// File: /workspace/github_c_makefile_star2_O2/0xADE1A1DE[P]MeasureSuite/bin/ms.c
// Function: main
int main(int argc, char *argv[]) {
  if (argc < 2 || strcmp(argv[1], "-h") == 0 ||
      strcmp(argv[1], "--help") == 0) {
    print_usage(argv[0]);
    return -1;
  }
  struct opts parsed = {0};
  int idx = parse(&parsed, argc, argv);

  measuresuite_t ms = NULL;
  if (ms_initialize(&ms, parsed.arg_width, parsed.arg_num_in,
                    parsed.arg_num_out)) {
    goto ms_error;
  }

  ms_set_checking(ms, parsed.check);

  for (; idx < argc; idx++) {
    DEBUG("loading file %s\n", argv[idx]);
    int res = load(ms, argv[idx], parsed.sym);
    if (res == 0) {
      continue;
    }
    if (res == 1) {
      goto ms_error;
    }
    return -1;
  }

  if (ms_measure(ms, parsed.batch_size, parsed.num_batches)) {
    goto ms_error;
  };

  const char *json = NULL;
  size_t len = 0;

  ms_get_json(ms, &json, &len);
  printf("%s", json);

  if (ms_terminate(ms)) {
    goto ms_error;
  }
  free(parsed.sym);

  return 0;

ms_error:
  fprintf(stderr, "Error with Measuresuite:");
  ms_fprintf_error(ms, stderr);
  return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rsi, 0x18(%rsp)
cmpl $0x2, %edi
jl 0x26cd
movl %edi, %ebp
movq 0x18(%rsp), %rax
movq 0x8(%rax), %rdi
cmpb $0x2d, (%rdi)
jne 0x2570
cmpb $0x68, 0x1(%rdi)
jne 0x2570
cmpb $0x0, 0x2(%rdi)
je 0x26cd
leaq 0x2b3f(%rip), %rsi      # 0x50b6
callq 0x2170
testl %eax, %eax
je 0x26cd
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %r15
movaps %xmm0, 0x10(%r15)
movaps %xmm0, (%r15)
movq %r15, %rdi
movl %ebp, %esi
movq 0x18(%rsp), %rdx
callq 0x237c
leaq 0x10(%rsp), %rdi
andq $0x0, (%rdi)
movl %eax, %r14d
movl (%r15), %esi
movl 0x4(%r15), %edx
movl 0x8(%r15), %ecx
callq 0x281c
testl %eax, %eax
jne 0x2783
movq 0x10(%rsp), %rdi
movl 0x44(%rsp), %esi
callq 0x28bf
movslq %r14d, %rbx
movl %ebp, %eax
movq %rax, 0x28(%rsp)
movq 0x10(%rsp), %rbp
cmpq 0x28(%rsp), %rbx
jge 0x2723
movq 0x18(%rsp), %rax
movq (%rax,%rbx,8), %r13
movq 0x48(%rsp), %r14
movq %r13, %rdi
pushq $0x2e
popq %rsi
callq 0x20f0
testq %rax, %rax
je 0x27b3
movq %rax, %r15
cmpq %r13, %rax
je 0x27b3
leaq 0x1(%r15), %r12
movq %r12, %rdi
leaq 0x2f87(%rip), %rsi      # 0x55b3
callq 0x2170
testl %eax, %eax
je 0x27c6
movq %r12, %rdi
leaq 0x2fdb(%rip), %rsi      # 0x561e
callq 0x2170
xorl %esi, %esi
testl %eax, %eax
sete %cl
movzbl (%r12), %edi
cmpl $0x6f, %edi
je 0x2685
movb $0x1, %dl
cmpl $0x73, %edi
jne 0x268d
cmpb $0x6f, 0x2(%r15)
jne 0x268d
cmpb $0x0, 0x3(%r15)
jne 0x268d
testq %r14, %r14
je 0x2807
cmpb $0x0, (%r14)
pushq $0x3
popq %rsi
jne 0x26a5
jmp 0x2807
cmpb $0x0, 0x2(%r15)
setne %dl
testb %dl, %dl
je 0x2699
testl %eax, %eax
jne 0x27e7
testb %dl, %dl
jne 0x26a2
pushq $0x2
popq %rsi
jmp 0x26a5
movb %cl, %sil
orl $-0x1, 0x24(%rsp)
movq %rbp, %rdi
movq %r13, %rdx
movq %r14, %rcx
leaq 0x24(%rsp), %r8
callq 0x28d0
incq %rbx
testl %eax, %eax
je 0x25e0
jmp 0x2783
movq 0x18(%rsp), %rax
movq (%rax), %rsi
leaq 0x29fd(%rip), %rdi      # 0x50d9
xorl %eax, %eax
callq 0x20d0
leaq 0x2ea2(%rip), %rax      # 0x558c
movq %rax, (%rsp)
leaq 0x2a04(%rip), %rdi      # 0x50f9
pushq $0xa
popq %rsi
pushq $0x1
popq %rdx
pushq $0x2
popq %rcx
pushq $0x1f
popq %r8
movl $0x96, %r9d
xorl %eax, %eax
callq 0x20d0
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x3c(%rsp), %edx
movl 0x40(%rsp), %esi
movq %rbp, %rdi
callq 0x294c
testl %eax, %eax
jne 0x2783
leaq 0x60(%rsp), %rbx
andq $0x0, (%rbx)
leaq 0x58(%rsp), %rdx
andq $0x0, (%rdx)
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x298e
movq (%rbx), %rsi
leaq 0x295d(%rip), %rdi      # 0x50bd
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x20d0
movq 0x10(%rsp), %rdi
callq 0x29da
testl %eax, %eax
jne 0x2783
movq 0x48(%rsp), %rdi
callq 0x2040
jmp 0x2712
movq 0x686e(%rip), %rbx      # 0x8ff8
movq (%rbx), %rcx
leaq 0x292c(%rip), %rdi      # 0x50c0
pushq $0x18
popq %rsi
pushq $0x1
popq %rdx
callq 0x2250
movq 0x10(%rsp), %rdi
movq (%rbx), %rsi
callq 0x2a69
pushq $0x1
jmp 0x2711
movq 0x683e(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
leaq 0x2dcb(%rip), %rsi      # 0x558f
jmp 0x27f8
movq 0x682b(%rip), %rax      # 0x8ff8
movq (%rax), %rcx
leaq 0x2de0(%rip), %rdi      # 0x55b7
pushq $0x66
popq %rsi
pushq $0x1
popq %rdx
callq 0x2250
jmp 0x270f
movq 0x680a(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
leaq 0x2e5b(%rip), %rsi      # 0x5653
movq %r13, %rdx
xorl %eax, %eax
callq 0x2190
jmp 0x270f
movq 0x67ea(%rip), %rax      # 0x8ff8
movq (%rax), %rcx
leaq 0x2e0a(%rip), %rdi      # 0x5622
pushq $0x30
jmp 0x27d9