// File: /workspace/github_c_makefile_star2_O2/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 %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq $0x8
popq %rsi
movl $0xf4240, %edi          # imm = 0xF4240
callq 0x10e0
movq %rax, %rbx
xorl %r14d, %r14d
cmpq $0xf4240, %r14          # imm = 0xF4240
je 0x20c0
callq 0x1120
cvtsi2sd %eax, %xmm0
movsd %xmm0, (%rbx,%r14,8)
incq %r14
jmp 0x20a3
leaq 0xf99(%rip), %rsi       # 0x3060
movq 0x3f22(%rip), %r12      # 0x5ff0
pushq $0x64
popq %rbp
pushq $0x15
popq %r14
movl %ebp, %edi
movq %r12, %rdx
movl %r14d, %ecx
movl $0x3e8, %r8d            # imm = 0x3E8
movq %rbx, %r9
callq 0x1630
leaq 0xf8a(%rip), %rsi       # 0x307c
pushq $0x16
popq %r15
movl %ebp, %edi
movq %r12, %rdx
movl %r15d, %ecx
movl $0x3e8, %r8d            # imm = 0x3E8
movq %rbx, %r9
callq 0x1630
leaq 0xf85(%rip), %rsi       # 0x3098
movl %ebp, %edi
movq %r12, %rdx
movl %r14d, %ecx
movl $0x3e8, %r8d            # imm = 0x3E8
movq %rbx, %r9
callq 0x1703
leaq 0xf81(%rip), %rsi       # 0x30b1
movl %ebp, %edi
movq %r12, %rdx
movl %r15d, %ecx
movl $0x3e8, %r8d            # imm = 0x3E8
movq %rbx, %r9
callq 0x1703
leaq 0xf7d(%rip), %rsi       # 0x30ca
movl %ebp, %edi
movl %r14d, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rbx, %r8
callq 0x17d6
leaq 0xf81(%rip), %rsi       # 0x30e7
movl %ebp, %edi
movl %r15d, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rbx, %r8
callq 0x17d6
leaq 0xf85(%rip), %rsi       # 0x3104
movl %ebp, %edi
movl %r14d, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rbx, %r8
callq 0x18c1
leaq 0xf89(%rip), %rsi       # 0x3121
movl %ebp, %edi
movl %r15d, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rbx, %r8
callq 0x18c1
leaq 0xf8d(%rip), %rsi       # 0x313e
movl %ebp, %edi
movl %r14d, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rbx, %r8
callq 0x19ac
leaq 0xf8e(%rip), %rsi       # 0x3158
movl %ebp, %edi
movl %r15d, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rbx, %r8
callq 0x19ac
leaq 0xf8f(%rip), %rsi       # 0x3172
movl %ebp, %edi
movl %r14d, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rbx, %r8
callq 0x1a97
leaq 0xf90(%rip), %rsi       # 0x318c
movl %ebp, %edi
movl %r15d, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rbx, %r8
callq 0x1a97
leaq 0xf91(%rip), %rsi       # 0x31a6
movl %ebp, %edi
movl %r14d, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rbx, %r8
callq 0x1b82
leaq 0xf8f(%rip), %rsi       # 0x31bd
movl %ebp, %edi
movl %r15d, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rbx, %r8
callq 0x1b82
leaq 0xf8d(%rip), %rsi       # 0x31d4
movl %ebp, %edi
movl %r14d, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rbx, %r8
callq 0x1c45
leaq 0xf88(%rip), %rsi       # 0x31e8
movl %ebp, %edi
movl %r15d, %edx
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rbx, %r8
callq 0x1c45
leaq 0xf83(%rip), %rsi       # 0x31fc
movl %ebp, %edi
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x1d08
leaq 0xf82(%rip), %rsi       # 0x320e
movl %ebp, %edi
movl $0x3e8, %edx            # imm = 0x3E8
callq 0x1d08
leaq 0xf7f(%rip), %rsi       # 0x321e
movl %ebp, %edi
movl $0x3e8, %edx            # imm = 0x3E8
movq %rbx, %rcx
callq 0x1eb1
leaq 0xf78(%rip), %rsi       # 0x322d
movl %ebp, %edi
movl $0x3e8, %edx            # imm = 0x3E8
movq %rbx, %rcx
callq 0x1f8e
leaq 0xf6f(%rip), %rsi       # 0x323a
movl %ebp, %edi
movl $0x3e8, %edx            # imm = 0x3E8
movq %rbx, %rcx
callq 0x125c
leaq 0xf6a(%rip), %rsi       # 0x324b
movl %ebp, %edi
movl $0x3e8, %edx            # imm = 0x3E8
movq %rbx, %rcx
callq 0x12ff
leaq 0xf6e(%rip), %rsi       # 0x3265
movl %ebp, %edi
movl $0x3e8, %edx            # imm = 0x3E8
movq %rbx, %rcx
callq 0x13a2
leaq 0xf66(%rip), %rsi       # 0x3273
movl %ebp, %edi
movl $0x3e8, %edx            # imm = 0x3E8
movq %rbx, %rcx
callq 0x1445
leaq 0xf67(%rip), %rsi       # 0x328a
movl %ebp, %edi
movl $0x3e8, %edx            # imm = 0x3E8
movq %rbx, %rcx
callq 0x14e8
leaq 0xf5f(%rip), %rsi       # 0x3298
movl %ebp, %edi
movl $0x3e8, %edx            # imm = 0x3E8
movq %rbx, %rcx
callq 0x158b
movq %rbx, %rdi
callq 0x1090
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop