// File: /workspace/github_c_makefile_star2_O2/vrancurel[P]ec/gf.c
// Function: utest
void utest()
{
#if W == 4
  assert(gmul(3, 7) == 9);
  assert(gmul(13, 10) == 11);  
  assert(gdiv(13, 10) == 3);
  assert(gdiv(3, 7) == 10);
  /* non-MDS vandermonde matrix */
  t_mat *mat = mat_vandermonde(3, 3);
  t_vec *vec = vec_xcalloc(3);
  VEC_ITEM(vec, 0) = 3;
  VEC_ITEM(vec, 1) = 13;
  VEC_ITEM(vec, 2) = 9;
  t_vec *output = vec_xcalloc(3);
  mat_mult(output, mat, vec);
  assert(VEC_ITEM(output, 0) == 7);
  assert(VEC_ITEM(output, 1) == 2);
  assert(VEC_ITEM(output, 2) == 9);
  VEC_ITEM(vec, 0) = 3;
  VEC_ITEM(vec, 1) = 1;
  VEC_ITEM(vec, 2) = 9;
  mat_mult(output, mat, vec);
  assert(VEC_ITEM(output, 0) == 11);
  assert(VEC_ITEM(output, 1) == 9);
  assert(VEC_ITEM(output, 2) == 12);
  MAT_ITEM(mat, 0, 0) = 1;
  MAT_ITEM(mat, 0, 1) = 0;
  MAT_ITEM(mat, 0, 2) = 0;
  MAT_ITEM(mat, 1, 0) = 1;
  MAT_ITEM(mat, 1, 1) = 1;
  MAT_ITEM(mat, 1, 2) = 1;
  MAT_ITEM(mat, 2, 0) = 1;
  MAT_ITEM(mat, 2, 1) = 2;
  MAT_ITEM(mat, 2, 2) = 3;
  VEC_ITEM(vec, 0) = 3;
  VEC_ITEM(vec, 1) = 11;
  VEC_ITEM(vec, 2) = 9;
  mat_inv(mat);
  mat_mult(output, mat, vec);
  assert(VEC_ITEM(output, 1) == 1);
  assert(VEC_ITEM(output, 2) == 9);
  vec_free(output);
  vec_free(vec);
  mat_free(mat);
  mat = mat_vandermonde_correct(3, 3);
  mat_free(mat);
  mat = mat_cauchy(3, 3);
  mat_free(mat);
#elif W == 8
  assert(gmul(3, 7) == 9);
  assert(gmul(13, 10) == 114);
  assert(gdiv(13, 10) == 40);
  assert(gdiv(3, 7) == 211);
#else
  //TBD
#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
pushq $0x3
popq %rdi
pushq $0x7
popq %rsi
callq 0x1364
cmpl $0x9, %eax
jne 0x15f9
pushq $0xd
popq %rdi
pushq $0xa
popq %rsi
callq 0x1364
cmpl $0xb, %eax
jne 0x1618
pushq $0xd
popq %rdi
pushq $0xa
popq %rsi
callq 0x13a2
cmpl $0x3, %eax
jne 0x1637
pushq $0x3
popq %rdi
pushq $0x7
popq %rsi
callq 0x13a2
cmpl $0xa, %eax
jne 0x1656
pushq $0x3
popq %rbp
movl %ebp, %edi
movl %ebp, %esi
callq 0x22f4
movq %rax, %rbx
movl %ebp, %edi
callq 0x2ac0
movq %rax, %r14
movq 0x8(%rax), %rax
movabsq $0xd00000003, %rcx      # imm = 0xD00000003
movq %rcx, (%rax)
movl $0x9, 0x8(%rax)
movl %ebp, %edi
callq 0x2ac0
movq %rax, %r15
movq %rax, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x294a
movq 0x8(%r15), %rax
cmpl $0x7, (%rax)
jne 0x1675
cmpl $0x2, 0x4(%rax)
jne 0x1694
cmpl $0x9, 0x8(%rax)
jne 0x16b3
movq 0x8(%r14), %rax
movabsq $0x100000003, %rcx      # imm = 0x100000003
movq %rcx, (%rax)
movl $0x9, 0x8(%rax)
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x294a
movq 0x8(%r15), %rax
cmpl $0xb, (%rax)
jne 0x16d2
cmpl $0x9, 0x4(%rax)
jne 0x16f1
cmpl $0xc, 0x8(%rax)
jne 0x1710
movq 0x8(%rbx), %rax
movq $0x1, (%rax)
andl $0x0, 0x8(%rax)
movl 0x4(%rbx), %ecx
pushq $0x1
popq %rbp
movl %ebp, (%rax,%rcx,4)
movl 0x4(%rbx), %ecx
incl %ecx
movl %ebp, (%rax,%rcx,4)
movl 0x4(%rbx), %ecx
addl $0x2, %ecx
movl %ebp, (%rax,%rcx,4)
movl 0x4(%rbx), %ecx
addl %ecx, %ecx
movl %ebp, (%rax,%rcx,4)
movl 0x4(%rbx), %ecx
addl %ecx, %ecx
movl $0x2, 0x4(%rax,%rcx,4)
movl 0x4(%rbx), %ecx
leal 0x2(,%rcx,2), %ecx
movl $0x3, (%rax,%rcx,4)
movq 0x8(%r14), %rax
movabsq $0xb00000003, %rcx      # imm = 0xB00000003
movq %rcx, (%rax)
movl $0x9, 0x8(%rax)
movq %rbx, %rdi
callq 0x26dc
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x294a
movq 0x8(%r15), %rax
cmpl %ebp, 0x4(%rax)
jne 0x172f
cmpl $0x9, 0x8(%rax)
jne 0x174e
movq %r15, %rdi
callq 0x2afe
movq %r14, %rdi
callq 0x2afe
movq %rbx, %rdi
callq 0x227e
pushq $0x3
popq %rbx
movl %ebx, %edi
movl %ebx, %esi
callq 0x25b4
movq %rax, %rdi
callq 0x227e
movl %ebx, %edi
movl %ebx, %esi
callq 0x2358
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x227e
leaq 0x1a08(%rip), %rdi      # 0x3008
leaq 0x1a11(%rip), %rsi      # 0x3018
leaq 0x1a0f(%rip), %rcx      # 0x301d
movl $0x86, %edx
callq 0x1090
leaq 0x1a0b(%rip), %rdi      # 0x302a
leaq 0x19f2(%rip), %rsi      # 0x3018
leaq 0x19f0(%rip), %rcx      # 0x301d
movl $0x87, %edx
callq 0x1090
leaq 0x19ff(%rip), %rdi      # 0x303d
leaq 0x19d3(%rip), %rsi      # 0x3018
leaq 0x19d1(%rip), %rcx      # 0x301d
movl $0x88, %edx
callq 0x1090
leaq 0x19f2(%rip), %rdi      # 0x304f
leaq 0x19b4(%rip), %rsi      # 0x3018
leaq 0x19b2(%rip), %rcx      # 0x301d
movl $0x89, %edx
callq 0x1090
leaq 0x19e4(%rip), %rdi      # 0x3060
leaq 0x1995(%rip), %rsi      # 0x3018
leaq 0x1993(%rip), %rcx      # 0x301d
movl $0x92, %edx
callq 0x1090
leaq 0x19de(%rip), %rdi      # 0x3079
leaq 0x1976(%rip), %rsi      # 0x3018
leaq 0x1974(%rip), %rcx      # 0x301d
movl $0x93, %edx
callq 0x1090
leaq 0x19d8(%rip), %rdi      # 0x3092
leaq 0x1957(%rip), %rsi      # 0x3018
leaq 0x1955(%rip), %rcx      # 0x301d
movl $0x94, %edx
callq 0x1090
leaq 0x19d2(%rip), %rdi      # 0x30ab
leaq 0x1938(%rip), %rsi      # 0x3018
leaq 0x1936(%rip), %rcx      # 0x301d
movl $0x99, %edx
callq 0x1090
leaq 0x19cd(%rip), %rdi      # 0x30c5
leaq 0x1919(%rip), %rsi      # 0x3018
leaq 0x1917(%rip), %rcx      # 0x301d
movl $0x9a, %edx
callq 0x1090
leaq 0x19c7(%rip), %rdi      # 0x30de
leaq 0x18fa(%rip), %rsi      # 0x3018
leaq 0x18f8(%rip), %rcx      # 0x301d
movl $0x9b, %edx
callq 0x1090
leaq 0x19c2(%rip), %rdi      # 0x30f8
leaq 0x18db(%rip), %rsi      # 0x3018
leaq 0x18d9(%rip), %rcx      # 0x301d
movl $0xaa, %edx
callq 0x1090
leaq 0x193d(%rip), %rdi      # 0x3092
leaq 0x18bc(%rip), %rsi      # 0x3018
leaq 0x18ba(%rip), %rcx      # 0x301d
movl $0xab, %edx
callq 0x1090
nopl (%rax)