// File: /workspace/github_cpp_makefile_star2_O3/ctSkennerton[P]fxtract/util/tap.c
// Function: cleanup
static void
_cleanup(void)
{
    /* If we forked, don't do cleanup in child! */
    if (getpid() != test_pid)
        return;

    LOCK;

    /* If plan_no_plan() wasn't called, and we don't have a plan,
       and we're not skipping everything, then something happened
       before we could produce any output */
    if(!no_plan && !have_plan && !skip_all) {
        _diag("Looks like your test died before it could output anything.");
        UNLOCK;
        return;
    }

    if(test_died) {
        _diag("Looks like your test died just after %d.", test_count);
        UNLOCK;
        return;
    }

    /* No plan provided, but now we know how many tests were run, and can
       print the header at the end */
    if(!skip_all && (no_plan || !have_plan)) {
        fprintf(tap_out, "1..%d\n", test_count);
    }

    if((have_plan && !no_plan) && e_tests < test_count) {
        _diag("Looks like you planned %d tests but ran %d extra.",
              e_tests, test_count - e_tests);
        if(failures) {
            _diag("Looks like you failed %d tests of %d run.",
                  failures, test_count);
        }
        UNLOCK;
        return;
    }

    if((have_plan || !no_plan) && e_tests > test_count) {
        _diag("Looks like you planned %d tests but only ran %d.",
              e_tests, test_count);
        if(failures) {
            _diag("Looks like you failed %d tests of %d run.",
                  failures, test_count);
        }
        UNLOCK;
        return;
    }

    if(failures)
        _diag("Looks like you failed %d tests of %d.",
              failures, test_count);

    UNLOCK;
}

// Assembly:
pushq %rax
callq 0x32f0
cmpl 0x4015(%rip), %eax      # 0xb7e0
jne 0x78d5
movb 0x4229(%rip), %cl       # 0xba00
movb 0x421b(%rip), %al       # 0xb9f8
movl %ecx, %esi
orb %al, %sil
movb 0x421c(%rip), %dl       # 0xba04
orb %dl, %sil
testb $0x1, %sil
je 0x780f
cmpb $0x1, 0x4204(%rip)      # 0xb9fc
jne 0x781e
movl 0x3fb8(%rip), %esi      # 0xb7b8
leaq 0x14d3(%rip), %rdi      # 0x8cda
xorl %eax, %eax
popq %rcx
jmp 0x76c0
leaq 0x1489(%rip), %rdi      # 0x8c9f
xorl %eax, %eax
popq %rcx
jmp 0x76c0
movl %ecx, %esi
notb %sil
andb %al, %sil
orb %sil, %dl
testb $0x1, %dl
jne 0x7855
movq 0x3f7b(%rip), %rdi      # 0xb7b0
movl 0x3f7d(%rip), %edx      # 0xb7b8
leaq 0x14c1(%rip), %rsi      # 0x8d03
xorl %eax, %eax
callq 0x32d0
movb 0x41a9(%rip), %al       # 0xb9f8
movb 0x41ab(%rip), %cl       # 0xba00
xorb $0x1, %al
movl %eax, %edx
orb %cl, %dl
testb $0x1, %dl
jne 0x7879
movl 0x41a2(%rip), %esi      # 0xba08
movl 0x3f4c(%rip), %edx      # 0xb7b8
subl %esi, %edx
jbe 0x7879
leaq 0x1493(%rip), %rdi      # 0x8d0a
jmp 0x7896
andb %cl, %al
testb $0x1, %al
jne 0x78b6
movl 0x4183(%rip), %esi      # 0xba08
movl 0x3f2d(%rip), %edx      # 0xb7b8
cmpl %edx, %esi
jbe 0x78b6
leaq 0x14d0(%rip), %rdi      # 0x8d66
xorl %eax, %eax
callq 0x76c0
movl 0x3f19(%rip), %esi      # 0xb7bc
testl %esi, %esi
je 0x78d5
movl 0x3f0b(%rip), %edx      # 0xb7b8
leaq 0x1488(%rip), %rdi      # 0x8d3c
jmp 0x78cd
movl 0x3f00(%rip), %esi      # 0xb7bc
testl %esi, %esi
je 0x78d5
movl 0x3ef2(%rip), %edx      # 0xb7b8
leaq 0x14ca(%rip), %rdi      # 0x8d97
xorl %eax, %eax
popq %rcx
jmp 0x76c0
popq %rax
retq