// File: /workspace/github_cpp_makefile_star2_O2/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, %r14
testb %al, %al
je 0x6dfc
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)
andq $0x0, 0x10(%rsp)
movl %edi, %ebp
movq 0x150(%rsp), %r12
decl %ebp
cmpl $0x4, %ebp
movq %rsi, 0x8(%rsp)
movq %rcx, 0x20(%rsp)
movq %r8, 0x18(%rsp)
movq %r9, 0x28(%rsp)
ja 0x6eb2
leaq 0x1bd6(%rip), %rax      # 0x8a08
movslq (%rax,%rbp,4), %rdx
addq %rax, %rdx
jmpq *%rdx
cmpq %r14, %rsi
jmp 0x6ea7
testq %rsi, %rsi
sete %al
testq %r14, %r14
sete %cl
orb %al, %cl
jne 0x6ead
movq %rsi, %rdi
movq %r14, %rsi
callq 0x3080
testq %rax, %rax
jmp 0x6eb4
movq %rsi, %rdi
movq %r14, %rsi
callq *%rcx
jmp 0x6ea5
testq %rsi, %rsi
sete %al
testq %r14, %r14
sete %dl
orb %al, %dl
jne 0x6ead
movq %rsi, %rdi
movq %r14, %rsi
movq %rcx, %rdx
callq 0x30f0
jmp 0x6ea5
testq %rsi, %rsi
sete %al
testq %r14, %r14
sete %cl
orb %al, %cl
jne 0x6ead
movq %rsi, %rdi
movq %r14, %rsi
callq 0x32b0
testl %eax, %eax
sete %r15b
jmp 0x6eb8
xorl %r15d, %r15d
jmp 0x6eb8
testl %esi, %esi
setne %r15b
movq 0x58f1(%rip), %rdi      # 0xc7b0
callq 0x30b0
movq 0x510d(%rip), %rax      # 0xbfd8
movq (%rax), %rdi
callq 0x30b0
incl 0x58df(%rip)            # 0xc7b8
testq %r12, %r12
je 0x6f45
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 0x7291
testl %eax, %eax
js 0x6f45
movq 0x10(%rsp), %rbx
testq %rbx, %rbx
je 0x6f45
movq %r14, %r12
movq %rbx, %r13
movsbq (%r13), %r14
testq %r14, %r14
je 0x6f49
callq 0x31f0
movq (%rax), %rax
incq %r13
testb $0x28, 0x1(%rax,%r14,2)
jne 0x6f26
jmp 0x6f68
xorl %ebx, %ebx
jmp 0x6f73
leaq 0x1ae0(%rip), %rdi      # 0x8a30
movq %rbx, %rsi
xorl %eax, %eax
callq 0x72ed
leaq 0x1b1d(%rip), %rdi      # 0x8a7e
xorl %eax, %eax
callq 0x72ed
movq %r12, %r14
movq 0x150(%rsp), %r12
testb %r15b, %r15b
jne 0x6f97
movq 0x5831(%rip), %rcx      # 0xc7b0
leaq 0x1b0c(%rip), %rdi      # 0x8a92
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
callq 0x33c0
incl 0x5825(%rip)            # 0xc7bc
movq 0x5812(%rip), %rdi      # 0xc7b0
movl 0x5814(%rip), %edx      # 0xc7b8
leaq 0x1aec(%rip), %rsi      # 0x8a97
xorl %eax, %eax
callq 0x32d0
movq 0x5807(%rip), %rax      # 0xc7c0
orq %r12, %rax
je 0x7071
movq 0x57e7(%rip), %rcx      # 0xc7b0
leaq 0x1acd(%rip), %rdi      # 0x8a9d
pushq $0x3
popq %rsi
pushq $0x1
popq %rdx
callq 0x33c0
movq 0x57de(%rip), %rdi      # 0xc7c0
testq %rdi, %rdi
je 0x6ff3
movq 0x57c2(%rip), %rsi      # 0xc7b0
callq 0x3220
testq %r12, %r12
je 0x7071
cmpq $0x0, 0x57c0(%rip)      # 0xc7c0
je 0x701b
movq 0x57a7(%rip), %rcx      # 0xc7b0
leaq 0x1a91(%rip), %rdi      # 0x8aa1
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
callq 0x33c0
testq %rbx, %rbx
je 0x705e
pushq $0x5c
popq %r12
movq %rbx, %r13
movzbl (%r13), %eax
cmpl $0x23, %eax
je 0x7037
testl %eax, %eax
jne 0x704a
jmp 0x7071
movq 0x5772(%rip), %rsi      # 0xc7b0
movl %r12d, %edi
callq 0x3270
movb (%r13), %al
movsbl %al, %edi
movq 0x575c(%rip), %rsi      # 0xc7b0
callq 0x3270
incq %r13
jmp 0x7027
movq 0x574b(%rip), %rsi      # 0xc7b0
leaq 0x1c37(%rip), %rdi      # 0x8ca3
callq 0x3220
cmpb $0x1, 0x5750(%rip)      # 0xc7c8
jne 0x70c3
movq 0x572f(%rip), %rdi      # 0xc7b0
movq 0x5748(%rip), %rax      # 0xc7d0
testq %rax, %rax
leaq 0x1c11(%rip), %rdx      # 0x8ca3
cmovneq %rax, %rdx
leaq 0x1a07(%rip), %rsi      # 0x8aa4
xorl %eax, %eax
callq 0x32d0
testb %r15b, %r15b
je 0x70bd
movq 0x5700(%rip), %rsi      # 0xc7b0
pushq $0xa
popq %rdi
callq 0x3270
jmp 0x7237
decl 0x56f9(%rip)            # 0xc7bc
movq 0x56e6(%rip), %rsi      # 0xc7b0
pushq $0xa
popq %rdi
callq 0x3270
testb %r15b, %r15b
jne 0x7237
movl 0x148(%rsp), %r8d
movq 0x140(%rsp), %rdx
leaq 0x19e4(%rip), %rax      # 0x8ad6
leaq 0x1aed(%rip), %rsi      # 0x8be6
cmpb $0x0, 0x56c8(%rip)      # 0xc7c8
cmovneq %rax, %rsi
leaq 0x19a4(%rip), %rdi      # 0x8aaf
movq 0x28(%rsp), %rcx
xorl %eax, %eax
callq 0x72ed
cmpl $0x4, %ebp
ja 0x7237
leaq 0x18f5(%rip), %rax      # 0x8a1c
movslq (%rax,%rbp,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movl $0x101, %eax            # imm = 0x101
movq 0x8(%rsp), %rsi
cmpq %rax, %rsi
setb %cl
cmpq %rax, %r14
setb %al
testb %al, %cl
jne 0x7218
leaq 0x1989(%rip), %rdi      # 0x8ade
movq %rsi, %rdx
xorl %eax, %eax
callq 0x72ed
leaq 0x1992(%rip), %rdi      # 0x8af8
movq %r14, %rsi
jmp 0x71f0
leaq 0x1a1c(%rip), %rdi      # 0x8b91
movq 0x8(%rsp), %rsi
xorl %eax, %eax
callq 0x72ed
leaq 0x1a27(%rip), %rdi      # 0x8baf
jmp 0x722d
movq 0x8(%rsp), %rdi
movq 0x18(%rsp), %r12
callq *%r12
leaq 0x19a8(%rip), %rdi      # 0x8b49
movq %rax, %rsi
xorl %eax, %eax
callq 0x72ed
movq %r14, %rdi
callq *%r12
leaq 0x19a2(%rip), %rdi      # 0x8b5a
movq %rax, %rsi
jmp 0x7230
movq 0x8(%rsp), %rdx
testq %rdx, %rdx
movq 0x20(%rsp), %r12
movq %r12, %rsi
cmoveq %rdx, %rsi
leaq 0x1993(%rip), %rdi      # 0x8b6b
xorl %eax, %eax
callq 0x72ed
testq %r14, %r14
cmoveq %r14, %r12
leaq 0x1991(%rip), %rdi      # 0x8b7e
movq %r12, %rsi
movq %r14, %rdx
xorl %eax, %eax
callq 0x72ed
jmp 0x7237
leaq 0x1999(%rip), %rdi      # 0x8b9c
movq 0x8(%rsp), %rsi
xorl %eax, %eax
callq 0x72ed
leaq 0x1920(%rip), %rdi      # 0x8b36
jmp 0x722d
leaq 0x18f3(%rip), %rdi      # 0x8b12
xorl %eax, %eax
callq 0x72ed
leaq 0x18f7(%rip), %rdi      # 0x8b24
movq %r14, %rsi
xorl %eax, %eax
callq 0x72ed
movq %rbx, %rdi
callq 0x3250
movq 0x4d92(%rip), %rax      # 0xbfd8
movq (%rax), %rdi
callq 0x3170
movq 0x555b(%rip), %rdi      # 0xc7b0
callq 0x3170
movb 0x5568(%rip), %al       # 0xc7c8
orb %r15b, %al
testb $0x1, %al
jne 0x7270
testb $0x1, 0x556a(%rip)      # 0xc7d8
jne 0x7286
movzbl %r15b, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x552c(%rip), %edi      # 0xc7b8
callq 0x3260