;==============================================================
; 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 Ti1_10 = 
         ; Integer 3
         MOV   EAX,  3
         MOV   [EBP-4],  EAX
         ; Let Tf2_8 = 
         ; Apply direct make_adder_5
         PUSH  dword ptr [EBP-4]
         CALL  make_adder_5
         ADD   ESP,  4
         MOV   [EBP-8],  EAX
         ; Let Ti3_9 = 
         ; Integer 7
         MOV   EAX,  7
         MOV   [EBP-12],  EAX
         ; Let Ti4_7 = 
         ; Apply closure Tf2_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 adder_11:

adder_11 proc
         PUSH  EBP
         MOV   EBP,  ESP
         SUB   ESP,  0
         ; Add x_6 + y_12
         MOV   EAX,  [ESI+4]
         ADD   EAX,  [EBP+8]
         MOV   ESP,  EBP
         POP   EBP
         RET
adder_11 endp

;==============================================================
; Function make_adder_5:

make_adder_5 proc
         PUSH  EBP
         MOV   EBP,  ESP
         SUB   ESP,  4
         ; Make closure adder_11
         PUSH  8
         CALL  min_caml_malloc
         ADD   ESP,  4
         MOV   [EBP-4],  EAX
         MOV   EDI,  EAX
         MOV   [EDI],  adder_11
         MOV   EAX,  [EBP+8]
         MOV   [EDI+4],  EAX
         ; Var adder_11
         MOV   EAX,  [EBP-4]
         MOV   ESP,  EBP
         POP   EBP
         RET
make_adder_5 endp

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

END start

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

