// File: /workspace/github_c_makefile_star2_O0/tomcatzh[P]RealityBenchmark/zlib_bench.c
// Function: main
int main(int argc, char **argv) {
  int ret = -1;
  CONTENTS *contents = 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;

  while ((c = getopt(argc, argv, "r:t:l:vfu:")) != -1) {
    switch (c) {
    case 'r':
      timeout.tv_sec = atoi(optarg);
      break;
    case 't':
      threads = atoi(optarg);
      break;
    case 'l':
      level = atoi(optarg);
      break;
    case 'u':
      randomSize = parseHumanSize(optarg);
      break;
    case 'v':
      verbose = 1;
      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;
    }
  }
  

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

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

  printResult(r, verbose, formated);

  resultDestory(r);
  
  ret = 0;

END:
  if (contents) {
    destroyContents(contents);
    free(contents);
    contents = 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, -0x30(%rbp)
movq $0x0, -0x28(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movq $0x0, -0x48(%rbp)
movq 0xcb87(%rip), %rax      # 0xefe0
movl $0x0, (%rax)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x8c77(%rip), %rdx      # 0xb0e4
callq 0x2080
movl %eax, -0x50(%rbp)
cmpl $-0x1, %eax
je 0x251f
movl -0x50(%rbp), %eax
addl $-0x3f, %eax
movl %eax, %ecx
movq %rcx, -0x68(%rbp)
subl $0x37, %eax
ja 0x251a
movq -0x68(%rbp), %rax
leaq 0x8b66(%rip), %rcx      # 0xb004
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0xcafa(%rip), %rax      # 0xefa8
movq (%rax), %rdi
callq 0x22b0
cltq
movq %rax, -0x30(%rbp)
jmp 0x251a
movq 0xcae3(%rip), %rax      # 0xefa8
movq (%rax), %rdi
callq 0x22b0
movl %eax, -0x34(%rbp)
jmp 0x251a
movq 0xcacf(%rip), %rax      # 0xefa8
movq (%rax), %rdi
callq 0x22b0
movl %eax, 0xcca1(%rip)      # 0xf188
jmp 0x251a
movq 0xcab8(%rip), %rax      # 0xefa8
movq (%rax), %rdi
callq 0x34c0
movq %rax, -0x48(%rbp)
jmp 0x251a
movl $0x1, -0x38(%rbp)
jmp 0x251a
movl $0x1, -0x3c(%rbp)
jmp 0x251a
callq 0x2bc0
jmp 0x269e
jmp 0x245f
cmpq $0x0, -0x30(%rbp)
jne 0x252e
movq $0x3, -0x30(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0x2550
movl $0x54, %edi
callq 0x2110
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0x254e
movl $0x2, -0x34(%rbp)
jmp 0x2550
cmpq $0x0, -0x48(%rbp)
je 0x2569
movq -0x48(%rbp), %rdi
callq 0x2be0
movq %rax, -0x20(%rbp)
jmp 0x25ec
movq 0xca60(%rip), %rax      # 0xefd0
movl (%rax), %eax
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
cmpl -0x8(%rbp), %eax
jl 0x2587
callq 0x2bc0
jmp 0x269e
movq -0x10(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x2d10
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x25c0
movq 0xca1e(%rip), %rax      # 0xefc8
movq (%rax), %rdi
leaq 0x8b3b(%rip), %rsi      # 0xb0ef
movb $0x0, %al
callq 0x2270
jmp 0x269e
movq -0x20(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x25e8
movq 0xc9f6(%rip), %rax      # 0xefc8
movq (%rax), %rdi
leaq 0x8b26(%rip), %rsi      # 0xb102
movb $0x0, %al
callq 0x2270
jmp 0x269e
jmp 0x25ea
jmp 0x25ec
movb $0x0, %al
callq 0x3600
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rdi
movl -0x34(%rbp), %esi
callq 0x3680
movq -0x58(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x3650
movq -0x58(%rbp), %rdi
leaq 0xb5(%rip), %rsi        # 0x26d0
callq 0x36a0
movq -0x58(%rbp), %rdi
leaq 0x325(%rip), %rsi       # 0x2950
callq 0x36a0
movq -0x58(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x3750
movq -0x58(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x3730
movq -0x58(%rbp), %rdi
callq 0x3820
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
je 0x2660
jmp 0x267f
leaq 0x8c6c(%rip), %rdi      # 0xb2d3
leaq 0x8aaa(%rip), %rsi      # 0xb118
movl $0xc3, %edx
leaq 0x8aab(%rip), %rcx      # 0xb125
callq 0x2120
movq -0x60(%rbp), %rdi
movl -0x38(%rbp), %esi
movl -0x3c(%rbp), %edx
callq 0x3c60
movq -0x60(%rbp), %rdi
callq 0x3780
movl $0x0, -0x14(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x26bf
movq -0x20(%rbp), %rdi
callq 0x2f80
movq -0x20(%rbp), %rdi
callq 0x22f8
movq $0x0, -0x20(%rbp)
movl -0x14(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)