// File: /workspace/github_c_makefile_star2_O0/chatziko-k08[P]lecture-code/tests/../include/acutest.h
// Function: acutest_run_
static void
acutest_run_(const struct acutest_test_* test, int index, int master_index)
{
    int failed = 1;
    acutest_timer_type_ start, end;

    acutest_current_test_ = test;
    acutest_test_already_logged_ = 0;
    acutest_timer_get_time_(&start);

    if(!acutest_no_exec_) {

#if defined(ACUTEST_UNIX_)

        pid_t pid;
        int exit_code;

        /* Make sure the child starts with empty I/O buffers. */
        fflush(stdout);
        fflush(stderr);

        pid = fork();
        if(pid == (pid_t)-1) {
            acutest_error_("Cannot fork. %s [%d]", strerror(errno), errno);
            failed = 1;
        } else if(pid == 0) {
            /* Child: Do the test. */
            acutest_worker_ = 1;
            failed = (acutest_do_run_(test, index) != 0);
            acutest_exit_(failed ? 1 : 0);
        } else {
            /* Parent: Wait until child terminates and analyze its exit code. */
            waitpid(pid, &exit_code, 0);
            if(WIFEXITED(exit_code)) {
                switch(WEXITSTATUS(exit_code)) {
                    case 0:   failed = 0; break;   /* test has passed. */
                    case 1:   /* noop */ break;    /* "normal" failure. */
                    default:  acutest_error_("Unexpected exit code [%d]", WEXITSTATUS(exit_code));
                }
            } else if(WIFSIGNALED(exit_code)) {
                char tmp[32];
                const char* signame;
                switch(WTERMSIG(exit_code)) {
                    case SIGINT:  signame = "SIGINT"; break;
                    case SIGHUP:  signame = "SIGHUP"; break;
                    case SIGQUIT: signame = "SIGQUIT"; break;
                    case SIGABRT: signame = "SIGABRT"; break;
                    case SIGKILL: signame = "SIGKILL"; break;
                    case SIGSEGV: signame = "SIGSEGV"; break;
                    case SIGILL:  signame = "SIGILL"; break;
                    case SIGTERM: signame = "SIGTERM"; break;
                    default:      sprintf(tmp, "signal %d", WTERMSIG(exit_code)); signame = tmp; break;
                }
                acutest_error_("Test interrupted by %s.", signame);
            } else {
                acutest_error_("Test ended in an unexpected way [%d].", exit_code);
            }
        }

#elif defined(ACUTEST_WIN_)

        char buffer[512] = {0};
        STARTUPINFOA startupInfo;
        PROCESS_INFORMATION processInfo;
        DWORD exitCode;

        /* Windows has no fork(). So we propagate all info into the child
         * through a command line arguments. */
        _snprintf(buffer, sizeof(buffer)-1,
                 "%s --worker=%d %s --no-exec --no-summary %s --verbose=%d --color=%s -- \"%s\"",
                 acutest_argv0_, index, acutest_timer_ ? "--time" : "",
                 acutest_tap_ ? "--tap" : "", acutest_verbose_level_,
                 acutest_colorize_ ? "always" : "never",
                 test->name);
        memset(&startupInfo, 0, sizeof(startupInfo));
        startupInfo.cb = sizeof(STARTUPINFO);
        if(CreateProcessA(NULL, buffer, NULL, NULL, FALSE, 0, NULL, NULL, &startupInfo, &processInfo)) {
            WaitForSingleObject(processInfo.hProcess, INFINITE);
            GetExitCodeProcess(processInfo.hProcess, &exitCode);
            CloseHandle(processInfo.hThread);
            CloseHandle(processInfo.hProcess);
            failed = (exitCode != 0);
            if(exitCode > 1) {
                switch(exitCode) {
                    case 3:             acutest_error_("Aborted."); break;
                    case 0xC0000005:    acutest_error_("Access violation."); break;
                    default:            acutest_error_("Test ended in an unexpected way [%lu].", exitCode); break;
                }
            }
        } else {
            acutest_error_("Cannot create unit test subprocess [%ld].", GetLastError());
            failed = 1;
        }

#else

        /* A platform where we don't know how to run child process. */
        failed = (acutest_do_run_(test, index) != 0);

#endif

    } else {
        /* Child processes suppressed through --no-exec. */
        failed = (acutest_do_run_(test, index) != 0);
    }
    acutest_timer_get_time_(&end);

    acutest_current_test_ = NULL;

    acutest_stat_run_units_++;
    if(failed)
        acutest_stat_failed_units_++;

    acutest_set_success_(master_index, !failed);
    acutest_set_duration_(master_index, acutest_timer_diff_(start, end));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl $0x1, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq %rax, 0x80a1(%rip)      # 0xc168
movl $0x0, 0x808f(%rip)      # 0xc160
leaq -0x28(%rbp), %rdi
callq 0x58d0
cmpl $0x0, 0x806b(%rip)      # 0xc14c
jne 0x42d7
movq 0x7eea(%rip), %rax      # 0xbfd8
movq (%rax), %rdi
callq 0x2190
movq 0x7efb(%rip), %rax      # 0xbff8
movq (%rax), %rdi
callq 0x2190
callq 0x2230
movl %eax, -0x3c(%rbp)
cmpl $-0x1, -0x3c(%rbp)
jne 0x4148
callq 0x2040
movl (%rax), %edi
callq 0x2220
movq %rax, -0x70(%rbp)
callq 0x2040
movq -0x70(%rbp), %rsi
movl (%rax), %edx
leaq 0x4d9e(%rip), %rdi      # 0x8ed3
movb $0x0, %al
callq 0x5900
movl $0x1, -0x14(%rbp)
jmp 0x42d5
cmpl $0x0, -0x3c(%rbp)
jne 0x4187
movl $0x1, 0x8170(%rip)      # 0xc2c8
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x5a00
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %ecx
xorl %edi, %edi
movl $0x1, %eax
cmpl $0x0, %ecx
cmovnel %eax, %edi
callq 0x3410
movl -0x3c(%rbp), %edi
leaq -0x40(%rbp), %rsi
xorl %edx, %edx
callq 0x21c0
movl -0x40(%rbp), %eax
andl $0x7f, %eax
cmpl $0x0, %eax
jne 0x41e4
movzwl -0x40(%rbp), %eax
shrl $0x8, %eax
movl %eax, -0x74(%rbp)
testl %eax, %eax
je 0x41ba
jmp 0x41b0
movl -0x74(%rbp), %eax
subl $0x1, %eax
je 0x41c3
jmp 0x41c5
movl $0x0, -0x14(%rbp)
jmp 0x41df
jmp 0x41df
movl -0x40(%rbp), %esi
andl $0xff00, %esi           # imm = 0xFF00
sarl $0x8, %esi
leaq 0x4d10(%rip), %rdi      # 0x8ee8
movb $0x0, %al
callq 0x5900
jmp 0x42d1
movl -0x40(%rbp), %eax
andl $0x7f, %eax
addl $0x1, %eax
movsbl %al, %eax
sarl %eax
cmpl $0x0, %eax
jle 0x42be
movl -0x40(%rbp), %eax
andl $0x7f, %eax
decl %eax
movl %eax, %ecx
movq %rcx, -0x80(%rbp)
subl $0xe, %eax
ja 0x428a
movq -0x80(%rbp), %rax
leaq 0x3e0b(%rip), %rcx      # 0x8024
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x4cd9(%rip), %rax      # 0x8f02
movq %rax, -0x68(%rbp)
jmp 0x42aa
leaq 0x4cd3(%rip), %rax      # 0x8f09
movq %rax, -0x68(%rbp)
jmp 0x42aa
leaq 0x4ccd(%rip), %rax      # 0x8f10
movq %rax, -0x68(%rbp)
jmp 0x42aa
leaq 0x4cc8(%rip), %rax      # 0x8f18
movq %rax, -0x68(%rbp)
jmp 0x42aa
leaq 0x4cc3(%rip), %rax      # 0x8f20
movq %rax, -0x68(%rbp)
jmp 0x42aa
leaq 0x4cbe(%rip), %rax      # 0x8f28
movq %rax, -0x68(%rbp)
jmp 0x42aa
leaq 0x4cb9(%rip), %rax      # 0x8f30
movq %rax, -0x68(%rbp)
jmp 0x42aa
leaq 0x4cb3(%rip), %rax      # 0x8f37
movq %rax, -0x68(%rbp)
jmp 0x42aa
leaq -0x60(%rbp), %rdi
movl -0x40(%rbp), %edx
andl $0x7f, %edx
leaq 0x4ca4(%rip), %rsi      # 0x8f3f
movb $0x0, %al
callq 0x2200
leaq -0x60(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rsi
leaq 0x4c94(%rip), %rdi      # 0x8f49
movb $0x0, %al
callq 0x5900
jmp 0x42cf
movl -0x40(%rbp), %esi
leaq 0x4c99(%rip), %rdi      # 0x8f61
movb $0x0, %al
callq 0x5900
jmp 0x42d1
jmp 0x42d3
jmp 0x42d5
jmp 0x42f1
movq -0x8(%rbp), %rdi
movl -0xc(%rbp), %esi
callq 0x5a00
cmpl $0x0, %eax
setne %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x14(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x58d0
movq $0x0, 0x7e63(%rip) # 0xc168
movl 0x7fc9(%rip), %eax      # 0xc2d4
addl $0x1, %eax
movl %eax, 0x7fc0(%rip)      # 0xc2d4
cmpl $0x0, -0x14(%rbp)
je 0x4329
movl 0x7fb8(%rip), %eax      # 0xc2d8
addl $0x1, %eax
movl %eax, 0x7faf(%rip)      # 0xc2d8
movl -0x10(%rbp), %edi
cmpl $0x0, -0x14(%rbp)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %esi
callq 0x5c40
movl -0x10(%rbp), %eax
movl %eax, -0x84(%rbp)
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq -0x30(%rbp), %rcx
callq 0x52c0
movl -0x84(%rbp), %edi
callq 0x5c80
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)