LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/c-zhou[P]yahs/yahs.c
// Function: default_nr
static int default_nr(char *fai, uint32_t ml)
{
    int i, max_res, nr;
    int64_t genome_size;
    genome_size = 0;
    sdict_t *sdict = make_sdict_from_index(fai, ml);
    for (i = 0; i < sdict->n; ++i)
        genome_size += sdict->s[i].len;
    sd_destroy(sdict);
    
    max_res = 0;
    if (genome_size < 100000000)
        max_res = 1000000;
    else if (genome_size < 200000000)
        max_res = 2000000;
    else if (genome_size < 500000000)
        max_res = 5000000;
    else if (genome_size < 1000000000)
        max_res = 10000000;
    else if (genome_size < 2000000000)
        max_res = 20000000;
    else if (genome_size < 5000000000)
        max_res = 50000000;
    else if (genome_size < 10000000000)
        max_res = 100000000;
    else if (genome_size < 20000000000)
        max_res = 200000000;
    else
        max_res = 500000000;

    nr = 0;
    while (nr < sizeof(default_resolutions) / sizeof(int) && default_resolutions[nr] <= max_res)
        ++nr;

    return nr;
}

// Assembly:
pushq %rbx
callq 0x12d2b
movl (%rax), %edx
testq %rdx, %rdx
je 0x21d7e
movq 0x8(%rax), %rcx
shlq $0x3, %rdx
leaq (%rdx,%rdx,2), %rdx
xorl %esi, %esi
xorl %ebx, %ebx
movl 0x10(%rcx,%rsi), %edi
addq %rdi, %rbx
addq $0x18, %rsi
cmpq %rsi, %rdx
jne 0x21cda
movq %rax, %rdi
callq 0x12233
movl $0xf4240, %ecx          # imm = 0xF4240
cmpq $0x5f5e100, %rbx        # imm = 0x5F5E100
jb 0x21d8b
movl $0x1e8480, %ecx         # imm = 0x1E8480
cmpq $0xbebc200, %rbx        # imm = 0xBEBC200
jb 0x21d8b
movl $0x4c4b40, %ecx         # imm = 0x4C4B40
cmpq $0x1dcd6500, %rbx       # imm = 0x1DCD6500
jb 0x21d8b
movl $0x989680, %ecx         # imm = 0x989680
cmpq $0x3b9aca00, %rbx       # imm = 0x3B9ACA00
jb 0x21d8b
movl $0x1312d00, %ecx        # imm = 0x1312D00
cmpq $0x77359400, %rbx       # imm = 0x77359400
jb 0x21d8b
movq %rbx, %rax
shrq $0x9, %rax
movl $0x2faf080, %ecx        # imm = 0x2FAF080
cmpq $0x9502f9, %rax         # imm = 0x9502F9
jb 0x21d8b
movq %rbx, %rax
shrq $0xa, %rax
movl $0x5f5e100, %ecx        # imm = 0x5F5E100
cmpq $0x9502f9, %rax         # imm = 0x9502F9
jb 0x21d8b
shrq $0xb, %rbx
cmpq $0x9502f9, %rbx         # imm = 0x9502F9
movl $0xbebc200, %eax        # imm = 0xBEBC200
movl $0x1dcd6500, %ecx       # imm = 0x1DCD6500
cmovbl %eax, %ecx
jmp 0x21d8b
movq %rax, %rdi
callq 0x12233
movl $0xf4240, %ecx          # imm = 0xF4240
leaq 0xa83e(%rip), %rdx      # 0x2c5d0
xorl %eax, %eax
cmpl %ecx, (%rdx)
jg 0x21daa
incq %rax
addq $0x4, %rdx
cmpq $0xf, %rax
jne 0x21d94
movl $0xf, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_8/exercise_8_04/syscalls.c
// Function: fill_buffer
int _fill_buffer(FILE *file_p)
{
  int buffer_size;

  if (file_p->flag._READ == 0 || file_p->flag._EOF == 1 || file_p->flag._ERR == 1)
  {
    return EOF;
  }

  buffer_size = (file_p->flag._UNBUF == 1) ? 1 : BUFFER_SIZE;

  if (file_p->base == NULL)
  {
    if ((file_p->base = (char *)malloc(buffer_size)) == NULL)
    {
      return EOF;
    }
  }

  file_p->next_char_pos_p = file_p->base;
  file_p->counter = read(file_p->file_descriptor, file_p->next_char_pos_p, buffer_size);

  if (--file_p->counter < 0)
  {
    if (file_p->counter == -1)
    {
      file_p->flag._EOF = 1;
    }
    else
    {
      file_p->flag._ERR = 1;
    }

    file_p->counter = 0;
    return EOF;
  }

  return (unsigned char)*file_p->next_char_pos_p++;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testb $0x1, 0x18(%rdi)
je 0x121d
movq %rdi, %r14
movq 0x10(%rdi), %rsi
testq %rsi, %rsi
jne 0x11dd
movl $0x400, %edi            # imm = 0x400
callq 0x1080
movq %rax, %rsi
movq %rax, 0x10(%r14)
testq %rax, %rax
je 0x121d
movq %rsi, 0x8(%r14)
movl 0x1c(%r14), %edi
movl $0x400, %edx            # imm = 0x400
callq 0x1070
leal -0x1(%rax), %ecx
movl %ecx, (%r14)
testl %eax, %eax
jle 0x120a
movq 0x8(%r14), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%r14)
movzbl (%rax), %ebx
jmp 0x121d
setne %al
shlb $0x3, %al
addb $0x8, %al
orb %al, 0x18(%r14)
movl $0x0, (%r14)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_8/exercise_8_04/syscalls.c
// Function: flush_buffer
int _flush_buffer(int c, FILE *file_p)
{
  int buffer_size;

  if (file_p->flag._WRITE == 0 || file_p->flag._ERR == 1)
  {
    return EOF;
  }

  buffer_size = (file_p->flag._UNBUF == 1) ? 1 : BUFFER_SIZE;

  if (file_p->base == NULL)
  {
    if ((file_p->base = (char *)malloc(buffer_size)) == NULL)
    {
      return EOF;
    }
  }
  else
  {
    unsigned long nr_of_bytes = file_p->next_char_pos_p - file_p->base;
    if ((write(file_p->file_descriptor, file_p->base, nr_of_bytes)) != nr_of_bytes)
    {
      file_p->flag._ERR = 1;
      return EOF;
    }
  }

  file_p->next_char_pos_p = file_p->base;
  *file_p->next_char_pos_p++ = c;
  file_p->counter = buffer_size - 1;

  return c;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
testb $0x2, 0x18(%rsi)
je 0x1292
movq %rsi, %rbx
movl %edi, %ebp
movq 0x10(%rsi), %rsi
testq %rsi, %rsi
je 0x1265
movq 0x8(%rbx), %r15
subq %rsi, %r15
movl 0x1c(%rbx), %edi
movq %r15, %rdx
callq 0x1040
cmpq %r15, %rax
jne 0x128e
movq 0x10(%rbx), %rax
jmp 0x1278
movl $0x400, %edi            # imm = 0x400
callq 0x1080
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x1292
leaq 0x1(%rax), %rcx
movq %rcx, 0x8(%rbx)
movb %bpl, (%rax)
movl $0x3ff, (%rbx)          # imm = 0x3FF
movl %ebp, %r14d
jmp 0x1292
orb $0x10, 0x18(%rbx)
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_8/exercise_8_04/syscalls.c
// Function: file_flush
int file_flush(FILE *file_p)
{
  if (file_p->flag._WRITE == 0)
  {
    file_p->flag._ERR = 1;
    return EOF;
  }

  if (_flush_buffer('0', file_p) == EOF)
  {
    return EOF;
  }

  file_p->next_char_pos_p = file_p->base;
  file_p->counter = (file_p->flag._UNBUF == 1) ? 1 : BUFFER_SIZE;

  return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movb 0x18(%rdi), %al
testb $0x2, %al
jne 0x12b2
orb $0x10, %al
movb %al, 0x18(%rbx)
jmp 0x12d6
movl $0x30, %edi
movq %rbx, %rsi
callq 0x1227
cmpl $-0x1, %eax
je 0x12d6
movq 0x10(%rbx), %rax
movq %rax, 0x8(%rbx)
movl $0x400, (%rbx)          # imm = 0x400
xorl %eax, %eax
jmp 0x12db
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_8/exercise_8_04/syscalls.c
// Function: file_open
FILE *file_open(char *name, char *mode)
{
  int file_descriptor;
  FILE *file_p;

  if (*mode != 'r' && *mode != 'w' && *mode != 'a')
  {
    return NULL;
  }

  for (file_p = _io_buffer; file_p < _io_buffer + MAX_NR_OF_OPEN_FILES; ++file_p)
  {
    if (file_p->flag._READ == 0 && file_p->flag._WRITE == 0)
    {
      break; // found free slot
    }
  }

  if (file_p >= _io_buffer + MAX_NR_OF_OPEN_FILES)
  {
    return NULL; // no free slots
  }

  if (*mode == 'w')
  {
    file_descriptor = creat(name, PERMISSIONS);
  }
  else if (*mode == 'a')
  {
    if ((file_descriptor = open(name, O_WRONLY, 0)) == -1)
    {
      file_descriptor = creat(name, PERMISSIONS);
    }
    lseek(file_descriptor, 0L, 2);
  }
  else
  {
    file_descriptor = open(name, O_RDONLY, 0);
  }

  if (file_descriptor == -1)
  {
    return NULL; // couldn't access name
  }

  file_p->file_descriptor = file_descriptor;
  file_p->counter = 0;
  file_p->base = NULL;
  file_p->flag._EOF = 0;
  file_p->flag._ERR = 0;
  file_p->flag._READ = (*mode == 'r') ? 1 : 0;
  file_p->flag._WRITE = (*mode == 'r') ? 0 : 1;

  return file_p;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movzbl (%rsi), %eax
xorl %ebx, %ebx
leal -0x61(%rax), %ecx
cmpl $0x16, %ecx
ja 0x13d3
movl $0x420001, %edx         # imm = 0x420001
btl %ecx, %edx
jae 0x13d3
movq %rsi, %r14
movq %rdi, %r15
leaq 0x2d60(%rip), %rbx      # 0x4070
movq $-0x20, %rcx
testb $0x3, 0x18(%rbx)
je 0x1333
addq $0x20, %rbx
addq $0x20, %rcx
cmpq $0x25f, %rcx            # imm = 0x25F
jbe 0x1317
jmp 0x13d1
cmpl $0x61, %eax
je 0x134c
movq %r15, %rdi
cmpl $0x77, %eax
jne 0x1383
movl $0x1b6, %esi            # imm = 0x1B6
callq 0x10a0
jmp 0x138e
movq %r15, %rdi
movl $0x1, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x1090
movl %eax, %ebp
cmpl $-0x1, %eax
jne 0x1373
movq %r15, %rdi
movl $0x1b6, %esi            # imm = 0x1B6
callq 0x10a0
movl %eax, %ebp
movl %ebp, %edi
xorl %esi, %esi
movl $0x2, %edx
callq 0x1050
jmp 0x1390
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x1090
movl %eax, %ebp
cmpl $-0x1, %ebp
je 0x13d1
movl %ebp, 0x1c(%rbx)
movl $0x0, (%rbx)
movq $0x0, 0x10(%rbx)
movb 0x18(%rbx), %al
movl %eax, %ecx
andb $-0x19, %cl
movb %cl, 0x18(%rbx)
cmpb $0x72, (%r14)
sete %cl
andb $-0x1a, %al
orb %cl, %al
movb %al, 0x18(%rbx)
cmpb $0x72, (%r14)
setne %cl
addb %cl, %cl
andb $-0x1b, %al
orb %cl, %al
movb %al, 0x18(%rbx)
jmp 0x13d3
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_8/exercise_8_04/syscalls.c
// Function: main
int main(void)
{
  FILE *file_in_p;
  FILE *file_out_p;

  if ((file_in_p = file_open("syscalls.c", "r")) == NULL)
  {
    write(1, "Error: could not open the file.\n", 33);
    return EXIT_FAILURE;
  }

  if ((file_out_p = file_open("out.txt", "w")) == NULL)
  {
    write(1, "Error: could not open the file.\n", 33);
    return EXIT_FAILURE;
  }

  if (file_seek(file_in_p, 5, SEEK_SET) == -1)
  {
    return EXIT_FAILURE;
  }

  char c;
  while ((c = getc(file_in_p)) != EOF)
  {
    putc(c, file_out_p);
  }
  file_close(file_in_p);
  file_close(file_out_p);

  return EXIT_SUCCESS;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0xbfb(%rip), %rdi       # 0x2020
leaq 0xbff(%rip), %rsi       # 0x202b
callq 0x12dd
testq %rax, %rax
je 0x14c4
movq %rax, %rbx
leaq 0xc0a(%rip), %rdi       # 0x204e
leaq 0xc0b(%rip), %rsi       # 0x2056
callq 0x12dd
testq %rax, %rax
je 0x14c4
movq %rax, %r14
movl 0x1c(%rbx), %edi
movl $0x5, %esi
xorl %edx, %edx
callq 0x1050
movq %rbx, %r12
addq $0x8, %r12
movq %r14, %r15
addq $0x8, %r15
movl (%rbx), %eax
leal -0x1(%rax), %ecx
movl %ecx, (%rbx)
testl %eax, %eax
jle 0x1490
movq (%r12), %rax
leaq 0x1(%rax), %rcx
movq %rcx, (%r12)
movb (%rax), %al
jmp 0x1498
movq %rbx, %rdi
callq 0x11ac
cmpb $-0x1, %al
je 0x14e1
movl (%r14), %ecx
leal -0x1(%rcx), %edx
movl %edx, (%r14)
testl %ecx, %ecx
jle 0x14b7
movq (%r15), %rcx
leaq 0x1(%rcx), %rdx
movq %rdx, (%r15)
movb %al, (%rcx)
jmp 0x1475
movsbl %al, %edi
movq %r14, %rsi
callq 0x1227
jmp 0x1475
leaq 0xb62(%rip), %rsi       # 0x202d
movl $0x1, %ebp
movl $0x21, %edx
movl $0x1, %edi
callq 0x1040
jmp 0x151a
movq 0x10(%rbx), %rdi
callq 0x1030
xorl %ebp, %ebp
movl %ebp, (%rbx)
xorps %xmm0, %xmm0
movups %xmm0, (%r12)
movl 0x1c(%rbx), %edi
callq 0x1060
movq 0x10(%r14), %rdi
callq 0x1030
movl %ebp, (%r14)
xorps %xmm0, %xmm0
movups %xmm0, (%r15)
movl 0x1c(%r14), %edi
callq 0x1060
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/WalterLuong[P]push_swap/srcs/checker/main_checker.c
// Function: checker
void	checker(t_lists *lists, t_list *commands, int ac)
{
	if (ft_read_command(commands) == -1)
		exit_failure(lists, commands);
	use_commands(commands, lists);
	check_sort(ac, lists);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
movq %rsi, %rdi
callq 0x176d
cmpl $-0x1, %eax
jne 0x31dd
movq %r14, %rdi
movq %r15, %rsi
callq 0x1218
movq %r15, %rdi
movq %r14, %rsi
callq 0x1720
movl %ebx, %edi
movq %r14, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x1ac0
// File: /workspace/github_c_makefile_star2_O3/WalterLuong[P]push_swap/srcs/checker/main_checker.c
// Function: main
int		main(int ac, char **av)
{
	int		i;
	t_lists lists;
	t_list	*commands;

	i = 1;
	init_list(&lists);
	commands = ft_lstnew(NULL);
	if (ac < 2)
		exit_success(&lists, commands);
	else
	{
		while (i < ac)
		{
			if (parsing_ac(av[i]) == -1)
				exit_failure(&lists, commands);
			if (check_existant(av, i) == 1)
				exit_failure(&lists, commands);
			if (is_an_int(av[i]) == -1)
				exit_failure(&lists, commands);
			ft_lstadd_back(&lists.list_a, fill_list_a(av[i]));
			i++;
		}
	}
	checker(&lists, commands, ac);
	exit_success(&lists, commands);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r15
movl %edi, %ebx
leaq 0x8(%rsp), %rdi
callq 0x1268
xorl %edi, %edi
callq 0x32d8
movq %rax, %r14
cmpl $0x2, %ebx
jge 0x3232
leaq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x125a
jmp 0x32a8
movl %ebx, %ebp
movl $0x1, %r12d
leaq 0x8(%rsp), %r13
movq (%r15,%r12,8), %rdi
callq 0x12e5
cmpl $-0x1, %eax
jne 0x3258
movq %r13, %rdi
movq %r14, %rsi
callq 0x1218
movq %r15, %rdi
movl %r12d, %esi
callq 0x126f
cmpl $0x1, %eax
jne 0x3273
movq %r13, %rdi
movq %r14, %rsi
callq 0x1218
movq (%r15,%r12,8), %rdi
callq 0x1314
cmpl $-0x1, %eax
jne 0x328c
movq %r13, %rdi
movq %r14, %rsi
callq 0x1218
movq (%r15,%r12,8), %rdi
callq 0x132b
movq %r13, %rdi
movq %rax, %rsi
callq 0x3338
incq %r12
cmpq %r12, %rbp
jne 0x323f
leaq 0x8(%rsp), %r15
movq %r15, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x31b8
movq %r15, %rdi
movq %r14, %rsi
callq 0x125a
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/WalterLuong[P]push_swap/libft/ft_lstlast.c
// Function: ft_lstlast
t_list		*ft_lstlast(t_list *lst)
{
	if (lst)
		while (lst->next)
			lst = lst->next;
	return (lst);
}

// Assembly:
testq %rdi, %rdi
je 0x3332
movq %rdi, %rax
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
jne 0x3325
retq
xorl %eax, %eax
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/WalterLuong[P]push_swap/libft/ft_lstadd_back.c
// Function: ft_lstadd_back
void	ft_lstadd_back(t_list **alst, t_list *new)
{
	t_list		*last;

	if (!new)
		return ;
	if (!*alst)
	{
		*alst = new;
		return ;
	}
	last = ft_lstlast(*alst);
	last->next = new;
}

// Assembly:
testq %rsi, %rsi
je 0x335c
pushq %rbx
movq %rsi, %rbx
movq (%rdi), %rax
testq %rax, %rax
je 0x3358
movq %rax, %rdi
callq 0x3320
movq %rax, %rdi
addq $0x8, %rdi
movq %rbx, (%rdi)
popq %rbx
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/WalterLuong[P]push_swap/libft/ft_strncmp.c
// Function: ft_strncmp
int		ft_strncmp(const char *s1, const char *s2, size_t n)
{
	size_t	i;

	i = 0;
	while ((s1[i] || s2[i]) && i < n)
	{
		if (s1[i] != s2[i])
			return ((unsigned char)s1[i] - (unsigned char)s2[i]);
		i++;
	}
	return (0);
}

// Assembly:
xorl %ecx, %ecx
xorl %eax, %eax
movzbl (%rdi,%rcx), %r8d
testl %r8d, %r8d
je 0x338d
cmpq %rdx, %rcx
jae 0x33ae
movb (%rsi,%rcx), %r9b
jmp 0x339b
cmpq %rdx, %rcx
jae 0x33ad
movb (%rsi,%rcx), %r9b
testb %r9b, %r9b
je 0x33ad
incq %rcx
cmpb %r9b, %r8b
je 0x3378
movzbl %r9b, %eax
subl %eax, %r8d
movl %r8d, %eax
retq
xorl %eax, %eax
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/WalterLuong[P]push_swap/libft/ft_atoi.c
// Function: ft_atoi
long int		ft_atoi(const char *str)
{
	long int		i;
	long int		neg;
	long int		res;

	i = 0;
	res = 0;
	neg = 1;
	while (str[i] == '\t' || str[i] == '\v' || str[i] == '\n'
			|| str[i] == '\f' || str[i] == '\r' || str[i] == ' ')
		i++;
	if (str[i] == '+' || str[i] == '-')
	{
		if (str[i] == '-')
			neg = -neg;
		i++;
	}
	while (str[i] >= '0' && str[i] <= '9')
	{
		res = res * 10 + str[i] - '0';
		i++;
	}
	return (res * neg);
}

// Assembly:
movl $0x1, %eax
movb -0x1(%rdi,%rax), %cl
movzbl %cl, %edx
leal -0x9(%rdx), %esi
cmpl $0x5, %esi
jae 0x33cd
incq %rax
jmp 0x33b9
cmpl $0x20, %edx
je 0x33c8
cmpl $0x2b, %edx
je 0x33dc
cmpl $0x2d, %edx
jne 0x33f1
xorl %edx, %edx
cmpb $0x2d, %cl
setne %dl
leaq -0x1(,%rdx,2), %rdx
movb (%rdi,%rax), %cl
jmp 0x33f9
decq %rax
movl $0x1, %edx
leal -0x30(%rcx), %esi
cmpb $0x9, %sil
ja 0x342a
leaq (%rax,%rdi), %rsi
incq %rsi
xorl %eax, %eax
leaq (%rax,%rax,4), %rax
movzbl %cl, %ecx
leaq (%rcx,%rax,2), %rax
addq $-0x30, %rax
movb (%rsi), %cl
leal -0x30(%rcx), %edi
incq %rsi
cmpb $0xa, %dil
jb 0x340b
jmp 0x342c
xorl %eax, %eax
imulq %rdx, %rax
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/WalterLuong[P]push_swap/libft/ft_strdup.c
// Function: ft_strdup
char	*ft_strdup(const char *s1)
{
	char			*str;
	unsigned int	i;

	i = 0;
	if (!(str = malloc(sizeof(char) * (ft_strlen(s1) + 1))))
		return (NULL);
	while (s1[i])
	{
		str[i] = s1[i];
		i++;
	}
	str[i] = '\0';
	return (str);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x3360
leaq 0x1(%rax), %rdi
callq 0x1090
testq %rax, %rax
je 0x346e
movb (%rbx), %dl
testb %dl, %dl
je 0x3468
movl $0x1, %esi
xorl %ecx, %ecx
movb %dl, (%rax,%rcx)
movl %esi, %ecx
movb (%rbx,%rcx), %dl
incl %esi
testb %dl, %dl
jne 0x3458
jmp 0x346a
xorl %ecx, %ecx
movb $0x0, (%rax,%rcx)
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/WalterLuong[P]push_swap/libft/ft_strcmp.c
// Function: ft_strcmp
int		ft_strcmp(const char *s1, const char *s2)
{
	int		i;

	i = 0;
	while (s1[i] || s2[i])
	{
		if (s1[i] != s2[i])
			return (s1[i] - s2[i]);
		i++;
	}
	return (0);
}

// Assembly:
xorl %eax, %eax
xorl %edx, %edx
movsbl (%rdi,%rdx), %ecx
movb (%rsi,%rdx), %r8b
movl %ecx, %r9d
orb %r8b, %r9b
je 0x3494
incq %rdx
cmpb %r8b, %cl
je 0x3474
movsbl %r8b, %eax
subl %eax, %ecx
movl %ecx, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/qpfiffer[P]lair/src/unit_test.c
// Function: run_program
int _run_program(const char *filename) {
	printf("%c[%dm%s%c[%dm\n", 0x1B, 32, filename, 0x1B, 0);
	char *buf = NULL;
	size_t buf_siz = 0;

	buf = lair_load_file(filename, &buf_siz);
	int rc = lair_execute(buf, buf_siz);
	if (rc != 0) {
		lair_unload_file(buf, buf_siz);
		return 1;
	}

	lair_unload_file(buf, buf_siz);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq 0x2d26(%rip), %rdi      # 0x4004
movl $0x1b, %esi
movl $0x20, %edx
movq %rbx, %rcx
movl $0x1b, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x10a0
leaq 0x8(%rsp), %r14
movq $0x0, (%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3c68
movq %rax, %rbx
movq (%r14), %rsi
movq %rax, %rdi
callq 0x3cff
xorl %ebp, %ebp
testl %eax, %eax
setne %bpl
movq (%r14), %rsi
movq %rbx, %rdi
callq 0x3da6
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/AtifChy[P]st/x.c
// Function: reload
void
reload(int sig)
{
	config_init();

	/* colors, fonts */
	xloadcols();
	xunloadfonts();
	usedfont = (opt_font == NULL)? font : opt_font;
	xloadfonts(usedfont, 0);

	/* pretend the window just got resized */
	cresize(win.w, win.h);

	redraw();

	/* triggers re-render if we're visible. */
	ttywrite("\033[O", 3, 1);

	signal(SIGUSR1, reload);
}

// Assembly:
pushq %rax
callq 0xd546
callq 0xbe87
callq 0xd5a7
movq 0x124db(%rip), %rdi     # 0x1f9c8
testq %rdi, %rdi
jne 0xd4f9
movq 0xb10f(%rip), %rdi      # 0x18608
movq %rdi, 0x124d0(%rip)     # 0x1f9d0
xorps %xmm0, %xmm0
callq 0xd60f
movl 0x1247a(%rip), %edi     # 0x1f988
movl 0x12478(%rip), %esi     # 0x1f98c
callq 0xd8bb
callq 0x9438
leaq 0x4832(%rip), %rdi      # 0x11d57
movl $0x3, %esi
movl $0x1, %edx
callq 0x8003
leaq -0x65(%rip), %rsi       # 0xd4d6
movl $0xa, %edi
popq %rax
jmp 0x6070
// File: /workspace/github_c_makefile_star2_O3/AtifChy[P]st/x.c
// Function: config_init
void
config_init(void)
{
	char *resm;
	XrmDatabase db;
	ResourcePref *p;

	XrmInitialize();
	resm = XResourceManagerString(XOpenDisplay(NULL));
	if (!resm)
		return;

	db = XrmGetStringDatabase(resm);
	for (p = resources; p < resources + LEN(resources); p++)
		resource_load(db, p->name, p->type, p->dst);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
callq 0x65e0
xorl %edi, %edi
callq 0x6310
movq %rax, %rdi
callq 0x6190
testq %rax, %rax
je 0xd5a1
movq %rax, %rdi
callq 0x6760
movq %rax, %rbx
movq $-0x18, %r14
leaq 0xb8e3(%rip), %r15      # 0x18e60
movq 0x18(%r14,%r15), %rsi
movl 0x20(%r14,%r15), %edx
movq 0x28(%r14,%r15), %rcx
movq %rbx, %rdi
callq 0xd398
addq $0x18, %r14
cmpq $0x2d0, %r14            # imm = 0x2D0
jb 0xd57d
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/AtifChy[P]st/x.c
// Function: xunloadfonts
void
xunloadfonts(void)
{
	/* Clear Harfbuzz font cache. */
	hbunloadfonts();

	/* Free the loaded fonts in the font cache.  */
	while (frclen > 0)
		XftFontClose(xw.dpy, frc[--frclen].font);

	xunloadfont(&dc.font);
	xunloadfont(&dc.bfont);
	xunloadfont(&dc.ifont);
	xunloadfont(&dc.ibfont);
}

// Assembly:
pushq %rax
xorl %eax, %eax
callq 0x10948
movl 0x1248b(%rip), %eax     # 0x1fa40
testl %eax, %eax
jle 0xd5de
movq 0x122c0(%rip), %rdi     # 0x1f880
movq 0x12481(%rip), %rcx     # 0x1fa48
decl %eax
movl %eax, 0x12471(%rip)     # 0x1fa40
shlq $0x4, %rax
movq (%rcx,%rax), %rsi
callq 0x60e0
jmp 0xd5af
leaq 0x121b3(%rip), %rdi     # 0x1f798
callq 0xea42
leaq 0x121df(%rip), %rdi     # 0x1f7d0
callq 0xea42
leaq 0x1220b(%rip), %rdi     # 0x1f808
callq 0xea42
leaq 0x12237(%rip), %rdi     # 0x1f840
popq %rax
jmp 0xea42
// File: /workspace/github_c_makefile_star2_O3/AtifChy[P]st/x.c
// Function: cmessage
void
cmessage(XEvent *e)
{
	/*
	 * See xembed specs
	 *  http://standards.freedesktop.org/xembed-spec/xembed-spec-latest.html
	 */
	if (e->xclient.message_type == xw.xembed && e->xclient.format == 32) {
		if (e->xclient.data.l[1] == XEMBED_FOCUS_IN) {
			win.mode |= MODE_FOCUSED;
			xseturgency(0);
		} else if (e->xclient.data.l[1] == XEMBED_FOCUS_OUT) {
			win.mode &= ~MODE_FOCUSED;
		}
	} else if (e->xclient.data.l[0] == xw.wmdeletewin) {
		ttyhangup();
		exit(0);
	} else if (strcmp(XGetAtomName(xw.dpy, e->xclient.message_type), "ReloadColors") == 0) {
		config_init();
		xloadcols();
		cresize(win.w, win.h);
	}
}

// Assembly:
pushq %rax
movq 0x28(%rdi), %rsi
cmpq 0xfe99(%rip), %rsi      # 0x1f8a8
jne 0xfa36
cmpl $0x20, 0x30(%rdi)
jne 0xfa36
movq 0x40(%rdi), %rax
cmpq $0x5, %rax
je 0xfa80
cmpq $0x4, %rax
jne 0xfa62
orb $0x2, 0xff72(%rip)      # 0x1f9a0
xorl %edi, %edi
popq %rax
jmp 0xd33c
movq 0x38(%rdi), %rax
cmpq 0xfe6f(%rip), %rax      # 0x1f8b0
je 0xfa89
movq 0xfe36(%rip), %rdi      # 0x1f880
callq 0x66e0
leaq 0x2b38(%rip), %rsi      # 0x1258e
movq %rax, %rdi
callq 0x6700
testl %eax, %eax
je 0xfa64
popq %rax
retq
callq 0xd546
callq 0xbe87
movl 0xff14(%rip), %edi      # 0x1f988
movl 0xff12(%rip), %esi      # 0x1f98c
popq %rax
jmp 0xd8bb
andb $-0x3, 0xff19(%rip)     # 0x1f9a0
jmp 0xfa62
callq 0x8441
xorl %edi, %edi
callq 0x61a0
// File: /workspace/github_c_makefile_star2_O3/antonblanchard[P]will-it-scale/tests/open1.c
// Function: testcase
void testcase(unsigned long long *iterations, unsigned long nr)
{
	char *tmpfile = tmpfiles[nr];

	while (1) {
		int fd = open(tmpfile, O_RDWR);
		assert(fd >= 0);
		close(fd);

		(*iterations)++;
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq (%rsi,%rsi,2), %r14
shlq $0x3, %r14
addq 0xa3bf(%rip), %r14      # 0xc1a8
movq %r14, %rdi
movl $0x2, %esi
xorl %eax, %eax
callq 0x1220
testl %eax, %eax
js 0x1e08
movl %eax, %edi
callq 0x1160
incq (%rbx)
jmp 0x1de9
leaq 0x4e6(%rip), %rdi       # 0x22f5
leaq 0x494(%rip), %rsi       # 0x22aa
leaq 0x4e0(%rip), %rcx       # 0x22fd
movl $0x27, %edx
callq 0x1130
// File: /workspace/github_c_makefile_star2_O3/dlbeer[P]dhara/tools/gftool.c
// Function: gf_dump
static void gf_dump(const gf_elem_t *tab)
{
	const int tab_size = 1 << gf_degree;
	const int digits = (gf_degree + 3) >> 2;
	const int per_line = 72 / (digits + 5);
	char fmt[16];
	int i;

	snprintf(fmt, sizeof(fmt), "0x%%0%dx,", digits);

	for (i = 0; i < tab_size; i++) {
		if (i % per_line)
			printf(" ");

		printf(fmt, tab[i]);

		if (!((i + 1) % per_line))
			printf("\n");
	}

	if (i % per_line)
		printf("\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movzwl 0x28cb(%rip), %r15d     # 0x40a2
leal 0x3(%r15), %ecx
shrl $0x2, %ecx
leal 0x5(%rcx), %esi
xorl %r14d, %r14d
movw $0x48, %ax
xorl %edx, %edx
divw %si
movl %eax, %ebp
leaq 0x9cd(%rip), %rdx       # 0x21c3
movq %rsp, %rdi
movl $0x10, %esi
xorl %eax, %eax
callq 0x1080
movzwl %bp, %ebp
cmpl $0x1f, %r15d
je 0x186e
movl $0x1, %eax
movl $0x1, %r14d
movl %r15d, %ecx
shll %cl, %r14d
cmpl $0x2, %r14d
cmovll %eax, %r14d
movq %rsp, %r15
xorl %r12d, %r12d
movl %r12d, %eax
xorl %edx, %edx
divl %ebp
testl %edx, %edx
je 0x1842
movl $0x20, %edi
callq 0x1040
movzwl (%rbx,%r12,2), %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1070
incq %r12
movl %r12d, %eax
xorl %edx, %edx
divl %ebp
testl %edx, %edx
jne 0x1869
movl $0xa, %edi
callq 0x1040
cmpq %r12, %r14
jne 0x182d
movl %r14d, %eax
xorl %edx, %edx
divl %ebp
testl %edx, %edx
je 0x188f
movl $0xa, %edi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1040
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/dlbeer[P]dhara/tools/gftool.c
// Function: print_poly
static void print_poly(char var, poly_t p)
{
	int have_term = 0;
	int i;

	printf("0x%lx [0x%lx] -> ", p, reciprocal(p));

	for (i = MAX_DEGREE; i >= 0; i--) {
		if (!((p >> i) & 1))
			continue;

		if (have_term)
			printf(" + ");

		if (!i)
			printf("1");
		else if (i == 1)
			printf("%c", var);
		else
			printf("%c^%d", var, i);

		have_term = 1;
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %edx, %edx
testq %rdi, %rdi
je 0x18c9
movq %rbx, %rcx
movq %rbx, %rax
movl %ecx, %esi
andl $0x1, %esi
leaq (%rsi,%rdx,2), %rdx
shrq %rax
cmpq $0x1, %rcx
movq %rax, %rcx
ja 0x18b4
leaq 0x87b(%rip), %rdi       # 0x214b
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1070
movl $0x3f, %r14d
leaq 0x87a(%rip), %r15       # 0x2161
leaq 0x86f(%rip), %r12       # 0x215d
xorl %eax, %eax
btq %r14, %rbx
jae 0x1939
testl %eax, %eax
je 0x1904
movq %r12, %rdi
xorl %eax, %eax
callq 0x1070
cmpl $0x1, %r14d
je 0x1916
testl %r14d, %r14d
jne 0x1922
movl $0x31, %edi
jmp 0x191b
movl $0x78, %edi
callq 0x1040
jmp 0x1934
movq %r15, %rdi
movl $0x78, %esi
movl %r14d, %edx
xorl %eax, %eax
callq 0x1070
movl $0x1, %eax
addq $-0x1, %r14
jb 0x18f0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/baines[P]MiniGBS/minigbs.c
// Function: cpu_frame
void cpu_frame(void){

	while(regs.sp != h.sp || regs.pc){
		cpu_step();
	}

	debug_separator();

	regs.pc = h.play_addr;
	mem[regs.sp-1] = mem[regs.sp-2] = 0;
	regs.sp -= 2;

	ui_redraw(&h);
}

// Assembly:
pushq %rax
movzwl 0xbc14(%rip), %eax      # 0x113c8
cmpw 0xbc1d(%rip), %ax       # 0x113d8
jne 0x57c7
cmpw $0x0, 0xbc05(%rip)      # 0x113ca
je 0x57ce
callq 0x581c
jmp 0x57ad
callq 0x8311
leaq 0xbbf2(%rip), %rdi      # 0x113cc
movzwl 0xbbf5(%rip), %eax      # 0x113d6
movw %ax, 0xbbe2(%rip)       # 0x113ca
movq 0xbc51(%rip), %rax      # 0x11440
movzwl 0xbbd2(%rip), %ecx      # 0x113c8
xorl %edx, %edx
movb %dl, -0x2(%rax,%rcx)
movq 0xbc3d(%rip), %rax      # 0x11440
movzwl 0xbbbe(%rip), %ecx      # 0x113c8
movb %dl, -0x1(%rax,%rcx)
addw $-0x2, 0xbbb2(%rip)     # 0x113c8
popq %rax
jmp 0xa2dd
// File: /workspace/github_c_makefile_star2_O3/baines[P]MiniGBS/minigbs.c
// Function: mem_write
static inline void mem_write(uint16_t addr, uint8_t val){
	if(addr >= 0x2000 && addr < 0x4000){
		bank_switch(val);
	} else if(addr >= 0xFF10 && addr <= 0xFF40){
		audio_write(addr, val);
	} else if(addr < 0x8000){
		debug_msg("rom write?: [%4x] <- [%2x]", addr, val);
	} else if(addr == 0xFF06 || addr == 0xFF07){
		if(mem[addr] != val){
			mem[addr] = val;
			audio_update_rate();
		}
	} else {
		switch(addr){
			case 0xFF04: debug_msg("DIV write: %2x", val); break;
			case 0xFF05: debug_msg("TIMA write: %2x", val); break;
			case 0xFF0F: debug_msg("IF write: %2x", val); break;
			case 0xFF41: debug_msg("STAT: %2x", val); break;
			case 0xFF46: debug_msg("DMA: %2x", val); break;
			case 0xFFFF: debug_msg("IE: %2x", val); break;
		}
		mem[addr] = val;
	}
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebx
movl %edi, %eax
andl $0xe000, %eax           # imm = 0xE000
cmpl $0x2000, %eax           # imm = 0x2000
jne 0x78c7
movzbl %bl, %ebp
leaq 0x4f17(%rip), %rdi      # 0xc77f
movl %ebp, %esi
xorl %eax, %eax
callq 0x8340
cmpb $0x1f, %bl
ja 0x79b7
cmpb $0x2, %bl
movl $0x1, %eax
cmovael %ebp, %eax
movzbl %al, %eax
leaq 0x9bf1(%rip), %rcx      # 0x11480
movq (%rcx,%rax,8), %rsi
testq %rsi, %rsi
je 0x79b7
movl $0x4000, %eax           # imm = 0x4000
movq 0x9b98(%rip), %rdi      # 0x11440
addq %rax, %rdi
movl $0x4000, %edx           # imm = 0x4000
callq 0x55a0
leaq 0x4ed9(%rip), %rdi      # 0xc795
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x8340
movl %edi, %esi
leal 0xf0(%rsi), %eax
cmpw $0x30, %ax
ja 0x78e4
movzwl %si, %edi
movzbl %bl, %esi
popq %rbx
popq %r14
popq %rbp
jmp 0x981b
testw %si, %si
js 0x78fe
movzbl %bl, %edx
leaq 0x4e29(%rip), %rdi      # 0xc71c
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
jmp 0x8340
movl %esi, %eax
andl $0xfffe, %eax           # imm = 0xFFFE
cmpl $0xff06, %eax           # imm = 0xFF06
jne 0x792b
movq 0x9b2d(%rip), %rax      # 0x11440
movzwl %si, %ecx
cmpb %bl, (%rax,%rcx)
je 0x79b7
movb %bl, (%rax,%rcx)
popq %rbx
popq %r14
popq %rbp
jmp 0x9328
movzwl %si, %r14d
cmpl $0xff40, %r14d          # imm = 0xFF40
jg 0x795c
cmpl $0xff04, %r14d          # imm = 0xFF04
je 0x7980
cmpl $0xff05, %r14d          # imm = 0xFF05
je 0x7992
cmpl $0xff0f, %r14d          # imm = 0xFF0F
jne 0x79ac
leaq 0x4dfc(%rip), %rdi      # 0xc756
jmp 0x79a2
cmpl $0xff41, %r14d          # imm = 0xFF41
je 0x7989
cmpl $0xff46, %r14d          # imm = 0xFF46
je 0x799b
cmpl $0xffff, %r14d          # imm = 0xFFFF
jne 0x79ac
leaq 0x4df9(%rip), %rdi      # 0xc777
jmp 0x79a2
leaq 0x4db0(%rip), %rdi      # 0xc737
jmp 0x79a2
leaq 0x4dd4(%rip), %rdi      # 0xc764
jmp 0x79a2
leaq 0x4dad(%rip), %rdi      # 0xc746
jmp 0x79a2
leaq 0x4dcc(%rip), %rdi      # 0xc76e
movzbl %bl, %esi
xorl %eax, %eax
callq 0x8340
movq 0x9a8d(%rip), %rax      # 0x11440
movb %bl, (%rax,%r14)
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/baines[P]MiniGBS/minigbs.c
// Function: mem_read
static inline uint8_t mem_read(uint16_t addr){
	uint8_t val = mem[addr];

	static uint8_t ortab[] = {
		0x80, 0x3f, 0x00, 0xff, 0xbf,
		0xff, 0x3f, 0x00, 0xff, 0xbf,
		0x7f, 0xff, 0x9f, 0xff, 0xbf,
		0xff, 0xff, 0x00, 0x00, 0xbf,
		0x00, 0x00, 0x70
	};

	if(addr >= 0xFF10 && addr <= 0xFF26){
		val |= ortab[addr - 0xFF10];
	}

	if(cfg.debug_mode){
		switch(addr){
			case 0xFF10 ... 0xFF26: {
				int i = (addr - 0xFF10)/5;
				int j = (addr - 0xFF10)%5;
				debug_msg("Audio read : %4x / NR%1d%1d -> %2x", addr, i+1, j, val);
				break;
			}
			case 0xFF27 ... 0xFF40:
				debug_msg("Audio read : %4x -> %2x", addr, val);
				break;
			case 0xFF04: debug_msg("DIV read: %2x", val); break;
			case 0xFF05: debug_msg("TIMA read: %2x", val); break;
			case 0xFF06: debug_msg("TMA read: %2x", val); break;
			case 0xFF07: debug_msg("TAC read: %2x", val); break;
			case 0xFF0F: debug_msg("IF read: %2x", val); break;
			case 0xFF41: debug_msg("STAT read: %2x", val); break;
			case 0xFF46: debug_msg("DMA read: %2x", val); break;
			case 0xFFFF: debug_msg("IE read: %2x", val); break;
		}
	}

	return val;
}

// Assembly:
pushq %rbx
movl %edi, %esi
movq 0x9a7a(%rip), %rax      # 0x11440
movl %edi, %ecx
movb (%rax,%rcx), %bl
leal 0xf0(%rsi), %eax
cmpw $0x16, %ax
ja 0x79e7
leal -0xff10(%rsi), %eax
leaq 0x47fc(%rip), %rcx      # 0xc1e0
orb (%rax,%rcx), %bl
cmpl $0x0, 0x9a5a(%rip)      # 0x11448
je 0x7ac5
movzwl %si, %ecx
leal -0xff04(%rcx), %eax
cmpl $0x42, %eax
ja 0x7a58
leaq 0x46ab(%rip), %rcx      # 0xc0b4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzbl %bl, %edx
leaq 0x4aa2(%rip), %rdi      # 0xc4be
xorl %eax, %eax
callq 0x8340
jmp 0x7ac5
leal -0x10(%rsi), %eax
movzbl %al, %eax
imull $0xcd, %eax, %edx
shrl $0xa, %edx
leal (%rdx,%rdx,4), %ecx
subb %cl, %al
movzbl %al, %ecx
incb %dl
movzbl %dl, %edx
movzbl %bl, %r8d
leaq 0x4a4c(%rip), %rdi      # 0xc49b
xorl %eax, %eax
callq 0x8340
jmp 0x7ac5
cmpl $0xffff, %ecx           # imm = 0xFFFF
jne 0x7ac5
movzbl %bl, %esi
leaq 0x4acf(%rip), %rdi      # 0xc539
jmp 0x7abe
movzbl %bl, %esi
leaq 0x4aa6(%rip), %rdi      # 0xc51c
jmp 0x7abe
movzbl %bl, %esi
leaq 0x4aa9(%rip), %rdi      # 0xc52b
jmp 0x7abe
movzbl %bl, %esi
leaq 0x4a48(%rip), %rdi      # 0xc4d6
jmp 0x7abe
movzbl %bl, %esi
leaq 0x4a4a(%rip), %rdi      # 0xc4e4
jmp 0x7abe
movzbl %bl, %esi
leaq 0x4a69(%rip), %rdi      # 0xc50f
jmp 0x7abe
movzbl %bl, %esi
leaq 0x4a41(%rip), %rdi      # 0xc4f3
jmp 0x7abe
movzbl %bl, %esi
leaq 0x4a43(%rip), %rdi      # 0xc501
xorl %eax, %eax
callq 0x8340
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/baines[P]MiniGBS/minigbs.c
// Function: config_open
static FILE* config_open(const char* mode){
	const int flags = WRDE_NOCMD | WRDE_UNDEF | WRDE_APPEND;
	wordexp_t w = {};

	wordexp("$XDG_CONFIG_DIR/minigbsrc", &w, flags);
	wordexp("~/.config/minigbsrc"      , &w, flags);

	FILE* config = w.we_wordc > 0 ? fopen(w.we_wordv[0], mode) : NULL;
	wordfree(&w);
	return config;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movq %rsp, %r14
movaps %xmm0, (%r14)
movq $0x0, 0x10(%r14)
leaq 0x4c02(%rip), %rdi      # 0xc6ee
movq %r14, %rsi
movl $0x26, %edx
callq 0x5300
leaq 0x4c08(%rip), %rdi      # 0xc708
movq %r14, %rsi
movl $0x26, %edx
callq 0x5300
cmpq $0x0, (%r14)
je 0x7b28
movq 0x8(%rsp), %rax
movq (%rax), %rdi
movq %rbx, %rsi
callq 0x51d0
movq %rax, %rbx
jmp 0x7b2a
xorl %ebx, %ebx
movq %rsp, %rdi
callq 0x5510
movq %rbx, %rax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/baines[P]MiniGBS/debug.c
// Function: debug_is_jump
static bool debug_is_jump(uint8_t op){
	const char* str = opcodes[op];
	return strncmp(str, "call", 4) == 0
		|| strncmp(str, "jr", 2) == 0
		|| strncmp(str, "jp", 2) == 0
		|| strncmp(str, "rst", 3) == 0
		|| strncmp(str, "ret", 3) == 0;
}

// Assembly:
pushq %rbx
movl %edi, %eax
leaq 0x82fa(%rip), %rcx      # 0x104d0
movq (%rcx,%rax,8), %rbx
leaq 0x4790(%rip), %rsi      # 0xc971
movl $0x4, %edx
movq %rbx, %rdi
callq 0x51b0
movl %eax, %ecx
movb $0x1, %al
testl %ecx, %ecx
je 0x8235
movzbl (%rbx), %ecx
cmpl $0x72, %ecx
je 0x8212
cmpl $0x6a, %ecx
jne 0x8233
cmpb $0x72, 0x1(%rbx)
je 0x8235
movb $0x70, %al
movl $0x1, %ecx
jmp 0x822b
cmpb $0x73, 0x1(%rbx)
jne 0x821e
cmpb $0x74, 0x2(%rbx)
je 0x8235
cmpb $0x65, 0x1(%rbx)
jne 0x8233
movb $0x74, %al
movl $0x2, %ecx
cmpb %al, (%rbx,%rcx)
sete %al
jmp 0x8235
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/baines[P]MiniGBS/debug.c
// Function: debug_print_colour_reg
static void debug_print_colour_reg(uint32_t mask, void* regs, off_t offset){
	int val_colours[2];
	int name_colours[2];

	for(int i = 0; i < 2; ++i){
		uint8_t a = ((uint8_t*)regs)[offset+i];
		uint8_t b = ((uint8_t*)&prev_regs)[offset+i];

		name_colours[i]
			= (mask & reg_by_offset[offset+i].mask)
			? colours[DBG_COLOUR_ACTIVE]
			: colours[DBG_COLOUR_PLAIN]
			;

		val_colours[i]
			= a == b
			? name_colours[i]
			: colours[DBG_COLOUR_CHANGED]
			;
	}

	printf(
		"\e[%dm%s\e[%dm%s\e[0m:\e[%dm%02x\e[%dm%02x\e[0m ",
		name_colours[1],
		reg_by_offset[offset+1].name,
		name_colours[0],
		reg_by_offset[offset].name,
		val_colours[1],
		((uint8_t*)regs)[offset+1],
		val_colours[0],
		((uint8_t*)regs)[offset]
	);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0x14(%rsp), %r10
leaq 0xc(%rsp), %r12
movb $0x1, %al
xorl %ebx, %ebx
leaq 0x9328(%rip), %rcx      # 0x11582
leaq 0x8a6f(%rip), %r8       # 0x10cd0
movl $0x21, %r9d
movl $0x24, %r11d
leaq 0x10(%rsp), %r14
leaq 0x8(%rsp), %r15
addq %rdx, %rbx
movq %rbx, %r13
shlq $0x4, %r13
movl 0x8(%r13,%r8), %ebp
andl %edi, %ebp
cmovnel %r9d, %ebp
movb (%rsi,%rbx), %r13b
cmpb (%rcx,%rbx), %r13b
movl %ebp, (%r12)
cmovnel %r11d, %ebp
movl %ebp, (%r10)
movl $0x1, %ebx
movq %r15, %r12
movq %r14, %r10
testb $0x1, %al
movl $0x0, %eax
jne 0x8277
movl 0x8(%rsp), %eax
leaq 0x1(%rdx), %rcx
shlq $0x4, %rcx
movq (%rcx,%r8), %r10
movl 0xc(%rsp), %ecx
movq %rdx, %rdi
shlq $0x4, %rdi
movq (%rdi,%r8), %r8
movl 0x10(%rsp), %r9d
movzbl 0x1(%rsi,%rdx), %r11d
movl 0x14(%rsp), %ebx
movzbl (%rsi,%rdx), %r14d
subq $0x8, %rsp
leaq 0x46b3(%rip), %rdi      # 0xc9a4
movl %eax, %esi
movq %r10, %rdx
xorl %eax, %eax
pushq %r14
pushq %rbx
pushq %r11
callq 0x5050
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/baines[P]MiniGBS/debug.c
// Function: debug_separator
void debug_separator(void){
	if(!cfg.debug_mode)
		return;

	puts("---------------+-----------------------------------------+----------------+-----");

	// XXX: not obvious that the function will do this...
	prev_op = 0;
	prev_len = 0;
}

// Assembly:
leaq 0x9130(%rip), %rax      # 0x11448
cmpl $0x0, (%rax)
je 0x833f
pushq %rax
leaq 0x458b(%rip), %rdi      # 0xc8b0
callq 0x5120
movb $0x0, 0x924f(%rip)      # 0x11580
movl $0x0, 0x9255(%rip)      # 0x11590
addq $0x8, %rsp
retq
// File: /workspace/github_c_makefile_star2_O3/baines[P]MiniGBS/debug.c
// Function: debug_msg
void debug_msg(const char* fmt, ...){
	if(!cfg.debug_mode)
		return;

	va_list va;
	va_start(va, fmt);

	char msg[39];
	vsnprintf(msg, sizeof(msg), fmt, va);

	if(cfg.debug_mode == 2){
		printf("     \e[0;35m* * *     \e[0m+ \e[0;35m%-39s\e[0m +                +\n", msg);
	} else {
		printf("     * * *     + %-39s +                +\n", msg);
	}

	va_end(va);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0xf8, %rsp
testb %al, %al
je 0x8385
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 %rsi, 0x28(%rsp)
movq %rdx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
leaq 0x90a3(%rip), %r14      # 0x11448
cmpl $0x0, (%r14)
je 0x840b
movq %rdi, %r10
leaq 0x20(%rsp), %rax
movq %rsp, %rcx
movq %rax, 0x10(%rcx)
leaq 0x110(%rsp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rcx)
leaq 0xd0(%rsp), %rbx
movl $0x27, %esi
movq %rbx, %rdi
movq %r10, %rdx
callq 0x53f0
cmpl $0x2, (%r14)
leaq 0x450b(%rip), %rax      # 0xc901
leaq 0x4545(%rip), %rdi      # 0xc942
cmoveq %rax, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0x5050
addq $0xf8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O3/baines[P]MiniGBS/audio.c
// Function: chan_enable
void chan_enable(int i, bool enable){
	chans[i].enabled = enable;

	uint8_t val = (mem[0xFF26] & 0x80)
		| (chans[3].enabled << 3)
		| (chans[2].enabled << 2)
		| (chans[1].enabled << 1)
		| (chans[0].enabled << 0);

	mem[0xFF26] = val;
}

// Assembly:
movslq %edi, %rax
imulq $0x70, %rax, %rax
leaq 0x90d7(%rip), %rcx      # 0x115b0
movb %sil, (%rax,%rcx)
leaq 0x8f5c(%rip), %rax      # 0x11440
movq (%rax), %rax
movb 0xff26(%rax), %cl
andb $-0x80, %cl
movb 0x920a(%rip), %dl       # 0x11700
shlb $0x3, %dl
orb %cl, %dl
movb 0x918f(%rip), %cl       # 0x11690
shlb $0x2, %cl
orb %dl, %cl
movb 0x9114(%rip), %dl       # 0x11620
addb %dl, %dl
orb %cl, %dl
orb 0x909a(%rip), %dl       # 0x115b0
movb %dl, 0xff26(%rax)
retq
// File: /workspace/github_c_makefile_star2_O3/baines[P]MiniGBS/audio.c
// Function: update_env
void update_env(struct chan* c){
	c->env.counter += c->env.inc;

	while(c->env.counter > 1.0f){
		if(c->env.step){
			c->volume += c->env.up ? 1 : -1;
			if(c->volume == 0 || c->volume == 15){
				c->env.inc = 0;
			}
			c->volume = MAX(0, MIN(15, c->volume));
		}
		c->env.counter -= 1.0f;
	}
}

// Assembly:
movss 0x3c(%rdi), %xmm0
addss 0x38(%rdi), %xmm0
ucomiss 0x3b2e(%rip), %xmm0     # 0xc05c
jbe 0x8581
movl 0x30(%rdi), %eax
movss 0x4d59(%rip), %xmm1     # 0xd294
movss 0x3b19(%rip), %xmm2     # 0xc05c
movl $0xf, %ecx
xorl %edx, %edx
testl %eax, %eax
je 0x8578
movzbl 0x34(%rdi), %esi
decl %esi
orl $0x1, %esi
addl 0x4(%rdi), %esi
cmpl $0xf, %esi
je 0x8563
testl %esi, %esi
jne 0x856a
movl $0x0, 0x3c(%rdi)
cmpl $0xf, %esi
cmovgel %ecx, %esi
testl %esi, %esi
cmovlel %edx, %esi
movl %esi, 0x4(%rdi)
addss %xmm1, %xmm0
ucomiss %xmm2, %xmm0
ja 0x854a
movss %xmm0, 0x38(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O3/baines[P]MiniGBS/audio.c
// Function: update_len
void update_len(struct chan* c){
	if(c->len.enabled){
		c->len.counter += c->len.inc;
		if(c->len.counter > 1.0f){
			chan_enable(c - chans, 0);
			c->len.counter = 0.0f;
		}
	}
}

// Assembly:
cmpb $0x1, 0x24(%rdi)
jne 0x8611
movss 0x2c(%rdi), %xmm0
addss 0x28(%rdi), %xmm0
movss %xmm0, 0x28(%rdi)
ucomiss 0x3ab5(%rip), %xmm0     # 0xc05c
jbe 0x8611
leaq 0x9000(%rip), %rax      # 0x115b0
movq %rdi, %rcx
subq %rax, %rcx
shrq $0x4, %rcx
imull $0xb6db6db7, %ecx, %ecx # imm = 0xB6DB6DB7
movslq %ecx, %rcx
imulq $0x70, %rcx, %rcx
movb $0x0, (%rcx,%rax)
leaq 0x8e6e(%rip), %rax      # 0x11440
movq (%rax), %rax
movb 0xff26(%rax), %cl
andb $-0x80, %cl
movb 0x911c(%rip), %dl       # 0x11700
shlb $0x3, %dl
orb %cl, %dl
movb 0x90a1(%rip), %cl       # 0x11690
shlb $0x2, %cl
orb %dl, %cl
movb 0x9026(%rip), %dl       # 0x11620
addb %dl, %dl
orb %cl, %dl
orb 0x8fac(%rip), %dl       # 0x115b0
movb %dl, 0xff26(%rax)
movl $0x0, 0x28(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O3/baines[P]MiniGBS/audio.c
// Function: update_freq
bool update_freq(struct chan* c, float* pos){
	float inc = c->freq_inc - *pos;
	c->freq_counter += inc;

	if(c->freq_counter > 1.0f){
		*pos = c->freq_inc - (c->freq_counter - 1.0f);
		c->freq_counter = 0.0f;
		return true;
	} else {
		*pos = c->freq_inc;
		return false;
	}
}

// Assembly:
movss 0x14(%rdi), %xmm1
movaps %xmm1, %xmm0
subss (%rsi), %xmm0
addss 0x10(%rdi), %xmm0
movss %xmm0, 0x10(%rdi)
ucomiss 0x3a2d(%rip), %xmm0     # 0xc05c
jbe 0x864e
movss 0x4c5b(%rip), %xmm2     # 0xd294
addss %xmm0, %xmm2
subss %xmm2, %xmm1
movss %xmm1, (%rsi)
movl $0x0, 0x10(%rdi)
jmp 0x8652
movss %xmm1, (%rsi)
ucomiss 0x3a03(%rip), %xmm0     # 0xc05c
seta %al
retq
// File: /workspace/github_c_makefile_star2_O3/baines[P]MiniGBS/audio.c
// Function: update_sweep
void update_sweep(struct chan* c){
	c->sweep.counter += c->sweep.inc;

	while(c->sweep.counter > 1.0f){
		if(c->sweep.shift){
			uint16_t inc = (c->sweep.freq >> c->sweep.shift);
			if(!c->sweep.up) inc *= -1;

			c->freq = c->sweep.freq + inc;
			if(c->freq > 2047){
				c->enabled = 0;
			} else {
				set_note_freq(c, 4194304.0f / (float)((2048 - c->freq) << 5));
				c->sweep.freq = c->freq;
				c->freq_inc *= 8.0f;
			}
		} else if(c->sweep.rate){
			c->enabled = 0;
		}
		c->sweep.counter -= 1.0f;
	}
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movss 0x54(%rdi), %xmm0
addss 0x50(%rdi), %xmm0
movss %xmm0, 0x50(%rdi)
ucomiss 0x39e6(%rip), %xmm0     # 0xc05c
jbe 0x876d
movq %rdi, %rbx
movss 0x4c0d(%rip), %xmm1     # 0xd294
movss 0x39cd(%rip), %xmm2     # 0xc05c
movl $0xffffffd0, %ebp       # imm = 0xFFFFFFD0
movl 0x4c(%rbx), %ecx
testl %ecx, %ecx
je 0x8752
movzwl 0x40(%rbx), %edx
movl %edx, %esi
shrl %cl, %esi
movl %esi, %eax
negl %eax
cmpb $0x0, 0x48(%rbx)
cmovnel %esi, %eax
addl %edx, %eax
movw %ax, 0xc(%rbx)
movzwl %ax, %ecx
cmpl $0x800, %ecx            # imm = 0x800
jae 0x8758
movl $0x800, %ecx            # imm = 0x800
subl %eax, %ecx
movzwl %cx, %eax
shll $0x5, %eax
xorps %xmm1, %xmm1
cvtsi2ss %eax, %xmm1
movss 0x4bb5(%rip), %xmm0     # 0xd298
divss %xmm1, %xmm0
movaps %xmm0, %xmm1
divss 0x4b9a(%rip), %xmm1     # 0xd28c
movss %xmm1, 0x14(%rbx)
divss 0x4b91(%rip), %xmm0     # 0xd290
callq 0x51f0
divss 0x8e98(%rip), %xmm0     # 0x115a4
callq 0x50d0
movss 0x3943(%rip), %xmm2     # 0xc05c
movss 0x4b73(%rip), %xmm1     # 0xd294
cvttss2si %xmm0, %eax
cmpl $-0x2f, %eax
cmovll %ebp, %eax
addl $0x30, %eax
movl %eax, 0x1c(%rbx)
movzwl 0xc(%rbx), %eax
movw %ax, 0x40(%rbx)
movss 0x14(%rbx), %xmm0
mulss 0x4b56(%rip), %xmm0     # 0xd29c
movss %xmm0, 0x14(%rbx)
movss 0x50(%rbx), %xmm0
jmp 0x875b
cmpl $0x0, 0x44(%rbx)
je 0x875b
movb $0x0, (%rbx)
addss %xmm1, %xmm0
movss %xmm0, 0x50(%rbx)
ucomiss %xmm2, %xmm0
ja 0x8694
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/baines[P]MiniGBS/audio.c
// Function: audio_reset
void audio_reset(void){
	memset(chans, 0, sizeof(chans));
	memset(samples, 0, nsamples * sizeof(float));
	sample_ptr = samples;
	sample_end = samples + nsamples;
	chans[0].val = chans[1].val = -1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x8626(%rip), %rdi      # 0x115b0
movl $0x1c0, %edx            # imm = 0x1C0
xorl %esi, %esi
callq 0x5080
movq 0x87e3(%rip), %rbx      # 0x11780
movq 0x87cc(%rip), %r14      # 0x11770
leaq (,%r14,4), %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5080
movq %rbx, 0x87d3(%rip)      # 0x11790
leaq (%rbx,%r14,4), %rax
movq %rax, 0x87d0(%rip)      # 0x11798
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %eax, 0x8665(%rip)      # 0x11638
movl %eax, 0x85ef(%rip)      # 0x115c8
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/baines[P]MiniGBS/audio.c
// Function: audio_init
int audio_init(struct pollfd** fds, int nfds){
	pcm_period_size = audio_output_init(fds, &nfds, FREQ);

	logbase = log(1.059463094f);
	charge_factor = pow(0.999958, 4194304.0 / FREQ);

	audio_update_rate();

	return nfds;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
leaq 0xc(%rsp), %rbx
movl %esi, (%rbx)
movss 0x3f94(%rip), %xmm0     # 0xd28c
movq %rbx, %rsi
callq 0x9c04
movw %ax, 0x84a9(%rip)       # 0x117b0
movl $0x3d6c982c, 0x8293(%rip) # imm = 0x3D6C982C
movl $0x3f7f0feb, 0x8285(%rip) # imm = 0x3F7F0FEB
callq 0x9328
movl (%rbx), %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/baines[P]MiniGBS/audio.c
// Function: audio_update_rate
void audio_update_rate(void){
	audio_rate = 59.7f;

	uint8_t tma = mem[0xff06];
	uint8_t tac = mem[0xff07];

	if(tac & 0x04){
		int rates[] = { 4096, 262144, 65536, 16384 };
		audio_rate = rates[tac & 0x03] / (float)(256 - tma);
		if(tac & 0x80) audio_rate *= 2.0f;
	}

	audio_rate *= cfg.speed;

	debug_msg("Audio rate changed: %.4f", audio_rate);

	size_t new_nsamples = (int)(FREQ / audio_rate) * 2;
	float* new_samples = calloc(new_nsamples, sizeof(float));

	if(samples){
		memcpy(new_samples, samples, MIN(nsamples, new_nsamples));
	}

	free(samples);
	samples    = new_samples;
	nsamples   = new_nsamples;

	free(samples_tmp);
	samples_tmp = calloc(nsamples, sizeof(float));

	// TODO: these should really be adjusted more accurately to not lose samples on speed change
	sample_ptr = samples;
	sample_end = samples + nsamples;
}

// Assembly:
leaq 0x8111(%rip), %rax      # 0x11440
movq (%rax), %rcx
movzbl 0xff07(%rcx), %eax
testb $0x4, %al
jne 0x9347
movss 0x3f6b(%rip), %xmm0     # 0xd2b0
jmp 0x9376
movzbl 0xff06(%rcx), %ecx
movl %eax, %edx
andl $0x3, %edx
leaq 0x3fb6(%rip), %rsi      # 0xd310
cvtsi2ssl (%rsi,%rdx,4), %xmm0
movl $0x100, %edx            # imm = 0x100
subl %ecx, %edx
cvtsi2ss %edx, %xmm1
divss %xmm1, %xmm0
testb %al, %al
jns 0x9376
addss %xmm0, %xmm0
pushq %r15
pushq %r14
pushq %rbx
leaq 0x80c6(%rip), %rax      # 0x11448
mulss 0x20(%rax), %xmm0
movss %xmm0, 0x8431(%rip)     # 0x117c0
cvtss2sd %xmm0, %xmm0
leaq 0x403e(%rip), %rdi      # 0xd3d8
movb $0x1, %al
callq 0x8340
movss 0x3ee3(%rip), %xmm0     # 0xd28c
divss 0x840f(%rip), %xmm0     # 0x117c0
cvttss2si %xmm0, %eax
addl %eax, %eax
movslq %eax, %rbx
movl $0x4, %esi
movq %rbx, %rdi
callq 0x5490
movq %rax, %r14
movq 0x83af(%rip), %r15      # 0x11780
testq %r15, %r15
je 0x93ef
movq 0x8393(%rip), %rdx      # 0x11770
cmpq %rbx, %rdx
cmovaeq %rbx, %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0x55a0
movq %r15, %rdi
callq 0x5250
movq %r14, 0x8382(%rip)      # 0x11780
movq %rbx, 0x836b(%rip)      # 0x11770
movq 0x83ac(%rip), %rdi      # 0x117b8
callq 0x5250
movl $0x4, %esi
movq %rbx, %rdi
callq 0x5490
movq %rax, 0x8393(%rip)      # 0x117b8
movq %r14, 0x8364(%rip)      # 0x11790
leaq (%r14,%rbx,4), %rax
movq %rax, 0x8361(%rip)      # 0x11798
popq %rbx
popq %r14
popq %r15
retq