LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/jfriesse[P]omping/util.c
// Function: util_gen_id
static void
util_gen_id(char *id, size_t len, const struct ai_item *ai_item,
    const struct sockaddr_storage *sas)
{
	pid_t pid;
	size_t pos;

	/*
	 * First fill item with some random data
	 */
	for (pos = 0; pos < len; pos++) {
#if defined(__FreeBSD__) || defined(__OPENBSD__)
		id[pos] = (unsigned char)arc4random_uniform(UCHAR_MAX);
#else
		id[pos] = (unsigned char)random();
#endif
	}

	pos = 0;

	if (pos + sizeof(pid) < len) {
		/*
		 * Add PID
		 */
		pid = getpid();
		memcpy(id, &pid, sizeof(pid));

		pos += sizeof(pid);
	}

	/*
	 * Add sas from ai_item
	 */
	if (ai_item != NULL) {
		util_gen_id_add_sas(id, len, &pos, &ai_item->sas);
	}

	if (sas != NULL) {
		util_gen_id_add_sas(id, len, &pos, sas);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
testq %rsi, %rsi
je 0x8dbb
xorl %r12d, %r12d
callq 0x2230
movb %al, (%r14,%r12)
incq %r12
cmpq %r12, %r15
jne 0x8daa
callq 0x20d0
movl %eax, (%r14)
testq %rbx, %rbx
je 0x8e12
movzwl (%rbx), %r8d
movl $0x4, %eax
movl $0x4, %edx
cmpl $0x2, %r8d
je 0x8dec
cmpl $0xa, %r8d
jne 0x8e1e
movl $0x10, %edx
movl $0x8, %eax
leaq 0x4(%rdx), %rcx
cmpq %r15, %rcx
jae 0x8e12
addq %rax, %rbx
addq $0x4, %r14
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2200
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x2f9b(%rip), %rdi      # 0xbdc0
leaq 0x2f01(%rip), %r14      # 0xbd2d
movl $0xc9, %esi
movl $0x2, %edx
movq %r14, %rcx
xorl %eax, %eax
callq 0x4ad6
movzwl (%rbx), %edx
movl $0x1, %edi
movq %r14, %rsi
xorl %eax, %eax
callq 0x20f0
// File: /workspace/github_c_makefile_star2_O3/jfriesse[P]omping/util.c
// Function: util_random_init
void
util_random_init(const struct sockaddr_storage *local_addr)
{
	unsigned int seed;
	unsigned int i;

	seed = time(NULL) + getpid();

	for (i = 0; i < af_sas_len(local_addr); i++) {
		seed += ((uint8_t *)local_addr)[i];
	}

	srandom(seed);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %edi, %edi
callq 0x2220
movq %rax, %r14
callq 0x20d0
addl %eax, %r14d
movq %rbx, %rdi
callq 0x2d4d
testl %eax, %eax
je 0x8f04
xorl %r15d, %r15d
movzbl (%rbx,%r15), %eax
addl %eax, %r14d
incq %r15
movq %rbx, %rdi
callq 0x2d4d
movl %eax, %eax
cmpq %rax, %r15
jb 0x8eea
movl %r14d, %edi
popq %rbx
popq %r14
popq %r15
jmp 0x2070
// File: /workspace/github_c_makefile_star2_O3/jfriesse[P]omping/util.c
// Function: util_time_double_absdiff
double
util_time_double_absdiff_us(struct timeval t1, struct timeval t2)
{
	double dt1, dt2, tmp;

	dt1 = t1.tv_usec + t1.tv_sec * UTIL_NSINMS;
	dt2 = t2.tv_usec + t2.tv_sec * UTIL_NSINMS;

	if (dt2 > dt1) {
		tmp = dt1;
		dt1 = dt2;
		dt2 = tmp;
	}

	return (dt1 - dt2);
}

// Assembly:
cvtsi2sd %rsi, %xmm0
cvtsi2sd %rdi, %xmm1
movsd 0x1a70(%rip), %xmm2     # 0xa9f0
mulsd %xmm2, %xmm1
cvtsi2sd %rcx, %xmm3
addsd %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsi2sd %rdx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm3, %xmm0
movapd %xmm1, %xmm2
minsd %xmm0, %xmm2
maxsd %xmm1, %xmm0
subsd %xmm2, %xmm0
divsd 0x15bb(%rip), %xmm0     # 0xa570
retq
// File: /workspace/github_c_makefile_star2_O3/jfriesse[P]omping/util.c
// Function: util_u64sqrt
uint32_t
util_u64sqrt(uint64_t n)
{
	double x, x2;

	if (n == 0) {
		return (0);
	}

	x = n;

	while (util_fabs((x2 = (x + n / x) / 2) - x) >= 0.5) {
		x = x2;
	}

	return ((uint32_t)x2);
}

// Assembly:
testq %rdi, %rdi
je 0x9175
movq %rdi, %xmm1
punpckldq 0x2c77(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x2c7f(%rip), %xmm1     # 0xbda0
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
movsd 0x2c7b(%rip), %xmm1     # 0xbdb0
movapd 0x2c43(%rip), %xmm2     # 0xbd80
movapd %xmm0, %xmm3
movapd %xmm3, %xmm4
movapd %xmm0, %xmm3
divsd %xmm4, %xmm3
addsd %xmm4, %xmm3
mulsd %xmm1, %xmm3
movapd %xmm3, %xmm5
subsd %xmm4, %xmm5
movapd %xmm5, %xmm4
xorpd %xmm2, %xmm4
maxsd %xmm5, %xmm4
ucomisd %xmm1, %xmm4
jae 0x9141
cvttsd2si %xmm3, %rax
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/jfriesse[P]omping/util.c
// Function: util_packet_loss_percent
int
util_packet_loss_percent(uint64_t packet_sent, uint64_t packet_received)
{
	int loss;

	if (packet_received > packet_sent) {
		DEBUG_PRINTF("packet_received > packet_sent");
		loss = 0;
	} else {
		loss = (int)((1.0 - (double)packet_received / (double)packet_sent) * 100.0);
	}

	return (loss);
}

// Assembly:
pushq %rbx
cmpq %rdi, %rsi
jbe 0x9222
leaq 0x2bba(%rip), %rdi      # 0xbdc0
leaq 0x2bdc(%rip), %rcx      # 0xbde9
xorl %ebx, %ebx
movl $0x170, %esi            # imm = 0x170
movl $0x2, %edx
xorl %eax, %eax
callq 0x4ad6
jmp 0x9280
movq %rsi, %xmm0
movq 0x2b61(%rip), %xmm1     # 0xbd90
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x2b65(%rip), %xmm2     # 0xbda0
subpd %xmm2, %xmm0
movapd %xmm0, %xmm3
unpckhpd %xmm0, %xmm3            # xmm3 = xmm3[1],xmm0[1]
addsd %xmm0, %xmm3
movq %rdi, %xmm0
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
subpd %xmm2, %xmm0
movapd %xmm0, %xmm1
unpckhpd %xmm0, %xmm1            # xmm1 = xmm1[1],xmm0[1]
addsd %xmm0, %xmm1
divsd %xmm1, %xmm3
movsd 0x1318(%rip), %xmm0     # 0xa588
subsd %xmm3, %xmm0
mulsd 0x2b3c(%rip), %xmm0     # 0xbdb8
cvttsd2si %xmm0, %ebx
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/antonblanchard[P]will-it-scale/tests/poll2.c
// Function: testcase_prepare
void testcase_prepare(unsigned long nr_tasks)
{
	struct rlimit rlim;
	int nr_procs = sysconf(_SC_NPROCESSORS_CONF);
	rlim_t new_lim = (NR_FILES + 10) * nr_procs;

	getrlimit(RLIMIT_NOFILE, &rlim);
	if (rlim.rlim_max < new_lim) {
		rlim.rlim_cur = new_lim;
		rlim.rlim_max = new_lim;
	}
	if (rlim.rlim_cur < new_lim) {
		rlim.rlim_cur = new_lim;
	}
	assert(setrlimit(RLIMIT_NOFILE, &rlim) == 0);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl $0x53, %edi
callq 0x2220
movabsq $0x8a00000000, %r14     # imm = 0x8A00000000
imulq %rax, %r14
sarq $0x20, %r14
leaq 0x8(%rsp), %rbx
movl $0x7, %edi
movq %rbx, %rsi
callq 0x22a0
cmpq %r14, 0x8(%rbx)
jae 0x2cdb
movq %r14, 0x8(%rsp)
movq %r14, 0x10(%rsp)
jmp 0x2ce7
cmpq %r14, 0x8(%rsp)
jae 0x2ce7
movq %r14, 0x8(%rsp)
leaq 0x8(%rsp), %rsi
movl $0x7, %edi
callq 0x21d0
testl %eax, %eax
jne 0x2d02
addq $0x18, %rsp
popq %rbx
popq %r14
retq
leaq 0x5af(%rip), %rdi       # 0x32b8
leaq 0x5cd(%rip), %rsi       # 0x32dd
leaq 0x5d4(%rip), %rcx       # 0x32eb
movl $0x1d, %edx
callq 0x2120
// File: /workspace/github_c_makefile_star2_O3/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
movups 0x5c2(%rip), %xmm0      # 0x3310
movaps %xmm0, 0x600(%rsp)
movq %r12, 0x610(%rsp)
movq %r14, %rdi
callq 0x21c0
movl %eax, (%rsp,%r15,4)
testl %eax, %eax
js 0x2dd2
movq %r14, %rdi
callq 0x2080
incq %r15
cmpq $0x80, %r15
jne 0x2d47
leaq 0x200(%rsp), %r14
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x2130
xorl %eax, %eax
movl (%rsp,%rax,4), %ecx
movl %ecx, 0x200(%rsp,%rax,8)
movw $0x4, 0x204(%rsp,%rax,8)
incq %rax
cmpq $0x80, %rax
jne 0x2d9b
movl $0x80, %esi
movq %r14, %rdi
xorl %edx, %edx
callq 0x21e0
testl %eax, %eax
js 0x2df1
incq (%rbx)
jmp 0x2d8a
leaq 0x54f(%rip), %rdi       # 0x3328
leaq 0x4fd(%rip), %rsi       # 0x32dd
leaq 0x552(%rip), %rcx       # 0x3339
movl $0x29, %edx
callq 0x2120
leaq 0x574(%rip), %rdi       # 0x336c
leaq 0x4de(%rip), %rsi       # 0x32dd
leaq 0x533(%rip), %rcx       # 0x3339
movl $0x37, %edx
callq 0x2120
// File: /workspace/github_c_makefile_star2_O3/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:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x40, %rsp
movq %rcx, %r15
leaq (%r8,%rdx), %rcx
addq $-0x3f, %rcx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq $-0x40, %rcx
jb 0x13c1
movq %r8, %r14
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)
vpmovsxbq 0xd52(%rip), %ymm0 # 0x2058
vpmovsxbq 0xd4d(%rip), %ymm1 # 0x205c
vpbroadcastq 0xd28(%rip), %ymm2 # 0x2040
xorl %eax, %eax
vpbroadcastq 0xd25(%rip), %ymm3 # 0x2048
vpbroadcastq %rbx, %ymm4
vpbroadcastq 0xd1e(%rip), %ymm5 # 0x2050
vpsrlq $0x2, %ymm1, %ymm6
vpand %ymm2, %ymm6, %ymm6
vpand %ymm3, %ymm1, %ymm7
vpsllq $0x4, %ymm6, %ymm6
vpaddq %ymm6, %ymm4, %ymm6
vpsllq $0x2, %ymm7, %ymm7
vmovdqa (%rsp,%rax,4), %xmm8
vpaddq %ymm7, %ymm6, %ymm6
vmovdqa 0x10(%rsp,%rax,4), %xmm7
kxnorw %k0, %k0, %k1
vpscatterqd %xmm8, (,%ymm6) {%k1}
vpsrlq $0x2, %ymm0, %ymm6
vpand %ymm2, %ymm6, %ymm6
vpand %ymm3, %ymm0, %ymm8
vpsllq $0x4, %ymm6, %ymm6
vpaddq %ymm6, %ymm4, %ymm6
vpsllq $0x2, %ymm8, %ymm8
vpaddq %ymm6, %ymm8, %ymm6
kxnorw %k0, %k0, %k1
vpscatterqd %xmm7, (,%ymm6) {%k1}
addq $0x8, %rax
vpaddq %ymm5, %ymm1, %ymm1
vpaddq %ymm5, %ymm0, %ymm0
cmpq $0x10, %rax
jne 0x1332
movq %rbx, %rdi
vzeroupper
callq 0x13cf
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_O3/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, %rdx
jb 0x1576
movq %rbx, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x10c0
incq %r14
addq $-0x20, %r15
addq $0x20, %r12
cmpq $0x1f, %r15
ja 0x1557
movq %rsp, %r13
movq %rbx, %rdi
movq %r13, %rsi
movq %r14, %rdx
callq 0x1500
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x15e9
movq %r13, %rdi
callq 0x13cf
vmovdqu 0x40(%rbx), %xmm0
vmovdqu 0x50(%rbx), %xmm1
vpaddd (%r13), %xmm0, %xmm0
vmovdqu %xmm0, 0x40(%rbx)
vpaddd 0x20(%r13), %xmm1, %xmm1
vmovdqu %xmm1, 0x50(%rbx)
addq %r14, 0x60(%rbx)
vpxor (%rbx), %xmm0, %xmm0
vmovdqu %xmm0, (%rbx)
vpxor 0x20(%rbx), %xmm1, %xmm0
vmovdqu %xmm0, 0x20(%rbx)
movq %rbx, %rdi
callq 0x13cf
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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, %rcx
jb 0x18b6
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
cmpq $0x1f, %r14
ja 0x1889
movq %rsp, %rbp
movq %rbx, %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x1500
movq %rbp, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x15e9
testq %r15, %r15
je 0x18fe
vmovaps (%rsp), %xmm0
vmovaps 0x20(%rsp), %xmm1
leaq 0x40(%rsp), %rsi
vmovaps %xmm0, (%rsi)
vmovaps %xmm1, 0x10(%rsi)
movq %r15, %rdi
movq %r14, %rdx
callq 0x1110
movq %rsp, %r14
movq %r14, %rdi
callq 0x13cf
vmovdqu 0x40(%rbx), %xmm0
vmovdqu 0x50(%rbx), %xmm1
vpaddd (%r14), %xmm0, %xmm0
vmovdqu %xmm0, 0x40(%rbx)
vpaddd 0x20(%r14), %xmm1, %xmm0
vmovdqu %xmm0, 0x50(%rbx)
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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, %rbx
movq %rdx, %r12
movq %rsi, %r14
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 0x1c0b
movl $0x1, %ecx
cmpq $0x20, %r13
movq %r14, 0x8(%rsp)
jb 0x1b63
movl $0x1, %r14d
movl %r14d, %edx
incl %r14d
leaq 0x10(%rsp), %rdi
movq %rbp, %rsi
callq 0x10c0
addq $-0x20, %r13
addq $0x20, %rbp
cmpq $0x1f, %r13
ja 0x1b3a
movl %r14d, %ecx
movq 0x8(%rsp), %r14
leaq 0x10(%rsp), %rdi
movq %rbp, %rsi
movq %r13, %rdx
callq 0x1030
movq $0x0, (%r14)
movq 0xb0(%rsp), %rdx
testq %rdx, %rdx
je 0x1b9c
leaq 0x10(%rsp), %rdi
movq %r15, %rsi
callq 0x10a0
addq $0x20, (%r14)
addq $0x20, %r15
movl $0x1, %r8d
cmpq $0x20, %rbx
jb 0x1bdd
movl $0x1, %ebp
leaq 0x10(%rsp), %r13
movl %ebp, %ecx
incl %ebp
movq %r13, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x1050
addq $0x20, %r12
addq $0x20, %r15
addq $0x20, (%r14)
addq $-0x20, %rbx
cmpq $0x1f, %rbx
ja 0x1bb2
movl %ebp, %r8d
leaq 0x10(%rsp), %r14
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x1070
movq 0x8(%rsp), %rax
addq %rbx, (%rax)
vmovups 0x40(%r14), %ymm0
vmovups %ymm0, (%r15,%rbx)
addq $0x20, (%rax)
addq $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
vzeroupper
retq
// File: /workspace/github_c_makefile_star2_O3/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, %ebx
leaq 0x7(%rsp), %rsi
movl $0x1, %edx
callq 0x10d0
testl %eax, %eax
jle 0x176d
xorl %ebp, %ebp
movq $-0x1, %r12
leaq 0x7(%rsp), %r14
movq $-0x1, %r15
testl %ebp, %ebp
je 0x1727
callq 0x1190
movq (%rax), %rcx
movsbq 0x7(%rsp), %rax
movzwl (%rcx,%rax,2), %ecx
btl $0xd, %ecx
jb 0x1786
btl $0xb, %ecx
jae 0x176d
leaq (%r12,%r12,4), %rcx
leaq (%rax,%rcx,2), %r12
addq $-0x30, %r12
jmp 0x175a
movsbq 0x7(%rsp), %r13
cmpq $0xa, %r13
je 0x1774
callq 0x1190
movq (%rax), %rax
movzwl (%rax,%r13,2), %eax
xorl %ebp, %ebp
btl $0xd, %eax
jb 0x175a
btl $0xb, %eax
jae 0x1774
addq $-0x30, %r13
movl $0x1, %ebp
movq %r13, %r12
movl $0x1, %edx
movl %ebx, %edi
movq %r14, %rsi
callq 0x10d0
testl %eax, %eax
jg 0x16f7
movq $-0x1, %r15
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %r15
jmp 0x1774
// File: /workspace/github_c_makefile_star2_O3/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
pushq %rax
movq %rcx, %r15
movq %rdx, %r12
callq 0x154c
movq %rax, %r13
testl %r13d, %r13d
jle 0x1853
movq %r13, %r14
shrq $0x20, %r14
testl %r14d, %r14d
jle 0x1853
movl %edx, %ebx
testq %r15, %r15
je 0x17e9
xorl %ebp, %ebp
leaq (%r12,%rbp), %rsi
movq %r15, %rdx
subq %rbp, %rdx
movl %r13d, %edi
callq 0x1070
testq %rax, %rax
je 0x1861
addq %rax, %rbp
cmpq %r15, %rbp
jb 0x17c6
movl %r13d, %edi
callq 0x10b0
movl %r14d, %edi
callq 0x16be
movl %r14d, %edi
callq 0x16be
movq %rax, %r15
movl %r14d, %edi
callq 0x16be
movl %r14d, %edi
callq 0x10b0
movl %ebx, %edi
callq 0x10b0
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
xorl %esi, %esi
movl $0x1, %edx
callq 0x1120
testl %eax, %eax
jg 0x181b
je 0x1841
cmpl $-0x1, %eax
jne 0x1866
callq 0x1040
cmpl $0xa, (%rax)
jne 0x1866
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x132b
movq $-0x1, %r15
jmp 0x1841
callq 0x1316
movl $0x1, %edi
callq 0x1150
// File: /workspace/github_c_makefile_star2_O3/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:
movl $0x1, %eax
testb %dil, %dil
js 0x187b
retq
movl %edi, %ecx
andl $-0x20, %ecx
movl $0x2, %eax
cmpl $0xc0, %ecx
je 0x187a
movl %edi, %ecx
andl $-0x10, %ecx
movl $0x3, %eax
cmpl $0xe0, %ecx
je 0x187a
andl $-0xf, %edi
xorl %eax, %eax
cmpl $0xf0, %edi
sete %al
shll $0x2, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
callq 0x23cb
testq %rax, %rax
je 0x23bd
movq %rax, %rbx
cmpl $0x20, 0x10(%r14)
jne 0x2398
movq 0x2c88(%rip), %r12      # 0x4fd0
cmpq %r12, 0x18(%r14)
jne 0x2398
movq %r14, %rdi
callq 0x12db
movq %r14, %rdi
callq 0x23cb
testq %rax, %rax
je 0x23ad
movq %rax, %r15
movl $0x1, %edi
movl $0x20, %esi
callq 0x1080
testq %rax, %rax
je 0x239d
movq %rbx, 0x10(%rax)
movq %r15, 0x18(%rax)
movl $0x2a, (%rax)
movq %r12, 0x8(%rax)
cmpl $0x20, 0x10(%r14)
movq %rax, %rbx
je 0x2348
jmp 0x23bf
movq %rbx, %rax
jmp 0x23bf
movq %r15, %rdi
callq 0x11d4
movq %r15, %rdi
callq 0x1030
movq %rbx, %rdi
callq 0x11d4
movq %rbx, %rdi
callq 0x1030
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/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, %rbx
movq (%rdi), %rdi
leaq 0x179a0e(%rip), %rsi    # 0x57e004
callq 0x4d4630
testq %rax, %rax
je 0x404655
movq %rax, %r14
xorl %r15d, %r15d
movq %rax, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x4d8fa0
movq %r14, %rdi
callq 0x4d4960
movq %rax, %r13
movq %r14, %rdi
callq 0x4d92e0
cmpl %r12d, %r13d
jg 0x40464b
movq %r14, %rdi
callq 0x4d92e0
movslq %r13d, %rdx
movl $0x1, %esi
movq %rbx, %rdi
movq %r14, %rcx
callq 0x4d4860
movl %r13d, %r15d
movq %r14, %rdi
callq 0x4d3f00
jmp 0x40465b
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
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_O3/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 0x179980(%rip), %rsi    # 0x57e007
callq 0x4d4630
movq %rax, %rbx
testq %rax, %rax
je 0x4046af
movslq %r15d, %rdx
movl $0x1, %esi
movq %r14, %rdi
movq %rbx, %rcx
callq 0x4d4ab0
movq %rbx, %rdi
callq 0x4d3f00
testq %rbx, %rbx
setne %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x1798e2(%rip), %rdi    # 0x57e013
xorl %eax, %eax
callq 0x4cd9b0
movq (%r15), %rdi
leaq 0x1798c5(%rip), %rsi    # 0x57e007
callq 0x4d4630
testq %rax, %rax
je 0x404799
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
movl $0x1, %esi
movq %rbx, %rdi
movq %r15, %rcx
callq 0x4d4ab0
movq %r15, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4d3f00
movq $0x5ec460, %rbx         # imm = 0x5EC460
leaq 0x179872(%rip), %rsi    # 0x57e019
movl $0x10, %edx
movq %rbx, %rdi
callq 0x46ef00
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x450050
movsbl %al, %esi
movq %rbx, %rdi
callq 0x46ea00
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x46dfd0
// File: /workspace/github_c_makefile_star2_O3/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 0x407180
movq %rax, %rbx
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0x40(%rbp), %r15
movq %r15, %rdi
callq 0x4062fa
movq %r15, %rdi
movq %rbx, %rsi
movl $0xa0000, %edx          # imm = 0xA0000
callq 0x4045d8
movl %eax, %r14d
movq (%r15), %rdi
cmpq %r12, %rdi
je 0x405936
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x406440
testl %r14d, %r14d
jle 0x4059b1
movabsq $0x5249414c434e4953, %rax # imm = 0x5249414C434E4953
cmpq %rax, (%rbx)
je 0x4059c6
cmpl $0xa0000, %r14d         # imm = 0xA0000
jne 0x4059fd
cmpb $0x10, 0x8e7(%rbx)
jne 0x4059fd
movb (%rbx), %al
testb %al, %al
je 0x405a43
addq $0x8, %rbx
movb $0x1, %r15b
leaq 0x178812(%rip), %r14    # 0x57e18e
cmpb $0x1, %al
je 0x405991
leaq -0x8(%rbx), %rsi
movq %r14, %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x4cd9b0
movb 0x8(%rbx), %al
testb %al, %al
je 0x405a43
leal 0x1(%r15), %ecx
addq $0x10, %rbx
testb %r15b, %r15b
movl %ecx, %r15d
jns 0x40597c
jmp 0x405a43
movq $0x5ec460, %rdi         # imm = 0x5EC460
leaq 0x17866b(%rip), %rsi    # 0x57e02a
movl $0xf, %edx
jmp 0x405a10
cmpb $0x0, 0x8(%rbx)
je 0x405a43
movq %rbx, %r14
addq $0x9, %r14
xorl %r12d, %r12d
leaq 0x1787b1(%rip), %r15    # 0x57e18e
leaq 0x8(%r14), %rdx
movq %r15, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x4cd9b0
incb %r12b
addq $0xe, %r14
cmpb 0x8(%rbx), %r12b
jb 0x4059dd
jmp 0x405a43
movq $0x5ec460, %rdi         # imm = 0x5EC460
leaq 0x1786bb(%rip), %rsi    # 0x57e0c6
movl $0x14, %edx
callq 0x46ef00
movq $0x5ec460, %rbx         # imm = 0x5EC460
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x450050
movsbl %al, %esi
movq %rbx, %rdi
callq 0x46ea00
movq %rax, %rdi
callq 0x46dfd0
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x407180
movq %rax, %rbx
movw $0x1601, 0x8e2(%rax)    # imm = 0x1601
movw $0x9f0, 0x8e5(%rax)     # imm = 0x9F0
movb $0x10, 0x8e7(%rax)
movq (%r14), %rdi
leaq 0x17857d(%rip), %rsi    # 0x57e007
callq 0x4d4630
testq %rax, %rax
je 0x405ab8
movq %rax, %r14
movl $0x1, %esi
movl $0xa0000, %edx          # imm = 0xA0000
movq %rbx, %rdi
movq %rax, %rcx
callq 0x4d4ab0
movq %r14, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x4d3f00
movq $0x5ec460, %rbx         # imm = 0x5EC460
leaq 0x1785d0(%rip), %rsi    # 0x57e096
movl $0x13, %edx
movq %rbx, %rdi
callq 0x46ef00
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x450050
movsbl %al, %esi
movq %rbx, %rdi
callq 0x46ea00
movq %rax, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x46dfd0
// File: /workspace/github_c_makefile_star2_O3/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
movl $0x1, %edi
callq 0x407140
movq %rax, %rbx
movabsq $0x5249414c434e4953, %rax # imm = 0x5249414C434E4953
movq %rax, (%rbx)
movb $0x0, 0x8(%rbx)
movq (%r14), %rdi
leaq 0x1784d7(%rip), %rsi    # 0x57e007
callq 0x4d4630
testq %rax, %rax
je 0x405b5e
movq %rax, %r14
movl $0x1, %esi
movl $0x9, %edx
movq %rbx, %rdi
movq %rax, %rcx
callq 0x4d4ab0
movq %r14, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x4d3f00
movq $0x5ec460, %rbx         # imm = 0x5EC460
leaq 0x17852a(%rip), %rsi    # 0x57e096
movl $0x13, %edx
movq %rbx, %rdi
callq 0x46ef00
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x450050
movsbl %al, %esi
movq %rbx, %rdi
callq 0x46ea00
movq %rax, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x46dfd0
// File: /workspace/github_c_makefile_star2_O3/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 %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq $0x5ec460, %r14         # imm = 0x5EC460
leaq 0x1785da(%rip), %rsi    # 0x57e199
movl $0x6, %edx
movq %r14, %rdi
callq 0x46ef00
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x450050
movsbl %al, %esi
movq %r14, %rdi
callq 0x46ea00
movq %rax, %rdi
callq 0x46dfd0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x46ef00
movq %rax, %r15
leaq 0x178594(%rip), %rsi    # 0x57e1a0
movl $0x29, %edx
movq %rax, %rdi
callq 0x46ef00
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x450050
movsbl %al, %esi
movq %r15, %rdi
callq 0x46ea00
movq %rax, %rdi
callq 0x46dfd0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x46ef00
movq %rax, %r15
leaq 0x178571(%rip), %rsi    # 0x57e1ca
movl $0x2f, %edx
movq %rax, %rdi
callq 0x46ef00
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x450050
movsbl %al, %esi
movq %r15, %rdi
callq 0x46ea00
movq %rax, %rdi
callq 0x46dfd0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x46ef00
movq %rax, %r15
leaq 0x178554(%rip), %rsi    # 0x57e1fa
movl $0x1f, %edx
movq %rax, %rdi
callq 0x46ef00
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x450050
movsbl %al, %esi
movq %r15, %rdi
callq 0x46ea00
movq %rax, %rdi
callq 0x46dfd0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x46ef00
movq %rax, %r15
leaq 0x178527(%rip), %rsi    # 0x57e21a
movl $0x1f, %edx
movq %rax, %rdi
callq 0x46ef00
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x450050
movsbl %al, %esi
movq %r15, %rdi
callq 0x46ea00
movq %rax, %rdi
callq 0x46dfd0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x46ef00
movq %rax, %r15
leaq 0x1784fa(%rip), %rsi    # 0x57e23a
movl $0x2b, %edx
movq %rax, %rdi
callq 0x46ef00
movq (%r15), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x450050
movsbl %al, %esi
movq %r15, %rdi
callq 0x46ea00
movq %rax, %rdi
callq 0x46dfd0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x46ef00
movq %rax, %rbx
leaq 0x1784d9(%rip), %rsi    # 0x57e266
movl $0x31, %edx
movq %rax, %rdi
callq 0x46ef00
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x450050
movsbl %al, %esi
movq %rbx, %rdi
callq 0x46ea00
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x46dfd0
// File: /workspace/github_c_makefile_star2_O3/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 0x5dce(%rip), %edi      # 0x7060
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, 0x5da9(%rip)      # 0x7060
xorl %esi, %esi
xorl %edx, %edx
callq 0x1060
xorl %eax, %eax
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x5d84(%rip), %esi      # 0x7060
leaq 0x414d(%rip), %rdi      # 0x5430
xorl %eax, %eax
callq 0x1050
movl 0x5d70(%rip), %edi      # 0x7060
shlq $0x9, %r14
movq %r14, %rsi
xorl %edx, %edx
callq 0x1060
movl 0x5d5c(%rip), %edi      # 0x7060
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_O3/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 0x5d29(%rip), %esi      # 0x7060
leaq 0x4107(%rip), %rdi      # 0x5445
xorl %eax, %eax
callq 0x1050
movl 0x5d15(%rip), %edi      # 0x7060
shlq $0x9, %r14
movq %r14, %rsi
xorl %edx, %edx
callq 0x1060
movl 0x5d01(%rip), %edi      # 0x7060
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_O3/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 0x13be
cmpl $0x1, %ebx
je 0x13ae
cmpl $0x3, %ebx
jne 0x13b9
movw $0x200, (%r14)          # imm = 0x200
jmp 0x13b5
movq $0x80, (%r14)
xorl %ebx, %ebx
jmp 0x13be
movl $0x4, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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
subq $0x10, %rsp
movq %rsi, -0x8(%rbp)
movl $0xb, %eax
testq %rsi, %rsi
je 0x1445
xorl %ecx, %ecx
movb (%rsi,%rcx), %r8b
incq %rcx
cmpb $0x21, %r8b
jb 0x13ff
cmpb $0x3a, %r8b
jne 0x13ec
cmpb $0x3a, %r8b
jne 0x1410
cmpq $0x2, %rcx
jne 0x1445
cmpb $0x30, (%rsi)
jne 0x1445
movq 0x5c59(%rip), %rax      # 0x7070
testq %rax, %rax
je 0x141f
movb $0x0, (%rax)
testq %rdi, %rdi
je 0x1427
movb $0x0, (%rdi)
movq %rdi, 0x5c42(%rip)      # 0x7070
testb %dl, %dl
je 0x1443
leaq -0x8(%rbp), %rdi
leaq -0x10(%rbp), %rsi
xorl %edx, %edx
callq 0x144b
jmp 0x1445
xorl %eax, %eax
addq $0x10, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/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 0x1fb1
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
callq 0x3782
movl %eax, %ecx
movl $0x1, %eax
testl %ecx, %ecx
jne 0x1fad
movzbl 0x1(%rbx), %edi
leaq 0x58(%rbx), %rsi
movq %r14, %rdx
movl $0x1, %ecx
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_O3/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
movl $0x9, %r14d
testq %rdi, %rdi
je 0x23f9
movq %rdi, %r15
movq (%rdi), %rax
testq %rax, %rax
je 0x23f9
cmpb $0x0, (%rax)
je 0x23f9
movzwl 0x8(%r15), %ecx
cmpw 0x6(%rax), %cx
jne 0x23f9
movzbl 0x1(%rax), %edi
callq 0x1274
xorl %ecx, %ecx
testb $0x1, %al
jne 0x23fb
movq (%r15), %rcx
xorl %r14d, %r14d
jmp 0x23fb
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_O3/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 0x3782
movl %eax, %ecx
movl $0x1, %eax
testl %ecx, %ecx
jne 0x29f1
cmpb $0x3, (%rbx)
jne 0x29db
cmpb $0x1, 0x4(%rbx)
jne 0x29db
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
movq %r14, %rsi
movl $0x1, %ecx
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