// File: /workspace/github_c_makefile_star2_O2/TheDiamondProject[P]lib68/libUnit/unit.c
// Function: start_tests
int start_tests(void)
{
	ssize_t failed_test_count = 0;
	ssize_t test_count = 0;

    for (int i = 0; i < suite_count; ++i) {
        struct suite *s = test_suites[i];
        printf(
            "\x1b[31m❯\x1b[1;33m❯\x1b[0;32m❯ "
            "\x1b[36mStarting test suite \"\x1b[96m%s\x1b[36m\"\x1b[0m\n",
            s->name
        );

        // Give a summary about the test suite.
        printf(
            "\tTest suite contains %zu test case%s.\n",
            s->count, s->count == 1 ? "" : "s"
        );

        for (int j = 0; j < s->count; ++j) {
            struct test_case *tc = s->cases[j];
            tc->imp(s, tc);

            failed_test_count += tc->failed;
            test_count++;

            printf(
                "\t%s \x1b[0mTest case \"\x1b[1m%s\x1b[0m\" %s.\n",
                tc->failed == 0 ? "\x1b[0;32m✔" : "\x1b[0;31m×",
                tc->name,
                tc->failed == 0 ? "passed" : "failed"
            );
        }

        printf(
			"\t\x1b[1m%ld\x1b[0m tests run with "
			"\x1b[1m%ld\x1b[0m passed and \x1b[1m%d\x1b[0m failed.\n\n",
			s->count, 
			s->count - s->failed, 
			s->failed
		);
    }

    printf(
		"\x1b[1m%zu\x1b[0m tests run across \x1b[1m%zu\x1b[0m suites with "
		"\x1b[1m%zu\x1b[0m passed and \x1b[1m%zu\x1b[0m failed.\n\n",
		test_count, suite_count,
		test_count - failed_test_count, 
		failed_test_count
	);

    // Return 0 if there were no failed tests, otherwise return 1.
    return (failed_test_count >= 1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0x10cc(%rip), %r13      # 0x57bf
xorl %ecx, %ecx
xorl %esi, %esi
xorl %ebx, %ebx
movq 0x103958(%rip), %rdx    # 0x108058
cmpq %rcx, %rdx
jle 0x47e3
movq %rsi, -0x38(%rbp)
movq 0x10394c(%rip), %rax    # 0x108060
movq %rcx, -0x30(%rbp)
movq (%rax,%rcx,8), %r12
movq (%r12), %rsi
leaq 0x1027(%rip), %rdi      # 0x574e
xorl %eax, %eax
callq 0x3040
movq 0x8(%r12), %rsi
cmpq $0x1, %rsi
leaq 0x9b4(%rip), %rdx       # 0x50f2
leaq 0x1108(%rip), %rax      # 0x584d
cmoveq %rax, %rdx
leaq 0x1048(%rip), %rdi      # 0x5798
xorl %eax, %eax
callq 0x3040
xorl %r15d, %r15d
movq 0x8(%r12), %rsi
cmpq %r15, %rsi
jle 0x47b7
movq 0x20(%r12), %rax
movq (%rax,%r15,8), %r14
movq %r12, %rdi
movq %r14, %rsi
callq *0x10(%r14)
movslq 0x8(%r14), %rax
addq %rax, %rbx
testq %rax, %rax
leaq 0x1066(%rip), %rsi      # 0x57ee
leaq 0x1054(%rip), %rax      # 0x57e3
cmoveq %rax, %rsi
movq (%r14), %rdx
leaq 0x1062(%rip), %rcx      # 0x57ff
leaq 0x1054(%rip), %rax      # 0x57f8
cmoveq %rax, %rcx
movq %r13, %rdi
xorl %eax, %eax
callq 0x3040
incq %r15
jmp 0x475a
movslq 0x18(%r12), %rcx
movq %rsi, %rdx
subq %rcx, %rdx
leaq 0x103d(%rip), %rdi      # 0x5806
xorl %eax, %eax
callq 0x3040
movq -0x30(%rbp), %rcx
incq %rcx
movq -0x38(%rbp), %rsi
addq %r15, %rsi
jmp 0x46f9
movq %rsi, %rcx
subq %rbx, %rcx
leaq 0x105e(%rip), %rdi      # 0x584e
movq %rbx, %r8
xorl %eax, %eax
callq 0x3040
xorl %eax, %eax
testq %rbx, %rbx
setg %al
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq