LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/beeper.h
// Function: beeper_tick
bool beeper_tick(beeper_t* bp) {
    /* generate a new sample? */
    bp->counter -= BEEPER_FIXEDPOINT_SCALE;
    if (bp->counter <= 0) {
        bp->counter += bp->period;
        bp->sample = _beeper_dcadjust(bp, (float)bp->state) * bp->mag;
        return true;
    }
    return false;
}

// Assembly:
movl 0x8(%rdi), %eax
leal -0x10(%rax), %ecx
movl %ecx, 0x8(%rdi)
cmpl $0x10, %eax
jg 0x38f7
pushq %rbp
movq %rsp, %rbp
addl 0x4(%rdi), %ecx
movl %ecx, 0x8(%rdi)
cvtsi2ssl (%rdi), %xmm0
movl 0x18(%rdi), %ecx
movss 0x14(%rdi), %xmm1
subss 0x1c(%rdi,%rcx,4), %xmm1
addss %xmm0, %xmm1
movss %xmm1, 0x14(%rdi)
movss %xmm0, 0x1c(%rdi,%rcx,4)
incl %ecx
andl $0x1ff, %ecx            # imm = 0x1FF
movl %ecx, 0x18(%rdi)
mulss 0xf718(%rip), %xmm1     # 0x13000
addss %xmm0, %xmm1
mulss 0xc(%rdi), %xmm1
movss %xmm1, 0x10(%rdi)
popq %rbp
cmpl $0x11, %eax
setl %al
retq
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/clk.h
// Function: clk_ticks_to_run
uint32_t clk_ticks_to_run(clk_t* clk, uint32_t micro_seconds) {
    CHIPS_ASSERT(clk && (micro_seconds > 0));
    int ticks = (int) ((clk->freq_hz * micro_seconds) / 1000000);
    clk->ticks_to_run = ticks - clk->overrun_ticks;
    if (clk->ticks_to_run < 1) {
        clk->ticks_to_run = 1;
    }
    return clk->ticks_to_run;
}

// Assembly:
testq %rdi, %rdi
je 0x3992
testl %esi, %esi
je 0x3992
movl %esi, %eax
imulq (%rdi), %rax
movabsq $0x431bde82d7b634db, %rcx # imm = 0x431BDE82D7B634DB
imulq %rcx
movq %rdx, %rcx
shrq $0x3f, %rcx
shrq $0x12, %rdx
addl %edx, %ecx
subl 0xc(%rdi), %ecx
cmpl $0x2, %ecx
movl $0x1, %eax
cmovgel %ecx, %eax
movl %eax, 0x8(%rdi)
retq
pushq %rbp
movq %rsp, %rbp
leaq 0x10354(%rip), %rdi     # 0x13cf1
leaq 0x10322(%rip), %rsi     # 0x13cc6
leaq 0x10361(%rip), %rcx     # 0x13d0c
movl $0x84, %edx
callq 0x30b0
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/kbd.h
// Function: kbd_register_modifier
void kbd_register_modifier(kbd_t* kbd, int layer, int column, int line) {
    CHIPS_ASSERT(kbd);
    CHIPS_ASSERT((column >= 0) && (column < KBD_MAX_COLUMNS));
    CHIPS_ASSERT((line >= 0) && (line < KBD_MAX_LINES));
    CHIPS_ASSERT((layer >= 0) && (layer < KBD_MAX_MOD_KEYS));
    kbd->mod_masks[layer] = (1<<(layer+KBD_MAX_COLUMNS+KBD_MAX_LINES)) | (1<<(column+KBD_MAX_LINES)) | (1<<line);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testq %rdi, %rdi
je 0x3a59
cmpl $0xc, %edx
jae 0x3a78
movl %ecx, %eax
cmpl $0xc, %ecx
jae 0x3a97
cmpl $0x4, %esi
jae 0x3ab6
movl $0x1000000, %r8d        # imm = 0x1000000
movl %esi, %ecx
shll %cl, %r8d
movl $0x1000, %r9d           # imm = 0x1000
movl %edx, %ecx
shll %cl, %r9d
orl %r8d, %r9d
btsl %eax, %r9d
movl %esi, %eax
movl %r9d, 0x410(%rdi,%rax,4)
popq %rbp
retq
leaq 0x102d9(%rip), %rdi     # 0x13d39
leaq 0x102d6(%rip), %rsi     # 0x13d3d
leaq 0x102f5(%rip), %rcx     # 0x13d63
movl $0xbc, %edx
callq 0x30b0
leaq 0x10317(%rip), %rdi     # 0x13d96
leaq 0x102b7(%rip), %rsi     # 0x13d3d
leaq 0x102d6(%rip), %rcx     # 0x13d63
movl $0xbd, %edx
callq 0x30b0
leaq 0x10319(%rip), %rdi     # 0x13db7
leaq 0x10298(%rip), %rsi     # 0x13d3d
leaq 0x102b7(%rip), %rcx     # 0x13d63
movl $0xbe, %edx
callq 0x30b0
leaq 0x10317(%rip), %rdi     # 0x13dd4
leaq 0x10279(%rip), %rsi     # 0x13d3d
leaq 0x10298(%rip), %rcx     # 0x13d63
movl $0xbf, %edx
callq 0x30b0
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/kbd.h
// Function: kbd_register_modifier_line
void kbd_register_modifier_line(kbd_t* kbd, int layer, int line) {
    CHIPS_ASSERT(kbd);
    CHIPS_ASSERT((line >= 0) && (line < KBD_MAX_LINES));
    CHIPS_ASSERT((layer >= 0) && (layer < KBD_MAX_MOD_KEYS));
    kbd->mod_masks[layer] = (1<<(layer+KBD_MAX_COLUMNS+KBD_MAX_LINES)) | (1<<line);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testq %rdi, %rdi
je 0x3aff
cmpl $0xc, %edx
jae 0x3b1e
cmpl $0x4, %esi
jae 0x3b3d
movl $0x1000000, %eax        # imm = 0x1000000
movl %esi, %ecx
shll %cl, %eax
btsl %edx, %eax
movl %esi, %ecx
movl %eax, 0x410(%rdi,%rcx,4)
popq %rbp
retq
leaq 0x10233(%rip), %rdi     # 0x13d39
leaq 0x10230(%rip), %rsi     # 0x13d3d
leaq 0x102de(%rip), %rcx     # 0x13df2
movl $0xc4, %edx
callq 0x30b0
leaq 0x10292(%rip), %rdi     # 0x13db7
leaq 0x10211(%rip), %rsi     # 0x13d3d
leaq 0x102bf(%rip), %rcx     # 0x13df2
movl $0xc5, %edx
callq 0x30b0
leaq 0x10290(%rip), %rdi     # 0x13dd4
leaq 0x101f2(%rip), %rsi     # 0x13d3d
leaq 0x102a0(%rip), %rcx     # 0x13df2
movl $0xc6, %edx
callq 0x30b0
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/kbd.h
// Function: kbd_register_modifier_column
void kbd_register_modifier_column(kbd_t* kbd, int layer, int column) {
    CHIPS_ASSERT(kbd);
    CHIPS_ASSERT((column >= 0) && (column < KBD_MAX_COLUMNS));
    CHIPS_ASSERT((layer >= 0) && (layer < KBD_MAX_MOD_KEYS));
    kbd->mod_masks[layer] = (1<<(layer+KBD_MAX_COLUMNS+KBD_MAX_LINES)) | (1<<(column+KBD_MAX_LINES));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testq %rdi, %rdi
je 0x3b92
cmpl $0xc, %edx
jae 0x3bb1
cmpl $0x4, %esi
jae 0x3bd0
movl $0x1000000, %eax        # imm = 0x1000000
movl %esi, %ecx
shll %cl, %eax
movl $0x1000, %r8d           # imm = 0x1000
movl %edx, %ecx
shll %cl, %r8d
orl %eax, %r8d
movl %esi, %eax
movl %r8d, 0x410(%rdi,%rax,4)
popq %rbp
retq
leaq 0x101a0(%rip), %rdi     # 0x13d39
leaq 0x1019d(%rip), %rsi     # 0x13d3d
leaq 0x1027e(%rip), %rcx     # 0x13e25
movl $0xcb, %edx
callq 0x30b0
leaq 0x101de(%rip), %rdi     # 0x13d96
leaq 0x1017e(%rip), %rsi     # 0x13d3d
leaq 0x1025f(%rip), %rcx     # 0x13e25
movl $0xcc, %edx
callq 0x30b0
leaq 0x101fd(%rip), %rdi     # 0x13dd4
leaq 0x1015f(%rip), %rsi     # 0x13d3d
leaq 0x10240(%rip), %rcx     # 0x13e25
movl $0xcd, %edx
callq 0x30b0
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/kbd.h
// Function: kbd_register_key
void kbd_register_key(kbd_t* kbd, int key, int column, int line, int mod_mask) {
    CHIPS_ASSERT(kbd);
    CHIPS_ASSERT((key >= 0) && (key < KBD_MAX_KEYS));
    CHIPS_ASSERT((column >= 0) && (column < KBD_MAX_COLUMNS));
    CHIPS_ASSERT((line >= 0) && (line < KBD_MAX_LINES));
    kbd->key_masks[key] = (mod_mask << (KBD_MAX_COLUMNS+KBD_MAX_LINES)) | (1<<(column+KBD_MAX_LINES)) | (1<<line);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testq %rdi, %rdi
je 0x3c2b
cmpl $0x100, %esi            # imm = 0x100
jae 0x3c4a
cmpl $0xc, %edx
jae 0x3c69
movl %ecx, %eax
cmpl $0xc, %ecx
jae 0x3c88
shll $0x18, %r8d
movl $0x1000, %r9d           # imm = 0x1000
movl %edx, %ecx
shll %cl, %r9d
btsl %eax, %r9d
orl %r8d, %r9d
movl %esi, %eax
movl %r9d, 0x10(%rdi,%rax,4)
popq %rbp
retq
leaq 0x10107(%rip), %rdi     # 0x13d39
leaq 0x10104(%rip), %rsi     # 0x13d3d
leaq 0x1021a(%rip), %rcx     # 0x13e5a
movl $0xd2, %edx
callq 0x30b0
leaq 0x10266(%rip), %rdi     # 0x13eb7
leaq 0x100e5(%rip), %rsi     # 0x13d3d
leaq 0x101fb(%rip), %rcx     # 0x13e5a
movl $0xd3, %edx
callq 0x30b0
leaq 0x10126(%rip), %rdi     # 0x13d96
leaq 0x100c6(%rip), %rsi     # 0x13d3d
leaq 0x101dc(%rip), %rcx     # 0x13e5a
movl $0xd4, %edx
callq 0x30b0
leaq 0x10128(%rip), %rdi     # 0x13db7
leaq 0x100a7(%rip), %rsi     # 0x13d3d
leaq 0x101bd(%rip), %rcx     # 0x13e5a
movl $0xd5, %edx
callq 0x30b0
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/kbd.h
// Function: kbd_update
void kbd_update(kbd_t* kbd, uint32_t frame_time_us) {
    CHIPS_ASSERT(kbd);
    kbd->cur_time += frame_time_us;
    /* check for sticky keys that should be released */
    for (int i = 0; i < KBD_MAX_PRESSED_KEYS; i++) {
        key_state_t* k = &kbd->key_buffer[i];
        if (k->released) {
            /* properly handle cur_time wraparound */
            if ((kbd->cur_time < k->pressed_time) ||
                (kbd->cur_time > (k->pressed_time + kbd->sticky_time))) {
                k->mask = 0;
                k->key = 0;
                k->pressed_time = 0;
                k->released = false;
            }
        }
    }
    _kbd_update_scanout_masks(kbd);
}

// Assembly:
testq %rdi, %rdi
je 0x3cf5
movl %esi, %eax
addq (%rdi), %rax
movq %rax, (%rdi)
movl $0x430, %ecx            # imm = 0x430
xorps %xmm0, %xmm0
cmpb $0x1, (%rdi,%rcx)
jne 0x3ce6
movq -0x8(%rdi,%rcx), %rdx
cmpq %rdx, %rax
jb 0x3cd7
movl 0x8(%rdi), %esi
addq %rsi, %rdx
cmpq %rdx, %rax
jbe 0x3ce6
leaq (%rdi,%rcx), %rdx
addq $-0x10, %rdx
movups %xmm0, (%rdx)
movb $0x0, 0x10(%rdx)
addq $0x18, %rcx
cmpq $0x490, %rcx            # imm = 0x490
je 0x3d18
jmp 0x3cbc
pushq %rbp
movq %rsp, %rbp
leaq 0x10039(%rip), %rdi     # 0x13d39
leaq 0x10036(%rip), %rsi     # 0x13d3d
leaq 0x1017f(%rip), %rcx     # 0x13e8d
movl $0x139, %edx            # imm = 0x139
callq 0x30b0
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/kbd.h
// Function: kbd_update_scanout_masks
static void _kbd_update_scanout_masks(kbd_t* kbd) {
    for (int line = 0; line < KBD_MAX_LINES; line++) {
        kbd->scanout_column_masks[line] = _kbd_test_columns(kbd, (1<<line));
    }
    for (int col = 0; col < KBD_MAX_COLUMNS; col++) {
        kbd->scanout_line_masks[col] = _kbd_test_lines(kbd, (1<<col));
    }
    kbd->cur_column_mask = 0;
    kbd->cur_scanout_line_mask = 0;
    kbd->cur_line_mask = 0;
    kbd->cur_scanout_column_mask = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
leaq 0x420(%rdi), %rax
xorl %edx, %edx
xorl %ecx, %ecx
movl $0x1, %esi
shll %cl, %esi
xorl %r8d, %r8d
notl %esi
xorl %r9d, %r9d
leaq (%r8,%r8,2), %r10
movl 0x4(%rax,%r10,8), %r10d
testl %r10d, %r10d
je 0x3da5
movl %r10d, %r11d
andl %esi, %r11d
movl %r10d, %ebx
shrl $0xc, %ebx
andl $0xfff, %ebx            # imm = 0xFFF
testl $0xfff, %r11d           # imm = 0xFFF
cmovnel %edx, %ebx
orl %ebx, %r9d
andl $0xf000000, %r10d       # imm = 0xF000000
je 0x3da5
xorl %r11d, %r11d
movl 0x410(%rdi,%r11,4), %ebx
testl %r10d, %ebx
je 0x3d9c
movl %ebx, %r14d
andl $0xfff, %r14d           # imm = 0xFFF
je 0x3d90
testl %esi, %r14d
jne 0x3d9c
shrl $0xc, %ebx
andl $0xfff, %ebx            # imm = 0xFFF
orl %ebx, %r9d
incq %r11
cmpq $0x4, %r11
jne 0x3d72
incq %r8
cmpq $0x4, %r8
jne 0x3d39
movw %r9w, 0x480(%rdi,%rcx,2)
incq %rcx
cmpq $0xc, %rcx
jne 0x3d2a
xorl %edx, %edx
xorl %ecx, %ecx
movl $0x1, %esi
shll %cl, %esi
xorl %r8d, %r8d
notl %esi
xorl %r9d, %r9d
leaq (%r8,%r8,2), %r10
movl 0x4(%rax,%r10,8), %r10d
testl %r10d, %r10d
je 0x3e4b
movl %r10d, %r11d
shrl $0xc, %r11d
andl %esi, %r11d
movl %r10d, %ebx
andl $0xfff, %ebx            # imm = 0xFFF
testl $0xfff, %r11d           # imm = 0xFFF
cmovnel %edx, %ebx
orl %ebx, %r9d
andl $0xf000000, %r10d       # imm = 0xF000000
je 0x3e4b
xorl %r11d, %r11d
movl 0x410(%rdi,%r11,4), %ebx
testl %r10d, %ebx
je 0x3e42
testl $0xfff000, %ebx         # imm = 0xFFF000
je 0x3e3f
movl %ebx, %r14d
shrl $0xc, %r14d
andl %esi, %r14d
testl $0xfff, %r14d           # imm = 0xFFF
jne 0x3e42
andl $0xfff, %ebx            # imm = 0xFFF
orl %ebx, %r9d
incq %r11
cmpq $0x4, %r11
jne 0x3e11
incq %r8
cmpq $0x4, %r8
jne 0x3dd7
movw %r9w, 0x498(%rdi,%rcx,2)
incq %rcx
cmpq $0xc, %rcx
jne 0x3dc8
movq $0x0, 0x4b0(%rdi)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/kbd.h
// Function: kbd_key_down
void kbd_key_down(kbd_t* kbd, int key) {
    CHIPS_ASSERT(kbd && (key >= 0) && (key < KBD_MAX_KEYS));
    /* first check if the key is already in the key buffer,
       if yes, just update its pressed-frame and return,
       otherwise find a new, free keybuffer slot
    */
    for (int i = 0; i < KBD_MAX_PRESSED_KEYS; i++) {
        key_state_t* k = &kbd->key_buffer[i];
        if (k->key == key) {
            k->pressed_time = kbd->cur_time;
            _kbd_update_scanout_masks(kbd);
            return;
        }
    }
    for (int i = 0; i < KBD_MAX_PRESSED_KEYS; i++) {
        key_state_t* k = &kbd->key_buffer[i];
        if (0 == k->mask) {
            k->key = key;
            k->mask = kbd->key_masks[key];
            k->pressed_time = kbd->cur_time;
            k->released = false;
            _kbd_update_scanout_masks(kbd);
            return;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x3f3d
movl %esi, %r14d
cmpl $0xff, %esi
ja 0x3f3d
movq %rdi, %rbx
cmpl %r14d, 0x420(%rdi)
jne 0x3eb4
movq (%rbx), %rax
movq %rax, 0x428(%rbx)
jmp 0x3f2b
leaq 0x438(%rbx), %rax
movq $-0x1, %r15
cmpq $0x2, %r15
je 0x3eec
incq %r15
leaq 0x18(%rax), %rcx
cmpl %r14d, (%rax)
movq %rcx, %rax
jne 0x3ec2
movq (%rbx), %rax
movq %rax, -0x10(%rcx)
movq %rbx, %rdi
callq 0x3d18
cmpq $0x2, %r15
jbe 0x3f04
movl $0x420, %eax            # imm = 0x420
cmpl $0x0, 0x4(%rbx,%rax)
je 0x3f0f
addq $0x18, %rax
cmpq $0x480, %rax            # imm = 0x480
jne 0x3ef1
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl %r14d, (%rbx,%rax)
movl %r14d, %ecx
movl 0x10(%rbx,%rcx,4), %ecx
movl %ecx, 0x4(%rbx,%rax)
movq (%rbx), %rcx
movq %rcx, 0x8(%rbx,%rax)
movb $0x0, 0x10(%rbx,%rax)
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x3d18
leaq 0xff6c(%rip), %rdi      # 0x13eb0
leaq 0xfdf2(%rip), %rsi      # 0x13d3d
leaq 0xff81(%rip), %rcx      # 0x13ed3
movl $0x14d, %edx            # imm = 0x14D
callq 0x30b0
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/kbd.h
// Function: kbd_key_up
void kbd_key_up(kbd_t* kbd, int key) {
    CHIPS_ASSERT(kbd && (key >= 0) && (key < KBD_MAX_KEYS));
    /* find the key in the keybuffer, just set released_frame */
    for (int i = 0; i < KBD_MAX_PRESSED_KEYS; i++) {
        key_state_t* k = &kbd->key_buffer[i];
        if (key == k->key) {
            k->released = true;
        }
    }
    _kbd_update_scanout_masks(kbd);
}

// Assembly:
testq %rdi, %rdi
je 0x3f8a
cmpl $0xff, %esi
ja 0x3f8a
movl $0x430, %eax            # imm = 0x430
cmpl %esi, -0x10(%rdi,%rax)
jne 0x3f78
movb $0x1, (%rdi,%rax)
addq $0x18, %rax
cmpq $0x490, %rax            # imm = 0x490
je 0x3d18
jmp 0x3f6e
pushq %rbp
movq %rsp, %rbp
leaq 0xff1b(%rip), %rdi      # 0x13eb0
leaq 0xfda1(%rip), %rsi      # 0x13d3d
leaq 0xff50(%rip), %rcx      # 0x13ef3
movl $0x168, %edx            # imm = 0x168
callq 0x30b0
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/kbd.h
// Function: kbd_test_lines
uint16_t kbd_test_lines(kbd_t* kbd, uint16_t column_mask) {
    if (column_mask != kbd->cur_column_mask) {
        kbd->cur_column_mask = column_mask;
        kbd->cur_scanout_line_mask = 0;
        for (int col = 0; col < KBD_MAX_COLUMNS; col++) {
            if (column_mask & (1<<col)) {
                kbd->cur_scanout_line_mask |= kbd->scanout_line_masks[col];
            }
        }
    }
    return kbd->cur_scanout_line_mask;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpw %si, 0x4b0(%rdi)
je 0x3fe9
movw %si, 0x4b0(%rdi)
movw $0x0, 0x4b2(%rdi)
xorl %eax, %eax
btl %eax, %esi
jae 0x3fe0
movzwl 0x498(%rdi,%rax,2), %ecx
orw %cx, 0x4b2(%rdi)
incq %rax
cmpq $0xc, %rax
jne 0x3fcc
movzwl 0x4b2(%rdi), %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/kbd.h
// Function: kbd_test_columns
uint16_t kbd_test_columns(kbd_t* kbd, uint16_t line_mask) {
    if (line_mask != kbd->cur_line_mask) {
        kbd->cur_line_mask = line_mask;
        kbd->cur_scanout_column_mask = 0;
        for (int line = 0; line < KBD_MAX_COLUMNS; line++) {
            if (line_mask & (1<<line)) {
                kbd->cur_scanout_column_mask |= kbd->scanout_column_masks[line];
            }
        }
    }
    return kbd->cur_scanout_column_mask;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpw %si, 0x4b4(%rdi)
je 0x402e
movw %si, 0x4b4(%rdi)
movw $0x0, 0x4b6(%rdi)
xorl %eax, %eax
btl %eax, %esi
jae 0x4025
movzwl 0x480(%rdi,%rax,2), %ecx
orw %cx, 0x4b6(%rdi)
incq %rax
cmpq $0xc, %rax
jne 0x4011
movzwl 0x4b6(%rdi), %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/mem.h
// Function: mem_init
void mem_init(mem_t* m) {
    CHIPS_ASSERT(m);
    memset(m, 0, sizeof(*m));
    memset(&m->unmapped_page, 0xFF, sizeof(m->unmapped_page));
    mem_unmap_all(m);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x40c3
movq %rdi, %rbx
xorl %r14d, %r14d
movl $0x1c00, %edx           # imm = 0x1C00
xorl %esi, %esi
callq 0x30e0
leaq 0x1400(%rbx), %rdi
movl $0x400, %edx            # imm = 0x400
movl $0xff, %esi
callq 0x30e0
movl $0x1000, %edx           # imm = 0x1000
movq %rbx, %rdi
xorl %esi, %esi
callq 0x30e0
movq %rbx, %rdi
movl %r14d, %esi
callq 0x43a2
incl %r14d
cmpl $0x40, %r14d
jne 0x40aa
popq %rbx
popq %r14
popq %rbp
retq
leaq 0xfe47(%rip), %rdi      # 0x13f11
leaq 0xfe42(%rip), %rsi      # 0x13f13
leaq 0xfe45(%rip), %rcx      # 0x13f1d
movl $0x10e, %edx            # imm = 0x10E
callq 0x30b0
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/mem.h
// Function: mem_unmap_all
void mem_unmap_all(mem_t* m) {
    for (int layer_index = 0; layer_index < MEM_NUM_LAYERS; layer_index++) {
        for (int page_index = 0; page_index < MEM_NUM_PAGES; page_index++) {
            mem_page_t* page = &m->layers[layer_index][page_index];
            page->read_ptr = 0; 
            page->write_ptr = 0;
        }
    }
    for (int page_index = 0; page_index < MEM_NUM_PAGES; page_index++) {
        _mem_update_page_table(m, page_index);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
movl $0x1000, %edx           # imm = 0x1000
xorl %esi, %esi
callq 0x30e0
movq %rbx, %rdi
movl %r14d, %esi
callq 0x43a2
incl %r14d
cmpl $0x40, %r14d
jne 0x40fb
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/mem.h
// Function: mem_map
static void _mem_map(mem_t* m, int layer, uint16_t addr, uint32_t size, const uint8_t* read_ptr, uint8_t* write_ptr) {
    CHIPS_ASSERT(m);
    CHIPS_ASSERT((layer >= 0) && (layer < MEM_NUM_LAYERS));
    CHIPS_ASSERT((addr & MEM_PAGE_MASK) == 0);
    CHIPS_ASSERT((size & MEM_PAGE_MASK) == 0);
    CHIPS_ASSERT(size <= MEM_ADDR_RANGE);
    const int num = size>>MEM_PAGE_SHIFT;
    CHIPS_ASSERT(num <= MEM_NUM_PAGES);
    for (int i = 0; i < num; i++) {
        const uint16_t offset = i * MEM_PAGE_SIZE;
        /* the page_index will wrap-around */
        const uint16_t page_index = ((addr+offset) & MEM_ADDR_MASK) >> MEM_PAGE_SHIFT;
        CHIPS_ASSERT(page_index <= MEM_NUM_PAGES);
        mem_page_t* page = &m->layers[layer][page_index];
        page->read_ptr = read_ptr + offset;
        if (0 != write_ptr) {
            page->write_ptr = write_ptr + offset;
        }
        else {
            page->write_ptr = m->junk_page;
        }
        _mem_update_page_table(m, page_index);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rdi, %rdi
je 0x4213
cmpl $0x4, %esi
jae 0x4232
movl %edx, %r12d
testl $0x3ff, %edx            # imm = 0x3FF
jne 0x4251
testl $0x3ff, %ecx            # imm = 0x3FF
jne 0x4270
cmpl $0x10001, %ecx          # imm = 0x10001
jae 0x428f
testl %ecx, %ecx
je 0x4204
movq %r9, %rbx
movq %r8, %r14
movq %rdi, %r15
shrl $0xa, %ecx
movl %esi, %eax
leaq 0x1800(%rdi), %rdx
movq %rdx, -0x38(%rbp)
shlq $0xa, %rax
addq %rdi, %rax
movq %rax, -0x40(%rbp)
movq %r9, %r13
movl %ecx, -0x2c(%rbp)
movzwl %r12w, %r12d
movl %r12d, %esi
shrl $0xa, %esi
movl %esi, %eax
shll $0x4, %eax
testq %rbx, %rbx
movq -0x40(%rbp), %rdx
movq %r14, (%rax,%rdx)
movq %r13, %rcx
cmoveq -0x38(%rbp), %rcx
movq %rcx, 0x8(%rax,%rdx)
movq %r15, %rdi
callq 0x43a2
movl -0x2c(%rbp), %ecx
addl $0x400, %r12d           # imm = 0x400
movl $0x400, %eax            # imm = 0x400
addq %rax, %r14
addq %rax, %r13
decl %ecx
jne 0x41b9
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xfcf7(%rip), %rdi      # 0x13f11
leaq 0xfcf2(%rip), %rsi      # 0x13f13
leaq 0x10233(%rip), %rcx     # 0x1445b
movl $0x12a, %edx            # imm = 0x12A
callq 0x30b0
leaq 0xfb9b(%rip), %rdi      # 0x13dd4
leaq 0xfcd3(%rip), %rsi      # 0x13f13
leaq 0x10214(%rip), %rcx     # 0x1445b
movl $0x12b, %edx            # imm = 0x12B
callq 0x30b0
leaq 0x1024f(%rip), %rdi     # 0x144a7
leaq 0xfcb4(%rip), %rsi      # 0x13f13
leaq 0x101f5(%rip), %rcx     # 0x1445b
movl $0x12c, %edx            # imm = 0x12C
callq 0x30b0
leaq 0x1024c(%rip), %rdi     # 0x144c3
leaq 0xfc95(%rip), %rsi      # 0x13f13
leaq 0x101d6(%rip), %rcx     # 0x1445b
movl $0x12d, %edx            # imm = 0x12D
callq 0x30b0
leaq 0x10249(%rip), %rdi     # 0x144df
leaq 0xfc76(%rip), %rsi      # 0x13f13
leaq 0x101b7(%rip), %rcx     # 0x1445b
movl $0x12e, %edx            # imm = 0x12E
callq 0x30b0
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/mem.h
// Function: mem_unmap_layer
void mem_unmap_layer(mem_t* m, int layer) {
    CHIPS_ASSERT(m);
    CHIPS_ASSERT((layer >= 0) && (layer < MEM_NUM_LAYERS));
    for (int page_index = 0; page_index < MEM_NUM_PAGES; page_index++) {
        mem_page_t* page = &m->layers[layer][page_index];
        page->read_ptr = 0; 
        page->write_ptr = 0;
        _mem_update_page_table(m, page_index);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x4364
cmpl $0x3, %esi
ja 0x4383
movq %rdi, %rbx
movl %esi, %r15d
shlq $0xa, %r15
addq %rdi, %r15
xorl %r14d, %r14d
xorps %xmm0, %xmm0
movups %xmm0, (%r15)
movq %rbx, %rdi
movl %r14d, %esi
callq 0x43a2
incq %r14
addq $0x10, %r15
cmpq $0x40, %r14
jne 0x433a
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0xfba6(%rip), %rdi      # 0x13f11
leaq 0xfba1(%rip), %rsi      # 0x13f13
leaq 0xfca1(%rip), %rcx      # 0x1401a
movl $0x152, %edx            # imm = 0x152
callq 0x30b0
leaq 0xfa4a(%rip), %rdi      # 0x13dd4
leaq 0xfb82(%rip), %rsi      # 0x13f13
leaq 0xfc82(%rip), %rcx      # 0x1401a
movl $0x153, %edx            # imm = 0x153
callq 0x30b0
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/mem.h
// Function: mem_update_page_table
static void _mem_update_page_table(mem_t* m, int page_index) {
    /* find highest priority layer which maps this memory page */
    int layer_index;
    for (layer_index = 0; layer_index < MEM_NUM_LAYERS; layer_index++) {
        if (m->layers[layer_index][page_index].read_ptr) {
            /* found highest priority layer with valid mapping */
            break;
        }
    }
    if (layer_index != MEM_NUM_LAYERS) { 
        /* found a valid mapping */
        m->page_table[page_index] = m->layers[layer_index][page_index];
    }
    else {
        /* no mapping exists for this page, set to special 'unmapped page' */
        m->page_table[page_index].read_ptr = m->unmapped_page;
        m->page_table[page_index].write_ptr = m->junk_page;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movslq %esi, %rax
shlq $0x4, %rax
leaq (%rdi,%rax), %rdx
xorl %ecx, %ecx
cmpq $0x0, (%rdx)
jne 0x43ce
incq %rcx
addq $0x400, %rdx            # imm = 0x400
cmpq $0x4, %rcx
jne 0x43b3
movl $0x4, %ecx
cmpl $0x4, %ecx
jne 0x43f3
leaq 0x1400(%rdi), %rcx
movq %rcx, 0x1000(%rdi,%rax)
leaq 0x1800(%rdi), %rcx
movq %rcx, 0x1008(%rdi,%rax)
jmp 0x4409
leaq (%rdi,%rax), %rdx
movl %ecx, %ecx
shlq $0xa, %rcx
movups (%rcx,%rdx), %xmm0
movups %xmm0, 0x1000(%rdi,%rax)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/mem.h
// Function: mem_layer_rd
uint8_t mem_layer_rd(mem_t* mem, int layer, uint16_t addr) {
    CHIPS_ASSERT((layer >= 0) && (layer < MEM_NUM_LAYERS));
    if (mem->layers[layer][addr>>MEM_PAGE_SHIFT].read_ptr) {
        return mem->layers[layer][addr>>MEM_PAGE_SHIFT].read_ptr[addr&MEM_PAGE_MASK];
    }
    else {
        return 0xFF;
    }
}

// Assembly:
cmpl $0x4, %esi
jae 0x44c0
movl %esi, %ecx
movzwl %dx, %eax
shlq $0xa, %rcx
addq %rcx, %rdi
movl %eax, %ecx
shrl $0x6, %ecx
andl $-0x10, %ecx
movq (%rcx,%rdi), %rcx
testq %rcx, %rcx
je 0x44bd
andl $0x3ff, %eax            # imm = 0x3FF
movb (%rcx,%rax), %al
retq
movb $-0x1, %al
retq
pushq %rbp
movq %rsp, %rbp
leaq 0xf909(%rip), %rdi      # 0x13dd4
leaq 0xfa41(%rip), %rsi      # 0x13f13
leaq 0xfb8c(%rip), %rcx      # 0x14065
movl $0x175, %edx            # imm = 0x175
callq 0x30b0
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/z80.h
// Function: z80_init
void z80_init(z80_t* cpu, const z80_desc_t* desc) {
    CHIPS_ASSERT(_FA == 0);
    CHIPS_ASSERT(cpu && desc);
    CHIPS_ASSERT(desc->tick_cb);
    memset(cpu, 0, sizeof(*cpu));
    z80_reset(cpu);
    cpu->tick_cb = desc->tick_cb;
    cpu->user_data = desc->user_data;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
testq %rdi, %rdi
je 0x482a
testq %rsi, %rsi
je 0x482a
cmpq $0x0, (%rsi)
je 0x4849
pxor %xmm0, %xmm0
movdqu %xmm0, 0x10(%rdi)
movdqu %xmm0, (%rdi)
movdqu %xmm0, 0x20(%rdi)
movdqu %xmm0, 0x40(%rdi)
movdqu %xmm0, 0x30(%rdi)
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, 0x8(%rdi)
movq $-0x1, 0x18(%rdi)
movabsq $-0xffffffffff0020, %rax # imm = 0xFF0000000000FFE0
andq %rax, 0x20(%rdi)
movq (%rsi), %rax
movq %rax, (%rdi)
movq 0x8(%rsi), %rax
movq %rax, 0x30(%rdi)
popq %rbp
retq
leaq 0xf894(%rip), %rdi      # 0x140c5
leaq 0xf899(%rip), %rsi      # 0x140d1
leaq 0xf89c(%rip), %rcx      # 0x140db
movl $0x2c7, %edx            # imm = 0x2C7
callq 0x30b0
leaq 0xf8b6(%rip), %rdi      # 0x14106
leaq 0xf87a(%rip), %rsi      # 0x140d1
leaq 0xf87d(%rip), %rcx      # 0x140db
movl $0x2c8, %edx            # imm = 0x2C8
callq 0x30b0
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/zx.h
// Function: zx_init_memory_map
static void _zx_init_memory_map(zx_t* sys) {
    mem_init(&sys->mem);
    if (sys->type == ZX_TYPE_128) {
        mem_map_ram(&sys->mem, 0, 0x4000, 0x4000, sys->ram[5]);
        mem_map_ram(&sys->mem, 0, 0x8000, 0x4000, sys->ram[2]);
        mem_map_ram(&sys->mem, 0, 0xC000, 0x4000, sys->ram[0]);
        mem_map_rom(&sys->mem, 0, 0x0000, 0x4000, sys->rom[0]);
    }
    else {
        mem_map_ram(&sys->mem, 0, 0x4000, 0x4000, sys->ram[0]);
        mem_map_ram(&sys->mem, 0, 0x8000, 0x4000, sys->ram[1]);
        mem_map_ram(&sys->mem, 0, 0xC000, 0x4000, sys->ram[2]);
        mem_map_rom(&sys->mem, 0, 0x0000, 0x4000, sys->rom[0]);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1610(%rdi), %r14
xorl %r15d, %r15d
movl $0x1c00, %edx           # imm = 0x1C00
movq %r14, %rdi
xorl %esi, %esi
callq 0x30e0
leaq 0x2a10(%rbx), %rdi
movl $0x400, %edx            # imm = 0x400
movl $0xff, %esi
callq 0x30e0
movl $0x1000, %edx           # imm = 0x1000
movq %r14, %rdi
xorl %esi, %esi
callq 0x30e0
movq %r14, %rdi
movl %r15d, %esi
callq 0x43a2
incl %r15d
cmpl $0x40, %r15d
jne 0x110a7
leaq 0x4230(%rbx), %r15
cmpl $0x1, 0x1114(%rbx)
jne 0x1111e
leaq 0x18230(%rbx), %r8
movq %r14, %rdi
xorl %esi, %esi
movl $0x4000, %edx           # imm = 0x4000
movl $0x4000, %ecx           # imm = 0x4000
movq %r8, %r9
callq 0x4144
leaq 0xc230(%rbx), %r8
movq %r14, %rdi
xorl %esi, %esi
movl $0x8000, %edx           # imm = 0x8000
movl $0x4000, %ecx           # imm = 0x4000
movq %r8, %r9
callq 0x4144
movq %r14, %rdi
xorl %esi, %esi
movl $0xc000, %edx           # imm = 0xC000
movl $0x4000, %ecx           # imm = 0x4000
movq %r15, %r8
movq %r15, %r9
jmp 0x1116f
movq %r14, %rdi
xorl %esi, %esi
movl $0x4000, %edx           # imm = 0x4000
movl $0x4000, %ecx           # imm = 0x4000
movq %r15, %r8
movq %r15, %r9
callq 0x4144
leaq 0x8230(%rbx), %r8
movq %r14, %rdi
xorl %esi, %esi
movl $0x8000, %edx           # imm = 0x8000
movl $0x4000, %ecx           # imm = 0x4000
movq %r8, %r9
callq 0x4144
leaq 0xc230(%rbx), %r8
movq %r14, %rdi
xorl %esi, %esi
movl $0xc000, %edx           # imm = 0xC000
movl $0x4000, %ecx           # imm = 0x4000
movq %r8, %r9
callq 0x4144
addq $0x24230, %rbx          # imm = 0x24230
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
movl $0x4000, %ecx           # imm = 0x4000
movq %rbx, %r8
xorl %r9d, %r9d
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x4144
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/zx.h
// Function: zx_reset
void zx_reset(zx_t* sys) {
    CHIPS_ASSERT(sys && sys->valid);
    z80_reset(&sys->cpu);
    beeper_reset(&sys->beeper);
    if (sys->type == ZX_TYPE_128) {
        ay38910_reset(&sys->ay);
    }
    sys->memory_paging_disabled = false;
    sys->kbd_joymask = 0;
    sys->joy_joymask = 0;
    sys->last_fe_out = 0;
    sys->scanline_counter = sys->scanline_period;
    sys->scanline_y = 0;
    sys->blink_counter = 0;
    if (sys->type == ZX_TYPE_48K) {
        sys->display_ram_bank = 0;
    }
    else {
        sys->display_ram_bank = 5;
    }
    _zx_init_memory_map(sys);
    z80_set_pc(&sys->cpu, 0x0000);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x112fb
movq %rdi, %rbx
cmpb $0x0, 0x1110(%rdi)
je 0x112fb
pcmpeqd %xmm0, %xmm0
movdqu %xmm0, 0x8(%rbx)
movq $-0x1, 0x18(%rbx)
movabsq $-0xffffffffff0020, %rax # imm = 0xFF0000000000FFE0
andq %rax, 0x20(%rbx)
xorl %eax, %eax
movl %eax, 0x50(%rbx)
movl 0x54(%rbx), %ecx
movl %ecx, 0x58(%rbx)
movl %eax, 0x60(%rbx)
cmpl $0x1, 0x1114(%rbx)
jne 0x112a4
leaq 0x870(%rbx), %rdi
pxor %xmm0, %xmm0
movdqu %xmm0, 0x890(%rbx)
movq $0x0, 0x89d(%rbx)
callq 0x33b0
xorl %eax, %eax
movb %al, 0x8e8(%rbx)
movb %al, 0x8ea(%rbx)
movb 0x8a2(%rbx), %al
andb $0x9, %al
cmpb $0x8, %al
setne 0x8e9(%rbx)
xorl %r14d, %r14d
movw %r14w, 0x111c(%rbx)
movb $0x0, 0x111e(%rbx)
movw %r14w, 0x1125(%rbx)
movl 0x1130(%rbx), %eax
movl %eax, 0x1134(%rbx)
movl $0x0, 0x1138(%rbx)
xorl %eax, %eax
cmpl $0x0, 0x1114(%rbx)
setne %al
leal (%rax,%rax,4), %eax
movl %eax, 0x113c(%rbx)
movq %rbx, %rdi
callq 0x1105c
movw %r14w, 0x22(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x2f9b(%rip), %rdi      # 0x1429d
leaq 0x2e61(%rip), %rsi      # 0x1416a
leaq 0x2fb7(%rip), %rcx      # 0x142c7
movl $0x133, %edx            # imm = 0x133
callq 0x30b0
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/zx.h
// Function: zx_exec
void zx_exec(zx_t* sys, uint32_t micro_seconds) {
    CHIPS_ASSERT(sys && sys->valid);
    uint32_t ticks_to_run = clk_ticks_to_run(&sys->clk, micro_seconds);
    uint32_t ticks_executed = z80_exec(&sys->cpu, ticks_to_run);
    clk_ticks_executed(&sys->clk, ticks_executed);
    kbd_update(&sys->kbd, micro_seconds);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x11372
movq %rdi, %r14
cmpb $0x0, 0x1110(%rdi)
je 0x11372
movl %esi, %ebx
leaq 0x1148(%r14), %rdi
callq 0x30a0
movq %r14, %rdi
movl %eax, %esi
callq 0x3030
xorl %ecx, %ecx
subl 0x1150(%r14), %eax
cmovlel %ecx, %eax
movl %eax, 0x1154(%r14)
addq $0x1158, %r14           # imm = 0x1158
movq %r14, %rdi
movl %ebx, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x31a0
leaq 0x2f24(%rip), %rdi      # 0x1429d
leaq 0x2dea(%rip), %rsi      # 0x1416a
leaq 0x2f56(%rip), %rcx      # 0x142dd
movl $0x14b, %edx            # imm = 0x14B
callq 0x30b0
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/main.c
// Function: retro_set_environment
void retro_set_environment(retro_environment_t const cb) {
    zx48k.env_cb = cb;

    bool yes = true;
    cb(RETRO_ENVIRONMENT_SET_SUPPORT_NO_GAME, &yes);

    struct retro_get_proc_address_interface get_proc_if = {zx48k_get_proc};
    cb(RETRO_ENVIRONMENT_SET_PROC_ADDRESS_CALLBACK, &get_proc_if);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq %rdi, 0x8a3e0(%rip)     # 0x9c378
leaq -0x9(%rbp), %rsi
movb $0x1, (%rsi)
movl $0x12, %edi
callq *%rbx
leaq 0x15(%rip), %rax        # 0x11fc2
leaq -0x18(%rbp), %rsi
movq %rax, (%rsi)
movl $0x21, %edi
callq *%rbx
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/main.c
// Function: retro_init
void retro_init() {
    zx48k.log_cb = dummy_log;

    struct retro_log_callback log;

    if (zx48k.env_cb(RETRO_ENVIRONMENT_GET_LOG_INTERFACE, &log)) {
        zx48k.log_cb = log.log;
    }

    zx48k_reset();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
leaq 0x30(%rip), %rax        # 0x1205f
movq %rax, 0x8a33a(%rip)     # 0x9c370
leaq -0x8(%rbp), %rsi
movl $0x1b, %edi
callq *0x8a333(%rip)          # 0x9c378
testb %al, %al
je 0x12054
movq -0x8(%rbp), %rax
movq %rax, 0x8a31c(%rip)     # 0x9c370
callq 0x12065
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/main.c
// Function: zx48k_reset
static void zx48k_reset(void) {
    zx_init(&zx48k.zx, &(zx_desc_t) {
        .type = ZX_TYPE_48K,
        .joystick_type = ZX_JOYSTICKTYPE_KEMPSTON,
        .pixel_buffer = zx48k.pixel_buffer,
        .pixel_buffer_size = sizeof(zx48k.pixel_buffer),
        .user_data = NULL,
        .audio_cb = zx48k_audio_cb,
        .audio_num_samples = ZX_DEFAULT_AUDIO_SAMPLES,
        .audio_sample_rate = 44100,
        .rom_zx48k = rom,
        .rom_zx48k_size = rom_len
    });

    /* Keep these around for the video callback */
    zx48k.width = zx_display_width(&zx48k.zx);
    zx48k.height = zx_display_height(&zx48k.zx);

    /* Reset the keyboard and register our own keys */
    zx48k.key_states = 0;
    kbd_init(&zx48k.zx.kbd, 1);

    int code = 128;

    for (int col = 0; col < 8; col++) {
        for (int row = 0; row < 5; row++, code++) {
            kbd_register_key(&zx48k.zx.kbd, code, col, row, 0);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x60, %rsp
movabsq $0x100000000, %rax      # imm = 0x100000000
leaq -0x80(%rbp), %rsi
movq %rax, (%rsi)
leaq 0x3a2cc(%rip), %rax     # 0x4c358
movq %rax, 0x8(%rsi)
leaq 0xa089(%rip), %rdi      # 0x1c120
movl $0x50000, 0x10(%rsi)    # imm = 0x50000
xorl %ebx, %ebx
movq %rbx, 0x18(%rsi)
leaq 0x689(%rip), %rax       # 0x12734
movq %rax, 0x20(%rsi)
movsd 0xf89(%rip), %xmm0      # 0x13040
movups %xmm0, 0x28(%rsi)
leaq 0x604e(%rip), %rax      # 0x18110
movq %rax, 0x38(%rsi)
movl $0x4000, 0x40(%rsi)     # imm = 0x4000
xorps %xmm0, %xmm0
movups %xmm0, 0x48(%rsi)
movq %rbx, 0x58(%rsi)
callq 0x3070
movabsq $0x10000000140, %rax    # imm = 0x10000000140
movq %rax, 0x8a26a(%rip)     # 0x9c358
movq %rbx, 0x3a25b(%rip)     # 0x4c350
leaq 0xb17c(%rip), %r14      # 0x1d278
movl $0x4b8, %edx            # imm = 0x4B8
movq %r14, %rdi
xorl %esi, %esi
callq 0x30e0
movl $0x411b, 0xb16b(%rip)   # imm = 0x411B
movl $0x80, %r12d
xorl %r15d, %r15d
leal (%r12,%r15), %esi
movq %r14, %rdi
movl %ebx, %edx
movl %r15d, %ecx
xorl %r8d, %r8d
callq 0x3160
incl %r15d
cmpl $0x5, %r15d
jne 0x1211e
incl %ebx
addl %r15d, %r12d
cmpl $0x8, %ebx
jne 0x1211b
addq $0x60, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/main.c
// Function: retro_get_system_info
void retro_get_system_info(struct retro_system_info* const info) {
    info->library_name = "zx48k";
    info->library_version = "0.0.1";
    info->need_fullpath = false;
    info->block_extract = false;
    info->valid_extensions = "z80";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x2280(%rip), %rax      # 0x14409
movq %rax, (%rdi)
leaq 0x227c(%rip), %rax      # 0x1440f
movq %rax, 0x8(%rdi)
movw $0x0, 0x18(%rdi)
leaq 0x2271(%rip), %rax      # 0x14415
movq %rax, 0x10(%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/main.c
// Function: retro_get_system_av_info
void retro_get_system_av_info(struct retro_system_av_info* const info) {
    info->geometry.base_width = zx48k.width;
    info->geometry.base_height = zx48k.height;
    info->geometry.max_width = zx48k.width;
    info->geometry.max_height = zx48k.height;
    info->geometry.aspect_ratio = 0.0f;
    info->timing.fps = ZX48K_FRAMES_PER_SECOND;
    info->timing.sample_rate = 44100.0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl 0x8a1a4(%rip), %eax     # 0x9c358
movl %eax, (%rdi)
movl 0x8a1a0(%rip), %ecx     # 0x9c35c
movl %ecx, 0x4(%rdi)
movl %eax, 0x8(%rdi)
movl %ecx, 0xc(%rdi)
movl $0x0, 0x10(%rdi)
movabsq $0x4049000000000000, %rax # imm = 0x4049000000000000
movq %rax, 0x18(%rdi)
movabsq $0x40e5888000000000, %rax # imm = 0x40E5888000000000
movq %rax, 0x20(%rdi)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/main.c
// Function: retro_load_game
bool retro_load_game(struct retro_game_info const* const info) {
    if (info == NULL) {
        return false;
    }

    enum retro_pixel_format fmt = RETRO_PIXEL_FORMAT_XRGB8888;

    if (!zx48k.env_cb(RETRO_ENVIRONMENT_SET_PIXEL_FORMAT, &fmt)) {
        zx48k.log_cb( RETRO_LOG_ERROR, "XRGB8888 is not supported\n" );
        return false;
    }

    bool const ok = zx48k_load(info->data, info->size);

    struct retro_memory_descriptor desc[4] = {
        {RETRO_MEMDESC_CONST,      zx48k.zx.rom[0], 0, 0x0000, 0, 0, 0x4000, NULL},
        {RETRO_MEMDESC_SYSTEM_RAM, zx48k.zx.ram[0], 0, 0x4000, 0, 0, 0x4000, NULL},
        {RETRO_MEMDESC_SYSTEM_RAM, zx48k.zx.ram[1], 0, 0x8000, 0, 0, 0x4000, NULL},
        {RETRO_MEMDESC_SYSTEM_RAM, zx48k.zx.ram[2], 0, 0xc000, 0, 0, 0x4000, NULL}
    };

    struct retro_memory_map memory_map = {desc, 4};
    zx48k.env_cb(RETRO_ENVIRONMENT_SET_MEMORY_MAPS, &memory_map);

    return ok;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
testq %rdi, %rdi
je 0x122d5
movq %rdi, %rbx
leaq -0x1c(%rbp), %rsi
movl $0x1, (%rsi)
movl $0xa, %edi
callq *0x8a112(%rip)          # 0x9c378
testb %al, %al
je 0x122d9
movq 0x8(%rbx), %r14
movq 0x10(%rbx), %rbx
movq 0x8a0e7(%rip), %rdi     # 0x9c360
testq %rdi, %rdi
je 0x1228d
callq 0x3040
xorps %xmm0, %xmm0
movups %xmm0, 0x8a0d3(%rip)    # 0x9c360
testq %r14, %r14
je 0x122f1
leaq 0x9e87(%rip), %rdi      # 0x1c120
movq %r14, %rsi
movl %ebx, %edx
callq 0x3120
testb %al, %al
je 0x12315
movq %rbx, %rdi
callq 0x3150
movq %rax, %r15
testq %rax, %rax
je 0x122f8
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x3140
movq %r15, 0x8a094(%rip)     # 0x9c360
movq %rbx, 0x8a095(%rip)     # 0x9c368
jmp 0x1230c
xorl %ebx, %ebx
jmp 0x1234b
leaq 0x2160(%rip), %rsi      # 0x14440
xorl %ebx, %ebx
movl $0x3, %edi
xorl %eax, %eax
callq *0x8a081(%rip)          # 0x9c370
jmp 0x1234b
callq 0x12065
jmp 0x12311
leaq 0x229c(%rip), %rsi      # 0x1459b
movl $0x3, %edi
xorl %eax, %eax
callq *0x8a064(%rip)          # 0x9c370
testq %r15, %r15
je 0x12315
movb $0x1, %bl
jmp 0x12317
xorl %ebx, %ebx
leaq 0x5922(%rip), %rsi      # 0x17c40
leaq -0x130(%rbp), %r14
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
callq 0x3140
leaq -0x30(%rbp), %rsi
movq %r14, (%rsi)
movl $0x4, 0x8(%rsi)
movl $0x10024, %edi          # imm = 0x10024
callq *0x8a02d(%rip)          # 0x9c378
movl %ebx, %eax
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/main.c
// Function: main_get_register
static uint64_t main_get_register(unsigned reg) {
    switch (reg) {
        case HC_Z80_A: return z80_a(&zx48k.zx.cpu);
        case HC_Z80_F: return z80_f(&zx48k.zx.cpu);
        case HC_Z80_BC: return z80_bc(&zx48k.zx.cpu);
        case HC_Z80_DE: return z80_de(&zx48k.zx.cpu);
        case HC_Z80_HL: return z80_hl(&zx48k.zx.cpu);
        case HC_Z80_IX: return z80_ix(&zx48k.zx.cpu);
        case HC_Z80_IY: return z80_iy(&zx48k.zx.cpu);
        case HC_Z80_AF2: return z80_af_(&zx48k.zx.cpu);
        case HC_Z80_BC2: return z80_bc_(&zx48k.zx.cpu);
        case HC_Z80_DE2: return z80_de_(&zx48k.zx.cpu);
        case HC_Z80_HL2: return z80_hl_(&zx48k.zx.cpu);
        case HC_Z80_I: return z80_i(&zx48k.zx.cpu);
        case HC_Z80_R: return z80_r(&zx48k.zx.cpu);
        case HC_Z80_SP: return z80_sp(&zx48k.zx.cpu);
        case HC_Z80_PC: return z80_pc(&zx48k.zx.cpu);
        case HC_Z80_IFF: return z80_iff1(&zx48k.zx.cpu) << 1 | z80_iff2(&zx48k.zx.cpu);
        case HC_Z80_IM: return z80_im(&zx48k.zx.cpu);
        case HC_Z80_WZ: return z80_wz(&zx48k.zx.cpu);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpl $0x11, %edi
ja 0x1260a
movl %edi, %eax
leaq 0x11b6(%rip), %rcx      # 0x13700
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzbl 0x9bce(%rip), %eax      # 0x1c128
jmp 0x1261c
movzbl 0x9be0(%rip), %eax      # 0x1c146
jmp 0x1261c
movzwl 0x9bd0(%rip), %eax      # 0x1c142
jmp 0x1261c
movzbl 0x9bc7(%rip), %eax      # 0x1c145
jmp 0x1261c
movzwl 0x9ba0(%rip), %eax      # 0x1c12a
jmp 0x1261c
movzbl 0x9bae(%rip), %eax      # 0x1c144
jmp 0x1261c
movzwl 0x9b92(%rip), %eax      # 0x1c134
jmp 0x1261c
movzwl 0x9b83(%rip), %eax      # 0x1c12e
jmp 0x1261c
movl 0x9b8d(%rip), %eax      # 0x1c140
movl %eax, %ecx
shrl %ecx
andl $0x2, %ecx
shrl $0x3, %eax
andl $0x1, %eax
orl %ecx, %eax
jmp 0x1261c
movzwl 0x9b61(%rip), %eax      # 0x1c12c
jmp 0x1261c
movzwl 0x9b5c(%rip), %eax      # 0x1c130
rolw $0x8, %ax
movzwl %ax, %eax
jmp 0x1261c
movzbl 0x9b45(%rip), %eax      # 0x1c129
jmp 0x1261c
movzwl 0x9b51(%rip), %eax      # 0x1c13e
jmp 0x1261c
movzwl 0x9b46(%rip), %eax      # 0x1c13c
jmp 0x1261c
movzwl 0x9b39(%rip), %eax      # 0x1c138
jmp 0x1261c
movzwl 0x9b32(%rip), %eax      # 0x1c13a
jmp 0x1261c
jmp 0x1261c
movzwl 0x9b1f(%rip), %eax      # 0x1c132
jmp 0x1261c
movzwl 0x9b1a(%rip), %eax      # 0x1c136
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/main.c
// Function: main_set_register
static int main_set_register(unsigned reg, uint64_t value) {
    switch (reg) {
        case HC_Z80_A: z80_set_a(&zx48k.zx.cpu, value); break;
        case HC_Z80_F: z80_set_f(&zx48k.zx.cpu, value); break;
        case HC_Z80_BC: z80_set_bc(&zx48k.zx.cpu, value); break;
        case HC_Z80_DE: z80_set_de(&zx48k.zx.cpu, value); break;
        case HC_Z80_HL: z80_set_hl(&zx48k.zx.cpu, value); break;
        case HC_Z80_IX: z80_set_ix(&zx48k.zx.cpu, value); break;
        case HC_Z80_IY: z80_set_iy(&zx48k.zx.cpu, value); break;
        case HC_Z80_AF2: z80_set_af_(&zx48k.zx.cpu, value); break;
        case HC_Z80_BC2: z80_set_bc_(&zx48k.zx.cpu, value); break;
        case HC_Z80_DE2: z80_set_de_(&zx48k.zx.cpu, value); break;
        case HC_Z80_HL2: z80_set_hl_(&zx48k.zx.cpu, value); break;
        case HC_Z80_I: z80_set_i(&zx48k.zx.cpu, value); break;
        case HC_Z80_R: z80_set_r(&zx48k.zx.cpu, value); break;
        case HC_Z80_SP: z80_set_sp(&zx48k.zx.cpu, value); break;
        case HC_Z80_PC: z80_set_pc(&zx48k.zx.cpu, value); break;

        case HC_Z80_IFF:
        case HC_Z80_IM:
        case HC_Z80_WZ: return 0;
    }

    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpl $0x11, %edi
ja 0x126d0
movl %edi, %eax
leaq 0x1114(%rip), %rcx      # 0x13748
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
xorl %eax, %eax
jmp 0x126d5
movw %si, 0x9af7(%rip)       # 0x1c142
jmp 0x126d0
movb %sil, 0x9aee(%rip)      # 0x1c145
jmp 0x126d0
movw %si, 0x9aca(%rip)       # 0x1c12a
jmp 0x126d0
movb %sil, 0x9adb(%rip)      # 0x1c144
jmp 0x126d0
movw %si, 0x9ac2(%rip)       # 0x1c134
jmp 0x126d0
movw %si, 0x9ab3(%rip)       # 0x1c12e
jmp 0x126d0
movw %si, 0x9aa8(%rip)       # 0x1c12c
jmp 0x126d0
rolw $0x8, %si
movw %si, 0x9a9f(%rip)       # 0x1c130
jmp 0x126d0
movb %sil, 0x9a8e(%rip)      # 0x1c128
jmp 0x126d0
movb %sil, 0x9a86(%rip)      # 0x1c129
jmp 0x126d0
movw %si, 0x9a90(%rip)       # 0x1c13c
jmp 0x126d0
movw %si, 0x9a83(%rip)       # 0x1c138
jmp 0x126d0
movw %si, 0x9a7c(%rip)       # 0x1c13a
jmp 0x126d0
movw %si, 0x9a6b(%rip)       # 0x1c132
jmp 0x126d0
movw %si, 0x9a66(%rip)       # 0x1c136
movl $0x1, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/leiradel[P]zx48k-libretro/src/main.c
// Function: zx48k_audio_cb
static void zx48k_audio_cb(float const* const samples, int const num_samples, void* const ud) {
    static int16_t pcm16[ZX_MAX_AUDIO_SAMPLES * 2];

    (void)ud;

    for (int i = 0, j = 0; i < num_samples; i++, j += 2) {
        float sample = samples[i];

        if (sample < -1.0f) {
            sample = -1.0f;
        }
        else if (sample > 1.0f) {
            sample = 1.0f;
        }

        pcm16[j] = sample * 32767;
        pcm16[j + 1] = sample * 32767;
    }

    zx48k.audio_cb(pcm16, num_samples);
}

// Assembly:
testl %esi, %esi
jle 0x12794
pushq %rbp
movq %rsp, %rbp
movl %esi, %eax
xorl %ecx, %ecx
movss 0x8c4(%rip), %xmm0      # 0x1300c
movss 0x8c4(%rip), %xmm1      # 0x13014
leaq 0x89c49(%rip), %rdx     # 0x9c3a0
movss 0x8b1(%rip), %xmm2      # 0x13010
movss (%rdi,%rcx,4), %xmm4
ucomiss %xmm4, %xmm0
movaps %xmm0, %xmm3
ja 0x12777
ucomiss %xmm2, %xmm4
movaps %xmm4, %xmm3
jbe 0x12777
movaps %xmm2, %xmm3
mulss %xmm1, %xmm3
cvttss2si %xmm3, %r8d
movw %r8w, (%rdx,%rcx,4)
movw %r8w, 0x2(%rdx,%rcx,4)
incq %rcx
cmpq %rcx, %rax
jne 0x1275f
popq %rbp
movq 0x89bed(%rip), %rax     # 0x9c388
movslq %esi, %rsi
leaq 0x89bfb(%rip), %rdi     # 0x9c3a0
jmpq *%rax
// File: /workspace/github_c_makefile_star2_O1/dlbeer[P]dhara/tools/gentab.c
// Function: main
int main(int argc, char **argv)
{
	uint32_t p;

	if (argc < 2) {
		fprintf(stderr, "usage: %s <polynomial>\n", argv[0]);
		return -1;
	}

	if (parse_poly(argv[1], &p) < 0)
		return -1;

	fill_table(p);
	print_table();
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x1, %edi
jle 0x129e
movq 0x8(%rsi), %rbx
incq %rbx
movzbl -0x1(%rbx), %eax
cmpl $0x30, %eax
je 0x1184
cmpl $0x78, %eax
je 0x1184
xorl %r13d, %r13d
movq 0x2e59(%rip), %rdx      # 0x3ff8
leaq 0xe76(%rip), %r14       # 0x201c
movl %r13d, %ebp
movsbl -0x1(%rbx), %r12d
testl %r12d, %r12d
je 0x1220
movl %ebp, %r13d
shll $0x4, %r13d
leal -0x30(%r12), %ecx
movl $0xffffffd0, %eax       # imm = 0xFFFFFFD0
cmpb $0xa, %cl
jb 0x11e7
leal -0x41(%r12), %ecx
movl $0xffffffc9, %eax       # imm = 0xFFFFFFC9
cmpb $0x6, %cl
jb 0x11e7
leal -0x61(%r12), %ecx
movl $0xffffffa9, %eax       # imm = 0xFFFFFFA9
cmpb $0x6, %cl
jae 0x11fa
addl %r12d, %eax
orl %eax, %r13d
movb $0x1, %r15b
incq %rbx
testb %r15b, %r15b
jne 0x11a6
jmp 0x1216
movq (%rdx), %rdi
xorl %r15d, %r15d
movq %r14, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1040
movq 0x2de4(%rip), %rdx      # 0x3ff8
jmp 0x11f0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testb %r12b, %r12b
jne 0x128d
xorl %eax, %eax
leaq 0x2e27(%rip), %r15      # 0x4050
movl $0x8, %ecx
movl %eax, %edx
movl %edx, %esi
shrl %esi
andl $0x1, %edx
negl %edx
andl %ebp, %edx
xorl %esi, %edx
decl %ecx
jne 0x1230
movl %edx, (%r15,%rax,4)
incq %rax
cmpq $0x100, %rax            # imm = 0x100
jne 0x1229
xorl %ebx, %ebx
movl $0xa, %ebp
leaq 0xde1(%rip), %r14       # 0x203f
xorl %r12d, %r12d
movl (%r15), %esi
movl %r12d, %eax
notl %eax
testb $0x3, %al
movl $0x20, %edx
cmovel %ebp, %edx
movq %r14, %rdi
xorl %eax, %eax
callq 0x1030
incq %r12
addq $0x4, %r15
cmpq $0x100, %r12            # imm = 0x100
jne 0x1261
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rsi, %rdi
callq 0x1060
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x128d