LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/flashtool.c
// Function: print_flashinfo
void print_flashinfo(unsigned char *flashdata) {
    struct nvs_console_info cinfo;
    char macaddress[6];
    int i;

    // read console info and mac address
    nvs_read(flashdata, 0, 2, NVS_VAR_BLOCK2_CONSOLE_INF0, sizeof(cinfo), (unsigned char *)&cinfo);
    nvs_read(flashdata, 0, 0, NVS_VAR_BLOCK0_MAC_ADDRESS, sizeof(macaddress), macaddress);

    printf("* motherboard serial: %.*s\n", (int)sizeof(cinfo.moboserial), cinfo.moboserial);
    printf("* serial: %.*s\n", (int)sizeof(cinfo.serial), cinfo.serial);
    printf("* model: %.*s\n", (int)sizeof(cinfo.model), cinfo.model);
    printf("* mac address: ");
    for(i = 0; i < sizeof(macaddress); i++) {
        printf("%02X%c", macaddress[i] & 0xFF, (i == sizeof(macaddress) - 1) ? '\n' : ':');
    }

    printf("\n");
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x60, %rsp
movq %rdi, %rbx
leaq 0x12(%rsp), %r14
xorl %esi, %esi
movl $0x2, %edx
xorl %ecx, %ecx
movl $0x4e, %r8d
movq %r14, %r9
callq 0x4e28
leaq 0xc(%rsp), %r9
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
movl $0x21, %ecx
movl $0x6, %r8d
callq 0x4e28
leaq 0x4920(%rip), %rdi      # 0x8501
movl $0xe, %esi
movq %r14, %rdx
xorl %eax, %eax
callq 0x20b0
leaq 0x42(%rsp), %rdx
leaq 0x4921(%rip), %rdi      # 0x851d
movl $0xa, %ebp
movl $0xa, %esi
xorl %eax, %eax
callq 0x20b0
leaq 0x53(%rsp), %rdx
leaq 0x4914(%rip), %rdi      # 0x852d
movl $0xd, %esi
xorl %eax, %eax
callq 0x20b0
leaq 0x4910(%rip), %rdi      # 0x853c
xorl %eax, %eax
callq 0x20b0
movq $-0x6, %r14
leaq 0x48b9(%rip), %rbx      # 0x84fa
movzbl 0x12(%rsp,%r14), %esi
incq %r14
movl $0x3a, %edx
cmovel %ebp, %edx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x20b0
testq %r14, %r14
jne 0x3c41
movl $0xa, %edi
callq 0x2040
addq $0x60, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/flashtool.c
// Function: extract_flashdump
int extract_flashdump(unsigned char *flashdata, char *extractdir) {
    unsigned char *ptr;
    int len;
    char path[512];
    
    printf("extracting flash to '%s' directory ...\n", extractdir);
    
    mkdir(extractdir, S_IRWXU);

    snprintf(path, sizeof(path), "%s/%s", extractdir, "emcipl.bin");
    if(decrypt_emc_ipl(flashdata, &ptr, &len)) {
        return 1;
    }

    dumpbin(path, ptr, len);
    free(ptr);

    printf("extracted EMC IPL to '%s'!\n", path);

    snprintf(path, sizeof(path), "%s/%s", extractdir, "eapkbl.elf");
    if(decrypt_eap_kbl(flashdata, &ptr, &len)) {
        return 1;
    }

    dumpbin(path, ptr, len);
    free(ptr);
    
    printf("extracted EAP KBL to '%s'!\n", path);

    snprintf(path, sizeof(path), "%s/%s", extractdir, "consoleinfo.txt");
    dump_console_info(flashdata, path);
    
    printf("wrote console info to '%s'!\n", path);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x4882(%rip), %rdi      # 0x854c
xorl %eax, %eax
callq 0x20b0
movq %r14, %rdi
movl $0x1c0, %esi            # imm = 0x1C0
callq 0x2050
leaq 0x488f(%rip), %rdx      # 0x8574
leaq 0x488e(%rip), %r8       # 0x857a
leaq 0x10(%rsp), %rdi
movl $0x200, %esi            # imm = 0x200
movq %r14, %rcx
xorl %eax, %eax
callq 0x20c0
leaq 0x8(%rsp), %rsi
leaq 0x4(%rsp), %rdx
movq %rbx, %rdi
callq 0x6791
movl $0x1, %ebp
testl %eax, %eax
jne 0x3df7
leaq 0x8(%rsp), %r15
movq (%r15), %rsi
leaq 0x4(%rsp), %r12
movl (%r12), %edx
leaq 0x10(%rsp), %r13
movq %r13, %rdi
callq 0x3922
movq (%r15), %rdi
callq 0x2030
leaq 0x4875(%rip), %rdi      # 0x85c1
movq %r13, %rsi
xorl %eax, %eax
callq 0x20b0
leaq 0x4817(%rip), %rdx      # 0x8574
leaq 0x4821(%rip), %r8       # 0x8585
movl $0x200, %esi            # imm = 0x200
movq %r13, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x20c0
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x6c21
testl %eax, %eax
jne 0x3df7
movq 0x8(%rsp), %rsi
movl 0x4(%rsp), %edx
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x3922
movq 0x8(%rsp), %rdi
callq 0x2030
leaq 0x4832(%rip), %rdi      # 0x85e1
movq %r15, %rsi
xorl %eax, %eax
callq 0x20b0
leaq 0x47b4(%rip), %rdx      # 0x8574
leaq 0x47c9(%rip), %r8       # 0x8590
movl $0x200, %esi            # imm = 0x200
movq %r15, %rdi
movq %r14, %rcx
xorl %eax, %eax
callq 0x20c0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3a6e
leaq 0x47b5(%rip), %rdi      # 0x85a0
movq %r15, %rsi
xorl %eax, %eax
callq 0x20b0
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/flashtool.c
// Function: rawextract_flashdump
int rawextract_flashdump(unsigned char *flashdata, char *extractdir) {
    struct bldr_hdr *emc_blhdr = flash_locate_emc_ipl(flashdata, 0);
    struct bldr_hdr *eap_blhdr = flash_locate_eap_kbl(flashdata);
    char path[512];

    snprintf(path, sizeof(path), "%s/%s", extractdir, "emcipl.bin");
    dumpbin(path, (unsigned char *)emc_blhdr, emc_blhdr->hdr_len + emc_blhdr->body_len);

    printf("raw extracted EMC IPL to '%s'!\n", path);

    snprintf(path, sizeof(path), "%s/%s", extractdir, "eapkbl.elf");
    dumpbin(path, (unsigned char *)eap_blhdr, eap_blhdr->hdr_len + eap_blhdr->body_len);

    printf("raw extracted EAP KBL to '%s'!\n", path);

    snprintf(path, sizeof(path), "%s/%s", extractdir, "consoleinfo.txt");
    dump_console_info(flashdata, path);
    
    printf("wrote console info to '%s'!\n", path);

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x208, %rsp            # imm = 0x208
movq %rsi, %r14
movq %rdi, %rbx
xorl %esi, %esi
callq 0x6420
movq %rax, %rbp
movq %rbx, %rdi
callq 0x64e9
movq %rax, %r13
leaq 0x4736(%rip), %r12      # 0x8574
leaq 0x4735(%rip), %r8       # 0x857a
movq %rsp, %r15
movl $0x200, %esi            # imm = 0x200
movq %r15, %rdi
movq %r12, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x20c0
movl 0xc(%rbp), %edx
addl 0x8(%rbp), %edx
movq %r15, %rdi
movq %rbp, %rsi
callq 0x3922
leaq 0x4748(%rip), %rdi      # 0x85bd
movq %r15, %rsi
xorl %eax, %eax
callq 0x20b0
leaq 0x46ff(%rip), %r8       # 0x8585
movl $0x200, %esi            # imm = 0x200
movq %r15, %rdi
movq %r12, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x20c0
movl 0xc(%r13), %edx
addl 0x8(%r13), %edx
movq %r15, %rdi
movq %r13, %rsi
callq 0x3922
leaq 0x4728(%rip), %rdi      # 0x85dd
movq %r15, %rsi
xorl %eax, %eax
callq 0x20b0
leaq 0x46ca(%rip), %r8       # 0x8590
movl $0x200, %esi            # imm = 0x200
movq %r15, %rdi
movq %r12, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x20c0
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3a6e
leaq 0x46b3(%rip), %rdi      # 0x85a0
movq %r15, %rsi
xorl %eax, %eax
callq 0x20b0
xorl %eax, %eax
addq $0x208, %rsp            # imm = 0x208
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/hmac-sha1.c
// Function: memxor
void *
memxor (void */*restrict*/ dest, const void */*restrict*/ src, size_t n)
{
  char const *s = (char const*)src;
  char *d = (char*)dest;

  for (; n > 0; n--)
    *d++ ^= *s++;

  return dest;
}

// Assembly:
movq %rdi, %rax
testq %rdx, %rdx
je 0x4a2e
xorl %ecx, %ecx
movb (%rsi,%rcx), %dil
xorb %dil, (%rax,%rcx)
incq %rcx
cmpq %rcx, %rdx
jne 0x4a1e
retq
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/hmac-sha1.c
// Function: hmac_sha1
int
hmac_sha1 (const void *key, size_t keylen,
	   const void *in, size_t inlen, void *resbuf)
{
  struct sha1_ctx inner;
  struct sha1_ctx outer;
  char optkeybuf[20];
  char block[64];
  char innerhash[20];

  /* Reduce the key's size, so that it becomes <= 64 bytes large.  */

  if (keylen > 64)
    {
      struct sha1_ctx keyhash;

      sha1_init_ctx (&keyhash);
      sha1_process_bytes (key, keylen, &keyhash);
      sha1_finish_ctx (&keyhash, optkeybuf);

      key = optkeybuf;
      keylen = 20;
    }

  /* Compute INNERHASH from KEY and IN.  */

  sha1_init_ctx (&inner);

  memset (block, IPAD, sizeof (block));
  memxor (block, key, keylen);

  sha1_process_block (block, 64, &inner);
  sha1_process_bytes (in, inlen, &inner);

  sha1_finish_ctx (&inner, innerhash);

  /* Compute result from KEY and INNERHASH.  */

  sha1_init_ctx (&outer);

  memset (block, OPAD, sizeof (block));
  memxor (block, key, keylen);

  sha1_process_block (block, 64, &outer);
  sha1_process_bytes (innerhash, 20, &outer);

  sha1_finish_ctx (&outer, resbuf);

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rcx, %r12
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %r14
cmpq $0x41, %rsi
movq %r8, 0x8(%rsp)
jb 0x4a8b
leaq 0x88(%rsp), %rbp
movq %rbp, %rdi
callq 0x4ef8
movq %r14, %rdi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x62b6
leaq 0x70(%rsp), %r14
movq %rbp, %rdi
movq %r14, %rsi
callq 0x4f39
movl $0x14, %r15d
leaq 0x88(%rsp), %rdi
callq 0x4ef8
movaps 0x45b1(%rip), %xmm0     # 0x9050
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
testq %r15, %r15
je 0x4b3e
xorl %eax, %eax
movb (%r14,%rax), %cl
xorb %cl, 0x30(%rsp,%rax)
incq %rax
cmpq %rax, %r15
jne 0x4abe
leaq 0x30(%rsp), %rbp
leaq 0x88(%rsp), %rbx
movl $0x40, %esi
movq %rbp, %rdi
movq %rbx, %rdx
callq 0x502f
movq %r13, %rdi
movq %r12, %rsi
movq %rbx, %rdx
callq 0x62b6
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x4f39
leaq 0x128(%rsp), %rdi
callq 0x4ef8
movaps 0x4546(%rip), %xmm0     # 0x9060
movaps %xmm0, 0x30(%rbp)
movaps %xmm0, 0x20(%rbp)
movaps %xmm0, 0x10(%rbp)
movaps %xmm0, (%rbp)
xorl %eax, %eax
movb (%r14,%rax), %cl
xorb %cl, 0x30(%rsp,%rax)
incq %rax
cmpq %rax, %r15
jne 0x4b2c
jmp 0x4b99
leaq 0x30(%rsp), %rbx
leaq 0x88(%rsp), %r14
movl $0x40, %esi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x502f
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x62b6
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x4f39
leaq 0x128(%rsp), %rdi
callq 0x4ef8
movaps 0x44d6(%rip), %xmm0     # 0x9060
movaps %xmm0, 0x30(%rbx)
movaps %xmm0, 0x20(%rbx)
movaps %xmm0, 0x10(%rbx)
movaps %xmm0, (%rbx)
leaq 0x30(%rsp), %rdi
leaq 0x128(%rsp), %rbx
movl $0x40, %esi
movq %rbx, %rdx
callq 0x502f
leaq 0x10(%rsp), %rdi
movl $0x14, %esi
movq %rbx, %rdx
callq 0x62b6
movq %rbx, %rdi
movq 0x8(%rsp), %rsi
callq 0x4f39
xorl %eax, %eax
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/keymgr.c
// Function: keymgr_loadkeys
int keymgr_loadkeys(const char *keyfile) {
    FILE *fkeyfile;
    long filesize;
    unsigned char *ptr;
    int i;
    int sz;

    fkeyfile = fopen(keyfile, "rb");
    if(!fkeyfile) {
        printf("keymgr: invalid key file!\n");
        return 1;
    }

    kmgrstate.keynames = (char **)malloc(MAXIMUM_KEYS * sizeof(char *));
    kmgrstate.keytypes = (int *)malloc(MAXIMUM_KEYS * sizeof(int));
    kmgrstate.keydata = (unsigned char **)malloc(MAXIMUM_KEYS * sizeof(char *));

    fseek(fkeyfile, 0, SEEK_END);
    filesize = ftell(fkeyfile);
    fseek(fkeyfile, 0, SEEK_SET);

    kmgrstate.filedata = (char *)malloc(filesize);
    fread(kmgrstate.filedata, 1, filesize, fkeyfile);
    fclose(fkeyfile);

    // parse all the keys
    ptr = kmgrstate.filedata;
    kmgrstate.numkeys = *(unsigned int *)ptr;
    ptr += 4;

    for(i = 0; i < kmgrstate.numkeys; i++) {
        // name
        sz = *(unsigned int *)ptr; ptr += 4;
        kmgrstate.keynames[i] = ptr; ptr += sz;

        // keytype
        kmgrstate.keytypes[i] = *(unsigned int *)ptr; ptr += 4;

        // keydat
        sz = *(unsigned int *)ptr; ptr += 4;
        kmgrstate.keydata[i] = ptr; ptr += sz;
    }

    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
leaq 0x38e6(%rip), %rsi      # 0x84da
callq 0x2180
testq %rax, %rax
je 0x4cf9
movq %rax, %r14
movl $0x8000, %edi           # imm = 0x8000
callq 0x2150
movq %rax, 0x771a(%rip)      # 0xc330
movl $0x4000, %edi           # imm = 0x4000
callq 0x2150
movq %rax, 0x7711(%rip)      # 0xc338
movl $0x8000, %edi           # imm = 0x8000
callq 0x2150
movq %rax, 0x7708(%rip)      # 0xc340
xorl %ebx, %ebx
movq %r14, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x2160
movq %r14, %rdi
callq 0x2130
movq %rax, %r15
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x2160
movq %r15, %rdi
callq 0x2150
movq %rax, 0x76d9(%rip)      # 0xc348
movl $0x1, %esi
movq %rax, %rdi
movq %r15, %rdx
movq %r14, %rcx
callq 0x2070
movq %r14, %rdi
callq 0x2080
movq 0x76b7(%rip), %rax      # 0xc348
movl (%rax), %ecx
movl %ecx, 0x76b7(%rip)      # 0xc350
testl %ecx, %ecx
jle 0x4d0a
addq $0x4, %rax
xorl %ebx, %ebx
xorl %ecx, %ecx
movslq (%rax), %rdx
leaq 0x4(%rax), %rsi
movq 0x767d(%rip), %rdi      # 0xc330
movq %rsi, (%rdi,%rcx,8)
leaq (%rax,%rdx), %rsi
addq $0x4, %rsi
leaq 0xc(%rax,%rdx), %rax
movl -0x8(%rax), %edx
movq 0x766a(%rip), %rdi      # 0xc338
movl %edx, (%rdi,%rcx,4)
movslq -0x4(%rax), %rdx
movq 0x7664(%rip), %rdi      # 0xc340
movq %rax, (%rdi,%rcx,8)
leaq (%rdx,%rsi), %rax
addq $0x8, %rax
incq %rcx
movslq 0x765e(%rip), %rdx      # 0xc350
cmpq %rdx, %rcx
jl 0x4ca5
jmp 0x4d0a
leaq 0x438b(%rip), %rdi      # 0x908b
callq 0x2060
movl $0x1, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/keymgr.c
// Function: keymgr_cleanup
void keymgr_cleanup() {
    if(kmgrstate.keynames) {
        free(kmgrstate.keynames);
    }

    if(kmgrstate.keytypes) {
        free(kmgrstate.keytypes);
    }

    if(kmgrstate.keydata) {
        free(kmgrstate.keydata);
    }

    if(kmgrstate.filedata) {
        free(kmgrstate.filedata);
    }
}

// Assembly:
pushq %rax
movq 0x7616(%rip), %rdi      # 0xc330
testq %rdi, %rdi
je 0x4d24
callq 0x2030
movq 0x760d(%rip), %rdi      # 0xc338
testq %rdi, %rdi
je 0x4d35
callq 0x2030
movq 0x7604(%rip), %rdi      # 0xc340
testq %rdi, %rdi
je 0x4d46
callq 0x2030
movq 0x75fb(%rip), %rdi      # 0xc348
testq %rdi, %rdi
je 0x4d58
popq %rax
jmp 0x2030
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/keymgr.c
// Function: keymgr_printkeys
void keymgr_printkeys() {
    int i;

    printf("\nkey manager state:\n");
    for(i = 0; i < kmgrstate.numkeys; i++) {
        printf("\tname: '%s' keytype: 0x%X\n", kmgrstate.keynames[i], kmgrstate.keytypes[i]);
        //hexdump(kmgrstate.keydata[i], 0x10);
    }
    printf("\n");
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x4340(%rip), %rdi      # 0x90a5
callq 0x2060
cmpl $0x0, 0x75df(%rip)      # 0xc350
jle 0x4dac
leaq 0x42f6(%rip), %rbx      # 0x9070
xorl %r14d, %r14d
movq 0x75ac(%rip), %rax      # 0xc330
movq (%rax,%r14,8), %rsi
movq 0x75a9(%rip), %rax      # 0xc338
movl (%rax,%r14,4), %edx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x20b0
incq %r14
movslq 0x75a9(%rip), %rax      # 0xc350
cmpq %rax, %r14
jl 0x4d7d
movl $0xa, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2040
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/keymgr.c
// Function: keymgr_getkey
unsigned char *keymgr_getkey(const char *keyname, int keytype) {
    int i;

    for(i = 0; i < kmgrstate.numkeys; i++) {
        if(!strcmp(kmgrstate.keynames[i], keyname) && kmgrstate.keytypes[i] == keytype) {
            return kmgrstate.keydata[i];
        }
    }

    return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movslq 0x7581(%rip), %r15      # 0xc350
testq %r15, %r15
jle 0x4e08
movl %esi, %ebp
movq %rdi, %r14
movq 0x7550(%rip), %r12      # 0xc330
movq 0x7551(%rip), %r13      # 0xc338
xorl %ebx, %ebx
movq (%r12,%rbx,8), %rdi
movq %r14, %rsi
callq 0x2110
testl %eax, %eax
jne 0x4e00
cmpl %ebp, (%r13,%rbx,4)
je 0x4e19
incq %rbx
cmpq %rbx, %r15
jne 0x4de9
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x7520(%rip), %rax      # 0xc340
movq (%rax,%rbx,8), %rax
jmp 0x4e0a
nop
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/nvs.c
// Function: nvs_read
int nvs_read(unsigned char *flashdata, unsigned int bank, unsigned int block, unsigned int offset, int size, unsigned char *buffer) {
    if(bank != 0) {
        printf("error: invalid NVS bank number %i\n", bank);
        return 1;
    }

    if(block > 4) {
        printf("error: invalid NVS block number %i\n", block);
        return 1;
    }

    if(offset >= g_nvs_block_sizes[block]) {
        printf("error: invalid NVS offset 0x%X\n", offset);
        return 1;
    }

    memcpy(buffer, flashdata + g_nvs_block_offsets[block] + offset, size);

    return 0;
}

// Assembly:
pushq %rax
testl %esi, %esi
je 0x4e36
leaq 0x4285(%rip), %rdi      # 0x90b9
jmp 0x4e84
cmpl $0x5, %edx
jb 0x4e46
leaq 0x429a(%rip), %rdi      # 0x90dc
movl %edx, %esi
jmp 0x4e84
movl %edx, %edx
leaq 0x42d1(%rip), %rsi      # 0x9120
cmpl %ecx, (%rsi,%rdx,4)
jbe 0x4e7b
movq %rdi, %rax
leaq 0x42e2(%rip), %rsi      # 0x9140
movl (%rsi,%rdx,4), %edx
movl %ecx, %ecx
addq %rcx, %rax
addq %rdx, %rax
movslq %r8d, %rdx
movq %r9, %rdi
movq %rax, %rsi
callq 0x2140
xorl %eax, %eax
jmp 0x4e90
leaq 0x427e(%rip), %rdi      # 0x9100
movl %ecx, %esi
xorl %eax, %eax
callq 0x20b0
movl $0x1, %eax
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/nvs.c
// Function: nvs_write
int nvs_write(unsigned char *flashdata, unsigned int bank, unsigned int block, unsigned int offset, int size, unsigned char *buffer) {
    if(bank != 0) {
        printf("error: invalid NVS bank number %i\n", bank);
        return 1;
    }

    if(block > 4) {
        printf("error: invalid NVS block number %i\n", block);
        return 1;
    }

    if(offset >= g_nvs_block_sizes[block]) {
        printf("error: invalid NVS offset 0x%X\n", offset);
        return 1;
    }

    memcpy(flashdata + g_nvs_block_offsets[block] + offset, buffer, size);

    return 0;
}

// Assembly:
pushq %rax
testl %esi, %esi
je 0x4ea0
leaq 0x421b(%rip), %rdi      # 0x90b9
jmp 0x4ee8
cmpl $0x5, %edx
jb 0x4eb0
leaq 0x4230(%rip), %rdi      # 0x90dc
movl %edx, %esi
jmp 0x4ee8
movl %edx, %eax
leaq 0x4267(%rip), %rdx      # 0x9120
cmpl %ecx, (%rdx,%rax,4)
jbe 0x4edf
leaq 0x427b(%rip), %rdx      # 0x9140
movl (%rdx,%rax,4), %eax
movl %ecx, %ecx
addq %rcx, %rdi
addq %rax, %rdi
movslq %r8d, %rdx
movq %r9, %rsi
callq 0x2140
xorl %eax, %eax
jmp 0x4ef4
leaq 0x421a(%rip), %rdi      # 0x9100
movl %ecx, %esi
xorl %eax, %eax
callq 0x20b0
movl $0x1, %eax
popq %rcx
retq
nop
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/sha1.c
// Function: sha1_finish_ctx
void *
sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf)
{
  /* Take yet unprocessed bytes into account.  */
  uint32_t bytes = ctx->buflen;
  size_t size = (bytes < 56) ? 64 / 4 : 64 * 2 / 4;

  /* Now count remaining bytes.  */
  ctx->total[0] += bytes;
  if (ctx->total[0] < bytes)
    ++ctx->total[1];

  /* Put the 64-bit file length in *bits* at the end of the buffer.  */
  ctx->buffer[size - 2] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29));
  ctx->buffer[size - 1] = SWAP (ctx->total[0] << 3);

  memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 4 - bytes);

  /* Process last bytes.  */
  sha1_process_block (ctx->buffer, size * 4, ctx);

  return sha1_read_ctx (ctx, resbuf);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl 0x18(%rdi), %esi
movl 0x1c(%rdi), %eax
movl 0x14(%rdi), %ecx
addl %eax, %ecx
movl %ecx, 0x14(%rdi)
jae 0x4f5d
incl %esi
movl %esi, 0x18(%r14)
xorl %r15d, %r15d
cmpl $0x38, %eax
setae %r15b
shldl $0x3, %ecx, %esi
movl %esi, %edx
shll $0x18, %edx
movl %esi, %edi
shll $0x8, %edi
movl $0xff0000, %r8d         # imm = 0xFF0000
andl %r8d, %edi
orl %edx, %edi
movl %esi, %edx
shrl $0x8, %edx
movl $0xff00, %r9d           # imm = 0xFF00
andl %r9d, %edx
orl %edi, %edx
shrl $0x18, %esi
orl %edx, %esi
leaq 0x20(%r14), %r12
shll $0x6, %r15d
leal 0x38(%r15), %edx
movl %esi, 0x20(%r14,%rdx)
movl %ecx, %esi
shll $0x1b, %esi
movl %ecx, %edi
shll $0xb, %edi
andl %r8d, %edi
orl %esi, %edi
movl %ecx, %esi
shrl $0x5, %esi
andl %r9d, %esi
orl %edi, %esi
shrl $0x15, %ecx
movzbl %cl, %ecx
orl %esi, %ecx
movl %ecx, 0x5c(%r15,%r14)
leaq (%r14,%rax), %rdi
addq $0x20, %rdi
subq %rax, %rdx
leaq 0x41b2(%rip), %rsi      # 0x9190
callq 0x2140
addq $0x40, %r15
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x502f
movl (%r14), %eax
bswapl %eax
movl %eax, (%rbx)
movl 0x4(%r14), %eax
bswapl %eax
movl %eax, 0x4(%rbx)
movl 0x8(%r14), %eax
bswapl %eax
movl %eax, 0x8(%rbx)
movl 0xc(%r14), %eax
bswapl %eax
movl %eax, 0xc(%rbx)
movl 0x10(%r14), %eax
bswapl %eax
movl %eax, 0x10(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/sha1.c
// Function: sha1_buffer
void *
sha1_buffer (const char *buffer, size_t len, void *resblock)
{
  struct sha1_ctx ctx;

  /* Initialize the computation context.  */
  sha1_init_ctx (&ctx);

  /* Process whole buffer but last len % 64 bytes.  */
  sha1_process_bytes (buffer, len, &ctx);

  /* Put result in desired memory area.  */
  return sha1_finish_ctx (&ctx, resblock);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0xa8, %rsp
movq %rdx, %rbx
movaps 0x2edf(%rip), %xmm0     # 0x9160
movq %rsp, %r14
movaps %xmm0, (%r14)
movss 0x2ef0(%rip), %xmm0     # 0x9180
movaps %xmm0, 0x10(%r14)
movq %r14, %rdx
callq 0x62b6
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4f39
movq %rbx, %rax
addq $0xa8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/southbridge.c
// Function: flash_locate_emc_ipl
struct bldr_hdr *flash_locate_emc_ipl(unsigned char *flashdata, int forcehdr) {
    // reversed from EMC bootrom
    // I want to start calling the first header the meta header and then the second header the main header.
    // I cannot tell if the two slots for booting are for updates or for testkit/devkit vs retail?
    struct flashheader0 *hdr0 = NULL;
    struct flashheader1 *hdr1 = NULL;
    struct bldr_hdr *blhdr = NULL;
    unsigned char flag;
    int blocknum;

    hdr0 = (struct flashheader0 *)flashdata;

    if(verbose) {
        printf("* flash branding '%s'\n", hdr0->branding);
    }

    blocknum = hdr0->secondHeaderBlockNum2;
    flag = *(unsigned int *)(flashdata + (hdr0->headerInfoBlockNum * 0x200));
    if(!((flag >> 7) & 1)) {
        if(verbose && !forcehdr) {
            printf("* using header block num 1\n");
        }

        blocknum = hdr0->secondHeaderBlockNum1;
    } else if(verbose && !forcehdr) {
        printf("* using header block num 2\n");
    }

    hdr1 = (struct flashheader1 *)(flashdata + (blocknum * 0x200));
    blhdr = (struct bldr_hdr *)(flashdata + ((blocknum + hdr1->dataBlockNumber) * 0x200));
    
    if(blhdr->magic != BLDR_MAGIC) {
        printf("error: invalid EMC IPL bootloader header magic!\n");
        return NULL;
    }

    if(blhdr->type != BLDR_TYPE_EMC) {
        printf("error: invalid EMC IPL bootloader header type!\n");
        return NULL;
    }

    if(forcehdr == 1) {
        return (struct bldr_hdr *)(flashdata + ((hdr0->secondHeaderBlockNum1 + hdr1->dataBlockNumber) * 0x200));
    } else if(forcehdr == 2) {
        return (struct bldr_hdr *)(flashdata + ((hdr0->secondHeaderBlockNum2 + hdr1->dataBlockNumber) * 0x200));
    }

    return blhdr;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x5ef4(%rip), %r14      # 0xc324
cmpl $0x0, (%r14)
je 0x6447
leaq 0x2d93(%rip), %rdi      # 0x91d0
movq %rbx, %rsi
xorl %eax, %eax
callq 0x20b0
movl 0x34(%rbx), %ecx
shll $0x9, %ecx
cmpl $0x0, (%r14)
sete %dl
testl %ebp, %ebp
setne %al
orb %dl, %al
testb $-0x80, (%rbx,%rcx)
jne 0x6477
testb %al, %al
jne 0x6471
leaq 0x30bd(%rip), %rdi      # 0x9529
callq 0x2060
movl 0x24(%rbx), %r14d
jmp 0x648b
movl 0x28(%rbx), %r14d
testb %al, %al
jne 0x648b
leaq 0x30be(%rip), %rdi      # 0x9544
callq 0x2060
movslq %r14d, %rax
movq %rax, %rcx
shlq $0x9, %rcx
movl 0x30(%rbx,%rcx), %ecx
addl %ecx, %eax
shll $0x9, %eax
cmpl $0xd48ff9aa, (%rbx,%rax) # imm = 0xD48FF9AA
jne 0x64bf
addq %rbx, %rax
cmpb $0x48, 0x7(%rax)
jne 0x64c8
cmpl $0x2, %ebp
je 0x64db
cmpl $0x1, %ebp
jne 0x64d6
addl 0x24(%rbx), %ecx
jmp 0x64de
leaq 0x30c8(%rip), %rdi      # 0x958e
jmp 0x64cf
leaq 0x3090(%rip), %rdi      # 0x955f
callq 0x2060
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
addl 0x28(%rbx), %ecx
shll $0x9, %ecx
addq %rbx, %rcx
movq %rcx, %rax
jmp 0x64d6
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/southbridge.c
// Function: flash_locate_eap_kbl
struct bldr_hdr *flash_locate_eap_kbl(unsigned char *flashdata) {
    struct bldr_hdr *blhdr = NULL;
    struct slb2_header *slbhdr = (struct slb2_header *)(flashdata + 0xC4000);
    struct slb2_entry *entry = NULL;
    int i;

    if(slbhdr->magic != SLB2_MAGIC) {
        printf("error: invalid KBL SLB2 magic!\n");
        return NULL;
    }

    for(i = 0; i < slbhdr->file_count; i++) {
        entry = &slbhdr->entry_list[i];

        if(!strcmp(entry->file_name, "C0010001") || !strcmp(entry->file_name, "eap_kbl")) {
            break;
        }
    }
    
    return (struct bldr_hdr *)(flashdata + 0xC4000 + (entry->block_offset << 9));
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
cmpl $0x32424c53, 0xc4000(%rdi) # imm = 0x32424C53
jne 0x655f
leaq 0xc4000(%rdi), %rbx
movl 0xc400c(%rdi), %r13d
decq %r13
addq $0xc4030, %rdi          # imm = 0xC4030
leaq 0x1f5f(%rip), %r14      # 0x847c
leaq 0x2cc3(%rip), %r15      # 0x91e7
movq %rdi, %r12
movq %r14, %rsi
callq 0x2110
testl %eax, %eax
je 0x6552
movq %r12, %rdi
movq %r15, %rsi
callq 0x2110
subq $0x1, %r13
setb %cl
testl %eax, %eax
je 0x6552
leaq 0x30(%r12), %rdi
testb %cl, %cl
je 0x6524
movl -0x10(%r12), %eax
shll $0x9, %eax
addq %rax, %rbx
jmp 0x656d
leaq 0x3058(%rip), %rdi      # 0x95be
callq 0x2060
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/southbridge.c
// Function: decrypt_emc_ipl
int decrypt_emc_ipl(unsigned char *flashdata, unsigned char **data, unsigned int *length) {
    struct bldr_hdr *blhdr = flash_locate_emc_ipl(flashdata, 0);
    unsigned char *hdraeskey = keymgr_getkey("emciplaes", KEY_TYPE_AES_128);
    
    if(verbose) {
        printf("* EMC IPL header aes key: ");
        hexdump(hdraeskey, 0x10, 0);
    }

    struct bldr_hdr dechdr;
    unsigned char *decbody = (unsigned char *)malloc(blhdr->body_len);

    // copy the header on to the stack, we dont want to modify anything
    memcpy(&dechdr, blhdr, blhdr->hdr_len);
    aes128_cbc_iv_zero_decrypt(hdraeskey, &blhdr->crypteddata, &dechdr.crypteddata, 0x50);
    aes128_cbc_iv_zero_decrypt(dechdr.crypteddata.iplbodyaeskey, &blhdr->bodystart, decbody, blhdr->body_len);

    if(data) {
        *data = decbody;
    }

    if(length) {
        *length = blhdr->body_len;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, %rbx
movq %rsi, %r14
xorl %esi, %esi
callq 0x6420
movq %rax, %r15
leaq 0x2a36(%rip), %rdi      # 0x91ef
movl $0xa1, %esi
callq 0x4dbd
movq %rax, %r12
leaq 0x5b57(%rip), %rax      # 0xc324
cmpl $0x0, (%rax)
je 0x67ef
leaq 0x2a2b(%rip), %rdi      # 0x9204
xorl %eax, %eax
callq 0x20b0
movq %r12, %rdi
movl $0x10, %esi
xorl %edx, %edx
callq 0x38a5
movl 0xc(%r15), %edi
callq 0x2150
movq %rax, %r13
movl 0x8(%r15), %edx
leaq 0x7(%rsp), %rdi
movq %r15, %rsi
callq 0x2140
leaq 0x30(%r15), %rsi
leaq 0x37(%rsp), %rbp
movq %r12, %rdi
movq %rbp, %rdx
movl $0x50, %ecx
callq 0x2cf4
movq %r15, %rsi
subq $-0x80, %rsi
movl 0xc(%r15), %ecx
movq %rbp, %rdi
movq %r13, %rdx
callq 0x2cf4
testq %r14, %r14
je 0x6843
movq %r13, (%r14)
testq %rbx, %rbx
je 0x684e
movl 0xc(%r15), %eax
movl %eax, (%rbx)
xorl %eax, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/jogolden[P]ps4flashtool/southbridge.c
// Function: decrypt_eap_kbl
int decrypt_eap_kbl(unsigned char *flashdata, unsigned char **data, unsigned int *length) {
    struct bldr_hdr *blhdr = flash_locate_eap_kbl(flashdata);
    unsigned char *hdraeskey = keymgr_getkey("eapkblaes", KEY_TYPE_AES_128);
    
    if(verbose) {
        printf("* EAP KBL header aes key: ");
        hexdump(hdraeskey, 0x10, 0);
    }

    struct bldr_hdr dechdr;
    unsigned char *decbody = (unsigned char *)malloc(blhdr->body_len);

    // copy the header on to the stack, we dont want to modify anything
    memcpy(&dechdr, blhdr, blhdr->hdr_len);
    aes128_cbc_iv_zero_decrypt(hdraeskey, &blhdr->crypteddata, &dechdr.crypteddata, 0x50);
    aes128_cbc_iv_zero_decrypt(dechdr.crypteddata.iplbodyaeskey, &blhdr->bodystart, decbody, blhdr->body_len);

    if(data) {
        *data = decbody;
    }

    if(length) {
        *length = blhdr->body_len;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rdx, %rbx
movq %rsi, %r15
callq 0x64e9
movq %rax, %r14
leaq 0x2745(%rip), %rdi      # 0x938c
movl $0xa1, %esi
callq 0x4dbd
movq %rax, %r12
leaq 0x56c9(%rip), %rax      # 0xc324
cmpl $0x0, (%rax)
je 0x6c7d
leaq 0x273a(%rip), %rdi      # 0x93a1
xorl %eax, %eax
callq 0x20b0
movq %r12, %rdi
movl $0x10, %esi
xorl %edx, %edx
callq 0x38a5
movl 0xc(%r14), %edi
callq 0x2150
movq %rax, %r13
movl 0x8(%r14), %edx
leaq 0x7(%rsp), %rdi
movq %r14, %rsi
callq 0x2140
leaq 0x30(%r14), %rsi
leaq 0x37(%rsp), %rbp
movq %r12, %rdi
movq %rbp, %rdx
movl $0x50, %ecx
callq 0x2cf4
movq %r14, %rsi
subq $-0x80, %rsi
movl 0xc(%r14), %ecx
movq %rbp, %rdi
movq %r13, %rdx
callq 0x2cf4
testq %r15, %r15
je 0x6cd1
movq %r13, (%r15)
testq %rbx, %rbx
je 0x6cdc
movl 0xc(%r14), %eax
movl %eax, (%rbx)
xorl %eax, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/Tarsnap[P]libcperciva/tests/optional_mutex/pthread/../main.c
// Function: inc_dec_counter
static void *
inc_dec_counter(void * cookie)
{
	int i;
	int rc;

	(void)cookie; /* UNUSED */

	for (i = 0; i < NUM_TIMES; i++) {
		/* Lock if we're using pthread. */
		if ((rc = optional_mutex_lock(&mutex)) != 0) {
			warn0("optional_mutex_lock: %s", strerror(rc));
			goto err0;
		}

		/* Increment, wait, decrement value. */
		value++;
		millisleep(10);
		value--;

		/* Increment overall counter. */
		counter++;

		/* Unlock if we're using pthread. */
		if ((rc = optional_mutex_unlock(&mutex)) != 0) {
			warn0("optional_mutex_unlock: %s", strerror(rc));
			goto err0;
		}
	}

	/* Success! */
	return (NULL);

err0:
	/* Failure! */
	pthread_exit(NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movl $0x64, %ebp
leaq 0x2c44(%rip), %r14      # 0x40e8
leaq 0xb7d(%rip), %rbx       # 0x2028
movq %rsp, %r15
leaq 0xb8b(%rip), %r12       # 0x2040
movq %r14, %rdi
callq 0x17fc
testl %eax, %eax
jne 0x1510
incl 0x2c49(%rip)            # 0x4110
movq $0x0, (%rsp)
movq $0x989680, 0x8(%rsp)    # imm = 0x989680
movq %r15, %rdi
xorl %esi, %esi
callq 0x1080
decl 0x2c28(%rip)            # 0x4110
incl 0x2c26(%rip)            # 0x4114
movq %r14, %rdi
callq 0x1801
testl %eax, %eax
jne 0x150d
decl %ebp
jne 0x14b5
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rbx
movl %eax, %edi
callq 0x1170
movq %rbx, %rdi
movq %rax, %rsi
xorl %eax, %eax
callq 0x16d7
callq 0x1060
movl $0x0, (%rax)
xorl %edi, %edi
callq 0x10e0
nop
// File: /workspace/github_c_makefile_star2_O3/ramirezsebas[P]TP-LISTINGS/./src/capitulo_4/4.5/detached.c
// Function: main
int main ()
{
	pthread_attr_t attr;
	pthread_t thread;
	pthread_attr_init (&attr);
	pthread_attr_setdetachstate (&attr, PTHREAD_CREATE_DETACHED);
	pthread_create (&thread, &attr, &thread_function, NULL);
	pthread_attr_destroy (&attr);

	/* Do work here...*/

	struct DatosCliente cliente;
	FILE *cuentaPtr, *salida;

	salida = fopen("deudas_altas.txt", "w");
	
	if ((cuentaPtr = fopen("../../src/capitulo_4/4.5/cliente.dat","r")) == NULL)
		printf("No se puede abrir el archivo\n");
	else
	{
		while (!feof(cuentaPtr))
		{
			fread(&cliente, sizeof(struct DatosCliente), 1, cuentaPtr);
			if (cliente.id != 0){
				if(cliente.deuda > 6000.0)
					fprintf(salida, "%d; %s; %.2f\n", cliente.id,cliente.nombre, cliente.deuda);
			}
		}
	}
	fclose(cuentaPtr);
	fclose(salida);

	while(!complete);

	/* No need to join the second thread.*/

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
leaq -0xa8(%rbp), %rbx
movq %rbx, %rdi
callq 0x1070
movq %rbx, %rdi
movl $0x1, %esi
callq 0x10a0
leaq -0x12f(%rip), %rdx      # 0x11dc
leaq -0x30(%rbp), %rdi
movq %rbx, %rsi
xorl %ecx, %ecx
callq 0x10b0
movq %rbx, %rdi
callq 0x10d0
leaq 0xd32(%rip), %rdi       # 0x205a
leaq 0xce9(%rip), %rsi       # 0x2018
callq 0x10c0
movq %rax, %rbx
leaq 0xcdc(%rip), %rdi       # 0x201a
leaq 0xcfa(%rip), %rsi       # 0x203f
callq 0x10c0
movq %rax, %r14
testq %rax, %rax
je 0x13b9
movq %r14, %rdi
callq 0x1090
testl %eax, %eax
jne 0x13c5
leaq -0x68(%rbp), %r15
leaq -0x6c(%rbp), %r12
leaq 0xcfe(%rip), %r13       # 0x206b
movl $0x3c, %esi
movl $0x1, %edx
movq %r12, %rdi
movq %r14, %rcx
callq 0x1040
movl -0x6c(%rbp), %edx
testl %edx, %edx
je 0x13ab
movss -0x34(%rbp), %xmm0
ucomiss 0xc6f(%rip), %xmm0      # 0x2004
jbe 0x13ab
cvtss2sd %xmm0, %xmm0
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rcx
movb $0x1, %al
callq 0x1080
movq %r14, %rdi
callq 0x1090
testl %eax, %eax
je 0x136d
jmp 0x13c5
leaq 0xcb9(%rip), %rdi       # 0x2079
callq 0x1030
movq %r14, %rdi
callq 0x1050
movq %rbx, %rdi
callq 0x1050
xorl %eax, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/mesbahamin[P]star-sim/src/star.c
// Function: star_accelerate
void star_accelerate(struct Star *s, float angle, float acceleration)
{
    struct Vec2d *new_vec = vec2d_add(s->angle, s->speed, angle, acceleration);
    s->angle = new_vec->angle;
    s->speed = new_vec->length;
    free(new_vec);
}

// Assembly:
pushq %rbx
movaps %xmm1, %xmm3
movaps %xmm0, %xmm2
movq %rdi, %rbx
movss (%rdi), %xmm0
movss 0x4(%rdi), %xmm1
callq 0x284c
movss (%rax), %xmm0
movss %xmm0, (%rbx)
movss 0x4(%rax), %xmm0
movss %xmm0, 0x4(%rbx)
movq %rax, %rdi
popq %rbx
jmp 0x11a0
// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/src/redis-cli.c
// Function: cliRefreshPrompt
static void cliRefreshPrompt(void) {
    int len;

    if (config.hostsocket != NULL)
        len = snprintf(config.prompt,sizeof(config.prompt),"redis %s",
                       config.hostsocket);
    else
        len = snprintf(config.prompt,sizeof(config.prompt),
                       strchr(config.hostip,':') ? "[%s]:%d" : "%s:%d",
                       config.hostip, config.hostport);
    /* Add [dbnum] if needed */
    if (config.dbnum != 0)
        len += snprintf(config.prompt+len,sizeof(config.prompt)-len,"[%d]",
            config.dbnum);
    snprintf(config.prompt+len,sizeof(config.prompt)-len,"> ");
}

// Assembly:
pushq %rbx
movq 0x30f33(%rip), %rcx     # 0x43d48
testq %rcx, %rcx
je 0x12e36
leaq 0x30fb7(%rip), %rdi     # 0x43dd8
leaq 0x20b39(%rip), %rdx     # 0x33961
movl $0x80, %esi
xorl %eax, %eax
callq 0xd1e0
jmp 0x12e7c
movq 0x30efb(%rip), %rbx     # 0x43d38
movq %rbx, %rdi
movl $0x3a, %esi
callq 0xd1c0
testq %rax, %rax
leaq 0x20b1e(%rip), %rax     # 0x33972
leaq 0x20b0f(%rip), %rdx     # 0x3396a
cmoveq %rax, %rdx
movl 0x30eda(%rip), %r8d     # 0x43d40
leaq 0x30f6b(%rip), %rdi     # 0x43dd8
movl $0x80, %esi
movq %rbx, %rcx
xorl %eax, %eax
callq 0xd1e0
movl %eax, %ebx
movl 0x30edc(%rip), %ecx     # 0x43d60
testl %ecx, %ecx
je 0x12eb5
movslq %ebx, %rbx
leaq 0x30ea6(%rip), %rax     # 0x43d38
leaq (%rbx,%rax), %rdi
addq $0xa0, %rdi
movl $0x80, %esi
subq %rbx, %rsi
leaq 0x20acc(%rip), %rdx     # 0x33978
xorl %eax, %eax
callq 0xd1e0
addl %eax, %ebx
movslq %ebx, %rax
leaq 0x30e79(%rip), %rcx     # 0x43d38
leaq (%rax,%rcx), %rdi
addq $0xa0, %rdi
movl $0x80, %esi
subq %rax, %rsi
leaq 0x21227(%rip), %rdx     # 0x34100
xorl %eax, %eax
popq %rbx
jmp 0xd1e0
// File: /workspace/github_c_makefile_star2_O3/sos22[P]unexec/unexec.c
// Function: alloc_with_mmap
static void * alloc_with_mmap(size_t sz) {
    sz = (sz + sizeof(size_t) + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1);
    void * res = mmap(NULL,
                      sz,
                      PROT_READ|PROT_WRITE,
                      MAP_PRIVATE|MAP_ANONYMOUS,
                      -1,
                      0);
    assert(res != MAP_FAILED);
    size_t * res_sz = res;
    res_sz[0] = sz;
    return res_sz + 1; }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
addq $0x1007, %rbx           # imm = 0x1007
andq $-0x1000, %rbx          # imm = 0xF000
xorl %edi, %edi
movq %rbx, %rsi
movl $0x3, %edx
movl $0x22, %ecx
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
xorl %r9d, %r9d
callq 0x1080
cmpq $-0x1, %rax
je 0x249a
movq %rbx, (%rax)
addq $0x8, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
leaq 0xc1c(%rip), %rdi       # 0x30bd
leaq 0xb76(%rip), %rsi       # 0x301e
leaq 0xc20(%rip), %rcx       # 0x30cf
movl $0x6c, %edx
callq 0x10a0
// File: /workspace/github_c_makefile_star2_O3/sos22[P]unexec/unexec.c
// Function: alloc_in_trampoline
static void * alloc_in_trampoline(size_t sz, struct trampoline * tramp) {
    static char failure[PAGE_SIZE];
    assert(sz < sizeof(failure));
    tramp->used += sz;
    if (tramp->used > tramp->allocated) return failure;
    else return tramp->allocator + tramp->used - sz; }

// Assembly:
cmpq $0x1000, %rdi           # imm = 0x1000
jae 0x24e3
movl 0x4(%rsi), %eax
addl %edi, %eax
movl %eax, 0x4(%rsi)
leaq (%rax,%rsi), %rcx
subq %rdi, %rcx
subq $-0x80, %rcx
cmpl (%rsi), %eax
leaq 0x2c02(%rip), %rax      # 0x50e0
cmovbeq %rcx, %rax
retq
pushq %rbp
movq %rsp, %rbp
leaq 0xc74(%rip), %rdi       # 0x3162
leaq 0xb29(%rip), %rsi       # 0x301e
leaq 0xc7b(%rip), %rcx       # 0x3177
movl $0x8f, %edx
callq 0x10a0
// File: /workspace/github_c_makefile_star2_O3/Cotix[P]cReddit/libreddit/comment.c
// Function: redditCommentFreeChildren
static void redditCommentFreeChildren (RedditComment *comment)
{
    int i;
    if (comment == NULL || comment->directChildrenIds == NULL)
        return ;

    for (i = 0; i < comment->directChildrenCount; i++)
        free(comment->directChildrenIds[i]);

    free(comment->directChildrenIds);
    comment->directChildrenIds = NULL;
}

// Assembly:
testq %rdi, %rdi
je 0x242e
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x70(%rdi), %rdi
testq %rdi, %rdi
je 0x2427
cmpl $0x0, 0x60(%rbx)
jle 0x241a
xorl %r14d, %r14d
movq 0x70(%rbx), %rax
movq (%rax,%r14,8), %rdi
callq 0x2040
incq %r14
movslq 0x60(%rbx), %rax
cmpq %rax, %r14
jl 0x23fd
movq 0x70(%rbx), %rdi
callq 0x2040
movq $0x0, 0x70(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/Cotix[P]cReddit/libreddit/comment.c
// Function: redditCommentAddReply
EXPORT_SYMBOL void redditCommentAddReply (RedditComment *comment, RedditComment *reply)
{
    comment->replyCount++;
    RedditComment* ptr = comment;
    while (ptr != NULL) {
        ptr->totalReplyCount += reply->totalReplyCount + 1;
        ptr = ptr->parent;
    }
    comment->replies = rrealloc(comment->replies, (comment->replyCount) * sizeof(RedditComment*));
    comment->replies[comment->replyCount - 1] = reply;
    reply->parent = comment;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movslq (%rdi), %rsi
incq %rsi
movl %esi, (%rdi)
movq %rdi, %rax
movl 0x5c(%rbx), %ecx
movl 0x5c(%rax), %edx
addl %edx, %ecx
incl %ecx
movl %ecx, 0x5c(%rax)
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x2444
movq 0x8(%r14), %rdi
shlq $0x3, %rsi
callq 0x3537
movq %rax, 0x8(%r14)
movslq (%r14), %rcx
movq %rbx, -0x8(%rax,%rcx,8)
movq %r14, 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/Cotix[P]cReddit/libreddit/comment.c
// Function: redditCommentListFree
EXPORT_SYMBOL void redditCommentListFree (RedditCommentList *list)
{
    if (list == NULL)
        return ;
    redditCommentFree(list->baseComment);
    redditLinkFree(list->post);
    free(list->permalink);
    free(list->id);
    free(list);
}

// Assembly:
testq %rdi, %rdi
je 0x24cb
pushq %rbx
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x20d0
movq 0x8(%rbx), %rdi
callq 0x2170
movq 0x10(%rbx), %rdi
callq 0x2040
movq 0x18(%rbx), %rdi
callq 0x2040
movq %rbx, %rdi
popq %rbx
jmp 0x2040
retq
// File: /workspace/github_c_makefile_star2_O3/Cotix[P]cReddit/libreddit/comment.c
// Function: getCommentReplies
DEF_TOKEN_CALLBACK(getCommentReplies)
{
    ARG_COMMENT_LISTING
    char *kindStr = NULL;

    TokenIdent ids[] = {
        ADD_TOKEN_IDENT_STRING("kind", kindStr),
        ADD_TOKEN_IDENT_FUNC  ("data", getCommentListHelper),
        {0}
    };

    parseTokens(parser, ids, list, comment);
    free(kindStr);
}

// Assembly:
movq %rdx, %rax
movl (%rdx), %esi
cmpq $0x29, %rsi
jae 0x2892
movq 0x10(%rax), %rdx
movq %rsi, %rcx
addq $0x8, %rcx
movl %ecx, (%rax)
movq (%rdx,%rsi), %rdx
cmpl $0x20, %esi
ja 0x28a1
addq 0x10(%rax), %rcx
addl $0x10, %esi
movl %esi, (%rax)
jmp 0x28ad
movq 0x8(%rax), %rcx
leaq 0x8(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq (%rcx), %rdx
movq 0x8(%rax), %rcx
leaq 0x8(%rcx), %rsi
movq %rsi, 0x8(%rax)
pushq %rbx
subq $0xc0, %rsp
movq (%rcx), %rcx
xorl %eax, %eax
leaq 0x8(%rsp), %rbx
movq %rax, (%rbx)
leaq 0x383d(%rip), %r8       # 0x6106
leaq 0x10(%rsp), %rsi
movq %r8, (%rsi)
movq $0x2, 0x8(%rsi)
movq %rbx, 0x10(%rsi)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rsi)
movl $0x0, 0x28(%rsi)
movb $0x1, 0x2c(%rsi)
movq %rax, 0x30(%rsi)
leaq 0x3811(%rip), %r8       # 0x610b
movq %r8, 0x38(%rsi)
movabsq $0x200000003, %r8       # imm = 0x200000003
movq %r8, 0x40(%rsi)
movups %xmm0, 0x48(%rsi)
movups %xmm0, 0x55(%rsi)
leaq 0x1ba(%rip), %r8        # 0x2ad5
movq %r8, 0x68(%rsi)
movaps %xmm0, 0x70(%rsi)
movaps %xmm0, 0x80(%rsi)
movaps %xmm0, 0x90(%rsi)
movq %rax, 0xa0(%rsi)
xorl %eax, %eax
callq 0x495b
movq (%rbx), %rdi
callq 0x2040
addq $0xc0, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O3/Cotix[P]cReddit/libreddit/comment.c
// Function: redditGetCommentList
EXPORT_SYMBOL RedditErrno redditGetCommentList (RedditCommentList *list)
{
    char fullLink[2048], *kindStr = NULL;
    TokenParserResult res;

    TokenIdent ids[] = {
        ADD_TOKEN_IDENT_STRING("id",   list->id),
        ADD_TOKEN_IDENT_STRING("kind", kindStr),
        ADD_TOKEN_IDENT_FUNC  ("data", getCommentListHelper),
        {0}
    };

    strcpy(fullLink, REDDIT_URL);
    strcat(fullLink, list->permalink);
    strcat(fullLink, REDDIT_JSON);

    if (list->baseComment == NULL)
        list->baseComment = redditCommentNew();

    res = redditRunParser(fullLink, NULL, ids, list, list->baseComment);

    free(kindStr);

    if (res == TOKEN_PARSER_SUCCESS)
        return REDDIT_SUCCESS;
    else
        return REDDIT_ERROR_RESPONSE;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x8f8, %rsp            # imm = 0x8F8
movq %rdi, %rbx
xorl %eax, %eax
leaq 0x8(%rsp), %rcx
movq %rax, (%rcx)
leaq 0x3747(%rip), %rdx      # 0x60b5
movq %rdx, 0x10(%rsp)
movl $0x2, %edx
movq %rdx, 0x18(%rsp)
leaq 0x18(%rdi), %rsi
movq %rsi, 0x20(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x28(%rsp)
movl %eax, 0x38(%rsp)
movb $0x1, %sil
movb %sil, 0x3c(%rsp)
movq %rax, 0x40(%rsp)
leaq 0x3760(%rip), %rdi      # 0x6106
movq %rdi, 0x48(%rsp)
movq %rdx, 0x50(%rsp)
movq %rcx, 0x58(%rsp)
movaps %xmm0, 0x60(%rsp)
movl %eax, 0x70(%rsp)
movb %sil, 0x74(%rsp)
movq %rax, 0x78(%rsp)
leaq 0x373c(%rip), %rcx      # 0x610b
movq %rcx, 0x80(%rsp)
movabsq $0x200000003, %rcx      # imm = 0x200000003
movq %rcx, 0x88(%rsp)
movups %xmm0, 0x9d(%rsp)
movaps %xmm0, 0x90(%rsp)
leaq 0xd5(%rip), %rcx        # 0x2ad5
movq %rcx, 0xb0(%rsp)
movups %xmm0, 0xb8(%rsp)
movups %xmm0, 0xc8(%rsp)
movups %xmm0, 0xd8(%rsp)
movq %rax, 0xe8(%rsp)
movabsq $0x6d6f632e746964, %rax # imm = 0x6D6F632E746964
leaq 0xf0(%rsp), %r14
movq %rax, 0xe(%r14)
movups 0x36cb(%rip), %xmm0     # 0x6110
movaps %xmm0, (%r14)
movq 0x10(%rbx), %rsi
movq %r14, %rdi
callq 0x2220
movq %r14, %rdi
callq 0x20b0
movl $0x6f736a2e, 0xf0(%rsp,%rax) # imm = 0x6F736A2E
movw $0x6e, 0xf4(%rsp,%rax)
movq (%rbx), %r14
testq %r14, %r14
jne 0x2a99
movl $0x88, %edi
callq 0x3520
movq %rax, %r14
movl $0x88, %edx
movq %rax, %rdi
xorl %esi, %esi
callq 0x20e0
movq %r14, (%rbx)
leaq 0xf0(%rsp), %rdi
leaq 0x10(%rsp), %rdx
xorl %esi, %esi
movq %rbx, %rcx
movq %r14, %r8
xorl %eax, %eax
callq 0x4c8e
xorl %ebx, %ebx
testl %eax, %eax
setne %bl
movq 0x8(%rsp), %rdi
callq 0x2040
addl %ebx, %ebx
movl %ebx, %eax
addq $0x8f8, %rsp            # imm = 0x8F8
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/Cotix[P]cReddit/libreddit/comment.c
// Function: redditGetCommentChildren
EXPORT_SYMBOL RedditErrno redditGetCommentChildren (RedditCommentList *list, RedditComment *parent)
{
    TokenParserResult res;
    char postText[4096];
    int i, endCount, children;
    int preCheck;

    TokenIdent ids[] = {
        ADD_TOKEN_IDENT_FUNC  ("things", getMoreChildren),
        {0}
    };

    sprintf(postText, "api_type=json&link_id=t3_%s&children=", list->post->id);
    if (parent->directChildrenCount > 20)
        children = 20;
    else
        children = parent->directChildrenCount;

    if (children == 0)
        return REDDIT_ERROR;

    strcat(postText, parent->directChildrenIds[0]);
    for (i = 1; i < children; i++) {
        strcat(postText, ",");
        strcat(postText, parent->directChildrenIds[i]);
    }

    preCheck = parent->totalReplyCount;

    res = redditRunParser(REDDIT_API_MORECHILDREN, postText, ids, list, parent);

    if (preCheck == parent->totalReplyCount)
        parent->totalReplyCount -= children;

    endCount = parent->directChildrenCount - children;
    for (i = parent->directChildrenCount - 1; i >= endCount; i--)
        free(parent->directChildrenIds[i]);

    parent->directChildrenCount = endCount;

    if (res == TOKEN_PARSER_SUCCESS)
        return REDDIT_SUCCESS;
    else
        return REDDIT_ERROR_RESPONSE;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1088, %rsp           # imm = 0x1088
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x601a(%rip), %rsi      # 0x8cf0
leaq 0x10(%rsp), %rdi
movl $0xe, %ecx
rep  movsq (%rsi), %es:(%rdi)
movq 0x8(%r14), %rax
movq 0x8(%rax), %rdx
leaq 0x343b(%rip), %rsi      # 0x612d
leaq 0x80(%rsp), %rdi
xorl %eax, %eax
callq 0x2230
movl 0x60(%rbx), %r12d
cmpl $0x14, %r12d
movl $0x14, %eax
cmovll %r12d, %eax
testl %r12d, %r12d
je 0x2de9
movl %eax, 0x4(%rsp)
movq %r14, 0x8(%rsp)
movq 0x70(%rbx), %rbp
movq (%rbp), %rsi
leaq 0x80(%rsp), %rdi
callq 0x2220
cmpl $0x2, %r12d
jl 0x2d79
movl 0x4(%rsp), %r14d
movl $0x1, %r13d
leaq 0x80(%rsp), %r15
movq %r15, %rdi
callq 0x20b0
movw $0x2c, 0x80(%rsp,%rax)
movq (%rbp,%r13,8), %rsi
movq %r15, %rdi
callq 0x2220
incq %r13
cmpq %r13, %r14
jne 0x2d52
movl 0x5c(%rbx), %r14d
leaq 0x33cf(%rip), %rdi      # 0x6153
leaq 0x80(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq 0x8(%rsp), %rcx
movq %rbx, %r8
xorl %eax, %eax
callq 0x4c8e
movl %eax, %ebp
cmpl 0x5c(%rbx), %r14d
movl 0x4(%rsp), %eax
jne 0x2db3
subl %eax, %r14d
movl %r14d, 0x5c(%rbx)
movslq 0x60(%rbx), %r14
cltq
movq %r14, %r15
subq %rax, %r15
testl %r12d, %r12d
jle 0x2dda
movq 0x70(%rbx), %rax
movq -0x8(%rax,%r14,8), %rdi
decq %r14
callq 0x2040
cmpq %r15, %r14
jg 0x2dc4
movl %r15d, 0x60(%rbx)
xorl %eax, %eax
testl %ebp, %ebp
setne %al
addl %eax, %eax
jmp 0x2dee
movl $0x1, %eax
addq $0x1088, %rsp           # imm = 0x1088
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq