// File: /workspace/github_cpp_makefile_star2_O1/ctSkennerton[P]fxtract/util/tap.c
// Function: gen_result
unsigned int
_gen_result(int type, uint64_t got, uint64_t expected,
            int (*cmp)(const void * got, const void * expected),
            const char * (*to_str)(const void * object), const char *func,
            const char *file, unsigned int line, const char *test_name, ...)
{
    va_list ap;
    const void *got_ptr = (const void *)(uintptr_t)got;
    const void *exp_ptr = (const void *)(uintptr_t)expected;
    char  * local_test_name = NULL;
    char  * c;
    int     name_is_digits;
    int     ok;

    switch (type) {
    case 1:
        ok = (int)(got == expected);
        break;

    case 2:
        ok = (int)(got_ptr && exp_ptr && strcmp(got_ptr, exp_ptr) == 0);
        break;

    case 3:
        ok = (int)((*cmp)(got_ptr, exp_ptr) == 0);
        break;

    case 4:
        ok = (int)(got_ptr && exp_ptr && strncmp(got_ptr, exp_ptr, (size_t)cmp) == 0);
        break;

    case 5:
        ok = (int)(got_ptr && exp_ptr && strstr(got_ptr, exp_ptr) != NULL);
        break;

    default:
        ok = got;
        break;
    }

/* ===================  LOCK  =================== */
    LOCK;
    flockfile(tap_out);
    flockfile(stderr);

    test_count++;

    /* Start by taking the test name and performing any printf()
       expansions on it */
    if (test_name != NULL) {
        va_start(ap, test_name);
        if (my_vasprintf(&local_test_name, test_name, ap) < 0)
            local_test_name = NULL;
        va_end(ap);

        /* Make sure the test name contains more than digits
           and spaces.  Emit an error message and exit if it
           does */
        if(local_test_name) {
            name_is_digits = 1;
            for(c = local_test_name; *c != '\0'; c++) {
                if(!isdigit(*c) && !isspace(*c)) {
                    name_is_digits = 0;
                    break;
                }
            }

            if(name_is_digits) {
                _diag("    You named your test '%s'.  You shouldn't use numbers for your test names.", local_test_name);
                _diag("    Very confusing.");
            }
        }
    }

    if(!ok) {
        fprintf(tap_out, "not ");
        failures++;
    }

    fprintf(tap_out, "ok %d", test_count);

    if (test_case_name != NULL || test_name != NULL) {
        fprintf(tap_out, " - ");
    }

    if (test_case_name != NULL) {
        fputs(test_case_name, tap_out);
    }

    if(test_name != NULL) {
        if (test_case_name != NULL) {
            fprintf(tap_out, ": ");
        }

        /* Print the test name, escaping any '#' characters it
           might contain */
        if(local_test_name != NULL) {
            for(c = local_test_name; *c != '\0'; c++) {
                if(*c == '#')
                    fputc('\\', tap_out);
                fputc((int)*c, tap_out);
            }
        } else {    /* my_vasprintf() failed, use a fixed message */
            fprintf(tap_out, "%s", todo_msg_fixed);
        }
    }

    /* If we're in a todo_start() block then flag the test as being
       TODO.  todo_msg should contain the message to print at this
       point.  If it's NULL then asprintf() failed, and we should
       use the fixed message.

       This is not counted as a failure, so decrement the counter if
       the test failed. */
    if (todo) {
        fprintf(tap_out, " # TODO %s", todo_msg ? todo_msg : todo_msg_fixed);
        if(!ok)
            failures--;
    }

    fprintf(tap_out, "\n");

    if (!ok) {
        _diag("    Failed %stest (%s:%s() at line %d)",
              todo ? "(TODO) " : "", file, func, line);

        switch (type) {
        case 1:
            if (got > 256 || expected > 256) {
                _diag("         got: 0x%"PRIx64" (%"PRId64")", got, got);
                _diag("    expected: 0x%"PRIx64" (%"PRId64")", expected, expected);
            } else {
                _diag("         got: %"PRId64, got);
                _diag("    expected: %"PRId64, expected);
            }
            break;

        case 2:
            _diag("         got: \"%s\"", (const char *)got_ptr);
            _diag("    expected: \"%s\"", (const char *)exp_ptr);
            break;

        case 3:
            _diag("         got: %s", (*to_str)(got_ptr));
            _diag("    expected: %s", (*to_str)(exp_ptr));
            break;

        case 4:
            _diag("         got: %.*s", got_ptr ? (long)cmp : 0, (const char *)got_ptr);
            _diag("    expected: %.*s", exp_ptr ? (long)cmp : 0, (const char *)exp_ptr);
            break;

        case 5:
            _diag("                    got: \"%s\"", (const char *)got_ptr);
            _diag("    expected to contain: \"%s\"", (const char *)exp_ptr);
            break;

        default:
            break;
        }
    }

    free(local_test_name);

    funlockfile(stderr);
    funlockfile(tap_out);
    UNLOCK;
/* =================== UNLOCK =================== */

    if (!ok && !todo && (tap_flags & TAP_FLAG_ON_FAILURE_EXIT)) {
        exit(test_count);
    }

    /* We only care (when testing) that ok is positive, but here we
       specifically only want to return 1 or 0 */
    return ok ? 1 : 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movq %rsi, %r14
movl %edi, %r13d
testb %al, %al
je 0x73d7
movaps %xmm0, 0x80(%rsp)
movaps %xmm1, 0x90(%rsp)
movaps %xmm2, 0xa0(%rsp)
movaps %xmm3, 0xb0(%rsp)
movaps %xmm4, 0xc0(%rsp)
movaps %xmm5, 0xd0(%rsp)
movaps %xmm6, 0xe0(%rsp)
movaps %xmm7, 0xf0(%rsp)
movq 0x150(%rsp), %r12
movq $0x0, 0x10(%rsp)
decl %r13d
cmpl $0x4, %r13d
movq %rdx, 0x8(%rsp)
movq %rcx, 0x20(%rsp)
movq %r8, 0x18(%rsp)
movq %r9, 0x28(%rsp)
ja 0x7492
leaq 0x15e0(%rip), %rax      # 0x89f0
movslq (%rax,%r13,4), %rsi
addq %rax, %rsi
jmpq *%rsi
cmpq %rdx, %r14
jmp 0x7487
testq %r14, %r14
sete %al
testq %rdx, %rdx
sete %cl
orb %al, %cl
jne 0x748d
movq %r14, %rdi
movq %rdx, %rsi
callq 0x3080
testq %rax, %rax
jmp 0x7495
movq %r14, %rdi
movq %rdx, %rsi
callq *%rcx
jmp 0x7485
testq %r14, %r14
sete %al
testq %rdx, %rdx
sete %sil
orb %al, %sil
jne 0x748d
movq %r14, %rdi
movq %rdx, %rsi
movq %rcx, %rdx
callq 0x30f0
jmp 0x7485
testq %r14, %r14
sete %al
testq %rdx, %rdx
sete %cl
orb %al, %cl
jne 0x748d
movq %r14, %rdi
movq %rdx, %rsi
callq 0x32b0
testl %eax, %eax
sete %r15b
jmp 0x7499
xorl %r15d, %r15d
jmp 0x7499
testl %r14d, %r14d
setne %r15b
movq 0x4310(%rip), %rdi      # 0xb7b0
callq 0x30b0
movq 0x3b2c(%rip), %rax      # 0xafd8
movq (%rax), %rdi
callq 0x30b0
incl 0x42fe(%rip)            # 0xb7b8
testq %r12, %r12
je 0x7554
leaq 0x50(%rsp), %rax
leaq 0x30(%rsp), %rdx
movq %rax, 0x10(%rdx)
leaq 0x158(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000030, %rax     # imm = 0x3000000030
movq %rax, (%rdx)
leaq 0x10(%rsp), %rdi
movq %r12, %rsi
callq 0x7887
testl %eax, %eax
jns 0x7504
movq $0x0, 0x10(%rsp)
movq 0x10(%rsp), %rbp
testq %rbp, %rbp
je 0x7554
movb (%rbp), %bl
testb %bl, %bl
je 0x7535
callq 0x31f0
movq (%rax), %rax
leaq 0x1(%rbp), %rcx
movsbq %bl, %rdx
testb $0x28, 0x1(%rax,%rdx,2)
je 0x7554
movb (%rcx), %bl
incq %rcx
testb %bl, %bl
jne 0x7521
leaq 0x14dc(%rip), %rdi      # 0x8a18
movq %rbp, %rsi
xorl %eax, %eax
callq 0x78e5
leaq 0x1519(%rip), %rdi      # 0x8a66
xorl %eax, %eax
callq 0x78e5
testb %r15b, %r15b
jne 0x757c
movq 0x4250(%rip), %rcx      # 0xb7b0
leaq 0x1513(%rip), %rdi      # 0x8a7a
movl $0x4, %esi
movl $0x1, %edx
callq 0x33c0
incl 0x4240(%rip)            # 0xb7bc
movq 0x422d(%rip), %rdi      # 0xb7b0
movl 0x422f(%rip), %edx      # 0xb7b8
leaq 0x14ef(%rip), %rsi      # 0x8a7f
xorl %eax, %eax
callq 0x32d0
movq 0x4222(%rip), %rax      # 0xb7c0
orq %r12, %rax
je 0x75c0
movq 0x4206(%rip), %rcx      # 0xb7b0
leaq 0x14d4(%rip), %rdi      # 0x8a85
movl $0x3, %esi
movl $0x1, %edx
callq 0x33c0
movq 0x41f9(%rip), %rdi      # 0xb7c0
testq %rdi, %rdi
je 0x75d8
movq 0x41dd(%rip), %rsi      # 0xb7b0
callq 0x3220
testq %r12, %r12
je 0x7658
cmpq $0x0, 0x41db(%rip)      # 0xb7c0
je 0x7604
movq 0x41c2(%rip), %rcx      # 0xb7b0
leaq 0x1494(%rip), %rdi      # 0x8a89
movl $0x2, %esi
movl $0x1, %edx
callq 0x33c0
movq 0x10(%rsp), %r12
testq %r12, %r12
je 0x7645
movzbl (%r12), %eax
cmpl $0x23, %eax
je 0x761e
testl %eax, %eax
jne 0x762f
jmp 0x7658
movq 0x418b(%rip), %rsi      # 0xb7b0
movl $0x5c, %edi
callq 0x3270
movsbl (%r12), %edi
movq 0x4175(%rip), %rsi      # 0xb7b0
callq 0x3270
incq %r12
jmp 0x760e
movq 0x4164(%rip), %rsi      # 0xb7b0
leaq 0x1638(%rip), %rdi      # 0x8c8b
callq 0x3220
cmpb $0x1, 0x4169(%rip)      # 0xb7c8
jne 0x76ac
movq 0x4148(%rip), %rdi      # 0xb7b0
movq 0x4161(%rip), %rax      # 0xb7d0
testq %rax, %rax
leaq 0x1612(%rip), %rdx      # 0x8c8b
cmovneq %rax, %rdx
leaq 0x1408(%rip), %rsi      # 0x8a8c
xorl %eax, %eax
callq 0x32d0
testb %r15b, %r15b
je 0x76a6
movq 0x4119(%rip), %rsi      # 0xb7b0
movl $0xa, %edi
callq 0x3270
jmp 0x780e
decl 0x4110(%rip)            # 0xb7bc
movq 0x40fd(%rip), %rsi      # 0xb7b0
movl $0xa, %edi
callq 0x3270
testb %r15b, %r15b
jne 0x780e
movl 0x148(%rsp), %r8d
movq 0x140(%rsp), %rdx
leaq 0x13e1(%rip), %rax      # 0x8abe
leaq 0x14ea(%rip), %rsi      # 0x8bce
cmpb $0x0, 0x40dd(%rip)      # 0xb7c8
cmovneq %rax, %rsi
leaq 0x13a1(%rip), %rdi      # 0x8a97
movq 0x28(%rsp), %rcx
xorl %eax, %eax
callq 0x78e5
cmpl $0x4, %r13d
ja 0x780e
leaq 0x12f1(%rip), %rax      # 0x8a04
movslq (%rax,%r13,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movl $0x101, %eax            # imm = 0x101
cmpq %rax, %r14
setb %cl
movq 0x8(%rsp), %rbx
cmpq %rax, %rbx
setb %al
testb %al, %cl
jne 0x785f
leaq 0x1385(%rip), %rdi      # 0x8ac6
movq %r14, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x78e5
leaq 0x138b(%rip), %rdi      # 0x8ae0
movq %rbx, %rsi
movq %rbx, %rdx
jmp 0x77e1
leaq 0x1412(%rip), %rdi      # 0x8b79
movq %r14, %rsi
xorl %eax, %eax
callq 0x78e5
leaq 0x141f(%rip), %rdi      # 0x8b97
jmp 0x7802
movq %r14, %rdi
movq 0x18(%rsp), %rbx
callq *%rbx
leaq 0x13a3(%rip), %rdi      # 0x8b31
movq %rax, %rsi
xorl %eax, %eax
callq 0x78e5
movq 0x8(%rsp), %rdi
callq *%rbx
leaq 0x139c(%rip), %rdi      # 0x8b42
movq %rax, %rsi
jmp 0x7807
testq %r14, %r14
movq 0x20(%rsp), %rbx
movq %rbx, %rsi
cmoveq %r14, %rsi
leaq 0x1392(%rip), %rdi      # 0x8b53
movq %r14, %rdx
xorl %eax, %eax
callq 0x78e5
movq 0x8(%rsp), %rdx
testq %rdx, %rdx
cmoveq %rdx, %rbx
leaq 0x1388(%rip), %rdi      # 0x8b66
movq %rbx, %rsi
xorl %eax, %eax
callq 0x78e5
jmp 0x780e
leaq 0x1393(%rip), %rdi      # 0x8b84
movq %r14, %rsi
xorl %eax, %eax
callq 0x78e5
leaq 0x131c(%rip), %rdi      # 0x8b1e
movq 0x8(%rsp), %rsi
xorl %eax, %eax
callq 0x78e5
movq 0x10(%rsp), %rdi
callq 0x3250
movq 0x37b9(%rip), %rax      # 0xafd8
movq (%rax), %rdi
callq 0x3170
movq 0x3f82(%rip), %rdi      # 0xb7b0
callq 0x3170
movb 0x3f8f(%rip), %al       # 0xb7c8
orb %r15b, %al
testb $0x1, %al
jne 0x7849
testb $0x1, 0x3f91(%rip)      # 0xb7d8
jne 0x787c
movzbl %r15b, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1294(%rip), %rdi      # 0x8afa
movq %r14, %rsi
xorl %eax, %eax
callq 0x78e5
leaq 0x1295(%rip), %rdi      # 0x8b0c
movq %rbx, %rsi
jmp 0x7807
movl 0x3f36(%rip), %edi      # 0xb7b8
callq 0x3260