LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/mikecat[P]x86_interpreter/xv6_syscall.c
// Function: initialize_xv6_syscall
int initialize_xv6_syscall(uint32_t work_addr) {
	int i;
	sbrk_origin = work_addr;
	sbrk_addr = work_addr;

	for (i = 0; i < STREAM_MAX; i++) {
		streams[i].stream = NULL;
		streams[i].ref_cnt = 0;
		streams[i].can_read = 0;
		streams[i].can_write = 0;
		streams[i].prev_operation = POP_NONE;
	}
	for (i = 0; i < FD_MAX; i++) {
		fds[i] = NULL;
	}
	/* ref_cnt = 1(from interpreter guest) + 1(from interpreter itself) */
	streams[0].stream = stdin;
	streams[0].ref_cnt = 1 + 1;
	streams[0].can_read = 1;
	streams[0].can_write = 0;
	streams[1].stream = stdout;
	streams[1].ref_cnt = 1 + 1;
	streams[1].can_read = 0;
	streams[1].can_write = 1;
	streams[2].stream = stderr;
	streams[2].ref_cnt = 1 + 1;
	streams[2].can_read = 0;
	streams[2].can_write = 1;
	fds[0] = &streams[0];
	fds[1] = &streams[1];
	fds[2] = &streams[2];
	return 1;
}

// Assembly:
movl %edi, 0xb75e(%rip)      # 0x14da0
movl %edi, 0xb75c(%rip)      # 0x14da4
xorl %eax, %eax
leaq 0xb75f(%rip), %rcx      # 0x14db0
xorps %xmm0, %xmm0
cmpq $0x6000, %rax           # imm = 0x6000
je 0x966c
movups %xmm0, (%rax,%rcx)
andq $0x0, 0x10(%rax,%rcx)
addq $0x18, %rax
jmp 0x9654
xorl %eax, %eax
leaq 0x1173b(%rip), %rdx     # 0x1adb0
cmpq $0x2000, %rax           # imm = 0x2000
je 0x9688
andq $0x0, (%rax,%rdx)
addq $0x8, %rax
jmp 0x9675
movq 0x8949(%rip), %rax      # 0x11fd8
movq (%rax), %rax
movq %rax, 0xb717(%rip)      # 0x14db0
movabsq $0x100000002, %rax      # imm = 0x100000002
movq %rax, 0xb70e(%rip)      # 0x14db8
andl $0x0, 0xb70f(%rip)      # 0x14dc0
movq 0x8918(%rip), %rax      # 0x11fd0
movq (%rax), %rax
movq %rax, 0xb706(%rip)      # 0x14dc8
leaq 0xb6ff(%rip), %rdx      # 0x14dc8
pushq $0x2
popq %rsi
movq %rsi, 0xb6fd(%rip)      # 0x14dd0
pushq $0x1
popq %rax
movl %eax, 0xb6fc(%rip)      # 0x14dd8
movq 0x8915(%rip), %rdi      # 0x11ff8
movq (%rdi), %rdi
movq %rdi, 0xb6f3(%rip)      # 0x14de0
leaq 0xb6ec(%rip), %rdi      # 0x14de0
movq %rsi, 0xb6ed(%rip)      # 0x14de8
movl %eax, 0xb6ef(%rip)      # 0x14df0
movq %rcx, 0x116a8(%rip)     # 0x1adb0
movq %rdx, 0x116a9(%rip)     # 0x1adb8
movq %rdi, 0x116aa(%rip)     # 0x1adc0
retq
// File: /workspace/github_c_makefile_star2_O2/mikecat[P]x86_interpreter/pe_import.c
// Function: pe_import
int pe_import(uint32_t* eip, uint32_t regs[]) {
	uint32_t i;
	const imported_lib_info* called_lib = NULL;
	const func_info* called_func = NULL;
	uint32_t stack_remove_size;
	for (i = 0; i < imported_lib_count; i++) {
		if (imported_libs[i].iat_addr <= *eip && *eip - imported_libs[i].iat_addr < imported_libs[i].iat_size) {
			uint32_t offset = *eip - imported_libs[i].iat_addr;
			called_lib = &imported_libs[i];
			if (offset % 4 == 0) {
				called_func = &imported_libs[i].funcs[offset / 4];
			}
			break;
		}
	}
	if (called_lib == NULL) {
		fprintf(stderr, "library not found for EIP %08"PRIx32"\n", *eip);
		return -1;
	}
	stack_remove_size = pe_lib_exec(regs, called_lib->name,
		called_func->is_ord ? NULL : called_func->name,
		called_func->is_ord ? called_func->hint_or_ord : 0);
	if (stack_remove_size == PE_LIB_EXEC_FAILED) return -1;
	if (stack_remove_size == PE_LIB_EXEC_EXIT) return 0;
	/* ret */
	dmemory_read(eip, regs[ESP], 4);
	regs[ESP] += 4 + stack_remove_size;
	return 1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl 0x12c9c(%rip), %ecx     # 0x1cdb8
movq 0x12c8d(%rip), %rax     # 0x1cdb0
imulq $0x28, %rcx, %rdx
xorl %ecx, %ecx
cmpq %rcx, %rdx
je 0xa1a8
movl (%r14), %edi
subl 0x4(%rax,%rcx), %edi
jb 0xa13d
cmpl 0x8(%rax,%rcx), %edi
jb 0xa143
addq $0x28, %rcx
jmp 0xa129
movq 0x10(%rax,%rcx), %rsi
movq 0x18(%rax,%rcx), %rcx
shrl $0x2, %edi
imulq $0x18, %rdi, %rdx
leaq (%rcx,%rdx), %rax
cmpl $0x0, (%rcx,%rdx)
je 0xa166
movzwl 0x10(%rax), %eax
xorl %edx, %edx
jmp 0xa16c
movq 0x8(%rax), %rdx
xorl %eax, %eax
movzwl %ax, %ecx
movq %rbx, %rdi
callq 0xa470
movl %eax, %r15d
cmpl $-0x1, %eax
je 0xa1c7
cmpl $-0x2, %r15d
jne 0xa18a
xorl %r15d, %r15d
jmp 0xa1c7
movl 0x10(%rbx), %esi
pushq $0x4
popq %rdx
movq %r14, %rdi
callq 0x5bd0
movl 0x10(%rbx), %eax
addl %r15d, %eax
addl $0x4, %eax
movl %eax, 0x10(%rbx)
pushq $0x1
jmp 0xa1c5
movq 0x7e49(%rip), %rax      # 0x11ff8
movq (%rax), %rdi
movl (%r14), %edx
leaq 0x3282(%rip), %rsi      # 0xd43e
xorl %eax, %eax
callq 0x10d0
pushq $-0x1
popq %r15
movl %r15d, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/mikecat[P]x86_interpreter/pe_libs.c
// Function: strcmp_ncs
static int strcmp_ncs(const char* a, const char* b) {
	for (;;) {
		int ac = tolower((unsigned char)*a);
		int bc = tolower((unsigned char)*b);
		if (ac != bc) return ac > bc ? 1 : -1;
		if (ac == 0) return 0;
		a++;
		b++;
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x11a0
movq (%rax), %rax
xorl %ecx, %ecx
movzbl (%r14,%rcx), %edx
movl (%rax,%rdx,4), %edx
movzbl (%rbx,%rcx), %esi
cmpl (%rax,%rsi,4), %edx
jne 0xa3c7
testl %edx, %edx
je 0xa3d6
incq %rcx
jmp 0xa3ad
setg %al
movzbl %al, %eax
leal -0x1(,%rax,2), %eax
jmp 0xa3d8
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/mikecat[P]x86_interpreter/pe_libs.c
// Function: get_buffer_address
uint32_t get_buffer_address(int lib_id, const char* identifier, uint32_t default_addr) {
	if (identifier == NULL) return default_addr;
	switch (lib_id) {
	case LIB_ID_MSVCRT:
		if (strcmp(identifier, "_iob") == 0) {
			return WORK_IOB;
		} else if (strcmp(identifier, "_daylight") == 0) {
			return WORK_DAYLIGHT;
		} else if (strcmp(identifier, "_timezone") == 0) {
			return WORK_TIMEZONE;
		} else if (strcmp(identifier, "_tzname") == 0) {
			return WORK_TZNAME;
		}
		break;
	}
	return default_addr;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
testq %rsi, %rsi
sete %al
cmpl $0x1, %edi
setne %cl
orb %al, %cl
jne 0xa466
movq %rsi, %r14
leaq 0x3086(%rip), %rsi      # 0xd486
movq %r14, %rdi
callq 0x10c0
testl %eax, %eax
je 0xa45b
leaq 0x3078(%rip), %rsi      # 0xd48b
movq %r14, %rdi
callq 0x10c0
testl %eax, %eax
je 0xa450
leaq 0x306f(%rip), %rsi      # 0xd495
movq %r14, %rdi
callq 0x10c0
testl %eax, %eax
je 0xa450
leaq 0x3066(%rip), %rsi      # 0xd49f
movq %r14, %rdi
callq 0x10c0
testl %eax, %eax
jne 0xa466
movl 0x12971(%rip), %ebx     # 0x1cdbc
addl $0x1c, %ebx
jmp 0xa466
movl 0x12966(%rip), %ebx     # 0x1cdbc
addl $0x18, %ebx
jmp 0xa466
movl $0x1000, %ebx           # imm = 0x1000
addl 0x12956(%rip), %ebx     # 0x1cdbc
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_3/exercise_3_01/binsearch.c
// Function: main
int main(void)
{
  int v[MAXLEN];

  initVector(v, MAXLEN);
  // printVector(v, MAXLEN);

  int x = -1;

  // Test binsearch_kr()
  test_binsearch(binsearch_kr, x, v, MAXLEN);

  // Test binsearch()
  test_binsearch(binsearch, x, v, MAXLEN);

  return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x9c48, %rsp           # imm = 0x9C48
movq %rsp, %rbx
movq %rbx, %rdi
movl $0x2710, %esi           # imm = 0x2710
callq 0x11a0
leaq 0xbf(%rip), %rdi        # 0x122b
pushq $-0x1
popq %rbp
movl %ebp, %esi
movq %rbx, %rdx
movl $0x2710, %ecx           # imm = 0x2710
callq 0x11b5
leaq 0xd4(%rip), %rdi        # 0x1259
movl %ebp, %esi
movq %rbx, %rdx
movl $0x2710, %ecx           # imm = 0x2710
callq 0x11b5
xorl %eax, %eax
addq $0x9c48, %rsp           # imm = 0x9C48
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_3/exercise_3_01/binsearch.c
// Function: test_binsearch
void test_binsearch(int binsearch(int x, int v[], int n), int x, int v[], int n)
{
  static int test_nr = 0;
  long clocks = clock();

  int i;
  for (i = 0; i < ITERATIONS; ++i)
  {
    binsearch(x, v, n);
  }

  clocks = clock() - clocks;

  printf("test_%d: %lu clocks (%.4f seconds)\n", test_nr, clocks, (double)clocks / CLOCKS_PER_SEC);

  ++test_nr;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %r12
movl $0x186a0, %r13d         # imm = 0x186A0
callq 0x1030
movq %rax, %r15
subl $0x1, %r13d
jb 0x11ea
movl %ebp, %edi
movq %r14, %rsi
movl %ebx, %edx
callq *%r12
jmp 0x11d8
callq 0x1030
subq %r15, %rax
movl 0x2e44(%rip), %esi      # 0x403c
cvtsi2sd %rax, %xmm0
divsd 0xe03(%rip), %xmm0      # 0x2008
leaq 0xe12(%rip), %rdi       # 0x201e
movq %rax, %rdx
movb $0x1, %al
callq 0x1040
incl 0x2e20(%rip)            # 0x403c
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_3/exercise_3_01/binsearch.c
// Function: printVector
void printVector(int v[], int n)
{
  int i;

  printf("[ ");
  for (i = 0; i < n; ++i)
  {
    (i != n - 1) ? printf("%d, ", v[i]) : printf("%d ]\n", v[i]);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
leaq 0xd72(%rip), %rdi       # 0x2010
xorl %r12d, %r12d
xorl %eax, %eax
callq 0x1040
leal -0x1(%rbx), %r15d
testl %ebx, %ebx
cmovlel %r12d, %ebx
leaq 0xd5f(%rip), %r12       # 0x2018
leaq 0xd53(%rip), %r13       # 0x2013
xorl %ebp, %ebp
cmpq %rbp, %rbx
je 0x12e1
cmpq %rbp, %r15
movq %r13, %rdi
cmoveq %r12, %rdi
movl (%r14,%rbp,4), %esi
xorl %eax, %eax
callq 0x1040
incq %rbp
jmp 0x12c2
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/neovim[P]libtermkey/demo-async.c
// Function: main
int main(int argc, char *argv[])
{
  TERMKEY_CHECK_VERSION;

  TermKey *tk = termkey_new(0, 0);

  if(!tk) {
    fprintf(stderr, "Cannot allocate termkey instance\n");
    exit(1);
  }

  struct pollfd fd;

  fd.fd = 0; /* the file descriptor we passed to termkey_new() */
  fd.events = POLLIN;

  TermKeyResult ret;
  TermKeyKey key;

  int running = 1;
  int nextwait = -1;

  while(running) {
    if(poll(&fd, 1, nextwait) == 0) {
      // Timed out
      if(termkey_getkey_force(tk, &key) == TERMKEY_RES_KEY)
        on_key(tk, &key);
    }

    if(fd.revents & (POLLIN|POLLHUP|POLLERR))
      termkey_advisereadable(tk);

    while((ret = termkey_getkey(tk, &key)) == TERMKEY_RES_KEY) {
      on_key(tk, &key);

      if(key.type == TERMKEY_TYPE_UNICODE &&
         key.modifiers & TERMKEY_KEYMOD_CTRL &&
         (key.code.codepoint == 'C' || key.code.codepoint == 'c'))
        running = 0;
    }

    if(ret == TERMKEY_RES_AGAIN)
      nextwait = termkey_get_waittime(tk);
    else
      nextwait = -1;
  }

  termkey_destroy(tk);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
pushq $0x17
popq %rsi
xorl %edi, %edi
callq 0x10b0
xorl %edi, %edi
xorl %esi, %esi
callq 0x10a0
testq %rax, %rax
je 0x12f3
movq %rax, %rbx
movq %rsp, %r14
andl $0x0, (%r14)
movw $0x1, 0x4(%r14)
pushq $-0x1
popq %rdx
pushq $0x1
popq %r13
pushq $0x1
popq %r15
leaq 0x8(%rsp), %r12
movl %r13d, %ebp
testl %ebp, %ebp
je 0x12da
movq %r14, %rdi
movq %r15, %rsi
callq 0x1090
testl %eax, %eax
jne 0x126c
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1030
cmpl $0x1, %eax
jne 0x126c
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1317
testb $0x19, 0x6(%rsp)
je 0x127b
movq %rbx, %rdi
callq 0x10e0
movl %r13d, %ebp
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1060
cmpl $0x1, %eax
jne 0x12be
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1317
cmpl $0x0, 0x8(%rsp)
jne 0x127e
testb $0x4, 0x18(%rsp)
je 0x127e
movq 0x10(%rsp), %rax
andq $-0x21, %rax
cmpq $0x43, %rax
movl $0x0, %eax
cmovel %eax, %ebp
jmp 0x127e
cmpl $0x3, %eax
jne 0x12d2
movq %rbx, %rdi
callq 0x1050
movl %eax, %edx
jmp 0x123a
pushq $-0x1
popq %rdx
jmp 0x123a
movq %rbx, %rdi
callq 0x1080
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2cfe(%rip), %rax      # 0x3ff8
movq (%rax), %rcx
leaq 0xd00(%rip), %rdi       # 0x2004
pushq $0x21
popq %rsi
pushq $0x1
popq %rdx
callq 0x10d0
pushq $0x1
popq %rdi
callq 0x10c0
// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/crypto_aead/aes128poetv1aes128/ref/poet.c
// Function: encrypt_block
void encrypt_block(struct poet_ctx *ctx, const uint8_t plaintext[16],
		   uint8_t ciphertext[16])
{
  block tmp;
  TOP_HASH;
  xor_block(ctx->x, plaintext,ctx->x);
  
  AES_encrypt(ctx->x, tmp, &(ctx->aes_enc)); // in, out, key

  BOTTOM_HASH;
  xor_block(ciphertext, tmp,ctx->y); // result, a, b

  memcpy(ctx->y, tmp, BLOCKLEN);
  ctx->mlen+=BLOCKLEN_BITS;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x420(%rdi), %r12
leaq 0x1e8(%rdi), %rdx
movq %r12, %rdi
movq %r12, %rsi
callq 0x1050
movq %r12, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x10f0
movq %rsp, %r15
movq %r12, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x1050
leaq 0x430(%rbx), %r12
leaq 0x2dc(%rbx), %rdx
movq %r12, %rdi
movq %r12, %rsi
callq 0x1050
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x10f0
vmovaps (%r15), %xmm0
vmovups %xmm0, 0x430(%rbx)
subq $-0x80, 0x450(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/wtakuo[P]SVM/test1.c
// Function: vmtest
void vmtest (int n, vm_mode_t mode) {
    int codelen = sizeof(code)/sizeof(Bcode);
    Function f = new_function(1, 1, code + 10, codelen - 10);
    gv[0] = (Value)n;
    gv[1] = (Value)f;

    vm(code, codelen, vs_base, VS_SIZE, gv, GV_SIZE, mode);

    delete_function(f);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebx
movl %edi, %ebp
leaq 0x286f(%rip), %rdx      # 0x407a
pushq $0x1
popq %rdi
pushq $0x1d
popq %rcx
movq %rdi, %rsi
callq 0x1578
movq %rax, %r14
leaq 0x284d(%rip), %rdi      # 0x4070
movslq %ebp, %rax
movq %rax, 0x2883(%rip)      # 0x40b0
leaq 0x287c(%rip), %r8       # 0x40b0
movq %r14, 0x287d(%rip)      # 0x40b8
movl %ebx, (%rsp)
leaq 0x30ab(%rip), %rdx      # 0x48f0
pushq $0x27
popq %rsi
pushq $0x8
popq %r9
movl $0x100, %ecx            # imm = 0x100
callq 0x11bc
movq %r14, %rdi
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x15c8
// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/src/util.c
// Function: hex_dump
void hex_dump(void *p, int len)
{
    int i, j;
    uint8_t t;

    for (i = 0; i < len; i += 16) {
        printf("[%08X] ", i);
        for (j = 0; j < 16; j++) {
            if (j == 8)
                putchar(' ');
            if (i + j < len)
                printf(" %02X", ((uint8_t *) p)[i + j]);
            else
                printf("   ");
        }
        printf("  |");

        for (j = 0; j < 16; j++) {
            if (i + j >= len)
                break;
            t = ((uint8_t *) p)[i + j];
            if (t >= 0x20 && t < 0x7F)
                putchar(t);
            else
                putchar('.');
        }
        printf("|\n");
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movslq %esi, %rax
movq %rax, (%rsp)
pushq $0x2e
popq %rbp
xorl %r15d, %r15d
movl %esi, %r12d
cmpq (%rsp), %r15
jge 0x1a81
movl %r12d, %r12d
leaq 0x1ac2(%rip), %rdi      # 0x349c
movl %r15d, %esi
xorl %eax, %eax
callq 0x10b0
xorl %r13d, %r13d
cmpq $0x8, %r13
je 0x19f5
cmpq $0x10, %r13
jne 0x19fd
jmp 0x1a2d
pushq $0x20
popq %rdi
callq 0x1050
leal (%r15,%r13), %eax
cmpl %ebx, %eax
jge 0x1a1a
movzbl (%r14,%r13), %esi
leaq 0x1a93(%rip), %rdi      # 0x34a4
xorl %eax, %eax
callq 0x10b0
jmp 0x1a28
leaq 0x1a89(%rip), %rdi      # 0x34aa
xorl %eax, %eax
callq 0x10b0
incq %r13
jmp 0x19e7
leaq 0x1a7a(%rip), %rdi      # 0x34ae
xorl %eax, %eax
callq 0x10b0
xorl %r13d, %r13d
cmpq $0x10, %r13
je 0x1a64
cmpq %r13, %r12
je 0x1a64
movzbl (%r14,%r13), %eax
leal -0x20(%rax), %ecx
cmpb $0x5f, %cl
cmovael %ebp, %eax
movzbl %al, %edi
callq 0x1050
incq %r13
jmp 0x1a3e
leaq 0x1a45(%rip), %rdi      # 0x34b0
callq 0x1070
addq $0x10, %r15
addl $-0x10, %r12d
addq $0x10, %r14
jmp 0x19c6
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/src/util.c
// Function: test_harness
int test_harness(int (*test_func)(caesar_t *, int), caesar_t *aead, int val)
{
    pid_t p;
    int stat;

    p = fork();
    if (p == 0) {
        exit(test_func(aead, val));
    }
    waitpid(p, &stat, 0);
    fflush(stdout);

    // normal exit ?
    if (WIFEXITED(stat))
        return WEXITSTATUS(stat);

    // something weird happened
    if (WIFSIGNALED(stat))
        printf("\n[SIGNAL %d]\n", WTERMSIG(stat));
    else
        printf("\n[TERMINATED]\n");

    return -1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
callq 0x1210
testl %eax, %eax
je 0x1b16
leaq 0xc(%rsp), %rbx
movl %eax, %edi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x1180
movq 0x4516(%rip), %rax      # 0x5fd8
movq (%rax), %rdi
callq 0x1160
movl (%rbx), %ecx
movl %ecx, %eax
andl $0x7f, %eax
je 0x1af8
movl %eax, %ecx
shll $0x18, %ecx
addl $0x1000000, %ecx        # imm = 0x1000000
cmpl $0x2000000, %ecx        # imm = 0x2000000
jl 0x1afd
leaq 0x19c5(%rip), %rdi      # 0x34b2
movl %eax, %esi
xorl %eax, %eax
callq 0x10b0
jmp 0x1b09
movzbl %ch, %eax
jmp 0x1b0c
leaq 0x19bc(%rip), %rdi      # 0x34c0
callq 0x1070
pushq $-0x1
popq %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %r15, %rdi
movl %ebx, %esi
callq *%r14
movl %eax, %edi
callq 0x11e0
// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/src/speed.c
// Function: test_speed
int test_speed(caesar_t *aead, int limit)
{
    uint64_t len;

    if (brutus_verbose) {
        printf("[%s] Speed Test (limit=%d sec)  "
            "key=%d  nsec=%d  npub=%d  a=%d\n",
            aead->name, limit, aead->keybytes, aead->nsecbytes,
            aead->npubbytes, aead->abytes);
    }

    for (len = 0x10; len <= 0x10000; len <<= 2) {
        run_speed(aead, len, 0, limit);
        run_speed(aead, 0, len, limit);
        run_speed(aead, len, len, limit);
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x42a4(%rip), %rax      # 0x6128
cmpl $0x0, (%rax)
je 0x1eae
movq 0x8(%rbx), %rsi
movl 0x10(%rbx), %ecx
movl 0x14(%rbx), %r8d
movl 0x18(%rbx), %r9d
movl 0x1c(%rbx), %eax
movl %eax, (%rsp)
leaq 0x18ea(%rip), %rdi      # 0x378f
movl %ebp, %edx
xorl %eax, %eax
callq 0x10b0
movslq %ebp, %r14
pushq $0x10
popq %r15
cmpq $0x10000, %r15          # imm = 0x10000
ja 0x1ef5
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
movq %r14, %rcx
callq 0x1b70
movq %rbx, %rdi
xorl %esi, %esi
movq %r15, %rdx
movq %r14, %rcx
callq 0x1b70
movq %rbx, %rdi
movq %r15, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0x1b70
shlq $0x2, %r15
jmp 0x1eb5
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/src/speed.c
// Function: test_throughput
int test_throughput(caesar_t *aead, int limit)
{
    if (brutus_verbose) {
        printf("[%s] Throughput (limit=%d sec)  "
            "key=%d  nsec=%d  npub=%d a=%d\n",
            aead->name, limit, aead->keybytes, aead->nsecbytes,
            aead->npubbytes, aead->abytes);
    }

    run_speed(aead, 0x10000, 0, limit);

    return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x4217(%rip), %rax      # 0x6128
cmpl $0x0, (%rax)
je 0x1f3b
movq 0x8(%rbx), %rsi
movl 0x10(%rbx), %ecx
movl 0x14(%rbx), %r8d
movl 0x18(%rbx), %r9d
movl 0x1c(%rbx), %eax
movl %eax, (%rsp)
leaq 0x189d(%rip), %rdi      # 0x37cf
movl %ebp, %edx
xorl %eax, %eax
callq 0x10b0
movslq %ebp, %rcx
movl $0x10000, %esi          # imm = 0x10000
movq %rbx, %rdi
xorl %edx, %edx
callq 0x1b70
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/src/kat.c
// Function: kat_vec
void kat_vec(void *p, int len, char *label)
{
    int i;
    printf("%4s[%5d]=", label, len);
    for (i = 0; i < len; i++)
        printf("%02X", ((uint8_t *) p)[i]);
    printf("\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x1426(%rip), %rdi      # 0x39e6
movq %rdx, %rsi
movl %ebp, %edx
xorl %eax, %eax
callq 0x10b0
movl %ebp, %eax
sarl $0x1f, %eax
andnl %ebp, %eax, %r15d
leaq 0xec8(%rip), %r14       # 0x34a5
xorl %r12d, %r12d
cmpq %r12, %r15
je 0x25f9
movzbl (%rbx,%r12), %esi
movq %r14, %rdi
xorl %eax, %eax
callq 0x10b0
incq %r12
jmp 0x25e0
pushq $0xa
popq %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1050
// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/src/kat.c
// Function: test_kat
int test_kat(caesar_t *aead, int limit)
{
    int len, t;

    if (brutus_verbose) {
        printf("[%s] KAT (limit=%d bytes)  "
            "key=%d  nsec=%d  npub=%d  a=%d\n",
            aead->name, limit, aead->keybytes, aead->nsecbytes,
            aead->npubbytes, aead->abytes);
    }
    if (limit > KAT_LIMIT) {
        fprintf(stderr, "Limit too high. Increse KAT_LIMIT macro (%d).\n",
            KAT_LIMIT);
        return -1;
    }

    detseq_seed(-1);
    do_kat(aead, 0, 0);

    for (len = 1; len <= limit; len++) {
        detseq_seed(len);
        do_kat(aead, len, 0);
        do_kat(aead, 0, len);
        if (len > 1) {
            t = detseq32() % (len - 1) + 1;
            do_kat(aead, t, len - t);
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl %esi, %r14d
movq %rdi, %rbx
leaq 0x38f4(%rip), %rax      # 0x6128
cmpl $0x0, (%rax)
je 0x285f
movq 0x8(%rbx), %rsi
movl 0x10(%rbx), %ecx
movl 0x14(%rbx), %r8d
movl 0x18(%rbx), %r9d
movl 0x1c(%rbx), %eax
movl %eax, (%rsp)
leaq 0x11e0(%rip), %rdi      # 0x3a35
movl %r14d, %edx
xorl %eax, %eax
callq 0x10b0
cmpl $0x10001, %r14d         # imm = 0x10001
jge 0x28df
pushq $-0x1
popq %rdi
callq 0x193c
xorl %ebp, %ebp
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2609
movl %r14d, %eax
sarl $0x1f, %eax
andnl %r14d, %eax, %r15d
xorl %r12d, %r12d
cmpl %r12d, %r15d
je 0x28ff
leal 0x1(%r12), %r14d
movl %r14d, %edi
callq 0x193c
movq %rbx, %rdi
movl %r14d, %esi
xorl %edx, %edx
callq 0x2609
movq %rbx, %rdi
xorl %esi, %esi
movl %r14d, %edx
callq 0x2609
cmpl $0x2, %r14d
jb 0x28da
xorl %eax, %eax
callq 0x1953
xorl %edx, %edx
divl %r12d
leal 0x1(%rdx), %esi
movl %r14d, %edx
subl %esi, %edx
movq %rbx, %rdi
callq 0x2609
movl %r14d, %r12d
jmp 0x288c
movq 0x3712(%rip), %rax      # 0x5ff8
movq (%rax), %rdi
leaq 0x1180(%rip), %rsi      # 0x3a70
movl $0x10000, %edx          # imm = 0x10000
xorl %eax, %eax
callq 0x1110
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/eric-lo[P]3150/12-VirtualMemory/grow_heap.c
// Function: main
int main(void) {
	int i;
	char *ptr[COUNT];

	printf("PID = %d\n", getpid());

	for(i = 0; i < COUNT; i++)
		ptr[i] = malloc(ONE_MEG);

	printf("malloc finished\n");

	for(i = 0; i < COUNT; i++) {
//		while(getchar() != '\n');
		memset(ptr[i], 0, ONE_MEG);
	}

	printf("return 0");
	return 0;
}

// Assembly:
pushq %rbx
subq $0x6000, %rsp           # imm = 0x6000
callq 0x1040
leaq 0xe74(%rip), %rdi       # 0x2004
xorl %ebx, %ebx
movl %eax, %esi
xorl %eax, %eax
callq 0x1050
cmpq $0xc00, %rbx            # imm = 0xC00
je 0x11b7
movl $0x100000, %edi         # imm = 0x100000
callq 0x1070
movq %rax, (%rsp,%rbx,8)
incq %rbx
jmp 0x119b
leaq 0xe59(%rip), %rdi       # 0x2017
callq 0x1030
xorl %ebx, %ebx
cmpq $0xc00, %rbx            # imm = 0xC00
je 0x11e3
movq (%rsp,%rbx,8), %rdi
movl $0x100000, %edx         # imm = 0x100000
xorl %esi, %esi
callq 0x1060
incq %rbx
jmp 0x11c5
leaq 0xe24(%rip), %rdi       # 0x200e
xorl %eax, %eax
callq 0x1050
xorl %eax, %eax
addq $0x6000, %rsp           # imm = 0x6000
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/zpole[P]IICV/src/test_kmeans.c
// Function: main
int main(int argc VL_UNUSED, char ** argv VL_UNUSED)
{
  VlRand rand ;

  vl_size numData = 100000;
  vl_size dimension = 256;
  vl_size numCenters = 400;
  vl_size maxiter = 10;
  vl_size maxComp = 100;
  vl_size maxrep = 1;
  vl_size ntrees = 1;

  double * data;

  vl_size dataIdx, d;

  //VlKMeansAlgorithm algorithm = VlKMeansANN ;
  VlKMeansAlgorithm algorithm = VlKMeansLloyd ;
  //VlKMeansAlgorithm algorithm = VlKMeansElkan ;
  VlVectorComparisonType distance = VlDistanceL2 ;
  VlKMeans * kmeans = vl_kmeans_new (VL_TYPE_DOUBLE,distance) ;

  vl_rand_init (&rand) ;
  vl_rand_seed (&rand,  1000) ;

  data = vl_malloc(sizeof(double) * dimension * numData);

  for(dataIdx = 0; dataIdx < numData; dataIdx++) {
    for(d = 0; d < dimension; d++) {
      double randomNum = (double)vl_rand_real3(&rand)+1;
      data[dataIdx*dimension+d] = randomNum;
    }
  }

  vl_kmeans_set_verbosity	(kmeans,1);
  vl_kmeans_set_max_num_iterations (kmeans, maxiter) ;
  vl_kmeans_set_max_num_comparisons (kmeans, maxComp) ;
  vl_kmeans_set_num_repetitions (kmeans, maxrep) ;
  vl_kmeans_set_num_trees (kmeans, ntrees);
  vl_kmeans_set_algorithm (kmeans, algorithm);

  //struct timeval t1,t2;
  //gettimeofday(&t1, NULL);

  vl_kmeans_cluster(kmeans,data,dimension,numData,numCenters);

  //gettimeofday(&t2, NULL);

  //VL_PRINT("elapsed vlfeat: %f s\n",(double)(t2.tv_sec - t1.tv_sec) + ((double)(t2.tv_usec - t1.tv_usec))/1000000.);

  vl_kmeans_delete(kmeans);
  vl_free(data);

  return 0 ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x9c8, %rsp            # imm = 0x9C8
pushq $0x2
popq %rdi
pushq $0x1
popq %rsi
callq 0x1030
movq %rax, %rbx
leaq 0x4(%rsp), %r15
movq %r15, %rdi
callq 0x10a0
movq %r15, %rdi
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1060
movl $0xc350000, %edi        # imm = 0xC350000
callq 0x1090
movq %rax, %r14
xorl %r12d, %r12d
movq %rax, %r13
cmpq $0x186a0, %r12          # imm = 0x186A0
je 0x124b
xorl %ebp, %ebp
cmpq $0x100, %rbp            # imm = 0x100
je 0x123f
movq %r15, %rdi
callq 0x1050
movl %eax, %eax
cvtsi2sd %rax, %xmm0
addsd 0xde5(%rip), %xmm0      # 0x2008
mulsd 0xde5(%rip), %xmm0      # 0x2010
addsd 0xde5(%rip), %xmm0      # 0x2018
movsd %xmm0, (%r13,%rbp,8)
incq %rbp
jmp 0x1203
incq %r12
addq $0x800, %r13            # imm = 0x800
jmp 0x11f8
movl $0x1, 0x50(%rbx)
movq $0xa, 0x38(%rbx)
movq $0x64, 0x20(%rbx)
pushq $0x1
popq %rax
movq %rax, 0x48(%rbx)
movq %rax, 0x18(%rbx)
andl $0x0, 0x2c(%rbx)
movl $0x100, %edx            # imm = 0x100
movl $0x186a0, %ecx          # imm = 0x186A0
movl $0x190, %r8d            # imm = 0x190
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1070
movq %rbx, %rdi
callq 0x1040
movq %r14, %rdi
callq 0x1080
xorl %eax, %eax
addq $0x9c8, %rsp            # imm = 0x9C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/lemire[P]simdprune/./simdprune.h
// Function: thinprune_epi8
static inline __m128i thinprune_epi8( __m128i x, int mask) {
      int mask1 = mask & 0xFF;
      int pop = 8 - __builtin_popcount(mask1);
      int mask2 = mask >> 8;
      __m128i m1 = _mm_loadl_epi64((const __m128i *)(thintable_epi8 + mask1));
      __m128i m2 = _mm_loadl_epi64((const __m128i *)(thintable_epi8 + mask2));
      __m128i m2add = _mm_add_epi8(m2,_mm_set1_epi8(8));
      __m128i m2shifted = left_shift_bytes(m2add,pop);
      __m128i shufmask = _mm_or_si128(m2shifted,m1);
      return _mm_shuffle_epi8(
          x, shufmask);
}

// Assembly:
movzbl %dil, %eax
popcntl %eax, %ecx
sarl $0x8, %edi
leaq 0x100dad(%rip), %rdx    # 0x102020
vmovq (%rdx,%rax,8), %xmm1
movslq %edi, %rax
vmovq (%rdx,%rax,8), %xmm2
vpbroadcastb 0xd87(%rip), %xmm3 # 0x2010
vpaddb %xmm3, %xmm2, %xmm2
shll $0x3, %ecx
pushq $0x40
popq %rax
subl %ecx, %eax
vmovd %eax, %xmm3
vpsllq %xmm3, %xmm2, %xmm3
vpslldq $0x8, %xmm2, %xmm2      # xmm2 = zero,zero,zero,zero,zero,zero,zero,zero,xmm2[0,1,2,3,4,5,6,7]
vmovd %ecx, %xmm4
vpsrlq %xmm4, %xmm2, %xmm2
vpternlogq $0xfe, %xmm1, %xmm3, %xmm2
vpshufb %xmm2, %xmm0, %xmm0
retq
// File: /workspace/github_c_makefile_star2_O2/lemire[P]simdprune/./simdprune.h
// Function: skinnyprune_epi8
static inline __m128i skinnyprune_epi8( __m128i x, int mask) {
      int mask1 = mask & 0xFF;
      int mask2 = (mask >> 8) & 0xFF;
      __m128i shufmask = _mm_castps_si128(_mm_loadh_pi(
        _mm_castsi128_ps(
          _mm_loadl_epi64((const __m128i *)(thintable_epi8 + mask1))
        ),
        (const __m64 *)(thintable_epi8 + mask2)
      ));
      shufmask = _mm_add_epi8(shufmask, _mm_set_epi32(0x08080808, 0x08080808, 0, 0));
      __m128i pruned = _mm_shuffle_epi8(x, shufmask);
      intptr_t popx2 = BitsSetTable256mul2[mask1];
      __m128i compactmask = _mm_loadu_si128((const __m128i*)(pshufb_combine_table + popx2*8));
      return _mm_shuffle_epi8(pruned, compactmask);
}

// Assembly:
movl $0xff, %eax
movl %edi, %ecx
andl %eax, %ecx
leaq 0x100d17(%rip), %rdx    # 0x102020
vmovsd (%rdx,%rcx,8), %xmm1
shrl $0x8, %edi
andl %eax, %edi
vmovhps (%rdx,%rdi,8), %xmm1, %xmm1 # xmm1 = xmm1[0,1],mem[0,1]
vpaddb 0x104810(%rip), %xmm1, %xmm1 # 0x105b30
vpshufb %xmm1, %xmm0, %xmm0
leaq 0x1014f4(%rip), %rax    # 0x102820
movzbl (%rcx,%rax), %eax
leaq 0x1015e9(%rip), %rcx    # 0x102920
vpshufb (%rcx,%rax,8), %xmm0, %xmm0
retq
// File: /workspace/github_c_makefile_star2_O2/lemire[P]simdprune/benchmark.c
// Function: print_epi8
void print_epi8(__m128i x) {
  uint8_t buffer[16];
  _mm_storeu_si128((__m128i*)buffer,x);
  for(size_t i = 0; i < 16; i++) {
    printf("%u ", buffer[i]);
  }
  printf("\n");
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
vmovaps %xmm0, (%rsp)
leaq 0x10474f(%rip), %rbx    # 0x105ba0
xorl %r14d, %r14d
cmpq $0x10, %r14
je 0x146e
movzbl (%rsp,%r14), %esi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1060
incq %r14
jmp 0x1454
pushq $0xa
popq %rdi
addq $0x18, %rsp
popq %rbx
popq %r14
jmp 0x1040
// File: /workspace/github_c_makefile_star2_O2/lemire[P]simdprune/benchmark.c
// Function: check_prune_epi8
void check_prune_epi8(__m128i input, __m128i output, int mask) {
  uint8_t buffer[16];
  _mm_storeu_si128((__m128i*)buffer,input);
  size_t pos = 0;
  uint8_t outbuffer[16];
  _mm_storeu_si128((__m128i*)outbuffer,output);

  for(size_t i = 0; i < 16; i++) {
    if((mask & (1<<i)) == 0) {
      assert(buffer[i] == outbuffer[pos]);
      pos ++;
    }
  }
}

// Assembly:
subq $0x28, %rsp
vmovaps %xmm0, 0x10(%rsp)
vmovaps %xmm1, (%rsp)
xorl %eax, %eax
xorl %ecx, %ecx
cmpq $0x10, %rcx
je 0x14ac
btl %ecx, %edi
jb 0x14a7
movb 0x10(%rsp,%rcx), %dl
cmpb (%rsp,%rax), %dl
jne 0x14b1
incq %rax
incq %rcx
jmp 0x1490
addq $0x28, %rsp
retq
leaq 0x1046ec(%rip), %rdi    # 0x105ba4
leaq 0x104701(%rip), %rsi    # 0x105bc0
leaq 0x104706(%rip), %rcx    # 0x105bcc
movl $0xe8, %edx
callq 0x1070
// File: /workspace/github_c_makefile_star2_O2/lemire[P]simdprune/benchmark.c
// Function: testepi8
void testepi8() {
  for(int mask = 0; mask < (1<<16); mask++) {
    __m128i source = _mm_set_epi8(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
    __m128i m1 = prune_epi8(source, mask);
    check_prune_epi8(source, m1, mask);
    __m128i m2 = thinprune_epi8(source, mask);
    check_prune_epi8(source, m2, mask);
    __m128i m3 = skinnyprune_epi8(source, mask);
    check_prune_epi8(source, m3, mask);
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0xb45(%rip), %r14       # 0x2020
xorl %ebx, %ebx
cmpq $0x10000, %rbx          # imm = 0x10000
je 0x1547
vmovdqa 0x104652(%rip), %xmm0   # 0x105b40
vpshufb (%r14), %xmm0, %xmm1
movl %ebx, %edi
callq 0x147d
vmovaps 0x10463e(%rip), %xmm0   # 0x105b40
movl %ebx, %edi
callq 0x1261
vmovaps %xmm0, %xmm1
vmovaps 0x10462b(%rip), %xmm0   # 0x105b40
movl %ebx, %edi
callq 0x147d
vmovaps 0x10461c(%rip), %xmm0   # 0x105b40
movl %ebx, %edi
callq 0x12f9
vmovaps %xmm0, %xmm1
vmovaps 0x104609(%rip), %xmm0   # 0x105b40
movl %ebx, %edi
callq 0x147d
incq %rbx
addq $0x10, %r14
jmp 0x14dd
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: readfile
int readfile(char* path, char* buf, int maxlen) {
	FILE *infile = fopen(path,"rb");
	if (!infile) {
		printf("Can't open file '%s'\n",path);
		return -1;		// failed to open file
	}
	fseek(infile, 0, SEEK_END);
	int iflen = ftell(infile);
	rewind(infile);
	if (iflen <= maxlen) {
		fread(buf, iflen, 1, infile);
	} else {
		printf("File '%s' is too long (max is 0x%X bytes)\n", path, maxlen);
		iflen = -2;
	}
	fclose(infile);
	return iflen;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r15d
movq %rsi, %r12
movq %rdi, %r14
leaq 0x9d7eb(%rip), %rsi     # 0x49f051
callq 0x414760
testq %rax, %rax
je 0x4018b2
movq %rax, %rbx
pushq $0x2
popq %rdx
movq %rax, %rdi
xorl %esi, %esi
callq 0x4189b0
movq %rbx, %rdi
callq 0x414960
movq %rax, %r13
movq %rbx, %rdi
callq 0x418bb0
cmpl %r15d, %r13d
jle 0x4018c9
leaq 0x9d7cb(%rip), %rdi     # 0x49f06a
movq %r14, %rsi
movl %r15d, %edx
xorl %eax, %eax
callq 0x40dd00
pushq $-0x2
popq %r13
jmp 0x4018da
leaq 0x9d79b(%rip), %rdi     # 0x49f054
movq %r14, %rsi
xorl %eax, %eax
callq 0x40dd00
pushq $-0x1
popq %r13
jmp 0x4018e2
movslq %r13d, %rsi
pushq $0x1
popq %rdx
movq %r12, %rdi
movq %rbx, %rcx
callq 0x414860
movq %rbx, %rdi
callq 0x414320
movl %r13d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: savefile
int savefile(char* path, char* buf, int len) {
	FILE *file = fopen(path, "wb");
	if (!file) {
		printf("Can't open file '%s' for writing\n",path);
		return 0;
	}
	if (buf && (len > 0)) fwrite(buf, len, 1, file);
	fclose(file);
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r12
leaq 0x9d786(%rip), %rsi     # 0x49f095
callq 0x414760
testq %rax, %rax
je 0x40194a
movq %rax, %r14
testq %rbx, %rbx
sete %al
testl %r15d, %r15d
setle %cl
orb %al, %cl
jne 0x40193d
movl %r15d, %esi
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %r14, %rcx
callq 0x414ab0
movq %r14, %rdi
callq 0x414320
pushq $0x1
popq %rbx
jmp 0x40195d
leaq 0x9d747(%rip), %rdi     # 0x49f098
xorl %ebx, %ebx
movq %r12, %rsi
xorl %eax, %eax
callq 0x40dd00
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: testExt
int testExt(char* path, char* ext) {
	char* ptr = strrchr(path, '.');
	if (!ptr) return 0;
	char buf[255];
	strcpy(buf, ptr + 1);
	ptr = buf;
	while (*ptr) {
		*ptr = tolower(*ptr);
		ptr++;
	}
	if (strcmp(ext, buf)) return 0;
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsi, %rbx
pushq $0x2e
popq %rsi
callq 0x401058
testq %rax, %rax
je 0x4019d4
incq %rax
leaq -0x120(%rbp), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x401020
movsbq (%r14), %r15
testq %r15, %r15
je 0x4019ba
callq 0x406570
movq (%rax), %rax
movb (%rax,%r15,4), %al
movb %al, (%r14)
incq %r14
jmp 0x40199d
leaq -0x120(%rbp), %rsi
movq %rbx, %rdi
callq 0x4010b8
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
sete %al
jmp 0x4019d6
xorl %eax, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: getFileType
int getFileType(char* path) {
	FILE* file = fopen(path, "rb");
	char buf[9];
	int res = TYPE_UNKNOWN;
	if (testExt(path, "tap")) {
		res = TYPE_TAP;
	} else if (testExt(path, "scl") && file) {
		fread(buf, 9, 1, file);
		if ((strncmp(buf, "SINCLAIR", 8) == 0) && ((unsigned)buf[8] < 129))
			res = TYPE_SCL;
	} else if (testExt(path, "trd") && file) {
		fseek(file, 0, SEEK_END);
		size_t size = ftell(file);
		fseek(file, 0x8e7, SEEK_SET);
		int type = fgetc(file);
		if ((size > 0x8ff) && (size < 0xa0001) && (type == 0x10))
			res = TYPE_TRD;
	}
	if (file) fclose(file);
	return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
leaq 0x9d658(%rip), %rsi     # 0x49f051
callq 0x414760
movq %rax, %rbx
leaq 0x9d6b2(%rip), %rsi     # 0x49f0ba
movq %r14, %rdi
callq 0x401968
testl %eax, %eax
je 0x401a26
pushq $0x3
popq %r14
testq %rbx, %rbx
jne 0x401add
jmp 0x401ae5
leaq 0x9d691(%rip), %rsi     # 0x49f0be
movq %r14, %rdi
callq 0x401968
testq %rbx, %rbx
je 0x401a73
testl %eax, %eax
je 0x401a73
leaq -0x19(%rbp), %r14
pushq $0x9
popq %rsi
pushq $0x1
popq %rdx
movq %r14, %rdi
movq %rbx, %rcx
callq 0x414860
movabsq $0x5249414c434e4953, %rax # imm = 0x5249414C434E4953
cmpq %rax, (%r14)
sete %al
cmpb $0x0, 0x8(%r14)
setns %cl
andb %al, %cl
movzbl %cl, %r14d
jmp 0x401add
leaq 0x9d651(%rip), %rsi     # 0x49f0cb
movq %r14, %rdi
callq 0x401968
xorl %r14d, %r14d
testq %rbx, %rbx
je 0x401a18
testl %eax, %eax
je 0x401a18
pushq $0x2
popq %rdx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4189b0
movq %rbx, %rdi
callq 0x414960
movq %rax, %r14
movl $0x8e7, %esi            # imm = 0x8E7
movq %rbx, %rdi
xorl %edx, %edx
callq 0x4189b0
movq %rbx, %rdi
callq 0x418a90
addq $-0x900, %r14           # imm = 0xF700
cmpq $0x9f701, %r14          # imm = 0x9F701
setb %cl
cmpl $0x10, %eax
sete %al
andb %cl, %al
movzbl %al, %r14d
addl %r14d, %r14d
movq %rbx, %rdi
callq 0x414320
movl %r14d, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: cutName
xName cutName(char* path) {
	char fnam[strlen(path) + 1];
	char* ptr = strrchr(path, SLASH);		// last slash
	if (ptr) {
		strcpy(fnam, ptr + 1);
	} else {
		strcpy(fnam, path);
	}
	ptr = strrchr(fnam, '.');
	xName nm;
	memset(nm.name, 0x20, 10);
	memset(nm.ext, 0x20, 3);
	if (ptr) {
		*ptr = 0x00;
		memcpy(nm.ext, ptr + 1, (strlen(ptr + 1) > 3) ? 3 : strlen(ptr + 1));
	}
	memcpy(nm.name, fnam, (strlen(fnam) > 10) ? 10 : strlen(fnam));
	return nm;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
callq 0x4010e0
movq %rsp, %rbx
addq $0x10, %rax
andq $-0x10, %rax
subq %rax, %rbx
movq %rbx, %rsp
pushq $0x2f
popq %rsi
movq %r14, %rdi
callq 0x401058
leaq 0x1(%rax), %rsi
testq %rax, %rax
cmoveq %r14, %rsi
movq %rbx, %rdi
callq 0x401020
pushq $0x2e
popq %rsi
movq %rbx, %rdi
callq 0x401058
movq %rax, %r14
movabsq $0x2020202020202020, %rax # imm = 0x2020202020202020
movq %rax, -0x20(%rbp)
movq %rax, -0x1b(%rbp)
testq %r14, %r14
je 0x401b7e
movb $0x0, (%r14)
incq %r14
movq %r14, %rdi
callq 0x4010e0
cmpq $0x3, %rax
pushq $0x3
popq %rdx
cmovbq %rax, %rdx
leaq -0x16(%rbp), %rdi
movq %r14, %rsi
callq 0x401048
movq %rbx, %rdi
callq 0x4010e0
cmpq $0xa, %rax
pushq $0xa
popq %rdx
cmovbq %rax, %rdx
leaq -0x20(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x401048
movq (%r14), %rax
movl 0x8(%r14), %ecx
movl 0xc(%r14), %edx
shlq $0x20, %rdx
orq %rcx, %rdx
leaq -0x10(%rbp), %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: stdAccumulate
int stdAccumulate(unsigned char* ptr, int size, int res) {
	while (size > 0) {
		res += *ptr;
		ptr++;
		size--;
	}
	return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %edx, %eax
testl %esi, %esi
jle 0x401bd1
movzbl (%rdi), %ecx
addl %ecx, %eax
incq %rdi
decl %esi
jmp 0x401bc1
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: fgeti
int fgeti(FILE* file) {
	int res = fgetc(file) & 0xff;
	res |= (fgetc(file) << 8);
	res |= (fgetc(file) << 16);
	res |= (fgetc(file) << 24);
	return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x418a90
movzbl %al, %r15d
movq %rbx, %rdi
callq 0x418a90
movl %eax, %r14d
shll $0x8, %r14d
orl %r15d, %r14d
movq %rbx, %rdi
callq 0x418a90
movl %eax, %r15d
shll $0x10, %r15d
movq %rbx, %rdi
callq 0x418a90
shll $0x18, %eax
orl %r15d, %eax
orl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: fputi
void fputi(FILE* file, int val) {
	fputc(val & 0xff, file);
	fputc((val >> 8) & 0xff, file);
	fputc((val >> 16) & 0xff, file);
	fputc((val >> 24) & 0xff, file);	
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
movl $0xff, %r15d
movl %esi, %edi
andl %r15d, %edi
movq %rbx, %rsi
callq 0x418870
movl %r14d, %edi
shrl $0x8, %edi
andl %r15d, %edi
movq %rbx, %rsi
callq 0x418870
movl %r14d, %edi
shrl $0x10, %edi
andl %r15d, %edi
movq %rbx, %rsi
callq 0x418870
shrl $0x18, %r14d
movl %r14d, %edi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x418870
// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: makeName
void makeName(char* name, char* buf) {
	if (name == NULL) return;
	memset(buf, 0x20, 9);
	char* ptr = strrchr(name, '.');
	if (ptr) {
		memcpy(buf, name, ((ptr - name) > 8) ? 8 : (ptr - name));
		ptr++;
		if (*ptr) buf[8] = *ptr;
	} else {
		memcpy(buf, name, (strlen(name) > 8) ? 8 : strlen(name));
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x401cde
movq %rsi, %rbx
movq %rdi, %r14
movabsq $0x2020202020202020, %rax # imm = 0x2020202020202020
movq %rax, (%rsi)
movb $0x20, 0x8(%rsi)
pushq $0x2e
popq %rsi
callq 0x401058
testq %rax, %rax
je 0x401ce9
movq %rax, %r15
subq %r14, %rax
cmpq $0x8, %rax
pushq $0x8
popq %rdx
cmovlq %rax, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x401048
movb 0x1(%r15), %al
testb %al, %al
je 0x401cde
movb %al, 0x8(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
callq 0x4010e0
cmpq $0x8, %rax
pushq $0x8
popq %rdx
cmovbq %rax, %rdx
movq %rbx, %rdi
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x401048
// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: getSum
int getSum(char* data, int len) {
	unsigned int crc = 0;
	while (len--) {
		crc += (unsigned char)*data;
		data++;
	}
	return crc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl %esi, %ecx
xorl %edx, %edx
xorl %eax, %eax
cmpl %edx, %ecx
je 0x401d2a
movzbl (%rdi,%rdx), %esi
addl %esi, %eax
incq %rdx
jmp 0x401d1b
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: makeDSC
trdFile makeDSC(char* path, int len) {
	trdFile hd;
	xName nm = cutName(path);
	memcpy(hd.name, nm.name, 8);
	hd.lnl = len & 0xff;
	hd.lnh = (len >> 8) & 0xff;
	if (opt.isBasic) {
		hd.ext = 'B';
		hd.stl = hd.lnl;
		hd.sth = hd.lnh;
		len += 4;		// 80,AA,<AS.line>
	} else {
		hd.ext = nm.ext[0];
		hd.stl = nm.ext[1];
		hd.sth = nm.ext[2];
	}
	hd.slen = ((len >> 8) & 0xff) + ((len & 0xff) ? 1 : 0);
	return hd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movl %esi, %ebx
callq 0x401af1
movl %ebx, %esi
shrl $0x8, %esi
testb $0x1, 0xd068b(%rip)     # 0x4d23d0
jne 0x401d6d
movabsq $0xffffffffff, %rcx     # imm = 0xFFFFFFFFFF
andq %rdx, %rcx
shrl $0x10, %edx
movq %rcx, %rdi
shrq $0x18, %rdi
shrq $0x20, %rcx
movzbl %dl, %r8d
movl %esi, %edx
movl %ebx, %r9d
jmp 0x401d7f
movl %ebx, %edi
movl %esi, %ecx
leal 0x4(%rbx), %r9d
movl %r9d, %edx
shrl $0x8, %edx
pushq $0x42
popq %r8
xorl %r10d, %r10d
testb %r9b, %r9b
setne %r10b
addl %edx, %r10d
movl $0xff, %edx
andl %edx, %r10d
shlq $0x28, %r10
andl %edx, %esi
shlq $0x20, %rsi
orq %r10, %rsi
shll $0x18, %ebx
orq %rsi, %rbx
andl %edx, %ecx
shll $0x10, %ecx
orq %rbx, %rcx
shll $0x8, %edi
movzwl %di, %edx
orq %rcx, %rdx
orq %r8, %rdx
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: prepareFile
trdFile prepareFile(char* path, char* buf) {
	memset(buf, 0x00, 0x10000);
	trdFile hd;
	int ilen;
	memset(hd.name, 0x00, sizeof(trdFile));
	if (opt.asHobeta) {
		ilen = readfile(path, buf, 0xff11);	// +17 bytes header
		if (ilen > 0) {
			if (!buf[13])
				buf[13] = buf[14];
			memcpy((char*)&hd, buf, 15);
			memcpy(buf, buf+17, ilen-17);
		}
	} else {
		ilen = readfile(path, buf, 0xff00);
		if (ilen > 0) {
			if (opt.isBasic) {
				buf[ilen] = 0x80;
				buf[ilen+1] = 0xaa;
				buf[ilen+2] = opt.aStart & 0xff;
				buf[ilen+3] = (opt.aStart >> 8) & 0xff;
			}
			hd = makeDSC(path, ilen);
		}
	}
	return hd;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl $0x10000, %edx          # imm = 0x10000
movq %rsi, %rdi
xorl %esi, %esi
callq 0x4010a8
testb $0x4, 0xd05e8(%rip)     # 0x4d23d0
jne 0x401e39
movq %r14, %rdi
movq %rbx, %rsi
movl $0xff00, %edx           # imm = 0xFF00
callq 0x401848
testl %eax, %eax
jle 0x401e88
testb $0x1, 0xd05c7(%rip)     # 0x4d23d0
je 0x401e27
movl %eax, %ecx
movw $0xaa80, (%rbx,%rcx)    # imm = 0xAA80
movb 0xd05bb(%rip), %dl      # 0x4d23d4
movb %dl, 0x2(%rbx,%rcx)
movb 0xd05b2(%rip), %dl      # 0x4d23d5
movb %dl, 0x3(%rbx,%rcx)
movq %r14, %rdi
movl %eax, %esi
callq 0x401d2c
movq %rax, %r14
movq %rdx, %r15
jmp 0x401e8e
movq %r14, %rdi
movq %rbx, %rsi
movl $0xff11, %edx           # imm = 0xFF11
callq 0x401848
testl %eax, %eax
jle 0x401e88
cmpb $0x0, 0xd(%rbx)
jne 0x401e59
movb 0xe(%rbx), %cl
movb %cl, 0xd(%rbx)
movq (%rbx), %r14
movzwl 0xc(%rbx), %ecx
movzbl 0xe(%rbx), %edx
shll $0x10, %edx
orl %ecx, %edx
shlq $0x20, %rdx
movl 0x8(%rbx), %r15d
orq %rdx, %r15
leaq 0x11(%rbx), %rsi
addl $-0x11, %eax
movslq %eax, %rdx
movq %rbx, %rdi
callq 0x401048
jmp 0x401e8e
xorl %r15d, %r15d
xorl %r14d, %r14d
movq %r14, %rax
movq %r15, %rdx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/salextpuru[P]speccy-toochain/src/mktrd/mctrd.c
// Function: saveoutput
int saveoutput(char* oname, char* buf, trdFile hd) {
	int len;
	if ((hd.lnh + (hd.lnl ? 1 : 0)) == hd.slen) {
		len = hd.lnl | (hd.lnh << 8);
	} else {
		len = hd.slen << 8;
	}
	int res;
	if (opt.asHobeta) {
		char hbuf[0x10010];
		memcpy(hbuf, (char*)&hd, 13);
		hbuf[13] = 0x00;
		hbuf[14] = hd.slen;
		int crc = ((105 + 257 * stdAccumulate((unsigned char*)hbuf, 15, 0)) & 0xffff);
		hbuf[15] = crc & 0xff;
		hbuf[16] = ((crc & 0xff00) >> 8);
		memcpy(hbuf + 17, buf, len);
		res = savefile(oname, hbuf, len + 17);
	} else {
		res = savefile(oname, buf, len);
	}
	return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10010, %rsp          # imm = 0x10010
movq %rsi, %r15
movq %rdi, %rbx
movq %rcx, %rax
shrq $0x20, %rax
movl $0xff, %edi
movl %eax, %r14d
andl %edi, %r14d
cmpl $0x1000000, %ecx        # imm = 0x1000000
movl %r14d, %r8d
sbbl $-0x1, %r8d
movq %rcx, %rsi
shrq $0x28, %rsi
andl %esi, %edi
cmpl %edi, %r8d
jne 0x401eeb
shldl $0x8, %ecx, %r14d
jmp 0x401ef1
shll $0x8, %edi
movl %edi, %r14d
testb $0x4, 0xd04d8(%rip)     # 0x4d23d0
jne 0x401f17
movq %rbx, %rdi
movq %r15, %rsi
movl %r14d, %edx
addq $0x10010, %rsp          # imm = 0x10010
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x4018f4
leaq -0x10030(%rbp), %r12
movq %rdx, (%r12)
movl %ecx, 0x8(%r12)
movb %al, 0xc(%r12)
movb $0x0, 0xd(%r12)
movb %sil, 0xe(%r12)
pushq $0xf
popq %rsi
movq %r12, %rdi
xorl %edx, %edx
callq 0x401bbb
imull $0x101, %eax, %eax      # imm = 0x101
addl $0x69, %eax
movw %ax, 0xf(%r12)
leaq -0x1001f(%rbp), %rdi
movl %r14d, %edx
movq %r15, %rsi
callq 0x401048
addl $0x11, %r14d
movq %rbx, %rdi
movq %r12, %rsi
movl %r14d, %edx
callq 0x4018f4
addq $0x10010, %rsp          # imm = 0x10010
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq