;==============================================================
; Intel Asm
;==============================================================
         .486
         .model flat, stdcall
         option casemap :none
         include \masm32\include\windows.inc
         include \masm32\include\masm32.inc
         include \masm32\include\kernel32.inc
         include \masm32\macros\macros.asm

         includelib \masm32\lib\masm32.lib
         includelib \masm32\lib\kernel32.lib

;==============================================================
         .data
Txt db ?, 0

;==============================================================
; Entry point:
         .code
start:
         FINIT
         PUSH  EBP
         MOV   EBP,  ESP
         SUB   ESP,  16
         ; Let x_7 = 
         ; Integer 10
         MOV   EAX,  10
         MOV   [EBP-4],  EAX
         ; Make closure f_8
         PUSH  8
         CALL  min_caml_malloc
         ADD   ESP,  4
         MOV   [EBP-8],  EAX
         MOV   EDI,  EAX
         MOV   [EDI],  f_8
         MOV   EAX,  [EBP-4]
         MOV   [EDI+4],  EAX
         ; Let Ti1_11 = 
         ; Integer 123
         MOV   EAX,  123
         MOV   [EBP-12],  EAX
         ; Let Ti2_10 = 
         ; Apply closure f_8
         PUSH  ESI
         MOV   ESI,  [EBP-8]
         MOV   EAX, [ESI]
         PUSH  dword ptr [EBP-12]
         CALL  EAX
         ADD   ESP,  4
         POP   ESI
         MOV   [EBP-16],  EAX
         ; Apply direct min_caml_print_int
         PUSH  dword ptr [EBP-16]
         CALL  min_caml_print_int
         ADD   ESP,  4
         MOV   ESP,  EBP
         POP   EBP
         PUSH  0
         CALL  ExitProcess

;==============================================================
; Function f_8:

f_8 proc
         PUSH  EBP
         MOV   EBP,  ESP
         SUB   ESP,  16
         ; Let Ti3_12 = 
         ; Integer 0
         MOV   EAX,  0
         MOV   [EBP-4],  EAX
         ; If y_9 == Ti3_12
         MOV   EAX,  [EBP+8]
         CMP   EAX,  [EBP-4]
         JNE   else_16
         ; Integer 0
         MOV   EAX,  0
         MOV   ESP,  EBP
         POP   EBP
         RET
else_16:
         ; Let Ti4_15 = 
         ; Integer 1
         MOV   EAX,  1
         MOV   [EBP-8],  EAX
         ; Let Ti5_14 = 
         ; Sub y_9 - Ti4_15
         MOV   EAX,  [EBP+8]
         SUB   EAX,  [EBP-8]
         MOV   [EBP-12],  EAX
         ; Let Ti6_13 = 
         ; Apply closure f_8
         PUSH  ESI
         MOV   ESI,  ESI
         MOV   EAX, [ESI]
         PUSH  dword ptr [EBP-12]
         CALL  EAX
         ADD   ESP,  4
         POP   ESI
         MOV   [EBP-16],  EAX
         ; Add x_7 + Ti6_13
         MOV   EAX,  [ESI+4]
         ADD   EAX,  [EBP-16]
         MOV   ESP,  EBP
         POP   EBP
         RET
f_8 endp

;==============================================================
; need to copy min_caml_intel.asm from min-caml directory to output directoty
include min_caml_intel.asm

END start

;==============================================================

