LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/termbox[P]termbox/termbox.c
// Function: tb_blit
void tb_blit(int x, int y, int w, int h, const struct tb_cell *cells) {
    if (x + w < 0 || x >= back_buffer.width)
        return;
    if (y + h < 0 || y >= back_buffer.height)
        return;
    int xo = 0, yo = 0, ww = w, hh = h;
    if (x < 0) {
        xo = -x;
        ww -= xo;
        x = 0;
    }
    if (y < 0) {
        yo = -y;
        hh -= yo;
        y = 0;
    }
    if (ww > back_buffer.width - x)
        ww = back_buffer.width - x;
    if (hh > back_buffer.height - y)
        hh = back_buffer.height - y;

    int sy;
    struct tb_cell *dst = &CELL(&back_buffer, x, y);
    const struct tb_cell *src = cells + yo * w + xo;
    size_t size = sizeof(struct tb_cell) * ww;

    for (sy = 0; sy < hh; ++sy) {
        memcpy(dst, src, size);
        dst += back_buffer.width;
        src += w;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %r11d
addl %edi, %r11d
setns %r9b
movl 0x51ad(%rip), %eax      # 0x9900
cmpl %edi, %eax
setg %r10b
movl %ecx, %ebx
addl %esi, %ebx
setns %r14b
andb %r9b, %r14b
andb %r10b, %r14b
movl 0x5197(%rip), %ebp      # 0x9904
cmpl %esi, %ebp
setg %r9b
andb %r14b, %r9b
cmpb $0x1, %r9b
jne 0x4817
xorl %r9d, %r9d
testl %edi, %edi
cmovnsl %edx, %r11d
movl $0x0, %r10d
cmovgl %edi, %r10d
testl %esi, %esi
cmovgl %esi, %r9d
cmovsl %ebx, %ecx
movl %eax, %ebx
subl %r10d, %ebx
cmpl %ebx, %r11d
cmovll %r11d, %ebx
subl %r9d, %ebp
cmpl %ebp, %ecx
cmovll %ecx, %ebp
testl %ebp, %ebp
jle 0x4817
movslq %ebx, %rbx
shlq $0x3, %rbx
movl %esi, %ecx
negl %ecx
sarl $0x1f, %esi
andl %ecx, %esi
imull %edx, %esi
movslq %esi, %rcx
leaq (%r8,%rcx,8), %rcx
movl %edi, %esi
negl %esi
sarl $0x1f, %edi
andl %esi, %edi
leaq (%rcx,%rdi,8), %r14
imull %r9d, %eax
addl %r10d, %eax
movslq %eax, %r15
shlq $0x3, %r15
addq 0x5118(%rip), %r15      # 0x9908
movslq %edx, %r12
shlq $0x3, %r12
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x3170
movslq 0x50f4(%rip), %rax      # 0x9900
leaq (%r15,%rax,8), %r15
addq %r12, %r14
decl %ebp
jne 0x47f7
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/termbox[P]termbox/termbox.c
// Function: tb_clear
void tb_clear(void) {
    if (buffer_size_change_request) {
        update_size();
        buffer_size_change_request = 0;
    }
    cellbuf_clear(&back_buffer);
}

// Assembly:
pushq %rax
cmpl $0x0, 0x4e77(%rip)      # 0x9920
je 0x4aba
callq 0x41e7
movl $0x0, 0x4e66(%rip)      # 0x9920
movl 0x4e44(%rip), %esi      # 0x9904
imull 0x4e39(%rip), %esi      # 0x9900
testl %esi, %esi
jle 0x4afd
movq 0x4e36(%rip), %rax      # 0x9908
movzwl 0x4e4b(%rip), %ecx      # 0x9924
movzwl 0x4e46(%rip), %edx      # 0x9926
movl %esi, %esi
xorl %edi, %edi
movl $0x20, (%rax,%rdi,8)
movw %cx, 0x4(%rax,%rdi,8)
movw %dx, 0x6(%rax,%rdi,8)
incq %rdi
cmpq %rdi, %rsi
jne 0x4ae4
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O3/termbox[P]termbox/termbox.c
// Function: tb_select_input_mode
int tb_select_input_mode(int mode) {
    if (mode) {
        if ((mode & (TB_INPUT_ESC | TB_INPUT_ALT)) == 0)
            mode |= TB_INPUT_ESC;

        /* technically termbox can handle that, but let's be nice and show here
           what mode is actually used */
        if ((mode & (TB_INPUT_ESC | TB_INPUT_ALT)) ==
            (TB_INPUT_ESC | TB_INPUT_ALT))
            mode &= ~TB_INPUT_ALT;

        inputmode = mode;
        if (mode & TB_INPUT_MOUSE) {
            bytebuffer_puts(&output_buffer, funcs[T_ENTER_MOUSE]);
            bytebuffer_flush(&output_buffer, inout);
        } else {
            bytebuffer_puts(&output_buffer, funcs[T_EXIT_MOUSE]);
            bytebuffer_flush(&output_buffer, inout);
        }
    }
    return inputmode;
}

// Assembly:
testl %edi, %edi
je 0x4b6e
pushq %rbx
xorl %eax, %eax
testb $0x3, %dil
sete %al
orl %edi, %eax
movl %eax, %ecx
notl %ecx
movl %eax, %edx
andl $-0x3, %edx
testb $0x3, %cl
cmovnel %eax, %edx
movl %edx, 0x4634(%rip)      # 0x9158
xorl %eax, %eax
testb $0x4, %dl
sete %al
movq 0x4dc5(%rip), %rcx      # 0x98f8
movq 0x60(%rcx,%rax,8), %rbx
movq %rbx, %rdi
callq 0x30c0
movq %rbx, %rdi
movl %eax, %esi
callq 0x4ceb
movl 0x4d40(%rip), %edi      # 0x9890
movq 0x4d91(%rip), %rsi      # 0x98e8
movslq 0x4d92(%rip), %rdx      # 0x98f0
callq 0x30a0
movl $0x0, 0x4d83(%rip)      # 0x98f0
popq %rbx
movl 0x45e4(%rip), %eax      # 0x9158
retq
// File: /workspace/github_c_makefile_star2_O3/termbox[P]termbox/termbox.c
// Function: terminfo_try_path
static char *terminfo_try_path(const char *path, const char *term) {
    char tmp[4096];
    snprintf(tmp, sizeof(tmp), "%s/%c/%s", path, term[0], term);
    tmp[sizeof(tmp) - 1] = '\0';
    char *data = read_file(tmp);
    if (data) {
        return data;
    }

    // fallback to darwin specific dirs structure
    snprintf(tmp, sizeof(tmp), "%s/%x/%s", path, term[0], term);
    tmp[sizeof(tmp) - 1] = '\0';
    return read_file(tmp);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x1000, %rsp           # imm = 0x1000
movq %rsi, %rbx
movq %rdi, %r14
movsbl (%rsi), %r8d
leaq 0x15bc(%rip), %rdx      # 0x61a1
movq %rsp, %r15
movl $0x1000, %esi           # imm = 0x1000
movq %r15, %rdi
movq %r14, %rcx
movq %rbx, %r9
xorl %eax, %eax
callq 0x30d0
movb $0x0, 0xfff(%r15)
movq %r15, %rdi
callq 0x4c52
testq %rax, %rax
jne 0x4c45
movsbl (%rbx), %r8d
leaq 0x158d(%rip), %rdx      # 0x61aa
movq %rsp, %r15
movl $0x1000, %esi           # imm = 0x1000
movq %r15, %rdi
movq %r14, %rcx
movq %rbx, %r9
xorl %eax, %eax
callq 0x30d0
movb $0x0, 0xfff(%r15)
movq %r15, %rdi
callq 0x4c52
addq $0x1000, %rsp           # imm = 0x1000
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/termbox[P]termbox/termbox.c
// Function: read_file
static char *read_file(const char *file) {
    FILE *f = fopen(file, "rb");
    if (!f)
        return 0;

    struct stat st;
    if (fstat(fileno(f), &st) != 0) {
        fclose(f);
        return 0;
    }

    char *data = malloc(st.st_size);
    if (!data) {
        fclose(f);
        return 0;
    }

    if (fread(data, 1, st.st_size, f) != (size_t)st.st_size) {
        fclose(f);
        free(data);
        return 0;
    }

    fclose(f);
    return data;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x98, %rsp
leaq 0x154c(%rip), %rsi      # 0x61b3
callq 0x3210
testq %rax, %rax
je 0x4c94
movq %rax, %rbx
movq %rax, %rdi
callq 0x3180
leaq 0x8(%rsp), %rsi
movl %eax, %edi
callq 0x3240
testl %eax, %eax
je 0x4ca9
movq %rbx, %rdi
callq 0x30b0
xorl %r14d, %r14d
movq %r14, %rax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x38(%rsp), %r15
movq %r15, %rdi
callq 0x31b0
testq %rax, %rax
je 0x4c8c
movq %rax, %r14
movl $0x1, %esi
movq %rax, %rdi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x3090
movq %rax, %r12
movq %rbx, %rdi
callq 0x30b0
cmpq %r15, %r12
je 0x4c97
movq %r14, %rdi
callq 0x3040
jmp 0x4c94
// File: /workspace/github_c_makefile_star2_O3/termbox[P]termbox/termbox.c
// Function: cellbuf_resize
static void cellbuf_resize(struct cellbuf *buf, int width, int height) {
    if (buf->width == width && buf->height == height)
        return;

    int oldw = buf->width;
    int oldh = buf->height;
    struct tb_cell *oldcells = buf->cells;

    cellbuf_init(buf, width, height);
    cellbuf_clear(buf);

    int minw = (width < oldw) ? width : oldw;
    int minh = (height < oldh) ? height : oldh;
    int i;

    for (i = 0; i < minh; ++i) {
        struct tb_cell *csrc = oldcells + (i * oldw);
        struct tb_cell *cdst = buf->cells + (i * width);
        memcpy(cdst, csrc, sizeof(struct tb_cell) * minw);
    }

    free(oldcells);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movslq (%rdi), %r14
movl %r14d, %eax
xorl %esi, %eax
movl 0x4(%rdi), %r12d
movl %r12d, %ecx
xorl %edx, %ecx
orl %eax, %ecx
jne 0x4ded
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %edx, %ebp
movl %esi, %r15d
movq %rdi, %rbx
movq 0x8(%rdi), %rax
movq %rax, 0x8(%rsp)
callq 0x3da6
movl 0x4(%rbx), %esi
imull (%rbx), %esi
testl %esi, %esi
jle 0x4e3c
movq 0x8(%rbx), %rax
movzwl 0x4b0c(%rip), %ecx      # 0x9924
movzwl 0x4b07(%rip), %edx      # 0x9926
movl %esi, %esi
xorl %edi, %edi
movl $0x20, (%rax,%rdi,8)
movw %cx, 0x4(%rax,%rdi,8)
movw %dx, 0x6(%rax,%rdi,8)
incq %rdi
cmpq %rdi, %rsi
jne 0x4e23
cmpl %ebp, %r12d
cmovll %r12d, %ebp
testl %ebp, %ebp
jle 0x4ea0
movq %r14, %rax
cmpl %r15d, %eax
movslq %r15d, %rcx
cmovll %eax, %r15d
movslq %r15d, %rdx
shlq $0x3, %rdx
movq %rdx, 0x10(%rsp)
movl %ebp, %ebp
shlq $0x3, %rcx
movq %rcx, %r15
shlq $0x3, %rax
xorl %r13d, %r13d
movq 0x8(%rsp), %r12
movq 0x8(%rbx), %rdi
addq %r13, %rdi
movq %r12, %rsi
movq %rbx, %r14
movq %rax, %rbx
movq 0x10(%rsp), %rdx
callq 0x3170
movq %rbx, %rax
movq %r14, %rbx
addq %r15, %r13
addq %rax, %r12
decq %rbp
jne 0x4e75
movq 0x8(%rsp), %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3040
// File: /workspace/github_c_makefile_star2_O3/termbox[P]termbox/termbox.c
// Function: read_up_to
static int read_up_to(int n) {
    assert(n > 0);
    const int prevlen = input_buffer.len;
    bytebuffer_resize(&input_buffer, prevlen + n);

    int read_n = 0;
    while (read_n <= n) {
        ssize_t r = 0;
        if (read_n < n) {
            r = read(inout, input_buffer.buf + prevlen + read_n, n - read_n);
        }
#ifdef __CYGWIN__
        // While linux man for tty says when VMIN == 0 && VTIME == 0, read
        // should return 0 when there is nothing to read, cygwin's read returns
        // -1. Not sure why and if it's correct to ignore it, but let's pretend
        // it's zero.
        if (r < 0)
            r = 0;
#endif
        if (r < 0) {
            // EAGAIN / EWOULDBLOCK shouldn't occur here
            assert(errno != EAGAIN && errno != EWOULDBLOCK);
            return -1;
        } else if (r > 0) {
            read_n += r;
        } else {
            bytebuffer_resize(&input_buffer, prevlen + read_n);
            return read_n;
        }
    }
    assert(!"unreachable");
    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movslq 0x4579(%rip), %r14      # 0x98e0
leal 0x40(%r14), %ebp
movl %ebp, %edi
callq 0x540e
xorl %ebx, %ebx
cmpl $0x40, %ebx
je 0x5400
movl 0x450d(%rip), %edi      # 0x9890
movq 0x454e(%rip), %rax      # 0x98d8
addq %r14, %rax
movslq %ebx, %rsi
addq %rax, %rsi
movl $0x40, %edx
subl %ebx, %edx
callq 0x3140
testq %rax, %rax
js 0x53cc
je 0x53fa
addl %eax, %ebx
cmpl $0x40, %ebx
jle 0x5374
leaq 0x10a1(%rip), %rdi      # 0x6455
leaq 0xfbb(%rip), %rsi       # 0x6376
leaq 0x1057(%rip), %rcx      # 0x6419
movl $0x4c2, %edx            # imm = 0x4C2
callq 0x30e0
callq 0x3060
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $0xb, (%rax)
jne 0x5407
leaq 0x104b(%rip), %rdi      # 0x642d
leaq 0xf8d(%rip), %rsi       # 0x6376
leaq 0x1029(%rip), %rcx      # 0x6419
movl $0x4b9, %edx            # imm = 0x4B9
callq 0x30e0
addl %ebx, %r14d
movl %r14d, %ebp
movl %ebp, %edi
callq 0x540e
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/termbox[P]termbox/utf8.c
// Function: tb_utf8_char_to_unicode
int tb_utf8_char_to_unicode(uint32_t *out, const char *c) {
    if (*c == 0)
        return TB_EOF;

    int i;
    unsigned char len = tb_utf8_char_length(*c);
    unsigned char mask = utf8_mask[len - 1];
    uint32_t result = c[0] & mask;
    for (i = 1; i < len; ++i) {
        result <<= 6;
        result |= c[i] & 0x3f;
    }

    *out = result;
    return (int)len;
}

// Assembly:
movzbl (%rsi), %edx
testq %rdx, %rdx
je 0x54bf
leaq 0xffd(%rip), %rax       # 0x6470
movzbl (%rdx,%rax), %eax
leaq 0x10f2(%rip), %rcx      # 0x6570
movb -0x1(%rax,%rcx), %cl
andb %dl, %cl
movzbl %cl, %ecx
addq $-0xc0, %rdx
cmpq $0x3d, %rdx
ja 0x54bc
cmpl $0x3, %eax
movl $0x2, %edx
cmovael %eax, %edx
movl $0x1, %r8d
shll $0x6, %ecx
movzbl (%rsi,%r8), %r9d
andl $0x3f, %r9d
orl %r9d, %ecx
incq %r8
cmpq %r8, %rdx
jne 0x54a5
movl %ecx, (%rdi)
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
// File: /workspace/github_c_makefile_star2_O3/termbox[P]termbox/utf8.c
// Function: tb_utf8_unicode_to_char
int tb_utf8_unicode_to_char(char *out, uint32_t c) {
    int len = 0;
    int first;
    int i;

    if (c < 0x80) {
        first = 0;
        len = 1;
    } else if (c < 0x800) {
        first = 0xc0;
        len = 2;
    } else if (c < 0x10000) {
        first = 0xe0;
        len = 3;
    } else if (c < 0x200000) {
        first = 0xf0;
        len = 4;
    } else if (c < 0x4000000) {
        first = 0xf8;
        len = 5;
    } else {
        first = 0xfc;
        len = 6;
    }

    for (i = len - 1; i > 0; --i) {
        out[i] = (c & 0x3f) | 0x80;
        c >>= 6;
    }
    out[0] = c | first;

    return len;
}

// Assembly:
cmpl $0x80, %esi
jae 0x54d6
movl $0x1, %eax
xorl %ecx, %ecx
jmp 0x554d
cmpl $0x800, %esi            # imm = 0x800
jae 0x54ea
movl $0xc0, %ecx
movl $0x2, %eax
jmp 0x552c
cmpl $0x10000, %esi          # imm = 0x10000
jae 0x54fe
movl $0xe0, %ecx
movl $0x3, %eax
jmp 0x552c
cmpl $0x200000, %esi         # imm = 0x200000
jae 0x5512
movl $0xf0, %ecx
movl $0x4, %eax
jmp 0x552c
xorl %ecx, %ecx
cmpl $0x4000000, %esi        # imm = 0x4000000
setae %cl
movl $0x6, %eax
sbbl $0x0, %eax
leal 0xf8(,%rcx,4), %ecx
movl %eax, %edx
incq %rdx
movl %esi, %r8d
andb $0x3f, %r8b
orb $-0x80, %r8b
movb %r8b, -0x2(%rdi,%rdx)
shrl $0x6, %esi
decq %rdx
cmpq $0x2, %rdx
ja 0x5531
orl %esi, %ecx
movb %cl, (%rdi)
retq
// File: /workspace/github_c_makefile_star2_O3/antonblanchard[P]will-it-scale/tests/unix1.c
// Function: testcase
void testcase(unsigned long long *iterations, unsigned long nr)
{
	int fd[2];
	char c;
	int ret;

	socketpair(AF_UNIX, SOCK_STREAM, 0, fd);

	while (1) {
		do {
			ret = write(fd[WRITE], &c, 1);
		} while (ret != 1 && errno == EINTR);

		do {
			ret = read(fd[READ], &c, 1);
		} while (ret != 1 && errno == EINTR);

		(*iterations)++;
	}
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq 0x10(%rsp), %rcx
movl $0x1, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x2170
leaq 0xf(%rsp), %r14
movl 0x14(%rsp), %edi
movl $0x1, %edx
movq %r14, %rsi
callq 0x20d0
cmpl $0x1, %eax
je 0x2cb9
callq 0x2070
cmpl $0x4, (%rax)
je 0x2c99
movl 0x10(%rsp), %edi
movl $0x1, %edx
movq %r14, %rsi
callq 0x2140
cmpl $0x1, %eax
je 0x2cd9
callq 0x2070
cmpl $0x4, (%rax)
je 0x2cb9
incq (%rbx)
jmp 0x2c99
// File: /workspace/github_c_makefile_star2_O3/wtakuo[P]SVM/vmbench.c
// Function: main
int main (int argc, char *argv[]) {
    vm_mode_t mode = vm_normal_mode;
    int x, y, z;
    int i = 1;

    while (i < argc && argv[i][0] == '-') {
        char *arg = argv[i];
        int j = 1;
        while (arg[j] != '\0') {
            switch (arg[j]) {
            case 't':
                mode = vm_trace_mode;
                break;
            case 's':
                mode = vm_step_mode;
                break;
            default:
                fprintf(stderr, "usage: %s [-t][-s] x y z\n", argv[0]);
                return EXIT_FAILURE;
            }
            j++;
        }
        i++;
    }
    if (argc < i + 3) {
        fprintf(stderr, "usage: %s [-t][-s] x y z\n", argv[0]);
        return EXIT_FAILURE;
    }
    x = atoi(argv[i]);
    y = atoi(argv[i+1]);
    z = atoi(argv[i+2]);

    vmtest(x, y, z, mode);

    return EXIT_SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
cmpl $0x2, %edi
jl 0x16b4
movl %edi, %ecx
xorl %ebp, %ebp
movl $0x1, %eax
movq (%rbx,%rax,8), %rdx
cmpb $0x2d, (%rdx)
jne 0x16bb
incq %rdx
movzbl (%rdx), %r8d
cmpl $0x73, %r8d
je 0x1697
movl $0x1, %esi
cmpl $0x74, %r8d
je 0x169c
jmp 0x16a3
movl $0x2, %esi
incq %rdx
movl %esi, %ebp
jmp 0x1680
testl %r8d, %r8d
jne 0x16fb
incq %rax
cmpq %rcx, %rax
jne 0x1674
movl %edi, %eax
jmp 0x16bb
movl $0x1, %eax
xorl %ebp, %ebp
leal 0x3(%rax), %ecx
cmpl %edi, %ecx
jg 0x1711
movl %eax, %r12d
movq (%rbx,%r12,8), %rdi
callq 0x1080
movl %eax, %r14d
movq 0x8(%rbx,%r12,8), %rdi
callq 0x1080
movl %eax, %r15d
movq 0x10(%rbx,%r12,8), %rdi
callq 0x1080
movl %r14d, %edi
movl %r15d, %esi
movl %eax, %edx
movl %ebp, %ecx
callq 0x15c4
xorl %eax, %eax
jmp 0x1708
movq %rbx, %rdi
callq 0x1102
movl $0x1, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x10e4
jmp 0x1703
// File: /workspace/github_c_makefile_star2_O3/sasairc[P]yasuna/src/libbenly/src/env.c
// Function: split_env
int split_env(char* env, env_t **dest)
{
    if (env == NULL)
        return -1;

    int     x       = 0,
            y       = 0;

    size_t  i       = 0,
            head    = 0,
            tail    = 0;

    env_t*  buf     = NULL;

    if ((buf = (env_t*)
                malloc(sizeof(env_t))) == NULL)
        return -1;

    i = 0;
    buf->envc = 1;
    while (i < strlen(env)) {
        if (*(env + i) == ':')
            buf->envc++;
        i++;
    }
    if ((buf->envs = (char**)
                malloc(sizeof(char*) * buf->envc)) == NULL)
        goto ERR;

    i = x = y = head = tail = 0;
    do {
        if (*(env + tail) == ':' || *(env + tail) == '\0') {
            if ((*(buf->envs + y) = (char*)
                        malloc(sizeof(char) * (tail - head + 1))) == NULL)
                goto ERR;

            while (head < tail) {
                *(*(buf->envs + y) + x) = *(env + head);
                head++;
                x++;
            }
            *(*(buf->envs + y) + x) = '\0';
            x = 0;
            head++;
            y++;
        }
        tail++;
    } while (y < buf->envc);

    *dest = buf;

    return 0;

ERR:
    release_env_t(buf);

    return -2;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x1256
movq %rsi, %rbx
movq %rdi, %r14
movl $0x10, %edi
callq 0x1050
testq %rax, %rax
je 0x1256
movq %rax, %r15
movq %rbx, (%rsp)
movl $0x1, (%rax)
movq %r14, %rdi
callq 0x1040
movl $0x1, %ebx
testq %rax, %rax
je 0x11a3
xorl %ecx, %ecx
cmpb $0x3a, (%r14,%rcx)
jne 0x119b
incl %ebx
movl %ebx, (%r15)
incq %rcx
cmpq %rcx, %rax
jne 0x118f
movslq %ebx, %rdi
shlq $0x3, %rdi
callq 0x1050
movq %rax, 0x8(%r15)
testq %rax, %rax
je 0x1249
xorl %r12d, %r12d
xorl %r13d, %r13d
xorl %ebp, %ebp
movzbl (%r14,%rbp), %eax
cmpl $0x3a, %eax
je 0x11d2
testl %eax, %eax
jne 0x1236
movq %rbp, %rdi
subq %r13, %rdi
incq %rdi
callq 0x1050
movq 0x8(%r15), %rcx
movslq %r12d, %r12
movq %rax, (%rcx,%r12,8)
testq %rax, %rax
je 0x1249
cmpq %r13, %rbp
jbe 0x121f
leaq (%r14,%r13), %rcx
xorl %eax, %eax
movb (%rcx,%rax), %dl
movq 0x8(%r15), %rsi
movq (%rsi,%r12,8), %rsi
movb %dl, (%rsi,%rax)
leaq (%rax,%r13), %rdx
incq %rdx
incq %rax
cmpq %rbp, %rdx
jb 0x11fb
movl %eax, %ecx
addq %rax, %r13
jmp 0x1221
xorl %ecx, %ecx
movq 0x8(%r15), %rax
movq (%rax,%r12,8), %rax
movb $0x0, (%rax,%rcx)
incq %r13
incl %r12d
movl (%r15), %ebx
incq %rbp
cmpl %ebx, %r12d
jl 0x11c4
movq (%rsp), %rax
movq %r15, (%rax)
xorl %ebp, %ebp
jmp 0x1256
movq %r15, %rdi
callq 0x1060
movl $0xfffffffe, %ebp       # imm = 0xFFFFFFFE
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/sasairc[P]yasuna/src/libbenly/src/env.c
// Function: release_env_t
void release_env_t(env_t* env)
{
    if (env == NULL)
        return;

    int i   = 0,
        j   = 0;

    j = env->envc - 1;
    while (i <= j) {
        if (*(env->envs + i) != NULL) {
            free(*(env->envs + i));
            *(env->envs + i) = NULL;
        }
        if (*(env->envs + j) != NULL) {
            free(*(env->envs + j));
            *(env->envs + j) = NULL;
        }
        i++;
        j--;
    }
    if (env->envs != NULL) {
        free(env->envs);
        env->envs = NULL;
    }
    if (env != NULL) {
        free(env);
        env = NULL;
    }

    return;
}

// Assembly:
testq %rdi, %rdi
je 0x12e8
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movslq (%rdi), %r14
testq %r14, %r14
jle 0x12cd
decq %r14
xorl %r15d, %r15d
movq 0x8(%rbx), %rax
movq (%rax,%r15,8), %rdi
testq %rdi, %rdi
je 0x12a4
callq 0x1030
movq 0x8(%rbx), %rax
movq $0x0, (%rax,%r15,8)
movq 0x8(%rbx), %rax
movq (%rax,%r14,8), %rdi
testq %rdi, %rdi
je 0x12be
callq 0x1030
movq 0x8(%rbx), %rax
movq $0x0, (%rax,%r14,8)
incq %r15
leaq -0x1(%r14), %rax
cmpq %r14, %r15
movq %rax, %r14
jl 0x1282
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x12db
callq 0x1030
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x1030
retq
// File: /workspace/github_c_makefile_star2_O3/zenkj[P]luajit-arm64/src/./../dynasm/dasm_x86.h
// Function: dasm_init
void dasm_init(Dst_DECL, int maxsection)
{
  dasm_State *D;
  size_t psz = 0;
  int i;
  Dst_REF = NULL;
  DASM_M_GROW(Dst, struct dasm_State, Dst_REF, psz, DASM_PSZ(maxsection));
  D = Dst_REF;
  D->psize = psz;
  D->lglabels = NULL;
  D->lgsize = 0;
  D->pclabels = NULL;
  D->pcsize = 0;
  D->globals = NULL;
  D->maxsection = maxsection;
  for (i = 0; i < maxsection; i++) {
    D->sections[i].buf = NULL;  /* Need this for pass3. */
    D->sections[i].rbuf = D->sections[i].buf - DASM_SEC2POS(i);
    D->sections[i].bsize = 0;
    D->sections[i].epos = 0;  /* Wrong, but is recalculated after resize. */
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %ebx
movq %rdi, %r14
movq $0x0, (%rdi)
leal -0x1(%rbx), %eax
cltq
leaq (%rax,%rax,4), %rax
leaq 0x78(,%rax,8), %rax
movl $0x10, %ecx
movq %rcx, %r15
addq %rcx, %rcx
cmpq %rax, %r15
jb 0x57a3
movq %r15, %rdi
callq 0x5150
movq %rax, (%r14)
testq %rax, %rax
je 0x5815
movq %r15, (%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movq $0x0, 0x30(%rax)
movl %ebx, 0x48(%rax)
testl %ebx, %ebx
jle 0x580f
addq $0x50, %rax
movl %ebx, %ecx
shlq $0x18, %rcx
xorl %edx, %edx
movups %xmm0, 0x8(%rax)
movslq %edx, %rsi
negq %rsi
shlq $0x2, %rsi
movq %rsi, (%rax)
movl $0x0, 0x1c(%rax)
addq $0x1000000, %rdx        # imm = 0x1000000
addq $0x28, %rax
cmpq %rdx, %rcx
jne 0x57e7
popq %rbx
popq %r14
popq %r15
retq
movl $0x1, %edi
callq 0x51b0
// File: /workspace/github_c_makefile_star2_O3/zenkj[P]luajit-arm64/src/./../dynasm/dasm_x86.h
// Function: dasm_free
void dasm_free(Dst_DECL)
{
  dasm_State *D = Dst_REF;
  int i;
  for (i = 0; i < D->maxsection; i++)
    if (D->sections[i].buf)
      DASM_M_FREE(Dst, D->sections[i].buf, D->sections[i].bsize);
  if (D->pclabels) DASM_M_FREE(Dst, D->pclabels, D->pcsize);
  if (D->lglabels) DASM_M_FREE(Dst, D->lglabels, D->lgsize);
  DASM_M_FREE(Dst, D, D->psize);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq (%rdi), %rbx
movl 0x48(%rbx), %eax
testl %eax, %eax
jle 0x5854
leaq 0x58(%rbx), %r14
xorl %r15d, %r15d
movq (%r14), %rdi
testq %rdi, %rdi
je 0x5845
callq 0x5030
movl 0x48(%rbx), %eax
incq %r15
movslq %eax, %rcx
addq $0x28, %r14
cmpq %rcx, %r15
jl 0x5835
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x5862
callq 0x5030
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x5870
callq 0x5030
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x5030
// File: /workspace/github_c_makefile_star2_O3/zenkj[P]luajit-arm64/src/./../dynasm/dasm_x86.h
// Function: dasm_growpc
void dasm_growpc(Dst_DECL, unsigned int maxpc)
{
  dasm_State *D = Dst_REF;
  size_t osz = D->pcsize;
  DASM_M_GROW(Dst, int, D->pclabels, D->pcsize, maxpc*sizeof(int));
  memset((void *)(((unsigned char *)D->pclabels)+osz), 0, D->pcsize-osz);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq (%rdi), %r15
movq 0x28(%r15), %r14
movl %esi, %eax
shlq $0x2, %rax
cmpq %rax, %r14
jae 0x592c
cmpq $0x11, %r14
movl $0x10, %ecx
cmovaeq %r14, %rcx
movq %rcx, %rbx
addq %rcx, %rcx
cmpq %rax, %rbx
jb 0x5903
movq 0x20(%r15), %rdi
movq %rbx, %rsi
callq 0x5170
movq %rax, 0x20(%r15)
testq %rax, %rax
je 0x5948
movq %rax, %rdi
movq %rbx, 0x28(%r15)
jmp 0x5933
movq 0x20(%r15), %rdi
movq %r14, %rbx
addq %r14, %rdi
subq %r14, %rbx
xorl %esi, %esi
movq %rbx, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x50c0
movl $0x1, %edi
callq 0x51b0
// File: /workspace/github_c_makefile_star2_O3/zenkj[P]luajit-arm64/src/./../dynasm/dasm_x86.h
// Function: dasm_setup
void dasm_setup(Dst_DECL, const void *actionlist)
{
  dasm_State *D = Dst_REF;
  int i;
  D->actionlist = (dasm_ActList)actionlist;
  D->status = DASM_S_OK;
  D->section = &D->sections[0];
  memset((void *)D->lglabels, 0, D->lgsize);
  if (D->pclabels) memset((void *)D->pclabels, 0, D->pcsize);
  for (i = 0; i < D->maxsection; i++) {
    D->sections[i].pos = DASM_SEC2POS(i);
    D->sections[i].ofs = 0;
  }
}

// Assembly:
pushq %rbx
movq (%rdi), %rbx
movq %rsi, 0x8(%rbx)
movl $0x0, 0x4c(%rbx)
leaq 0x50(%rbx), %rax
movq %rax, 0x38(%rbx)
movq 0x10(%rbx), %rdi
movq 0x18(%rbx), %rdx
xorl %esi, %esi
callq 0x50c0
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x598c
movq 0x28(%rbx), %rdx
xorl %esi, %esi
callq 0x50c0
movslq 0x48(%rbx), %rax
testq %rax, %rax
jle 0x59b8
addq $0x70, %rbx
shlq $0x18, %rax
xorl %ecx, %ecx
movl %ecx, -0x8(%rbx)
movl $0x0, (%rbx)
addq $0x1000000, %rcx        # imm = 0x1000000
addq $0x28, %rbx
cmpq %rcx, %rax
jne 0x599f
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/zenkj[P]luajit-arm64/src/./../dynasm/dasm_x86.h
// Function: dasm_getpclabel
int dasm_getpclabel(Dst_DECL, unsigned int pc)
{
  dasm_State *D = Dst_REF;
  if (pc*sizeof(int) < D->pcsize) {
    int pos = D->pclabels[pc];
    if (pos < 0) return *DASM_POS2PTR(D, -pos);
    if (pos > 0) return -1;  /* Undefined. */
  }
  return -2;  /* Unused or out of range. */
}

// Assembly:
movq (%rdi), %rax
movl %esi, %ecx
leaq (,%rcx,4), %rdx
cmpq 0x28(%rax), %rdx
jae 0x6604
movq 0x20(%rax), %rdx
movl (%rdx,%rcx,4), %ecx
testl %ecx, %ecx
js 0x660a
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
je 0x6604
retq
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
retq
negl %ecx
movl %ecx, %edx
shrl $0x18, %edx
leaq (%rdx,%rdx,4), %rdx
movq 0x50(%rax,%rdx,8), %rax
movl (%rax,%rcx,4), %eax
retq
// File: /workspace/github_c_makefile_star2_O3/zenkj[P]luajit-arm64/src/./../dynasm/dasm_x86.h
// Function: dasm_checkstep
int dasm_checkstep(Dst_DECL, int secmatch)
{
  dasm_State *D = Dst_REF;
  if (D->status == DASM_S_OK) {
    int i;
    for (i = 1; i <= 9; i++) {
      if (D->lglabels[i] > 0) { D->status = DASM_S_UNDEF_L|i; break; }
      D->lglabels[i] = 0;
    }
  }
  if (D->status == DASM_S_OK && secmatch >= 0 &&
      D->section != &D->sections[secmatch])
    D->status = DASM_S_MATCH_SEC|(int)(D->section-D->sections);
  return D->status;
}

// Assembly:
movq (%rdi), %rcx
movl 0x4c(%rcx), %eax
testl %eax, %eax
je 0x6629
retq
movq 0x10(%rcx), %rdx
movl $0x1, %eax
cmpl $0x0, (%rdx,%rax,4)
jg 0x6692
movl $0x0, (%rdx,%rax,4)
incq %rax
cmpq $0xa, %rax
jne 0x6632
movl 0x4c(%rcx), %eax
testl %eax, %eax
setne %dl
testl %esi, %esi
sets %dil
orb %dl, %dil
jne 0x6628
movq 0x38(%rcx), %rdx
movl %esi, %eax
leaq (%rax,%rax,4), %rax
leaq (%rcx,%rax,8), %rax
addq $0x50, %rax
cmpq %rax, %rdx
je 0x669d
leaq 0x50(%rcx), %rax
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x3333333333333333, %rax # imm = 0xCCCCCCCCCCCCCCCD
imulq %rdx, %rax
movl $0x3000000, %edx        # imm = 0x3000000
jmp 0x6697
movl $0x21000000, %edx       # imm = 0x21000000
orl %edx, %eax
movl %eax, 0x4c(%rcx)
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/zenkj[P]luajit-arm64/src/host/buildvm.c
// Function: sym_decorate
static const char *sym_decorate(BuildCtx *ctx,
				const char *prefix, const char *suffix)
{
  char name[256];
  char *p;
#if LJ_64
  const char *symprefix = ctx->mode == BUILD_machasm ? "_" : "";
#elif LJ_TARGET_XBOX360
  const char *symprefix = "";
#else
  const char *symprefix = ctx->mode != BUILD_elfasm ? "_" : "";
#endif
  sprintf(name, "%s%s%s", symprefix, prefix, suffix);
  p = strchr(name, '@');
  if (p) {
#if LJ_TARGET_X86ORX64
    if (!LJ_64 && (ctx->mode == BUILD_coffasm || ctx->mode == BUILD_peobj))
      name[0] = '@';
    else
      *p = '\0';
#elif (LJ_TARGET_PPC  || LJ_TARGET_PPCSPE) && !LJ_TARGET_CONSOLE
    /* Keep @plt. */
#else
    *p = '\0';
#endif
  }
  p = (char *)malloc(strlen(name)+1);  /* MSVC doesn't like strdup. */
  strcpy(p, name);
  return p;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rdx, %r8
movq %rsi, %rcx
cmpl $0x2, %edi
leaq 0xaf8b(%rip), %rax      # 0x1215f
leaq 0xa854(%rip), %rdx      # 0x11a2f
cmoveq %rax, %rdx
leaq 0x914a(%rip), %rsi      # 0x10330
movq %rsp, %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x51a0
movq %rbx, %rdi
movl $0x40, %esi
callq 0x50b0
testq %rax, %rax
je 0x7208
movb $0x0, (%rax)
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x50a0
leaq 0x1(%rax), %rdi
callq 0x5150
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x5060
movq %r14, %rax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/zenkj[P]luajit-arm64/src/host/buildvm.c
// Function: usage
static void usage(void)
{
  int i;
  fprintf(stderr, LUAJIT_VERSION " VM builder.\n");
  fprintf(stderr, LUAJIT_COPYRIGHT ", " LUAJIT_URL "\n");
  fprintf(stderr, "Target architecture: " LJ_ARCH_NAME "\n\n");
  fprintf(stderr, "Usage: buildvm -m mode [-o outfile] [infiles...]\n\n");
  fprintf(stderr, "Available modes:\n");
  for (i = 0; i < BUILD__MAX; i++)
    fprintf(stderr, "  %s\n", modenames[i]);
  exit(1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq 0xedb1(%rip), %r14      # 0x15ff8
movq (%r14), %rcx
leaq 0x9347(%rip), %rdi      # 0x10598
movl $0x19, %esi
movl $0x1, %edx
callq 0x51c0
movq (%r14), %rcx
leaq 0x9348(%rip), %rdi      # 0x105b2
movl $0x36, %esi
movl $0x1, %edx
callq 0x51c0
movq (%r14), %rcx
leaq 0x9366(%rip), %rdi      # 0x105e9
movl $0x1a, %esi
movl $0x1, %edx
callq 0x51c0
movq (%r14), %rcx
leaq 0x9368(%rip), %rdi      # 0x10604
movl $0x32, %esi
movl $0x1, %edx
callq 0x51c0
movq (%r14), %rcx
leaq 0x9382(%rip), %rdi      # 0x10637
movl $0x11, %esi
movl $0x1, %edx
callq 0x51c0
leaq 0xe335(%rip), %r15      # 0x15600
leaq 0x9377(%rip), %rbx      # 0x10649
xorl %r12d, %r12d
movq (%r14), %rdi
movq (%r12,%r15), %rdx
movq %rbx, %rsi
xorl %eax, %eax
callq 0x5130
addq $0x8, %r12
cmpq $0x58, %r12
jne 0x72d5
movl $0x1, %edi
callq 0x51b0
// File: /workspace/github_c_makefile_star2_O3/zenkj[P]luajit-arm64/src/host/buildvm.c
// Function: sym_insert
static void sym_insert(BuildCtx *ctx, int32_t ofs,
		       const char *prefix, const char *suffix)
{
  ptrdiff_t i = ctx->nsym++;
  while (i > 0) {
    if (ctx->sym[i-1].ofs <= ofs)
      break;
    ctx->sym[i] = ctx->sym[i-1];
    i--;
  }
  ctx->sym[i].ofs = ofs;
  ctx->sym[i].name = sym_decorate(ctx, prefix, suffix);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movslq 0x40(%rdi), %r14
leal 0x1(%r14), %eax
movl %eax, 0x40(%rdi)
testq %r14, %r14
jle 0x9621
movq %r14, %rax
shlq $0x4, %rax
movq 0x58(%rbx), %rdi
cmpl %esi, -0x8(%rdi,%rax)
jle 0x9621
movups -0x10(%rdi,%rax), %xmm0
addq %rax, %rdi
movups %xmm0, (%rdi)
leaq -0x1(%r14), %rdi
addq $-0x10, %rax
cmpq $0x1, %r14
movq %rdi, %r14
jg 0x95f8
xorl %r14d, %r14d
movq 0x58(%rbx), %rax
shlq $0x4, %r14
movl %esi, 0x8(%rax,%r14)
movl 0x8(%rbx), %edi
movq %rdx, %rsi
movq %rcx, %rdx
callq 0x71ba
movq 0x58(%rbx), %rcx
movq %rax, (%rcx,%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/zenkj[P]luajit-arm64/src/host/buildvm_asm.c
// Function: emit_asm_label
static void emit_asm_label(BuildCtx *ctx, const char *name, int size, int isfunc)
{
  switch (ctx->mode) {
  case BUILD_elfasm:
#if LJ_TARGET_PS3
    if (!strncmp(name, "lj_vm_", 6) &&
	strcmp(name, ctx->beginsym) &&
	!strstr(name, "hook")) {
      fprintf(ctx->fp,
	"\n\t.globl %s\n"
	"\t.section \".opd\",\"aw\"\n"
	"%s:\n"
	"\t.long .%s,.TOC.@tocbase32\n"
	"\t.size %s,8\n"
	"\t.previous\n"
	"\t.globl .%s\n"
	"\t.hidden .%s\n"
	"\t.type .%s, " ELFASM_PX "function\n"
	"\t.size .%s, %d\n"
	".%s:\n",
	name, name, name, name, name, name, name, name, size, name);
      break;
    }
#endif
    fprintf(ctx->fp,
      "\n\t.globl %s\n"
      "\t.hidden %s\n"
      "\t.type %s, " ELFASM_PX "%s\n"
      "\t.size %s, %d\n"
      "%s:\n",
      name, name, name, isfunc ? "function" : "object", name, size, name);
    break;
  case BUILD_coffasm:
    fprintf(ctx->fp, "\n\t.globl %s\n", name);
    if (isfunc)
      fprintf(ctx->fp, "\t.def %s; .scl 3; .type 32; .endef\n", name);
    fprintf(ctx->fp, "%s:\n", name);
    break;
  case BUILD_machasm:
    fprintf(ctx->fp,
      "\n\t.private_extern %s\n"
      "%s:\n", name, name);
    break;
  default:
    break;
  }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl 0x8(%rdi), %eax
cmpl $0x2, %eax
je 0x9a09
movl %ecx, %ebp
cmpl $0x1, %eax
je 0x99c2
testl %eax, %eax
jne 0x99bd
movl %edx, %r10d
movq 0x10(%r14), %rdi
testl %ebp, %ebp
leaq 0x858d(%rip), %rax      # 0x11f1c
leaq 0x8215(%rip), %r9       # 0x11bab
cmoveq %rax, %r9
subq $0x8, %rsp
leaq 0x853d(%rip), %rsi      # 0x11ee2
movq %rbx, %rdx
movq %rbx, %rcx
movq %rbx, %r8
xorl %eax, %eax
pushq %rbx
pushq %r10
pushq %rbx
callq 0x5130
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq 0x10(%r14), %rdi
leaq 0x8556(%rip), %rsi      # 0x11f23
movq %rbx, %rdx
xorl %eax, %eax
callq 0x5130
testl %ebp, %ebp
je 0x99f0
movq 0x10(%r14), %rdi
leaq 0x854a(%rip), %rsi      # 0x11f30
movq %rbx, %rdx
xorl %eax, %eax
callq 0x5130
movq 0x10(%r14), %rdi
leaq 0x851c(%rip), %rsi      # 0x11f17
movq %rbx, %rdx
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x5130
movq 0x10(%r14), %rdi
leaq 0x8540(%rip), %rsi      # 0x11f54
movq %rbx, %rdx
movq %rbx, %rcx
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x5130
// File: /workspace/github_c_makefile_star2_O3/zenkj[P]luajit-arm64/src/host/buildvm_asm.c
// Function: emit_asm_bytes
static void emit_asm_bytes(BuildCtx *ctx, uint8_t *p, int n)
{
  int i;
  for (i = 0; i < n; i++) {
    if ((i & 15) == 0)
      fprintf(ctx->fp, "\t.byte %d", p[i]);
    else
      fprintf(ctx->fp, ",%d", p[i]);
    if ((i & 15) == 15) putc('\n', ctx->fp);
  }
  if ((n & 15) != 0) putc('\n', ctx->fp);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl %edx, 0x4(%rsp)
testl %edx, %edx
jle 0x9a94
movq %rsi, %r14
movl 0x4(%rsp), %r13d
leaq 0x85a8(%rip), %r12      # 0x11ff2
xorl %ebp, %ebp
movl %ebp, %r15d
movq 0x10(%rbx), %rdi
movzbl (%r14,%rbp), %edx
andl $0xf, %r15d
je 0x9a7e
movq %r12, %rsi
xorl %eax, %eax
callq 0x5130
cmpl $0xf, %r15d
jne 0x9a8c
movq 0x10(%rbx), %rsi
movl $0xa, %edi
callq 0x5120
jmp 0x9a8c
leaq 0x8563(%rip), %rsi      # 0x11fe8
xorl %eax, %eax
callq 0x5130
incq %rbp
cmpq %rbp, %r13
jne 0x9a4c
testb $0xf, 0x4(%rsp)
je 0x9ab7
movq 0x10(%rbx), %rsi
movl $0xa, %edi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5120
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/zenkj[P]luajit-arm64/src/host/buildvm_peobj.c
// Function: emit_peobj_sym
static void emit_peobj_sym(BuildCtx *ctx, const char *name, uint32_t value,
			   int sect, int type, int scl)
{
  PEsym sym;
  size_t len = strlen(name);
  if (!strtab) {  /* Pass 1: only calculate string table length. */
    if (len > 8) strtabofs += len+1;
    return;
  }
  if (len <= 8) {
    memcpy(sym.n.name, name, len);
    memset(sym.n.name+len, 0, 8-len);
  } else {
    sym.n.nameref[0] = 0;
    sym.n.nameref[1] = (uint32_t)strtabofs;
    memcpy(strtab + strtabofs, name, len);
    strtab[strtabofs+len] = 0;
    strtabofs += len+1;
  }
  sym.value = value;
  sym.sect = (int16_t)(sect+1);  /* 1-based section number. */
  sym.type = (uint16_t)type;
  sym.scl = (uint8_t)scl;
  sym.naux = 0;
  owrite(ctx, &sym, PEOBJ_SYM_SIZE);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r9d, 0x4(%rsp)
movl %r8d, (%rsp)
movl %ecx, %r15d
movl %edx, %r12d
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x50a0
movq %rax, %r13
movq 0xc1cf(%rip), %rbp      # 0x161b8
testq %rbp, %rbp
je 0xa01d
cmpq $0x8, %r13
ja 0xa03d
leaq 0x14(%rsp), %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x5140
leaq (%rsp,%r13), %rdi
addq $0x14, %rdi
movl $0x8, %edx
subq %r13, %rdx
xorl %esi, %esi
callq 0x50c0
jmp 0xa080
cmpq $0x9, %r13
jb 0xa0b0
movq 0xc192(%rip), %rax      # 0x161c0
addq %r13, %rax
incq %rax
movq %rax, 0xc185(%rip)      # 0x161c0
jmp 0xa0b0
movl $0x0, 0x14(%rsp)
movq %r14, 0x8(%rsp)
movq 0xc16f(%rip), %r14      # 0x161c0
movl %r14d, 0x18(%rsp)
addq %r14, %rbp
movq %rbp, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x5140
movb $0x0, (%r13,%rbp)
leaq (%r14,%r13), %rax
incq %rax
movq 0x8(%rsp), %r14
movq %rax, 0xc140(%rip)      # 0x161c0
leaq 0x14(%rsp), %rsi
movl %r12d, 0x8(%rsi)
incl %r15d
movw %r15w, 0xc(%rsi)
movl (%rsp), %eax
movw %ax, 0xe(%rsi)
movl 0x4(%rsp), %eax
movb %al, 0x10(%rsi)
movb $0x0, 0x11(%rsi)
movl $0x12, %edx
movq %r14, %rdi
callq 0x66a0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/zenkj[P]luajit-arm64/src/host/buildvm_peobj.c
// Function: emit_peobj_sym_sect
static void emit_peobj_sym_sect(BuildCtx *ctx, PEsection *pesect, int sect)
{
  PEsym sym;
  PEsymaux aux;
  if (!strtab) return;  /* Pass 1: no output. */
  memcpy(sym.n.name, pesect[sect].name, 8);
  sym.value = 0;
  sym.sect = (int16_t)(sect+1);  /* 1-based section number. */
  sym.type = PEOBJ_TYPE_NULL;
  sym.scl = PEOBJ_SCL_STATIC;
  sym.naux = 1;
  owrite(ctx, &sym, PEOBJ_SYM_SIZE);
  memset(&aux, 0, sizeof(PEsymaux));
  aux.size = pesect[sect].size;
  aux.nreloc = pesect[sect].nreloc;
  owrite(ctx, &aux, PEOBJ_SYM_SIZE);
}

// Assembly:
cmpq $0x0, 0xc0f1(%rip)      # 0x161b8
je 0xa13b
pushq %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movl %edx, %eax
leaq (%rax,%rax,4), %r15
movq (%rsi,%r15,8), %rax
leaq 0x8(%rsp), %rsi
movq %rax, (%rsi)
movl $0x0, 0x8(%rsi)
incl %edx
movw %dx, 0xc(%rsi)
movl $0x1030000, 0xe(%rsi)   # imm = 0x1030000
movl $0x12, %edx
callq 0x66a0
xorps %xmm0, %xmm0
leaq 0x1c(%rsp), %rsi
movups %xmm0, 0x4(%rsi)
movl 0x10(%r14,%r15,8), %eax
movl %eax, (%rsi)
movzwl 0x20(%r14,%r15,8), %eax
movw %ax, 0x4(%rsi)
movl $0x12, %edx
movq %rbx, %rdi
callq 0x66a0
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/zenkj[P]luajit-arm64/src/host/buildvm_lib.c
// Function: libdef_endmodule
static void libdef_endmodule(BuildCtx *ctx)
{
  if (modstate != 0) {
    char line[80];
    const uint8_t *p;
    int n;
    if (modstate == 1)
      fprintf(ctx->fp, "  (lua_CFunction)0");
    fprintf(ctx->fp, "\n};\n");
    fprintf(ctx->fp, "static const uint8_t %s%s[] = {\n",
	    LABEL_PREFIX_LIBINIT, modname);
    line[0] = '\0';
    for (n = 0, p = obuf; p < optr; p++) {
      n += sprintf(line+n, "%d,", *p);
      if (n >= 75) {
	fprintf(ctx->fp, "%s\n", line);
	n = 0;
	line[0] = '\0';
      }
    }
    fprintf(ctx->fp, "%s%d\n};\n#endif\n\n", line, LIBINIT_END);
  }
}

// Assembly:
movl 0xbc0b(%rip), %eax      # 0x161dc
testl %eax, %eax
je 0xa6d2
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
cmpl $0x1, %eax
jne 0xa609
movq 0x10(%rbx), %rcx
leaq 0x7e5e(%rip), %rdi      # 0x12458
movl $0x12, %esi
movl $0x1, %edx
callq 0x51c0
movq 0x10(%rbx), %rcx
leaq 0x7e57(%rip), %rdi      # 0x1246b
movl $0x4, %esi
movl $0x1, %edx
callq 0x51c0
movq 0x10(%rbx), %rdi
leaq 0x7e42(%rip), %rsi      # 0x12470
leaq 0x7e5c(%rip), %rdx      # 0x12491
leaq 0xdbc4(%rip), %rcx      # 0x18200
xorl %eax, %eax
callq 0x5130
movb $0x0, (%rsp)
leaq 0xbba2(%rip), %r13      # 0x161f0
cmpq %r13, 0xdb9b(%rip)      # 0x181f0
jbe 0xa6aa
leaq 0x7e40(%rip), %r14      # 0x1249e
leaq 0x5fe6(%rip), %r15      # 0x1064b
movq %rsp, %r12
xorl %ebp, %ebp
movslq %ebp, %rbp
leaq (%rsp,%rbp), %rdi
movzbl (%r13), %edx
movq %r14, %rsi
xorl %eax, %eax
callq 0x51a0
addl %eax, %ebp
cmpl $0x4b, %ebp
jl 0xa69e
movq 0x10(%rbx), %rdi
xorl %ebp, %ebp
movq %r15, %rsi
movq %r12, %rdx
xorl %eax, %eax
callq 0x5130
movb $0x0, (%rsp)
incq %r13
cmpq 0xdb48(%rip), %r13      # 0x181f0
jb 0xa66a
movq 0x10(%rbx), %rdi
leaq 0x7ded(%rip), %rsi      # 0x124a2
movq %rsp, %rdx
movl $0xff, %ecx
xorl %eax, %eax
callq 0x5130
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/zenkj[P]luajit-arm64/src/host/buildvm_lib.c
// Function: libdef_module
static void libdef_module(BuildCtx *ctx, char *p, int arg)
{
  UNUSED(arg);
  if (ctx->mode == BUILD_libdef) {
    libdef_endmodule(ctx);
    optr = obuf;
    *optr++ = (uint8_t)ffid;
    *optr++ = (uint8_t)ffasmfunc;
    *optr++ = 0;  /* Hash table size. */
    modstate = 1;
    fprintf(ctx->fp, "#ifdef %sMODULE_%s\n", LIBDEF_PREFIX, p);
    fprintf(ctx->fp, "#undef %sMODULE_%s\n", LIBDEF_PREFIX, p);
    fprintf(ctx->fp, "static const lua_CFunction %s%s[] = {\n",
	    LABEL_PREFIX_LIBCF, p);
  }
  modnamelen = strlen(p);
  if (modnamelen > sizeof(modname)-1) {
    fprintf(stderr, "Error: module name too long: '%s'\n", p);
    exit(1);
  }
  strcpy(modname, p);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
cmpl $0x7, 0x8(%rdi)
jne 0xa777
movq %rdi, %r14
callq 0xa5cb
movb 0xbadd(%rip), %al       # 0x161d0
movb %al, 0xbaf7(%rip)       # 0x161f0
movb 0xbad9(%rip), %al       # 0x161d8
movb %al, 0xbaec(%rip)       # 0x161f1
leaq 0xbae7(%rip), %rax      # 0x161f3
movq %rax, 0xdadd(%rip)      # 0x181f0
movb $0x0, 0xbad8(%rip)      # 0x161f2
movl $0x1, 0xbab8(%rip)      # 0x161dc
movq 0x10(%r14), %rdi
leaq 0x7b7f(%rip), %rsi      # 0x122ae
leaq 0x7a24(%rip), %r15      # 0x1215a
movq %r15, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x5130
movq 0x10(%r14), %rdi
leaq 0x7b74(%rip), %rsi      # 0x122c2
movq %r15, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x5130
movq 0x10(%r14), %rdi
leaq 0x7b70(%rip), %rsi      # 0x122d6
leaq 0x7b90(%rip), %rdx      # 0x122fd
movq %rbx, %rcx
xorl %eax, %eax
callq 0x5130
movq %rbx, %rdi
callq 0x50a0
movq %rax, 0xda72(%rip)      # 0x181f8
cmpq $0x50, %rax
jae 0xa7a0
leaq 0xda6d(%rip), %rdi      # 0x18200
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x5060
movq %rbx, %rdi
callq 0x538a
// File: /workspace/github_c_makefile_star2_O3/zenkj[P]luajit-arm64/src/host/buildvm_lib.c
// Function: libdef_rec
static void libdef_rec(BuildCtx *ctx, char *p, int arg)
{
  UNUSED(arg);
  if (ctx->mode == BUILD_recdef) {
    char *q;
    uint32_t n;
    for (; recffid+1 < ffid; recffid++)
      fprintf(ctx->fp, ",\n0");
    recffid = ffid;
    if (*p == '.') p = funcname;
    q = strchr(p, ' ');
    if (q) *q++ = '\0';
    n = find_rec(p);
    if (q)
      fprintf(ctx->fp, ",\n0x%02x00+(%s)", n, q);
    else
      fprintf(ctx->fp, ",\n0x%02x00", n);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x8, 0x8(%rdi)
jne 0xaa63
movq %rsi, %r14
movq %rdi, %rbx
movl 0xb7e8(%rip), %ecx      # 0x161d4
incl %ecx
movl 0xb7dc(%rip), %eax      # 0x161d0
cmpl %eax, %ecx
jge 0xaa31
leaq 0x7a0d(%rip), %r15      # 0x1240c
movq 0x10(%rbx), %rcx
movl $0x3, %esi
movl $0x1, %edx
movq %r15, %rdi
callq 0x51c0
movl 0xb7b9(%rip), %ecx      # 0x161d4
leal 0x1(%rcx), %eax
movl %eax, 0xb7b0(%rip)      # 0x161d4
addl $0x2, %ecx
movl 0xb7a3(%rip), %eax      # 0x161d0
cmpl %eax, %ecx
jl 0xa9ff
movl %eax, 0xb79d(%rip)      # 0x161d4
cmpb $0x2e, (%r14)
leaq 0xd80e(%rip), %r15      # 0x18250
cmovneq %r14, %r15
movq %r15, %rdi
movl $0x20, %esi
callq 0x50b0
testq %rax, %rax
je 0xaa72
movq %rax, %rcx
incq %rcx
movb $0x0, (%rax)
jmp 0xaa74
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ecx, %ecx
cmpb $0x0, 0xb775(%rip)      # 0x161f0
movq %rcx, (%rsp)
je 0xaabf
movl $0x2, %ebp
leaq 0xb763(%rip), %r14      # 0x161f0
xorl %r13d, %r13d
movq %r14, %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x5110
testl %eax, %eax
je 0xaaec
movq %r12, %rdi
callq 0x50a0
addq %rax, %r13
incq %r13
incl %ebp
leaq (%r14,%r13), %r12
cmpb $0x0, (%r14,%r13)
jne 0xaa93
jmp 0xaace
leaq 0xb72a(%rip), %r12      # 0x161f0
movl $0x2, %ebp
xorl %r13d, %r13d
movq %r15, %rdi
callq 0x50a0
addq %r13, %rax
cmpq $0x1fff, %rax           # imm = 0x1FFF
jge 0xab35
movq %r12, %rdi
movq %r15, %rsi
callq 0x5060
movq 0x10(%rbx), %rdi
movq (%rsp), %rcx
testq %rcx, %rcx
je 0xab17
leaq 0x7910(%rip), %rsi      # 0x12410
movl %ebp, %edx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5130
leaq 0x7902(%rip), %rsi      # 0x12420
movl %ebp, %edx
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5130
callq 0x5446
// File: /workspace/github_c_makefile_star2_O3/zenkj[P]luajit-arm64/src/host/buildvm_lib.c
// Function: libdef_push
static void libdef_push(BuildCtx *ctx, char *p, int arg)
{
  UNUSED(arg);
  if (ctx->mode == BUILD_libdef) {
    int len = (int)strlen(p);
    if (*p == '"') {
      if (len > 1 && p[len-1] == '"') {
	p[len-1] = '\0';
	libdef_name(p+1, LIBINIT_STRING);
	return;
      }
    } else if (*p >= '0' && *p <= '9') {
      char *ep;
      double d = strtod(p, &ep);
      if (*ep == '\0') {
	if (optr+1+sizeof(double) > obuf+sizeof(obuf)) {
	  fprintf(stderr, "Error: output buffer overflow\n");
	  exit(1);
	}
	*optr++ = LIBINIT_NUMBER;
	memcpy_endian(optr, &d, sizeof(double));
	optr += sizeof(double);
	return;
      }
    } else if (!strcmp(p, "lastcl")) {
      if (optr+1 > obuf+sizeof(obuf)) {
	fprintf(stderr, "Error: output buffer overflow\n");
	exit(1);
      }
      *optr++ = LIBINIT_LASTCL;
      return;
    } else if (len > 4 && !strncmp(p, "top-", 4)) {
      if (optr+2 > obuf+sizeof(obuf)) {
	fprintf(stderr, "Error: output buffer overflow\n");
	exit(1);
      }
      *optr++ = LIBINIT_COPY;
      *optr++ = (uint8_t)atoi(p+4);
      return;
    }
    fprintf(stderr, "Error: bad value for %sPUSH(%s)\n", LIBDEF_PREFIX, p);
    exit(1);
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
cmpl $0x7, 0x8(%rdi)
jne 0xac7d
movq %rsi, %rbx
movq %rsi, %rdi
callq 0x50a0
movq %rax, %r14
movb (%rbx), %al
cmpb $0x22, %al
jne 0xab97
cmpl $0x2, %r14d
jl 0xac87
decl %r14d
cmpb $0x22, (%rbx,%r14)
jne 0xac87
movb $0x0, (%rbx,%r14)
incq %rbx
movq %rbx, %rdi
movl $0xc0, %esi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
jmp 0xace7
addb $-0x30, %al
cmpb $0x9, %al
ja 0xabe8
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5080
movq (%r14), %rax
cmpb $0x0, (%rax)
jne 0xac87
movq 0xd630(%rip), %rax      # 0x181f0
leaq 0x9(%rax), %rcx
leaq 0xd625(%rip), %rdx      # 0x181f0
cmpq %rdx, %rcx
ja 0xac8f
movb $-0x5, (%rax)
movsd %xmm0, 0x1(%rax)
movq %rcx, 0xd60d(%rip)      # 0x181f0
jmp 0xac7d
leaq 0x783c(%rip), %rsi      # 0x1242b
movq %rbx, %rdi
callq 0x5110
testl %eax, %eax
je 0xac5c
cmpl $0x5, %r14d
jl 0xac87
leaq 0x7826(%rip), %rsi      # 0x12432
movl $0x4, %edx
movq %rbx, %rdi
callq 0x5050
testl %eax, %eax
jne 0xac87
movq 0xd5cc(%rip), %r14      # 0x181f0
leaq 0x2(%r14), %r15
leaq 0xd5c1(%rip), %rax      # 0x181f0
cmpq %rax, %r15
ja 0xac94
leaq 0x1(%r14), %rax
movq %rax, 0xd5b1(%rip)      # 0x181f0
movb $-0x4, (%r14)
addq $0x4, %rbx
movq %rbx, %rdi
callq 0x5190
movq %r15, 0xd59a(%rip)      # 0x181f0
movb %al, 0x1(%r14)
jmp 0xac7d
movq 0xd58d(%rip), %rax      # 0x181f0
leaq 0x1(%rax), %rcx
leaq 0xd582(%rip), %rdx      # 0x181f0
cmpq %rdx, %rcx
ja 0xac99
movq %rcx, 0xd576(%rip)      # 0x181f0
movb $-0x3, (%rax)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rbx, %rdi
callq 0x54da
callq 0x54b5
callq 0x546b
callq 0x5490
// File: /workspace/github_c_makefile_star2_O3/zenkj[P]luajit-arm64/src/host/buildvm_lib.c
// Function: libdef_set
static void libdef_set(BuildCtx *ctx, char *p, int arg)
{
  UNUSED(arg);
  if (ctx->mode == BUILD_libdef) {
    if (p[0] == '!' && p[1] == '\0') p[0] = '\0';  /* Set env. */
    libdef_name(p, LIBINIT_STRING);
    *optr++ = LIBINIT_SET;
    obuf[2]++;  /* Bump hash table size. */
  }
}

// Assembly:
cmpl $0x7, 0x8(%rdi)
jne 0xacdf
cmpb $0x21, (%rsi)
jne 0xacb2
cmpb $0x0, 0x1(%rsi)
jne 0xacb2
movb $0x0, (%rsi)
pushq %rax
movq %rsi, %rdi
movl $0xc0, %esi
callq 0xace7
movq 0xd529(%rip), %rax      # 0x181f0
leaq 0x1(%rax), %rcx
movq %rcx, 0xd51e(%rip)      # 0x181f0
movb $-0x6, (%rax)
incb 0xb517(%rip)            # 0x161f2
addq $0x8, %rsp
retq