// File: /workspace/github_c_makefile_star2_O0/vrancurel[P]ec/mat.c
// Function: mat_cauchy
t_mat *mat_cauchy(u_int n_rows, u_int n_cols)
{
  t_mat *mat;
  int i, j;

  mat = mat_xcalloc(n_rows, n_cols);
  for (i = 0;i < n_rows;i++) {
    for (j = 0;j < n_cols;j++) {
      MAT_ITEM(mat, i, j) = gdiv(1, (i ^ (j + n_rows)));
    }
  }

  /* do optimise */
  // convert 1st row to all 1s
  for (j = 0;j < n_cols;j++) {
    for (i = 0;i < n_rows;i++) {
      MAT_ITEM(mat, i, j) = gdiv(MAT_ITEM(mat, i, j), MAT_ITEM(mat, 0, j));
    }
  }
  // convert 1st element of each row to 1
  for (i = 1;i < n_rows;i++) {
    for (j = 0;j < n_cols;j++) {
      MAT_ITEM(mat, i, j) = gdiv(MAT_ITEM(mat, i, j), MAT_ITEM(mat, i, 0));
    }
  }

  return mat;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movl -0x4(%rbp), %edi
movl -0x8(%rbp), %esi
callq 0x2a10
movq %rax, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x4(%rbp), %eax
jae 0x2c55
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x8(%rbp), %eax
jae 0x2c48
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %eax
addl -0x4(%rbp), %eax
xorl %eax, %esi
movl $0x1, %edi
callq 0x14b0
movl %eax, %edx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rsi
imull 0x4(%rsi), %ecx
addl -0x18(%rbp), %ecx
movl %ecx, %ecx
movl %edx, (%rax,%rcx,4)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x2c03
jmp 0x2c4a
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2bf4
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x8(%rbp), %eax
jae 0x2ce3
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x4(%rbp), %eax
jae 0x2cd3
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rdx
imull 0x4(%rdx), %ecx
addl -0x18(%rbp), %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %edi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
imull $0x0, 0x4(%rcx), %ecx
addl -0x18(%rbp), %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %esi
callq 0x14b0
movl %eax, %edx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rsi
imull 0x4(%rsi), %ecx
addl -0x18(%rbp), %ecx
movl %ecx, %ecx
movl %edx, (%rax,%rcx,4)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2c6b
jmp 0x2cd5
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x2c5c
movl $0x1, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x4(%rbp), %eax
jae 0x2d78
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x8(%rbp), %eax
jae 0x2d68
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rdx
imull 0x4(%rdx), %ecx
addl -0x18(%rbp), %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %edi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rdx
imull 0x4(%rdx), %ecx
addl $0x0, %ecx
movl %ecx, %ecx
movl (%rax,%rcx,4), %esi
callq 0x14b0
movl %eax, %edx
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x14(%rbp), %ecx
movq -0x10(%rbp), %rsi
imull 0x4(%rsi), %ecx
addl -0x18(%rbp), %ecx
movl %ecx, %ecx
movl %edx, (%rax,%rcx,4)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x2cfd
jmp 0x2d6a
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2cea
movq -0x10(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)