// File: /workspace/github_c_makefile_star2_O1/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 0x342(%rip), %rax       # 0x2b6e
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 %r14d, %r14d
movl %r14d, %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, %esi
leaq 0x58a8(%rip), %r15      # 0x812c
movq $-0x38, %rax
leaq -0x38(%rsi), %rcx
cmpl $0xdeadbeef, -0x3c(%rsi,%r15) # imm = 0xDEADBEEF
movl %r14d, %edx
cmoveq %rax, %rdx
movq %rcx, %rsi
je 0x288b
addq %rcx, %rdx
leaq (%r15,%rdx), %r14
leaq 0x5842(%rip), %rsi      # 0x80f4
xorl %eax, %eax
movl $0x38, %ecx
movq %rdx, %rbx
leaq 0x38(%rsi), %r12
addq $-0x38, %rbx
cmpl $0xdeadbeef, 0xa4(%rsi) # imm = 0xDEADBEEF
movq %rax, %r13
cmoveq %rcx, %r13
movq %rbx, %rdx
movq %r12, %rsi
je 0x28b9
movq %r14, 0x5cbc(%rip)      # 0x85a0
addq %r13, %r12
cmpq %rbx, %r13
je 0x291b
movq %r14, %rdi
cmpq %r15, %rdi
je 0x2904
callq *0x5826(%rip)           # 0x8120
testl %eax, %eax
je 0x2904
incl 0x5c84(%rip)            # 0x8588
movq 0x5c95(%rip), %rax      # 0x85a0
leaq 0x38(%rax), %rdi
movq %rdi, 0x5c8a(%rip)      # 0x85a0
cmpq %rax, %r12
jne 0x28ef
movq %r14, 0x5c7e(%rip)      # 0x85a0
cmpq %rbx, %r13
je 0x2aab
leaq 0x5c7e(%rip), %rbx      # 0x85b0
xorl %r13d, %r13d
leaq 0x5b84(%rip), %rax      # 0x84c0
movq %r14, %rdi
movq %rax, %r14
cmpq %r15, %rdi
je 0x2a90
callq *0x57cf(%rip)           # 0x8120
testl %eax, %eax
je 0x2a90
movb $0x0, 0x5c50(%rip)      # 0x85b0
movq $0xfff, 0x6c45(%rip) # imm = 0xFFF
movq %rbx, 0x6c46(%rip)      # 0x95b8
movl 0x57a0(%rip), %esi      # 0x8118
movl 0x5c0a(%rip), %edx      # 0x8588
movq 0x5c1b(%rip), %rax      # 0x85a0
movq (%rax), %rcx
movq 0x8(%rax), %r8
movl %r13d, %eax
leaq 0x287d(%rip), %rdi      # 0x5213
callq 0x2100
movq 0x5636(%rip), %rax      # 0x7fd8
movq (%rax), %rdi
callq 0x21d0
movq 0x5bef(%rip), %rax      # 0x85a0
cmpl $0x0, 0x30(%rax)
je 0x29d5
leaq 0x2867(%rip), %rdi      # 0x5225
leaq 0x2869(%rip), %rsi      # 0x522e
callq 0x2ba3
incl 0x5bc4(%rip)            # 0x8594
jmp 0x2a8a
movq %r14, %rdi
callq 0x2170
testl %eax, %eax
je 0x29fd
leaq 0x2850(%rip), %rdi      # 0x5238
leaq 0x2852(%rip), %rsi      # 0x5241
callq 0x2ba3
leaq 0x5b95(%rip), %rax      # 0x8590
jmp 0x2a69
movq 0x5b9c(%rip), %rax      # 0x85a0
movq 0x20(%rax), %rcx
testq %rcx, %rcx
je 0x2a1b
movq (%rcx), %rcx
testq %rcx, %rcx
je 0x2a1b
movq 0x18(%rax), %rdi
callq *%rcx
movq 0x5b7e(%rip), %rax      # 0x85a0
movq 0x10(%rax), %rcx
movq 0x18(%rax), %rdi
movl %r13d, %eax
testq %rdi, %rdi
je 0x2a36
callq *%rcx
jmp 0x2a38
callq *%rcx
movq 0x5b61(%rip), %rax      # 0x85a0
movq 0x28(%rax), %rcx
testq %rcx, %rcx
je 0x2a56
movq (%rcx), %rcx
testq %rcx, %rcx
je 0x2a56
movq 0x18(%rax), %rdi
callq *%rcx
leaq 0x2843(%rip), %rdi      # 0x52a0
callq 0x2080
leaq 0x5b23(%rip), %rax      # 0x858c
incl (%rax)
cmpq $0xfff, 0x6b3a(%rip) # imm = 0xFFF
je 0x2a8a
movl %r13d, %eax
leaq 0x2fe5(%rip), %rdi      # 0x5a67
movq %rbx, %rsi
callq 0x2100
incl 0x5688(%rip)            # 0x8118
movq 0x5b09(%rip), %rax      # 0x85a0
leaq 0x38(%rax), %rdi
movq %rdi, 0x5afe(%rip)      # 0x85a0
cmpq %rax, %r12
jne 0x2942
xorl %r15d, %r15d
movl %r15d, %esi
leaq -0x90(%rbp), %r14
movq %r14, %rdi
callq 0x2130
movq (%r14), %rax
movl 0x5ac6(%rip), %r9d      # 0x8590
testl %r9d, %r9d
leaq 0x2774(%rip), %rcx      # 0x5248
leaq 0x275d(%rip), %rbx      # 0x5238
cmoveq %rcx, %rbx
movq 0x8(%r14), %rdx
movl 0x5a9f(%rip), %ecx      # 0x8588
movl 0x5a9c(%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 0x5a77(%rip), %r10d     # 0x8594
movq %rdx, %r11
shrq $0x4, %r11
leaq 0x2725(%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 0x2ba3
movl 0x5a3c(%rip), %eax      # 0x8590
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq