// File: /workspace/github_cpp_makefile_star2_O3/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 %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
testb %al, %al
je 0x71a9
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), %r15
movq $0x0, 0x10(%rsp)
decl %ebp
cmpl $0x4, %ebp
movq %rcx, 0x20(%rsp)
movq %r8, 0x18(%rsp)
movq %r9, 0x28(%rsp)
ja 0x725b
leaq 0x1815(%rip), %rax      # 0x89f0
movslq (%rax,%rbp,4), %rdx
addq %rax, %rdx
jmpq *%rdx
cmpq %rbx, %r14
jmp 0x7250
testq %r14, %r14
sete %al
testq %rbx, %rbx
sete %cl
orb %al, %cl
jne 0x7256
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3080
testq %rax, %rax
jmp 0x725e
movq %r14, %rdi
movq %rbx, %rsi
callq *%rcx
jmp 0x724e
testq %r14, %r14
sete %al
testq %rbx, %rbx
sete %dl
orb %al, %dl
jne 0x7256
movq %r14, %rdi
movq %rbx, %rsi
movq %rcx, %rdx
callq 0x30f0
jmp 0x724e
testq %r14, %r14
sete %al
testq %rbx, %rbx
sete %cl
orb %al, %cl
jne 0x7256
movq %r14, %rdi
movq %rbx, %rsi
callq 0x32b0
testl %eax, %eax
sete %r12b
jmp 0x7262
xorl %r12d, %r12d
jmp 0x7262
testl %r14d, %r14d
setne %r12b
movq 0x4547(%rip), %rdi      # 0xb7b0
callq 0x30b0
movq 0x3d63(%rip), %rax      # 0xafd8
movq (%rax), %rdi
callq 0x30b0
incl 0x4535(%rip)            # 0xb7b8
testq %r15, %r15
je 0x7327
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 %r15, %rsi
callq 0x7662
testl %eax, %eax
js 0x7327
movq 0x10(%rsp), %r13
testq %r13, %r13
je 0x7327
movq %r14, 0x8(%rsp)
movq %rbx, %r14
movb (%r13), %bl
testb %bl, %bl
je 0x72fe
callq 0x31f0
movq (%rax), %rax
leaq 0x1(%r13), %rcx
movsbq %bl, %rdx
testb $0x28, 0x1(%rax,%rdx,2)
je 0x731d
movb (%rcx), %bl
incq %rcx
testb %bl, %bl
jne 0x72ea
leaq 0x1713(%rip), %rdi      # 0x8a18
movq %r13, %rsi
xorl %eax, %eax
callq 0x76c0
leaq 0x1750(%rip), %rdi      # 0x8a66
xorl %eax, %eax
callq 0x76c0
movq %r14, %rbx
movq 0x8(%rsp), %r14
jmp 0x732a
xorl %r13d, %r13d
testb %r12b, %r12b
jne 0x7352
movq 0x447a(%rip), %rcx      # 0xb7b0
leaq 0x173d(%rip), %rdi      # 0x8a7a
movl $0x4, %esi
movl $0x1, %edx
callq 0x33c0
incl 0x446a(%rip)            # 0xb7bc
movq 0x4457(%rip), %rdi      # 0xb7b0
movl 0x4459(%rip), %edx      # 0xb7b8
leaq 0x1719(%rip), %rsi      # 0x8a7f
xorl %eax, %eax
callq 0x32d0
movq 0x444c(%rip), %rax      # 0xb7c0
orq %r15, %rax
je 0x7430
movq 0x442c(%rip), %rcx      # 0xb7b0
leaq 0x16fa(%rip), %rdi      # 0x8a85
movl $0x3, %esi
movl $0x1, %edx
callq 0x33c0
movq 0x441f(%rip), %rdi      # 0xb7c0
testq %rdi, %rdi
je 0x73b2
movq 0x4403(%rip), %rsi      # 0xb7b0
callq 0x3220
testq %r15, %r15
je 0x7430
cmpq $0x0, 0x4401(%rip)      # 0xb7c0
je 0x73de
movq 0x43e8(%rip), %rcx      # 0xb7b0
leaq 0x16ba(%rip), %rdi      # 0x8a89
movl $0x2, %esi
movl $0x1, %edx
callq 0x33c0
testq %r13, %r13
je 0x741d
movq %r13, %r15
movzbl (%r15), %eax
cmpl $0x23, %eax
je 0x73f5
testl %eax, %eax
jne 0x7409
jmp 0x7430
movq 0x43b4(%rip), %rsi      # 0xb7b0
movl $0x5c, %edi
callq 0x3270
movb (%r15), %al
movsbl %al, %edi
movq 0x439d(%rip), %rsi      # 0xb7b0
callq 0x3270
incq %r15
jmp 0x73e6
movq 0x438c(%rip), %rsi      # 0xb7b0
leaq 0x1860(%rip), %rdi      # 0x8c8b
callq 0x3220
movq 0x4379(%rip), %rax      # 0xb7b0
cmpb $0x1, 0x438a(%rip)      # 0xb7c8
jne 0x7488
movq 0x4389(%rip), %rcx      # 0xb7d0
testq %rcx, %rcx
leaq 0x183a(%rip), %rdx      # 0x8c8b
cmovneq %rcx, %rdx
leaq 0x1630(%rip), %rsi      # 0x8a8c
movq %rax, %rdi
xorl %eax, %eax
callq 0x32d0
testb %r12b, %r12b
movq 0x3b68(%rip), %r15      # 0xafd8
je 0x74a6
movq 0x4337(%rip), %rsi      # 0xb7b0
movl $0xa, %edi
callq 0x3270
jmp 0x760f
movl $0xa, %edi
movq %rax, %rsi
callq 0x3270
testb %r12b, %r12b
movq 0x3b39(%rip), %r15      # 0xafd8
je 0x74bd
jmp 0x760f
decl 0x4310(%rip)            # 0xb7bc
movq 0x42fd(%rip), %rsi      # 0xb7b0
movl $0xa, %edi
callq 0x3270
movl 0x148(%rsp), %r8d
movq 0x140(%rsp), %rdx
leaq 0x15ea(%rip), %rax      # 0x8abe
leaq 0x16f3(%rip), %rsi      # 0x8bce
cmpb $0x0, 0x42e6(%rip)      # 0xb7c8
cmovneq %rax, %rsi
leaq 0x15aa(%rip), %rdi      # 0x8a97
movq 0x28(%rsp), %rcx
xorl %eax, %eax
callq 0x76c0
cmpl $0x4, %ebp
ja 0x760f
leaq 0x14fb(%rip), %rax      # 0x8a04
movslq (%rax,%rbp,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movl $0x101, %eax            # imm = 0x101
cmpq %rax, %r14
setb %cl
cmpq %rax, %rbx
setb %al
testb %al, %cl
jne 0x75ed
leaq 0x1594(%rip), %rdi      # 0x8ac6
movq %r14, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x76c0
leaq 0x159a(%rip), %rdi      # 0x8ae0
movq %rbx, %rsi
jmp 0x75c7
leaq 0x1627(%rip), %rdi      # 0x8b79
movq %r14, %rsi
xorl %eax, %eax
callq 0x76c0
leaq 0x1634(%rip), %rdi      # 0x8b97
jmp 0x7605
movq %r14, %rdi
movq 0x18(%rsp), %r14
callq *%r14
leaq 0x15b7(%rip), %rdi      # 0x8b31
movq %rax, %rsi
xorl %eax, %eax
callq 0x76c0
movq %rbx, %rdi
callq *%r14
leaq 0x15b1(%rip), %rdi      # 0x8b42
movq %rax, %rsi
jmp 0x7608
testq %r14, %r14
movq 0x20(%rsp), %rbp
movq %rbp, %rsi
cmoveq %r14, %rsi
leaq 0x15a7(%rip), %rdi      # 0x8b53
movq %r14, %rdx
xorl %eax, %eax
callq 0x76c0
testq %rbx, %rbx
cmoveq %rbx, %rbp
leaq 0x15a2(%rip), %rdi      # 0x8b66
movq %rbp, %rsi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x76c0
jmp 0x760f
leaq 0x15aa(%rip), %rdi      # 0x8b84
movq %r14, %rsi
xorl %eax, %eax
callq 0x76c0
leaq 0x1533(%rip), %rdi      # 0x8b1e
jmp 0x7605
leaq 0x1506(%rip), %rdi      # 0x8afa
movq %r14, %rsi
xorl %eax, %eax
callq 0x76c0
leaq 0x1507(%rip), %rdi      # 0x8b0c
movq %rbx, %rsi
xorl %eax, %eax
callq 0x76c0
movq %r13, %rdi
callq 0x3250
movq (%r15), %rdi
callq 0x3170
movq 0x418a(%rip), %rdi      # 0xb7b0
callq 0x3170
movb 0x4197(%rip), %al       # 0xb7c8
orb %r12b, %al
testb $0x1, %al
jne 0x7641
testb $0x1, 0x4199(%rip)      # 0xb7d8
jne 0x7657
movzbl %r12b, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x415b(%rip), %edi      # 0xb7b8
callq 0x3260