LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/antonblanchard[P]will-it-scale/tests/poll2.c
// Function: testcase
void testcase(unsigned long long *iterations, unsigned long nr)
{
	int i;
	char tmpfile[PATH_MAX];
	int tmpfiles[NR_FILES];

	for (i = 0; i < NR_FILES; i++) {
		sprintf(tmpfile, "/tmp/willitscale.XXXXXX");
		tmpfiles[i] = mkstemp(tmpfile);
		assert(tmpfiles[i] >= 0);
		unlink(tmpfile);
	}

	while (1) {
		struct pollfd pfd[NR_FILES];

		memset(&pfd, 0, sizeof(pfd));

		for (i = 0; i < NR_FILES; i++) {
			pfd[i].fd = tmpfiles[i];
			pfd[i].events = POLLOUT;
		}

		assert(poll(pfd, NR_FILES, 0) >= 0);

		(*iterations)++;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1608, %rsp           # imm = 0x1608
movq %rdi, %rbx
xorl %r15d, %r15d
movabsq $0x5858585858582e, %r12 # imm = 0x5858585858582E
leaq 0x600(%rsp), %r14
cmpq $0x80, %r15
je 0x2c38
movups 0x6c5(%rip), %xmm0      # 0x32d0
movaps %xmm0, 0x600(%rsp)
movq %r12, 0x610(%rsp)
movq %r14, %rdi
callq 0x21c0
movl %eax, (%rsp,%r15,4)
testl %eax, %eax
js 0x2ca3
movq %r14, %rdi
callq 0x2080
incq %r15
jmp 0x2bfb
leaq 0x200(%rsp), %r14
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x2130
xorl %eax, %eax
cmpq $0x80, %rax
je 0x2c72
movl (%rsp,%rax,4), %ecx
movl %ecx, 0x200(%rsp,%rax,8)
movw $0x4, 0x204(%rsp,%rax,8)
incq %rax
jmp 0x2c51
movl $0x80, %esi
movq %r14, %rdi
xorl %edx, %edx
callq 0x21e0
testl %eax, %eax
js 0x2c8a
incq (%rbx)
jmp 0x2c40
leaq 0x69b(%rip), %rdi       # 0x332c
leaq 0x605(%rip), %rsi       # 0x329d
leaq 0x65a(%rip), %rcx       # 0x32f9
pushq $0x37
jmp 0x2cba
leaq 0x63e(%rip), %rdi       # 0x32e8
leaq 0x5ec(%rip), %rsi       # 0x329d
leaq 0x641(%rip), %rcx       # 0x32f9
pushq $0x29
popq %rdx
callq 0x2120
// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/crypto_aead/pi32cipher256v2/ref3/pi-cipher.c
// Function: pi32_init
int PI_INIT(
        PI_CTX *ctx,
        const void *key,
        size_t key_length_B,
        const void *pmn,
        size_t pmn_length_B)
{
	int i;
	uint8_t setup_buf[PI_IS_BITS / 8];
    if (key_length_B + pmn_length_B + 1 >= PI_IS_BITS / 8) {
        return -1;
    }
    memset(ctx->tag, 0, sizeof(ctx->tag));
    memset(setup_buf, 0, sizeof(setup_buf));
    memcpy(setup_buf, key, key_length_B);
    memcpy(&setup_buf[key_length_B], pmn, pmn_length_B);
    setup_buf[key_length_B + pmn_length_B] = 1;
    for (i = 0; i < 16; ++i) {
        ctx->cis[i / 4][i % 4] = load_word_little(&setup_buf[i * PI_WORD_SIZE / 8]);
    }
    pi((word_t*)ctx->cis);
    ctx->ctr = 0;
    for (i = 0; i * PI_WORD_SIZE < 64; ++i) {
		ctx->ctr |= (uint64_t)ctx->cis[1][i] << (i * PI_WORD_SIZE);
	}
    return 0;
}

// Assembly:
leaq (%r8,%rdx), %rax
addq $-0x3f, %rax
cmpq $-0x40, %rax
jae 0x12ba
pushq $-0x1
popq %rax
retq
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %r8, %r14
movq %rcx, %r15
movq %rdx, %r12
movq %rdi, %rbx
vxorps %xmm0, %xmm0, %xmm0
vmovups %ymm0, 0x40(%rdi)
leaq (%r8,%rdx), %r13
movq %rsp, %rdi
vmovups %ymm0, 0x20(%rdi)
vmovups %ymm0, (%rdi)
vzeroupper
callq 0x1110
leaq (%rsp,%r12), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x1110
movb $0x1, (%rsp,%r13)
xorl %eax, %eax
cmpq $0x10, %rax
je 0x132c
movl (%rsp,%rax,4), %ecx
movl %eax, %edx
shrl $0x2, %edx
movl %eax, %esi
andl $0x3, %esi
shlq $0x4, %rdx
addq %rbx, %rdx
movl %ecx, (%rdx,%rsi,4)
incq %rax
jmp 0x130a
movq %rbx, %rdi
callq 0x134c
movq 0x10(%rbx), %rax
movq %rax, 0x60(%rbx)
xorl %eax, %eax
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/crypto_aead/pi32cipher256v2/ref3/pi-cipher.c
// Function: pi32_process_ad_last_block
void PI_PROCESS_AD_LAST_BLOCK(
        PI_CTX *ctx,
        const void *ad,
        size_t ad_length_B,
        unsigned long ad_num )
{
    state_t a;
    while (ad_length_B >= PI_AD_BLOCK_LENGTH_BYTES) {
        PI_PROCESS_AD_BLOCK(ctx, ad, ad_num);
        ad_num++;
        ad_length_B -= PI_AD_BLOCK_LENGTH_BYTES;
        ad = &((uint8_t*)ad)[PI_AD_BLOCK_LENGTH_BYTES];
    }

    ctr_trans(ctx, a, ad_num);
    inject_last_block(a, ad, ad_length_B);
    pi((word_t*)a);
    add_tag(ctx, a);
    ctx->ctr += ad_num;
    inject_tag(ctx->cis, ctx->tag);
    pi((word_t*)ctx->cis);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
cmpq $0x20, %r15
jb 0x1514
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x10c0
incq %r14
addq $-0x20, %r15
addq $0x20, %r12
jmp 0x14f3
movq %rsp, %r13
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x145b
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x1589
movq %r13, %rdi
callq 0x134c
movq %rbx, %rdi
movq %r13, %rsi
callq 0x14be
addq %r14, 0x60(%rbx)
xorl %eax, %eax
cmpq $0x4, %rax
je 0x155e
movl 0x40(%rbx,%rax,4), %ecx
xorl %ecx, (%rbx,%rax,4)
incq %rax
jmp 0x154c
pushq $0x8
popq %rax
cmpq $0xc, %rax
je 0x1573
movl 0x30(%rbx,%rax,4), %ecx
xorl %ecx, (%rbx,%rax,4)
incq %rax
jmp 0x1561
movq %rbx, %rdi
callq 0x134c
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/crypto_aead/pi32cipher256v2/ref3/pi-cipher.c
// Function: inject_last_block
static void inject_last_block(
        state_t a,
        const void *block,
        size_t length_B )
{
    uint8_t t[PI_RATE_BYTES];
    if (length_B >= PI_RATE_BYTES) {
        /* error */
    	printf("ERROR <%s %s %d>\n", __FILE__, __func__, __LINE__);
        return;
    }
    memset(t, 0, sizeof(t));
    memcpy(t, block, length_B);
    t[length_B] = 1;
    inject_block(a, t);
}

// Assembly:
cmpq $0x1f, %rdx
ja 0x15ce
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdx, %r14
movq %rdi, %rbx
vxorps %xmm0, %xmm0, %xmm0
movq %rsp, %r15
vmovups %ymm0, (%r15)
movq %r15, %rdi
vzeroupper
callq 0x1110
movb $0x1, (%rsp,%r14)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1495
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/crypto_aead/pi32cipher256v2/ref3/pi-cipher.c
// Function: pi32_encrypt_last_block
void PI_ENCRYPT_LAST_BLOCK(
        PI_CTX *ctx,
        void *dest,
        const void *src,
        size_t length_B,
        unsigned long num )
{
    state_t a;
    while (length_B >= PI_PT_BLOCK_LENGTH_BYTES) {
        PI_ENCRYPT_BLOCK(ctx, dest, src, num);
        num++;
        length_B -= PI_PT_BLOCK_LENGTH_BYTES;
        src = &((uint8_t*)src)[PI_PT_BLOCK_LENGTH_BYTES];
        if (dest) {
            dest = &((uint8_t*)dest)[PI_CT_BLOCK_LENGTH_BYTES];
        }
    }
    ctr_trans(ctx, a, num);
    inject_last_block(a, src, length_B);
    if (dest) {
        uint8_t tmp[PI_PT_BLOCK_LENGTH_BYTES];
        extract_block(tmp, a);
        memcpy(dest, tmp, length_B);
    }
    pi((word_t*)a);
    add_tag(ctx, a);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %r8, %r13
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
cmpq $0x20, %r14
jb 0x1775
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x1050
incq %r13
addq $-0x20, %r14
addq $0x20, %r12
leaq 0x20(%r15), %rax
testq %r15, %r15
cmovneq %rax, %r15
jmp 0x1746
movq %rsp, %rbp
movq %rbx, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x145b
movq %rbp, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x1589
testq %r15, %r15
je 0x17b7
leaq 0x40(%rsp), %r12
movq %rsp, %rsi
movq %r12, %rdi
callq 0x161e
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x1110
movq %rsp, %r14
movq %r14, %rdi
callq 0x134c
movq %rbx, %rdi
movq %r14, %rsi
callq 0x14be
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/crypto_aead/pi32cipher256v2/ref3/pi-cipher.c
// Function: pi32_encrypt_simple
void PI_ENCRYPT_SIMPLE(
        void *cipher,
        size_t *cipher_len_B,
        const void *msg,
        size_t msg_len_B,
        const void *ad,
        size_t ad_len_B,
        const void *nonce_secret,
        const void *nonce_public,
        size_t nonce_public_len_B,
        const void *key,
        size_t key_len_B
        )
{
    unsigned i;
    PI_CTX ctx;
    if (PI_INIT(&ctx, key, key_len_B, nonce_public, nonce_public_len_B)) {
        printf("ERROR! <%s %s %d>\n", __FILE__, __func__, __LINE__);
        return;
    }
    i = 1;
    while (ad_len_B >= PI_AD_BLOCK_LENGTH_BYTES) {
        PI_PROCESS_AD_BLOCK(&ctx, ad, i++);
        ad_len_B -= PI_AD_BLOCK_LENGTH_BYTES;
        ad = &((const uint8_t*)ad)[PI_AD_BLOCK_LENGTH_BYTES];
    }
    PI_PROCESS_AD_LAST_BLOCK(&ctx, ad, ad_len_B, i);
    *cipher_len_B = 0;
    if (nonce_secret) {
        PI_ENCRYPT_SMN(&ctx, cipher, nonce_secret);
        *cipher_len_B += PI_CT_BLOCK_LENGTH_BYTES;
        cipher = &((uint8_t*)cipher)[PI_CT_BLOCK_LENGTH_BYTES];
    }
    i = 1;
    while (msg_len_B >= PI_PT_BLOCK_LENGTH_BYTES) {
        PI_ENCRYPT_BLOCK(&ctx, cipher, msg, i++);
        msg = &((const uint8_t*)msg)[PI_PT_BLOCK_LENGTH_BYTES];
        cipher = &((uint8_t*)cipher)[PI_CT_BLOCK_LENGTH_BYTES];
        *cipher_len_B += PI_CT_BLOCK_LENGTH_BYTES;
        msg_len_B -= PI_PT_BLOCK_LENGTH_BYTES;
    }
    PI_ENCRYPT_LAST_BLOCK(&ctx, cipher, msg, msg_len_B, i);
    *cipher_len_B += msg_len_B;
    cipher = &((uint8_t*)cipher)[msg_len_B];
    PI_EXTRACT_TAG(&ctx, cipher);
    *cipher_len_B += PI_TAG_BYTES;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x78, %rsp
movq %r9, %r13
movq %r8, %rbp
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %rbx
movq %rdi, %r15
movq 0xc8(%rsp), %rsi
movq 0xd0(%rsp), %rdx
movq 0xb8(%rsp), %rcx
movq 0xc0(%rsp), %r8
leaq 0x10(%rsp), %rdi
callq 0x1100
testl %eax, %eax
jne 0x1a36
movq %rbx, 0x8(%rsp)
pushq $0x1
popq %rbx
movl %ebx, %ecx
cmpq $0x20, %r13
jb 0x1995
incl %ebx
leaq 0x10(%rsp), %rdi
movq %rbp, %rsi
movq %rcx, %rdx
callq 0x10c0
addq $-0x20, %r13
addq $0x20, %rbp
jmp 0x1971
leaq 0x10(%rsp), %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x1030
movq 0x8(%rsp), %rbp
andq $0x0, (%rbp)
movq 0xb0(%rsp), %rdx
testq %rdx, %rdx
je 0x19d2
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x10a0
addq $0x20, (%rbp)
addq $0x20, %r15
pushq $0x1
popq %rbx
leaq 0x10(%rsp), %r13
movl %ebx, %r8d
cmpq $0x20, %r14
jb 0x1a09
incl %ebx
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r8, %rcx
callq 0x1050
addq $0x20, %r12
addq $0x20, %r15
addq $0x20, (%rbp)
addq $-0x20, %r14
jmp 0x19da
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r14, %rcx
callq 0x1070
addq %r14, (%rbp)
addq %r14, %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x1120
addq $0x20, (%rbp)
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/robertdavidgraham[P]wc2/wcdiff.c
// Function: is_executable
int is_executable(const char *filename)
{
    struct stat st;

    if (stat(filename, &st) != 0) {
        fprintf(stderr, "[-] %s: %s\n", filename, strerror(errno));
        return 0;
    }
    if (!(st.st_mode & S_IXUSR)) {
        fprintf(stderr, "[-] %s: not executable\n", filename);
        return 0;
    }
    return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x90, %rsp
movq %rdi, %rbx
movq %rsp, %rsi
callq 0x1100
testl %eax, %eax
jne 0x132a
testb $0x40, 0x18(%rsp)
je 0x135b
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0x90, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq 0x2cc7(%rip), %rax      # 0x3ff8
movq (%rax), %r14
callq 0x1040
movl (%rax), %edi
callq 0x1170
leaq 0xcbd(%rip), %rsi       # 0x2004
xorl %ebp, %ebp
movq %r14, %rdi
movq %rbx, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x10f0
jmp 0x131c
movq 0x2c96(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
leaq 0xca4(%rip), %rsi       # 0x2010
xorl %ebp, %ebp
movq %rbx, %rdx
xorl %eax, %eax
callq 0x10f0
jmp 0x131c
// File: /workspace/github_c_makefile_star2_O2/robertdavidgraham[P]wc2/wcdiff.c
// Function: get_results
struct wcresults
get_results(int fd)
{
    struct wcresults results;

    results.line_count = get_integer(fd);
    results.word_count = get_integer(fd);
    results.char_count = get_integer(fd);

    return results;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movl %esi, %edi
callq 0x153a
movq %rax, (%r14)
movl %ebx, %edi
callq 0x153a
movq %rax, 0x8(%r14)
movl %ebx, %edi
callq 0x153a
movq %rax, 0x10(%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/robertdavidgraham[P]wc2/wcdiff.c
// Function: get_integer
static long
get_integer(int fd)
{
    int state = 0;
    long result = -1;

    for (;;) {
        char c;
        int count;

        count = read(fd, &c, 1);
        if (count <= 0)
            return -1;

        switch (state) {
        case 0:
            if (c == '\n')
                return -1;
            if (isspace(c))
                continue;
            if (isdigit(c)) {
                result = c - '0';
                state++;
                continue;
            }
            return -1;
        case 1:
            if (isspace(c))
                return result;
            if (!isdigit(c))
                return -1;
            result = result * 10 + (c - '0');
            break;
        }
    }
    return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebp
pushq $-0x1
popq %rbx
xorl %r12d, %r12d
leaq 0x7(%rsp), %r14
pushq $0x1
popq %r15
movl %ebp, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x10d0
testl %eax, %eax
jle 0x15cd
testl %r12d, %r12d
je 0x1598
callq 0x1190
movq (%rax), %rcx
movsbq 0x7(%rsp), %rax
movzwl (%rcx,%rax,2), %ecx
btl $0xd, %ecx
jb 0x15d2
btl $0xb, %ecx
jae 0x15cd
imulq $0xa, %rbx, %rcx
leaq (%rcx,%rax), %rbx
addq $-0x30, %rbx
jmp 0x1556
movsbq 0x7(%rsp), %r13
cmpq $0xa, %r13
je 0x15cd
callq 0x1190
movq (%rax), %rax
movzwl (%rax,%r13,2), %eax
xorl %r12d, %r12d
btl $0xd, %eax
jb 0x1556
btl $0xb, %eax
jae 0x15cd
addq $-0x30, %r13
pushq $0x1
popq %r12
movq %r13, %rbx
jmp 0x1556
pushq $-0x1
popq %rax
jmp 0x15d5
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/robertdavidgraham[P]wc2/wcdiff.c
// Function: word_count
long
word_count(const char *progname, const char *parms, const unsigned char *buf, size_t length)
{
    struct handles h;
    size_t offset = 0;
    struct wcresults results;


    h = my_spawn(progname, parms);
    if (h.child_stdin <= 0 || h.child_stdout <= 0) {
        fprintf(stderr, "[-] spawn failed\n");
        return -1;
    }

    /* keep writing until we've written the entire chunk */
    while (offset < length) {
        size_t count;
        count = write(h.child_stdin, buf+offset, length-offset);
        if (count == 0) {
            perror("write()");
            exit(1);
        }
        offset += count;
    }

    /* Close the handle, telling the child process that input has ended */
    close(h.child_stdin);

    /* Read the results from the child */
    results = get_results(h.child_stdout);

    close(h.child_stdout);
    close(h.child_stderr);
    cleanup_children();

    return results.word_count;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %r14
movq %rdx, %r15
callq 0x137a
movq %rax, %r13
testl %r13d, %r13d
jle 0x16ae
movq %r13, %r12
shrq $0x20, %r12
testl %r12d, %r12d
jle 0x16ae
movl %edx, %ebx
xorl %ebp, %ebp
movq %r14, %rdx
subq %rbp, %rdx
jbe 0x164d
leaq (%r15,%rbp), %rsi
movl %r13d, %edi
callq 0x1070
addq %rax, %rbp
testq %rax, %rax
jne 0x161d
leaq 0xa35(%rip), %rdi       # 0x2075
callq 0x1130
pushq $0x1
popq %rdi
callq 0x1150
movl %r13d, %edi
callq 0x10b0
movq %rsp, %r14
movq %r14, %rdi
movl %r12d, %esi
callq 0x1506
movq 0x8(%r14), %r14
movl %r12d, %edi
callq 0x10b0
movl %ebx, %edi
callq 0x10b0
pushq $-0x1
popq %rbx
pushq $0x1
popq %rbp
movl %ebx, %edi
xorl %esi, %esi
movl %ebp, %edx
callq 0x1120
testl %eax, %eax
jg 0x167c
je 0x169c
cmpl $-0x1, %eax
jne 0x1645
callq 0x1040
cmpl $0xa, (%rax)
jne 0x1645
movq %r14, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2943(%rip), %rax      # 0x3ff8
movq (%rax), %rcx
leaq 0x9a4(%rip), %rdi       # 0x2063
pushq $0x11
popq %rsi
pushq $0x1
popq %rdx
callq 0x1160
pushq $-0x1
popq %r14
jmp 0x169c
// File: /workspace/github_c_makefile_star2_O2/robertdavidgraham[P]wc2/wcdiff.c
// Function: utf8_len
unsigned
utf8_len(unsigned char c)
{
    if (c < 0x80) {
        return 1;
    } else if ((c&0xE0) == 0xC0) {
        return  2;
    } else if ((c&0xF0) == 0xE0) {
        return 3;
    } else if ((c&0xF1) == 0xF0) {
        return 4;
    } else
        return 0;
}

// Assembly:
testb %dil, %dil
js 0x16d9
pushq $0x1
jmp 0x16f7
movl %edi, %eax
andl $-0x20, %eax
cmpl $0xc0, %eax
jne 0x16e9
pushq $0x2
jmp 0x16f7
movl %edi, %eax
andl $-0x10, %eax
cmpl $0xe0, %eax
jne 0x16f9
pushq $0x3
popq %rax
retq
andl $-0xf, %edi
xorl %eax, %eax
cmpl $0xf0, %edi
sete %al
shll $0x2, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/codeplea[P]tinyexpr/tinyexpr.c
// Function: factor
static te_expr *factor(state *s) {
    /* <factor>    =    <power> {"^" <power>} */
    te_expr *ret = power(s);
    CHECK_NULL(ret);

    while (s->type == TOK_INFIX && (s->function == pow)) {
        te_fun2 t = s->function;
        next_token(s);
        te_expr *p = power(s);
        CHECK_NULL(p, te_free(ret));

        te_expr *prev = ret;
        ret = NEW_EXPR(TE_FUNCTION2 | TE_FLAG_PURE, ret, p);
        CHECK_NULL(ret, te_free(p), te_free(prev));

        ret->function = t;
    }

    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
callq 0x21e6
testq %rax, %rax
je 0x21d2
movq %rax, %rbx
movq 0x2e5d(%rip), %r13      # 0x4fd0
pushq $0x2a
popq %rbp
leaq 0x8(%rsp), %r15
cmpl $0x20, 0x10(%r14)
jne 0x21d4
cmpq %r13, 0x18(%r14)
jne 0x21d4
movq %r14, %rdi
callq 0x1254
movq %r14, %rdi
callq 0x21e6
testq %rax, %rax
je 0x21ca
movq %rax, %r12
movq %rbx, 0x8(%rsp)
movq %rax, 0x10(%rsp)
movl %ebp, %edi
movq %r15, %rsi
callq 0x2019
testq %rax, %rax
je 0x21c2
movq %r13, 0x8(%rax)
movq %rax, %rbx
jmp 0x217b
movq %r12, %rdi
callq 0x123c
movq %rbx, %rdi
callq 0x123c
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/mktrd/mktrd.cpp
// Function: readfile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned char*, int)
int readfile(const string fname,unsigned char* buf,int fmax=0xa0000) {
	FILE *infile=fopen(fname.c_str(),"rb");
	if (!infile) return -1;		// failed to open file
	fseek(infile,0,SEEK_END);
	int iflen = ftell(infile);
	rewind(infile);
	if (iflen < fmax+1) {
		rewind(infile);
		fread((char*)buf,1,iflen,infile);
	} else {
		iflen=0;
	}
	fclose(infile);
	return iflen;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r12d
movq %rsi, %r14
movq (%rdi), %rdi
leaq 0x17987e(%rip), %rsi    # 0x57e004
callq 0x4d48c0
testq %rax, %rax
je 0x4047e1
movq %rax, %rbx
xorl %r15d, %r15d
pushq $0x2
popq %rdx
movq %rax, %rdi
xorl %esi, %esi
callq 0x4d9230
movq %rbx, %rdi
callq 0x4d4bf0
movq %rax, %r13
movq %rbx, %rdi
callq 0x4d9570
cmpl %r12d, %r13d
jg 0x4047d7
movq %rbx, %rdi
callq 0x4d9570
movslq %r13d, %rdx
pushq $0x1
popq %rsi
movq %r14, %rdi
movq %rbx, %rcx
callq 0x4d4af0
movl %r13d, %r15d
movq %rbx, %rdi
callq 0x4d4190
jmp 0x4047e5
pushq $-0x1
popq %r15
movl %r15d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/mktrd/mktrd.cpp
// Function: savefile(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned char*, int)
bool savefile(const string fname, unsigned char* buf, int len) {
	FILE *file=fopen(fname.c_str(),"wb");
	if (!file) return false;
	fwrite((char*)buf,1,len,file);
	fclose(file);
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %r15d
movq %rsi, %r14
movq (%rdi), %rdi
leaq 0x1797f6(%rip), %rsi    # 0x57e007
callq 0x4d48c0
movq %rax, %rbx
testq %rax, %rax
je 0x404837
movslq %r15d, %rdx
pushq $0x1
popq %rsi
movq %r14, %rdi
movq %rbx, %rcx
callq 0x4d4d40
movq %rbx, %rdi
callq 0x4d4190
testq %rbx, %rbx
setne %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/mktrd/mktrd.cpp
// Function: extractfile(unsigned char*, unsigned char*, int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void extractfile(unsigned char* buf, unsigned char* ptr,int fpos,const string fname) {
	int len=*(ptr+11)+(*(ptr+12)<<8);
	unsigned char slen=*(ptr+13);
	unsigned char rlen=*(ptr+12); if (*(ptr+11)!=0) rlen++;
	if (slen!=rlen) len=(slen<<8);
	printf("%.8s\n",ptr);
	FILE *ofile=fopen(fname.c_str(),"wb");
	if (!ofile) {cout<<"Can't write file"<<endl; return;}
	fwrite(buf+fpos,1,len,ofile);
	fclose(ofile);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movl %edx, -0x2c(%rbp)
movq %rdi, %rbx
movzbl 0xb(%rsi), %r14d
movzbl 0xc(%rsi), %r12d
movzbl 0xd(%rsi), %r13d
leaq 0x17975c(%rip), %rdi    # 0x57e013
xorl %eax, %eax
callq 0x4cdc40
movq (%r15), %rdi
leaq 0x17973f(%rip), %rsi    # 0x57e007
callq 0x4d48c0
testq %rax, %rax
je 0x40491d
movq %rax, %r15
cmpq $0x1, %r14
movl %r12d, %eax
sbbb $-0x1, %al
shll $0x8, %r12d
orq %r14, %r12
movl %r13d, %edx
shll $0x8, %edx
cmpb %al, %r13b
cmoveq %r12, %rdx
movslq -0x2c(%rbp), %rax
addq %rax, %rbx
pushq $0x1
popq %rsi
movq %rbx, %rdi
movq %r15, %rcx
callq 0x4d4d40
movq %r15, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4d4190
movq $0x5ec460, %rdi         # imm = 0x5EC460
leaq 0x1796ee(%rip), %rsi    # 0x57e019
callq 0x46eb50
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x46e430
// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/mktrd/mktrd.cpp
// Function: makedsc(unsigned char*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, unsigned char, unsigned short)
void makedsc(unsigned char* ptr, const string fname, const string fext, int len,unsigned char slen, unsigned short start=0) {
	strncpy((char*)ptr,fname.c_str(),8);
	*(ptr+8)=fext[0];
	// start
	*(ptr+9)=(start & 0xFF);
	*(ptr+10)=(start >> 8) & 0xFF;
	// len
	*(ptr+11)=(len&0xff);
	*(ptr+12)=((len&0xff00)>>8);
	// slen
	*(ptr+13)=slen;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r9d, %r13d
movl %r8d, %r14d
movl %ecx, %r12d
movq %rdx, %r15
movq %rdi, %rbx
movq (%rsi), %rsi
pushq $0x8
popq %rdx
callq 0x4010c8
movq (%r15), %rax
movb (%rax), %al
movb %al, 0x8(%rbx)
movl %r13d, %eax
movb %al, 0x9(%rbx)
movb %ah, 0xa(%rbx)
movl %r12d, %eax
movb %al, 0xb(%rbx)
movb %ah, 0xc(%rbx)
movb %r14b, 0xd(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/mktrd/mktrd.cpp
// Function: list(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void list(const string fname) {
	unsigned char *buf = new unsigned char[0xa0000];
	int len=readfile(fname,buf);
	if (len<1) {cout<<"Can't read file"<<endl; return;}
	int mode=testsig(buf,len);
	unsigned char* ptr = buf;
	unsigned char i=0;
	switch (mode) {
		case 1:
			ptr+=9;
			printf("Name\t\tExt\tStart\tSize\tSLen\n---------------------------\n");
			for(;i<*(buf+8);i++) {
				printf("%.8s\t%.1s\t%i\t%i\t%i\n",ptr,ptr+8,*(ptr+9)+(*(ptr+10)<<8),*(ptr+11)+(*(ptr+12)<<8),*(ptr+13));
				ptr+=14;
			}
			break;
		case 2:
			printf("Name\t\tExt\tStart\tSize\tSLen\tTrk\tSec\n---------------------------\n");
			while (*ptr!=0 && i<128) {
				if (*ptr!=1) printf("%.8s\t%.1s\t%i\t%i\t%i\t%i\t%i\n",ptr,ptr+8,*(ptr+9)+(*(ptr+10)<<8),*(ptr+11)+(*(ptr+12)<<8),*(ptr+13),*(ptr+14),*(ptr+15));
				ptr+=16; i++;
			}
			break;
		default: cout<<"Unknown image format"<<endl; break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdi, %r14
movl $0xa0000, %edi          # imm = 0xA0000
callq 0x4068a0
movq %rax, %rbx
leaq -0x40(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x4776b0
movq %r15, %rdi
movq %rbx, %rsi
movl $0xa0000, %edx          # imm = 0xA0000
callq 0x404768
movl %eax, %r14d
movq %r15, %rdi
callq 0x474f20
testl %r14d, %r14d
jle 0x4053d8
movq %rbx, %rdi
movl %r14d, %esi
callq 0x404848
cmpb $0x2, %al
je 0x4053e1
movzbl %al, %eax
cmpl $0x1, %eax
jne 0x405443
leaq 0x178f83(%rip), %rdi    # 0x57e312
callq 0x4d52d0
movq %rbx, %r14
addq $0x11, %r14
xorl %r12d, %r12d
leaq 0x178dbb(%rip), %r15    # 0x57e160
cmpb 0x8(%rbx), %r12b
jae 0x40545e
leaq -0x8(%r14), %rsi
movzwl 0x1(%r14), %ecx
movzwl 0x3(%r14), %r8d
movzbl 0x5(%r14), %r9d
movq %r15, %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x4cdc40
incb %r12b
addq $0xe, %r14
jmp 0x4053a5
leaq 0x178c4b(%rip), %rsi    # 0x57e02a
jmp 0x40544a
leaq 0x178eec(%rip), %rdi    # 0x57e2d4
callq 0x4d52d0
addq $0x8, %rbx
xorl %r15d, %r15d
leaq 0x178d79(%rip), %r14    # 0x57e174
movb -0x8(%rbx), %al
testb %al, %al
je 0x40545e
testb %r15b, %r15b
js 0x40545e
cmpb $0x1, %al
je 0x40543a
leaq -0x8(%rbx), %rsi
movzwl 0x1(%rbx), %ecx
movzwl 0x3(%rbx), %r8d
movzbl 0x5(%rbx), %r9d
movzbl 0x6(%rbx), %r10d
movzbl 0x7(%rbx), %r11d
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x4cdc40
popq %rcx
popq %rdx
incb %r15b
addq $0x10, %rbx
jmp 0x4053fb
leaq 0x178c7c(%rip), %rsi    # 0x57e0c6
movq $0x5ec460, %rdi         # imm = 0x5EC460
callq 0x46eb50
movq %rax, %rdi
callq 0x46e430
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/mktrd/mktrd.cpp
// Function: nlist(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void nlist(const string fname) {
	unsigned char *buf = new unsigned char[0xa0000];
	int len=readfile(fname,buf);
	if (len<1) {cout<<"Can't read file"<<endl; return;}
	int mode=testsig(buf,len);
	unsigned char* ptr = buf;
	unsigned char i=0;
	switch (mode) {
		case 1:
			ptr+=9;
			for(;i<*(buf+8);i++) {
				printf("%.8s.%.1s\n",ptr,ptr+8);
				ptr+=14;
			}
			break;
		case 2:
			while (*ptr!=0 && i<128) {
				if (*ptr!=1) printf("%.8s.%.1s\n",ptr,ptr+8);
				ptr+=16; i++;
			}
			break;
		default: cout<<"Unknown image format"<<endl; break;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdi, %r14
movl $0xa0000, %edi          # imm = 0xA0000
callq 0x4068a0
movq %rax, %rbx
leaq -0x40(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x4776b0
movq %r15, %rdi
movq %rbx, %rsi
movl $0xa0000, %edx          # imm = 0xA0000
callq 0x404768
movl %eax, %r14d
movq %r15, %rdi
callq 0x474f20
testl %r14d, %r14d
jle 0x405503
movq %rbx, %rdi
movl %r14d, %esi
callq 0x404848
cmpb $0x1, %al
je 0x40550c
movzbl %al, %eax
cmpl $0x2, %eax
jne 0x40553d
xorl %r15d, %r15d
leaq 0x178cb4(%rip), %r14    # 0x57e18e
movb (%rbx), %al
testb %al, %al
je 0x405558
testb %r15b, %r15b
js 0x405558
cmpb $0x1, %al
je 0x4054fa
leaq 0x8(%rbx), %rdx
movq %r14, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x4cdc40
addq $0x10, %rbx
incb %r15b
jmp 0x4054da
leaq 0x178b20(%rip), %rsi    # 0x57e02a
jmp 0x405544
movq %rbx, %r14
addq $0x9, %r14
xorl %r12d, %r12d
leaq 0x178c71(%rip), %r15    # 0x57e18e
cmpb 0x8(%rbx), %r12b
jae 0x405558
leaq 0x8(%r14), %rdx
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x4cdc40
incb %r12b
addq $0xe, %r14
jmp 0x40551d
leaq 0x178b82(%rip), %rsi    # 0x57e0c6
movq $0x5ec460, %rdi         # imm = 0x5EC460
callq 0x46eb50
movq %rax, %rdi
callq 0x46e430
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/mktrd/mktrd.cpp
// Function: createtrd(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void createtrd(const string fname) {
	unsigned char *buf = new unsigned char[0xa0000];
	*(buf+0x8e2)=0x01;
	*(buf+0x8e3)=0x16;
	*(buf+0x8e5)=0xf0;
	*(buf+0x8e6)=0x09;
	*(buf+0x8e7)=0x10;
	FILE *ofile = fopen(fname.c_str(),"wb");
	if (!ofile) {cout<<"Can't write to file"<<endl; return;}
	fwrite((char*)buf,1,0xa0000,ofile);
	fclose(ofile);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
movl $0xa0000, %edi          # imm = 0xA0000
callq 0x4068a0
movq %rax, %rbx
movw $0x1601, 0x8e2(%rax)    # imm = 0x1601
movw $0x9f0, 0x8e5(%rax)     # imm = 0x9F0
movb $0x10, 0x8e7(%rax)
movq (%r14), %rdi
leaq 0x178a68(%rip), %rsi    # 0x57e007
callq 0x4d48c0
testq %rax, %rax
je 0x4055cb
movq %rax, %r14
pushq $0x1
popq %rsi
movl $0xa0000, %edx          # imm = 0xA0000
movq %rbx, %rdi
movq %rax, %rcx
callq 0x4d4d40
movq %r14, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x4d4190
movq $0x5ec460, %rdi         # imm = 0x5EC460
leaq 0x178abd(%rip), %rsi    # 0x57e096
callq 0x46eb50
movq %rax, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x46e430
// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/mktrd/mktrd.cpp
// Function: createscl(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void createscl(const string fname) {
	char *buf = new char;
	strncpy(buf,"SINCLAIR\0",9);
	FILE *ofile = fopen(fname.c_str(),"wb");
	if (!ofile) {cout<<"Can't write to file"<<endl; return;}
	fwrite(buf,1,9,ofile);
	fclose(ofile);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
pushq $0x1
popq %rdi
callq 0x406860
movq %rax, %rbx
movabsq $0x5249414c434e4953, %rax # imm = 0x5249414C434E4953
movq %rax, (%rbx)
movb $0x0, 0x8(%rbx)
movq (%r14), %rdi
leaq 0x1789ed(%rip), %rsi    # 0x57e007
callq 0x4d48c0
testq %rax, %rax
je 0x405644
movq %rax, %r14
pushq $0x1
popq %rsi
pushq $0x9
popq %rdx
movq %rbx, %rdi
movq %rax, %rcx
callq 0x4d4d40
movq %r14, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x4d4190
movq $0x5ec460, %rdi         # imm = 0x5EC460
leaq 0x178a44(%rip), %rsi    # 0x57e096
callq 0x46eb50
movq %rax, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x46e430
// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/mktrd/mktrd.cpp
// Function: help(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void help(const string pname) {
	cout<<"Usage:"<<endl;
	cout<<pname<<" list filename\t\t\tlist of files (formated)"<<endl;
	cout<<pname<<" nlist filename\t\t\tlist of files (name.ext only)"<<endl;
	cout<<pname<<" ctrd filename\t\t\tcreate new TRD"<<endl;
	cout<<pname<<" cscl filename\t\t\tcreate new SCL"<<endl;
	cout<<pname<<" add filename archname\t\tadd file to archive"<<endl;
	cout<<pname<<" pop filename archname\t\textract file from archive"<<endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq $0x5ec460, %r14         # imm = 0x5EC460
leaq 0x178b1e(%rip), %rsi    # 0x57e199
movq %r14, %rdi
callq 0x46eb50
movq %rax, %rdi
callq 0x46e430
movq %r14, %rdi
movq %rbx, %rsi
callq 0x477950
leaq 0x178b03(%rip), %rsi    # 0x57e1a0
movq %rax, %rdi
callq 0x46eb50
movq %rax, %rdi
callq 0x46e430
movq %r14, %rdi
movq %rbx, %rsi
callq 0x477950
leaq 0x178b0b(%rip), %rsi    # 0x57e1ca
movq %rax, %rdi
callq 0x46eb50
movq %rax, %rdi
callq 0x46e430
movq %r14, %rdi
movq %rbx, %rsi
callq 0x477950
leaq 0x178b19(%rip), %rsi    # 0x57e1fa
movq %rax, %rdi
callq 0x46eb50
movq %rax, %rdi
callq 0x46e430
movq %r14, %rdi
movq %rbx, %rsi
callq 0x477950
leaq 0x178b17(%rip), %rsi    # 0x57e21a
movq %rax, %rdi
callq 0x46eb50
movq %rax, %rdi
callq 0x46e430
movq %r14, %rdi
movq %rbx, %rsi
callq 0x477950
leaq 0x178b15(%rip), %rsi    # 0x57e23a
movq %rax, %rdi
callq 0x46eb50
movq %rax, %rdi
callq 0x46e430
movq %r14, %rdi
movq %rbx, %rsi
callq 0x477950
leaq 0x178b1f(%rip), %rsi    # 0x57e266
movq %rax, %rdi
callq 0x46eb50
movq %rax, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x46e430
// File: /workspace/github_c_makefile_star2_O2/gadget114514[P]fatfs-example/fatfs/source/diskio.c
// Function: disk_initialize
DSTATUS disk_initialize (
	BYTE pdrv				/* Physical drive nmuber to identify the drive */
)
{
  printf("disk_initialize\n");
  if (fno == -1)
    fno = open("abc.dat", O_SYNC|O_RDWR, S_IRUSR|S_IWUSR);
  lseek(fno, 0, SEEK_SET);
  return RES_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
leaq 0x41e6(%rip), %rdi      # 0x546d
callq 0x1030
movl 0x6dce(%rip), %edi      # 0x8060
cmpl $-0x1, %edi
jne 0x12b7
leaq 0x418a(%rip), %rdi      # 0x5428
movl $0x101002, %esi         # imm = 0x101002
movl $0x180, %edx            # imm = 0x180
xorl %eax, %eax
callq 0x1090
movl %eax, %edi
movl %eax, 0x6da9(%rip)      # 0x8060
xorl %esi, %esi
xorl %edx, %edx
callq 0x1060
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gadget114514[P]fatfs-example/fatfs/source/diskio.c
// Function: disk_read
DRESULT disk_read (
	BYTE pdrv,		/* Physical drive nmuber to identify the drive */
	BYTE *buff,		/* Data buffer to store read data */
	DWORD sector,	/* Start sector in LBA */
	UINT count		/* Number of sectors to read */
)
{
	DRESULT res;
	int result;

	printf("disk_read %d %ld %d\n", fno, sector, count);
	lseek(fno, sector*512, SEEK_SET);
	read(fno, buff, 512*count);

	return RES_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %ebx
movq %rdx, %r14
movq %rsi, %r15
movl 0x6d84(%rip), %esi      # 0x8060
leaq 0x414d(%rip), %rdi      # 0x5430
xorl %eax, %eax
callq 0x1050
movl 0x6d70(%rip), %edi      # 0x8060
shlq $0x9, %r14
movq %r14, %rsi
xorl %edx, %edx
callq 0x1060
movl 0x6d5c(%rip), %edi      # 0x8060
shll $0x9, %ebx
movq %r15, %rsi
movq %rbx, %rdx
callq 0x1080
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gadget114514[P]fatfs-example/fatfs/source/diskio.c
// Function: disk_write
DRESULT disk_write (
	BYTE pdrv,			/* Physical drive nmuber to identify the drive */
	const BYTE *buff,	/* Data to be written */
	DWORD sector,		/* Start sector in LBA */
	UINT count			/* Number of sectors to write */
)
{
	DRESULT res;
	int result;
	printf("disk_write %d %ld %d\n", fno, sector, count);	
	lseek(fno, sector*512, SEEK_SET);
	write(fno, buff, 512*count);
	return RES_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %ebx
movq %rdx, %r14
movq %rsi, %r15
movl 0x6d29(%rip), %esi      # 0x8060
leaq 0x4107(%rip), %rdi      # 0x5445
xorl %eax, %eax
callq 0x1050
movl 0x6d15(%rip), %edi      # 0x8060
shlq $0x9, %r14
movq %r14, %rsi
xorl %edx, %edx
callq 0x1060
movl 0x6d01(%rip), %edi      # 0x8060
shll $0x9, %ebx
movq %r15, %rsi
movq %rbx, %rdx
callq 0x1040
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gadget114514[P]fatfs-example/fatfs/source/diskio.c
// Function: disk_ioctl
DRESULT disk_ioctl (
	BYTE pdrv,		/* Physical drive nmuber (0..) */
	BYTE cmd,		/* Control code */
	void *buff		/* Buffer to send/receive control data */
)
{
	DRESULT res;
	int result;

	printf("disk_ioctl %d %d\n", pdrv, cmd);
	if (cmd == 3) { // sector size
	  *((WORD*)buff) = 512;
	  return RES_OK;
	}
	if (cmd == 1) { // total count
	  *((DWORD*)buff) = SECCOUNT;
	  return RES_OK;	  
	}
	if (cmd == CTRL_SYNC) {
	  return RES_OK;	  
	}
	return RES_PARERR;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdx, %r14
movl %esi, %ebx
movl %edi, %esi
leaq 0x40cc(%rip), %rdi      # 0x545b
movl %ebx, %edx
xorl %eax, %eax
callq 0x1050
testl %ebx, %ebx
je 0x13bc
cmpl $0x1, %ebx
je 0x13ae
cmpl $0x3, %ebx
jne 0x13b9
movw $0x200, (%r14)          # imm = 0x200
jmp 0x13b5
movq $0x80, (%r14)
xorl %ebx, %ebx
jmp 0x13bc
pushq $0x4
popq %rbx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gadget114514[P]fatfs-example/fatfs/source/ff.c
// Function: f_mount
FRESULT f_mount (
	FATFS* fs,			/* Pointer to the filesystem object (NULL:unmount)*/
	const TCHAR* path,	/* Logical drive number to be mounted/unmounted */
	BYTE opt			/* Mode option 0:Do not mount (delayed mount), 1:Mount immediately */
)
{
	FATFS *cfs;
	int vol;
	FRESULT res;
	const TCHAR *rp = path;


	/* Get logical drive number */
	vol = get_ldnumber(&rp);
	if (vol < 0) return FR_INVALID_DRIVE;
	cfs = FatFs[vol];					/* Pointer to fs object */

	if (cfs) {
#if FF_FS_LOCK != 0
		clear_lock(cfs);
#endif
#if FF_FS_REENTRANT						/* Discard sync object of the current volume */
		if (!ff_del_syncobj(cfs->sobj)) return FR_INT_ERR;
#endif
		cfs->fs_type = 0;				/* Clear old fs object */
	}

	if (fs) {
		fs->fs_type = 0;				/* Clear new fs object */
#if FF_FS_REENTRANT						/* Create sync object for the new volume */
		if (!ff_cre_syncobj((BYTE)vol, &fs->sobj)) return FR_INT_ERR;
#endif
	}
	FatFs[vol] = fs;					/* Register new fs object */

	if (opt == 0) return FR_OK;			/* Do not mount now, it will be mounted later */

	res = find_volume(&path, &fs, 0);	/* Force mounted the volume */
	LEAVE_FF(fs, res);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movl %edx, %ebx
movq %rdi, %r14
movq %rsi, -0x18(%rbp)
leaq -0x20(%rbp), %rdi
movq %rsi, (%rdi)
callq 0x143f
testl %eax, %eax
js 0x142f
movl %eax, %eax
leaq 0x6c6f(%rip), %rcx      # 0x8070
movq (%rcx,%rax,8), %rdx
testq %rdx, %rdx
je 0x140d
movb $0x0, (%rdx)
testq %r14, %r14
je 0x1416
movb $0x0, (%r14)
movq %r14, (%rcx,%rax,8)
testb %bl, %bl
je 0x1434
leaq -0x18(%rbp), %rdi
leaq -0x28(%rbp), %rsi
xorl %edx, %edx
callq 0x1480
jmp 0x1436
pushq $0xb
popq %rax
jmp 0x1436
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gadget114514[P]fatfs-example/fatfs/source/ff.c
// Function: move_window
static
FRESULT move_window (	/* Returns FR_OK or FR_DISK_ERR */
	FATFS* fs,			/* Filesystem object */
	DWORD sector		/* Sector number to make appearance in the fs->win[] */
)
{
	FRESULT res = FR_OK;


	if (sector != fs->winsect) {	/* Window offset changed? */
#if !FF_FS_READONLY
		res = sync_window(fs);		/* Write-back changes */
#endif
		if (res == FR_OK) {			/* Fill sector window with new data */
			if (disk_read(fs->pdrv, fs->win, sector, 1) != RES_OK) {
				sector = 0xFFFFFFFF;	/* Invalidate window if read data is not valid */
				res = FR_DISK_ERR;
			}
			fs->winsect = sector;
		}
	}
	return res;
}

// Assembly:
xorl %eax, %eax
cmpq %rsi, 0x50(%rdi)
je 0x1ed7
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
callq 0x357b
testl %eax, %eax
je 0x1eaa
pushq $0x1
popq %rax
jmp 0x1ed3
movzbl 0x1(%rbx), %edi
leaq 0x58(%rbx), %rsi
pushq $0x1
popq %rcx
movq %r14, %rdx
callq 0x12c4
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
setne %al
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmoveq %r14, %rcx
movq %rcx, 0x50(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gadget114514[P]fatfs-example/fatfs/source/ff.c
// Function: validate
static
FRESULT validate (	/* Returns FR_OK or FR_INVALID_OBJECT */
	FFOBJID* obj,	/* Pointer to the FFOBJID, the 1st member in the FIL/DIR object, to check validity */
	FATFS** rfs		/* Pointer to pointer to the owner filesystem object to return */
)
{
	FRESULT res = FR_INVALID_OBJECT;


	if (obj && obj->fs && obj->fs->fs_type && obj->id == obj->fs->id) {	/* Test if the object is valid */
#if FF_FS_REENTRANT
		if (lock_fs(obj->fs)) {	/* Obtain the filesystem object */
			if (!(disk_status(obj->fs->pdrv) & STA_NOINIT)) { /* Test if the phsical drive is kept initialized */
				res = FR_OK;
			} else {
				unlock_fs(obj->fs, FR_OK);
			}
		} else {
			res = FR_TIMEOUT;
		}
#else
		if (!(disk_status(obj->fs->pdrv) & STA_NOINIT)) { /* Test if the phsical drive is kept initialized */
			res = FR_OK;
		}
#endif
	}
	*rfs = (res == FR_OK) ? obj->fs : 0;	/* Corresponding filesystem object */
	return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
pushq $0x9
popq %r14
testq %rdi, %rdi
je 0x22d7
movq %rdi, %r15
movq (%rdi), %rax
testq %rax, %rax
je 0x22d7
cmpb $0x0, (%rax)
je 0x22d7
movzwl 0x8(%r15), %ecx
cmpw 0x6(%rax), %cx
jne 0x22d7
movzbl 0x1(%rax), %edi
callq 0x1274
xorl %ecx, %ecx
testb $0x1, %al
jne 0x22d9
movq (%r15), %rcx
xorl %r14d, %r14d
jmp 0x22d9
xorl %ecx, %ecx
movq %rcx, (%rbx)
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gadget114514[P]fatfs-example/fatfs/source/ff.c
// Function: sync_fs
static
FRESULT sync_fs (	/* Returns FR_OK or FR_DISK_ERR */
	FATFS* fs		/* Filesystem object */
)
{
	FRESULT res;


	res = sync_window(fs);
	if (res == FR_OK) {
		if (fs->fs_type == FS_FAT32 && fs->fsi_flag == 1) {	/* FAT32: Update FSInfo sector if needed */
			/* Create FSInfo structure */
			mem_set(fs->win, 0, SS(fs));
			st_word(fs->win + BS_55AA, 0xAA55);
			st_dword(fs->win + FSI_LeadSig, 0x41615252);
			st_dword(fs->win + FSI_StrucSig, 0x61417272);
			st_dword(fs->win + FSI_Free_Count, fs->free_clst);
			st_dword(fs->win + FSI_Nxt_Free, fs->last_clst);
			/* Write it into the FSInfo sector */
			fs->winsect = fs->volbase + 1;
			disk_write(fs->pdrv, fs->win, fs->winsect, 1);
			fs->fsi_flag = 0;
		}
		/* Make sure that no pending write process in the lower layer */
		if (disk_ioctl(fs->pdrv, CTRL_SYNC, 0) != RES_OK) res = FR_DISK_ERR;
	}

	return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x357b
testl %eax, %eax
je 0x2837
pushq $0x1
popq %rax
jmp 0x28b6
cmpb $0x3, (%rbx)
jne 0x28a0
cmpb $0x1, 0x4(%rbx)
jne 0x28a0
leaq 0x58(%rbx), %r14
leaq 0x5c(%rbx), %rdi
movl $0x1fa, %edx            # imm = 0x1FA
xorl %esi, %esi
callq 0x1070
movw $0xaa55, 0x256(%rbx)    # imm = 0xAA55
movl $0x41615252, 0x58(%rbx) # imm = 0x41615252
movl $0x61417272, 0x23c(%rbx) # imm = 0x61417272
movl 0x10(%rbx), %eax
movl 0x18(%rbx), %ecx
movl %ecx, 0x240(%rbx)
movl %eax, 0x244(%rbx)
movq 0x30(%rbx), %rdx
incq %rdx
movq %rdx, 0x50(%rbx)
movzbl 0x1(%rbx), %edi
pushq $0x1
popq %rcx
movq %r14, %rsi
callq 0x131f
movb $0x0, 0x4(%rbx)
movzbl 0x1(%rbx), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x137a
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
setne %al
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/gadget114514[P]fatfs-example/fatfs/source/ff.c
// Function: f_opendir
FRESULT f_opendir (
	DIR* dp,			/* Pointer to directory object to create */
	const TCHAR* path	/* Pointer to the directory path */
)
{
	FRESULT res;
	FATFS *fs;
	DEF_NAMBUF


	if (!dp) return FR_INVALID_OBJECT;

	/* Get logical drive */
	res = find_volume(&path, &fs, 0);
	if (res == FR_OK) {
		dp->obj.fs = fs;
		INIT_NAMBUF(fs);
		res = follow_path(dp, path);			/* Follow the path to the directory */
		if (res == FR_OK) {						/* Follow completed */
			if (!(dp->fn[NSFLAG] & NS_NONAME)) {	/* It is not the origin directory itself */
				if (dp->obj.attr & AM_DIR) {		/* This object is a sub-directory */
#if FF_FS_EXFAT
					if (fs->fs_type == FS_EXFAT) {
						dp->obj.c_scl = dp->obj.sclust;							/* Get containing directory inforamation */
						dp->obj.c_size = ((DWORD)dp->obj.objsize & 0xFFFFFF00) | dp->obj.stat;
						dp->obj.c_ofs = dp->blk_ofs;
						init_alloc_info(fs, &dp->obj);	/* Get object allocation info */
					} else
#endif
					{
						dp->obj.sclust = ld_clust(fs, dp->dir);	/* Get object allocation info */
					}
				} else {						/* This object is a file */
					res = FR_NO_PATH;
				}
			}
			if (res == FR_OK) {
				dp->obj.id = fs->id;
				res = dir_sdi(dp, 0);			/* Rewind directory */
#if FF_FS_LOCK != 0
				if (res == FR_OK) {
					if (dp->obj.sclust != 0) {
						dp->obj.lockid = inc_lock(dp, 0);	/* Lock the sub directory */
						if (!dp->obj.lockid) res = FR_TOO_MANY_OPEN_FILES;
					} else {
						dp->obj.lockid = 0;	/* Root directory need not to be locked */
					}
				}
#endif
			}
		}
		FREE_NAMBUF();
		if (res == FR_NO_FILE) res = FR_NO_PATH;
	}
	if (res != FR_OK) dp->obj.fs = 0;		/* Invalidate the directory object if function faild */

	LEAVE_FF(fs, res);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, -0x18(%rbp)
testq %rdi, %rdi
je 0x2b9c
movq %rdi, %rbx
leaq -0x18(%rbp), %rdi
leaq -0x20(%rbp), %rsi
xorl %edx, %edx
callq 0x1480
testl %eax, %eax
jne 0x2be3
movq -0x20(%rbp), %r14
movq %r14, (%rbx)
movq -0x18(%rbp), %rsi
movq %rbx, %rdi
callq 0x1a6d
testl %eax, %eax
je 0x2ba1
movl %eax, %ecx
cmpl $0x4, %eax
pushq $0x5
popq %rax
cmovnel %ecx, %eax
jmp 0x2be3
pushq $0x9
popq %rax
jmp 0x2be7
cmpb $0x0, 0x4b(%rbx)
js 0x2bce
testb $0x10, 0xa(%rbx)
jne 0x2bb2
pushq $0x5
popq %rax
jmp 0x2be3
movq 0x38(%rbx), %rcx
movzwl 0x1a(%rcx), %eax
cmpb $0x3, (%r14)
jne 0x2bca
movzwl 0x14(%rcx), %ecx
shll $0x10, %ecx
orq %rcx, %rax
movq %rax, 0x10(%rbx)
movzwl 0x6(%r14), %eax
movw %ax, 0x8(%rbx)
movq %rbx, %rdi
callq 0x2bf4
testl %eax, %eax
je 0x2bf0
andq $0x0, (%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
xorl %eax, %eax
jmp 0x2be7
// File: /workspace/github_c_makefile_star2_O2/gadget114514[P]fatfs-example/fatfs/source/ff.c
// Function: dir_sdi
static
FRESULT dir_sdi (	/* FR_OK(0):succeeded, !=0:error */
	DIR* dp,		/* Pointer to directory object */
	DWORD ofs		/* Offset of directory table */
)
{
	DWORD csz, clst;
	FATFS *fs = dp->obj.fs;


	if (ofs >= (DWORD)((FF_FS_EXFAT && fs->fs_type == FS_EXFAT) ? MAX_DIR_EX : MAX_DIR) || ofs % SZDIRE) {	/* Check range of offset and alignment */
		return FR_INT_ERR;
	}
	dp->dptr = ofs;				/* Set current offset */
	clst = dp->obj.sclust;		/* Table start cluster (0:root) */
	if (clst == 0 && fs->fs_type >= FS_FAT32) {	/* Replace cluster# 0 with root cluster# */
		clst = fs->dirbase;
		if (FF_FS_EXFAT) dp->obj.stat = 0;	/* exFAT: Root dir has an FAT chain */
	}

	if (clst == 0) {	/* Static table (root-directory on the FAT volume) */
		if (ofs / SZDIRE >= fs->n_rootdir) return FR_INT_ERR;	/* Is index out of range? */
		dp->sect = fs->dirbase;

	} else {			/* Dynamic table (sub-directory or root-directory on the FAT32/exFAT volume) */
		csz = (DWORD)fs->csize * SS(fs);	/* Bytes per cluster */
		while (ofs >= csz) {				/* Follow cluster chain */
			clst = get_fat(&dp->obj, clst);				/* Get next cluster */
			if (clst == 0xFFFFFFFF) return FR_DISK_ERR;	/* Disk error */
			if (clst < 2 || clst >= fs->n_fatent) return FR_INT_ERR;	/* Reached to end of table or internal error */
			ofs -= csz;
		}
		dp->sect = clst2sect(fs, clst);
	}
	dp->clust = clst;					/* Current cluster# */
	if (dp->sect == 0) return FR_INT_ERR;
	dp->sect += ofs / SS(fs);			/* Sector# of the directory entry */
	dp->dir = fs->win + (ofs % SS(fs));	/* Pointer to the entry in the win[] */

	return FR_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movq (%rdi), %r15
movq 0x10(%rdi), %r12
andq $0x0, 0x20(%rdi)
pushq $0x2
popq %rcx
testq %r12, %r12
je 0x2c4c
movzwl 0xa(%r15), %r13d
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movq %r12, %rax
testw %r13w, %r13w
jne 0x2c6c
movq %r14, %rdi
movq %rax, %rsi
callq 0x1ed8
cmpq %rbx, %rax
je 0x2c93
cmpq $0x2, %rax
jb 0x2c48
cmpq 0x20(%r15), %rax
jb 0x2c26
pushq $0x2
jmp 0x2c95
cmpb $0x3, (%r15)
jb 0x2c5b
movq 0x40(%r15), %r12
testq %r12, %r12
jne 0x2c19
cmpw $0x0, 0x8(%r15)
je 0x2c96
movq 0x40(%r15), %rax
xorl %r12d, %r12d
jmp 0x2c7a
movq %r15, %rdi
movq %r12, %rsi
callq 0x201a
pushq $0x2
popq %rcx
movq %rax, 0x30(%r14)
movq %r12, 0x28(%r14)
testq %rax, %rax
je 0x2c96
addq $0x58, %r15
movq %r15, 0x38(%r14)
xorl %ecx, %ecx
jmp 0x2c96
pushq $0x1
popq %rcx
movl %ecx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq