// File: AndreRenaud[P]simple_uart/./acutest.h
// Function: main
int
main(int argc, char** argv)
{
    int i, index;
    int exit_code = 1;

    acutest_argv0_ = argv[0];

#if defined ACUTEST_UNIX_
    acutest_colorize_ = isatty(STDOUT_FILENO);
#elif defined ACUTEST_WIN_
 #if defined _BORLANDC_
    acutest_colorize_ = isatty(_fileno(stdout));
 #else
    acutest_colorize_ = _isatty(_fileno(stdout));
 #endif
#else
    acutest_colorize_ = 0;
#endif

    /* Count all test units */
    acutest_list_size_ = 0;
    for(i = 0; acutest_list_[i].func != NULL; i++)
        acutest_list_size_++;

    acutest_test_data_ = (struct acutest_test_data_*)calloc(acutest_list_size_, sizeof(struct acutest_test_data_));
    if(acutest_test_data_ == NULL) {
        fprintf(stderr, "Out of memory.\n");
        acutest_exit_(2);
    }

    /* Parse options */
    acutest_cmdline_read_(acutest_cmdline_options_, argc, argv, acutest_cmdline_callback_);

    /* Initialize the proper timer. */
    acutest_timer_init_();

#if defined(ACUTEST_WIN_)
    SetUnhandledExceptionFilter(acutest_seh_exception_filter_);
#ifdef _MSC_VER
    _set_abort_behavior(0, _WRITE_ABORT_MSG);
#endif
#endif

    /* Determine what to run. */
    if(acutest_count_(ACUTEST_STATE_SELECTED) > 0) {
        enum acutest_state_ if_selected;
        enum acutest_state_ if_unselected;

        if(!acutest_exclude_mode_) {
            if_selected = ACUTEST_STATE_NEEDTORUN;
            if_unselected = ACUTEST_STATE_EXCLUDED;
        } else {
            if_selected = ACUTEST_STATE_EXCLUDED;
            if_unselected = ACUTEST_STATE_NEEDTORUN;
        }

        for(i = 0; acutest_list_[i].func != NULL; i++) {
            if(acutest_test_data_[i].state == ACUTEST_STATE_SELECTED)
                acutest_test_data_[i].state = if_selected;
            else
                acutest_test_data_[i].state = if_unselected;
        }
    } else {
        /* By default, we want to run all tests. */
        for(i = 0; acutest_list_[i].func != NULL; i++)
            acutest_test_data_[i].state = ACUTEST_STATE_NEEDTORUN;
    }

    /* By default, we want to suppress running tests as child processes if we
     * run just one test, or if we're under debugger: Debugging tests is then
     * so much easier. */
    if(acutest_no_exec_ < 0) {
        if(acutest_count_(ACUTEST_STATE_NEEDTORUN) <= 1  ||  acutest_under_debugger_())
            acutest_no_exec_ = 1;
        else
            acutest_no_exec_ = 0;
    }

    if(acutest_tap_) {
        /* TAP requires we know test result ("ok", "not ok") before we output
         * anything about the test, and this gets problematic for larger verbose
         * levels. */
        if(acutest_verbose_level_ > 2)
            acutest_verbose_level_ = 2;

        /* TAP harness should provide some summary. */
        acutest_no_summary_ = 1;

        if(!acutest_worker_)
            printf("1..%d\n", acutest_count_(ACUTEST_STATE_NEEDTORUN));
    }

    index = acutest_worker_index_;
    for(i = 0; acutest_list_[i].func != NULL; i++) {
        if(acutest_test_data_[i].state == ACUTEST_STATE_NEEDTORUN)
            acutest_run_(&acutest_list_[i], index++, i);
    }

    /* Write a summary */
    if(!acutest_no_summary_ && acutest_verbose_level_ >= 1) {
        int n_run, n_success, n_failed ;

        n_run = acutest_list_size_ - acutest_count_(ACUTEST_STATE_EXCLUDED);
        n_success = acutest_count_(ACUTEST_STATE_SUCCESS);
        n_failed = acutest_count_(ACUTEST_STATE_FAILED);

        if(acutest_verbose_level_ >= 3) {
            acutest_colored_printf_(ACUTEST_COLOR_DEFAULT_INTENSIVE_, "Summary:\n");

            printf("  Count of run unit tests:        %4d\n", n_run);
            printf("  Count of successful unit tests: %4d\n", n_success);
            printf("  Count of failed unit tests:     %4d\n", n_failed);
        }

        if(n_failed == 0) {
            acutest_colored_printf_(ACUTEST_COLOR_GREEN_INTENSIVE_, "SUCCESS:");
            printf(" No unit tests have failed.\n");
        } else {
            acutest_colored_printf_(ACUTEST_COLOR_RED_INTENSIVE_, "FAILED:");
            printf(" %d of %d unit tests %s failed.\n",
                    n_failed, n_run, (n_failed == 1) ? "has" : "have");
        }

        if(acutest_verbose_level_ >= 3)
            printf("\n");
    }

    if (acutest_xml_output_) {
        const char* suite_name = acutest_basename_(argv[0]);
        fprintf(acutest_xml_output_, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
        fprintf(acutest_xml_output_, "<testsuite name=\"%s\" tests=\"%d\" errors=\"0\" failures=\"%d\" skip=\"%d\">\n",
            suite_name,
            (int)acutest_list_size_,
            acutest_count_(ACUTEST_STATE_FAILED),
            acutest_count_(ACUTEST_STATE_SKIPPED) + acutest_count_(ACUTEST_STATE_EXCLUDED));
        for(i = 0; acutest_list_[i].func != NULL; i++) {
            struct acutest_test_data_ *details = &acutest_test_data_[i];
            const char* str_state;
            fprintf(acutest_xml_output_, "  <testcase name=\"%s\" time=\"%.2f\">\n", acutest_list_[i].name, details->duration);

            switch(details->state) {
                case ACUTEST_STATE_SUCCESS:     str_state = NULL; break;
                case ACUTEST_STATE_EXCLUDED:    /* Fall through. */
                case ACUTEST_STATE_SKIPPED:     str_state = "<skipped />"; break;
                case ACUTEST_STATE_FAILED:      /* Fall through. */
                default:                        str_state = "<failure />"; break;
            }

            if(str_state != NULL)
                fprintf(acutest_xml_output_, "    %s\n", str_state);
            fprintf(acutest_xml_output_, "  </testcase>\n");
        }
        fprintf(acutest_xml_output_, "</testsuite>\n");
        fclose(acutest_xml_output_);
    }

    if(acutest_worker_  &&  acutest_count_(ACUTEST_STATE_EXCLUDED)+1 == acutest_list_size_) {
        /* If we are the child process, we need to propagate the test state
         * without any moderation. */
        for(i = 0; acutest_list_[i].func != NULL; i++) {
            if(acutest_test_data_[i].state != ACUTEST_STATE_EXCLUDED) {
                exit_code = (int) acutest_test_data_[i].state;
                break;
            }
        }
    } else {
        if(acutest_count_(ACUTEST_STATE_FAILED) > 0)
            exit_code = 1;
        else
            exit_code = 0;
    }

    acutest_cleanup_();
    return exit_code;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x1, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, 0xa10a(%rip)      # 0xd458
movl $0x1, %edi
callq 0x2090
movl %eax, 0xa102(%rip)      # 0xd460
movl $0x0, 0xa0fc(%rip)      # 0xd464
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x99c6(%rip), %rax      # 0xcd40
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x33a2
movl 0xa0d6(%rip), %eax      # 0xd464
addl $0x1, %eax
movl %eax, 0xa0cd(%rip)      # 0xd464
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x336f
movslq 0xa0bb(%rip), %rdi      # 0xd464
movl $0x10, %esi
callq 0x21f0
movq %rax, 0xa0ae(%rip)      # 0xd468
cmpq $0x0, 0xa0a6(%rip)      # 0xd468
jne 0x33e6
movq 0x9c2d(%rip), %rax      # 0xcff8
movq (%rax), %rdi
leaq 0x5d8e(%rip), %rsi      # 0x9163
movb $0x0, %al
callq 0x2230
movl $0x2, %edi
callq 0x3300
movl -0x8(%rbp), %esi
movq -0x10(%rbp), %rdx
leaq 0x97ac(%rip), %rdi      # 0xcba0
leaq 0xa35(%rip), %rcx       # 0x3e30
callq 0x3970
callq 0x43b0
movl $0xfffffffd, %edi       # imm = 0xFFFFFFFD
callq 0x43e0
cmpl $0x0, %eax
jle 0x34b5
cmpl $0x0, 0xa051(%rip)      # 0xd470
jne 0x3431
movl $0xfffffffe, -0x20(%rbp) # imm = 0xFFFFFFFE
movl $0xffffffff, -0x24(%rbp) # imm = 0xFFFFFFFF
jmp 0x343f
movl $0xffffffff, -0x20(%rbp) # imm = 0xFFFFFFFF
movl $0xfffffffe, -0x24(%rbp) # imm = 0xFFFFFFFE
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x98ef(%rip), %rax      # 0xcd40
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x34b3
movq 0xa002(%rip), %rax      # 0xd468
movslq -0x14(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
cmpl $-0x3, (%rax)
jne 0x348f
movl -0x20(%rbp), %ecx
movq 0x9fe8(%rip), %rax      # 0xd468
movslq -0x14(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
jmp 0x34a6
movl -0x24(%rbp), %ecx
movq 0x9fcf(%rip), %rax      # 0xd468
movslq -0x14(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
jmp 0x34a8
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x3446
jmp 0x34fa
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x9879(%rip), %rax      # 0xcd40
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x34f8
movq 0x9f8c(%rip), %rax      # 0xd468
movslq -0x14(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl $0xfffffffe, (%rax)     # imm = 0xFFFFFFFE
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x34bc
jmp 0x34fa
cmpl $0x0, 0x9d0b(%rip)      # 0xd20c
jge 0x3534
movl $0xfffffffe, %edi       # imm = 0xFFFFFFFE
callq 0x43e0
cmpl $0x1, %eax
jle 0x351c
callq 0x4440
cmpl $0x0, %eax
je 0x3528
movl $0x1, 0x9ce6(%rip)      # 0xd20c
jmp 0x3532
movl $0x0, 0x9cda(%rip)      # 0xd20c
jmp 0x3534
cmpl $0x0, 0x9f39(%rip)      # 0xd474
je 0x357f
cmpl $0x2, 0x9cc4(%rip)      # 0xd208
jle 0x3550
movl $0x2, 0x9cb8(%rip)      # 0xd208
movl $0x1, 0x9f1e(%rip)      # 0xd478
cmpl $0x0, 0x9f1b(%rip)      # 0xd47c
jne 0x357d
movl $0xfffffffe, %edi       # imm = 0xFFFFFFFE
callq 0x43e0
movl %eax, %esi
leaq 0x5bfd(%rip), %rdi      # 0x9173
movb $0x0, %al
callq 0x2160
jmp 0x357f
movl 0x9efb(%rip), %eax      # 0xd480
movl %eax, -0x18(%rbp)
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x97a6(%rip), %rax      # 0xcd40
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x35f1
movq 0x9eb9(%rip), %rax      # 0xd468
movslq -0x14(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
cmpl $-0x2, (%rax)
jne 0x35e4
movslq -0x14(%rbp), %rax
leaq 0x9776(%rip), %rdi      # 0xcd40
shlq $0x4, %rax
addq %rax, %rdi
movl -0x18(%rbp), %esi
movl %esi, %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
movl -0x14(%rbp), %edx
callq 0x45d0
jmp 0x35e6
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x358f
cmpl $0x0, 0x9e80(%rip)      # 0xd478
jne 0x370f
cmpl $0x1, 0x9c03(%rip)      # 0xd208
jl 0x370f
movl 0x9e53(%rip), %eax      # 0xd464
movl %eax, -0x4c(%rbp)
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x43e0
movl %eax, %ecx
movl -0x4c(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x28(%rbp)
xorl %edi, %edi
callq 0x43e0
movl %eax, -0x2c(%rbp)
movl $0x1, %edi
callq 0x43e0
movl %eax, -0x30(%rbp)
cmpl $0x3, 0x9bc2(%rip)      # 0xd208
jl 0x368e
movl $0xa, %edi
leaq 0x5b26(%rip), %rsi      # 0x917a
movb $0x0, %al
callq 0x2b70
movl -0x28(%rbp), %esi
leaq 0x5b1f(%rip), %rdi      # 0x9184
movb $0x0, %al
callq 0x2160
movl -0x2c(%rbp), %esi
leaq 0x5b35(%rip), %rdi      # 0x91ab
movb $0x0, %al
callq 0x2160
movl -0x30(%rbp), %esi
leaq 0x5b4b(%rip), %rdi      # 0x91d2
movb $0x0, %al
callq 0x2160
cmpl $0x0, -0x30(%rbp)
jne 0x36b7
movl $0xc, %edi
leaq 0x5b59(%rip), %rsi      # 0x91f9
movb $0x0, %al
callq 0x2b70
leaq 0x5b54(%rip), %rdi      # 0x9202
movb $0x0, %al
callq 0x2160
jmp 0x36f6
movl $0xb, %edi
leaq 0x5b5c(%rip), %rsi      # 0x921f
movb $0x0, %al
callq 0x2b70
movl -0x30(%rbp), %esi
movl -0x28(%rbp), %edx
movl -0x30(%rbp), %edi
leaq 0x5b72(%rip), %rcx      # 0x924c
leaq 0x5b67(%rip), %rax      # 0x9248
cmpl $0x1, %edi
cmoveq %rax, %rcx
leaq 0x5b38(%rip), %rdi      # 0x9227
movb $0x0, %al
callq 0x2160
cmpl $0x3, 0x9b0b(%rip)      # 0xd208
jl 0x370d
leaq 0x6379(%rip), %rdi      # 0x9a7f
movb $0x0, %al
callq 0x2160
jmp 0x370f
cmpq $0x0, 0x9d71(%rip)      # 0xd488
je 0x38c0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x2b20
movq %rax, -0x38(%rbp)
movq 0x9d54(%rip), %rdi      # 0xd488
leaq 0x5b16(%rip), %rsi      # 0x9251
movb $0x0, %al
callq 0x2230
movq 0x9d3f(%rip), %rax      # 0xd488
movq %rax, -0x68(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x60(%rbp)
movl 0x9d09(%rip), %eax      # 0xd464
movl %eax, -0x54(%rbp)
movl $0x1, %edi
callq 0x43e0
movl %eax, -0x50(%rbp)
movl $0x2, %edi
callq 0x43e0
movl %eax, -0x6c(%rbp)
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x43e0
movl -0x6c(%rbp), %r9d
movq -0x68(%rbp), %rdi
movq -0x60(%rbp), %rdx
movl -0x54(%rbp), %ecx
movl -0x50(%rbp), %r8d
addl %eax, %r9d
leaq 0x5ada(%rip), %rsi      # 0x9279
movb $0x0, %al
callq 0x2230
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x9588(%rip), %rax      # 0xcd40
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x389f
movq 0x9c97(%rip), %rax      # 0xd468
movslq -0x14(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq 0x9ca1(%rip), %rdi      # 0xd488
movslq -0x14(%rbp), %rax
shlq $0x4, %rax
leaq 0x954a(%rip), %rcx      # 0xcd40
movq (%rax,%rcx), %rdx
movq -0x40(%rbp), %rax
movsd 0x8(%rax), %xmm0
leaq 0x5ab4(%rip), %rsi      # 0x92be
movb $0x1, %al
callq 0x2230
movq -0x40(%rbp), %rax
movl (%rax), %eax
incl %eax
movl %eax, %ecx
movq %rcx, -0x78(%rbp)
subl $0x3, %eax
ja 0x3851
movq -0x78(%rbp), %rax
leaq 0x5815(%rip), %rcx      # 0x9044
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq $0x0, -0x48(%rbp)
jmp 0x385c
leaq 0x5a99(%rip), %rax      # 0x92e2
movq %rax, -0x48(%rbp)
jmp 0x385c
jmp 0x3851
leaq 0x5a96(%rip), %rax      # 0x92ee
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x387c
movq 0x9c1e(%rip), %rdi      # 0xd488
movq -0x48(%rbp), %rdx
leaq 0x5a85(%rip), %rsi      # 0x92fa
movb $0x0, %al
callq 0x2230
movq 0x9c05(%rip), %rdi      # 0xd488
leaq 0x5a78(%rip), %rsi      # 0x9302
movb $0x0, %al
callq 0x2230
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x37ad
movq 0x9be2(%rip), %rdi      # 0xd488
leaq 0x5a64(%rip), %rsi      # 0x9311
movb $0x0, %al
callq 0x2230
movq 0x9bcd(%rip), %rdi      # 0xd488
callq 0x2110
cmpl $0x0, 0x9bb5(%rip)      # 0xd47c
je 0x393d
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x43e0
addl $0x1, %eax
cmpl 0x9b88(%rip), %eax      # 0xd464
jne 0x393d
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x9450(%rip), %rax      # 0xcd40
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x393b
movq 0x9b63(%rip), %rax      # 0xd468
movslq -0x14(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
cmpl $-0x1, (%rax)
je 0x392e
movq 0x9b4c(%rip), %rax      # 0xd468
movslq -0x14(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movl (%rax), %eax
movl %eax, -0x1c(%rbp)
jmp 0x393b
jmp 0x3930
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x38e5
jmp 0x395e
movl $0x1, %edi
callq 0x43e0
cmpl $0x0, %eax
jle 0x3955
movl $0x1, -0x1c(%rbp)
jmp 0x395c
movl $0x0, -0x1c(%rbp)
jmp 0x395e
callq 0x4830
movl -0x1c(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nop