// File: /workspace/github_c_makefile_star2_O1/aligusnet[P]morpheus/benchmarks/main.c
// Function: main
int main(int argc, char **argv) {
  int n = 100;
  int size = 1000;
  double *x = calloc(size*size, sizeof(double));
  for (int i = 0; i < size*size; ++i) {
    x[i] = rand();
  }

  /* maxtrix_map */
  bench_column_pred(n, "column_pred_max - row_major", fmax, morpheus_row_major, size, x);
  bench_column_pred(n, "column_pred_max - col_major", fmax, morpheus_col_major, size, x);

  bench_row_pred(n, "row_pred_max - row_major", fmax, morpheus_row_major, size, x);
  bench_row_pred(n, "row_pred_max - col_major", fmax, morpheus_col_major, size, x);

  bench_column_max_index(n, "column_max_index - row_major", morpheus_row_major, size, x);
  bench_column_max_index(n, "column_max_index - col_major", morpheus_col_major, size, x);

  bench_column_min_index(n, "column_min_index - row_major", morpheus_row_major, size, x);
  bench_column_min_index(n, "column_min_index - col_major", morpheus_col_major, size, x);

  bench_row_max_index(n, "row_max_index - row_major", morpheus_row_major, size, x);
  bench_row_max_index(n, "row_max_index - col_major", morpheus_col_major, size, x);

  bench_row_min_index(n, "row_min_index - row_major", morpheus_row_major, size, x);
  bench_row_min_index(n, "row_min_index - col_major", morpheus_col_major, size, x);

  bench_column_sum(n, "column_sum - row_major", morpheus_row_major, size, x);
  bench_column_sum(n, "column_sum - col_major", morpheus_col_major, size, x);

  bench_row_sum(n, "row_sum - row_major", morpheus_row_major, size, x);
  bench_row_sum(n, "row_sum - col_major", morpheus_col_major, size, x);


  /* simple_blas */
  bench_morpheus_identity(n, "morpheus_identity", size);
  bench_morpheus_identity(n, "manual_identity", size);

  bench_morpheus_dcopy(n, "morpheus_dcopy", size, x);
  bench_manual_dcopy(n, "manual_dcopy", size, x);


  /* activation */
  bench_sigmoid(n, "morpheus_sigmoid", size, x);
  bench_sigmoid_gradient(n, "morpheus_sigmoid_gradient", size, x);

  bench_relu(n, "morpheus_ReLu", size, x);
  bench_relu_gradient(n, "morpheus_ReLu_gradient", size, x);

  bench_tanh(n, "morpheus_tanh", size, x);
  bench_tanh_gradient(n, "morpheus_tanh_gradient", size, x);


  free(x);
  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl $0xf4240, %edi          # imm = 0xF4240
movl $0x8, %esi
callq 0x10f0
movq %rax, %rbx
xorl %r14d, %r14d
callq 0x1130
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd %xmm0, (%rbx,%r14,8)
incq %r14
cmpq $0xf4240, %r14          # imm = 0xF4240
jne 0x227d
leaq 0x1df6(%rip), %rsi      # 0x4098
movq 0x4d47(%rip), %r14      # 0x6ff0
movl $0x64, %edi
movq %r14, %rdx
movl $0x15, %ecx
movl $0x3e8, %r8d            # imm = 0x3E8
movq %rbx, %r9
callq 0x17b0
leaq 0x1de9(%rip), %rsi      # 0x40b4
movl $0x64, %edi
movq %r14, %rdx
movl $0x16, %ecx
movl $0x3e8, %r8d            # imm = 0x3E8
movq %rbx, %r9
callq 0x17b0
leaq 0x1de3(%rip), %rsi      # 0x40d0
movl $0x64, %edi
movq %r14, %rdx
movl $0x15, %ecx
movl $0x3e8, %r8d            # imm = 0x3E8
movq %rbx, %r9
callq 0x1884
leaq 0x1dda(%rip), %rsi      # 0x40e9
movl $0x64, %edi
movq %r14, %rdx
movl $0x16, %ecx
movl $0x3e8, %r8d            # imm = 0x3E8
movq %rbx, %r9
callq 0x1884
leaq 0x1dd1(%rip), %rsi      # 0x4102
movl $0x64, %edi
movl $0x15, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rbx, %r8
callq 0x1958
leaq 0x1dd0(%rip), %rsi      # 0x411f
movl $0x64, %edi
movl $0x16, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rbx, %r8
callq 0x1958
leaq 0x1dcf(%rip), %rsi      # 0x413c
movl $0x64, %edi
movl $0x15, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rbx, %r8
callq 0x1a46
leaq 0x1dce(%rip), %rsi      # 0x4159
movl $0x64, %edi
movl $0x16, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rbx, %r8
callq 0x1a46
leaq 0x1dcd(%rip), %rsi      # 0x4176
movl $0x64, %edi
movl $0x15, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rbx, %r8
callq 0x1b34
leaq 0x1dc9(%rip), %rsi      # 0x4190
movl $0x64, %edi
movl $0x16, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rbx, %r8
callq 0x1b34
leaq 0x1dc5(%rip), %rsi      # 0x41aa
movl $0x64, %edi
movl $0x15, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rbx, %r8
callq 0x1c22
leaq 0x1dc1(%rip), %rsi      # 0x41c4
movl $0x64, %edi
movl $0x16, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rbx, %r8
callq 0x1c22
leaq 0x1dbd(%rip), %rsi      # 0x41de
movl $0x64, %edi
movl $0x15, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rbx, %r8
callq 0x1d10
leaq 0x1db6(%rip), %rsi      # 0x41f5
movl $0x64, %edi
movl $0x16, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rbx, %r8
callq 0x1d10
leaq 0x1daf(%rip), %rsi      # 0x420c
movl $0x64, %edi
movl $0x15, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rbx, %r8
callq 0x1dd4
leaq 0x1da5(%rip), %rsi      # 0x4220
movl $0x64, %edi
movl $0x16, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rbx, %r8
callq 0x1dd4
leaq 0x1d9b(%rip), %rsi      # 0x4234
movl $0x64, %edi
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x1e98
leaq 0x1d97(%rip), %rsi      # 0x4246
movl $0x64, %edi
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x1e98
leaq 0x1d91(%rip), %rsi      # 0x4256
movl $0x64, %edi
movl $0x3e8, %edx            # imm = 0x3E8
movq %rbx, %rcx
callq 0x2075
leaq 0x1d87(%rip), %rsi      # 0x4265
movl $0x64, %edi
movl $0x3e8, %edx            # imm = 0x3E8
movq %rbx, %rcx
callq 0x2151
leaq 0x1d7b(%rip), %rsi      # 0x4272
movl $0x64, %edi
movl $0x3e8, %edx            # imm = 0x3E8
movq %rbx, %rcx
callq 0x13dc
leaq 0x1d73(%rip), %rsi      # 0x4283
movl $0x64, %edi
movl $0x3e8, %edx            # imm = 0x3E8
movq %rbx, %rcx
callq 0x147f
leaq 0x1d74(%rip), %rsi      # 0x429d
movl $0x64, %edi
movl $0x3e8, %edx            # imm = 0x3E8
movq %rbx, %rcx
callq 0x1522
leaq 0x1d69(%rip), %rsi      # 0x42ab
movl $0x64, %edi
movl $0x3e8, %edx            # imm = 0x3E8
movq %rbx, %rcx
callq 0x15c5
leaq 0x1d67(%rip), %rsi      # 0x42c2
movl $0x64, %edi
movl $0x3e8, %edx            # imm = 0x3E8
movq %rbx, %rcx
callq 0x1668
leaq 0x1d5c(%rip), %rsi      # 0x42d0
movl $0x64, %edi
movl $0x3e8, %edx            # imm = 0x3E8
movq %rbx, %rcx
callq 0x170b
movq %rbx, %rdi
callq 0x10a0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq