// File: /workspace/github_c_makefile_star2_O2/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
andq $0x0, 0x20(%rsp)
movq 0x8be3(%rip), %rax      # 0xafe0
andl $0x0, (%rax)
xorl %ebp, %ebp
pushq $0x8
popq %rdi
xorl %esi, %esi
callq 0x20e0
leaq 0x4c19(%rip), %rbx      # 0x702c
leaq 0x4bea(%rip), %r14      # 0x7004
movq 0x8b87(%rip), %r13      # 0xafa8
movl $0x0, 0x8(%rsp)
movl $0x0, 0x4(%rsp)
movq $0x0, 0x10(%rsp)
movl $0x0, 0xc(%rsp)
movl %r12d, %edi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x2080
leal -0x6d(%rax), %ecx
cmpl $0x9, %ecx
ja 0x247b
movslq (%r14,%rcx,4), %rax
addq %r14, %rax
jmpq *%rax
movq (%r13), %rdi
callq 0x2050
movq %rax, 0x8d27(%rip)      # 0xb198
testq %rax, %rax
jne 0x2442
jmp 0x25ed
cmpl $-0x1, %eax
je 0x24d0
cmpl $0x3f, %eax
je 0x25ed
cmpl $0x66, %eax
jne 0x2442
pushq $0x1
popq %rax
movl %eax, 0x4(%rsp)
jmp 0x2442
pushq $0x1
popq %rax
movl %eax, 0x8(%rsp)
jmp 0x2442
movq (%r13), %rdi
callq 0x2cce
movq %rax, 0x10(%rsp)
jmp 0x2442
movq (%r13), %rdi
callq 0x2260
movslq %eax, %rbp
jmp 0x2442
movq (%r13), %rdi
callq 0x2260
movl %eax, 0xc(%rsp)
jmp 0x2442
testq %rbp, %rbp
pushq $0x3
popq %rax
cmovneq %rbp, %rax
movq %rax, 0x18(%rsp)
movl 0xc(%rsp), %ebp
testl %ebp, %ebp
jne 0x24f7
pushq $0x54
popq %rdi
callq 0x2100
testl %eax, %eax
pushq $0x2
popq %rbp
cmovnel %eax, %ebp
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x250b
callq 0x27b8
movq %rax, %rbx
jmp 0x253e
movq 0x8abe(%rip), %rax      # 0xafd0
movslq (%rax), %rax
cmpl %r12d, %eax
jge 0x25ed
movq (%r15,%rax,8), %rdi
callq 0x2891
testq %rax, %rax
je 0x2608
movq %rax, %rbx
cmpq $0x0, 0x8(%rax)
je 0x2626
movq %rbx, %rdi
callq 0x266d
movq %rax, %r12
leaq 0x11d(%rip), %r14       # 0x266d
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x2d88
movq %rax, %r13
movq %rax, %rdi
movl %ebp, %esi
callq 0x2dbf
leaq 0x18(%rsp), %rsi
movq %r13, %rdi
callq 0x2db8
movq %r13, %rdi
movq %r14, %rsi
callq 0x2dc3
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2e1f
movq %r13, %rdi
movq %r12, %rsi
callq 0x2e1a
movq %r13, %rdi
callq 0x2e78
testq %rax, %rax
je 0x264e
movq %rax, %r14
movq %rax, %rdi
movl 0x8(%rsp), %esi
movl 0x4(%rsp), %edx
callq 0x3195
movq %r14, %rdi
callq 0x2e25
testq %rbx, %rbx
je 0x25d6
movq %rbx, %rdi
callq 0x2a36
movq %rbx, %rdi
callq 0x22d8
testq %r12, %r12
je 0x25f6
movq %r12, %rdi
callq 0x2a36
movq %r12, %rdi
callq 0x22d8
jmp 0x25f6
callq 0x2799
pushq $-0x1
popq %r15
movl %r15d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x89b9(%rip), %rax      # 0xafc8
movq (%rax), %rcx
leaq 0x4a1e(%rip), %rdi      # 0x7037
pushq $0x12
popq %rsi
pushq $0x1
popq %rdx
callq 0x22b0
jmp 0x25f2
movq 0x899b(%rip), %rax      # 0xafc8
movq (%rax), %rcx
leaq 0x4a13(%rip), %rdi      # 0x704a
pushq $0x15
popq %rsi
pushq $0x1
popq %rdx
callq 0x22b0
pushq $-0x1
popq %r15
xorl %r12d, %r12d
jmp 0x25c6
leaq 0x4d10(%rip), %rdi      # 0x7365
leaq 0x4a04(%rip), %rsi      # 0x7060
leaq 0x4a08(%rip), %rcx      # 0x706b
movl $0x9e, %edx
callq 0x2110