LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: tb_deinit
static int tb_deinit(void) {
    if (global.caps[0] != NULL && global.wfd >= 0) {
        bytebuf_puts(&global.out, global.caps[TB_CAP_SHOW_CURSOR]);
        bytebuf_puts(&global.out, global.caps[TB_CAP_SGR0]);
        bytebuf_puts(&global.out, global.caps[TB_CAP_CLEAR_SCREEN]);
        bytebuf_puts(&global.out, global.caps[TB_CAP_EXIT_CA]);
        bytebuf_puts(&global.out, global.caps[TB_CAP_EXIT_KEYPAD]);
        bytebuf_puts(&global.out, TB_HARDCAP_EXIT_MOUSE);
        bytebuf_flush(&global.out, global.wfd);
    }
    if (global.ttyfd >= 0) {
        if (global.has_orig_tios) {
            tcsetattr(global.ttyfd, TCSAFLUSH, &global.orig_tios);
        }
        if (global.ttyfd_open) {
            close(global.ttyfd);
            global.ttyfd_open = 0;
        }
    }

    sigaction(SIGWINCH, &(struct sigaction){.sa_handler = SIG_DFL}, NULL);
    if (global.resize_pipefd[0] >= 0)
        close(global.resize_pipefd[0]);
    if (global.resize_pipefd[1] >= 0)
        close(global.resize_pipefd[1]);

    cellbuf_free(&global.back);
    cellbuf_free(&global.front);
    bytebuf_free(&global.in);
    bytebuf_free(&global.out);

    if (global.terminfo)
        tb_free(global.terminfo);

    cap_trie_deinit(&global.cap_trie);

    tb_reset();
    return TB_OK;
}

// Assembly:
pushq %rbx
subq $0xa0, %rsp
cmpq $0x0, 0x1eb73(%rip)     # 0x25ab8
je 0x6fa3
cmpl $0x0, 0x1eb22(%rip)     # 0x25a70
js 0x6fa3
movq 0x1ec29(%rip), %rdi     # 0x25b80
callq 0x78d9
movq 0x1ec35(%rip), %rdi     # 0x25b98
callq 0x78d9
movq 0x1ec21(%rip), %rdi     # 0x25b90
callq 0x78d9
movq 0x1ebfd(%rip), %rdi     # 0x25b78
callq 0x78d9
movq 0x1ec49(%rip), %rdi     # 0x25bd0
callq 0x78d9
leaq 0x148eb(%rip), %rdi     # 0x1b87e
callq 0x78d9
movl 0x1ead2(%rip), %edi     # 0x25a70
callq 0x77dd
movl 0x1eabf(%rip), %edi     # 0x25a68
testl %edi, %edi
js 0x6fe0
cmpl $0x0, 0x1ecd0(%rip)     # 0x25c84
je 0x6fc5
leaq 0x1ec8b(%rip), %rdx     # 0x25c48
pushq $0x2
popq %rsi
callq 0x64d0
cmpl $0x0, 0x1eaa8(%rip)     # 0x25a74
je 0x6fe0
movl 0x1ea94(%rip), %edi     # 0x25a68
callq 0x6260
andl $0x0, 0x1ea94(%rip)     # 0x25a74
leaq 0x8(%rsp), %rbx
movl $0x98, %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x6230
pushq $0x1c
popq %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x60d0
movl 0x1ea71(%rip), %edi     # 0x25a78
testl %edi, %edi
js 0x7010
callq 0x6260
movl 0x1ea66(%rip), %edi     # 0x25a7c
testl %edi, %edi
js 0x701f
callq 0x6260
leaq 0x1ec02(%rip), %rdi     # 0x25c28
callq 0x1341c
leaq 0x1ec06(%rip), %rdi     # 0x25c38
callq 0x1341c
leaq 0x1ebba(%rip), %rdi     # 0x25bf8
callq 0x13454
leaq 0x1ebc6(%rip), %rdi     # 0x25c10
callq 0x13454
movq 0x1ea52(%rip), %rdi     # 0x25aa8
callq 0x6050
leaq 0x1eb76(%rip), %rdi     # 0x25bd8
callq 0x1346d
callq 0x6d39
addq $0xa0, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: cellbuf_clear
static int cellbuf_clear(struct cellbuf_t *c) {
    int rv, i;
    uint32_t space = (uint32_t)' ';
    for (i = 0; i < c->width * c->height; i++) {
        if_err_return(rv,
            cell_set(&c->cells[i], &space, 1, global.fg, global.bg));
    }
    return TB_OK;
}

// Assembly:
movslq (%rdi), %rcx
movslq 0x4(%rdi), %rax
imulq %rcx, %rax
movsd 0x1e9ad(%rip), %xmm0    # 0x25a98
xorl %ecx, %ecx
cmpq %rax, %rcx
jge 0x7108
movq 0x8(%rdi), %rdx
movl $0x20, (%rdx,%rcx,8)
movss %xmm0, 0x4(%rdx,%rcx,8)
incq %rcx
jmp 0x70ed
retq
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: cellbuf_get
static int cellbuf_get(struct cellbuf_t *c, int x, int y,
    struct tb_cell **out) {
    if (x < 0 || x >= c->width || y < 0 || y >= c->height) {
        *out = NULL;
        return TB_ERR_OUT_OF_BOUNDS;
    }
    *out = &c->cells[(y * c->width) + x];
    return TB_OK;
}

// Assembly:
pushq $-0x9
popq %rax
testl %esi, %esi
js 0x72e5
movl (%rdi), %r9d
cmpl %esi, %r9d
setle %r8b
testl %edx, %edx
sets %r10b
orb %r8b, %r10b
je 0x72ec
xorl %r8d, %r8d
movq %r8, (%rcx)
retq
xorl %r8d, %r8d
cmpl %edx, 0x4(%rdi)
jle 0x72e8
imull %edx, %r9d
addl %esi, %r9d
shlq $0x3, %r9
addq 0x8(%rdi), %r9
movq %r9, %r8
xorl %eax, %eax
jmp 0x72e8
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: send_cursor_if
static int send_cursor_if(int x, int y) {
    int rv;
    char nbuf[32];
    if (x < 0 || y < 0) {
        return TB_OK;
    }
    send_literal(rv, "\x1b[");
    send_num(rv, nbuf, y + 1);
    send_literal(rv, ";");
    send_num(rv, nbuf, x + 1);
    send_literal(rv, "H");
    return TB_OK;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movl %esi, %eax
orl %edi, %eax
js 0x77d2
movl %esi, %ebp
movl %edi, %ebx
leaq 0x1e4d7(%rip), %rdi     # 0x25c10
leaq 0x15fd7(%rip), %rsi     # 0x1d717
pushq $0x2
popq %rdx
callq 0x7f4b
testl %eax, %eax
jne 0x77d4
incl %ebp
movq %rsp, %r14
movl %ebp, %edi
movq %r14, %rsi
callq 0x13ad6
movslq %eax, %rdx
leaq 0x1e4a7(%rip), %rdi     # 0x25c10
movq %r14, %rsi
callq 0x7f4b
testl %eax, %eax
jne 0x77d4
leaq 0x1e494(%rip), %rdi     # 0x25c10
leaq 0x15f9b(%rip), %rsi     # 0x1d71e
pushq $0x1
popq %rdx
callq 0x7f4b
testl %eax, %eax
jne 0x77d4
incl %ebx
movq %rsp, %r14
movl %ebx, %edi
movq %r14, %rsi
callq 0x13ad6
movslq %eax, %rdx
leaq 0x1e468(%rip), %rdi     # 0x25c10
movq %r14, %rsi
callq 0x7f4b
testl %eax, %eax
jne 0x77d4
leaq 0x1e455(%rip), %rdi     # 0x25c10
leaq 0x160fd(%rip), %rsi     # 0x1d8bf
pushq $0x1
popq %rdx
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x7f4b
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: bytebuf_flush
static int bytebuf_flush(struct bytebuf_t *b, int fd) {
    if (b->len <= 0) {
        return TB_OK;
    }
    ssize_t write_rv = write(fd, b->buf, b->len);
    if (write_rv < 0 || (size_t)write_rv != b->len) {
        // Note, errno will be 0 on partial write
        global.last_errno = errno;
        return TB_ERR;
    }
    b->len = 0;
    return TB_OK;
}

// Assembly:
pushq %rbx
movq 0x1e433(%rip), %rdx     # 0x25c18
xorl %ebx, %ebx
testq %rdx, %rdx
je 0x7820
movq 0x1e41d(%rip), %rsi     # 0x25c10
callq 0x6120
testq %rax, %rax
js 0x7810
cmpq 0x1e414(%rip), %rax     # 0x25c18
jne 0x7810
andq $0x0, 0x1e40a(%rip)     # 0x25c18
jmp 0x7820
callq 0x6060
movl (%rax), %eax
movl %eax, 0x1e46b(%rip)     # 0x25c88
pushq $-0x1
popq %rbx
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: resize_cellbufs
static int resize_cellbufs(void) {
    int rv;
    if_err_return(rv,
        cellbuf_resize(&global.back, global.width, global.height));
    if_err_return(rv,
        cellbuf_resize(&global.front, global.width, global.height));
    if_err_return(rv, cellbuf_clear(&global.front));
    if_err_return(rv, send_clear());
    return TB_OK;
}

// Assembly:
pushq %rax
movl 0x1e248(%rip), %esi     # 0x25a80
movl 0x1e246(%rip), %edx     # 0x25a84
leaq 0x1e3e3(%rip), %rdi     # 0x25c28
callq 0x139dd
testl %eax, %eax
jne 0x786a
movl 0x1e22c(%rip), %esi     # 0x25a80
movl 0x1e22a(%rip), %edx     # 0x25a84
leaq 0x1e3d7(%rip), %rdi     # 0x25c38
callq 0x139dd
testl %eax, %eax
je 0x786c
popq %rcx
retq
leaq 0x1e3c5(%rip), %rdi     # 0x25c38
callq 0x70d8
popq %rax
jmp 0x6da0
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: tb_set_cursor
int tb_set_cursor(int cx, int cy) {
    if_not_init_return();
    int rv;
    if (cx < 0)
        cx = 0;
    if (cy < 0)
        cy = 0;
    if (global.cursor_x == -1) {
        if_err_return(rv,
            bytebuf_puts(&global.out, global.caps[TB_CAP_SHOW_CURSOR]));
    }
    if_err_return(rv, send_cursor_if(cx, cy));
    global.cursor_x = cx;
    global.cursor_y = cy;
    return TB_OK;
}

// Assembly:
cmpl $0x0, 0x1e407(%rip)     # 0x25c8c
je 0x78be
pushq %rbp
pushq %rbx
pushq %rax
movl %edi, %ebx
xorl %ebp, %ebp
testl %edi, %edi
cmovlel %ebp, %ebx
testl %esi, %esi
cmovgl %esi, %ebp
cmpl $-0x1, 0x1e1e9(%rip)    # 0x25a88
je 0x78c2
movl %ebx, %edi
movl %ebp, %esi
callq 0x771c
testl %eax, %eax
jne 0x78d2
movl %ebx, 0x1e1d4(%rip)     # 0x25a88
movl %ebp, 0x1e1d2(%rip)     # 0x25a8c
xorl %eax, %eax
jmp 0x78d2
pushq $-0x8
popq %rax
retq
movq 0x1e2b7(%rip), %rdi     # 0x25b80
callq 0x78d9
testl %eax, %eax
je 0x78a1
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: tb_hide_cursor
int tb_hide_cursor(void) {
    if_not_init_return();
    int rv;
    if (global.cursor_x >= 0) {
        if_err_return(rv,
            bytebuf_puts(&global.out, global.caps[TB_CAP_HIDE_CURSOR]));
    }
    global.cursor_x = -1;
    global.cursor_y = -1;
    return TB_OK;
}

// Assembly:
cmpl $0x0, 0x1e390(%rip)     # 0x25c8c
je 0x7929
cmpl $0x0, 0x1e183(%rip)     # 0x25a88
js 0x791e
pushq %rax
movq 0x1e279(%rip), %rdi     # 0x25b88
callq 0x78d9
testl %eax, %eax
leaq 0x8(%rsp), %rsp
je 0x791e
retq
orq $-0x1, 0x1e162(%rip)    # 0x25a88
xorl %eax, %eax
retq
pushq $-0x8
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: tb_set_cell_ex
int tb_set_cell_ex(int x, int y, uint32_t *ch, size_t nch, uintattr_t fg,
    uintattr_t bg) {
    if_not_init_return();
    int rv;
    struct tb_cell *cell;
    if_err_return(rv, cellbuf_get(&global.back, x, y, &cell));
    if_err_return(rv, cell_set(cell, ch, nch, fg, bg));
    return TB_OK;
}

// Assembly:
cmpl $0x0, 0x1e32f(%rip)     # 0x25c8c
je 0x7998
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %r9d, %ebx
movl %r8d, %ebp
movq %rdx, %r14
movl %esi, %edx
movl %edi, %esi
leaq 0x1e2ad(%rip), %rdi     # 0x25c28
leaq 0x8(%rsp), %rcx
callq 0x72c9
testl %eax, %eax
jne 0x79a8
movq 0x8(%rsp), %rcx
testq %r14, %r14
je 0x799c
movl (%r14), %edx
jmp 0x799e
pushq $-0x8
popq %rax
retq
xorl %edx, %edx
movl %edx, (%rcx)
movw %bp, 0x4(%rcx)
movw %bx, 0x6(%rcx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: tb_set_input_mode
int tb_set_input_mode(int mode) {
    if_not_init_return();
    if (mode == TB_INPUT_CURRENT) {
        return global.input_mode;
    }

    if ((mode & (TB_INPUT_ESC | TB_INPUT_ALT)) == 0) {
        mode |= TB_INPUT_ESC;
    }

    if ((mode & (TB_INPUT_ESC | TB_INPUT_ALT)) == (TB_INPUT_ESC | TB_INPUT_ALT))
    {
        mode &= ~TB_INPUT_ALT;
    }

    if (mode & TB_INPUT_MOUSE) {
        bytebuf_puts(&global.out, TB_HARDCAP_ENTER_MOUSE);
        bytebuf_flush(&global.out, global.wfd);
    } else {
        bytebuf_puts(&global.out, TB_HARDCAP_EXIT_MOUSE);
        bytebuf_flush(&global.out, global.wfd);
    }

    global.input_mode = mode;
    return TB_OK;
}

// Assembly:
cmpl $0x0, 0x1e2c6(%rip)     # 0x25c8c
je 0x7a16
testl %edi, %edi
je 0x7a1a
pushq %rbx
xorl %eax, %eax
testb $0x3, %dil
sete %al
orl %edi, %eax
movl %eax, %ecx
notl %ecx
movl %eax, %ebx
andl $-0x3, %ebx
testb $0x3, %cl
cmovnel %eax, %ebx
testb $0x4, %bl
leaq 0x13e8d(%rip), %rax     # 0x1b87e
leaq 0x13e65(%rip), %rdi     # 0x1b85d
cmoveq %rax, %rdi
callq 0x78d9
movl 0x1e069(%rip), %edi     # 0x25a70
callq 0x77dd
movl %ebx, 0x1e08e(%rip)     # 0x25aa0
xorl %eax, %eax
popq %rbx
retq
pushq $-0x8
popq %rax
retq
movl 0x1e080(%rip), %eax     # 0x25aa0
retq
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: tb_set_output_mode
int tb_set_output_mode(int mode) {
    if_not_init_return();
    switch (mode) {
        case TB_OUTPUT_CURRENT:
            return global.output_mode;
        case TB_OUTPUT_NORMAL:
        case TB_OUTPUT_256:
        case TB_OUTPUT_216:
        case TB_OUTPUT_GRAYSCALE:
#ifdef TB_OPT_TRUECOLOR
        case TB_OUTPUT_TRUECOLOR:
#endif
            global.last_fg = ~global.fg;
            global.last_bg = ~global.bg;
            global.output_mode = mode;
            return TB_OK;
    }
    return TB_ERR;
}

// Assembly:
cmpl $0x0, 0x1e264(%rip)     # 0x25c8c
je 0x7a49
leal -0x1(%rdi), %eax
cmpl $0x4, %eax
jae 0x7a4d
movl 0x1e060(%rip), %eax     # 0x25a98
notl %eax
movl %eax, 0x1e05c(%rip)     # 0x25a9c
movl %edi, 0x1e05e(%rip)     # 0x25aa4
xorl %eax, %eax
retq
pushq $-0x8
jmp 0x7a5a
testl %edi, %edi
jne 0x7a58
movl 0x1e04d(%rip), %eax     # 0x25aa4
retq
pushq $-0x1
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: tb_print_ex
int tb_print_ex(int x, int y, uintattr_t fg, uintattr_t bg, size_t *out_w,
    const char *str) {
    int rv;
    uint32_t uni;
    int w, ix = x;
    if (out_w) {
        *out_w = 0;
    }
    while (*str) {
        str += tb_utf8_char_to_unicode(&uni, str);
        w = wcwidth((wchar_t)uni);
        if (w < 0) {
            w = 1;
        }
        if (w == 0 && x > ix) {
            if_err_return(rv, tb_extend_cell(x - 1, y, uni));
        } else {
            if_err_return(rv, tb_set_cell(x, y, uni, fg, bg));
        }
        x += w;
        if (out_w) {
            *out_w += w;
        }
    }
    return TB_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %rbx
movl %ecx, %r9d
movl %esi, 0x18(%rsp)
movl %edi, %r13d
movq %r8, 0x8(%rsp)
testq %r8, %r8
movl %ecx, 0x14(%rsp)
movl %edx, 0x10(%rsp)
movl %edi, 0x1c(%rsp)
je 0x7cd1
xorl %eax, %eax
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
movzwl %dx, %eax
movl %eax, 0x20(%rsp)
movzwl %r9w, %r12d
cmpb $0x0, (%rbx)
je 0x7d66
leaq 0x24(%rsp), %rdi
movq %rbx, %rsi
callq 0x7d86
movl %eax, %ebp
movl 0x24(%rsp), %r15d
movl %r15d, %edi
callq 0x63c0
movl %eax, %r14d
testl %eax, %eax
pushq $0x1
popq %rax
cmovsl %eax, %r14d
testl %r14d, %r14d
sete %al
cmpl 0x1c(%rsp), %r13d
setg %cl
andb %al, %cl
cmpb $0x1, %cl
je 0x7d6a
movl %r13d, %edi
movl 0x18(%rsp), %esi
movl %r15d, %edx
movl 0x20(%rsp), %ecx
movl %r12d, %r8d
callq 0x792d
testl %eax, %eax
jne 0x7d77
movslq %ebp, %rax
addq %rax, %rbx
addl %r14d, %r13d
cmpq $0x0, 0x8(%rsp)
je 0x7cdc
movslq %r14d, %rax
movq 0x8(%rsp), %rcx
addq (%rcx), %rax
movl 0x14(%rsp), %r9d
movl 0x10(%rsp), %edx
jmp 0x7cc9
xorl %eax, %eax
jmp 0x7d77
xorl %eax, %eax
cmpl 0x1df1a(%rip), %eax     # 0x25c8c
sbbl %eax, %eax
orl $-0x8, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: tb_printf_inner
int tb_printf_inner(int x, int y, uintattr_t fg, uintattr_t bg, size_t *out_w,
    const char *fmt, va_list vl) {
    int rv;
    char buf[TB_OPT_PRINTF_BUF];
    rv = vsnprintf(buf, sizeof(buf), fmt, vl);
    if (rv < 0 || rv >= (int)sizeof(buf)) {
        return TB_ERR;
    }
    return tb_print_ex(x, y, fg, bg, out_w, buf);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1000, %rsp           # imm = 0x1000
movq %r8, %rbx
movl %ecx, %r14d
movl %edx, %r12d
movl %esi, %ebp
movl %edi, %r15d
movq 0x1030(%rsp), %rcx
movq %rsp, %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %r9, %rdx
callq 0x60f0
cmpl $0xfff, %eax            # imm = 0xFFF
jbe 0x7e97
pushq $-0x1
popq %rax
jmp 0x7eaf
movzwl %r12w, %edx
movzwl %r14w, %ecx
movq %rsp, %r9
movl %r15d, %edi
movl %ebp, %esi
movq %rbx, %r8
callq 0x7c96
addq $0x1000, %rsp           # imm = 0x1000
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: tb_printf_ex
int tb_printf_ex(int x, int y, uintattr_t fg, uintattr_t bg, size_t *out_w,
    const char *fmt, ...) {
    int rv;
    va_list vl;
    va_start(vl, fmt);
    rv = tb_printf_inner(x, y, fg, bg, out_w, fmt, vl);
    va_end(vl);
    return rv;
}

// Assembly:
subq $0xe8, %rsp
testb %al, %al
je 0x7f04
movaps %xmm0, 0x60(%rsp)
movaps %xmm1, 0x70(%rsp)
movaps %xmm2, 0x80(%rsp)
movaps %xmm3, 0x90(%rsp)
movaps %xmm4, 0xa0(%rsp)
movaps %xmm5, 0xb0(%rsp)
movaps %xmm6, 0xc0(%rsp)
movaps %xmm7, 0xd0(%rsp)
leaq 0x30(%rsp), %rax
leaq 0x10(%rsp), %r10
movq %rax, 0x10(%r10)
leaq 0xf0(%rsp), %rax
movq %rax, 0x8(%r10)
movabsq $0x3000000030, %rax     # imm = 0x3000000030
movq %rax, (%r10)
movq %r10, (%rsp)
callq 0x7e56
addq $0xe8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: bytebuf_nputs
static int bytebuf_nputs(struct bytebuf_t *b, const char *str, size_t nstr) {
    int rv;
    if_err_return(rv, bytebuf_reserve(b, b->len + nstr + 1));
    memcpy(b->buf + b->len, str, nstr);
    b->len += nstr;
    b->buf[b->len] = '\0';
    return TB_OK;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq 0x8(%rdi), %rdi
movq 0x10(%r14), %rcx
leaq (%rdx,%rdi), %rax
incq %rax
cmpq %rax, %rcx
jae 0x7f95
cmpq $0x1, %rcx
adcq $0x0, %rcx
movq %rcx, %r12
addq %rcx, %rcx
cmpq %rax, %r12
jb 0x7f78
movq (%r14), %rdi
testq %rdi, %rdi
je 0x7f9a
movq %r12, %rsi
callq 0x6430
jmp 0x7fa2
movq (%r14), %rax
jmp 0x7fb2
movq %r12, %rdi
callq 0x63e0
testq %rax, %rax
je 0x7fdd
movq %rax, (%r14)
movq %r12, 0x10(%r14)
movq 0x8(%r14), %rdi
addq %rax, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x6360
addq 0x8(%r14), %rbx
movq %rbx, 0x8(%r14)
movq (%r14), %rax
movb $0x0, (%rax,%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
pushq $-0x5
popq %rax
jmp 0x7fd1
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: tb_sendf
int tb_sendf(const char *fmt, ...) {
    int rv;
    char buf[TB_OPT_PRINTF_BUF];
    va_list vl;
    va_start(vl, fmt);
    rv = vsnprintf(buf, sizeof(buf), fmt, vl);
    va_end(vl);
    if (rv < 0 || rv >= (int)sizeof(buf)) {
        return TB_ERR;
    }
    return tb_send(buf, (size_t)rv);
}

// Assembly:
subq $0x10d8, %rsp           # imm = 0x10D8
movq %rdi, %r10
leaq 0x20(%rsp), %rdi
movq %rsi, 0x8(%rdi)
movq %rdx, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movq %r8, 0x20(%rdi)
movq %r9, 0x28(%rdi)
testb %al, %al
je 0x8040
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rsp, %rcx
movq %rdi, 0x10(%rcx)
leaq 0x10e0(%rsp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rcx)
leaq 0xd0(%rsp), %rdi
movl $0x1000, %esi           # imm = 0x1000
movq %r10, %rdx
callq 0x60f0
cmpl $0xfff, %eax            # imm = 0xFFF
jbe 0x8081
pushq $-0x1
popq %rax
jmp 0x8090
movl %eax, %esi
leaq 0xd0(%rsp), %rdi
callq 0x7f3c
addq $0x10d8, %rsp           # imm = 0x10D8
retq
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/phpspy.c
// Function: log_error
void log_error(const char *fmt, ...) {
    va_list args;
    if (log_error_enabled) {
        va_start(args, fmt);
        vfprintf(stderr, fmt, args);
    }
}

// Assembly:
subq $0xd8, %rsp
movq %rsi, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
testb %al, %al
je 0xa49d
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
cmpl $0x0, 0x1aedc(%rip)     # 0x25380
jne 0xa4ae
addq $0xd8, %rsp
retq
movq %rdi, %r10
leaq 0x20(%rsp), %rax
movq %rsp, %rdx
movq %rax, 0x10(%rdx)
leaq 0xe0(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rdx)
movq 0x1ab13(%rip), %rax     # 0x24ff0
movq (%rax), %rdi
movq %r10, %rsi
callq 0x6550
jmp 0xa4a6
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/phpspy.c
// Function: clock_get
static void clock_get(struct timespec *ts) {
    if (clock_gettime(CLOCK_MONOTONIC_RAW, ts) == -1) {
        perror("clock_gettime");
        ts->tv_sec = 0;
        ts->tv_nsec = 0;
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
pushq $0x4
popq %rdi
movq %rbx, %rsi
callq 0x6110
cmpl $-0x1, %eax
je 0x130ec
popq %rbx
retq
leaq 0xaa60(%rip), %rdi      # 0x1db53
callq 0x6530
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
jmp 0x130ea
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/phpspy.c
// Function: phpspy_zend_inline_hash_func
uint64_t phpspy_zend_inline_hash_func(const char *str, size_t len) {
    /* Adapted from zend_string.h */
    uint64_t hash;
    hash = 5381UL;

    for (; len >= 8; len -= 8) {
        hash = ((hash << 5) + hash) + *str++;
        hash = ((hash << 5) + hash) + *str++;
        hash = ((hash << 5) + hash) + *str++;
        hash = ((hash << 5) + hash) + *str++;
        hash = ((hash << 5) + hash) + *str++;
        hash = ((hash << 5) + hash) + *str++;
        hash = ((hash << 5) + hash) + *str++;
        hash = ((hash << 5) + hash) + *str++;
    }
    switch (len) {
        case 7: hash = ((hash << 5) + hash) + *str++; /* fallthrough... */
        case 6: hash = ((hash << 5) + hash) + *str++; /* fallthrough... */
        case 5: hash = ((hash << 5) + hash) + *str++; /* fallthrough... */
        case 4: hash = ((hash << 5) + hash) + *str++; /* fallthrough... */
        case 3: hash = ((hash << 5) + hash) + *str++; /* fallthrough... */
        case 2: hash = ((hash << 5) + hash) + *str++; /* fallthrough... */
        case 1: hash = ((hash << 5) + hash) + *str++; break;
        case 0: break;
    }

    return hash | 0x8000000000000000UL;
}

// Assembly:
movl $0x1505, %eax           # imm = 0x1505
cmpq $0x8, %rsi
jb 0x13174
imulq $0x21, %rax, %rax
movsbq (%rdi), %rcx
addq %rax, %rcx
imulq $0x21, %rcx, %rax
movsbq 0x1(%rdi), %rcx
addq %rax, %rcx
imulq $0x21, %rcx, %rax
movsbq 0x2(%rdi), %rcx
addq %rax, %rcx
imulq $0x21, %rcx, %rax
movsbq 0x3(%rdi), %rcx
addq %rax, %rcx
imulq $0x21, %rcx, %rax
movsbq 0x4(%rdi), %rcx
addq %rax, %rcx
imulq $0x21, %rcx, %rax
movsbq 0x5(%rdi), %rcx
addq %rax, %rcx
imulq $0x21, %rcx, %rax
movsbq 0x6(%rdi), %rcx
addq %rax, %rcx
imulq $0x21, %rcx, %rcx
movsbq 0x7(%rdi), %rax
addq $0x8, %rdi
addq %rcx, %rax
addq $-0x8, %rsi
jmp 0x13105
leaq 0x8439(%rip), %rcx      # 0x1b5b4
movslq (%rcx,%rsi,4), %rdx
addq %rcx, %rdx
jmpq *%rdx
imulq $0x21, %rax, %rcx
movsbq (%rdi), %rax
incq %rdi
addq %rcx, %rax
imulq $0x21, %rax, %rcx
movsbq (%rdi), %rax
incq %rdi
addq %rcx, %rax
imulq $0x21, %rax, %rcx
movsbq (%rdi), %rax
incq %rdi
addq %rcx, %rax
imulq $0x21, %rax, %rcx
movsbq (%rdi), %rax
incq %rdi
addq %rcx, %rax
imulq $0x21, %rax, %rcx
movsbq (%rdi), %rax
incq %rdi
addq %rcx, %rax
imulq $0x21, %rax, %rcx
movsbq (%rdi), %rax
incq %rdi
addq %rcx, %rax
imulq $0x21, %rax, %rcx
movsbq (%rdi), %rax
addq %rcx, %rax
btsq $0x3f, %rax
retq
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: load_terminfo_from_path
static int load_terminfo_from_path(const char *path, const char *term) {
    int rv;
    char tmp[PATH_MAX];

    // Look for term at this terminfo location, e.g., <terminfo>/x/xterm
    snprintf_or_return(rv, tmp, sizeof(tmp), "%s/%c/%s", path, term[0], term);
    if_ok_return(rv, read_terminfo_path(tmp));

#ifdef __APPLE__
    // Try the Darwin equivalent path, e.g., <terminfo>/78/xterm
    snprintf_or_return(rv, tmp, sizeof(tmp), "%s/%x/%s", path, term[0], term);
    return read_terminfo_path(tmp);
#endif

    return TB_ERR;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1098, %rsp           # imm = 0x1098
movq %rsi, %r9
movq %rdi, %rcx
movsbl (%rsi), %r8d
leaq 0x9d10(%rip), %rdx      # 0x1cf18
leaq 0x90(%rsp), %rdi
movl $0x1000, %esi           # imm = 0x1000
xorl %eax, %eax
callq 0x61d0
pushq $-0x1
popq %rbx
cmpl $0xfff, %eax            # imm = 0xFFF
ja 0x13260
leaq 0x9cf4(%rip), %rsi      # 0x1cf21
leaq 0x90(%rsp), %rdi
callq 0x6520
testq %rax, %rax
je 0x13260
movq %rax, %r14
movq %rax, %rdi
callq 0x6380
movq %rsp, %rsi
movl %eax, %edi
callq 0x65f0
testl %eax, %eax
je 0x13271
movq %r14, %rdi
callq 0x6140
movl %ebx, %eax
addq $0x1098, %rsp           # imm = 0x1098
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x30(%rsp), %r12
movq %r12, %rdi
callq 0x63e0
testq %rax, %rax
je 0x13258
movq %rax, %r15
pushq $0x1
popq %rsi
movq %rax, %rdi
movq %r12, %rdx
movq %r14, %rcx
callq 0x60e0
cmpq %r12, %rax
jne 0x132b6
movq %r15, 0x12805(%rip)     # 0x25aa8
movq %r12, 0x12806(%rip)     # 0x25ab0
movq %r14, %rdi
callq 0x6140
xorl %ebx, %ebx
jmp 0x13260
movq %r14, %rdi
callq 0x6140
movq %r15, %rdi
callq 0x6050
jmp 0x13260
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: cap_trie_add
static int cap_trie_add(const char *cap, uint16_t key, uint8_t mod) {
    struct cap_trie_t *next, *node = &global.cap_trie;
    size_t i, j;
    for (i = 0; cap[i] != '\0'; i++) {
        char c = cap[i];
        next = NULL;

        // Check if c is already a child of node
        for (j = 0; j < node->nchildren; j++) {
            if (node->children[j].c == c) {
                next = &node->children[j];
                break;
            }
        }
        if (!next) {
            // We need to add a new child to node
            node->nchildren += 1;
            node->children =
                tb_realloc(node->children, sizeof(*node) * node->nchildren);
            if (!node->children) {
                return TB_ERR_MEM;
            }
            next = &node->children[node->nchildren - 1];
            memset(next, 0, sizeof(*next));
            next->c = c;
        }

        // Continue
        node = next;
    }

    if (node->is_leaf) {
        // Already a leaf here
        return TB_ERR_CAP_COLLISION;
    }

    node->is_leaf = 1;
    node->key = key;
    node->mod = mod;
    return TB_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, 0x4(%rsp)
movl %esi, (%rsp)
movq %rdi, %r15
leaq 0x128f4(%rip), %r12     # 0x25bd8
xorl %r13d, %r13d
pushq $-0x20
popq %rbx
pushq $-0x5
popq %r14
movb (%r15,%r13), %bpl
testb %bpl, %bpl
je 0x1336b
movq 0x10(%r12), %rsi
leaq 0x1(%rsi), %rax
movq %rbx, %rcx
decq %rax
je 0x13323
leaq 0x20(%rcx), %rdx
movq 0x8(%r12), %rdi
cmpb %bpl, 0x20(%rdi,%rcx)
movq %rdx, %rcx
jne 0x13303
addq %rdx, %rdi
movq %rdi, %r12
jmp 0x13366
incq %rsi
movq %rsi, 0x10(%r12)
movq 0x8(%r12), %rdi
shlq $0x5, %rsi
callq 0x6430
movq %rax, 0x8(%r12)
testq %rax, %rax
je 0x13397
movq 0x10(%r12), %rcx
shlq $0x5, %rcx
leaq (%rax,%rcx), %r12
addq $-0x20, %r12
xorps %xmm0, %xmm0
movups %xmm0, -0x20(%rax,%rcx)
movups %xmm0, -0x10(%rax,%rcx)
movb %bpl, -0x20(%rax,%rcx)
incq %r13
jmp 0x132ee
cmpl $0x0, 0x18(%r12)
je 0x13379
pushq $-0x16
popq %r14
jmp 0x13397
movl $0x1, 0x18(%r12)
movl (%rsp), %eax
movw %ax, 0x1c(%r12)
movl 0x4(%rsp), %eax
movb %al, 0x1e(%r12)
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: cellbuf_init
static int cellbuf_init(struct cellbuf_t *c, int w, int h) {
    c->cells = tb_malloc(sizeof(struct tb_cell) * w * h);
    if (!c->cells) {
        return TB_ERR_MEM;
    }
    memset(c->cells, 0, sizeof(struct tb_cell) * w * h);
    c->width = w;
    c->height = h;
    return TB_OK;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r14
movslq %esi, %rax
movslq %edx, %rsi
imulq %rax, %rsi
shlq $0x3, %rsi
pushq $0x1
popq %rdi
callq 0x62f0
movq %rax, 0x8(%r14)
testq %rax, %rax
je 0x13414
movl %ebp, (%r14)
movl %ebx, 0x4(%r14)
xorl %eax, %eax
jmp 0x13417
pushq $-0x5
popq %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: cellbuf_free
static int cellbuf_free(struct cellbuf_t *c) {
    if (c->cells) {
        int i;
        for (i = 0; i < c->width * c->height; i++) {
            cell_free(&c->cells[i]);
        }
        tb_free(c->cells);
    }
    memset(c, 0, sizeof(*c));
    return TB_OK;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpq $0x0, 0x8(%rdi)
je 0x1344c
xorl %eax, %eax
movslq (%rbx), %rcx
movslq 0x4(%rbx), %rdx
imulq %rcx, %rdx
movq 0x8(%rbx), %rdi
cmpq %rdx, %rax
jge 0x13447
andq $0x0, (%rdi,%rax,8)
incq %rax
jmp 0x13429
callq 0x6050
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: bytebuf_free
static int bytebuf_free(struct bytebuf_t *b) {
    if (b->buf) {
        tb_free(b->buf);
    }
    memset(b, 0, sizeof(*b));
    return TB_OK;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x6050
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: cap_trie_deinit
static int cap_trie_deinit(struct cap_trie_t *node) {
    size_t j;
    for (j = 0; j < node->nchildren; j++) {
        cap_trie_deinit(&node->children[j]);
    }
    if (node->children) {
        tb_free(node->children);
    }
    memset(node, 0, sizeof(*node));
    return TB_OK;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
xorl %r15d, %r15d
movq 0x8(%rbx), %rdi
cmpq 0x10(%rbx), %r15
jae 0x13496
addq %r14, %rdi
callq 0x1346d
incq %r15
addq $0x20, %r14
jmp 0x1347b
callq 0x6050
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: extract_esc_user
static int extract_esc_user(struct tb_event *event, int is_post) {
    int rv;
    size_t consumed = 0;
    struct bytebuf_t *in = &global.in;
    int (*fn)(struct tb_event *, size_t *);

    fn = is_post ? global.fn_extract_esc_post : global.fn_extract_esc_pre;

    if (!fn) {
        return TB_ERR;
    }

    rv = fn(event, &consumed);
    if (rv == TB_OK) {
        bytebuf_shift(in, consumed);
    }

    if_ok_or_need_more_return(rv, rv);
    return TB_ERR;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
andq $0x0, 0x8(%rsp)
xorl %eax, %eax
testl %esi, %esi
setne %al
leaq 0x120e6(%rip), %rcx     # 0x25a68
movq 0x228(%rcx,%rax,8), %rax
pushq $-0x1
popq %rbx
testq %rax, %rax
je 0x139d5
leaq 0x8(%rsp), %rsi
callq *%rax
cmpl $-0x2, %eax
je 0x139d3
testl %eax, %eax
jne 0x139d5
movq 0x8(%rsp), %rbx
movq 0x12252(%rip), %rdx     # 0x25c00
cmpq %rbx, %rdx
cmovbq %rdx, %rbx
subq %rbx, %rdx
movq 0x12239(%rip), %rdi     # 0x25bf8
leaq (%rdi,%rbx), %rsi
callq 0x6490
subq %rbx, 0x12231(%rip)     # 0x25c00
xorl %ebx, %ebx
jmp 0x139d5
movl %eax, %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: cellbuf_resize
static int cellbuf_resize(struct cellbuf_t *c, int w, int h) {
    int rv;

    int ow = c->width;
    int oh = c->height;

    if (ow == w && oh == h) {
        return TB_OK;
    }

    w = w < 1 ? 1 : w;
    h = h < 1 ? 1 : h;

    int minw = (w < ow) ? w : ow;
    int minh = (h < oh) ? h : oh;

    struct tb_cell *prev = c->cells;

    if_err_return(rv, cellbuf_init(c, w, h));
    if_err_return(rv, cellbuf_clear(c));

    int x, y;
    for (x = 0; x < minw; x++) {
        for (y = 0; y < minh; y++) {
            struct tb_cell *src, *dst;
            src = &prev[(y * ow) + x];
            if_err_return(rv, cellbuf_get(c, x, y, &dst));
            if_err_return(rv, cell_copy(dst, src));
        }
    }

    tb_free(prev);

    return TB_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, %ebx
movslq (%rdi), %r15
movl 0x4(%rdi), %r13d
movl %r15d, %ecx
xorl %esi, %ecx
movl %r13d, %esi
xorl %edx, %esi
xorl %eax, %eax
orl %ecx, %esi
je 0x13a27
movq %rdi, %r14
cmpl $0x2, %ebx
pushq $0x1
popq %rbp
cmovll %ebp, %ebx
cmpl $0x2, %edx
cmovgel %edx, %ebp
movq 0x8(%rdi), %r12
movl %ebx, %esi
movl %ebp, %edx
callq 0x133df
testl %eax, %eax
je 0x13a36
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl %r13d, %ebp
cmovll %ebp, %r13d
cmpl %r15d, %ebx
cmovgel %r15d, %ebx
movq %r14, %rdi
callq 0x70d8
movq %r12, %rax
xorl %r12d, %r12d
testl %r13d, %r13d
cmovlel %r12d, %r13d
testl %ebx, %ebx
cmovlel %r12d, %ebx
movq %rax, 0x8(%rsp)
addq $0x4, %rax
shlq $0x3, %r15
movq %rbx, 0x10(%rsp)
cmpq %rbx, %r12
je 0x13ac5
movq %rax, 0x18(%rsp)
movq %rax, %rbx
xorl %ebp, %ebp
cmpq %rbp, %r13
je 0x13ab2
movq %r14, %rdi
movl %r12d, %esi
movl %ebp, %edx
leaq 0x20(%rsp), %rcx
callq 0x72c9
testl %eax, %eax
jne 0x13a27
movq 0x20(%rsp), %rax
movl -0x4(%rbx), %ecx
movl %ecx, (%rax)
movl (%rbx), %ecx
movl %ecx, 0x4(%rax)
incq %rbp
addq %r15, %rbx
jmp 0x13a80
incq %r12
movq 0x18(%rsp), %rax
addq $0x8, %rax
movq 0x10(%rsp), %rbx
jmp 0x13a71
movq 0x8(%rsp), %rdi
callq 0x6050
xorl %eax, %eax
jmp 0x13a27
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/vendor/termbox2/termbox2.h
// Function: convert_num
static int convert_num(uint32_t num, char *buf) {
    int i, l = 0;
    char ch;
    do {
        /* '0' = 48; 48 + num%10 < 58 < MAX_8bitCHAR */
        buf[l++] = (char)('0' + (num % 10));
        num /= 10;
    } while (num);
    for (i = 0; i < l / 2; i++) {
        ch = buf[i];
        buf[i] = buf[l - 1 - i];
        buf[l - 1 - i] = ch;
    }
    return l;
}

// Assembly:
xorl %ecx, %ecx
pushq $0xa
popq %r8
movl %edi, %eax
xorl %edx, %edx
divl %r8d
orb $0x30, %dl
movb %dl, (%rsi,%rcx)
incq %rcx
cmpl $0x9, %edi
movl %eax, %edi
ja 0x13adc
movq %rcx, %rax
shrq %rax
negq %rax
leal -0x1(%rcx), %edx
movslq %edx, %rdx
addq %rsi, %rdx
xorl %edi, %edi
cmpq %rdi, %rax
je 0x13b22
movb (%rsi), %r8b
movb (%rdx,%rdi), %r9b
movb %r9b, (%rsi)
movb %r8b, (%rdx,%rdi)
decq %rdi
incq %rsi
jmp 0x13b07
movl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/phpspy.c
// Function: atoi_with_min_or_exit
static int atoi_with_min_or_exit(const char *name, const char *str, int min) {
    long result = strtol_with_min_or_exit(name, str, min);
    #if LONG_MAX > INT_MAX
    if (result > INT_MAX) {
        log_error("Expected value that could fit in a C int for %s, got '%s'\n", name, str);
        usage(stderr, 1);
    }
    #endif
    return (int)result;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x13b6c
movl $0x80000000, %ecx       # imm = 0x80000000
cmpq %rcx, %rax
jge 0x13b46
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x9e2c(%rip), %rdi      # 0x1d979
movq %r14, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0xa442
movq 0x1148f(%rip), %rax     # 0x24ff0
movq (%rax), %rdi
pushq $0x1
popq %rsi
callq 0xa4ea
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/phpspy.c
// Function: strtol_with_min_or_exit
static long strtol_with_min_or_exit(const char *name, const char *str, int min) {
    long result;
    char *end;
    errno = 0;
    result = strtol(str, &end, 10);
    if (end <= str || *end != '\0') {
        /* e.g. reject -H '', -H invalid, -H 5000suffix */
        log_error("Expected integer for %s, got '%s'\n", name, str);
        usage(stderr, 1);
    }
    if (result < min) {
        /* e.g. reject -H 0 */
        log_error("Expected integer >= %d for %s, got '%s'\n", min, name, str);
        usage(stderr, 1);
    }
    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
callq 0x6060
andl $0x0, (%rax)
movq %rsp, %r15
pushq $0xa
popq %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x6340
movq (%r15), %rcx
cmpq %rbx, %rcx
jbe 0x13bb4
cmpb $0x0, (%rcx)
jne 0x13bb4
movslq %ebp, %rcx
cmpq %rcx, %rax
jl 0x13bca
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9df9(%rip), %rdi      # 0x1d9b4
movq %r14, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0xa442
jmp 0x13be0
leaq 0x9e06(%rip), %rdi      # 0x1d9d7
movl %ebp, %esi
movq %r14, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0xa442
movq 0x11409(%rip), %rax     # 0x24ff0
movq (%rax), %rdi
pushq $0x1
popq %rsi
callq 0xa4ea
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/phpspy.c
// Function: redirect_child_stdio
static void redirect_child_stdio(int proc_fd, char *opt_path) {
    char *redir_path;
    FILE *redir_file;
    if (strcmp(opt_path, "-") == 0) {
        return;
    } else if (strstr(opt_path, "%d") != NULL) {
        if (asprintf(&redir_path, opt_path, getpid()) < 0) {
            errno = ENOMEM;
            perror("asprintf");
            exit(1);
        }
    } else {
        if ((redir_path = strdup(opt_path)) == NULL) {
            perror("strdup");
            exit(1);
        }
    }
    if ((redir_file = fopen(redir_path, "w")) == NULL) {
        perror("fopen");
        free(redir_path);
        exit(1);
    }
    dup2(fileno(redir_file), proc_fd);
    fclose(redir_file);
    free(redir_path);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movl %edi, %ebx
cmpb $0x2d, (%rsi)
jne 0x13c07
cmpb $0x0, 0x1(%r14)
je 0x13c83
leaq 0xa7d9(%rip), %rsi      # 0x1e3e7
movq %r14, %rdi
callq 0x6610
testq %rax, %rax
je 0x13c39
callq 0x6130
movq %rsp, %rdi
movq %r14, %rsi
movl %eax, %edx
xorl %eax, %eax
callq 0x6460
testl %eax, %eax
js 0x13ca2
movq (%rsp), %rdi
jmp 0x13c4d
movq %r14, %rdi
callq 0x65c0
movq %rax, %rdi
movq %rax, (%rsp)
testq %rax, %rax
je 0x13cb6
leaq 0x9ea5(%rip), %rsi      # 0x1daf9
callq 0x6520
testq %rax, %rax
je 0x13c8b
movq %rax, %r14
movq %rax, %rdi
callq 0x6380
movl %eax, %edi
movl %ebx, %esi
callq 0x6180
movq %r14, %rdi
callq 0x6140
movq (%rsp), %rdi
callq 0x6050
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x9e69(%rip), %rdi      # 0x1dafb
callq 0x6530
movq (%rsp), %rdi
callq 0x6050
jmp 0x13cc2
callq 0x6060
movl $0xc, (%rax)
leaq 0xa7e0(%rip), %rdi      # 0x1e494
jmp 0x13cbd
leaq 0x9e35(%rip), %rdi      # 0x1daf2
callq 0x6530
pushq $0x1
popq %rdi
callq 0x6590
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/phpspy.c
// Function: copy_proc_mem
static int copy_proc_mem(pid_t pid, const char *what, void *raddr, void *laddr, size_t size) {
    struct iovec local[1];
    struct iovec remote[1];

    if (raddr == NULL) {
        log_error("copy_proc_mem: Not copying %s; raddr is NULL\n", what);
        return PHPSPY_ERR;
    }

    local[0].iov_base = laddr;
    local[0].iov_len = size;
    remote[0].iov_base = raddr;
    remote[0].iov_len = size;

    if (process_vm_readv(pid, local, 1, remote, 1, 0) == -1) {
        if (errno == ESRCH) { /* No such process */
            perror("process_vm_readv");
            return PHPSPY_ERR | PHPSPY_ERR_PID_DEAD;
        }
        log_error("copy_proc_mem: Failed to copy %s; err=%s raddr=%p size=%lu\n", what, strerror(errno), raddr, size);
        return PHPSPY_ERR;
    }

    return PHPSPY_OK;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
testq %rdx, %rdx
je 0x14157
movq %r8, %r14
movq %rdx, %r15
leaq 0x10(%rsp), %rsi
movq %rcx, (%rsi)
movq %r8, 0x8(%rsi)
movq %rsp, %rcx
movq %rdx, (%rcx)
movq %r8, 0x8(%rcx)
xorl %r12d, %r12d
pushq $0x1
popq %rdx
movq %rdx, %r8
xorl %r9d, %r9d
callq 0x6300
cmpq $-0x1, %rax
jne 0x1416c
callq 0x6060
movl (%rax), %edi
cmpl $0x3, %edi
je 0x1417b
callq 0x65d0
leaq 0x9ca9(%rip), %rdi      # 0x1ddeb
movq %rbx, %rsi
movq %rax, %rdx
movq %r15, %rcx
movq %r14, %r8
xorl %eax, %eax
callq 0xa442
jmp 0x14168
leaq 0x9c4e(%rip), %rdi      # 0x1ddac
movq %rbx, %rsi
xorl %eax, %eax
callq 0xa442
pushq $0x1
popq %r12
movl %r12d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x9c58(%rip), %rdi      # 0x1ddda
callq 0x6530
pushq $0x3
jmp 0x1416a
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/./phpspy_trace.c
// Function: sprint_zstring_70
static int sprint_zstring(trace_context_t *context, const char *what, zend_string *rzstring, char *buf, size_t buf_size, size_t *buf_len) {
    int rv;
    zend_string lzstring;

    *buf = '\0';
    *buf_len = 0;
    try_copy_proc_mem(what, rzstring, &lzstring, sizeof(lzstring));
    *buf_len = PHPSPY_MIN(lzstring.len, PHPSPY_MAX(1, buf_size)-1);
    try_copy_proc_mem(what, ((char*)rzstring) + offsetof(zend_string, val), buf, *buf_len);
    *(buf + (int)*buf_len) = '\0';

    return PHPSPY_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %rbx
movq %r8, %r15
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %r13
movq %rdi, %rbp
movb $0x0, (%rcx)
andq $0x0, (%r9)
movl (%rdi), %edi
leaq 0xf(%rsp), %rcx
pushq $0x19
popq %r8
callq 0x140e4
testl %eax, %eax
jne 0x14203
cmpq $0x1, %r15
adcq $-0x1, %r15
movq 0x1f(%rsp), %rax
cmpq %r15, %rax
cmovbq %rax, %r15
movq %r15, (%rbx)
movl (%rbp), %edi
addq $0x18, %r12
movq %r13, %rsi
movq %r12, %rdx
movq %r14, %rcx
movq %r15, %r8
callq 0x140e4
testl %eax, %eax
jne 0x14203
movslq (%rbx), %rax
movb $0x0, (%r14,%rax)
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/./phpspy_trace.c
// Function: copy_zarray_bucket_70
static int copy_zarray_bucket(trace_context_t *context, zend_array *rzarray, const char *key, Bucket *lbucket) {
    int rv;
    zend_array lzarray;
    uint32_t hash_table_size;
    uint64_t hash_val;
    uint32_t hash_index;
    uint32_t hash_table_val;
    uint32_t *hash_bucket;
    char tmp_key[PHPSPY_STR_SIZE];
    size_t tmp_len;

    try_copy_proc_mem("array", rzarray, &lzarray, sizeof(lzarray));

    hash_val = phpspy_zend_inline_hash_func(key, strlen(key));
    hash_table_size = (uint32_t)(-1 * (int32_t)lzarray.nTableMask);
    hash_index = hash_val % hash_table_size;

    try_copy_proc_mem("hash_table_val", ((uint32_t*)lzarray.arData) - hash_table_size + hash_index, &hash_table_val, sizeof(uint32_t));

    hash_bucket = &hash_table_val;

    do {
        if (*hash_bucket == (uint32_t)-1) return PHPSPY_ERR;

        /* Copy the next bucket from array data */
        try_copy_proc_mem("bucket", lzarray.arData + *hash_bucket, lbucket, sizeof(Bucket));

        if (lbucket->key == NULL) {
            break;
        }

        /* On hash collision, advance to the next bucket */
        try(rv, sprint_zstring(context, "array_key", lbucket->key, tmp_key, sizeof(tmp_key), &tmp_len));

        if (strcmp(key, tmp_key) == 0) {
            hash_bucket = NULL;
        } else {
            hash_bucket = &lbucket->val.u2.next;
        }
    } while (hash_bucket);

    return PHPSPY_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %rdx
movq %rdi, %r15
movl (%rdi), %edi
leaq 0x9a47(%rip), %rsi      # 0x1de82
leaq 0x1c(%rsp), %rcx
pushq $0x24
popq %r8
callq 0x140e4
testl %eax, %eax
jne 0x1449a
movq %r14, %rdi
callq 0x6160
movq %r14, %rdi
movq %rax, %rsi
callq 0x13100
xorl %ecx, %ecx
subl 0x28(%rsp), %ecx
xorl %edx, %edx
divq %rcx
movl (%r15), %edi
movq 0x2c(%rsp), %rax
shlq $0x2, %rcx
subq %rcx, %rax
leaq (%rax,%rdx,4), %rdx
leaq 0x9a56(%rip), %rsi      # 0x1dedb
leaq 0xc(%rsp), %r13
pushq $0x4
popq %r8
movq %r13, %rcx
callq 0x140e4
testl %eax, %eax
je 0x144b0
movl %eax, %ebp
movl %ebp, %eax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xc(%rbx), %rax
movq %rax, (%rsp)
leaq 0x40(%rsp), %r12
movl (%r13), %edx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, %rdx
je 0x14532
movl (%r15), %edi
shlq $0x5, %rdx
addq 0x2c(%rsp), %rdx
leaq 0x9a0c(%rip), %rsi      # 0x1deea
movq %rbx, %rcx
pushq $0x20
popq %r8
callq 0x140e4
testl %eax, %eax
jne 0x1449a
movq 0x18(%rbx), %rdx
xorl %ebp, %ebp
testq %rdx, %rdx
je 0x1449c
movl $0x100, %r8d            # imm = 0x100
movq %r15, %rdi
leaq 0x9987(%rip), %rsi      # 0x1de90
movq %r12, %rcx
leaq 0x10(%rsp), %r9
callq 0x1418b
testl %eax, %eax
jne 0x1449a
movq %r14, %rdi
movq %r12, %rsi
callq 0x6310
movq (%rsp), %r13
testl %eax, %eax
jne 0x144bd
jmp 0x1449c
pushq $0x1
popq %rbp
jmp 0x1449c
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/pgrep.c
// Function: run_signal_thread
static void *run_signal_thread(void *arg) {
    int rv, ignore;
    fd_set rfds;
    struct timeval tv;
    struct sigaction sa;

    (void)arg;

    /* Create done_pipe */
    rv = pipe(done_pipe);
    rv = fcntl(done_pipe[1], F_SETFL, O_NONBLOCK);

    /* Install signal handler */
    memset(&sa, 0, sizeof(struct sigaction));
    sa.sa_handler = handle_signal;
    sigaction(SIGINT, &sa, NULL);
    sigaction(SIGTERM, &sa, NULL);
    sigaction(SIGHUP, &sa, NULL);
    sigaction(SIGALRM, &sa, NULL);
    sa.sa_handler = SIG_IGN;
    sigaction(SIGPIPE, &sa, NULL);

    /* Wait for write on done_pipe from write_done_pipe */
    do {
        FD_ZERO(&rfds);
        FD_SET(done_pipe[0], &rfds);
        tv.tv_sec = 1;
        tv.tv_usec = 0;
        rv = select(done_pipe[0]+1, &rfds, NULL, NULL, &tv);
    } while (rv < 1);

    /* Read pipe for fun */
    rv = read(done_pipe[0], &ignore, sizeof(int));

    /* Set done flag; wake up all threads */
    done = 1;
    pthread_mutex_lock(&mutex);
    pthread_cond_broadcast(&can_consume);
    pthread_cond_broadcast(&can_produce);
    pthread_mutex_unlock(&mutex);

    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x130, %rsp            # imm = 0x130
leaq 0xf067(%rip), %rdi      # 0x25a50
callq 0x6270
movl 0xf060(%rip), %edi      # 0x25a54
xorl %r15d, %r15d
pushq $0x4
popq %rsi
movl $0x800, %edx            # imm = 0x800
xorl %eax, %eax
callq 0x6100
leaq 0xa0(%rsp), %rbx
movl $0x90, %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x6230
leaq 0x27e(%rip), %rax       # 0x16ca2
movq %rax, -0x8(%rbx)
pushq $0x2
popq %rdi
leaq 0x98(%rsp), %rbx
movq %rbx, %rsi
xorl %edx, %edx
callq 0x60d0
pushq $0xf
popq %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x60d0
pushq $0x1
popq %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x60d0
pushq $0xe
popq %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x60d0
movq $0x1, (%rbx)
pushq $0xd
popq %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x60d0
pushq $0x40
popq %rbp
pushq $0x1
popq %r12
leaq 0x18(%rsp), %rbx
leaq 0x8(%rsp), %r14
cmpq $0x10, %r15
je 0x16a9a
andq $0x0, 0x18(%rsp,%r15,8)
incq %r15
jmp 0x16a89
movl 0xefb0(%rip), %edi      # 0x25a50
movl %edi, %eax
cltd
idivl %ebp
movslq %eax, %rdx
shll $0x6, %eax
movl %edi, %ecx
subl %eax, %ecx
movq %r12, %rax
shlq %cl, %rax
orq %rax, 0x18(%rsp,%rdx,8)
movq %r12, 0x8(%rsp)
andq $0x0, 0x10(%rsp)
incl %edi
movq %rbx, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
movq %r14, %r8
callq 0x6390
movl $0x0, %r15d
testl %eax, %eax
jle 0x16a89
movl 0xef6a(%rip), %edi      # 0x25a50
leaq 0x4(%rsp), %rsi
pushq $0x4
popq %rdx
callq 0x62b0
leaq 0xf61a(%rip), %rax      # 0x26114
movl $0x1, (%rax)
leaq 0xf6f9(%rip), %rbx      # 0x26200
movq %rbx, %rdi
callq 0x6620
leaq 0xf68a(%rip), %rdi      # 0x261a0
callq 0x60a0
leaq 0xf6ae(%rip), %rdi      # 0x261d0
callq 0x60a0
movq %rbx, %rdi
callq 0x63d0
xorl %eax, %eax
addq $0x130, %rsp            # imm = 0x130
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/adsr[P]phpspy/pgrep.c
// Function: run_work_thread
static void *run_work_thread(void *arg) {
    int worker_num;
    worker_num = (long)arg;
    while (!done) {
        if (wait_for_turn('c')) break;
        attached_pids[worker_num] = avail_pids[--avail_pids_count];
        pthread_cond_signal(&can_produce);
        pthread_mutex_unlock(&mutex);
        main_pid(attached_pids[worker_num]);
        attached_pids[worker_num] = 0;
    }
    return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movslq %edi, %r12
leaq 0xf5c0(%rip), %r13      # 0x26114
pushq $0x63
popq %rbx
leaq 0xf672(%rip), %r14      # 0x261d0
leaq 0xf69b(%rip), %r15      # 0x26200
cmpl $0x0, (%r13)
jne 0x16bcc
movl %ebx, %edi
callq 0x16bfb
testl %eax, %eax
jne 0x16bcc
movq 0xf61a(%rip), %rax      # 0x26198
movslq 0xf60b(%rip), %rcx      # 0x26190
leaq -0x1(%rcx), %rdx
movl %edx, 0xf601(%rip)      # 0x26190
movl -0x4(%rax,%rcx,4), %eax
movq 0xf68e(%rip), %rcx      # 0x26228
movl %eax, (%rcx,%r12,4)
movq %r14, %rdi
callq 0x62d0
movq %r15, %rdi
callq 0x63d0
movq 0xf673(%rip), %rax      # 0x26228
movl (%rax,%r12,4), %edi
callq 0x9b6a
movq 0xf663(%rip), %rax      # 0x26228
andl $0x0, (%rax,%r12,4)
jmp 0x16b65
xorl %eax, %eax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq