// File: /workspace/github_c_makefile_star2_O0/tomcatzh[P]RealityBenchmark/benchmark.c
// Function: resultToJSON
static cJSON* resultToJSON(const RESULT *results) {
  cJSON *resultsJSON = cJSON_CreateObject();
  assert(resultsJSON);

  cJSON_AddBoolToObject(resultsJSON, "allSuccess", isResultSuccess(results));
  cJSON_AddBoolToObject(resultsJSON, "allCorrect", isResultCorrect(results));
  cJSON_AddBoolToObject(resultsJSON, "allFixed", isResultFixed(results));
  cJSON_AddNumberToObject(resultsJSON, "threads", resultThreads(results));
  cJSON_AddNumberToObject(resultsJSON, "totalLoops", resultTotalLoops(results));
  cJSON_AddNumberToObject(resultsJSON, "avgLoops", resultAvgLoop(results));
  cJSON_AddNumberToObject(resultsJSON, "stdevLoops", resultStdevLoop(results));
  cJSON_AddNumberToObject(resultsJSON, "time", resultRealTime(results, NULL));
  cJSON_AddNumberToObject(resultsJSON, "avgInterval", resultAvgInterval(results));
  cJSON_AddNumberToObject(resultsJSON, "stdevInterval", resultStdevInterval(results));

  cJSON *runsJSON = cJSON_CreateArray();
  assert(runsJSON);

  unsigned int id = 0;
  for (RUN *r = results->loops->runs; r; r = r->next) {
    cJSON *run = cJSON_CreateObject();

    cJSON_AddNumberToObject(run, "input", resultSampleInputByRun(results, id));
    cJSON_AddNumberToObject(run, "output", resultSampleOutputByRun(results, id));
    cJSON_AddNumberToObject(run, "totalInput", resultTotalInputByRun(results, id));
    cJSON_AddNumberToObject(run, "totalOutput", resultTotalOutputByRun(results, id));
    cJSON_AddNumberToObject(run, "avgInterval", resultAvgIntervalByRun(results, id));
    cJSON_AddNumberToObject(run, "stdevInterval", resultStdevIntervalByRun(results, id));
    cJSON_AddItemToObject(runsJSON, "runs", run);

    id ++;
  }
  cJSON_AddItemToObject(resultsJSON, "runs", runsJSON);

  return resultsJSON;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
callq 0x81a0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x5091
jmp 0x50b0
leaq 0x767e(%rip), %rdi      # 0xc716
leaq 0x7589(%rip), %rsi      # 0xc628
movl $0x1a7, %edx            # imm = 0x1A7
leaq 0x772f(%rip), %rcx      # 0xc7da
callq 0x21a0
movq -0x10(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x57a0
movq -0xa8(%rbp), %rdi
movl %eax, %edx
leaq 0x772a(%rip), %rsi      # 0xc7fe
callq 0x7d90
movq -0x10(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x8(%rbp), %rdi
callq 0x5800
movq -0xa0(%rbp), %rdi
movl %eax, %edx
leaq 0x770c(%rip), %rsi      # 0xc809
callq 0x7d90
movq -0x10(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x8(%rbp), %rdi
callq 0x5860
movq -0x98(%rbp), %rdi
movl %eax, %edx
leaq 0x76ee(%rip), %rsi      # 0xc814
callq 0x7d90
movq -0x10(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x8(%rbp), %rdi
callq 0x58c0
movq -0x90(%rbp), %rdi
movl %eax, %eax
cvtsi2sd %rax, %xmm0
leaq 0x754b(%rip), %rsi      # 0xc69f
callq 0x7e50
movq -0x10(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x8(%rbp), %rdi
callq 0x5900
movq -0x88(%rbp), %rdi
movq %rax, %xmm0
movaps 0x7480(%rip), %xmm1     # 0xc600
movaps %xmm1, -0x70(%rbp)
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x7480(%rip), %xmm1     # 0xc610
movaps %xmm1, -0x60(%rbp)
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
leaq 0x7673(%rip), %rsi      # 0xc81d
callq 0x7e50
movq -0x10(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x8(%rbp), %rdi
callq 0x5950
movq -0x80(%rbp), %rdi
movaps -0x70(%rbp), %xmm2
movaps -0x60(%rbp), %xmm1
movq %rax, %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
leaq 0x763d(%rip), %rsi      # 0xc828
callq 0x7e50
movq -0x10(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x8(%rbp), %rdi
callq 0x5990
movq -0x78(%rbp), %rdi
leaq 0x7625(%rip), %rsi      # 0xc831
callq 0x7e50
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x5a50
movaps -0x70(%rbp), %xmm2
movaps -0x60(%rbp), %xmm1
movq -0x48(%rbp), %rdi
movq %rax, %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
leaq 0x7577(%rip), %rsi      # 0xc7c8
callq 0x7e50
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
callq 0x5a80
movq -0x40(%rbp), %rdi
leaq 0x75ca(%rip), %rsi      # 0xc83c
callq 0x7e50
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x8(%rbp), %rdi
callq 0x5aa0
movq -0x38(%rbp), %rdi
leaq 0x75b5(%rip), %rsi      # 0xc848
callq 0x7e50
callq 0x8240
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x52aa
jmp 0x52c9
leaq 0x74e0(%rip), %rdi      # 0xc791
leaq 0x7370(%rip), %rsi      # 0xc628
movl $0x1b5, %edx            # imm = 0x1B5
leaq 0x7516(%rip), %rcx      # 0xc7da
callq 0x21a0
movl $0x0, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x54c3
callq 0x81a0
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x5ac0
movq -0xf8(%rbp), %rdi
movq %rax, %xmm0
movaps 0x72e4(%rip), %xmm1     # 0xc600
movaps %xmm1, -0xe0(%rbp)
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
movapd 0x72e1(%rip), %xmm1     # 0xc610
movaps %xmm1, -0xd0(%rbp)
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
leaq 0x7481(%rip), %rsi      # 0xc7cd
callq 0x7e50
movq -0x30(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x5b30
movq -0xf0(%rbp), %rdi
movaps -0xe0(%rbp), %xmm2
movaps -0xd0(%rbp), %xmm1
movq %rax, %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
leaq 0x7437(%rip), %rsi      # 0xc7d3
callq 0x7e50
movq -0x30(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x5ba0
movq -0xe8(%rbp), %rdi
movaps -0xe0(%rbp), %xmm2
movaps -0xd0(%rbp), %xmm1
movq %rax, %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
leaq 0x746a(%rip), %rsi      # 0xc856
callq 0x7e50
movq -0x30(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x5c00
movaps -0xe0(%rbp), %xmm2
movaps -0xd0(%rbp), %xmm1
movq -0xc0(%rbp), %rdi
movq %rax, %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
subpd %xmm1, %xmm0
movaps %xmm0, %xmm1
unpckhpd %xmm0, %xmm0            # xmm0 = xmm0[1,1]
addsd %xmm1, %xmm0
leaq 0x7425(%rip), %rsi      # 0xc861
callq 0x7e50
movq -0x30(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x5c60
movq -0xb8(%rbp), %rdi
leaq 0x73d6(%rip), %rsi      # 0xc83c
callq 0x7e50
movq -0x30(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x5d20
movq -0xb0(%rbp), %rdi
leaq 0x73b8(%rip), %rsi      # 0xc848
callq 0x7e50
movq -0x18(%rbp), %rdi
movq -0x30(%rbp), %rdx
leaq 0x72e8(%rip), %rsi      # 0xc78c
callq 0x78d0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
movq -0x28(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x52de
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rdx
leaq 0x72ba(%rip), %rsi      # 0xc78c
callq 0x78d0
movq -0x10(%rbp), %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopw %cs:(%rax,%rax)