// File: /workspace/github_c_makefile_star2_O3/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, %r14
movq %rdi, 0x18(%rsp)
cmpl $0x2, %edi
jl 0x27ed
movq 0x8(%r14), %rdi
cmpb $0x2d, (%rdi)
jne 0x2610
cmpb $0x68, 0x1(%rdi)
jne 0x2610
cmpb $0x0, 0x2(%rdi)
je 0x27ed
leaq 0x2a9f(%rip), %rsi      # 0x50b6
callq 0x2170
testl %eax, %eax
je 0x27ed
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %r15
movaps %xmm0, 0x10(%r15)
movaps %xmm0, (%r15)
movq %r15, %rdi
movq 0x18(%rsp), %rsi
movq %r14, %rdx
callq 0x23fc
movl %eax, %ebp
leaq 0x10(%rsp), %rdi
movq $0x0, (%rdi)
movl (%r15), %esi
movl 0x4(%r15), %edx
movl 0x8(%r15), %ecx
callq 0x2898
testl %eax, %eax
jne 0x2848
movq 0x10(%rsp), %rdi
movl 0x44(%rsp), %esi
callq 0x2940
movq 0x18(%rsp), %rax
subl %ebp, %eax
movq %rax, 0x18(%rsp)
jle 0x2789
movslq %ebp, %rax
leaq (%r14,%rax,8), %rax
movq %rax, 0x28(%rsp)
xorl %ebx, %ebx
movq 0x10(%rsp), %r14
movq 0x28(%rsp), %rax
movq (%rax,%rbx,8), %r13
movq 0x48(%rsp), %rbp
movq %r13, %rdi
movl $0x2e, %esi
callq 0x20f0
testq %rax, %rax
je 0x2859
movq %rax, %r15
cmpq %r13, %rax
je 0x2859
leaq 0x1(%r15), %r12
movq %r12, %rdi
leaq 0x2ed7(%rip), %rsi      # 0x55b3
callq 0x2170
testl %eax, %eax
je 0x286c
movq %r12, %rdi
leaq 0x2f2b(%rip), %rsi      # 0x561e
callq 0x2170
xorl %esi, %esi
testl %eax, %eax
sete %cl
movzbl (%r12), %edi
cmpl $0x6f, %edi
je 0x2737
movb $0x1, %dl
cmpl $0x73, %edi
jne 0x273f
cmpb $0x6f, 0x2(%r15)
jne 0x273f
cmpb $0x0, 0x3(%r15)
jne 0x273f
testq %rbp, %rbp
je 0x2890
movl $0x3, %esi
cmpb $0x0, (%rbp)
jne 0x2759
jmp 0x2890
cmpb $0x0, 0x2(%r15)
setne %dl
testb %dl, %dl
je 0x274b
testl %eax, %eax
jne 0x2873
testb %dl, %dl
jne 0x2756
movl $0x2, %esi
jmp 0x2759
movb %cl, %sil
movl $0xffffffff, 0x24(%rsp) # imm = 0xFFFFFFFF
movq %r14, %rdi
movq %r13, %rdx
movq %rbp, %rcx
leaq 0x24(%rsp), %r8
callq 0x2951
testl %eax, %eax
jne 0x2848
incq %rbx
cmpl %ebx, 0x18(%rsp)
jne 0x2699
movq 0x10(%rsp), %rdi
movl 0x3c(%rsp), %edx
movl 0x40(%rsp), %esi
callq 0x2a00
testl %eax, %eax
jne 0x2848
xorl %ebx, %ebx
leaq 0x60(%rsp), %r14
movq %rbx, (%r14)
leaq 0x58(%rsp), %rdx
movq %rbx, (%rdx)
movq 0x10(%rsp), %rdi
movq %r14, %rsi
callq 0x2a47
movq (%r14), %rsi
leaq 0x28f1(%rip), %rdi      # 0x50bd
xorl %eax, %eax
callq 0x20d0
movq 0x10(%rsp), %rdi
callq 0x2a95
testl %eax, %eax
jne 0x2848
movq 0x48(%rsp), %rdi
callq 0x2040
jmp 0x2837
movq (%r14), %rsi
leaq 0x28e2(%rip), %rdi      # 0x50d9
xorl %eax, %eax
callq 0x20d0
leaq 0x2d87(%rip), %rax      # 0x558c
movq %rax, (%rsp)
leaq 0x28e9(%rip), %rdi      # 0x50f9
movl $0xa, %esi
movl $0x1, %edx
movl $0x2, %ecx
movl $0x1f, %r8d
movl $0x96, %r9d
xorl %eax, %eax
callq 0x20d0
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x10(%rsp), %rdi
callq 0x22b2
movl $0x1, %ebx
jmp 0x2837
movq 0x6798(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
leaq 0x2d25(%rip), %rsi      # 0x558f
jmp 0x2884
callq 0x22e8
jmp 0x2832
movq 0x677e(%rip), %rax      # 0x8ff8
movq (%rax), %rdi
leaq 0x2dcf(%rip), %rsi      # 0x5653
movq %r13, %rdx
xorl %eax, %eax
callq 0x2190
jmp 0x2832
callq 0x2290
jmp 0x2832
nop