;==============================================================
; 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,  28
         ; Make closure dbl_10
         PUSH  4
         CALL  min_caml_malloc
         ADD   ESP,  4
         MOV   [EBP-4],  EAX
         MOV   EDI,  EAX
         MOV   [EDI],  dbl_10
         ; Make closure inc_12
         PUSH  4
         CALL  min_caml_malloc
         ADD   ESP,  4
         MOV   [EBP-8],  EAX
         MOV   EDI,  EAX
         MOV   [EDI],  inc_12
         ; Make closure dec_14
         PUSH  4
         CALL  min_caml_malloc
         ADD   ESP,  4
         MOV   [EBP-12],  EAX
         MOV   EDI,  EAX
         MOV   [EDI],  dec_14
         ; Let Tf1_19 = 
         ; Apply direct compose_7
         PUSH  dword ptr [EBP-12]
         PUSH  dword ptr [EBP-4]
         CALL  compose_7
         ADD   ESP,  8
         MOV   [EBP-16],  EAX
         ; Let h_16 = 
         ; Apply direct compose_7
         PUSH  dword ptr [EBP-16]
         PUSH  dword ptr [EBP-8]
         CALL  compose_7
         ADD   ESP,  8
         MOV   [EBP-20],  EAX
         ; Let Ti2_18 = 
         ; Integer 123
         MOV   EAX,  123
         MOV   [EBP-24],  EAX
         ; Let Ti3_17 = 
         ; Apply closure h_16
         PUSH  ESI
         MOV   ESI,  [EBP-20]
         MOV   EAX, [ESI]
         PUSH  dword ptr [EBP-24]
         CALL  EAX
         ADD   ESP,  4
         POP   ESI
         MOV   [EBP-28],  EAX
         ; Apply direct min_caml_print_int
         PUSH  dword ptr [EBP-28]
         CALL  min_caml_print_int
         ADD   ESP,  4
         MOV   ESP,  EBP
         POP   EBP
         PUSH  0
         CALL  ExitProcess

;==============================================================
; Function composed_22:

composed_22 proc
         PUSH  EBP
         MOV   EBP,  ESP
         SUB   ESP,  4
         ; Let Ti6_24 = 
         ; Apply closure f_8
         PUSH  ESI
         MOV   ESI,  [ESI+4]
         MOV   EAX, [ESI]
         PUSH  dword ptr [EBP+8]
         CALL  EAX
         ADD   ESP,  4
         POP   ESI
         MOV   [EBP-4],  EAX
         ; Apply closure g_9
         MOV   ESI,  [ESI+8]
         MOV   EAX, [ESI]
         PUSH  dword ptr [EBP-4]
         CALL  EAX
         ADD   ESP,  4
         MOV   ESP,  EBP
         POP   EBP
         RET
composed_22 endp

;==============================================================
; Function compose_7:

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

;==============================================================
; Function dbl_10:

dbl_10 proc
         PUSH  EBP
         MOV   EBP,  ESP
         SUB   ESP,  0
         ; Add x_11 + x_11
         MOV   EAX,  [EBP+8]
         ADD   EAX,  [EBP+8]
         MOV   ESP,  EBP
         POP   EBP
         RET
dbl_10 endp

;==============================================================
; Function inc_12:

inc_12 proc
         PUSH  EBP
         MOV   EBP,  ESP
         SUB   ESP,  4
         ; Let Ti5_21 = 
         ; Integer 1
         MOV   EAX,  1
         MOV   [EBP-4],  EAX
         ; Add x_13 + Ti5_21
         MOV   EAX,  [EBP+8]
         ADD   EAX,  [EBP-4]
         MOV   ESP,  EBP
         POP   EBP
         RET
inc_12 endp

;==============================================================
; Function dec_14:

dec_14 proc
         PUSH  EBP
         MOV   EBP,  ESP
         SUB   ESP,  4
         ; Let Ti4_20 = 
         ; Integer 1
         MOV   EAX,  1
         MOV   [EBP-4],  EAX
         ; Sub x_15 - Ti4_20
         MOV   EAX,  [EBP+8]
         SUB   EAX,  [EBP-4]
         MOV   ESP,  EBP
         POP   EBP
         RET
dec_14 endp

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

END start

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

