Skip to content

Instantly share code, notes, and snippets.

@jlouis
Created August 10, 2010 14:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jlouis/517325 to your computer and use it in GitHub Desktop.
Save jlouis/517325 to your computer and use it in GitHub Desktop.
let rec even x =
match x with
| 0 -> true
| 1 -> false
| _ -> odd (x-1)
and odd x =
match x with
| 1 -> true
| 0 -> false
| _ -> even (x-1);;
@jlouis
Copy link
Author

jlouis commented Aug 10, 2010

       .section        .rodata.cst8,"a",@progbits
        .align  16
caml_negf_mask: .quad   0x8000000000000000, 0
        .align  16
caml_absf_mask: .quad   0x7FFFFFFFFFFFFFFF, 0xFFFFFFFFFFFFFFFF
        .data
        .globl  camlFoo__data_begin
camlFoo__data_begin:
        .text
        .globl  camlFoo__code_begin
camlFoo__code_begin:
        .data
        .quad   2048
        .globl  camlFoo
camlFoo:
        .space  16
        .data
        .quad   5367
camlFoo__3:
        .quad   camlFoo__even_58
        .quad   3
        .quad   3321
        .quad   camlFoo__odd_59
        .quad   3
        .data
        .quad   2300
camlFoo__1:
        .ascii  "Oh noes!\12"
        .space  6
        .byte   6
        .data
        .quad   1276
camlFoo__2:
        .ascii  "Yay!\12"
        .space  2
        .byte   2
        .text
        .align  16
        .globl  camlFoo__odd_59
camlFoo__odd_59:

.L102:
        cmpq    $1, %rax
        je      .L100
        cmpq    $3, %rax
        je      .L101
        addq    $-2, %rax
        jmp     camlFoo__even_58@PLT
        .align  4
.L101:
        movq    $3, %rax
        ret
        .align  4
.L100:
        movq    $1, %rax
        ret
        .type   camlFoo__odd_59,@function
        .size   camlFoo__odd_59,.-camlFoo__odd_59
        .text
        .align  16
        .globl  camlFoo__even_58
camlFoo__even_58:
.L105:
        cmpq    $1, %rax
        je      .L103
        cmpq    $3, %rax
        je      .L104
        addq    $-2, %rax
        jmp     camlFoo__odd_59@PLT
        .align  4
.L104:
        movq    $1, %rax
        ret
        .align  4
.L103:
        movq    $3, %rax
        ret
        .type   camlFoo__even_58,@function
        .size   camlFoo__even_58,.-camlFoo__even_58
        .text
        .align  16
        .globl  camlFoo__entry
camlFoo__entry:
        subq    $8, %rsp

L108:
        movq    camlFoo__3@GOTPCREL(%rip), %rax
        movq    camlFoo@GOTPCREL(%rip), %rbx
        movq    %rax, (%rbx)
        movq    camlFoo@GOTPCREL(%rip), %rbx
        addq    $24, %rax
        movq    %rax, 8(%rbx)
        movq    $9, %rax
        call    camlFoo__even_58@PLT
.L109:
        cmpq    $1, %rax
        je      .L107
        movq    camlFoo__2@GOTPCREL(%rip), %rbx
        jmp     .L106
.L107:
        movq    camlFoo__1@GOTPCREL(%rip), %rbx
.L106:
        movq    camlPervasives@GOTPCREL(%rip), %rax
        movq    184(%rax), %rax
        call    camlPervasives__output_string_215@PLT
.L110:
        movq    $1, %rax
        addq    $8, %rsp
        ret
        .type   camlFoo__entry,@function
        .size   camlFoo__entry,.-camlFoo__entry
        .data
        .text
        .globl  camlFoo__code_end
camlFoo__code_end:
        .data
        .globl  camlFoo__data_end
camlFoo__data_end:
        .long   0
        .globl  camlFoo__frametable
camlFoo__frametable:
        .quad   2
        .quad   .L110
        .word   17
        .word   0
        .align  8
        .long   (.L200000 - .) + 0xac000000
        .long   0x163150
        .quad   .L109
        .word   16
        .word   0
        .align  8

.L200000:
        .asciz  "pervasives.ml"
        .align  8
        .section .note.GNU-stack,"",%progbits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment