// File: /workspace/github_c_makefile_star2_O0/0xADE1A1DE[P]MeasureSuite/lib/src/evaluator.c
// Function: run_measurement
int run_measurement(struct measuresuite *ms) {

  // init result indicator
  size_t check_result = 0;
  if (init_cycle_results(ms)) {
    return 1;
  };

  // START MEASUREMENT
  uint64_t start_time = current_timestamp();

  DEBUG("Evaluating %lu batches\n", ms->num_batches);
  for (size_t batch_i = 0; batch_i < ms->num_batches; batch_i++) {

    if (randomize(ms) != 0 || shuffle_permutations(ms) != 0) {
      return 1;
    }

    DEBUG("Evaluating %lu functions\n", ms->num_functions);
    // for as many functions as we need to measure
    for (size_t func_i = 0; func_i < ms->num_functions; func_i++) {

      // get the function to measure
      size_t function_index = ms->permutation[func_i];
      struct function_tuple *fct = &ms->functions[function_index];

      // measure
      DEBUG("Run batch %lu for function %lu\n", batch_i, function_index);
      run_batch(ms, fct, &fct->cycle_results[batch_i]);
    }

    if (ms->enable_check) {

      for (size_t func_i = 1; func_i < ms->num_functions; func_i++) {

        // get the tuple and the previous
        struct function_tuple *fct = &ms->functions[func_i];
        struct function_tuple *prev = &ms->functions[func_i - 1];

        // check
        DEBUG("Checking correctness for function %lu and previous\n", func_i);
        if (check(ms->arg_width * ms->num_arg_out, fct->arithmetic_results,
                  prev->arithmetic_results)) {
          check_result = func_i;
          break;
        };
      }
    }
  }

  unsigned long elapsed_in_sec = current_timestamp() - start_time;

  if (generate_json(ms, elapsed_in_sec, check_result)) {
    return 1;
  }

  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x3b20
cmpl $0x0, %eax
je 0x41ce
movl $0x1, -0x4(%rbp)
jmp 0x4378
movb $0x0, %al
callq 0x3ca0
movq %rax, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x28(%rcx), %rax
jae 0x4343
movq -0x10(%rbp), %rdi
callq 0x3100
cmpl $0x0, %eax
jne 0x420f
movq -0x10(%rbp), %rdi
callq 0x62e0
cmpl $0x0, %eax
je 0x421b
movl $0x1, -0x4(%rbp)
jmp 0x4378
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x80(%rcx), %rax
jae 0x428a
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq -0x30(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
imulq $0x28, -0x38(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x40(%rbp), %rax
movq 0x20(%rax), %rdx
movq -0x28(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdx
callq 0x4390
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x4223
movq -0x10(%rbp), %rax
movb 0x68(%rax), %al
shlb $0x7, %al
sarb $0x7, %al
cmpb $0x0, %al
je 0x4330
movq $0x1, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x80(%rcx), %rax
jae 0x432e
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
imulq $0x28, -0x48(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movq -0x48(%rbp), %rcx
subq $0x1, %rcx
imulq $0x28, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
imulq 0x10(%rax), %rdi
movq -0x50(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x58(%rbp), %rax
movq 0x18(%rax), %rdx
callq 0x4d00
cmpl $0x0, %eax
je 0x431b
movq -0x48(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x432e
jmp 0x431d
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x42a7
jmp 0x4330
jmp 0x4332
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x41e1
movb $0x0, %al
callq 0x3ca0
subq -0x20(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rdi
movq -0x60(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x5e40
cmpl $0x0, %eax
je 0x4371
movl $0x1, -0x4(%rbp)
jmp 0x4378
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)