LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/tudurom[P]disputils/ppd.c
// Function: main
int
main(int argc, char *argv[])
{
#ifdef __OpenBSD__
	if (pledge("stdio rpath unix", NULL) == -1)
		err(1, "pledge");
#endif
	xcb_randr_get_output_primary_reply_t *primary_output;

	if (argc > 1)
		usage(argv[0]);
	init_xcb(&conn);
	get_screen(conn, &scrn);

	primary_output = get_primary_output(conn);

	printf("%s\n", get_output_name(conn, primary_output->output));
	return 0;
}

// Assembly:
pushq %rax
cmpl $0x2, %edi
jge 0x1381
leaq 0x2de6(%rip), %rdi      # 0x4128
callq 0x139c
movq 0x2dda(%rip), %rdi      # 0x4128
leaq 0x2ddb(%rip), %rsi      # 0x4130
callq 0x13da
movq 0x2dc7(%rip), %rdi      # 0x4128
callq 0x15e8
movq 0x2dbb(%rip), %rdi      # 0x4128
movl 0x8(%rax), %esi
callq 0x14dd
movq %rax, %rdi
callq 0x1050
xorl %eax, %eax
popq %rcx
retq
movq (%rsi), %rsi
leaq 0xc79(%rip), %rdi       # 0x2004
xorl %eax, %eax
callq 0x10c0
xorl %edi, %edi
callq 0x11e0
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/kyz[P]amostools/./fileio.c
// Function: read_file
void *read_file(char *name, size_t *length) {
    void *mem = NULL;
    FILE *fh = NULL;
    struct stat s;
    size_t len;

    if (!stat(name, &s)) {
        if (S_ISDIR(s.st_mode)) {
            errno = EISDIR;
        }
        else {
            len = (size_t) s.st_size;
            if ((mem = malloc(len)) &&
                (fh = fopen(name, "rb")) &&
                fread(mem, 1, len, fh) == len)
            {
                if (length) *length = len;
                fclose(fh);
                return mem;
            }
        }
    }

    if (mem) free(mem);
    if (fh) fclose(fh);
    perror(name);
    return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x90, %rsp
movq %rsi, %r15
movq %rdi, %rbx
movq %rsp, %rsi
callq 0x10f0
testl %eax, %eax
jne 0x12ef
movl $0xf000, %eax           # imm = 0xF000
andl 0x18(%rsp), %eax
cmpl $0x4000, %eax           # imm = 0x4000
je 0x12e4
movq 0x30(%rsp), %r13
movq %r13, %rdi
callq 0x1110
testq %rax, %rax
je 0x12ef
movq %rax, %r14
leaq 0x1d5a(%rip), %rsi      # 0x3004
movq %rbx, %rdi
callq 0x1120
testq %rax, %rax
je 0x12f2
movq %rax, %r12
movl $0x1, %esi
movq %r14, %rdi
movq %r13, %rdx
movq %rax, %rcx
callq 0x1080
cmpq %r13, %rax
jne 0x12f5
testq %r15, %r15
je 0x12da
movq %r13, (%r15)
movq %r12, %rdi
callq 0x10a0
jmp 0x131a
callq 0x1050
movl $0x15, (%rax)
xorl %r14d, %r14d
xorl %r12d, %r12d
testq %r14, %r14
je 0x1302
movq %r14, %rdi
callq 0x1030
testq %r12, %r12
je 0x130f
movq %r12, %rdi
callq 0x10a0
movq %rbx, %rdi
callq 0x1130
xorl %r14d, %r14d
movq %r14, %rax
addq $0x90, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/kyz[P]amostools/./fileio.c
// Function: write_file
int write_file(char *name, void *mem, size_t length) {
    FILE *fh;
    int ok = 0;
    if ((fh = fopen(name, "wb"))) {
        ok = (fwrite(mem, 1, length, fh) == length);
        fclose(fh);
    }
    if (!ok) {
        perror(name);
    }
    return ok;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r14
movq %rsi, %r12
movq %rdi, %rbx
leaq 0x1cc1(%rip), %rsi      # 0x3007
callq 0x1120
testq %rax, %rax
je 0x1379
movq %rax, %r15
movl $0x1, %esi
movq %r12, %rdi
movq %r14, %rdx
movq %rax, %rcx
callq 0x1140
xorl %ebp, %ebp
cmpq %r14, %rax
sete %bpl
movq %r15, %rdi
callq 0x10a0
jmp 0x137b
xorl %ebp, %ebp
testl %ebp, %ebp
je 0x138a
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x1130
jmp 0x137f
// File: /workspace/github_c_makefile_star2_O1/kyz[P]amostools/dumpamos.c
// Function: output_fname
char *output_fname(char *fname, char *fmt, ...) {
    size_t namelen = strlen(fname), i;
    char *name = malloc(namelen + 202);
    va_list args;

    if (!name) {
        perror(fname);
        return NULL;
    }

    *name = 0;
    if (use_prefix) {
        /* prefix input filename, with .amos/.abk/.abs stripped off */
        char *extensions[] = {".amos", ".abk", ".abs"};
        strcpy(name, fname);
        for (i = 0; i < sizeof(extensions)/sizeof(*extensions); i++) {
            size_t elen = strlen(extensions[i]);
            if (namelen > elen && !strcasecmp(&name[namelen - elen], extensions[i])) {
                name[namelen - elen] = 0;
                break;
            }
        }
        /* append "." */
        strcat(name, ".");
    }
    va_start(args, fmt);
    vsnprintf(&name[strlen(name)], 200, fmt, args);
    va_end(args);
    return name;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xe8, %rsp
movq %rsi, %rbx
movq %rdi, %r12
movq %rdx, 0x40(%rsp)
movq %rcx, 0x48(%rsp)
movq %r8, 0x50(%rsp)
movq %r9, 0x58(%rsp)
testb %al, %al
je 0x13fd
movaps %xmm0, 0x60(%rsp)
movaps %xmm1, 0x70(%rsp)
movaps %xmm2, 0x80(%rsp)
movaps %xmm3, 0x90(%rsp)
movaps %xmm4, 0xa0(%rsp)
movaps %xmm5, 0xb0(%rsp)
movaps %xmm6, 0xc0(%rsp)
movaps %xmm7, 0xd0(%rsp)
callq 0x10b0
movq %rax, %r15
leaq 0xca(%rax), %rdi
callq 0x1110
testq %rax, %rax
je 0x14e8
movq %rax, %r14
movb $0x0, (%rax)
cmpl $0x0, 0x3ca1(%rip)      # 0x50c8
je 0x148e
movq %rbx, 0x8(%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x1060
xorl %ebp, %ebp
leaq 0x398e(%rip), %rbx      # 0x4dd0
movq (%rbp,%rbx), %r13
movq %r13, %rdi
callq 0x10b0
movq %r15, %r12
subq %rax, %r12
jbe 0x1469
addq %r14, %r12
movq %r12, %rdi
movq %r13, %rsi
callq 0x1040
testl %eax, %eax
je 0x1475
addq $0x8, %rbp
cmpq $0x18, %rbp
jne 0x1442
jmp 0x147a
movb $0x0, (%r12)
movq %r14, %rdi
callq 0x10b0
movw $0x2e, (%r14,%rax)
movq 0x8(%rsp), %rbx
leaq 0x30(%rsp), %rax
leaq 0x10(%rsp), %r15
movq %rax, 0x10(%r15)
leaq 0x120(%rsp), %rax
movq %rax, 0x8(%r15)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%r15)
movq %r14, %rdi
callq 0x10b0
movq %r14, %rdi
addq %rax, %rdi
movl $0xc8, %esi
movq %rbx, %rdx
movq %r15, %rcx
callq 0x1090
movq %r14, %rax
addq $0xe8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
callq 0x1130
xorl %r14d, %r14d
jmp 0x14d3
// File: /workspace/github_c_makefile_star2_O1/kyz[P]amostools/dumpamos.c
// Function: bank_length
uint32_t bank_length(uint8_t *src, size_t len) {
    if (len >= 6 && (amos_leek(src) == ID_AmSp || amos_leek(src) == ID_AmIc)) {
        int num_sprites = amos_deek(&src[4]);
        uint32_t pos = 6, w, h, d;
        while (num_sprites--) {
            if (pos + 10 > len) return 0;
             w = amos_deek(&src[pos+0]) * 2;
             h = amos_deek(&src[pos+2]);
             d = amos_deek(&src[pos+4]);
            pos += 10 +  w * h * d;
        }
        pos += 64; /* include palette */
        return pos > len ? 0 : pos;
    }
    else if (len >= 20 && amos_leek(src) == ID_AmBk) {
        uint32_t bank_len = (amos_leek(&src[8]) & 0x0FFFFFFF) + 20 - 8;
        return bank_len > len ? 0 : bank_len;
    }
    return 0;
}

// Assembly:
cmpq $0x6, %rsi
jb 0x1580
movl (%rdi), %eax
bswapl %eax
cmpl $0x416d5370, %eax       # imm = 0x416D5370
je 0x1511
cmpl $0x416d4963, %eax       # imm = 0x416D4963
jne 0x1580
movzwl 0x4(%rdi), %eax
rolw $0x8, %ax
testw %ax, %ax
je 0x15c1
movzwl %ax, %eax
movl $0x6, %ecx
leal 0xa(%rcx), %edx
cmpq %rsi, %rdx
ja 0x15d1
movl %ecx, %edx
movzbl (%rdi,%rdx), %r8d
movzbl 0x1(%rdi,%rdx), %edx
shll $0x9, %r8d
leal (%r8,%rdx,2), %edx
leal 0x2(%rcx), %r8d
movzwl (%rdi,%r8), %r8d
rolw $0x8, %r8w
movzwl %r8w, %r8d
imull %edx, %r8d
leal 0x4(%rcx), %edx
movzwl (%rdi,%rdx), %edx
rolw $0x8, %dx
movzwl %dx, %edx
imull %r8d, %edx
addl %edx, %ecx
addl $0xa, %ecx
decl %eax
jne 0x152a
addl $0x40, %ecx
jmp 0x15c6
xorl %eax, %eax
cmpq $0x14, %rsi
jb 0x15d0
movl (%rdi), %ecx
bswapl %ecx
cmpl $0x416d426b, %ecx       # imm = 0x416D426B
jne 0x15d0
movzbl 0x8(%rdi), %eax
movzbl 0x9(%rdi), %ecx
shll $0x10, %ecx
movzbl 0xa(%rdi), %edx
shll $0x8, %edx
movzbl 0xb(%rdi), %edi
andl $0xf, %eax
shll $0x18, %eax
orl %ecx, %eax
orl %edi, %eax
leal (%rdx,%rax), %ecx
addl $0xc, %ecx
xorl %eax, %eax
cmpq %rsi, %rcx
jmp 0x15cd
movl $0x46, %ecx
movl %ecx, %edx
xorl %eax, %eax
cmpq %rsi, %rdx
cmovbel %ecx, %eax
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/kyz[P]amostools/dumpamos.c
// Function: bank_number
uint32_t bank_number(uint8_t *src, size_t len) {
    if (len >= 6 && amos_leek(src) == ID_AmSp) {
        return 1; /* Sprites always bank 1 */
    }
    if (len >= 6 && amos_leek(src) == ID_AmIc) {
        return 2; /* Icons always bank 2 */
    }
    if (len >= 20 && amos_leek(src) == ID_AmBk) {
        return amos_deek(&src[4]);
    }
    return 0;
}

// Assembly:
cmpq $0x6, %rsi
jb 0x15f3
movl (%rdi), %ecx
bswapl %ecx
cmpl $0x416d4963, %ecx       # imm = 0x416D4963
je 0x1613
movl $0x1, %eax
cmpl $0x416d5370, %ecx       # imm = 0x416D5370
je 0x1618
xorl %eax, %eax
cmpq $0x14, %rsi
jb 0x1618
movl (%rdi), %ecx
bswapl %ecx
cmpl $0x416d426b, %ecx       # imm = 0x416D426B
jne 0x1618
movzwl 0x4(%rdi), %eax
rolw $0x8, %ax
movzwl %ax, %eax
retq
movl $0x2, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/kyz[P]amostools/dumpamos.c
// Function: bank_type
char *bank_type(uint8_t *src, size_t len) {
    if (len >= 6 && amos_leek(src) == ID_AmSp) {
        return "Sprites";
    }
    if (len >= 6 && amos_leek(src) == ID_AmIc) {
        return "Icons";
    }
    if (len >= 20 && amos_leek(src) == ID_AmBk) {
        /* copy bank type, remove space padding */
        static char type[9];
        char *tp = &type[8];
        memcpy(type, &src[12], 8);
        do { *tp-- = 0; } while (*tp == ' ' && tp > &type[0]);
        return type;
    }
    return NULL;
}

// Assembly:
cmpq $0x6, %rsi
jb 0x1639
movl (%rdi), %eax
bswapl %eax
cmpl $0x416d4963, %eax       # imm = 0x416D4963
je 0x1679
cmpl $0x416d5370, %eax       # imm = 0x416D5370
jne 0x1639
leaq 0x19dd(%rip), %rax      # 0x3015
retq
cmpq $0x14, %rsi
jb 0x1676
movl (%rdi), %eax
bswapl %eax
cmpl $0x416d426b, %eax       # imm = 0x416D426B
jne 0x1676
movq 0xc(%rdi), %rax
movq %rax, 0x3a7b(%rip)      # 0x50d0
leaq 0x3a7b(%rip), %rcx      # 0x50d7
leaq 0x3a6d(%rip), %rax      # 0x50d0
movb $0x0, 0x1(%rcx)
cmpq %rax, %rcx
jbe 0x1675
cmpb $0x20, (%rcx)
leaq -0x1(%rcx), %rcx
je 0x1663
retq
xorl %eax, %eax
retq
leaq 0x199d(%rip), %rax      # 0x301d
retq
// File: /workspace/github_c_makefile_star2_O1/kyz[P]amostools/dumpamos.c
// Function: decode_tracker
void decode_tracker(char *fname, uint8_t *src, size_t len) {
    uint32_t mod_len = len - 20;
    char *outname = output_fname(fname, "tracker%02X.mod", bank_number(src, len));
    if (outname) {
        printf("%s: extracting tracker mod %s (%d bytes)\n", fname, outname, mod_len);
        write_file(outname, &src[20], mod_len);
        free(outname);
    }
    else {
        perror(fname);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq %rsi, %rdi
movq %rdx, %rsi
callq 0x15d4
leaq 0xea8(%rip), %rsi       # 0x3104
movq %r15, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x1394
testq %rax, %rax
je 0x22ae
movq %rax, %r12
addl $-0x14, %ebx
leaq 0xe9a(%rip), %rdi       # 0x3114
movq %r15, %rsi
movq %rax, %rdx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x10c0
addq $0x14, %r14
movq %r12, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x132e
movq %r12, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1030
movq %r15, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x1130
// File: /workspace/github_c_makefile_star2_O1/kyz[P]amostools/dumpamos.c
// Function: amos_bank
void amos_bank(char *fname, uint8_t *src, size_t len) {
    /* get the "real", validated bank length */
    if (!(len = bank_length(src, len))) return;

    if (amos_leek(src) == ID_AmSp) {
        decode_sprites(fname, src, len, "sprite");
    }
    else if (amos_leek(src) == ID_AmIc) {
        decode_sprites(fname, src, len, "icon");
    }
    else if (amos_leek(src) == ID_AmBk) {
        if (!memcmp(&src[12], "Pac.Pic.", 8)) {
            decode_pacpic(fname, src, len);
        }
        else if (!memcmp(&src[12], "Samples ", 8)) {
            decode_samples(fname, src, len);
        }
        else if (!memcmp(&src[12], "Tracker ", 8)) {
            decode_tracker(fname, src, len);
        }
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
movq %rdx, %rsi
callq 0x14f5
testl %eax, %eax
je 0x2347
movl %eax, %edx
movl (%rbx), %eax
bswapl %eax
cmpl $0x416d426b, %eax       # imm = 0x416D426B
je 0x2317
cmpl $0x416d4963, %eax       # imm = 0x416D4963
je 0x22fe
cmpl $0x416d5370, %eax       # imm = 0x416D5370
jne 0x2347
leaq 0xe42(%rip), %rcx       # 0x313e
jmp 0x2305
leaq 0xe40(%rip), %rcx       # 0x3145
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x1681
movabsq $0x2e6369502e636150, %rax # imm = 0x2E6369502E636150
cmpq %rax, 0xc(%rbx)
je 0x234f
movabsq $0x2073656c706d6153, %rax # imm = 0x2073656C706D6153
cmpq %rax, 0xc(%rbx)
je 0x2361
movabsq $0x2072656b63617254, %rax # imm = 0x2072656B63617254
cmpq %rax, 0xc(%rbx)
je 0x2373
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x196f
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2042
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2239
// File: /workspace/github_c_makefile_star2_O1/kyz[P]amostools/dumpamos.c
// Function: amos_banks
void amos_banks(char *fname, uint8_t *src, size_t len) {
    if (len < 6) {
        fprintf(stderr, "%s: file too short to be AMOS banks\n", fname);
    }
    else {
        uint32_t num_banks = amos_deek(&src[4]), bank_pos = 6;
        while (num_banks--) {
            uint32_t bank_len = bank_length(&src[bank_pos], len - bank_pos);
            uint32_t bank_num = bank_number(&src[bank_pos], bank_len);
            char *type = bank_type(&src[bank_pos], bank_len), *outname;
            if (bank_num > 0) {
                if ((outname = output_fname(fname, "bank%02X.abk", bank_num))) {
                    printf("%s: extracting bank %d (%s) as %s (%d bytes)\n",
                           fname, bank_num, type, outname, bank_len);
                    write_file(outname, &src[bank_pos], bank_len);
                    amos_bank(outname, &src[bank_pos], bank_len);
                    free(outname);
                }
                else {
                    perror(fname);
                }
            }
            bank_pos += bank_len;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
movq %rdx, 0x18(%rsp)
cmpq $0x5, %rdx
jbe 0x249f
movzwl 0x4(%rsi), %eax
rolw $0x8, %ax
testw %ax, %ax
je 0x2490
movzwl %ax, %ebx
movl $0x6, %r15d
movq %rsi, 0x10(%rsp)
movq %r14, 0x8(%rsp)
movl %r15d, %eax
leaq (%rsi,%rax), %r13
movq 0x18(%rsp), %rsi
subq %rax, %rsi
movq %r13, %rdi
callq 0x14f5
movl %eax, %ebp
movq %r13, %rdi
movq %rbp, %rsi
callq 0x15d4
movl %eax, %r12d
movq %r13, %rdi
movq %rbp, %rsi
callq 0x1619
testl %r12d, %r12d
je 0x246c
movq %rax, 0x20(%rsp)
movq %r14, %rdi
leaq 0xd7b(%rip), %rsi       # 0x318a
movl %r12d, %edx
xorl %eax, %eax
callq 0x1394
movq %r14, %rcx
testq %rax, %rax
je 0x2483
movq %rax, %r14
leaq 0xd6c(%rip), %rdi       # 0x3197
movq %rcx, %rsi
movl %r12d, %edx
movq 0x20(%rsp), %rcx
movq %rax, %r8
movl %ebp, %r9d
xorl %eax, %eax
callq 0x10c0
movq %r14, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x132e
movq %r14, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x22c1
movq %r14, %rdi
callq 0x1030
movq 0x8(%rsp), %r14
decl %ebx
addl %r15d, %ebp
movl %ebp, %r15d
testl %ebx, %ebx
movq 0x10(%rsp), %rsi
jne 0x23c9
jmp 0x2490
movq %rcx, %rdi
movq %rcx, %r14
callq 0x1130
jmp 0x246c
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x2b4a(%rip), %rax      # 0x4ff0
movq (%rax), %rdi
leaq 0xcb5(%rip), %rsi       # 0x3165
movq %r14, %rdx
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10e0
// File: /workspace/github_c_makefile_star2_O1/kyz[P]amostools/dumpamos.c
// Function: amos_source
void amos_source(char *fname, uint8_t *src, size_t len) {
    if (len < 30) {
        fprintf(stderr, "%s: file too short to be AMOS source code\n", fname);
    }
    else {
        uint32_t src_len = amos_leek(&src[16]) + 20;
        char hdr[17] = {0};
        memcpy(hdr, src, 16);
        printf("%s: AMOS source code with header '%s'\n", fname, hdr);

        /* parse banks after source code */
        if (src_len < len) {
            amos_banks(fname, &src[src_len], len - src_len);
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
cmpq $0x1d, %rdx
jbe 0x252d
movq %rdx, %r14
movq %rsi, %r15
movl 0x10(%rsi), %r12d
bswapl %r12d
addl $0x14, %r12d
movq %rsp, %rdx
movb $0x0, 0x10(%rdx)
movups (%rsi), %xmm0
movaps %xmm0, (%rdx)
leaq 0xcef(%rip), %rdi       # 0x31f0
movq %rbx, %rsi
xorl %eax, %eax
callq 0x10c0
subq %r12, %r14
jbe 0x2521
addq %r12, %r15
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x2385
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x2abc(%rip), %rax      # 0x4ff0
movq (%rax), %rdi
leaq 0xc87(%rip), %rsi       # 0x31c5
movq %rbx, %rdx
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x10e0
// File: /workspace/github_c_makefile_star2_O1/kyz[P]amostools/dumpamos.c
// Function: amos_file
void amos_file(char *fname, uint8_t *src, size_t len) {
    if (len < 4) {
        fprintf(stderr, "%s: file too short to be an AMOS file\n", fname);
    }
    else {
        switch (amos_leek(src)) {
        case ID_AMOS:
            amos_source(fname, src, len);
            break;

        case ID_AmBs:
            printf("%s: AMOS banks\n", fname);
            amos_banks(fname, src, len);
            break;

        case ID_AmBk:
        case ID_AmSp:
        case ID_AmIc:
            printf("%s: AMOS bank (%s)\n", fname, bank_type(src, len));
            amos_bank(fname, src, len);
            break;

        default:
            fprintf(stderr, "%s: not an AMOS source file or bank\n", fname);
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpq $0x3, %rdx
jbe 0x2618
movq %rdx, %r14
movq %rsi, %r15
movl (%rsi), %eax
bswapl %eax
cmpl $0x416d4272, %eax       # imm = 0x416D4272
jle 0x25a1
cmpl $0x416d4273, %eax       # imm = 0x416D4273
je 0x25e1
cmpl $0x416d4963, %eax       # imm = 0x416D4963
je 0x25af
cmpl $0x416d5370, %eax       # imm = 0x416D5370
je 0x25af
movq 0x2a5e(%rip), %rax      # 0x4ff0
movq (%rax), %rdi
leaq 0xcc6(%rip), %rsi       # 0x3262
jmp 0x2629
cmpl $0x414d4f53, %eax       # imm = 0x414D4F53
je 0x2605
cmpl $0x416d426b, %eax       # imm = 0x416D426B
jne 0x258b
movq %r15, %rdi
movq %r14, %rsi
callq 0x1619
leaq 0xc8d(%rip), %rdi       # 0x324e
movq %rbx, %rsi
movq %rax, %rdx
xorl %eax, %eax
callq 0x10c0
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x22c1
leaq 0xc56(%rip), %rdi       # 0x323e
movq %rbx, %rsi
xorl %eax, %eax
callq 0x10c0
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x2385
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x24c8
movq 0x29d1(%rip), %rax      # 0x4ff0
movq (%rax), %rdi
leaq 0xbee(%rip), %rsi       # 0x3217
movq %rbx, %rdx
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
jmp 0x10e0
// File: /workspace/github_c_makefile_star2_O1/kyz[P]amostools/dumpamos.c
// Function: main
int main(int argc, char *argv[]) {
    if (argc <= 1) {
        printf("Extract the contents of AMOS source code and memory banks.\n");
        printf("Usage: %s [-p] <file.AMOS, file.abk, file.abs, ...>\n", argv[0]);
        printf("Options:\n"
               "  -p     Prefix removal\n");
        return 1;
    }

    for (int i = 1; i < argc; i++) {
        if (!strcmp(argv[i], "-p")) {
            use_prefix = 1;
        }
        else {
            char *fname = argv[i];
            uint8_t *buf;
            size_t len;
            if ((buf = read_file(fname, &len))) {
                amos_file(fname, buf, len);
                free(buf);
            }
        }
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
cmpl $0x2, %edi
jge 0x267b
leaq 0xc6d(%rip), %rdi       # 0x32bf
callq 0x1070
movq (%rbx), %rsi
leaq 0xc26(%rip), %rdi       # 0x3287
xorl %eax, %eax
callq 0x10c0
leaq 0xc8b(%rip), %rdi       # 0x32fa
callq 0x1070
movl $0x1, %eax
jmp 0x26dd
movl %edi, %ebp
movl $0x1, %r15d
leaq 0xc32(%rip), %r14       # 0x32bc
movq (%rbx,%r15,8), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x10d0
testl %eax, %eax
je 0x26c9
movq %r12, %rdi
movq %rsp, %rsi
callq 0x125c
testq %rax, %rax
je 0x26d3
movq %rax, %r13
movq (%rsp), %rdx
movq %r12, %rdi
movq %rax, %rsi
callq 0x2553
movq %r13, %rdi
callq 0x1030
jmp 0x26d3
movl $0x1, 0x29f5(%rip)      # 0x50c8
incq %r15
cmpq %r15, %rbp
jne 0x268a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/JimKent[P]linearSat/lib/cheapcgi.c
// Function: catchSignal
static void catchSignal(int sigNum)
/* handler for various terminal signals for logging purposes */
{
char *sig = NULL;
switch (sigNum)
    {
    case SIGTERM:  // after timing out for not producing any stdout or stderr output for too long,
		   //  apache gives you 3 seconds to clean up and exit or it then sends SIGKILL.
      sig = "SIGTERM";
      break;
    case SIGHUP:   // apache sends this when it is doing a graceful restart or a log rotate.
      sig = "SIGHUP";
      break;
    case SIGABRT:
      sig = "SIGABRT";
      break;
    case SIGSEGV:
      sig = "SIGSEGV";
      break;
    case SIGFPE:
      sig = "SIGFPE";
      break;
    case SIGBUS:
      sig = "SIGBUS";
      break;
    }
    logCgiToStderr();

    // apache closes STDERR on the CGI before it sends the SIGTERM and SIGKILL signals
    //  which means that stderr output after that point will not be visible in error_log.
    fprintf(stderr, "Received signal %s\n", sig);
    if (dumpStackOnSignal)
        dumpStack("Stack for signal %s\n", sig);

if (sigNum == SIGTERM || sigNum == SIGHUP) 
    exit(1);   // so that atexit cleanup get called

raise(SIGKILL);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %edi, %ebx
leal -0x1(%rbx), %eax
cmpl $0xe, %eax
ja 0x388e
movl %eax, %eax
leaq 0x234c8(%rip), %rcx     # 0x26d50
movq (%rcx,%rax,8), %r14
jmp 0x3891
xorl %r14d, %r14d
callq 0x38ec
movq 0x2375b(%rip), %rax     # 0x26ff8
movq (%rax), %rdi
leaq 0x18844(%rip), %rsi     # 0x1c0eb
movq %r14, %rdx
xorl %eax, %eax
callq 0x3470
cmpl $0x0, 0x24a10(%rip)     # 0x282c8
je 0x38cb
leaq 0x1883e(%rip), %rdi     # 0x1c0ff
movq %r14, %rsi
xorl %eax, %eax
callq 0x11c6b
cmpl $0xf, %ebx
je 0x38e4
cmpl $0x1, %ebx
je 0x38e4
pushq $0x9
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3060
pushq $0x1
popq %rdi
callq 0x36e0
// File: /workspace/github_c_makefile_star2_O1/JimKent[P]linearSat/lib/cheapcgi.c
// Function: logCgiToStderr
void logCgiToStderr()
/* Log useful CGI info to stderr */
{
char *ip = getenv("REMOTE_ADDR");
char *cgiBinary = getenv("SCRIPT_FILENAME");
char *requestUri = getenv("REQUEST_URI");
char *hgsid = cgiOptionalString("hgsid");
char *cgiFileName = NULL;
time_t nowTime = time(NULL);
struct tm *tm;
tm = localtime(&nowTime);
char *ascTime = asctime(tm);
size_t len = strlen(ascTime);
if (cgiBinary)
    cgiFileName = basename(cgiBinary);
else
    cgiFileName = "cgi-bin";
if (len > 3) ascTime[len-2] = '\0';
if (!ip)
    ip = "unknown";
if (!hgsid)
    hgsid = "unknown";
if (!requestUri)
    requestUri = "unknown";
fprintf(stderr, "[%s] [%s] [client %s] [hgsid=%.24s] [%.1024s] ", ascTime, cgiFileName, ip,
	hgsid, requestUri);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0x17e0c(%rip), %rdi     # 0x1b70d
callq 0x3040
movq %rax, %rbx
leaq 0x186dd(%rip), %rdi     # 0x1bfed
callq 0x3040
movq %rax, %r13
leaq 0x17da2(%rip), %rdi     # 0x1b6c1
callq 0x3040
movq %rax, %r15
leaq 0x186cf(%rip), %rdi     # 0x1bffd
callq 0x13c60
movq %rax, %r14
xorl %edi, %edi
callq 0x34d0
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
callq 0x30a0
movq %rax, %rdi
callq 0x3220
movq %rax, %r12
movq %rax, %rdi
callq 0x3200
movq %rax, %rbp
testq %r13, %r13
jne 0x396e
leaq 0x18697(%rip), %rcx     # 0x1c003
jmp 0x3979
movq %r13, %rdi
callq 0x34c0
movq %rax, %rcx
cmpq $0x4, %rbp
jb 0x3985
movb $0x0, -0x2(%r12,%rbp)
testq %rbx, %rbx
leaq 0x174d4(%rip), %rax     # 0x1ae63
cmoveq %rax, %rbx
testq %r14, %r14
cmoveq %rax, %r14
testq %r15, %r15
cmoveq %rax, %r15
movq 0x23650(%rip), %rax     # 0x26ff8
movq (%rax), %rdi
movq %r15, (%rsp)
leaq 0x18655(%rip), %rsi     # 0x1c00b
movq %r12, %rdx
movq %rbx, %r8
movq %r14, %r9
xorl %eax, %eax
callq 0x3470
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop
// File: /workspace/github_c_makefile_star2_O1/JimKent[P]linearSat/linearSat/linearSat.c
// Function: wordTreeFindInList
struct wordTree *wordTreeFindInList(struct wordTree *list, struct monomer *monomer)
/* Return wordTree element in list that has given word, or NULL if none. */
{
struct wordTree *wt;
for (wt = list; wt != NULL; wt = wt->next)
    if (wt->monomer == monomer)
        break;
return wt;
}

// Assembly:
movq %rdi, %rax
testq %rdi, %rdi
je 0x3b38
cmpq %rsi, 0x18(%rax)
je 0x3b38
movq (%rax), %rax
testq %rax, %rax
jne 0x3b2a
retq
// File: /workspace/github_c_makefile_star2_O1/JimKent[P]linearSat/linearSat/linearSat.c
// Function: wordTreeAddFollowing
struct wordTree *wordTreeAddFollowing(struct wordTree *wt, struct monomer *monomer)
/* Make word follow wt in tree.  If word already exists among followers
 * return it and bump use count.  Otherwise create new one. */
{
struct wordTree *child = wordTreeFindInList(wt->children, monomer);
if (child == NULL)
    {
    child = wordTreeNew(monomer);
    child->parent = wt;
    slAddHead(&wt->children, child);
    }
child->useCount += 1;
return child;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x3b57
cmpq %r14, 0x18(%rax)
je 0x3b57
movq (%rax), %rax
jmp 0x3b47
testq %rax, %rax
jne 0x3b79
movl $0x38, %edi
callq 0xf07d
movq %r14, 0x18(%rax)
movq %rbx, 0x10(%rax)
movq 0x8(%rbx), %rcx
movq %rcx, (%rax)
movq %rax, 0x8(%rbx)
incl 0x20(%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/JimKent[P]linearSat/linearSat/linearSat.c
// Function: addChainToTree
void addChainToTree(struct wordTree *wt, struct dlList *chain)
/* Add chain of words to tree. */
{
struct dlNode *node;
wt->useCount += 1;
for (node = chain->head; !dlEnd(node); node = node->next)
    {
    struct monomer *monomer = node->val;
    verbose(4, "  adding %s\n", monomer->word);
    wt = wordTreeAddFollowing(wt, monomer);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
incl 0x20(%rdi)
movq (%rsi), %r12
cmpq $0x0, (%r12)
je 0x3bf4
movq %rdi, %rbx
leaq 0x14abe(%rip), %r14     # 0x18681
movq 0x10(%r12), %r15
movq 0x8(%r15), %rdx
movl $0x4, %edi
movq %r14, %rsi
xorl %eax, %eax
callq 0x12c8e
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3b39
movq %rax, %rbx
movq (%r12), %r12
cmpq $0x0, (%r12)
jne 0x3bc3
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/JimKent[P]linearSat/linearSat/linearSat.c
// Function: useCountInTree
int useCountInTree(struct wordTree *wt, struct dlNode *nodeList, int chainSize)
/* Return number of times chainSize successive nodes from nodeList are found
 * in wt,  0 if not found. */
{
int i;
struct wordTree *subTree = wt;
struct dlNode *node = nodeList;
for (i=0; i<chainSize; ++i)
    {
    struct monomer *monomer = node->val;
    subTree = wordTreeFindInList(subTree->children, monomer);
    if (subTree == NULL)
        return FALSE;
    node = node->next;
    }
return subTree->useCount;
}

// Assembly:
testl %edx, %edx
jle 0x3c34
xorl %eax, %eax
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0x3c21
movq 0x10(%rsi), %rcx
cmpq %rcx, 0x18(%rdi)
je 0x3c21
movq (%rdi), %rdi
testq %rdi, %rdi
jne 0x3c13
testq %rdi, %rdi
je 0x3c29
movq (%rsi), %rsi
testq %rdi, %rdi
je 0x3c38
incl %eax
cmpl %edx, %eax
jne 0x3c06
movl 0x20(%rdi), %eax
retq
xorl %eax, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/JimKent[P]linearSat/linearSat/linearSat.c
// Function: findLongestSupportingMarkovChain
void findLongestSupportingMarkovChain(struct wordTree *wt, struct dlNode *node,
    int *retChainSize, int *retReadCount)
/* See if chain of words is in tree tree. */
{
struct dlNode *start = node;
int chainSize = 1;
int readCount = 0;
for (;;)
    {
    int useCount = useCountInTree(wt, start, chainSize);
    if (useCount == 0)
        break;
    readCount = useCount;
    chainSize += 1;
    start = start->prev;
    if (dlStart(start))
        break;
    }
*retChainSize = chainSize;
*retReadCount = readCount;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
xorl %r13d, %r13d
movl $0x1, %ebp
movq %r12, %rdi
movq %r15, %rsi
movl %ebp, %edx
callq 0x3c00
testl %eax, %eax
je 0x3c7e
incl %ebp
movq 0x8(%r15), %r15
cmpq $0x0, 0x8(%r15)
setne %cl
movl %eax, %r13d
jmp 0x3c80
xorl %ecx, %ecx
testb %cl, %cl
jne 0x3c5a
movl %ebp, (%r14)
movl %r13d, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/JimKent[P]linearSat/linearSat/linearSat.c
// Function: wordTreeAddPseudoCount
int wordTreeAddPseudoCount(struct wordTree *wt, int pseudo)
/* Add pseudo to all leaves of tree and propagate counts up to parents. */
{
if (wt->children == NULL)
    {
    wt->useCount += pseudo;
    return wt->useCount;
    }
else
    {
    struct wordTree *child;
    int oldChildTotal = 0;
    for (child = wt->children; child != NULL; child = child->next)
	oldChildTotal += child->useCount;
    int oldDiff = wt->useCount - oldChildTotal;
    if (oldDiff < 0) oldDiff = 0;  // Necessary in rare cases, not sure why.

    int total = 0;
    for (child = wt->children; child != NULL; child = child->next)
	total += wordTreeAddPseudoCount(child, pseudo);
    wt->useCount = total + oldDiff + pseudo;
    return total;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %esi, %ebp
movq %rdi, %rbx
movq 0x8(%rdi), %rax
testq %rax, %rax
je 0x3cfa
xorl %ecx, %ecx
addl 0x20(%rax), %ecx
movq (%rax), %rax
testq %rax, %rax
jne 0x3cb1
movl 0x20(%rbx), %r12d
subl %ecx, %r12d
xorl %r14d, %r14d
testl %r12d, %r12d
cmovlel %r14d, %r12d
movq 0x8(%rbx), %r15
testq %r15, %r15
je 0x3cee
xorl %r14d, %r14d
movq %r15, %rdi
movl %ebp, %esi
callq 0x3c99
addl %eax, %r14d
movq (%r15), %r15
testq %r15, %r15
jne 0x3cd9
addl %ebp, %r12d
addl %r14d, %r12d
movl %r12d, 0x20(%rbx)
jmp 0x3d03
addl 0x20(%rbx), %ebp
movl %ebp, 0x20(%rbx)
movl %ebp, %r14d
movl %r14d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/JimKent[P]linearSat/linearSat/linearSat.c
// Function: wordTreeNormalize
void wordTreeNormalize(struct wordTree *wt, double outTarget, double normVal)
/* Recursively set wt->normVal  and wt->outTarget so each branch gets its share */
{
if (pseudoCount > 0)
    wordTreeAddPseudoCount(wt, pseudoCount);
wt->normVal = normVal;
wt->outTarget = outTarget;
wt->outCount = 0;
int childrenTotalUses = wordTreeSumUseCounts(wt->children);
struct wordTree *child;
for (child = wt->children; child != NULL; child = child->next)
    {
    double childRatio = (double)child->useCount / childrenTotalUses;
    wordTreeNormalize(child, childRatio*outTarget, childRatio*normVal);
    }
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movapd %xmm1, %xmm2
movapd %xmm0, %xmm3
movq %rdi, %rbx
movl 0x236cb(%rip), %esi     # 0x273f0
testl %esi, %esi
movsd %xmm1, 0x10(%rsp)
movsd %xmm0, 0x8(%rsp)
jle 0x3d49
movq %rbx, %rdi
callq 0x3c99
movsd 0x8(%rsp), %xmm3
movsd 0x10(%rsp), %xmm2
movsd %xmm2, 0x30(%rbx)
cvttsd2si %xmm3, %eax
movl %eax, 0x24(%rbx)
movl $0x0, 0x28(%rbx)
movq 0x8(%rbx), %rax
testq %rax, %rax
je 0x3d7b
xorl %ecx, %ecx
addl 0x20(%rax), %ecx
movq (%rax), %rax
testq %rax, %rax
jne 0x3d67
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
jmp 0x3d7f
xorpd %xmm0, %xmm0
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
je 0x3dc8
movsd %xmm0, 0x18(%rsp)
xorps %xmm1, %xmm1
cvtsi2sdl 0x20(%rbx), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, %xmm0
mulsd %xmm3, %xmm0
mulsd %xmm2, %xmm1
movq %rbx, %rdi
callq 0x3d0f
movsd 0x18(%rsp), %xmm0
movsd 0x8(%rsp), %xmm3
movsd 0x10(%rsp), %xmm2
movq (%rbx), %rbx
testq %rbx, %rbx
jne 0x3d8e
addq $0x20, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/JimKent[P]linearSat/linearSat/linearSat.c
// Function: wordTreeString
char *wordTreeString(struct wordTree *wt)
/* Return something like '(a b c)' where c would be the value at wt itself, and
 * a and b would be gotten by following parents. */
{
struct slName *list = NULL, *el;
for (;wt != NULL; wt = wt->parent)
    {
    char *word = wt->monomer->word;
    if (!isEmpty(word))   // Avoid blank great grandparent at root of tree.
	slNameAddHead(&list, word);
    }

struct dyString *dy = dyStringNew(0);
dyStringAppendC(dy, '(');
for (el = list; el != NULL; el = el->next)
   {
   dyStringPrintf(dy, "%s", el->name);
   if (el->next != NULL)
       dyStringAppendC(dy, ' ');
   }
dyStringAppendC(dy, ')');
slFreeList(&list);
return dyStringCannibalize(&dy);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq $0x0, 0x10(%rsp)
testq %rdi, %rdi
je 0x3e0e
movq %rdi, %rbx
leaq 0x10(%rsp), %r14
movq 0x18(%rbx), %rax
movq 0x8(%rax), %rsi
testq %rsi, %rsi
je 0x3e05
cmpb $0x0, (%rsi)
je 0x3e05
movq %r14, %rdi
callq 0x7066
movq 0x10(%rbx), %rbx
testq %rbx, %rbx
jne 0x3deb
xorl %edi, %edi
callq 0xaf38
movq %rax, 0x8(%rsp)
movq %rax, %rdi
movl $0x28, %esi
callq 0xb0c7
movq 0x10(%rsp), %r14
testq %r14, %r14
je 0x3e68
leaq 0x15774(%rip), %rbx     # 0x195ac
movq 0x8(%rsp), %rdi
leaq 0x8(%r14), %rdx
movq %rbx, %rsi
xorl %eax, %eax
callq 0xb2d2
cmpq $0x0, (%r14)
je 0x3e60
movq 0x8(%rsp), %rdi
movl $0x20, %esi
callq 0xb0c7
movq (%r14), %r14
testq %r14, %r14
jne 0x3e38
leaq 0x8(%rsp), %rbx
movq (%rbx), %rdi
movl $0x29, %esi
callq 0xb0c7
leaq 0x10(%rsp), %rdi
callq 0x675e
movq %rbx, %rdi
callq 0xaf94
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/JimKent[P]linearSat/linearSat/linearSat.c
// Function: dlListFragWords
char *dlListFragWords(struct dlNode *head)
/* Return string containing all words in list pointed to by head. */
{
struct dyString *dy = dyStringNew(0);
dyStringAppendC(dy, '{');
struct dlNode *node;
for (node = head; !dlEnd(node); node = node->next)
    {
    if (node != head)
       dyStringAppendC(dy, ' ');
    struct monomer *monomer = node->val;
    dyStringAppend(dy, monomer->word);
    }
dyStringAppendC(dy, '}');
return dyStringCannibalize(&dy);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %edi, %edi
callq 0xaf38
movq %rax, (%rsp)
movq %rax, %rdi
movl $0x7b, %esi
callq 0xb0c7
cmpq $0x0, (%rbx)
je 0x3ee9
movq %rbx, %r14
cmpq %rbx, %r14
je 0x3ecf
movq (%rsp), %rdi
movl $0x20, %esi
callq 0xb0c7
movq 0x10(%r14), %rax
movq (%rsp), %rdi
movq 0x8(%rax), %rsi
callq 0xb18d
movq (%r14), %r14
cmpq $0x0, (%r14)
jne 0x3ebc
movq %rsp, %rbx
movq (%rbx), %rdi
movl $0x7d, %esi
callq 0xb0c7
movq %rbx, %rdi
callq 0xaf94
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/JimKent[P]linearSat/linearSat/linearSat.c
// Function: wordTreeDump
void wordTreeDump(int level, struct wordTree *wt, int maxChainSize, FILE *f)
/* Write out wordTree to file. */
{
static char *words[64];
int i;
assert(level < ArraySize(words));

words[level] = wt->monomer->word;
if (!fullOnly || level == maxChainSize)
    {
    fprintf(f, "%d\t%d\t%d\t%d\t%f\t", 
	    level, wt->useCount, wt->outTarget, wt->outCount, wt->normVal);
    
    for (i=1; i<=level; ++i)
	{
	spaceOut(f, level*2);
	fprintf(f, "%s ", words[i]);
	}
    fprintf(f, "\n");
    }
struct wordTree *child;
for (child = wt->children; child != NULL; child = child->next)
    wordTreeDump(level+1, child, maxChainSize, f);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x40, %edi
jae 0x3ff5
movq %rcx, %rbx
movl %edx, %ebp
movl %edi, %r14d
movl %edi, %eax
movq 0x18(%rsi), %rcx
movq 0x8(%rcx), %rcx
leaq 0x236ea(%rip), %rdx     # 0x27620
movq %rcx, (%rdx,%rax,8)
cmpl %ebp, %edi
je 0x3f47
cmpl $0x0, 0x236cf(%rip)     # 0x27614
jne 0x3fc2
movl 0x20(%rsi), %ecx
movl 0x24(%rsi), %r8d
movl 0x28(%rsi), %r9d
movq %rsi, (%rsp)
movsd 0x30(%rsi), %xmm0
leaq 0x14788(%rip), %rsi     # 0x186ea
movq %rbx, %rdi
movl %r14d, %edx
movb $0x1, %al
callq 0x3470
testl %r14d, %r14d
je 0x3fb1
leal (%r14,%r14), %r12d
leal 0x1(%r14), %r15d
movl $0x1, %r13d
movq %rbx, %rdi
movl %r12d, %esi
callq 0x9104
leaq 0x2368c(%rip), %rax     # 0x27620
movq (%rax,%r13,8), %rdx
movq %rbx, %rdi
leaq 0x1762d(%rip), %rsi     # 0x1b5cf
xorl %eax, %eax
callq 0x3470
incq %r13
cmpq %r13, %r15
jne 0x3f82
movl $0xa, %edi
movq %rbx, %rsi
callq 0x33a0
movq (%rsp), %rsi
movq 0x8(%rsi), %r15
testq %r15, %r15
je 0x3fe6
incl %r14d
movl %r14d, %edi
movq %r15, %rsi
movl %ebp, %edx
movq %rbx, %rcx
callq 0x3f09
movq (%r15), %r15
testq %r15, %r15
jne 0x3fce
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x14692(%rip), %rdi     # 0x1868e
leaq 0x146a4(%rip), %rsi     # 0x186a7
leaq 0x146a9(%rip), %rcx     # 0x186b3
movl $0x1a8, %edx            # imm = 0x1A8
callq 0x32e0
// File: /workspace/github_c_makefile_star2_O1/JimKent[P]linearSat/linearSat/linearSat.c
// Function: pickRandomFromType
struct monomer *pickRandomFromType(struct monomerType *type)
/* Pick a random word, weighted by outTarget, from all available of given type */
{
/* Figure out total on list */
int total = 0;
struct monomerRef *ref;
for (ref = type->list; ref != NULL; ref = ref->next)
    total += ref->val->outTarget;
verbose(3, "pickRandomFromType %s total of outTarget=%d\n", type->name, total);

/* Loop through list returning selection corresponding to random threshold. */
if (total > 0)
    {
    int threshold = rand() % total; 
    int binStart = 0;
    for (ref = type->list; ref != NULL; ref = ref->next)
	{
	struct monomer *monomer = ref->val;
	int size = monomer->outTarget;
	int binEnd = binStart + size;
	if (threshold < binEnd)
	    return monomer;
	binStart = binEnd;
	}
    }

verbose(3, "Backup plan for %s in pickRandomFromType\n", type->name);

/* Try again based on use counts. */
total = 0;
for (ref = type->list; ref != NULL; ref = ref->next)
    total += ref->val->useCount;
if (total > 0)
    {
    int threshold = rand() % total; 
    int binStart = 0;
    for (ref = type->list; ref != NULL; ref = ref->next)
	{
	struct monomer *monomer = ref->val;
	int size = monomer->useCount;
	int binEnd = binStart + size;
	if (threshold < binEnd)
	    return monomer;
	binStart = binEnd;
	}
    }

errAbort("Fell off end in pickRandomFromType on %s", type->name);
return NULL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x10(%rdi), %rax
xorl %ebp, %ebp
testq %rax, %rax
je 0x41ad
movq 0x8(%rax), %rcx
movq (%rax), %rdx
addl 0x14(%rcx), %ebp
movq %rdx, %rax
testq %rdx, %rdx
jne 0x419b
leaq 0x10(%rbx), %r15
movq 0x8(%rbx), %rdx
leaq 0x145b1(%rip), %rsi     # 0x1876d
xorl %r12d, %r12d
movl $0x3, %edi
movl %ebp, %ecx
xorl %eax, %eax
callq 0x12c8e
testl %ebp, %ebp
jle 0x4201
callq 0x3780
cltd
idivl %ebp
xorl %ecx, %ecx
movq %r15, %rax
movq (%rax), %rax
testq %rax, %rax
je 0x41fa
movq 0x8(%rax), %rsi
movl 0x14(%rsi), %edi
addl %ecx, %edi
cmpl %edi, %edx
cmovgel %edi, %ecx
cmovlq %rsi, %r14
jge 0x41de
testq %rax, %rax
jne 0x427d
jmp 0x4201
movq 0x8(%rbx), %rdx
leaq 0x1458e(%rip), %rsi     # 0x1879a
movl $0x3, %edi
xorl %eax, %eax
callq 0x12c8e
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0x4237
xorl %r12d, %r12d
movq 0x8(%rax), %rcx
movq (%rax), %rdx
addl 0x10(%rcx), %r12d
movq %rdx, %rax
testq %rdx, %rdx
jne 0x4224
testl %r12d, %r12d
jle 0x4268
callq 0x3780
cltd
idivl %r12d
xorl %eax, %eax
movq (%r15), %r15
testq %r15, %r15
je 0x4263
movq 0x8(%r15), %rcx
movl 0x10(%rcx), %esi
addl %eax, %esi
cmpl %esi, %edx
cmovgel %esi, %eax
cmovlq %rcx, %r14
jge 0x4247
testq %r15, %r15
jne 0x427d
movq 0x8(%rbx), %rsi
leaq 0x14551(%rip), %rdi     # 0x187c4
xorl %r14d, %r14d
xorl %eax, %eax
callq 0xb8d7
movq %r14, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/JimKent[P]linearSat/linearSat/linearSat.c
// Function: predictNextFromAllPredecessors
struct wordTree *predictNextFromAllPredecessors(struct wordTree *wt, struct dlNode *list)
/* Predict next word given tree and recently used word list.  If tree doesn't
 * have statistics for what comes next given the words in list, then it returns
 * NULL. */
{
if (verboseLevel() >= 4)
    verbose(4, "  predictNextFromAllPredecessors(%s, %s)\n", wordTreeString(wt), dlListFragWords(list));
struct dlNode *node;
for (node = list; !dlEnd(node); node = node->next)
    {
    struct monomer *monomer = node->val;
    wt = wordTreeFindInList(wt->children, monomer);
    if (verboseLevel() >= 4)
	verbose(4, "   wordTreeFindInList(%s) = %p %s\n", monomer->word, wt, wordTreeString(wt));
    if (wt == NULL || wt->children == NULL)
        break;
    }
struct wordTree *result = NULL;
if (wt != NULL && wt->children != NULL)
    result = pickWeightedRandomFromList(wt->children);
return result;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
xorl %eax, %eax
callq 0x12f02
cmpl $0x4, %eax
jl 0x42cf
movq %rbx, %rdi
callq 0x3dce
movq %rax, %r15
movq %r14, %rdi
callq 0x3e94
leaq 0x14530(%rip), %rsi     # 0x187ed
movl $0x4, %edi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x12c8e
cmpq $0x0, (%r14)
je 0x433a
leaq 0x1453b(%rip), %r15     # 0x18817
movq 0x10(%r14), %r12
movq 0x8(%rbx), %rbx
testq %rbx, %rbx
je 0x42f4
cmpq %r12, 0x18(%rbx)
je 0x42f4
movq (%rbx), %rbx
jmp 0x42e4
xorl %eax, %eax
callq 0x12f02
cmpl $0x4, %eax
jl 0x4325
movq 0x8(%r12), %r12
movq %rbx, %rdi
callq 0x3dce
movl $0x4, %edi
movq %r15, %rsi
movq %r12, %rdx
movq %rbx, %rcx
movq %rax, %r8
xorl %eax, %eax
callq 0x12c8e
testq %rbx, %rbx
je 0x433a
cmpq $0x0, 0x8(%rbx)
je 0x433a
movq (%r14), %r14
cmpq $0x0, (%r14)
jne 0x42dc
testq %rbx, %rbx
je 0x4358
movq 0x8(%rbx), %rdi
testq %rdi, %rdi
je 0x4358
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x4014
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/JimKent[P]linearSat/linearSat/linearSat.c
// Function: predictFromWordTree
struct wordTree *predictFromWordTree(struct wordTree *wt, struct dlNode *recent)
/* Predict next word given tree and recently used word list.  Will use all words in
 * recent list if can,  but if there is not data in tree, will back off, and use
 * progressively less previous words. */
{
struct dlNode *node;
if (verboseLevel() >= 4)
    verbose(4, " predictNextFromWordTree(%s)\n", wordTreeString(wt));

for (node = recent; !dlEnd(node); node = node->next)
    {
    struct wordTree *result = predictNextFromAllPredecessors(wt, node);
    if (result != NULL)
        return result;
    }
return NULL;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
xorl %eax, %eax
callq 0x12f02
cmpl $0x4, %eax
jl 0x439b
movq %r14, %rdi
callq 0x3dce
leaq 0x144ae(%rip), %rsi     # 0x1883a
movl $0x4, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x12c8e
cmpq $0x0, (%rbx)
je 0x43be
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4289
testq %rax, %rax
cmovneq %rax, %r15
jne 0x43c1
movq (%rbx), %rbx
cmpq $0x0, (%rbx)
jne 0x43a1
xorl %r15d, %r15d
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/JimKent[P]linearSat/linearSat/linearSat.c
// Function: typeBefore
struct monomerType *typeBefore(struct alphaStore *store, struct monomerType *oldType, int amount)
/* Pick type that comes amount before given type. */
{
int typeIx = ptArrayIx(oldType, store->typeArray, store->typeCount);
typeIx -= amount;
while (typeIx < 0)
    typeIx += store->typeCount;
return store->typeArray[typeIx];
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %rax
movq %rdi, %rbx
movq 0x50(%rdi), %rsi
movl 0x48(%rdi), %edx
movq %rax, %rdi
callq 0x9513
subl %ebp, %eax
jns 0x4421
movl 0x48(%rbx), %ecx
addl %ecx, %eax
js 0x441d
movq 0x50(%rbx), %rcx
movl %eax, %eax
movq (%rcx,%rax,8), %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/JimKent[P]linearSat/linearSat/linearSat.c
// Function: predictNext
struct wordTree *predictNext(struct alphaStore *store, struct dlList *past)
/* Given input data store and what is known from the past, predict the next word. */
{
struct dlNode *recent = nodesFromTail(past, store->maxChainSize);
struct wordTree *pick =  predictFromWordTree(store->markovChains, recent);
if (pick == NULL)
    pick = predictFromPreviousTypes(store, past);
if (pick == NULL)
    {
    pick = pickWeightedRandomFromList(store->markovChains->children);
    verbose(3, "in predictNext() last resort pick of %s\n", pick->monomer->word);
    }
return pick;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movl 0x30(%rdi), %eax
movq 0x10(%rsi), %rsi
testl %eax, %eax
jle 0x45ae
movq 0x8(%rsi), %rsi
testq %rsi, %rsi
je 0x45ab
decl %eax
jne 0x459c
jmp 0x45ae
movq (%r14), %rsi
movq 0x20(%rbx), %rdi
callq 0x4366
movq %rax, %r15
testq %rax, %rax
jne 0x45cd
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4432
movq %rax, %r15
testq %r15, %r15
jne 0x45fd
movq 0x20(%rbx), %rax
movq 0x8(%rax), %rdi
callq 0x4014
movq %rax, %r15
movq 0x18(%rax), %rax
movq 0x8(%rax), %rdx
leaq 0x14322(%rip), %rsi     # 0x18913
movl $0x3, %edi
xorl %eax, %eax
callq 0x12c8e
movq %r15, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/JimKent[P]linearSat/linearSat/linearSat.c
// Function: decrementOutputCountsInTree
void decrementOutputCountsInTree(struct wordTree *wt)
/* Decrement output count of self and parents. */
{
while (wt != NULL)
    {
    /* Decrement target count, but don't let it fall below sum of counts of all children. 
     * This can happen with incomplete data if we don't prevent it.  This
     * same code also prevents us from having negative outTarget. */
    int outTarget = wt->outTarget - 1;
    int kidSum = wordTreeSumOutTargets(wt->children);
    if (outTarget < kidSum)
        outTarget = kidSum;
    wt->outTarget = outTarget;

    /* Always bump outCount to help us debug (only real use of outCount). */
    wt->outCount += 1;
    wt = wt->parent;
    }
}

// Assembly:
testq %rdi, %rdi
je 0x4635
movq 0x8(%rdi), %rcx
xorl %eax, %eax
testq %rcx, %rcx
je 0x461e
addl 0x24(%rcx), %eax
movq (%rcx), %rcx
jmp 0x4611
movl 0x24(%rdi), %ecx
leal -0x1(%rcx), %edx
cmpl %eax, %ecx
cmovlel %eax, %edx
movl %edx, 0x24(%rdi)
incl 0x28(%rdi)
movq 0x10(%rdi), %rdi
jmp 0x4606
retq