// File: AndreRenaud[P]simple_options/./acutest.h
// Function: main
int
main(int argc, char** argv)
{
    int i;

    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

    /* By default, we want to run all tests. */
    if(acutest_count_ == 0) {
        for(i = 0; acutest_list_[i].func != NULL; i++)
            acutest_remember_(i);
    }

    /* Guess whether we want to run unit tests as child processes. */
    if(acutest_no_exec_ < 0) {
        acutest_no_exec_ = 0;

        if(acutest_count_ <= 1) {
            acutest_no_exec_ = 1;
        } else {
#ifdef ACUTEST_WIN_
            if(IsDebuggerPresent())
                acutest_no_exec_ = 1;
#endif
#ifdef ACUTEST_LINUX_
            if(acutest_is_tracer_present_())
                acutest_no_exec_ = 1;
#endif
#ifdef RUNNING_ON_VALGRIND
            /* RUNNING_ON_VALGRIND is provided by optionally included <valgrind.h> */
            if(RUNNING_ON_VALGRIND)
                acutest_no_exec_ = 1;
#endif
        }
    }

    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", (int) acutest_count_);
    }

    int index = acutest_worker_index_;
    for(i = 0; acutest_list_[i].func != NULL; i++) {
        int run = (acutest_test_data_[i].flags & ACUTEST_FLAG_RUN_);
        if (acutest_skip_mode_) /* Run all tests except those listed. */
            run = !run;
        if(run)
            acutest_run_(&acutest_list_[i], index++, i);
    }

    /* Write a summary */
    if(!acutest_no_summary_ && acutest_verbose_level_ >= 1) {
        if(acutest_verbose_level_ >= 3) {
            acutest_colored_printf_(ACUTEST_COLOR_DEFAULT_INTENSIVE_, "Summary:\n");

            printf("  Count of all unit tests:     %4d\n", (int) acutest_list_size_);
            printf("  Count of run unit tests:     %4d\n", acutest_stat_run_units_);
            printf("  Count of failed unit tests:  %4d\n", acutest_stat_failed_units_);
            printf("  Count of skipped unit tests: %4d\n", (int) acutest_list_size_ - acutest_stat_run_units_);
        }

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

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

    if (acutest_xml_output_) {
#if defined ACUTEST_UNIX_
        char *suite_name = basename(argv[0]);
#elif defined ACUTEST_WIN_
        char suite_name[_MAX_FNAME];
        _splitpath(argv[0], NULL, NULL, suite_name, NULL);
#else
        const char *suite_name = argv[0];
#endif
        fprintf(acutest_xml_output_, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
        fprintf(acutest_xml_output_, "<testsuite name=\"%s\" tests=\"%d\" errors=\"%d\" failures=\"%d\" skip=\"%d\">\n",
            suite_name, (int)acutest_list_size_, acutest_stat_failed_units_, acutest_stat_failed_units_,
            (int)acutest_list_size_ - acutest_stat_run_units_);
        for(i = 0; acutest_list_[i].func != NULL; i++) {
            struct acutest_test_data_ *details = &acutest_test_data_[i];
            fprintf(acutest_xml_output_, "  <testcase name=\"%s\" time=\"%.2f\">\n", acutest_list_[i].name, details->duration);
            if (details->flags & ACUTEST_FLAG_FAILURE_)
                fprintf(acutest_xml_output_, "    <failure />\n");
            if (!(details->flags & ACUTEST_FLAG_FAILURE_) && !(details->flags & ACUTEST_FLAG_SUCCESS_))
                fprintf(acutest_xml_output_, "    <skipped />\n");
            fprintf(acutest_xml_output_, "  </testcase>\n");
        }
        fprintf(acutest_xml_output_, "</testsuite>\n");
        fclose(acutest_xml_output_);
    }

    acutest_cleanup_();

    return (acutest_stat_failed_units_ == 0) ? 0 : 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, 0x76d4(%rip)      # 0xb2a8
movl $0x1, %edi
callq 0x2090
movl %eax, 0x76cc(%rip)      # 0xb2b0
movq $0x0, 0x76c9(%rip) # 0xb2b8
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x6fff(%rip), %rax      # 0xac00
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x3c2c
movq 0x76a2(%rip), %rax      # 0xb2b8
addq $0x1, %rax
movq %rax, 0x7697(%rip)      # 0xb2b8
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x3bf6
movq 0x7685(%rip), %rdi      # 0xb2b8
movl $0x10, %esi
callq 0x2160
movq %rax, 0x767c(%rip)      # 0xb2c0
cmpq $0x0, 0x7674(%rip)      # 0xb2c0
jne 0x3c70
movq 0x73a3(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x3560(%rip), %rsi      # 0x71bf
movb $0x0, %al
callq 0x2190
movl $0x2, %edi
callq 0x40b0
movl -0x8(%rbp), %esi
movq -0x10(%rbp), %rdx
leaq 0x6e02(%rip), %rdi      # 0xaa80
leaq 0x90b(%rip), %rcx       # 0x4590
callq 0x40d0
callq 0x4b10
cmpq $0x0, 0x7631(%rip)      # 0xb2c8
jne 0x3cce
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x6f55(%rip), %rax      # 0xac00
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x3ccc
movl -0x14(%rbp), %edi
callq 0x4b40
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x3ca0
jmp 0x3cce
cmpl $0x0, 0x7487(%rip)      # 0xb15c
jge 0x3d0f
movl $0x0, 0x747b(%rip)      # 0xb15c
cmpq $0x1, 0x75df(%rip)      # 0xb2c8
ja 0x3cf7
movl $0x1, 0x7467(%rip)      # 0xb15c
jmp 0x3d0d
callq 0x4ba0
cmpl $0x0, %eax
je 0x3d0b
movl $0x1, 0x7451(%rip)      # 0xb15c
jmp 0x3d0d
jmp 0x3d0f
cmpl $0x0, 0x75ba(%rip)      # 0xb2d0
je 0x3d57
cmpl $0x2, 0x7439(%rip)      # 0xb158
jle 0x3d2b
movl $0x2, 0x742d(%rip)      # 0xb158
movl $0x1, 0x759f(%rip)      # 0xb2d4
cmpl $0x0, 0x759c(%rip)      # 0xb2d8
jne 0x3d55
movq 0x7583(%rip), %rax      # 0xb2c8
movl %eax, %esi
leaq 0x3481(%rip), %rdi      # 0x71cf
movb $0x0, %al
callq 0x2100
jmp 0x3d57
movl 0x757f(%rip), %eax      # 0xb2dc
movl %eax, -0x18(%rbp)
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x6e8e(%rip), %rax      # 0xac00
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x3df0
movq 0x7539(%rip), %rax      # 0xb2c0
movslq -0x14(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movzbl (%rax), %eax
andl $0x1, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, 0x753e(%rip)      # 0xb2e0
je 0x3db5
cmpl $0x0, -0x1c(%rbp)
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
je 0x3de0
movslq -0x14(%rbp), %rax
leaq 0x6e3a(%rip), %rdi      # 0xac00
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 0x4d10
jmp 0x3de2
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x3d67
cmpl $0x0, 0x74dd(%rip)      # 0xb2d4
jne 0x3f0f
cmpl $0x1, 0x7354(%rip)      # 0xb158
jl 0x3f0f
cmpl $0x3, 0x7347(%rip)      # 0xb158
jl 0x3e82
movl $0x3, %edi
leaq 0x33b7(%rip), %rsi      # 0x71d6
movb $0x0, %al
callq 0x3470
movq 0x748b(%rip), %rax      # 0xb2b8
movl %eax, %esi
leaq 0x33aa(%rip), %rdi      # 0x71e0
movb $0x0, %al
callq 0x2100
movl 0x74a1(%rip), %esi      # 0xb2e4
leaq 0x33ba(%rip), %rdi      # 0x7204
movb $0x0, %al
callq 0x2100
movl 0x7491(%rip), %esi      # 0xb2e8
leaq 0x33ca(%rip), %rdi      # 0x7228
movb $0x0, %al
callq 0x2100
movq 0x744c(%rip), %rax      # 0xb2b8
movl %eax, %esi
subl 0x7470(%rip), %esi      # 0xb2e4
leaq 0x33d1(%rip), %rdi      # 0x724c
movb $0x0, %al
callq 0x2100
cmpl $0x0, 0x745f(%rip)      # 0xb2e8
jne 0x3eae
movl $0x4, %edi
leaq 0x33d9(%rip), %rsi      # 0x7270
movb $0x0, %al
callq 0x3470
leaq 0x33d4(%rip), %rdi      # 0x7279
movb $0x0, %al
callq 0x2100
jmp 0x3ef6
movl $0x5, %edi
leaq 0x33dd(%rip), %rsi      # 0x7297
movb $0x0, %al
callq 0x3470
movl 0x7421(%rip), %esi      # 0xb2e8
movl 0x7417(%rip), %edx      # 0xb2e4
movl 0x7415(%rip), %edi      # 0xb2e8
leaq 0x33ea(%rip), %rcx      # 0x72c4
leaq 0x33df(%rip), %rax      # 0x72c0
cmpl $0x1, %edi
cmoveq %rax, %rcx
leaq 0x33b0(%rip), %rdi      # 0x729f
movb $0x0, %al
callq 0x2100
cmpl $0x3, 0x725b(%rip)      # 0xb158
jl 0x3f0d
leaq 0x36d0(%rip), %rdi      # 0x75d6
movb $0x0, %al
callq 0x2100
jmp 0x3f0f
cmpq $0x0, 0x73d9(%rip)      # 0xb2f0
je 0x408a
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x21b0
movq %rax, -0x28(%rbp)
movq 0x73bc(%rip), %rdi      # 0xb2f0
leaq 0x338e(%rip), %rsi      # 0x72c9
movb $0x0, %al
callq 0x2190
movq 0x73a7(%rip), %rdi      # 0xb2f0
movq -0x28(%rbp), %rdx
movq 0x7364(%rip), %rax      # 0xb2b8
movl %eax, %ecx
movl 0x738b(%rip), %r8d      # 0xb2e8
movl 0x7384(%rip), %r9d      # 0xb2e8
movq 0x734d(%rip), %rax      # 0xb2b8
subl 0x7373(%rip), %eax      # 0xb2e4
leaq 0x3379(%rip), %rsi      # 0x72f1
movl %eax, (%rsp)
movb $0x0, %al
callq 0x2190
movl $0x0, -0x14(%rbp)
movslq -0x14(%rbp), %rcx
leaq 0x6c6c(%rip), %rax      # 0xac00
shlq $0x4, %rcx
addq %rcx, %rax
cmpq $0x0, 0x8(%rax)
je 0x4069
movq 0x7313(%rip), %rax      # 0xb2c0
movslq -0x14(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq 0x732d(%rip), %rdi      # 0xb2f0
movslq -0x14(%rbp), %rcx
leaq 0x6c32(%rip), %rax      # 0xac00
shlq $0x4, %rcx
addq %rcx, %rax
movq (%rax), %rdx
movq -0x30(%rbp), %rax
movsd 0x8(%rax), %xmm0
leaq 0x334f(%rip), %rsi      # 0x7337
movb $0x1, %al
callq 0x2190
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x4013
movq 0x72eb(%rip), %rdi      # 0xb2f0
leaq 0x334f(%rip), %rsi      # 0x735b
movb $0x0, %al
callq 0x2190
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
jne 0x4046
movq -0x30(%rbp), %rax
movzbl (%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
jne 0x4046
movq 0x72b8(%rip), %rdi      # 0xb2f0
leaq 0x332d(%rip), %rsi      # 0x736c
movb $0x0, %al
callq 0x2190
movq 0x72a3(%rip), %rdi      # 0xb2f0
leaq 0x3329(%rip), %rsi      # 0x737d
movb $0x0, %al
callq 0x2190
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x3f89
movq 0x7280(%rip), %rdi      # 0xb2f0
leaq 0x3315(%rip), %rsi      # 0x738c
movb $0x0, %al
callq 0x2190
movq 0x726b(%rip), %rdi      # 0xb2f0
callq 0x20d0
callq 0x4ff0
movl 0x7253(%rip), %edx      # 0xb2e8
movl $0x1, %eax
xorl %ecx, %ecx
cmpl $0x0, %edx
cmovel %ecx, %eax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)