// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x28, %rsp
movl $0x0, 0x24(%rsp)
movl %edi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movl $0x64, 0x14(%rsp)
movl $0x3e8, 0x10(%rsp)      # imm = 0x3E8
movl 0x10(%rsp), %eax
imull 0x10(%rsp), %eax
movslq %eax, %rdi
movl $0x8, %esi
callq 0x10e0
movq %rax, 0x8(%rsp)
movl $0x0, 0x4(%rsp)
movl 0x4(%rsp), %eax
movl 0x10(%rsp), %ecx
imull 0x10(%rsp), %ecx
cmpl %ecx, %eax
jge 0x23ee
callq 0x1120
cvtsi2sd %eax, %xmm0
movq 0x8(%rsp), %rax
movslq 0x4(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl 0x4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4(%rsp)
jmp 0x23b8
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %r8d
movq 0x8(%rsp), %r9
leaq 0x2c4d(%rip), %rsi      # 0x5050
movq 0x4be6(%rip), %rdx      # 0x6ff0
movl $0x15, %ecx
callq 0x1740
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %r8d
movq 0x8(%rsp), %r9
leaq 0x2c43(%rip), %rsi      # 0x506c
movq 0x4bc0(%rip), %rdx      # 0x6ff0
movl $0x16, %ecx
callq 0x1740
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %r8d
movq 0x8(%rsp), %r9
leaq 0x2c39(%rip), %rsi      # 0x5088
movq 0x4b9a(%rip), %rdx      # 0x6ff0
movl $0x15, %ecx
callq 0x1820
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %r8d
movq 0x8(%rsp), %r9
leaq 0x2c2c(%rip), %rsi      # 0x50a1
movq 0x4b74(%rip), %rdx      # 0x6ff0
movl $0x16, %ecx
callq 0x1820
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %ecx
movq 0x8(%rsp), %r8
leaq 0x2c20(%rip), %rsi      # 0x50ba
movl $0x15, %edx
callq 0x1900
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %ecx
movq 0x8(%rsp), %r8
leaq 0x2c1f(%rip), %rsi      # 0x50d7
movl $0x16, %edx
callq 0x1900
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %ecx
movq 0x8(%rsp), %r8
leaq 0x2c1e(%rip), %rsi      # 0x50f4
movl $0x15, %edx
callq 0x1a00
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %ecx
movq 0x8(%rsp), %r8
leaq 0x2c1d(%rip), %rsi      # 0x5111
movl $0x16, %edx
callq 0x1a00
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %ecx
movq 0x8(%rsp), %r8
leaq 0x2c1c(%rip), %rsi      # 0x512e
movl $0x15, %edx
callq 0x1b00
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %ecx
movq 0x8(%rsp), %r8
leaq 0x2c18(%rip), %rsi      # 0x5148
movl $0x16, %edx
callq 0x1b00
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %ecx
movq 0x8(%rsp), %r8
leaq 0x2c14(%rip), %rsi      # 0x5162
movl $0x15, %edx
callq 0x1c00
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %ecx
movq 0x8(%rsp), %r8
leaq 0x2c10(%rip), %rsi      # 0x517c
movl $0x16, %edx
callq 0x1c00
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %ecx
movq 0x8(%rsp), %r8
leaq 0x2c0c(%rip), %rsi      # 0x5196
movl $0x15, %edx
callq 0x1d00
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %ecx
movq 0x8(%rsp), %r8
leaq 0x2c05(%rip), %rsi      # 0x51ad
movl $0x16, %edx
callq 0x1d00
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %ecx
movq 0x8(%rsp), %r8
leaq 0x2bfe(%rip), %rsi      # 0x51c4
movl $0x15, %edx
callq 0x1de0
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %ecx
movq 0x8(%rsp), %r8
leaq 0x2bf4(%rip), %rsi      # 0x51d8
movl $0x16, %edx
callq 0x1de0
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %edx
leaq 0x2bef(%rip), %rsi      # 0x51ec
callq 0x1ec0
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %edx
leaq 0x2bed(%rip), %rsi      # 0x51fe
callq 0x1ec0
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %edx
movq 0x8(%rsp), %rcx
leaq 0x2be4(%rip), %rsi      # 0x520e
callq 0x2100
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %edx
movq 0x8(%rsp), %rcx
leaq 0x2bda(%rip), %rsi      # 0x521d
callq 0x2230
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %edx
movq 0x8(%rsp), %rcx
leaq 0x2bce(%rip), %rsi      # 0x522a
callq 0x1260
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %edx
movq 0x8(%rsp), %rcx
leaq 0x2bc6(%rip), %rsi      # 0x523b
callq 0x1330
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %edx
movq 0x8(%rsp), %rcx
leaq 0x2bc7(%rip), %rsi      # 0x5255
callq 0x1400
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %edx
movq 0x8(%rsp), %rcx
leaq 0x2bbc(%rip), %rsi      # 0x5263
callq 0x14d0
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %edx
movq 0x8(%rsp), %rcx
leaq 0x2bba(%rip), %rsi      # 0x527a
callq 0x15a0
movl 0x14(%rsp), %edi
movl 0x10(%rsp), %edx
movq 0x8(%rsp), %rcx
leaq 0x2baf(%rip), %rsi      # 0x5288
callq 0x1670
movq 0x8(%rsp), %rdi
callq 0x1090
xorl %eax, %eax
addq $0x28, %rsp
retq
nop