// File: /workspace/github_c_makefile_star2_O1/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 $0x38, %rsp
movq %rsi, %r15
movl %edi, %r12d
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movq 0x8b31(%rip), %rax      # 0xafe0
movl $0x0, (%rax)
movq $0x0, 0x10(%rsp)
movl $0x8, %edi
xorl %esi, %esi
callq 0x20e0
leaq 0x4b5b(%rip), %rbx      # 0x702c
leaq 0x4b2c(%rip), %rbp      # 0x7004
movq 0x8ac9(%rip), %r13      # 0xafa8
movl $0x0, 0xc(%rsp)
movq $0x0, 0x18(%rsp)
xorl %r14d, %r14d
movl %r12d, %edi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x2080
cmpl $0x6c, %eax
jle 0x2544
addl $-0x6d, %eax
cmpl $0x9, %eax
ja 0x24f3
movslq (%rbp,%rax,4), %rax
addq %rbp, %rax
jmpq *%rax
movq (%r13), %rdi
callq 0x2050
movq %rax, 0x8c78(%rip)      # 0xb1a0
testq %rax, %rax
jne 0x24f3
jmp 0x26cc
movq (%r13), %rdi
callq 0x2270
cltq
movq %rax, 0x20(%rsp)
jmp 0x24f3
cmpl $-0x1, %eax
je 0x2595
cmpl $0x66, %eax
je 0x2588
cmpl $0x3f, %eax
jne 0x24f3
jmp 0x26d3
movl $0x1, %eax
movq %rax, 0x10(%rsp)
jmp 0x24f3
movq (%r13), %rdi
callq 0x2e21
movq %rax, 0x18(%rsp)
jmp 0x24f3
movq (%r13), %rdi
callq 0x2270
movl %eax, %r14d
jmp 0x24f3
movl $0x1, 0xc(%rsp)
jmp 0x24f3
cmpq $0x0, 0x20(%rsp)
jne 0x25a6
movq $0x3, 0x20(%rsp)
testl %r14d, %r14d
movq 0x18(%rsp), %rbx
jne 0x25c6
movl $0x54, %edi
callq 0x2100
testl %eax, %eax
movl $0x2, %r14d
cmovnel %eax, %r14d
testq %rbx, %rbx
je 0x25d8
movq %rbx, %rdi
callq 0x2870
movq %rax, %rbx
jmp 0x260b
movq 0x89f1(%rip), %rax      # 0xafd0
movslq (%rax), %rax
cmpl %r12d, %eax
jge 0x26da
movq (%r15,%rax,8), %rdi
callq 0x2961
testq %rax, %rax
je 0x26e1
movq %rax, %rbx
cmpq $0x0, 0x8(%rax)
je 0x26f3
movq %rbx, %rdi
callq 0x2722
movq %rax, %r12
leaq 0x105(%rip), %r13       # 0x2722
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x2f08
movq %rax, %rbp
movq %rax, %rdi
movl %r14d, %esi
callq 0x2f4d
leaq 0x20(%rsp), %rsi
movq %rbp, %rdi
callq 0x2f3e
movq %rbp, %rdi
movq %r13, %rsi
callq 0x2f51
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x2faf
movq %rbp, %rdi
movq %r12, %rsi
callq 0x2faa
movq %rbp, %rdi
callq 0x3011
testq %rax, %rax
je 0x2703
movq %rax, %r14
movq %rax, %rdi
movq 0x10(%rsp), %rsi
movl 0xc(%rsp), %edx
callq 0x3350
movq %r14, %rdi
callq 0x2fb5
testq %rbx, %rbx
je 0x26a5
movq %rbx, %rdi
callq 0x2b2d
movq %rbx, %rdi
callq 0x22e8
testq %r12, %r12
je 0x26ba
movq %r12, %rdi
callq 0x2b2d
movq %r12, %rdi
callq 0x22e8
movl %r15d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x231e
jmp 0x26e6
callq 0x2300
jmp 0x26e6
callq 0x233c
jmp 0x26e6
callq 0x2376
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
xorl %r12d, %r12d
xorl %ebx, %ebx
jmp 0x2690
callq 0x235a
movl $0xffffffff, %r15d      # imm = 0xFFFFFFFF
xorl %r12d, %r12d
jmp 0x2690
leaq 0x4c5b(%rip), %rdi      # 0x7365
leaq 0x494f(%rip), %rsi      # 0x7060
leaq 0x4953(%rip), %rcx      # 0x706b
movl $0x9e, %edx
callq 0x2110