// File: /workspace/github_c_makefile_star2_O3/morozov312[P]documentary/thirdparty/ctest.h
// Function: ctest_main
__attribute__((no_sanitize_address)) int ctest_main(int argc, const char *argv[])
{
    static int total = 0;
    static int num_ok = 0;
    static int num_fail = 0;
    static int num_skip = 0;
    static int idx = 1;
    static ctest_filter_func filter = suite_all;

#ifdef CTEST_SEGFAULT
    signal(SIGSEGV, sighandler);
#endif

    if (argc == 2) {
        suite_name = argv[1];
        filter = suite_filter;
    }
#ifdef CTEST_NO_COLORS
    color_output = 0;
#else
    color_output = isatty(1);
#endif
    uint64_t t1 = getCurrentTime();

    struct ctest* ctest_begin = &CTEST_IMPL_TNAME(suite, test);
    struct ctest* ctest_end = &CTEST_IMPL_TNAME(suite, test);
    // find begin and end of section by comparing magics
    while (1) {
        struct ctest* t = ctest_begin-1;
        if (t->magic != CTEST_IMPL_MAGIC) break;
        ctest_begin--;
    }
    while (1) {
        struct ctest* t = ctest_end+1;
        if (t->magic != CTEST_IMPL_MAGIC) break;
        ctest_end++;
    }
    ctest_end++;    // end after last one

    static struct ctest* test;
    for (test = ctest_begin; test != ctest_end; test++) {
        if (test == &CTEST_IMPL_TNAME(suite, test)) continue;
        if (filter(test)) total++;
    }

    for (test = ctest_begin; test != ctest_end; test++) {
        if (test == &CTEST_IMPL_TNAME(suite, test)) continue;
        if (filter(test)) {
            ctest_errorbuffer[0] = 0;
            ctest_errorsize = MSG_SIZE-1;
            ctest_errormsg = ctest_errorbuffer;
            printf("TEST %d/%d %s:%s ", idx, total, test->ssname, test->ttname);
            fflush(stdout);
            if (test->skip) {
                color_print(ANSI_BYELLOW, "[SKIPPED]");
                num_skip++;
            } else {
                int result = setjmp(ctest_err);
                if (result == 0) {
                    if (test->setup && *test->setup) (*test->setup)(test->data);
                    if (test->data)
                        test->run(test->data);
                    else
                        test->run();
                    if (test->teardown && *test->teardown) (*test->teardown)(test->data);
                    // if we got here it's ok
#ifdef CTEST_COLOR_OK
                    color_print(ANSI_BGREEN, "[OK]");
#else
                    printf("[OK]\n");
#endif
                    num_ok++;
                } else {
                    color_print(ANSI_BRED, "[FAIL]");
                    num_fail++;
                }
                if (ctest_errorsize != MSG_SIZE-1) printf("%s", ctest_errorbuffer);
            }
            idx++;
        }
    }
    uint64_t t2 = getCurrentTime();

    const char* color = (num_fail) ? ANSI_BRED : ANSI_GREEN;
    char results[80];
    snprintf(results, sizeof(results), "RESULTS: %d tests (%d ok, %d failed, %d skipped) ran in %" PRIu64 " ms", total, num_ok, num_fail, num_skip, (t2 - t1)/1000);
    color_print(color, results);
    return num_fail;
}

// Assembly:
cmpl $0x2, %edi
jne 0x2833
movq 0x8(%rsi), %rax
movq %rax, 0x5d73(%rip)      # 0x8598
leaq 0x329(%rip), %rax       # 0x2b55
movq %rax, 0x58ed(%rip)      # 0x8120
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl $0x1, %edi
callq 0x2090
movl %eax, 0x58d4(%rip)      # 0x8128
xorl %eax, %eax
movl %eax, %esi
leaq -0x90(%rbp), %rbx
movq %rbx, %rdi
callq 0x2130
movq (%rbx), %rax
movq %rax, -0x30(%rbp)
movq 0x8(%rbx), %rax
movq %rax, -0x38(%rbp)
movl $0x38, %ecx
leaq 0x58aa(%rip), %r15      # 0x812c
leaq -0x38(%rcx), %rax
cmpl $0xdeadbeef, -0x3c(%rcx,%r15) # imm = 0xDEADBEEF
movq %rax, %rcx
je 0x2882
leaq (%r15,%rax), %r14
leaq 0x5855(%rip), %rcx      # 0x80f4
movq %rax, %rbx
leaq 0x38(%rcx), %r12
addq $-0x38, %rbx
cmpl $0xdeadbeef, 0xa4(%rcx) # imm = 0xDEADBEEF
movq %rbx, %rax
movq %r12, %rcx
je 0x289f
movq %r14, 0x5cdd(%rip)      # 0x85a0
testq %rbx, %rbx
je 0x2a92
movq %r14, %rdi
cmpq %r15, %rdi
je 0x28e4
callq *0x5846(%rip)           # 0x8120
testl %eax, %eax
je 0x28e4
incl 0x5ca4(%rip)            # 0x8588
movq 0x5cb5(%rip), %rax      # 0x85a0
leaq 0x38(%rax), %rdi
movq %rdi, 0x5caa(%rip)      # 0x85a0
cmpq %rax, %r12
jne 0x28cf
movq %r14, 0x5c9e(%rip)      # 0x85a0
testq %rbx, %rbx
je 0x2a92
leaq 0x5c9e(%rip), %rbx      # 0x85b0
leaq 0x28fa(%rip), %rax      # 0x5213
xorl %r13d, %r13d
movq %r14, %rdi
movq %rax, %r14
movq %r15, %rax
cmpq %r15, %rdi
je 0x2a7e
callq *0x57ec(%rip)           # 0x8120
movq 0x5c65(%rip), %rdi      # 0x85a0
testl %eax, %eax
je 0x29b0
movb $0x0, 0x5c6a(%rip)      # 0x85b0
movq $0xfff, 0x6c5f(%rip) # imm = 0xFFF
movq %rbx, 0x6c60(%rip)      # 0x95b8
movl 0x57ba(%rip), %esi      # 0x8118
movl 0x5c24(%rip), %edx      # 0x8588
movq (%rdi), %rcx
movq 0x8(%rdi), %r8
movl %r13d, %eax
movq %r14, %rdi
callq 0x2100
movq 0x565b(%rip), %rax      # 0x7fd8
movq (%rax), %rdi
callq 0x21d0
movq 0x5c14(%rip), %rax      # 0x85a0
cmpl $0x0, 0x30(%rax)
je 0x29b8
leaq 0x288c(%rip), %rdi      # 0x5225
leaq 0x288e(%rip), %rsi      # 0x522e
callq 0x2b8a
incl 0x5be9(%rip)            # 0x8594
jmp 0x2a71
movq %rdi, %rax
jmp 0x2a7e
leaq 0x5b01(%rip), %rdi      # 0x84c0
callq 0x2170
testl %eax, %eax
je 0x29e4
leaq 0x2869(%rip), %rdi      # 0x5238
leaq 0x286b(%rip), %rsi      # 0x5241
callq 0x2b8a
leaq 0x5bae(%rip), %rax      # 0x8590
jmp 0x2a50
movq 0x5bb5(%rip), %rax      # 0x85a0
movq 0x20(%rax), %rcx
testq %rcx, %rcx
je 0x2a09
movq (%rcx), %rcx
testq %rcx, %rcx
je 0x2a09
movq 0x18(%rax), %rdi
callq *%rcx
movq 0x5b97(%rip), %rax      # 0x85a0
movq 0x10(%rax), %rcx
movq 0x18(%rax), %rdi
movl %r13d, %eax
testq %rdi, %rdi
je 0x2a1d
callq *%rcx
jmp 0x2a1f
callq *%rcx
movq 0x5b7a(%rip), %rax      # 0x85a0
movq 0x28(%rax), %rcx
testq %rcx, %rcx
je 0x2a3d
movq (%rcx), %rcx
testq %rcx, %rcx
je 0x2a3d
movq 0x18(%rax), %rdi
callq *%rcx
leaq 0x285c(%rip), %rdi      # 0x52a0
callq 0x2080
leaq 0x5b3c(%rip), %rax      # 0x858c
incl (%rax)
cmpq $0xfff, 0x6b53(%rip) # imm = 0xFFF
je 0x2a71
movl %r13d, %eax
leaq 0x2ffe(%rip), %rdi      # 0x5a67
movq %rbx, %rsi
callq 0x2100
incl 0x56a1(%rip)            # 0x8118
movq 0x5b22(%rip), %rax      # 0x85a0
leaq 0x38(%rax), %rdi
movq %rdi, 0x5b17(%rip)      # 0x85a0
cmpq %rax, %r12
jne 0x2922
xorl %r15d, %r15d
movl %r15d, %esi
leaq -0x90(%rbp), %r14
movq %r14, %rdi
callq 0x2130
movq (%r14), %rax
movl 0x5adf(%rip), %r9d      # 0x8590
testl %r9d, %r9d
leaq 0x278d(%rip), %rcx      # 0x5248
leaq 0x2776(%rip), %rbx      # 0x5238
cmoveq %rcx, %rbx
movq 0x8(%r14), %rdx
movl 0x5ab8(%rip), %ecx      # 0x8588
movl 0x5ab5(%rip), %r8d      # 0x858c
subq -0x30(%rbp), %rax
imulq $0xf4240, %rax, %rax    # imm = 0xF4240
subq -0x38(%rbp), %rdx
addq %rax, %rdx
movq %rdx, %rax
shrq $0x3, %rax
movabsq $0x20c49ba5e353f7cf, %rdx # imm = 0x20C49BA5E353F7CF
mulq %rdx
movl 0x5a90(%rip), %r10d     # 0x8594
movq %rdx, %r11
shrq $0x4, %r11
leaq 0x273e(%rip), %rdx      # 0x5250
movl %r15d, %eax
movl $0x50, %esi
movq %r14, %rdi
pushq %r11
pushq %r10
callq 0x2110
addq $0x10, %rsp
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2b8a
movl 0x5a55(%rip), %eax      # 0x8590
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq