LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/Orycterope[P]corewar/src/vm/display_infos.c
// Function: check_keystroke
int			check_keystroke(t_arena *a)
{
	char	c;
	int		*cps;

	cps = &(a->display->cps);
	c = wgetch(a->display->w_info);
	if (c == 's')
		return (1);
	else if (c == ' ')
		a->display->running = !a->display->running;
	else if (c == 'j')
		*cps += (*cps < 1000) ? 10 : 1000 - *cps;
	else if (c == 'k')
		*cps -= (*cps >= 11) ? 10 : *cps - 1;
	else if (c == 'l')
		*cps += (*cps < 1000) ? 1 : 0;
	else if (c == ';')
		*cps -= (*cps > 1) ? 1 : 0;
	else if (c == 'q')
		a->display->quitting = 1;
	update_infos(a);
	return (0);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x30(%rdi), %r14
movq 0x30(%r14), %rdi
callq 0x2080
movzbl %al, %eax
leal -0x6a(%rax), %ecx
cmpl $0x9, %ecx
ja 0x4ba0
leaq 0x292e(%rip), %rax      # 0x74a4
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movl 0xc(%r14), %eax
leal -0x3e8(%rax), %ecx
negl %ecx
cmpl $0x3e8, %eax            # imm = 0x3E8
movl $0xa, %edx
cmovgel %ecx, %edx
addl %eax, %edx
movl %edx, 0xc(%r14)
jmp 0x4c12
cmpl $0x3b, %eax
je 0x4c00
cmpl $0x20, %eax
jne 0x4c12
movq 0x30(%rbx), %rax
xorl %ecx, %ecx
cmpl $0x0, 0x8(%rax)
sete %cl
movl %ecx, 0x8(%rax)
jmp 0x4c12
movl 0xc(%r14), %eax
leal -0x1(%rax), %ecx
cmpl $0xb, %eax
movl $0xa, %edx
cmovll %ecx, %edx
subl %edx, %eax
movl %eax, 0xc(%r14)
jmp 0x4c12
movl 0xc(%r14), %eax
xorl %ecx, %ecx
cmpl $0x3e8, %eax            # imm = 0x3E8
setl %cl
addl %eax, %ecx
movl %ecx, 0xc(%r14)
jmp 0x4c12
movq 0x30(%rbx), %rax
movl $0x1, 0x10(%rax)
jmp 0x4c12
movl $0x1, %eax
jmp 0x4c1c
movl 0xc(%r14), %eax
xorl %ecx, %ecx
cmpl $0x2, %eax
setge %cl
subl %ecx, %eax
movl %eax, 0xc(%r14)
movq %rbx, %rdi
callq 0x4a67
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/Orycterope[P]corewar/src/vm/display_infos.c
// Function: regulate_speed
void		regulate_speed(t_arena *a)
{
	static clock_t	last_release = 0;
	clock_t			now;

	while (1)
	{
		if (check_keystroke(a))
			break ;
		now = clock();
		if ((a->display->running == 1
					&& now >= last_release + CLOCKS_PER_SEC / a->display->cps)
				|| a->display->quitting)
			break ;
	}
	last_release = now;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x4b50
testl %eax, %eax
jne 0x4c70
callq 0x2090
movq %rax, %r14
movq 0x30(%rbx), %rcx
cmpl $0x1, 0x8(%rcx)
jne 0x4c60
movslq 0xc(%rcx), %rsi
movl $0xf4240, %eax          # imm = 0xF4240
xorl %edx, %edx
idivq %rsi
addq 0x6775(%rip), %rax      # 0xb3d0
cmpq %rax, %r14
jge 0x4c70
cmpl $0x0, 0x10(%rcx)
jne 0x4c70
movq %rbx, %rdi
callq 0x4b50
jmp 0x4c30
movq %r14, 0x6759(%rip)      # 0xb3d0
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/Orycterope[P]corewar/src/vm/display_infos.c
// Function: print_winner_display
void		print_winner_display(t_arena *a)
{
	t_player	*p;
	t_player	*best;

	best = a->players;
	p = a->players;
	while (p != NULL)
	{
		if (p->last_live >= best->last_live)
			best = p;
		p = p->next;
	}
	a->display->running = 0;
	update_infos(a);
	wtimeout(a->display->w_info, -1);
	wprintw(a->display->w_info, "\n\n\nThe fight as ended.\n\n");
	wprintw(a->display->w_info, "The winner is ");
	wattron(a->display->w_info, COLOR_PAIR(best->id));
	wprintw(a->display->w_info, "%s\n\n", best->name);
	wattroff(a->display->w_info, COLOR_PAIR(best->id));
	wprintw(a->display->w_info, "Press any key to exit");
	wgetch(a->display->w_info);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %r14
testq %r14, %r14
je 0x4ca6
movq %r14, %rax
movl 0x30(%rax), %ecx
cmpl 0x30(%r14), %ecx
cmovgeq %rax, %r14
movq 0x38(%rax), %rax
testq %rax, %rax
jne 0x4c92
movq 0x30(%rbx), %rax
movl $0x0, 0x8(%rax)
movq %rbx, %rdi
callq 0x4a67
movq 0x30(%rbx), %rax
movq 0x30(%rax), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x2130
movq 0x30(%rbx), %rax
movq 0x30(%rax), %rdi
leaq 0x2875(%rip), %rsi      # 0x754f
xorl %eax, %eax
callq 0x21f0
movq 0x30(%rbx), %rax
movq 0x30(%rax), %rdi
leaq 0x2878(%rip), %rsi      # 0x7568
xorl %eax, %eax
callq 0x21f0
movq 0x30(%rbx), %rax
movq 0x30(%rax), %rdi
movl (%r14), %esi
shll $0x8, %esi
movl $0xffff, %ebp           # imm = 0xFFFF
andl %ebp, %esi
xorl %edx, %edx
callq 0x2110
movq 0x30(%rbx), %rax
movq 0x30(%rax), %rdi
movq 0x8(%r14), %rdx
leaq 0x2851(%rip), %rsi      # 0x7577
xorl %eax, %eax
callq 0x21f0
movq 0x30(%rbx), %rax
movq 0x30(%rax), %rdi
movl (%r14), %esi
shll $0x8, %esi
andl %ebp, %esi
xorl %edx, %edx
callq 0x2210
movq 0x30(%rbx), %rax
movq 0x30(%rax), %rdi
leaq 0x2829(%rip), %rsi      # 0x757c
xorl %eax, %eax
callq 0x21f0
movq 0x30(%rbx), %rax
movq 0x30(%rax), %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x2080
nop
// File: /workspace/github_c_makefile_star2_O1/Orycterope[P]corewar/src/vm/display_mem.c
// Function: get_update_struct_of
t_d_update	*get_update_struct_of(int i, t_arena *arena)
{
	t_d_update	*u;
	t_d_update	*previous;

	u = arena->display->updates;
	previous = NULL;
	while (u != NULL && u->index != i)
	{
		previous = u;
		u = u->next;
	}
	if (u != NULL)
		return (u);
	u = (t_d_update *)malloc(sizeof(t_d_update));
	if (u == NULL)
		return (NULL);
	ft_bzero(u, sizeof(t_d_update));
	if (previous == NULL)
		arena->display->updates = u;
	else
		previous->next = u;
	u->index = i;
	return (u);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movl %edi, %ebx
movq 0x30(%rsi), %rax
movq (%rax), %rax
testq %rax, %rax
je 0x4d99
movq %rax, %r12
cmpl %ebx, 0x4(%rax)
je 0x4dc6
movq 0x8(%r12), %rax
testq %rax, %rax
jne 0x4d85
jmp 0x4d9c
xorl %r12d, %r12d
movl $0x10, %edi
callq 0x2180
testq %rax, %rax
je 0x4dcb
movq %rax, %r15
movl $0x10, %esi
movq %rax, %rdi
callq 0x5250
testq %r12, %r12
je 0x4dd0
addq $0x8, %r12
jmp 0x4dd4
movq %r12, %r15
jmp 0x4ddc
xorl %r15d, %r15d
jmp 0x4ddc
movq 0x30(%r14), %r12
movq %r15, (%r12)
movl %ebx, 0x4(%r15)
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/Orycterope[P]corewar/src/vm/display_mem.c
// Function: init_mem_display
void		init_mem_display(t_arena *arena)
{
	int	i;

	arena->display->w_bkp = newwin(MEM_SIZE / 64, 64 * 3 + 10, 0, 0);
	arena->display->w_mem = newwin(MEM_SIZE / 64, 64 * 3 + 10, 0, 0);
	arena->display->w_pcs = newwin(MEM_SIZE / 64, 64 * 3 + 10, 0, 0);
	i = -1;
	while (++i < MEM_SIZE)
	{
		if (i % 64 == 0 && i != MEM_SIZE - 1)
		{
			if (i != 0)
				wprintw(arena->display->w_bkp, "\n");
			wprintw(arena->display->w_bkp, "%0#6x : ", i);
		}
		wprintw(arena->display->w_bkp, "%02x ",
				(unsigned char)arena->memory[i]);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %rbx
movl $0x40, %edi
movl $0xca, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x2050
movq 0x30(%rbx), %rcx
movq %rax, 0x28(%rcx)
movl $0x40, %edi
movl $0xca, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x2050
movq 0x30(%rbx), %rcx
movq %rax, 0x18(%rcx)
movl $0x40, %edi
movl $0xca, %esi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x2050
movq 0x30(%rbx), %rcx
movq %rax, 0x20(%rcx)
leaq 0x2204(%rip), %r14      # 0x707b
leaq 0x26e8(%rip), %r15      # 0x7566
leaq 0x21ff(%rip), %r12      # 0x7084
xorl %r13d, %r13d
testb $0x3f, %r13b
jne 0x4eba
testq %r13, %r13
je 0x4ea5
movq 0x30(%rbx), %rax
movq 0x28(%rax), %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x21f0
movq 0x30(%rbx), %rax
movq 0x28(%rax), %rdi
movq %r14, %rsi
movl %r13d, %edx
xorl %eax, %eax
callq 0x21f0
movq (%rbx), %rax
movq 0x30(%rbx), %rcx
movq 0x28(%rcx), %rdi
movzbl (%rax,%r13), %edx
movq %r12, %rsi
xorl %eax, %eax
callq 0x21f0
incq %r13
cmpq $0x1000, %r13           # imm = 0x1000
jne 0x4e88
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/Orycterope[P]corewar/src/vm/display_mem.c
// Function: highlight_pcs
int			highlight_pcs(t_arena *arena)
{
	int			p_nbr;
	t_process	*p;

	p_nbr = 0;
	p = arena->processes;
	werase(arena->display->w_pcs);
	while (p != NULL)
	{
		wattron(arena->display->w_pcs, COLOR_PAIR(p->player) | A_BOLD);
		mvwprintw(arena->display->w_pcs,
				(int)(p->pc - arena->memory) / 64,
				((int)(p->pc - arena->memory) % 64) * 3 + 9,
				"%02x", (unsigned char)*(p->pc));
		wattroff(arena->display->w_pcs, COLOR_PAIR(p->player) | A_BOLD);
		p_nbr++;
		p = p->next;
	}
	return (p_nbr);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x28(%rdi), %r15
movq 0x30(%rdi), %rax
movq 0x20(%rax), %rdi
callq 0x2030
testq %r15, %r15
je 0x4fa0
movl $0xffff, %r12d          # imm = 0xFFFF
movl $0x200000, %r13d        # imm = 0x200000
leaq 0x266d(%rip), %r14      # 0x7592
xorl %ebp, %ebp
movq 0x30(%rbx), %rax
movq 0x20(%rax), %rdi
movl (%r15), %esi
shll $0x8, %esi
andl %r12d, %esi
orl %r13d, %esi
xorl %edx, %edx
callq 0x2110
movq 0x30(%rbx), %rax
movq 0x20(%rax), %rdi
movq 0x48(%r15), %rax
movl (%rbx), %ecx
movzbl (%rax), %r8d
subl %ecx, %eax
leal 0x3f(%rax), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
movl %ecx, %esi
sarl $0x6, %esi
andl $-0x40, %ecx
subl %ecx, %eax
leal (%rax,%rax,2), %edx
addl $0x9, %edx
movq %r14, %rcx
xorl %eax, %eax
callq 0x20d0
movq 0x30(%rbx), %rax
movq 0x20(%rax), %rdi
movl (%r15), %esi
shll $0x8, %esi
andl %r12d, %esi
orl %r13d, %esi
xorl %edx, %edx
callq 0x2210
incl %ebp
movq 0x70(%r15), %r15
testq %r15, %r15
jne 0x4f27
jmp 0x4fa2
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Orycterope[P]corewar/src/vm/display_mem.c
// Function: highlight_rw
void		highlight_rw(t_arena *arena)
{
	t_d_update	*u;
	t_d_update	*next;
	int			pair;

	u = arena->display->updates;
	while (u != NULL)
	{
		next = u->next;
		pair = u->owner * 10 + u->w_turns + MAX_PLAYERS + 1;
		wmove(arena->display->w_bkp, u->index / 64, (u->index % 64) * 3 + 9);
		wattron(arena->display->w_bkp, COLOR_PAIR(pair));
		wprintw(arena->display->w_bkp,
				"%02x", (unsigned char)arena->memory[u->index]);
		wattroff(arena->display->w_bkp, COLOR_PAIR(pair));
		u->w_turns--;
		if (u->w_turns == 0)
			remove_update_struct(u, arena);
		u = next;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x30(%rdi), %rax
movq (%rax), %r15
testq %r15, %r15
je 0x5078
movq %rdi, %rbx
leaq 0x25bd(%rip), %r14      # 0x7592
movq 0x8(%r15), %r12
movl (%r15), %eax
movl 0x4(%r15), %ecx
leal (%rax,%rax,4), %eax
movzbl 0x1(%r15), %edx
leal (%rdx,%rax,2), %ebp
movq 0x30(%rbx), %rax
movq 0x28(%rax), %rdi
leal 0x3f(%rcx), %eax
testl %ecx, %ecx
cmovnsl %ecx, %eax
movl %eax, %esi
sarl $0x6, %esi
andl $-0x40, %eax
subl %eax, %ecx
leal (%rcx,%rcx,2), %edx
addl $0x9, %edx
callq 0x21d0
movq 0x30(%rbx), %rax
movq 0x28(%rax), %rdi
shll $0x8, %ebp
addl $0x500, %ebp            # imm = 0x500
movzwl %bp, %ebp
movl %ebp, %esi
xorl %edx, %edx
callq 0x2110
movq (%rbx), %rax
movq 0x30(%rbx), %rcx
movq 0x28(%rcx), %rdi
movslq 0x4(%r15), %rcx
movzbl (%rax,%rcx), %edx
movq %r14, %rsi
xorl %eax, %eax
callq 0x21f0
movq 0x30(%rbx), %rax
movq 0x28(%rax), %rdi
movl %ebp, %esi
xorl %edx, %edx
callq 0x2210
decb 0x1(%r15)
jne 0x506c
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4deb
movq %r12, %r15
testq %r12, %r12
jne 0x4fd5
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/Orycterope[P]corewar/src/vm/display_color.c
// Function: init_pairs
void		init_pairs(int players)
{
	int		o;
	int		oi;

	o = 0;
	while (++o <= players)
	{
		oi = -1;
		while (++oi < D_WRITE_TURNS + 1)
		{
			init_pair(10 * o + oi + MAX_PLAYERS + 1,
						100 + o * 10 + D_WRITE_TURNS - oi,
						0);
		}
	}
}

// Assembly:
testl %edi, %edi
jle 0x50ed
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %ebx
movl $0x1, %r12d
movl $0x76, %r14d
movw $0xf, %r15w
movl %r15d, %ebp
xorl %r13d, %r13d
leal (%r14,%r13), %eax
movswl %ax, %esi
movswl %bp, %ebp
movl %ebp, %edi
xorl %edx, %edx
callq 0x2170
decl %r13d
incl %ebp
cmpl $-0x9, %r13d
jne 0x50ac
leal 0x1(%r12), %eax
addl $0xa, %r14d
addl $0xa, %r15d
cmpl %ebx, %r12d
movl %eax, %r12d
jne 0x50a6
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Orycterope[P]corewar/src/vm/display_color.c
// Function: init_colors
void		init_colors(t_player *p)
{
	float		i;
	short		r;
	short		g;
	short		b;
	int			c;

	c = 0;
	while (p != NULL)
	{
		color_content(p->id, &r, &g, &b);
		i = 11;
		while (--i > 0)
			init_color(
					100 + p->id * 10 + 9 - i,
					r + (((r + g + b) / 3 - r) + 400) * (i) / 25,
					g + (((r + g + b) / 3 - g) + 800) * (i) / 25,
					b + (((r + g + b) / 3 - b) + 700) * (i) / 25);
		init_pair(p->id, p->id, COLOR_BLACK);
		c++;
		p = p->next;
	}
	init_pairs(c);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x5235
movq %rdi, %r14
xorl %ebx, %ebx
leaq 0x6(%rsp), %r15
leaq 0x4(%rsp), %r12
leaq 0x2(%rsp), %r13
movswl (%r14), %edi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x21c0
movl $0xa, %ebp
xorps %xmm0, %xmm0
cvtsi2ss %ebp, %xmm0
movl (%r14), %eax
leal (%rax,%rax,4), %eax
leal 0x6d(,%rax,2), %eax
xorps %xmm1, %xmm1
cvtsi2ss %eax, %xmm1
subss %xmm0, %xmm1
cvttss2si %xmm1, %eax
movswl 0x6(%rsp), %edi
xorps %xmm1, %xmm1
cvtsi2ss %edi, %xmm1
movswl 0x4(%rsp), %esi
leal (%rsi,%rdi), %edx
movswl 0x2(%rsp), %ecx
addl %ecx, %edx
movslq %edx, %rdx
imulq $0x55555556, %rdx, %rdx # imm = 0x55555556
movq %rdx, %r8
shrq $0x3f, %r8
shrq $0x20, %rdx
addl %r8d, %edx
movl %edx, %r8d
subl %edi, %r8d
addl $0x190, %r8d            # imm = 0x190
xorps %xmm2, %xmm2
cvtsi2ss %r8d, %xmm2
mulss %xmm0, %xmm2
xorps %xmm3, %xmm3
cvtsi2ss %esi, %xmm3
movss 0x23ed(%rip), %xmm4     # 0x7598
divss %xmm4, %xmm2
addss %xmm1, %xmm2
movl %edx, %edi
subl %esi, %edi
addl $0x320, %edi            # imm = 0x320
xorps %xmm1, %xmm1
cvtsi2ss %edi, %xmm1
cvttss2si %xmm2, %esi
mulss %xmm0, %xmm1
divss %xmm4, %xmm1
addss %xmm3, %xmm1
xorps %xmm2, %xmm2
cvtsi2ss %ecx, %xmm2
cvttss2si %xmm1, %edi
subl %ecx, %edx
addl $0x2bc, %edx            # imm = 0x2BC
xorps %xmm1, %xmm1
cvtsi2ss %edx, %xmm1
mulss %xmm0, %xmm1
divss %xmm4, %xmm1
addss %xmm2, %xmm1
cvttss2si %xmm1, %ecx
movswl %si, %esi
movswl %di, %edx
movswl %cx, %ecx
movswl %ax, %edi
callq 0x21a0
decl %ebp
jne 0x512d
movswl (%r14), %edi
movl %edi, %esi
xorl %edx, %edx
callq 0x2170
incl %ebx
movq 0x38(%r14), %r14
testq %r14, %r14
jne 0x5116
jmp 0x5237
xorl %ebx, %ebx
movl %ebx, %edi
callq 0x5084
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/Orycterope[P]corewar/libft/printf/ft_printf_fd.c
// Function: ft_printf_fd
int			ft_printf_fd(int fd, const char *format, ...)
{
	va_list args;
	int		count;
	int		error;

	va_start(args, format);
	error = replace_conversion((char **)&format, args);
	if (error)
		count = -1;
	else
		count = ft_strlen(format);
	ft_putstr_spec_fd((char *)format, fd);
	free((void*)format);
	va_end(args);
	return (count);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movl %edi, %ebx
leaq 0x30(%rsp), %rdi
movq %rdx, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movq %r8, 0x20(%rdi)
movq %r9, 0x28(%rdi)
testb %al, %al
je 0x5636
movaps %xmm0, 0x60(%rsp)
movaps %xmm1, 0x70(%rsp)
movaps %xmm2, 0x80(%rsp)
movaps %xmm3, 0x90(%rsp)
movaps %xmm4, 0xa0(%rsp)
movaps %xmm5, 0xb0(%rsp)
movaps %xmm6, 0xc0(%rsp)
movaps %xmm7, 0xd0(%rsp)
movq %rdi, 0x20(%rsp)
leaq 0x120(%rsp), %rax
movq %rax, 0x18(%rsp)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, 0x10(%rsp)
movq %rsi, %rdi
callq 0x5878
movq %rax, %r14
xorl %eax, %eax
movabsq $0x100000000, %rdx      # imm = 0x100000000
xorl %ecx, %ecx
movzbl (%r14,%rcx), %esi
testl %esi, %esi
je 0x5686
cmpl $0x25, %esi
je 0x5686
incq %rcx
addq %rdx, %rax
jmp 0x5670
movl %ecx, (%rsp)
sarq $0x20, %rax
movb $0x1, %cl
cmpb $0x0, (%r14,%rax)
je 0x5752
movl %ebx, 0x4(%rsp)
movq %r14, %rdi
addq %rax, %rdi
leaq 0x10(%rsp), %r15
movq %rsp, %r12
leaq 0x8(%rsp), %r13
movq %rdi, 0x8(%rsp)
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x5790
testq %rax, %rax
je 0x5743
movq %rax, %rbp
movq %r14, %rdi
movq %rax, %rsi
callq 0x58c4
movq %rax, %rbx
movq %rbp, %rdi
callq 0x2040
movq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x58c4
movq %rax, %rbp
movq %r14, %rdi
callq 0x2040
movq %rbx, %rdi
callq 0x2040
movslq (%rsp), %rax
movq %rax, %rcx
addq %rbp, %rcx
movzbl (%rcx), %edx
testl %edx, %edx
je 0x571f
cmpl $0x25, %edx
je 0x571f
incl %eax
incq %rcx
jmp 0x570c
movl %eax, (%rsp)
cltq
movq %rbp, %rdi
addq %rax, %rdi
cmpb $0x0, (%rbp,%rax)
movq %rbp, %r14
jne 0x56b1
movq %rbp, %r14
movl 0x4(%rsp), %ebx
movb $0x1, %cl
jmp 0x5752
movslq (%rsp), %rax
movb $0x0, (%r14,%rax)
xorl %ecx, %ecx
movl 0x4(%rsp), %ebx
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
testb %cl, %cl
je 0x5767
movq %r14, %rdi
callq 0x585c
movq %rax, %r15
movq %r14, %rdi
movl %ebx, %esi
callq 0x59d0
movq %r14, %rdi
callq 0x2040
movl %r15d, %eax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/simh[P]simtools/converters/cosy/cosy.c
// Function: compressCard
int compressCard(
  FILE *dest
)
{
  int i, spcount = 0, len = strlen(card);

  for (i = 0; i < len; i++) {
    if (!VALID(card[i]))
      return 4;

    if (card[i] != ' ') {
      if (spcount != 0) {
        size_t l = strlen(compr[spcount]);

        if (fwrite(compr[spcount], sizeof(char), l, dest) != l)
          return 3;
        outcount += l;
        spcount = 0;
      }
      if (fputc(card[i], dest) == EOF)
        return 3;
      outcount++;
    } else {
      if (++spcount == MAXSPACES) {
        size_t l = strlen(compr[spcount]);

        if (fwrite(compr[spcount], sizeof(char), l, dest) != l)
          return 3;
        outcount += l;
        spcount = 0;
      }
    }
  }
  /*
   * Terminate the card image.
   */
  fwrite("\x5F\x5E", sizeof(char), 2, dest);
  outcount += 2;
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x305f(%rip), %r12      # 0x42d0
movq %r12, %rdi
callq 0x1070
movq %rax, %r15
testl %r15d, %r15d
jle 0x1383
andl $0x7fffffff, %r15d      # imm = 0x7FFFFFFF
xorl %ebp, %ebp
xorl %r14d, %r14d
movb (%rbp,%r12), %cl
movl $0x4, %eax
cmpb $0x26, %cl
je 0x13ac
leal -0x5f(%rcx), %edx
cmpb $-0x3f, %dl
jb 0x13ac
cmpb $0x20, %cl
jne 0x130d
incl %r14d
cmpl $0x3e, %r14d
jne 0x1377
movq 0x2fd7(%rip), %r13      # 0x42a0
movq %r13, %rdi
callq 0x1070
movq %rax, %r12
movl $0x1, %esi
movq %r13, %rdi
movq %rax, %rdx
movq %rbx, %rcx
callq 0x1110
movl $0x3e, %r14d
cmpq %r12, %rax
jne 0x12fc
addl %r12d, 0x2fcb(%rip)     # 0x42c4
xorl %r14d, %r14d
cmpq %r12, %rax
leaq 0x2fca(%rip), %r12      # 0x42d0
je 0x1377
jmp 0x13a7
testl %r14d, %r14d
je 0x135b
movslq %r14d, %rax
leaq 0x2d94(%rip), %rcx      # 0x40b0
movq (%rcx,%rax,8), %r13
movq %r13, %rdi
callq 0x1070
movq %rax, %r12
movl $0x1, %esi
movq %r13, %rdi
movq %rax, %rdx
movq %rbx, %rcx
callq 0x1110
cmpq %r12, %rax
jne 0x134d
addl %r12d, 0x2f7a(%rip)     # 0x42c4
xorl %r14d, %r14d
cmpq %r12, %rax
leaq 0x2f79(%rip), %r12      # 0x42d0
je 0x135e
jmp 0x13a7
xorl %r14d, %r14d
movsbl (%rbp,%r12), %edi
movq %rbx, %rsi
callq 0x10a0
cmpl $-0x1, %eax
je 0x13a7
incl 0x2f4d(%rip)            # 0x42c4
incq %rbp
cmpq %rbp, %r15
jne 0x1291
leaq 0xd49(%rip), %rdi       # 0x20d3
movl $0x1, %esi
movl $0x2, %edx
movq %rbx, %rcx
callq 0x1110
addl $0x2, 0x2f21(%rip)      # 0x42c4
xorl %eax, %eax
jmp 0x13ac
movl $0x3, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/simh[P]simtools/converters/cosy/cosy.c
// Function: decompressCard
int decompressCard(
  FILE *src
)
{
  int ch, i, spcount;

  idx = 0;

  while ((ch = fgetc(src)) != -1) {
    if (ch == 0)
      continue;

    if (ch == PREFIX) {
      if ((ch = fgetc(src)) == -1)
        break;

      switch (ch) {
        case 0x21: case 0x22: case 0x23: case 0x24: case 0x25:
          spcount = ch - 0x21 + 3;
          goto fill;

        case 0x27: case 0x28: case 0x29: case 0x2A: case 0x2B:
        case 0x2C: case 0x2D: case 0x2E: case 0x2F: case 0x30:
        case 0x31: case 0x32: case 0x33: case 0x34: case 0x35:
        case 0x36: case 0x37: case 0x38: case 0x39: case 0x3A:
        case 0x3B: case 0x3C: case 0x3D: case 0x3E: case 0x3F:
        case 0x40: case 0x41: case 0x42: case 0x43: case 0x44:
        case 0x45: case 0x46: case 0x47: case 0x48: case 0x49:
        case 0x4A: case 0x4B: case 0x4C: case 0x4D: case 0x4E:
        case 0x4F: case 0x50: case 0x51: case 0x52: case 0x53:
        case 0x54: case 0x55: case 0x56: case 0x57: case 0x58:
        case 0x59: case 0x5A: case 0x5B: case 0x5C: case 0x5D:
          spcount = ch - 0x27 + 8;
      fill:
          for (i = 0; i< spcount; i++) {
            if (idx != CARDLEN)
              card[idx++] = ' ';
          }
          break;

        case 0x5E:
          card[idx] = '\0';
          return 0;

        case 0x5F:
          card[idx] = '\0';
          return -2;
      }
    } else {
      if (idx != CARDLEN)
        card[idx++] = ch;
    }
  }
  card[idx] = '\0';
  return -1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x0, 0x2ef4(%rip)      # 0x42c0
leaq 0x2efd(%rip), %r14      # 0x42d0
movq %rbx, %rdi
callq 0x1090
testl %eax, %eax
je 0x13d3
cmpl $0x5f, %eax
je 0x1409
cmpl $-0x1, %eax
je 0x1477
movslq 0x2ecc(%rip), %rcx      # 0x42c0
cmpq $0x50, %rcx
je 0x13d3
leal 0x1(%rcx), %edx
movl %edx, 0x2ebd(%rip)      # 0x42c0
movb %al, (%rcx,%r14)
jmp 0x13d3
movq %rbx, %rdi
callq 0x1090
leal -0x27(%rax), %ecx
cmpl $0x37, %ecx
jae 0x1443
movl $0xffffffe1, %ecx       # imm = 0xFFFFFFE1
addl %ecx, %eax
jle 0x13d3
movl 0x2e98(%rip), %ecx      # 0x42c0
cmpl $0x50, %ecx
je 0x143d
movslq %ecx, %rdx
incl %ecx
movl %ecx, 0x2e88(%rip)      # 0x42c0
movb $0x20, (%rdx,%r14)
decl %eax
jne 0x1428
jmp 0x13d3
cmpl $0x5d, %eax
jg 0x1460
movl $0xffffffe2, %ecx       # imm = 0xFFFFFFE2
leal -0x21(%rax), %edx
cmpl $0x5, %edx
jb 0x141e
cmpl $-0x1, %eax
jne 0x13d3
jmp 0x1477
cmpl $0x5e, %eax
je 0x1475
cmpl $0x5f, %eax
jne 0x13d3
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x1477
xorl %eax, %eax
movslq 0x2e42(%rip), %rcx      # 0x42c0
movb $0x0, (%rcx,%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/simh[P]simtools/converters/cosy/cosy.c
// Function: writeCard
int writeCard(
  FILE *dest
)
{
  /*
   * Remove trailing spaces.
   */
  while (idx && (card[idx - 1] == ' '))
    card[--idx] = '\0';

  if (fprintf(dest, "%s\n", card) < 0)
    return -1;
  return 0;
}

// Assembly:
movslq 0x2e2e(%rip), %rax      # 0x42c0
testq %rax, %rax
je 0x14bd
leal -0x1(%rax), %ecx
leaq 0x2e2f(%rip), %rdx      # 0x42d0
cmpb $0x20, -0x1(%rax,%rdx)
jne 0x14bd
movl %ecx, 0x2e12(%rip)      # 0x42c0
movb $0x0, -0x1(%rax,%rdx)
decq %rax
decl %ecx
testq %rax, %rax
jne 0x14a1
pushq %rax
leaq 0xcdd(%rip), %rsi       # 0x21a2
leaq 0x2e04(%rip), %rdx      # 0x42d0
xorl %eax, %eax
callq 0x10c0
sarl $0x1f, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O1/simh[P]simtools/converters/cosy/cosy.c
// Function: usage
void usage(void)
{
  fprintf(stderr,
          "Usage: cosy [-cd] <cosyfile> [file ...]\n");
  fprintf(stderr,
          "   Compress/decompress a COSY file\n");
  fprintf(stderr, "\nSwitches:\n\n");
  fprintf(stderr, " -c   Perform COSY compression\n");
  fprintf(stderr, " -d   Perform COSY decompression (the default)\n");
  exit(1);
}

// Assembly:
pushq %rbx
movq 0x2b18(%rip), %rbx      # 0x3ff8
movq (%rbx), %rcx
leaq 0xbec(%rip), %rdi       # 0x20d6
movl $0x28, %esi
movl $0x1, %edx
callq 0x1110
movq (%rbx), %rcx
leaq 0xbfc(%rip), %rdi       # 0x20ff
movl $0x23, %esi
movl $0x1, %edx
callq 0x1110
movq (%rbx), %rcx
leaq 0xc07(%rip), %rdi       # 0x2123
movl $0xc, %esi
movl $0x1, %edx
callq 0x1110
movq (%rbx), %rcx
leaq 0xbfb(%rip), %rdi       # 0x2130
movl $0x1f, %esi
movl $0x1, %edx
callq 0x1110
movq (%rbx), %rcx
leaq 0xc02(%rip), %rdi       # 0x2150
movl $0x2f, %esi
movl $0x1, %edx
callq 0x1110
movl $0x1, %edi
callq 0x1100
// File: /workspace/github_c_makefile_star2_O1/simh[P]simtools/converters/cosy/cosy.c
// Function: main
int main(
  int argc,
  char *argv[]
)
{
  int ch;
  FILE *cosy;

  while ((ch = getopt(argc, argv, "cd")) != -1) {
    switch (ch) {
      case 'c':
        compress = 1;
        break;

      case 'd':
        compress = 0;
        break;

      default:
        usage();
    }
  }
  argc -= optind;
  argv += optind;

  if (argc < (compress ? 2 : 1))
    usage();

  /*
   * Open the COSY file.
   */
  if ((cosy = fopen(argv[0], compress ? "w" : "r")) == NULL) {
    fprintf(stderr, "Failed to open COSY file - %s\n", argv[0]);
    return 2;
  }
  argc--, argv++;

  if (compress) {
    return doCompress(cosy, argc, argv);
  }
  return doDecompress(cosy);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movl %edi, %ebx
leaq 0xc08(%rip), %r15       # 0x2180
movl %ebx, %edi
movq %r14, %rsi
movq %r15, %rdx
callq 0x10e0
movl $0x1, %ecx
cmpl $0x63, %eax
je 0x1596
cmpl $0x64, %eax
jne 0x159e
xorl %ecx, %ecx
movl %ecx, 0x2d2c(%rip)      # 0x42c8
jmp 0x1578
cmpl $-0x1, %eax
jne 0x1631
movq 0x2a2a(%rip), %rax      # 0x3fd8
movslq (%rax), %rax
subl %eax, %ebx
cmpl $0x1, 0x2d0e(%rip)      # 0x42c8
movl $0x2, %ecx
sbbl $0x0, %ecx
cmpl %ecx, %ebx
jl 0x1631
leaq (%r14,%rax,8), %r14
movq (%r14), %rdi
cmpl $0x0, 0x2cf4(%rip)      # 0x42c8
leaq 0xbaa(%rip), %rax       # 0x2185
leaq 0xba1(%rip), %rsi       # 0x2183
cmoveq %rax, %rsi
callq 0x10d0
testq %rax, %rax
je 0x161e
cmpl $0x0, 0x2cd1(%rip)      # 0x42c8
je 0x1611
addq $0x8, %r14
decl %ebx
movq %rax, %rdi
movl %ebx, %esi
movq %r14, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x1636
movq %rax, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x1867
movq %r14, %rdi
callq 0x1130
movl $0x2, %eax
popq %rbx
popq %r14
popq %r15
retq
callq 0x14d8
// File: /workspace/github_c_makefile_star2_O1/eridanhq[P]miraclelib/setpwr.c
// Function: main
int main(int argc, char *argv[])
{
	FILE * fp;
	int memfd;
	void *mapped_base;

	int pwr_val;

	pwr_val = atoi(argv[1]);

	memfd = open("/dev/mem", O_RDWR | O_SYNC);
	if (memfd == -1) {
		printf("Can't open /dev/mem.\n");
		exit(0);
	}

	// Map one page of memory into user space such that the device is in that page, but it may not
	// be at the start of the page
	mapped_base = mmap( (void *) MEM0_BASE_ADDRESS, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_FIXED, memfd, SPI_BASE_ADDRESS);
	if (mapped_base == (void *) -1) {
		printf("Can't map the memory to user space.\n");
		exit(0);
	}

	/* ----------- INSERT CODE BELOW THIS LINE ------------ */

	set_pwr_tx(pwr_val, mapped_base);

	/* ----------- INSERT CODE ABOVE THIS LINE ------------ */

	if (munmap(mapped_base, MAP_SIZE) == -1) {
		printf("Can't unmap memory from user space.\n");
		exit(0);
	}
	close(memfd);


	return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq 0x8(%rsi), %rdi
callq 0x1110
movl %eax, %ebp
leaq 0xda2(%rip), %rdi       # 0x2004
movl $0x101002, %esi         # imm = 0x101002
xorl %eax, %eax
callq 0x10f0
cmpl $-0x1, %eax
je 0x12ca
movl %eax, %ebx
movl $0x40000000, %edi       # imm = 0x40000000
movl $0x400000, %esi         # imm = 0x400000
movl $0x64000000, %r9d       # imm = 0x64000000
movl $0x3, %edx
movl $0x11, %ecx
movl %eax, %r8d
callq 0x1080
cmpq $-0x1, %rax
je 0x12d3
movq %rax, %r14
movl %ebp, %edi
movq %rax, %rsi
callq 0x1b33
movl $0x400000, %esi         # imm = 0x400000
movq %r14, %rdi
callq 0x10e0
cmpl $-0x1, %eax
je 0x12dc
movl %ebx, %edi
callq 0x10c0
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0xd84(%rip), %rdi       # 0x2055
jmp 0x12e3
leaq 0xd57(%rip), %rdi       # 0x2031
jmp 0x12e3
leaq 0xd2a(%rip), %rdi       # 0x200d
callq 0x1060
xorl %edi, %edi
callq 0x1130
nop
// File: /workspace/github_c_makefile_star2_O1/begriffs[P]pthread-test/alarm.c
// Function: main
int main(void)
{
	int seconds;
	char line[128], message[64];

	while (printf("Alarm> ") && fgets(line, sizeof(line), stdin))
	{
		if (strlen(line) <= 1)
			continue;
		if (sscanf(line, "%d %64[^\n]", &seconds, message) < 2)
			fputs("Bad command\n", stderr);
		else
		{
			sleep(seconds);
			printf("(%d) %s\n", seconds, message);
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
leaq 0xe40(%rip), %rdi       # 0x2004
xorl %eax, %eax
callq 0x1040
testl %eax, %eax
je 0x1268
movq 0x2dfe(%rip), %rbp      # 0x3fd8
leaq 0x50(%rsp), %rbx
leaq 0xe1e(%rip), %r14       # 0x2004
leaq 0xe1f(%rip), %r15       # 0x200c
leaq 0xc(%rsp), %r12
leaq 0x10(%rsp), %r13
movq (%rbp), %rdx
movq %rbx, %rdi
movl $0x80, %esi
callq 0x1060
testq %rax, %rax
je 0x1268
movq %rbx, %rdi
callq 0x1030
cmpq $0x2, %rax
jb 0x1251
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0x1070
cmpl $0x1, %eax
jle 0x1261
movl 0xc(%rsp), %edi
callq 0x1080
movl 0xc(%rsp), %esi
leaq 0xddd(%rip), %rdi       # 0x2024
movq %r13, %rdx
xorl %eax, %eax
callq 0x1040
movq %r14, %rdi
xorl %eax, %eax
callq 0x1040
testl %eax, %eax
jne 0x11f7
jmp 0x1268
callq 0x10a0
jmp 0x1251
xorl %eax, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/excess-c64[P]lib1541img/src/lib/1541img/util.c
// Function: xmalloc
SOLOCAL void *xmalloc(size_t size)
{
    void *m = malloc(size);
    if (!m)
    {
        logmsg(L_FATAL, "memory allocation failed.");
        abort();
    }
    return m;
}

// Assembly:
pushq %rax
callq 0x44c0
testq %rax, %rax
je 0x4869
popq %rcx
retq
leaq 0x93b2(%rip), %rsi      # 0xdc22
xorl %edi, %edi
callq 0x491c
callq 0x40a0
// File: /workspace/github_c_makefile_star2_O1/excess-c64[P]lib1541img/src/lib/1541img/util.c
// Function: xrealloc
SOLOCAL void *xrealloc(void *ptr, size_t size)
{
    void *m = realloc(ptr, size);
    if (!m)
    {
        logmsg(L_FATAL, "memory allocation failed.");
        abort();
    }
    return m;
}

// Assembly:
pushq %rax
callq 0x4590
testq %rax, %rax
je 0x4889
popq %rcx
retq
leaq 0x9392(%rip), %rsi      # 0xdc22
xorl %edi, %edi
callq 0x491c
callq 0x40a0
// File: /workspace/github_c_makefile_star2_O1/excess-c64[P]lib1541img/src/lib/1541img/util.c
// Function: upperstr
SOLOCAL char *upperstr(const char *src)
{
    if (!src) return 0;
    char *upper = xmalloc(strlen(src) +1);
    const char *r = src;
    char *w = upper;
    while (*r)
    {
	*w++ = toupper(*r++);
    }
    *w = 0;
    return upper;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x4911
movq %rdi, %rbx
callq 0x4250
leaq 0x1(%rax), %rdi
callq 0x485c
movq %rax, %r14
movb (%rbx), %bpl
testb %bpl, %bpl
je 0x490c
callq 0x4050
movq (%rax), %rcx
incq %rbx
movq %r14, %rax
movsbq %bpl, %rdx
movb (%rcx,%rdx,4), %dl
movb %dl, (%rax)
incq %rax
movb (%rbx), %bpl
incq %rbx
testb %bpl, %bpl
jne 0x48f5
movb $0x0, (%rax)
jmp 0x4914
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/excess-c64[P]lib1541img/src/lib/1541img/log.c
// Function: logfmt
SOLOCAL void logfmt(LogLevel level, const char *format, ...)
{
    if (logsilent && level > L_ERROR) return;
    if (level > maxlevel) return;
    char buf[8192];
    va_list ap;
    va_start(ap, format);
    vsnprintf(buf, 8192, format, ap);
    va_end(ap);
    logmsg(level, buf);
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x20d8, %rsp           # imm = 0x20D8
testb %al, %al
je 0x498d
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
movq %rdx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
cmpl $0x0, 0xea40(%rip)      # 0x133e8
setne %al
cmpl $0x2, %edi
setae %cl
testb %al, %cl
jne 0x4a31
movl %edi, %ebx
cmpl %edi, 0xea13(%rip)      # 0x133d0
jb 0x4a31
movq %rsi, %r10
cmpl $0x2, %ebx
setae %bpl
leaq 0x20(%rsp), %rax
movq %rsp, %rcx
movq %rax, 0x10(%rcx)
leaq 0x20f0(%rsp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rcx)
leaq 0xd0(%rsp), %rdi
movl $0x2000, %esi           # imm = 0x2000
movq %r10, %rdx
callq 0x4160
cmpl $0x0, 0xe9de(%rip)      # 0x133e8
setne %al
testb %al, %bpl
jne 0x4a31
cmpl %ebx, 0xe9b8(%rip)      # 0x133d0
jb 0x4a31
movq 0xe9cf(%rip), %rdx      # 0x133f0
leaq 0xd0(%rsp), %rsi
movl %ebx, %edi
callq *0xe9a7(%rip)           # 0x133d8
addq $0x20d8, %rsp           # imm = 0x20D8
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/excess-c64[P]lib1541img/src/lib/1541img/log.c
// Function: writeFile
static void writeFile(LogLevel level, const char *message, void *data)
{
    FILE *target = data;
    fputs(levels[level], target);
    fputs(message, target);
    fputc('\n', target);
    fflush(target);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %eax
leaq 0x8595(%rip), %rcx      # 0xd000
movslq (%rcx,%rax,4), %rdi
addq %rcx, %rdi
movq %rdx, %rsi
callq 0x42e0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x42e0
movl $0xa, %edi
movq %rbx, %rsi
callq 0x43b0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x44d0
// File: /workspace/github_c_makefile_star2_O1/excess-c64[P]lib1541img/src/lib/1541img/sector.c
// Function: Sector_createAt
SOEXPORT Sector *Sector_createAt(uint8_t tracknum, uint8_t sectornum)
{
    Sector *self = Sector_create();
    Sector_setTrackNum(self, tracknum);
    Sector_setSectorNum(self, sectornum);
    return self;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movl %edi, %ebp
movl $0x102, %edi            # imm = 0x102
callq 0x485c
movq %rax, %r14
movl $0x102, %edx            # imm = 0x102
movq %rax, %rdi
xorl %esi, %esi
callq 0x4320
movb %bpl, (%r14)
movb %bl, 0x1(%r14)
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/excess-c64[P]lib1541img/src/lib/1541img/track.c
// Function: Track_create
SOEXPORT Track *Track_create(uint8_t tracknum)
{
    uint8_t sectors = getsectors(tracknum);
    if (!sectors)
    {
        logfmt(L_ERROR, "Track: invalid track number %hhu.", tracknum);
        return 0;
    }
    Track *self = xmalloc(sizeof *self + sectors * sizeof *self->sector);
    for (uint8_t sectornum = 0; sectornum < sectors; ++sectornum)
    {
	self->sector[sectornum] = Sector_createAt(tracknum, sectornum);
    }
    self->tracknum = tracknum;
    self->sectors = sectors;
    return self;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edi, %ebx
leal -0x2b(%rbx), %eax
cmpb $-0x2a, %al
jae 0x4b3d
xorl %eax, %eax
jmp 0x4b52
movb $0x15, %al
cmpb $0x12, %bl
jb 0x4b52
movb $0x13, %al
cmpb $0x19, %bl
jb 0x4b52
xorl %eax, %eax
cmpb $0x1f, %bl
adcb $0x11, %al
testb %al, %al
je 0x4b96
movzbl %al, %r15d
leal (,%r15,8), %eax
addb $0x8, %al
movzbl %al, %edi
callq 0x485c
movq %rax, %r14
xorl %r12d, %r12d
movzbl %bl, %ebp
movzbl %r12b, %esi
movl %ebp, %edi
callq 0x4700
movq %rax, 0x8(%r14,%r12,8)
incq %r12
cmpq %r12, %r15
jne 0x4b75
movb %bl, (%r14)
movb %r15b, 0x1(%r14)
jmp 0x4baf
movzbl %bl, %edx
leaq 0x84a6(%rip), %rsi      # 0xd046
xorl %r14d, %r14d
movl $0x1, %edi
xorl %eax, %eax
callq 0x4949
movq %r14, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/excess-c64[P]lib1541img/src/lib/1541img/track.c
// Function: Track_rsector
SOEXPORT const Sector *Track_rsector(const Track *self, uint8_t sectornum)
{
    if (sectornum >= self->sectors)
    {
        logfmt(L_WARNING, "Track_rsector: invalid sector number %hhu "
		"requested.", sectornum);
        return 0;
    }
    return self->sector[sectornum];
}

// Assembly:
pushq %rbx
cmpb %sil, 0x1(%rdi)
jbe 0x4bcd
movzbl %sil, %eax
movq 0x8(%rdi,%rax,8), %rbx
jmp 0x4be6
movzbl %sil, %edx
leaq 0x8490(%rip), %rsi      # 0xd068
xorl %ebx, %ebx
movl $0x2, %edi
xorl %eax, %eax
callq 0x4949
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/excess-c64[P]lib1541img/src/lib/1541img/track.c
// Function: Track_sector
SOEXPORT Sector *Track_sector(Track *self, uint8_t sectornum)
{
    if (sectornum >= self->sectors)
    {
        logfmt(L_WARNING, "Track_sector: invalid sector number %hhu requested.",
                sectornum);
        return 0;
    }
    return self->sector[sectornum];
}

// Assembly:
pushq %rbx
cmpb %sil, 0x1(%rdi)
jbe 0x4bfd
movzbl %sil, %eax
movq 0x8(%rdi,%rax,8), %rbx
jmp 0x4c16
movzbl %sil, %edx
leaq 0x8495(%rip), %rsi      # 0xd09d
xorl %ebx, %ebx
movl $0x2, %edi
xorl %eax, %eax
callq 0x4949
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/excess-c64[P]lib1541img/src/lib/1541img/track.c
// Function: Track_destroy
SOEXPORT void Track_destroy(Track *self)
{
    if (!self) return;
    for (uint8_t sectornum = 0; sectornum < self->sectors; ++sectornum)
    {
	Sector_destroy(self->sector[sectornum]);
    }
    free(self);
}

// Assembly:
testq %rdi, %rdi
je 0x4c5c
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpb $0x0, 0x1(%rdi)
je 0x4c4d
xorl %r14d, %r14d
movq 0x8(%rbx,%r14,8), %rdi
callq 0x41a0
incq %r14
movzbl 0x1(%rbx), %eax
cmpq %rax, %r14
jb 0x4c37
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x4080
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/excess-c64[P]lib1541img/src/lib/1541img/d64.c
// Function: D64_create
SOEXPORT D64 *D64_create(D64Type type)
{
    if (type < 0 || type > 2)
    {
        logmsg(L_ERROR, "D64: invalid type argument.");
        return 0;
    }
    D64 *self = xmalloc(sizeof *self + tracks[type] * sizeof *self->track);
    for (uint8_t tracknum = 0; tracknum < tracks[type]; ++tracknum)
    {
	self->track[tracknum] = Track_create(tracknum+1);
    }
    self->type = type;
    return self;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x3, %edi
jb 0x4c83
leaq 0x845d(%rip), %rsi      # 0xd0d1
movl $0x1, %edi
callq 0x491c
xorl %r14d, %r14d
jmp 0x4cd8
movl %edi, %ebx
movl %edi, %eax
leaq 0x84c0(%rip), %rcx      # 0xd14e
movzbl (%rax,%rcx), %r15d
leaq 0x8(,%r15,8), %rdi
callq 0x485c
cmpb $0x1, %r15b
adcl $0x0, %r15d
movq %rax, %r14
movzbl %r15b, %r15d
negq %r15
movl $0x1, %r12d
movzbl %r12b, %edi
callq 0x41b0
movq %rax, (%r14,%r12,8)
leaq (%r15,%r12), %rax
incq %rax
incq %r12
cmpq $0x1, %rax
jne 0x4cb8
movl %ebx, (%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/excess-c64[P]lib1541img/src/lib/1541img/d64.c
// Function: D64_rtrack
SOEXPORT const Track *D64_rtrack(const D64 *self, uint8_t tracknum)
{
    if (!tracknum || tracknum > tracks[D64_type(self)])
    {
        logfmt(L_WARNING, "D64_rtrack: invalid track number %hhu requested.",
                tracknum);
        return 0;
    }
    return self->track[tracknum-1];
}

// Assembly:
pushq %rbx
testl %esi, %esi
je 0x4d0b
movl (%rdi), %eax
leaq 0x8449(%rip), %rcx      # 0xd14e
cmpb %sil, (%rax,%rcx)
jae 0x4d26
movzbl %sil, %edx
leaq 0x83d7(%rip), %rsi      # 0xd0ed
xorl %ebx, %ebx
movl $0x2, %edi
xorl %eax, %eax
callq 0x4949
jmp 0x4d31
movzbl %sil, %eax
decl %eax
movq 0x8(%rdi,%rax,8), %rbx
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/excess-c64[P]lib1541img/src/lib/1541img/d64.c
// Function: D64_track
SOEXPORT Track *D64_track(D64 *self, uint8_t tracknum)
{
    if (!tracknum || tracknum > tracks[D64_type(self)])
    {
        logfmt(L_WARNING, "D64_track: invalid track number %hhu requested.",
                tracknum);
        return 0;
    }
    return self->track[tracknum-1];
}

// Assembly:
pushq %rbx
testl %esi, %esi
je 0x4d4a
movl (%rdi), %eax
leaq 0x840a(%rip), %rcx      # 0xd14e
cmpb %sil, (%rax,%rcx)
jae 0x4d65
movzbl %sil, %edx
leaq 0x83c9(%rip), %rsi      # 0xd11e
xorl %ebx, %ebx
movl $0x2, %edi
xorl %eax, %eax
callq 0x4949
jmp 0x4d70
movzbl %sil, %eax
decl %eax
movq 0x8(%rdi,%rax,8), %rbx
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/excess-c64[P]lib1541img/src/lib/1541img/d64.c
// Function: D64_destroy
SOEXPORT void D64_destroy(D64 *self)
{
    if (!self) return;
    for (uint8_t tracknum = 0; tracknum < tracks[D64_type(self)]; ++tracknum)
    {
	Track_destroy(self->track[tracknum]);
    }
    free(self);
}

// Assembly:
testq %rdi, %rdi
je 0x4dec
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
leaq 0x8388(%rip), %r15      # 0xd14e
movq 0x8(%rbx,%r14,8), %rdi
callq 0x45d0
incq %r14
movl (%rbx), %eax
movzbl (%rax,%r15), %eax
cmpq %rax, %r14
jb 0x4dc6
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x4080
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/excess-c64[P]lib1541img/src/lib/1541img/filedata.c
// Function: FileData_create
SOEXPORT FileData *FileData_create(void)
{
    FileData *self = xmalloc(sizeof *self);
    self->content = xmalloc(FD_CHUNKSIZE);
    self->size = 0;
    self->capacity = FD_CHUNKSIZE;
    self->changedEvent = Event_create(0, self);
    return self;
}

// Assembly:
pushq %rbx
movl $0x20, %edi
callq 0x485c
movq %rax, %rbx
movl $0x400, %edi            # imm = 0x400
callq 0x485c
movq %rax, 0x18(%rbx)
movq $0x0, (%rbx)
movq $0x400, 0x8(%rbx)       # imm = 0x400
xorl %edi, %edi
movq %rbx, %rsi
callq 0x4270
movq %rax, 0x10(%rbx)
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/excess-c64[P]lib1541img/src/lib/1541img/filedata.c
// Function: FileData_clone
SOEXPORT FileData *FileData_clone(const FileData *self)
{
    FileData *cloned = xmalloc(sizeof *cloned);
    cloned->size = self->size;
    cloned->capacity = self->capacity;
    cloned->content = xmalloc(self->capacity);
    cloned->changedEvent = Event_create(0, cloned);
    memcpy(cloned->content, self->content, self->size);
    return cloned;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x20, %edi
callq 0x485c
movq %rax, %r14
movq (%rbx), %rax
movq %rax, (%r14)
movq 0x8(%rbx), %rax
movq %rax, 0x8(%r14)
movq 0x8(%rbx), %rdi
callq 0x485c
movq %rax, 0x18(%r14)
xorl %edi, %edi
movq %r14, %rsi
callq 0x4270
movq %rax, 0x10(%r14)
movq 0x18(%r14), %rdi
movq (%rbx), %rdx
movq 0x18(%rbx), %rsi
callq 0x4470
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/excess-c64[P]lib1541img/src/lib/1541img/filedata.c
// Function: FileData_append
SOEXPORT int FileData_append(FileData *self, const uint8_t *data, size_t size)
{
    if (self->size + size < size || self->size + size > FILEDATA_MAXSIZE)
    {
        logmsg(L_ERROR, "FileData_append: maximum size exceeded.");
        return -1;
    }
    while (self->size + size > self->capacity)
    {
        self->capacity += FD_CHUNKSIZE;
        self->content = xrealloc(self->content, self->capacity);
    }
    memcpy(self->content + self->size, data, size);
    self->size += size;
    Event_raise(self->changedEvent, 0);
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq (%rdi), %rax
addq %rdx, %rax
setb %cl
cmpq $0x100001, %rax         # imm = 0x100001
setae %al
orb %cl, %al
je 0x530a
leaq 0x823f(%rip), %rsi      # 0xd538
movl $0x1, %edi
callq 0x491c
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x535c
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq (%r14), %rdi
movq 0x8(%r14), %rsi
leaq (%rdi,%rbx), %rax
cmpq %rsi, %rax
jbe 0x533d
addq $0x400, %rsi            # imm = 0x400
movq %rsi, 0x8(%r14)
movq 0x18(%r14), %rdi
callq 0x487c
movq %rax, 0x18(%r14)
jmp 0x5313
addq 0x18(%r14), %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x4470
addq %rbx, (%r14)
movq 0x10(%r14), %rdi
xorl %ebx, %ebx
xorl %esi, %esi
callq 0x45e0
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/excess-c64[P]lib1541img/src/lib/1541img/filedata.c
// Function: FileData_appendByte
SOEXPORT int FileData_appendByte(FileData *self, uint8_t byte)
{
    if (self->size == FILEDATA_MAXSIZE)
    {
        logmsg(L_ERROR, "FileData_appendByte: maximum size exceeded.");
        return -1;
    }
    if (self->size == self->capacity)
    {
        self->capacity += FD_CHUNKSIZE;
        self->content = xrealloc(self->content, self->capacity);
    }
    self->content[self->size++] = byte;
    Event_raise(self->changedEvent, 0);
    return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq (%rdi), %rax
cmpq $0x100000, %rax         # imm = 0x100000
jne 0x538a
leaq 0x81e7(%rip), %rsi      # 0xd560
movl $0x1, %edi
callq 0x491c
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x53cf
movl %esi, %ebp
movq %rdi, %rbx
movq 0x8(%rdi), %rsi
cmpq %rsi, %rax
jne 0x53b0
addq $0x400, %rsi            # imm = 0x400
movq %rsi, 0x8(%rbx)
movq 0x18(%rbx), %rdi
callq 0x487c
movq %rax, 0x18(%rbx)
movq (%rbx), %rax
movq 0x18(%rbx), %rcx
leaq 0x1(%rax), %rdx
movq %rdx, (%rbx)
movb %bpl, (%rcx,%rax)
movq 0x10(%rbx), %rdi
xorl %ebx, %ebx
xorl %esi, %esi
callq 0x45e0
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/excess-c64[P]lib1541img/src/lib/1541img/filedata.c
// Function: FileData_appendBytes
SOEXPORT int FileData_appendBytes(FileData *self, uint8_t byte, size_t count)
{
    if (self->size + count < count || self->size + count > FILEDATA_MAXSIZE)
    {
        logmsg(L_ERROR, "FileData_appendBytes: maximum size exceeded.");
        return -1;
    }
    while (self->size + count > self->capacity)
    {
        self->capacity += FD_CHUNKSIZE;
        self->content = xrealloc(self->content, self->capacity);
    }
    memset(self->content + self->size, byte, count);
    self->size += count;
    Event_raise(self->changedEvent, 0);
    return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq (%rdi), %rax
addq %rdx, %rax
setb %cl
cmpq $0x100001, %rax         # imm = 0x100001
setae %al
orb %cl, %al
je 0x540a
leaq 0x8193(%rip), %rsi      # 0xd58c
movl $0x1, %edi
callq 0x491c
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x545c
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r14
movq (%r14), %rdi
movq 0x8(%r14), %rsi
leaq (%rdi,%rbx), %rax
cmpq %rsi, %rax
jbe 0x543c
addq $0x400, %rsi            # imm = 0x400
movq %rsi, 0x8(%r14)
movq 0x18(%r14), %rdi
callq 0x487c
movq %rax, 0x18(%r14)
jmp 0x5412
addq 0x18(%r14), %rdi
movzbl %bpl, %esi
movq %rbx, %rdx
callq 0x4320
addq %rbx, (%r14)
movq 0x10(%r14), %rdi
xorl %ebx, %ebx
xorl %esi, %esi
callq 0x45e0
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/excess-c64[P]lib1541img/src/lib/1541img/filedata.c
// Function: FileData_setByte
SOEXPORT int FileData_setByte(FileData *self, uint8_t byte, size_t pos)
{
    if (pos >= self->size)
    {
	logmsg(L_ERROR, "FileData_setByte: invalid position.");
	return -1;
    }
    self->content[pos] = byte;
    return 0;
}

// Assembly:
cmpq %rdx, (%rdi)
jbe 0x5473
movq 0x18(%rdi), %rax
movb %sil, (%rax,%rdx)
xorl %eax, %eax
retq
pushq %rax
leaq 0x813e(%rip), %rsi      # 0xd5b9
movl $0x1, %edi
callq 0x491c
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O1/excess-c64[P]lib1541img/src/lib/1541img/filedata.c
// Function: FileData_destroy
SOEXPORT void FileData_destroy(FileData *self)
{
    if (!self) return;
    Event_destroy(self->changedEvent);
    free(self->content);
    free(self);
}

// Assembly:
testq %rdi, %rdi
je 0x54b8
pushq %rbx
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
callq 0x4170
movq 0x18(%rbx), %rdi
callq 0x4080
movq %rbx, %rdi
popq %rbx
jmp 0x4080
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/excess-c64[P]lib1541img/src/lib/1541img/hostfilereader.c
// Function: readHostFile
SOEXPORT FileData *readHostFile(FILE *file)
{
    uint8_t buf[RBUFSIZE];
    size_t nread;

    FileData *filedata = FileData_create();

    while ((nread = fread(buf, 1, RBUFSIZE, file)))
    {
	if (FileData_append(filedata, buf, nread) < 0)
	{
	    FileData_destroy(filedata);
	    return 0;
	}
    }

    return filedata;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x400, %rsp            # imm = 0x400
movq %rdi, %r14
callq 0x44f0
movq %rax, %rbx
movq %rsp, %r15
movl $0x1, %esi
movl $0x400, %edx            # imm = 0x400
movq %r15, %rdi
movq %r14, %rcx
callq 0x4140
testq %rax, %rax
je 0x550c
movq %rbx, %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x4720
testl %eax, %eax
jns 0x54d6
movq %rbx, %rdi
callq 0x43d0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x400, %rsp            # imm = 0x400
popq %rbx
popq %r14
popq %r15
retq