// File: /workspace/github_c_makefile_star2_O3/tomcatzh[P]RealityBenchmark/md_bench.c
// Function: main
int main(int argc, char **argv) {
    int ret = -1;
    CONTENTS *contents = NULL;
    CONTENTS *mdResult = NULL;

    struct timeval timeout;
    timeout.tv_sec = 0;
    timeout.tv_usec = 0;
    unsigned int threads = 0;
    int verbose = 0;
    int formated = 0;
    size_t randomSize = 0;

    int index;
    int c;
    opterr = 0;

    OpenSSL_add_all_digests();

    while ((c = getopt(argc, argv, "r:t:m:vfu:")) != -1) {
        switch (c) {
        case 'r':
            timeout.tv_sec = atoi(optarg);
            break;
        case 't':
            threads = atoi(optarg);
            break;
        case 'u':
            randomSize = parseHumanSize(optarg);
            break;
        case 'v':
            verbose = 1;
            break;
        case 'm':
            md = EVP_get_digestbyname(optarg);
            if (!md) {
                printUsage();
                goto END;
            }
            break;
        case 'f':
            formated = 1;
            break;
        case '?':
            printUsage();
            goto END;
        }
    }

    if (timeout.tv_sec == 0) {
    timeout.tv_sec = 3;
    }

    if (threads == 0) {
    threads = sysconf(_SC_NPROCESSORS_ONLN);
    if (threads == 0) 
        threads = 2;
    }

    if (randomSize) {
    contents = randomContents(randomSize);
    } else {
    index = optind;
    if (index >= argc) {
        printUsage();
        goto END;
    }

    contents = getContents(argv[index]);

    if (contents == NULL) {
        fprintf(stderr, "Get content error\n");
        goto END;
    } else if (contents->size == 0) {
        fprintf(stderr, "Empty content to zip\n");
        goto END;
    }
    }

    mdResult = mdContent(contents);

    TEST *t = testNew();
    testSetThreads(t, threads);
    testSetTimeout(t, &timeout);
    testAddRun(t, &mdContent);
    testSetInput(t, contents);
    testSetTesting(t, mdResult);

    RESULT *r = testRun(t);
    assert(r);

    printResult(r, verbose, formated);

    resultDestory(r);

    ret = 0;

END:
    if (contents) {
        destroyContents(contents);
        free(contents);
        contents = NULL;
    }
    if (mdResult) {
        destroyContents(mdResult);
        free(mdResult);
        mdResult = NULL;
    }
    return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r15
movl %edi, %r12d
movq $0x0, 0x20(%rsp)
movq 0x8b40(%rip), %rax      # 0xafe0
movl $0x0, (%rax)
xorl %ebx, %ebx
movl $0x8, %edi
xorl %esi, %esi
callq 0x20e0
leaq 0x4b71(%rip), %rbp      # 0x702c
leaq 0x4b42(%rip), %r13      # 0x7004
movq 0x8adf(%rip), %r14      # 0xafa8
movl $0x0, 0x8(%rsp)
movl $0x0, 0x4(%rsp)
movq $0x0, 0x10(%rsp)
movl $0x0, 0xc(%rsp)
movl %r12d, %edi
movq %r15, %rsi
movq %rbp, %rdx
callq 0x2080
cmpl $0x6c, %eax
jle 0x2528
addl $-0x6d, %eax
cmpl $0x9, %eax
ja 0x24ea
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
movq (%r14), %rdi
callq 0x2050
movq %rax, 0x8c7a(%rip)      # 0xb198
testq %rax, %rax
jne 0x24ea
jmp 0x26a7
cmpl $-0x1, %eax
je 0x2580
cmpl $0x66, %eax
je 0x2573
cmpl $0x3f, %eax
jne 0x24ea
jmp 0x26ae
movq (%r14), %rdi
callq 0x2260
movslq %eax, %rbx
jmp 0x24ea
movq (%r14), %rdi
callq 0x2260
movl %eax, 0xc(%rsp)
jmp 0x24ea
movl $0x1, 0x8(%rsp)
jmp 0x24ea
movq (%r14), %rdi
callq 0x2e08
movq %rax, 0x10(%rsp)
jmp 0x24ea
movl $0x1, 0x4(%rsp)
jmp 0x24ea
testq %rbx, %rbx
movl $0x3, %eax
cmovneq %rbx, %rax
movq %rax, 0x18(%rsp)
movl 0xc(%rsp), %r14d
testl %r14d, %r14d
jne 0x25b1
movl $0x54, %edi
callq 0x2100
testl %eax, %eax
movl $0x2, %r14d
cmovnel %eax, %r14d
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x25c5
callq 0x2854
movq %rax, %r15
jmp 0x25f8
movq 0x8a04(%rip), %rax      # 0xafd0
movslq (%rax), %rax
cmpl %r12d, %eax
jge 0x26b5
movq (%r15,%rax,8), %rdi
callq 0x2945
testq %rax, %rax
je 0x26bc
movq %rax, %r15
cmpq $0x0, 0x8(%rax)
je 0x26d7
movq %r15, %rdi
callq 0x2705
movq %rax, %r12
leaq 0xfb(%rip), %r13        # 0x2705
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x2ed8
movq %rax, %rbx
movq %rax, %rdi
movl %r14d, %esi
callq 0x2f15
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x2f0e
movq %rbx, %rdi
movq %r13, %rsi
callq 0x2f19
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2f77
movq %rbx, %rdi
movq %r12, %rsi
callq 0x2f72
movq %rbx, %rdi
callq 0x2fd9
testq %rax, %rax
je 0x26e6
movq %rax, %r14
movq %rax, %rdi
movl 0x8(%rsp), %esi
movl 0x4(%rsp), %edx
callq 0x3331
movq %r14, %rdi
callq 0x2f7d
testq %r15, %r15
je 0x2690
movq %r15, %rdi
callq 0x2b11
movq %r15, %rdi
callq 0x22d8
testq %r12, %r12
je 0x26c6
movq %r12, %rdi
callq 0x2b11
movq %r12, %rdi
callq 0x22d8
jmp 0x26c6
callq 0x230e
jmp 0x26c1
callq 0x22f0
jmp 0x26c1
callq 0x232c
jmp 0x26c1
callq 0x2366
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x234a
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
xorl %r12d, %r12d
jmp 0x2680
leaq 0x4c78(%rip), %rdi      # 0x7365
leaq 0x496c(%rip), %rsi      # 0x7060
leaq 0x4970(%rip), %rcx      # 0x706b
movl $0x9e, %edx
callq 0x2110