LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/tests/tests.c
// Function: sirtest_failnulls
bool sirtest_failnulls(void) {
    INIT_BASE(si, SIRL_ALL, 0, 0, 0, "", false);
    bool pass = true;

    _sir_eqland(pass, !sir_init(NULL));

    if (pass)
        PRINT_EXPECTED_ERROR();

    _sir_eqland(pass, sir_init(&si));
    _sir_eqland(pass, !sir_info(NULL)); //-V618 //-V575

    if (pass)
        PRINT_EXPECTED_ERROR();

    _sir_eqland(pass, 0U == sir_addfile(NULL, SIRL_ALL, SIRO_MSGONLY));

    if (pass)
        PRINT_EXPECTED_ERROR();

    _sir_eqland(pass, !sir_remfile(0U));

    if (pass)
        PRINT_EXPECTED_ERROR();

    _sir_eqland(pass, sir_cleanup());
    return PRINT_RESULT_RETURN(pass);
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsp, %rbx
movl $0x108, %edx            # imm = 0x108
movq %rbx, %rdi
xorl %esi, %esi
callq 0x31f0
movl $0x100000, %eax         # imm = 0x100000
movl %eax, 0x4(%rbx)
movw $0xff, (%rbx)
movl %eax, 0xc(%rbx)
movw $0x0, 0x8(%rbx)
xorl %edi, %edi
callq 0x9a31
movl %eax, %ebx
xorb $0x1, %bl
testb %al, %al
jne 0x4ad4
movl $0x1, %edi
movl $0x1, %esi
callq 0x3b04
movq %rsp, %rdi
callq 0x9a31
movl %eax, %ebp
andb %bl, %bpl
xorl %edi, %edi
xorl %eax, %eax
callq 0x9b13
movl %eax, %ebx
xorb $0x1, %bl
andb %bpl, %bl
cmpb $0x1, %bl
jne 0x4b06
movl $0x1, %edi
movl $0x1, %esi
callq 0x3b04
xorl %edi, %edi
movl $0xff, %esi
movl $0x7f00, %edx           # imm = 0x7F00
callq 0xa045
testl %eax, %eax
sete %al
andb %al, %bl
cmpb $0x1, %bl
jne 0x4b32
movl $0x1, %edi
movl $0x1, %esi
callq 0x3b04
xorl %edi, %edi
callq 0xa04a
xorb $0x1, %al
andb %al, %bl
cmpb $0x1, %bl
jne 0x4b51
movl $0x1, %edi
movl $0x1, %esi
callq 0x3b04
callq 0x9a36
andb %al, %bl
movzbl %bl, %edi
xorl %esi, %esi
callq 0x3b04
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/tests/tests.c
// Function: sirtest_failemptymessage
bool sirtest_failemptymessage(void) {
    INIT(si, SIRL_ALL, 0, 0, 0);
    bool pass = si_init;

    _sir_eqland(pass, !sir_debug("%s", ""));

    _sir_eqland(pass, sir_cleanup());
    return PRINT_RESULT_RETURN(pass);
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsp, %rbx
movl $0x108, %edx            # imm = 0x108
movq %rbx, %rdi
xorl %esi, %esi
callq 0x31f0
movl $0x100000, %eax         # imm = 0x100000
movl %eax, 0x4(%rbx)
movw $0xff, (%rbx)
movl %eax, 0xc(%rbx)
movw $0x0, 0x8(%rbx)
movq %rbx, %rdi
callq 0x9a31
movl %eax, %ebx
leaq 0xc67a(%rip), %rdi      # 0x11228
leaq 0xc712(%rip), %rsi      # 0x112c7
xorl %eax, %eax
callq 0x9a55
movl %eax, %ebp
xorb $0x1, %bpl
callq 0x9a36
andb %bl, %al
andb %bpl, %al
movzbl %al, %edi
xorl %esi, %esi
callq 0x3b04
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/tests/tests.c
// Function: sirtest_failinvalidfilename
bool sirtest_failinvalidfilename(void) {
    INIT(si, SIRL_ALL, 0, 0, 0);
    bool pass = si_init;

    _sir_eqland(pass, 0U == sir_addfile("bad file!/name", SIRL_ALL, SIRO_MSGONLY));

    if (pass)
        PRINT_EXPECTED_ERROR();

    _sir_eqland(pass, sir_cleanup());
    return PRINT_RESULT_RETURN(pass);
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsp, %rbx
movl $0x108, %edx            # imm = 0x108
movq %rbx, %rdi
xorl %esi, %esi
callq 0x31f0
movl $0x100000, %eax         # imm = 0x100000
movl %eax, 0x4(%rbx)
movw $0xff, (%rbx)
movl %eax, 0xc(%rbx)
movw $0x0, 0x8(%rbx)
movq %rbx, %rdi
callq 0x9a31
movl %eax, %ebx
leaq 0xcb7f(%rip), %rdi      # 0x11a8c
movl $0xff, %esi
movl $0x7f00, %edx           # imm = 0x7F00
callq 0xa045
testl %eax, %eax
sete %bpl
andb %bl, %bpl
cmpb $0x1, %bpl
jne 0x4f3a
movl $0x1, %edi
movl $0x1, %esi
callq 0x3b04
callq 0x9a36
andb %al, %bpl
movzbl %bpl, %edi
xorl %esi, %esi
callq 0x3b04
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/tests/tests.c
// Function: sirtest_failfilebadpermission
bool sirtest_failfilebadpermission(void) {
    INIT(si, SIRL_ALL, 0, 0, 0);
    bool pass = si_init;

#if !defined(__WIN__)
    static const char* path = "/noperms";
#else /* __WIN__ */
# if defined(__CYGWIN__)
    static const char* path = "/cygdrive/c/Windows/System32/noperms";
# else
    static const char* path;
    if (get_wineversion()) {
        path = "Z:\\noperms";
    } else {
        path = "C:\\Windows\\System32\\noperms";
    }
# endif
#endif

    _sir_eqland(pass, 0U == sir_addfile(path, SIRL_ALL, SIRO_MSGONLY));

    if (pass)
        PRINT_EXPECTED_ERROR();

    _sir_eqland(pass, sir_cleanup());
    return PRINT_RESULT_RETURN(pass);
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsp, %rbx
movl $0x108, %edx            # imm = 0x108
movq %rbx, %rdi
xorl %esi, %esi
callq 0x31f0
movl $0x100000, %eax         # imm = 0x100000
movl %eax, 0x4(%rbx)
movw $0xff, (%rbx)
movl %eax, 0xc(%rbx)
movw $0x0, 0x8(%rbx)
movq %rbx, %rdi
callq 0x9a31
movl %eax, %ebx
leaq 0xcb02(%rip), %rdi      # 0x11a9b
movl $0xff, %esi
movl $0x7f00, %edx           # imm = 0x7F00
callq 0xa045
testl %eax, %eax
sete %bpl
andb %bl, %bpl
cmpb $0x1, %bpl
jne 0x4fc6
movl $0x1, %edi
movl $0x1, %esi
callq 0x3b04
callq 0x9a36
andb %al, %bpl
movzbl %bpl, %edi
xorl %esi, %esi
callq 0x3b04
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/tests/tests.c
// Function: sirtest_failremovebadfile
bool sirtest_failremovebadfile(void) {
    INIT(si, SIRL_ALL, 0, 0, 0);
    bool pass = si_init;

    sirfileid invalidid = 9999999;
    _sir_eqland(pass, !sir_remfile(invalidid));

    if (pass)
        PRINT_EXPECTED_ERROR();

    _sir_eqland(pass, sir_cleanup());
    return PRINT_RESULT_RETURN(pass);
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsp, %rbx
movl $0x108, %edx            # imm = 0x108
movq %rbx, %rdi
xorl %esi, %esi
callq 0x31f0
movl $0x100000, %eax         # imm = 0x100000
movl %eax, 0x4(%rbx)
movw $0xff, (%rbx)
movl %eax, 0xc(%rbx)
movw $0x0, 0x8(%rbx)
movq %rbx, %rdi
callq 0x9a31
movl %eax, %ebp
movl $0x98967f, %edi         # imm = 0x98967F
callq 0xa04a
movl %eax, %ebx
xorb $0x1, %bl
andb %bpl, %bl
cmpb $0x1, %bl
jne 0x5266
movl $0x1, %edi
movl $0x1, %esi
callq 0x3b04
callq 0x9a36
andb %al, %bl
movzbl %bl, %edi
xorl %esi, %esi
callq 0x3b04
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/tests/tests.c
// Function: sirtest_rollandarchivefile
bool sirtest_rollandarchivefile(void) {
    bool pass = true;

    _sir_eqland(pass, roll_and_archive("rollandarchive1", ".log"));
    _sir_eqland(pass, roll_and_archive("rollandarchive2", ""));

    return pass;
}

// Assembly:
pushq %rbx
leaq 0xc8b9(%rip), %rdi      # 0x11b42
leaq 0xc827(%rip), %rsi      # 0x11ab7
callq 0x52ae
movl %eax, %ebx
leaq 0xc8b4(%rip), %rdi      # 0x11b52
leaq 0xc022(%rip), %rsi      # 0x112c7
callq 0x52ae
andb %bl, %al
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/tests/tests.c
// Function: sirtest_failwithoutinit
bool sirtest_failwithoutinit(void) {
    bool pass = !sir_info("sir isn't initialized; this needs to fail");

    if (pass)
        PRINT_EXPECTED_ERROR();

    return PRINT_RESULT_RETURN(pass);
}

// Assembly:
pushq %rbx
leaq 0xc46f(%rip), %rdi      # 0x11b62
xorl %eax, %eax
callq 0x9b13
movl %eax, %ebx
testb %al, %al
jne 0x570f
movl $0x1, %edi
movl $0x1, %esi
callq 0x3b04
xorb $0x1, %bl
movzbl %bl, %edi
xorl %esi, %esi
popq %rbx
jmp 0x3b04
// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/tests/tests.c
// Function: sirtest_isinitialized
bool sirtest_isinitialized(void) {

    bool pass = true;

    TEST_MSG_0("checking sir_isinitialized before initialization...");
    _sir_eqland(pass, !sir_isinitialized());

    INIT(si, SIRL_ALL, 0, 0, 0);
    _sir_eqland(pass, si_init);

    TEST_MSG_0("checking sir_isinitialized after initialization...");
    _sir_eqland(pass, sir_isinitialized());

    _sir_eqland(pass, sir_cleanup());

    TEST_MSG_0("checking sir_isinitialized after cleanup...");
    _sir_eqland(pass, !sir_isinitialized());

    return PRINT_RESULT_RETURN(pass);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
leaq 0xc45b(%rip), %rsi      # 0x11b8c
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
callq 0x9a3b
movl %eax, %ebx
movq %rsp, %r14
movl $0x108, %edx            # imm = 0x108
movq %r14, %rdi
xorl %esi, %esi
callq 0x31f0
movl $0x100000, %eax         # imm = 0x100000
movl %eax, 0x4(%r14)
movw $0xff, (%r14)
movl %eax, 0xc(%r14)
movw $0x0, 0x8(%r14)
xorb $0x1, %bl
movq %r14, %rdi
callq 0x9a31
movl %eax, %ebp
leaq 0xc43e(%rip), %rsi      # 0x11bc2
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
callq 0x9a3b
movl %eax, %r14d
callq 0x9a36
movl %eax, %r15d
leaq 0xc450(%rip), %rsi      # 0x11bf7
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
callq 0x9a3b
xorb $0x1, %al
andb %r14b, %r15b
andb %al, %r15b
andb %bl, %bpl
andb %r15b, %bpl
movzbl %bpl, %edi
xorl %esi, %esi
callq 0x3b04
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/tests/tests.c
// Function: sirtest_failinittwice
bool sirtest_failinittwice(void) {
    INIT(si, SIRL_ALL, 0, 0, 0);
    bool pass = si_init;

    INIT(si2, SIRL_ALL, 0, 0, 0);
    _sir_eqland(pass, !si2_init);

    if (pass)
        PRINT_EXPECTED_ERROR();

    _sir_eqland(pass, sir_cleanup());
    return PRINT_RESULT_RETURN(pass);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x210, %rsp            # imm = 0x210
leaq 0x108(%rsp), %rbx
xorl %r14d, %r14d
movl $0x108, %edx            # imm = 0x108
movq %rbx, %rdi
xorl %esi, %esi
callq 0x31f0
movl $0x100000, %r15d        # imm = 0x100000
movl %r15d, 0x4(%rbx)
movw $0xff, %r12w
movw %r12w, (%rbx)
movl %r15d, 0xc(%rbx)
movw %r14w, 0x8(%rbx)
movq %rbx, %rdi
callq 0x9a31
movl %eax, %ebp
movq %rsp, %rbx
movl $0x108, %edx            # imm = 0x108
movq %rbx, %rdi
xorl %esi, %esi
callq 0x31f0
movl %r15d, 0x4(%rbx)
movw %r12w, (%rbx)
movl %r15d, 0xc(%rbx)
movw %r14w, 0x8(%rbx)
movq %rbx, %rdi
callq 0x9a31
movl %eax, %ebx
xorb $0x1, %bl
andb %bpl, %bl
cmpb $0x1, %bl
jne 0x5875
movl $0x1, %edi
movl $0x1, %esi
callq 0x3b04
callq 0x9a36
andb %al, %bl
movzbl %bl, %edi
xorl %esi, %esi
callq 0x3b04
addq $0x210, %rsp            # imm = 0x210
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/tests/tests.c
// Function: sirtest_failinvalidinitdata
bool sirtest_failinvalidinitdata(void) {
    sirinit si;

    /* fill with bad data. */
    (void)memset(&si, 0xab, sizeof(sirinit));

    TEST_MSG_0("calling sir_init with invalid data...");
    bool pass = !sir_init(&si);

    if (pass)
        PRINT_EXPECTED_ERROR();

    (void)sir_cleanup();
    return PRINT_RESULT_RETURN(pass);
}

// Assembly:
pushq %rbx
subq $0x110, %rsp            # imm = 0x110
leaq 0x8(%rsp), %rbx
movl $0x108, %edx            # imm = 0x108
movq %rbx, %rdi
movl $0xab, %esi
callq 0x31f0
leaq 0xc369(%rip), %rsi      # 0x11c25
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movq %rbx, %rdi
callq 0x9a31
movl %eax, %ebx
testb %al, %al
jne 0x58e5
movl $0x1, %edi
movl $0x1, %esi
callq 0x3b04
xorb $0x1, %bl
callq 0x9a36
movzbl %bl, %edi
xorl %esi, %esi
callq 0x3b04
addq $0x110, %rsp            # imm = 0x110
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/tests/tests.c
// Function: sirtest_initcleanupinit
bool sirtest_initcleanupinit(void) {
    INIT(si1, SIRL_ALL, 0, 0, 0);
    bool pass = si1_init;

    _sir_eqland(pass, sir_info("init called once; testing output..."));
    _sir_eqland(pass, sir_cleanup());

    INIT(si2, SIRL_ALL, 0, 0, 0);
    _sir_eqland(pass, si2_init);

    _sir_eqland(pass, sir_info("init called again after re-init; testing output..."));
    _sir_eqland(pass, sir_cleanup());

    return PRINT_RESULT_RETURN(pass);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x218, %rsp            # imm = 0x218
leaq 0x110(%rsp), %rbx
xorl %ebp, %ebp
movl $0x108, %edx            # imm = 0x108
movq %rbx, %rdi
xorl %esi, %esi
callq 0x31f0
movl $0x100000, %r13d        # imm = 0x100000
movl %r13d, 0x4(%rbx)
movw $0xff, %r12w
movw %r12w, (%rbx)
movl %r13d, 0xc(%rbx)
movw %bp, 0x8(%rbx)
movq %rbx, %rdi
callq 0x9a31
movl %eax, %ebx
leaq 0xc2f7(%rip), %rdi      # 0x11c4d
xorl %eax, %eax
callq 0x9b13
movl %eax, %ebp
callq 0x9a36
movl %eax, %r14d
leaq 0x8(%rsp), %r15
movl $0x108, %edx            # imm = 0x108
movq %r15, %rdi
xorl %esi, %esi
callq 0x31f0
movl %r13d, 0x4(%r15)
movw %r12w, (%r15)
movl %r13d, 0xc(%r15)
xorl %eax, %eax
movw %ax, 0x8(%r15)
movq %r15, %rdi
callq 0x9a31
movl %eax, %r15d
leaq 0xc2d1(%rip), %rdi      # 0x11c71
xorl %eax, %eax
callq 0x9b13
movl %eax, %r12d
callq 0x9a36
andb %r12b, %al
andb %r14b, %r15b
andb %al, %r15b
andb %bl, %bpl
andb %r15b, %bpl
movzbl %bpl, %edi
xorl %esi, %esi
callq 0x3b04
addq $0x218, %rsp            # imm = 0x218
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/tests/tests.c
// Function: sirtest_initmakeinit
bool sirtest_initmakeinit(void) {
    bool pass = true;

    sirinit si;
    _sir_eqland(pass, sir_makeinit(&si));
    _sir_eqland(pass, sir_init(&si));
    _sir_eqland(pass, sir_info("initialized with sir_makeinit"));
    _sir_eqland(pass, sir_cleanup());

    return PRINT_RESULT_RETURN(pass);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x110, %rsp            # imm = 0x110
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x9a2c
movl %eax, %ebp
movq %rbx, %rdi
callq 0x9a31
movl %eax, %ebx
leaq 0xc29e(%rip), %rdi      # 0x11ca4
xorl %eax, %eax
callq 0x9b13
movl %eax, %r14d
callq 0x9a36
andb %r14b, %al
andb %bpl, %bl
andb %al, %bl
movzbl %bl, %edi
xorl %esi, %esi
callq 0x3b04
addq $0x110, %rsp            # imm = 0x110
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/tests/tests.c
// Function: sirtest_failaftercleanup
bool sirtest_failaftercleanup(void) {
    INIT(si, SIRL_ALL, 0, 0, 0);
    bool pass = si_init;

    _sir_eqland(pass, sir_cleanup());
    _sir_eqland(pass, !sir_info("already cleaned up; this needs to fail"));

    if (pass)
        PRINT_EXPECTED_ERROR();

    return PRINT_RESULT_RETURN(pass);
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsp, %rbx
movl $0x108, %edx            # imm = 0x108
movq %rbx, %rdi
xorl %esi, %esi
callq 0x31f0
movl $0x100000, %eax         # imm = 0x100000
movl %eax, 0x4(%rbx)
movw $0xff, (%rbx)
movl %eax, 0xc(%rbx)
movw $0x0, 0x8(%rbx)
movq %rbx, %rdi
callq 0x9a31
movl %eax, %ebp
callq 0x9a36
movl %eax, %ebx
leaq 0xc246(%rip), %rdi      # 0x11cc2
xorl %eax, %eax
callq 0x9b13
xorb $0x1, %al
andb %bpl, %bl
andb %al, %bl
cmpb $0x1, %bl
jne 0x5a9e
movl $0x1, %edi
movl $0x1, %esi
callq 0x3b04
movzbl %bl, %edi
xorl %esi, %esi
callq 0x3b04
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/tests/tests.c
// Function: filter_error
bool filter_error(bool pass, uint16_t err) {
    if (!pass) {
        char msg[SIR_MAXERROR] = {0};
        if (sir_geterror(msg) != err)
            return false;
    }
    return true;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
testl %edi, %edi
jne 0x7c7d
movl %esi, %ebx
movq %rsp, %r14
xorl %ebp, %ebp
movl $0x100, %edx            # imm = 0x100
movq %r14, %rdi
xorl %esi, %esi
callq 0x31f0
movq %r14, %rdi
callq 0x9a40
cmpw %bx, %ax
jne 0x7c80
movb $0x1, %bpl
movl %ebp, %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/tests/tests.c
// Function: sirtest_getcpucount
bool sirtest_getcpucount(void) {
    INIT(si, SIRL_ALL, 0, 0, 0);
    bool pass = si_init;

    TEST_MSG_0("checking processor counting function...");

    const long cpus = _sir_nprocs_test();
    _sir_eqland(pass, 0 < cpus);

    TEST_MSG("processor(s) detected: %ld", cpus);

    _sir_eqland(pass, sir_cleanup());
    return PRINT_RESULT_RETURN(pass);
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsp, %rbx
movl $0x108, %edx            # imm = 0x108
movq %rbx, %rdi
xorl %esi, %esi
callq 0x31f0
movl $0x100000, %eax         # imm = 0x100000
movl %eax, 0x4(%rbx)
movw $0xff, (%rbx)
movl %eax, 0xc(%rbx)
movw $0x0, 0x8(%rbx)
movq %rbx, %rdi
callq 0x9a31
movl %eax, %ebx
leaq 0xb03e(%rip), %rsi      # 0x14276
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
movl $0x1, %edi
callq 0xea15
testq %rax, %rax
setg %bpl
leaq 0xb044(%rip), %rsi      # 0x142a0
movl $0x1, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3400
callq 0x9a36
andb %bl, %al
andb %bpl, %al
movzbl %al, %edi
xorl %esi, %esi
callq 0x3b04
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/tests/tests.c
// Function: sirtest_getversioninfo
bool sirtest_getversioninfo(void) {
    INIT(si, SIRL_ALL, 0, 0, 0);
    bool pass = si_init;

    TEST_MSG_0("checking version retrieval functions...");

    const char* str = sir_getversionstring();
    _sir_eqland(pass, _sir_validstrnofail(str));

    TEST_MSG("version as string: '%s'", _SIR_PRNSTR(str));

    uint32_t hex = sir_getversionhex();
    _sir_eqland(pass, 0 != hex);

    TEST_MSG("version as hex: 0x%08"PRIx32"", hex);

    bool prerel = sir_isprerelease();
    TEST_MSG("prerelease: %s", prerel ? "true" : "false");

    _sir_eqland(pass, sir_cleanup());
    return PRINT_RESULT_RETURN(pass);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x110, %rsp            # imm = 0x110
leaq 0x8(%rsp), %rbx
xorl %ebp, %ebp
movl $0x108, %edx            # imm = 0x108
movq %rbx, %rdi
xorl %esi, %esi
callq 0x31f0
movl $0x100000, %eax         # imm = 0x100000
movl %eax, 0x4(%rbx)
movw $0xff, (%rbx)
movl %eax, 0xc(%rbx)
movw $0x0, 0x8(%rbx)
movq %rbx, %rdi
callq 0x9a31
movl %eax, %ebx
leaq 0xafec(%rip), %rsi      # 0x142bd
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
callq 0xa336
testq %rax, %rax
je 0x92f0
cmpb $0x0, (%rax)
setne %bpl
jmp 0x92f7
leaq 0xb00a(%rip), %rax      # 0x14301
leaq 0xafe9(%rip), %rsi      # 0x142e7
movl $0x1, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3400
callq 0xa33e
testl %eax, %eax
setne %r14b
leaq 0xafe9(%rip), %rsi      # 0x14308
movl $0x1, %edi
movl %eax, %edx
xorl %eax, %eax
callq 0x3400
callq 0xa344
leaq 0xa414(%rip), %rcx      # 0x1374d
leaq 0xa412(%rip), %rdx      # 0x13752
testb %al, %al
cmovneq %rcx, %rdx
leaq 0xafd4(%rip), %rsi      # 0x14321
movl $0x1, %edi
xorl %eax, %eax
callq 0x3400
callq 0x9a36
andb %bpl, %al
andb %bl, %al
andb %r14b, %al
movzbl %al, %edi
xorl %esi, %esi
callq 0x3b04
addq $0x110, %rsp            # imm = 0x110
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/tests/tests.c
// Function: sirtest_threadpool
bool sirtest_threadpool(void) {
    INIT(si, SIRL_ALL, SIRO_NOTIME | SIRO_NOHOST | SIRO_NONAME, 0, 0);
    bool pass = si_init;

    static const size_t num_jobs = 30;
    sir_threadpool* pool         = NULL;

    _sir_eqland(pass, _sir_threadpool_create(&pool, NUM_THREADS));
    if (pass) {
        /* dispatch a whole bunch of jobs. */
        for (size_t n = 0; n < num_jobs; n++) {
            sir_threadpool_job* job = calloc(1, sizeof(sir_threadpool_job));
            _sir_eqland(pass, NULL != job);
            if (job) {
                job->fn = &threadpool_pseudojob;
                job->data = (void*)(n + 1);
                _sir_eqland(pass, _sir_threadpool_add_job(pool, job));
                _sir_eqland(pass, sir_info("dispatched job (fn: %"PRIxPTR", data: %p)",
                    (uintptr_t)job->fn, job->data));
            }
        }

        sir_sleep_msec(1000);

        _sir_eqland(pass, sir_info("destroying thread pool..."));
        _sir_eqland(pass, _sir_threadpool_destroy(&pool));
    }

    _sir_eqland(pass, sir_cleanup());
    return PRINT_RESULT_RETURN(pass);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
leaq 0x10(%rsp), %rbx
movl $0x108, %edx            # imm = 0x108
movq %rbx, %rdi
xorl %esi, %esi
callq 0x31f0
movl $0x1500, 0x4(%rbx)      # imm = 0x1500
movw $0xff, (%rbx)
movl $0x100000, 0xc(%rbx)    # imm = 0x100000
movw $0x0, 0x8(%rbx)
movq %rbx, %rdi
callq 0x9a31
movl %eax, %ebp
leaq 0x8(%rsp), %rdi
movq $0x0, (%rdi)
movl $0x4, %esi
callq 0xfcf8
movl %eax, %ebx
andb %bpl, %bl
cmpb $0x1, %bl
jne 0x947f
movl $0x1, %r12d
leaq 0xad(%rip), %r13        # 0x94a2
leaq 0xaf36(%rip), %r14      # 0x14332
movl %ebx, %ebp
movl $0x1, %edi
movl $0x10, %esi
callq 0x32b0
testq %rax, %rax
setne %bl
andb %bpl, %bl
testq %rax, %rax
je 0x944d
movq %rax, %r15
movq %r13, (%rax)
movq %r12, 0x8(%rax)
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x100f3
movl %eax, %ebp
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq %r14, %rdi
xorl %eax, %eax
callq 0x9b13
andb %bl, %bpl
andb %al, %bpl
movl %ebp, %ebx
incq %r12
cmpq $0x1f, %r12
jne 0x93fc
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x3f87
leaq 0xaeee(%rip), %rdi      # 0x14355
xorl %eax, %eax
callq 0x9b13
movl %eax, %ebp
leaq 0x8(%rsp), %rdi
callq 0xff38
andb %bpl, %al
andb %al, %bl
callq 0x9a36
andb %bl, %al
movzbl %al, %edi
xorl %esi, %esi
callq 0x3b04
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/tests/tests.c
// Function: threadpool_pseudojob
static bool threadpool_pseudojob(void* arg) {
    char thread_name[SIR_MAXPID] = {0};

    _sir_snprintf_trunc(thread_name, SIR_MAXPID, "pool.%p", arg);
    (void)_sir_setthreadname(thread_name);

    (void)sir_debug("start of pseudo job that does nothing (arg: %p)", arg);
    sir_sleep_msec(1000);
    (void)sir_debug("end of pseudo job that does nothing (arg: %p)", arg);

    return true;
}

// Assembly:
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x10, 0x8(%rsp)
movq 0x8(%rsp), %rsi
leaq 0xb85e(%rip), %r8       # 0x14d28
movl $0x10, %ecx
movl $0x1, %edx
movq %rbx, %r9
xorl %eax, %eax
callq 0x3040
testl %eax, %eax
jne 0x94e7
movq 0x8(%rsp), %rax
leaq 0x10(%rsp), %rdi
callq 0xe9b8
leaq 0xb838(%rip), %rdi      # 0x14d30
movq %rbx, %rsi
xorl %eax, %eax
callq 0x9a55
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x3f87
leaq 0xb84d(%rip), %rdi      # 0x14d60
movq %rbx, %rsi
xorl %eax, %eax
callq 0x9a55
movb $0x1, %al
addq $0x20, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/src/sirthreadpool.c
// Function: sir_threadpool_destroy
bool _sir_threadpool_destroy(sir_threadpool** pool) {
    if (!pool || !*pool)
        return _sir_seterror(_SIR_E_INVALID);

    bool locked = _sir_mutexlock(&(*pool)->mutex);
    SIR_ASSERT(locked);

    if (locked) {
        _sir_selflog("broadcasting signal to condition var...");
        (*pool)->cancel = true;

        bool bcast = _sir_condbroadcast(&(*pool)->cond);
        SIR_ASSERT_UNUSED(bcast, bcast);

        bool unlock = _sir_mutexunlock(&(*pool)->mutex);
        SIR_ASSERT_UNUSED(unlock, unlock);
    }

    bool destroy = true;
    for (size_t n = 0; n < (*pool)->num_threads; n++) {
        SIR_ASSERT(0 != (*pool)->threads[n]);
        if (0 == (*pool)->threads[n])
            continue;
        _sir_selflog("joining thread %zu of %zu...", n + 1, (*pool)->num_threads);
#if !defined(__WIN__)
        int join = pthread_join((*pool)->threads[n], NULL);
        SIR_ASSERT(0 == join);
        _sir_eqland(destroy, 0 == join);
#else /* __WIN__ */
        DWORD join = WaitForSingleObject((*pool)->threads[n], INFINITE);
        SIR_ASSERT(WAIT_OBJECT_0 == join);
        _sir_eqland(destroy, WAIT_OBJECT_0 == join);
#endif
    }

    _sir_eqland(destroy, _sir_queue_destroy(&(*pool)->jobs));
    SIR_ASSERT(destroy);

    _sir_eqland(destroy, _sir_conddestroy(&(*pool)->cond));
    SIR_ASSERT(destroy);

    _sir_eqland(destroy, _sir_mutexdestroy(&(*pool)->mutex));
    SIR_ASSERT(destroy);

    _sir_safefree(&(*pool)->threads);
    _sir_safefree(pool);

    return destroy;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testq %rdi, %rdi
je 0xffb7
movq %rdi, %rbx
movq (%rdi), %rdi
testq %rdi, %rdi
je 0xffb7
addq $0x48, %rdi
callq 0xeb24
testb %al, %al
je 0xff79
movq (%rbx), %rdi
movb $0x1, 0x70(%rdi)
addq $0x18, %rdi
callq 0x101cc
movq (%rbx), %rdi
addq $0x48, %rdi
callq 0xebc2
movq (%rbx), %rdi
cmpq $0x0, 0x8(%rdi)
je 0xffdc
movb $0x1, %r12b
xorl %r14d, %r14d
xorl %r15d, %r15d
movq (%rdi), %rax
movq (%rax,%r15,8), %rdi
testq %rdi, %rdi
je 0xffa9
xorl %esi, %esi
callq 0x3540
testl %eax, %eax
movzbl %r12b, %r12d
cmovnel %r14d, %r12d
incq %r15
movq (%rbx), %rdi
cmpq 0x8(%rdi), %r15
jb 0xff8c
jmp 0xffdf
leaq 0x5ab2(%rip), %rsi      # 0x15a70
leaq 0x5a9b(%rip), %rdx      # 0x15a60
movl $0x800c0000, %edi       # imm = 0x800C0000
movl $0x8a, %ecx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xa348
movb $0x1, %r12b
addq $0x10, %rdi
callq 0x1045c
movl %eax, %ebp
movq (%rbx), %rdi
addq $0x18, %rdi
callq 0x1021e
movl %eax, %r14d
movq (%rbx), %rdi
addq $0x48, %rdi
callq 0xec11
movl %eax, %r15d
andb %r14b, %r15b
andb %r12b, %bpl
andb %bpl, %r15b
movq (%rbx), %rdi
callq 0xc618
movq %rbx, %rdi
callq 0xc618
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/src/sirthreadpool.c
// Function: sir_threadpool_add_job
bool _sir_threadpool_add_job(sir_threadpool* pool, sir_threadpool_job* job) {
    bool retval = false;

    if (pool && pool->jobs && job && job->fn && job->data) {
        bool locked = _sir_mutexlock(&pool->mutex);
        SIR_ASSERT(locked);

        if (locked) {
            if (_sir_queue_push(pool->jobs, job)) {
                retval = _sir_condbroadcast(&pool->cond);
                _sir_selflog("added job; new size: %zu", _sir_queue_size(pool->jobs));
            }

            bool unlocked = _sir_mutexunlock(&pool->mutex);
            SIR_ASSERT_UNUSED(unlocked, unlocked);
        }
    }

    return retval;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x10159
movq %rsi, %r12
xorl %ebx, %ebx
testq %rsi, %rsi
je 0x1015b
movq %rdi, %r14
cmpq $0x0, 0x10(%rdi)
je 0x1015b
cmpq $0x0, (%r12)
je 0x10159
cmpq $0x0, 0x8(%r12)
je 0x10159
leaq 0x48(%r14), %r15
movq %r15, %rdi
callq 0xeb24
testb %al, %al
je 0x10159
movq 0x10(%r14), %rdi
movq %r12, %rsi
callq 0x10526
testb %al, %al
je 0x10169
leaq 0x18(%r14), %rdi
callq 0x101cc
movl %eax, %ebx
movq 0x10(%r14), %rdi
callq 0x104f7
jmp 0x1016b
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
xorl %ebx, %ebx
movq %r15, %rdi
callq 0xebc2
jmp 0x1015b
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/src/sircondition.c
// Function: sir_condwait_timeout
bool _sir_condwait_timeout(sir_condition* cond, sir_mutex* mutex,
    const sir_wait* howlong) {
    bool valid = _sir_validptr(cond) && _sir_validptr(mutex) && _sir_validptr(howlong);

    if (valid) {
#if !defined(__WIN__)
        int op = pthread_cond_timedwait(cond, mutex, howlong);
        valid = 0 == op ? true : ETIMEDOUT == op ? false : _sir_handleerr(op);
#else
        valid = (FALSE != SleepConditionVariableCS(cond, mutex, *howlong))
            ? true : _sir_handlewin32err(GetLastError());
#endif
    }

    return valid;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
sete %cl
orb %al, %cl
je 0x10294
xorl %ebp, %ebp
jmp 0x1029d
testq %rbx, %rbx
setne %bpl
jne 0x102ba
leaq 0x5827(%rip), %rsi      # 0x15acb
leaq 0x57ed(%rip), %rdx      # 0x15a98
movl $0x800b0000, %edi       # imm = 0x800B0000
movl $0x76, %ecx
callq 0xa348
testb %bpl, %bpl
je 0x102dd
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x3450
testl %eax, %eax
je 0x102da
cmpl $0x6e, %eax
jne 0x102ea
xorl %ebp, %ebp
jmp 0x102dd
movb $0x1, %bpl
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x57da(%rip), %rsi      # 0x15acb
leaq 0x57a0(%rip), %rdx      # 0x15a98
movl %eax, %edi
movl $0x7b, %ecx
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xa444
nop
// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/src/sirqueue.c
// Function: sir_queue_node_create
sir_queue_node* _sir_queue_node_create(void* data) {
    sir_queue_node* retval = calloc(1, sizeof(sir_queue_node));
    if (!retval)
        (void)_sir_handleerr(errno);
    else
        retval->data = data;

    return retval;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movl $0x1, %edi
movl $0x10, %esi
callq 0x32b0
movq %rax, %rbx
testq %rax, %rax
je 0x1036c
movq %r14, 0x8(%rbx)
jmp 0x1038b
callq 0x3080
movl (%rax), %edi
leaq 0x5785(%rip), %rsi      # 0x15aff
leaq 0x5795(%rip), %rdx      # 0x15b16
movl $0x27, %ecx
callq 0xa444
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/src/sirqueue.c
// Function: sir_queue_node_destroy
bool _sir_queue_node_destroy(sir_queue_node** node, void** data) {
    bool valid = _sir_validptrptr(node) && _sir_validptr(*node);

    if (valid) {
        if (data)
            *data = (*node)->data;

        _sir_safefree(node);
    }

    return valid;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
testq %rdi, %rdi
je 0x103b1
cmpq $0x0, (%rbx)
setne %bpl
jne 0x103d0
jmp 0x103b3
xorl %ebp, %ebp
leaq 0x5767(%rip), %rsi      # 0x15b21
leaq 0x5755(%rip), %rdx      # 0x15b16
movl $0x800b0000, %edi       # imm = 0x800B0000
movl $0x2f, %ecx
callq 0xa348
testb %bpl, %bpl
je 0x103ec
testq %r14, %r14
je 0x103e4
movq (%rbx), %rax
movq 0x8(%rax), %rax
movq %rax, (%r14)
movq %rbx, %rdi
callq 0xc618
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/src/sirqueue.c
// Function: sir_queue_destroy
bool _sir_queue_destroy(sir_queue** q) {
    bool valid = _sir_validptrptr(q) && _sir_validptr(*q);

    if (valid) {
        sir_queue_node* next = (*q)->head;
        while (next) {
            sir_queue_node* this_node = next;
            void* data                = NULL;
            next                      = this_node->next;

            if (_sir_queue_node_destroy(&this_node, &data))
                _sir_safefree(&data);
        }

        _sir_safefree(q);
    }

    return valid;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
testq %rdi, %rdi
je 0x1047c
cmpq $0x0, (%rbx)
setne %bpl
jne 0x1049b
jmp 0x1047e
xorl %ebp, %ebp
leaq 0x56c6(%rip), %rsi      # 0x15b4b
leaq 0x568a(%rip), %rdx      # 0x15b16
movl $0x800b0000, %edi       # imm = 0x800B0000
movl $0x48, %ecx
callq 0xa348
testb %bpl, %bpl
je 0x104e8
movq (%rbx), %rax
movq (%rax), %r12
testq %r12, %r12
je 0x104e0
leaq 0x8(%rsp), %r14
movq %rsp, %r15
movq %r12, 0x8(%rsp)
movq $0x0, (%rsp)
movq (%r12), %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x10396
testb %al, %al
je 0x104db
movq %r15, %rdi
callq 0xc618
testq %r12, %r12
jne 0x104b3
movq %rbx, %rdi
callq 0xc618
movl %ebp, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/aremmell[P]libsir/src/sirqueue.c
// Function: sir_queue_push
bool _sir_queue_push(sir_queue* q, void* data) {
    bool retval = false;

    if (_sir_validptr(q)) {
        if (!q->head) {
            q->head = _sir_queue_node_create(data);
            retval = NULL != q->head;
        } else {
            sir_queue_node* next = q->head;
            while (next) {
                if (!next->next) {
                    next->next = _sir_queue_node_create(data);
                    if (next->next) {
                        retval = true;
                        break;
                    }
                }
                next = next->next;
            }
        }
    }

    return retval;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x10561
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %r15
testq %r15, %r15
je 0x10582
cmpq $0x0, (%r15)
jne 0x10554
movq %rbx, %rdi
callq 0x10348
movq %rax, (%r15)
testq %rax, %rax
jne 0x10595
movq (%r15), %r15
testq %r15, %r15
setne %al
jne 0x1053e
jmp 0x10597
leaq 0x55f6(%rip), %rsi      # 0x15b5e
leaq 0x55a7(%rip), %rdx      # 0x15b16
movl $0x800b0000, %edi       # imm = 0x800B0000
movl $0x70, %ecx
callq 0xa348
xorl %eax, %eax
jmp 0x10597
movq %rbx, %rdi
callq 0x10348
movq %rax, (%r14)
testq %rax, %rax
setne %al
jmp 0x10597
movb $0x1, %al
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/giometti[P]mastering_UNIX_programming/chapter_09/scdu.c
// Function: crypt_std
void crypt_std(char *text, size_t n)
{
	int i, c;
	char base;

	for (i = 0; i < n; i++) {
		if ((text[i] >= 'a') && (text[i] <= 'z'))
			base = 'a';
		else if ((text[i] >= 'A') && (text[i] <= 'Z'))
			base = 'A';
		else
			continue;
		
		c = text[i] - base;
		c = (c + 1) % 26;
		text[i] = c + base;
	}
}

// Assembly:
testq %rsi, %rsi
je 0x134c
xorl %eax, %eax
movsbl (%rdi,%rax), %edx
leal -0x61(%rdx), %r8d
movl $0x61, %ecx
cmpb $0x1a, %r8b
jb 0x1315
leal -0x41(%rdx), %r8d
movl $0x41, %ecx
cmpb $0x19, %r8b
ja 0x1344
subl %ecx, %edx
incl %edx
movslq %edx, %rdx
imulq $0x4ec4ec4f, %rdx, %r8  # imm = 0x4EC4EC4F
movq %r8, %r9
shrq $0x3f, %r9
sarq $0x23, %r8
addl %r9d, %r8d
leal (%r8,%r8,4), %r9d
leal (%r9,%r9,4), %r9d
addl %r8d, %r9d
subl %r9d, %edx
addl %ecx, %edx
movb %dl, (%rdi,%rax)
incq %rax
cmpq %rax, %rsi
jne 0x12f3
retq
// File: /workspace/github_c_makefile_star2_O1/giometti[P]mastering_UNIX_programming/chapter_09/scdu.c
// Function: load_funcs
void load_funcs(char *module, func_t *crypt, func_t *decrypt)
{
	void *handler;

	if (module == NULL) {
		/* Use standard functions */
		*crypt = crypt_std;
		*decrypt = decrypt_std;

		return;
	}

	/* Try to load external functions */
	handler = dlopen(module, RTLD_NOW | RTLD_GLOBAL);
	if (!handler) {
		fprintf(stderr,
			"cannot load module %s\n", module);
		exit(EXIT_FAILURE);
	}

	*crypt = (func_t) dlsym(handler, "mod_crypt");
	if (!*crypt) {
		fprintf(stderr,
			"cannot find crypt() function: %s\n", dlerror());
		exit(EXIT_FAILURE);
	}

	*decrypt = (func_t) dlsym(handler, "mod_decrypt");
	if (!*crypt) {
		fprintf(stderr,
			"cannot find decrypt() function: %s\n", dlerror());
		exit(EXIT_FAILURE);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
testq %rdi, %rdi
je 0x140f
movq %rdi, %r12
movl $0x102, %esi            # imm = 0x102
callq 0x1060
testq %rax, %rax
je 0x142f
movq %rax, %r15
leaq 0xc39(%rip), %rsi       # 0x201b
movq %rax, %rdi
callq 0x1090
movq %rax, (%r14)
testq %rax, %rax
je 0x1437
leaq 0xc4e(%rip), %rsi       # 0x2047
movq %r15, %rdi
callq 0x1090
movq %rax, (%rbx)
cmpq $0x0, (%r14)
jne 0x1423
callq 0x10d0
leaq -0x12a(%rip), %rax      # 0x12ec
movq %rax, (%r14)
leaq -0xd3(%rip), %rax       # 0x134d
movq %rax, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %r12, %rdi
callq 0x1128
callq 0x10fc
// File: /workspace/github_c_makefile_star2_O1/giometti[P]mastering_UNIX_programming/chapter_09/scdu.c
// Function: main
int main(int argc, char *argv[ ])
{
	bool do_decrypt = false;
	int errflg = 0;
	char *module = NULL, *text;
	func_t crypt, decrypt;
	int c, n;

	/* Parse the command line */
	while ((c = getopt(argc, argv, ":hdf:")) != -1) {
		switch(c) {
		case 'h':
			usage(argv[0], EXIT_SUCCESS);

		case 'd':
			do_decrypt = true;
			break;

		case 'f':
			module = optarg;
			break;

		case ':':       /* missing operand? */
			fprintf(stderr,
				"option -%c requires an operand\n",
				optopt);
			errflg++;
			break;

		case '?':	/* invalid option? */
			fprintf(stderr,
				"unrecognized option: '-%c'\n",

				optopt);
			errflg++;
		}
	}
	if (errflg)
		usage(argv[0], EXIT_FAILURE);
	if (optind == argc) {
		fprintf(stderr, "no input text\n");
		exit(EXIT_FAILURE);
	}
	text = argv[optind];

	/* Load standard or external function within a module */
	load_funcs(module, &crypt, &decrypt);

	/* Do the job */
	n = strlen(text);
	if (do_decrypt)
		decrypt(text, n);
	else
		crypt(text, n);

	/* Print the result */
	printf("%*s\n", n, text);

	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movl %edi, %ebp
xorl %r14d, %r14d
leaq 0xc24(%rip), %r15       # 0x20a2
xorl %r12d, %r12d
xorl %r13d, %r13d
movl %ebp, %edi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x1080
cmpl $0x63, %eax
jle 0x14aa
cmpl $0x64, %eax
je 0x14cc
cmpl $0x66, %eax
je 0x14c0
cmpl $0x68, %eax
jne 0x1484
jmp 0x154b
cmpl $-0x1, %eax
je 0x14db
cmpl $0x3a, %eax
je 0x14d1
cmpl $0x3f, %eax
jne 0x1484
callq 0x114c
jmp 0x14d6
movq 0x2b09(%rip), %rax      # 0x3fd0
movq (%rax), %r14
jmp 0x1484
movb $0x1, %r13b
jmp 0x1484
callq 0x116d
incl %r12d
jmp 0x1484
testl %r12d, %r12d
jne 0x1553
movq 0x2ae1(%rip), %rax      # 0x3fc8
movslq (%rax), %rax
cmpl %ebp, %eax
je 0x155b
movq (%rbx,%rax,8), %rbx
leaq 0x10(%rsp), %r15
leaq 0x8(%rsp), %r12
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x13b3
movq %rbx, %rdi
callq 0x1040
movslq %eax, %r14
testb $0x1, %r13b
cmovneq %r12, %r15
movq %rbx, %rdi
movq %r14, %rsi
callq *(%r15)
leaq 0xbc6(%rip), %rdi       # 0x20f3
movl %r14d, %esi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x1050
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x118e
movq %rbx, %rdi
callq 0x11b1
callq 0x11d5
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/minidump.c
// Function: read_minidump_header
int read_minidump_header(struct minidump_header_t *minidump_header, FILE *in)
{
  read_chars(in, minidump_header->magic1, 4);
  read_chars_bin(in, minidump_header->magic2, 2);
  minidump_header->version = read_uint16(in);
  minidump_header->num_streams = read_uint32(in);
  minidump_header->ofs_streams = read_uint32(in);
  minidump_header->checksum = read_uint32(in);
  minidump_header->timestamp = read_uint32(in);
  minidump_header->flags = read_uint64(in);

  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
movq %rbx, %rsi
movl $0x4, %edx
callq 0x17f6
leaq 0x4(%rbx), %rsi
movq %r14, %rdi
movl $0x2, %edx
callq 0x183a
movq %r14, %rdi
callq 0x17d0
movw %ax, 0x6(%rbx)
movq %r14, %rdi
callq 0x178e
movl %eax, 0x8(%rbx)
movq %r14, %rdi
callq 0x178e
movl %eax, 0xc(%rbx)
movq %r14, %rdi
callq 0x178e
movl %eax, 0x10(%rbx)
movq %r14, %rdi
callq 0x178e
movl %eax, 0x14(%rbx)
movq %r14, %rdi
callq 0x16f4
movq %rax, 0x18(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/minidump.c
// Function: read_minidump_dir
int read_minidump_dir(struct minidump_dir_t *minidump_dir, FILE *in)
{
  minidump_dir->stream_type = read_uint32(in);
  minidump_dir->len_data = read_uint32(in);
  minidump_dir->ofs_data = read_uint32(in);

  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x178e
movl %eax, (%r14)
movq %rbx, %rdi
callq 0x178e
movl %eax, 0x4(%r14)
movq %rbx, %rdi
callq 0x178e
movl %eax, 0x8(%r14)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/minidump.c
// Function: print_minidump_header
void print_minidump_header(struct minidump_header_t *minidump_header)
{
  printf(" -------- MiniDump header -------\n");
  printf("     magic1: %.4s\n", minidump_header->magic1);
  printf("     magic2: 0x%02x 0x%02x\n", minidump_header->magic2[0],
                                         minidump_header->magic2[1]);
  printf("    version: %d\n", minidump_header->version);
  printf("num_streams: %d\n", minidump_header->num_streams);
  printf("ofs_streams: %d\n", minidump_header->ofs_streams);
  printf("   checksum: %d\n", minidump_header->checksum);
  printf("  timestamp: %d\n", minidump_header->timestamp);
  printf("      flags: 0x%lx\n", minidump_header->flags);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0x3a88(%rip), %rdi      # 0x55aa
callq 0x1040
leaq 0x27ea(%rip), %rdi      # 0x4318
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1060
movzbl 0x4(%rbx), %esi
movzbl 0x5(%rbx), %edx
leaq 0x27e4(%rip), %rdi      # 0x432b
xorl %eax, %eax
callq 0x1060
movzwl 0x6(%rbx), %esi
leaq 0x27ee(%rip), %rdi      # 0x4347
xorl %eax, %eax
callq 0x1060
movl 0x8(%rbx), %esi
leaq 0x27ee(%rip), %rdi      # 0x4358
xorl %eax, %eax
callq 0x1060
movl 0xc(%rbx), %esi
leaq 0x27ee(%rip), %rdi      # 0x4369
xorl %eax, %eax
callq 0x1060
movl 0x10(%rbx), %esi
leaq 0x27ee(%rip), %rdi      # 0x437a
xorl %eax, %eax
callq 0x1060
movl 0x14(%rbx), %esi
leaq 0x27ee(%rip), %rdi      # 0x438b
xorl %eax, %eax
callq 0x1060
movq 0x18(%rbx), %rsi
leaq 0x27ed(%rip), %rdi      # 0x439c
xorl %eax, %eax
popq %rbx
jmp 0x1060
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/minidump.c
// Function: print_minidump_dir
void print_minidump_dir(struct minidump_dir_t *minidump_dir, int index)
{
  printf(" -------- MiniDump dir %d -------\n", index);
  printf("stream_type: %d (%s)\n",
    minidump_dir->stream_type,
    get_minidump_stream_type(minidump_dir->stream_type));
  printf("   len_data: %u\n", minidump_dir->len_data);
  printf("   ofs_data: %u\n", minidump_dir->ofs_data);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x27ec(%rip), %rdi      # 0x43b0
xorl %eax, %eax
callq 0x1060
movl (%rbx), %ebp
movl %ebp, %edi
callq 0x338c
leaq 0x27f8(%rip), %rdi      # 0x43d3
movl %ebp, %esi
movq %rax, %rdx
xorl %eax, %eax
callq 0x1060
movl 0x4(%rbx), %esi
leaq 0x27f8(%rip), %rdi      # 0x43e9
xorl %eax, %eax
callq 0x1060
movl 0x8(%rbx), %esi
leaq 0x27f8(%rip), %rdi      # 0x43fa
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x1060
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/minidump.c
// Function: print_minidump_string
static void print_minidump_string(FILE *in, uint32_t offset)
{
  uint32_t n;

  if (offset == 0)
  {
    printf("length=0\n");
    return;
  }

  long marker = ftell(in);
  fseek(in, offset, SEEK_SET);

  uint32_t length = read_uint32(in);

  printf(",length=%d\n", length);

  for (n = 0; n < length; n += 2)
  {
    uint16_t c = read_uint16(in);

    putchar(c);
  }

  fseek(in, marker, SEEK_SET);

  printf("\n");
}

// Assembly:
testl %esi, %esi
je 0x2a4a
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %rbx
callq 0x1090
movq %rax, %r14
movl %ebp, %esi
xorl %r15d, %r15d
movq %rbx, %rdi
xorl %edx, %edx
callq 0x10b0
movq %rbx, %rdi
callq 0x178e
movl %eax, %ebp
leaq 0x2a47(%rip), %rdi      # 0x544a
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
testl %ebp, %ebp
je 0x2a29
movq %rbx, %rdi
callq 0x17d0
movzwl %ax, %edi
callq 0x1030
addl $0x2, %r15d
cmpl %ebp, %r15d
jb 0x2a10
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
callq 0x10b0
movl $0xa, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1030
leaq 0x2be2(%rip), %rdi      # 0x5633
jmp 0x1040
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/minidump.c
// Function: print_minidump_memory_list
void print_minidump_memory_list(FILE *in)
{
  uint32_t number_of_memory_ranges = read_uint32(in);
  uint64_t start_of_memory_range = read_uint64(in);
  uint32_t data_size = read_uint32(in);
  uint64_t relative_virtual_address = read_uint64(in);

  printf("   number_of_memory_ranges: %u\n", number_of_memory_ranges);
  printf("     start_of_memory_range: 0x%lx\n", start_of_memory_range);
  printf("                 data_size: %d\n", data_size);
  printf("  relative_virtual_address: 0x%lx\n", relative_virtual_address);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x178e
movl %eax, %ebp
movq %rbx, %rdi
callq 0x16f4
movq %rax, %r14
movq %rbx, %rdi
callq 0x178e
movl %eax, %r15d
movq %rbx, %rdi
callq 0x16f4
movq %rax, %rbx
leaq 0x1b1a(%rip), %rdi      # 0x45a9
movl %ebp, %esi
xorl %eax, %eax
callq 0x1060
leaq 0x1b2a(%rip), %rdi      # 0x45c9
movq %r14, %rsi
xorl %eax, %eax
callq 0x1060
leaq 0x1b3c(%rip), %rdi      # 0x45ec
movl %r15d, %esi
xorl %eax, %eax
callq 0x1060
leaq 0x1b4b(%rip), %rdi      # 0x460c
movq %rbx, %rsi
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1060
// File: /workspace/github_c_makefile_star2_O1/mikeakohn[P]print_pe/build/../src/minidump.c
// Function: print_minidump_exception
void print_minidump_exception(FILE *in)
{
  uint32_t n;

  printf("         thread_id: %d\n", read_uint32(in));
  printf("            unused: %d\n", read_uint32(in));
  printf("    exception_code: 0x%08x\n", read_uint32(in));
  printf("   exception_flags: 0x%08x\n", read_uint32(in));
  printf("  exception_record: 0x%" PRIx64 "\n", read_uint64(in));
  printf(" exception_address: 0x%" PRIx64 "\n", read_uint64(in));

  uint32_t number_parameters = read_uint32(in);
  printf("  number_paramters: %d\n", number_parameters);
  printf("            unused: %d\n", read_uint32(in));
  printf("       information:\n");

  for (n = 0; n < number_parameters; n++)
  {
    printf("      ---- %d ----\n", n);
    printf("            thread_id: %d\n", read_uint32(in));
    printf("    excpetion_pointer: %d\n", read_uint32(in));
    printf("      client_pointers: %d\n", read_uint32(in));
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x178e
leaq 0x1b55(%rip), %rdi      # 0x480f
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x178e
leaq 0x1a88(%rip), %r14      # 0x475a
movq %r14, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x178e
leaq 0x1a85(%rip), %rdi      # 0x4772
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x178e
leaq 0x1a89(%rip), %rdi      # 0x478e
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x16f4
leaq 0x1a8d(%rip), %rdi      # 0x47aa
movq %rax, %rsi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x16f4
leaq 0x1a8f(%rip), %rdi      # 0x47c5
movq %rax, %rsi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x178e
movl %eax, %ebp
leaq 0x1a8f(%rip), %rdi      # 0x47e0
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x178e
movq %r14, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
leaq 0x28e5(%rip), %rdi      # 0x565a
callq 0x1040
testl %ebp, %ebp
je 0x2deb
leaq 0x1a87(%rip), %r15      # 0x480c
leaq 0x1a9b(%rip), %r12      # 0x4827
leaq 0x1aaf(%rip), %r13      # 0x4842
xorl %r14d, %r14d
leaq 0x1a5b(%rip), %rdi      # 0x47f8
movl %r14d, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x178e
movq %r15, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x178e
movq %r12, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
movq %rbx, %rdi
callq 0x178e
movq %r13, %rdi
movl %eax, %esi
xorl %eax, %eax
callq 0x1060
incl %r14d
cmpl %r14d, %ebp
jne 0x2d96
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq