// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x70, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
movq $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x38(%rbp)
movq $0x0, -0x30(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
movl $0x0, -0x44(%rbp)
movq $0x0, -0x50(%rbp)
movq 0xbb6f(%rip), %rax      # 0xdfe0
movl $0x0, (%rax)
movl $0x8, %edi
xorl %eax, %eax
movl %eax, %esi
callq 0x20e0
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x7c51(%rip), %rdx      # 0xa0e4
callq 0x2080
movl %eax, -0x58(%rbp)
cmpl $-0x1, %eax
je 0x255a
movl -0x58(%rbp), %eax
addl $-0x3f, %eax
movl %eax, %ecx
movq %rcx, -0x70(%rbp)
subl $0x37, %eax
ja 0x2555
movq -0x70(%rbp), %rax
leaq 0x7b40(%rip), %rcx      # 0xa004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0xbad4(%rip), %rax      # 0xdfa8
movq (%rax), %rdi
callq 0x22a0
cltq
movq %rax, -0x38(%rbp)
jmp 0x2555
movq 0xbabd(%rip), %rax      # 0xdfa8
movq (%rax), %rdi
callq 0x22a0
movl %eax, -0x3c(%rbp)
jmp 0x2555
movq 0xbaa9(%rip), %rax      # 0xdfa8
movq (%rax), %rdi
callq 0x31b0
movq %rax, -0x50(%rbp)
jmp 0x2555
movl $0x1, -0x40(%rbp)
jmp 0x2555
movq 0xba8b(%rip), %rax      # 0xdfa8
movq (%rax), %rdi
callq 0x2060
movq %rax, 0xbc84(%rip)      # 0xe1b0
cmpq $0x0, 0xbc7c(%rip)      # 0xe1b0
jne 0x2540
callq 0x28b0
jmp 0x26d6
jmp 0x2555
movl $0x1, -0x44(%rbp)
jmp 0x2555
callq 0x28b0
jmp 0x26d6
jmp 0x2485
cmpq $0x0, -0x38(%rbp)
jne 0x2569
movq $0x3, -0x38(%rbp)
cmpl $0x0, -0x3c(%rbp)
jne 0x258b
movl $0x54, %edi
callq 0x2110
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
jne 0x2589
movl $0x2, -0x3c(%rbp)
jmp 0x258b
cmpq $0x0, -0x50(%rbp)
je 0x25a4
movq -0x50(%rbp), %rdi
callq 0x28d0
movq %rax, -0x20(%rbp)
jmp 0x2627
movq 0xba25(%rip), %rax      # 0xdfd0
movl (%rax), %eax
movl %eax, -0x54(%rbp)
movl -0x54(%rbp), %eax
cmpl -0x8(%rbp), %eax
jl 0x25c2
callq 0x28b0
jmp 0x26d6
movq -0x10(%rbp), %rax
movslq -0x54(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2a00
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x25fb
movq 0xb9e3(%rip), %rax      # 0xdfc8
movq (%rax), %rdi
leaq 0x7b00(%rip), %rsi      # 0xa0ef
movb $0x0, %al
callq 0x2260
jmp 0x26d6
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x2623
movq 0xb9bb(%rip), %rax      # 0xdfc8
movq (%rax), %rdi
leaq 0x7aeb(%rip), %rsi      # 0xa102
movb $0x0, %al
callq 0x2260
jmp 0x26d6
jmp 0x2625
jmp 0x2627
movq -0x20(%rbp), %rdi
callq 0x2730
movq %rax, -0x28(%rbp)
movb $0x0, %al
callq 0x32f0
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rdi
movl -0x3c(%rbp), %esi
callq 0x3370
movq -0x60(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x3340
movq -0x60(%rbp), %rdi
leaq 0xcd(%rip), %rsi        # 0x2730
callq 0x3390
movq -0x60(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x3440
movq -0x60(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x3420
movq -0x60(%rbp), %rdi
callq 0x3510
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
je 0x2698
jmp 0x26b7
leaq 0x7d7e(%rip), %rdi      # 0xa41d
leaq 0x7a72(%rip), %rsi      # 0xa118
movl $0x9e, %edx
leaq 0x7a71(%rip), %rcx      # 0xa123
callq 0x2120
movq -0x68(%rbp), %rdi
movl -0x40(%rbp), %esi
movl -0x44(%rbp), %edx
callq 0x3950
movq -0x68(%rbp), %rdi
callq 0x3470
movl $0x0, -0x14(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x26f7
movq -0x20(%rbp), %rdi
callq 0x2c70
movq -0x20(%rbp), %rdi
callq 0x2308
movq $0x0, -0x20(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x2718
movq -0x28(%rbp), %rdi
callq 0x2c70
movq -0x28(%rbp), %rdi
callq 0x2308
movq $0x0, -0x28(%rbp)
movl -0x14(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)