// File: /workspace/github_c_makefile_star2_O3/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
movq 0x3b91(%rip), %rdi      # 0x50e8
movzwl 0x6(%rdi), %eax
movzwl 0xe(%rdi), %ecx
leal (%rcx,%rax), %edx
cmpl $0xf, %edx
leal -0xf(%rcx,%rax), %esi
cmovbl %edx, %esi
movq 0x3b7d(%rip), %rdx      # 0x50f0
cmpw $0x9, (%rdx,%rsi,2)
jne 0x1776
movzwl 0x1a(%rdi), %esi
movzwl 0x14(%rdi), %edi
leal (%rdi,%rsi), %r8d
cmpl $0xf, %r8d
leal -0xf(%rdi,%rsi), %r9d
cmovbl %r8d, %r9d
cmpw $0xb, (%rdx,%r9,2)
jne 0x1795
subl %edi, %esi
leal 0xf(%rsi), %edi
testl %esi, %esi
cmovnsl %esi, %edi
movslq %edi, %rsi
cmpw $0x3, (%rdx,%rsi,2)
jne 0x17b4
subl %ecx, %eax
leal 0xf(%rax), %ecx
testl %eax, %eax
cmovnsl %eax, %ecx
movslq %ecx, %rax
cmpw $0xa, (%rdx,%rax,2)
jne 0x17d3
movl $0x3, %edi
movl $0x3, %esi
callq 0x24d3
movq %rax, %rbx
movl $0x3, %edi
callq 0x2d40
movq %rax, %r14
movq 0x8(%rax), %rax
movabsq $0xd00000003, %rcx      # imm = 0xD00000003
movq %rcx, (%rax)
movl $0x9, 0x8(%rax)
movl $0x3, %edi
callq 0x2d40
movq %rax, %r15
movq %rax, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2bbe
movq 0x8(%r15), %rax
cmpl $0x7, (%rax)
jne 0x17f2
cmpl $0x2, 0x4(%rax)
jne 0x1811
cmpl $0x9, 0x8(%rax)
jne 0x1830
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 0x2bbe
movq 0x8(%r15), %rax
cmpl $0xb, (%rax)
jne 0x184f
cmpl $0x9, 0x4(%rax)
jne 0x186e
cmpl $0xc, 0x8(%rax)
jne 0x188d
movq 0x8(%rbx), %rax
movq $0x1, (%rax)
movl $0x0, 0x8(%rax)
movl 0x4(%rbx), %ecx
movl $0x1, %ebp
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 0x2938
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2bbe
movq 0x8(%r15), %rax
cmpl %ebp, 0x4(%rax)
jne 0x18ac
cmpl $0x9, 0x8(%rax)
jne 0x18cb
movq %r15, %rdi
callq 0x2d80
movq %r14, %rdi
callq 0x2d80
movq %rbx, %rdi
callq 0x2458
movl $0x3, %edi
movl $0x3, %esi
callq 0x27ba
movq %rax, %rdi
callq 0x2458
movl $0x3, %edi
movl $0x3, %esi
callq 0x253b
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x2458
leaq 0x188b(%rip), %rdi      # 0x3008
leaq 0x1894(%rip), %rsi      # 0x3018
leaq 0x1892(%rip), %rcx      # 0x301d
movl $0x86, %edx
callq 0x1090
leaq 0x188e(%rip), %rdi      # 0x302a
leaq 0x1875(%rip), %rsi      # 0x3018
leaq 0x1873(%rip), %rcx      # 0x301d
movl $0x87, %edx
callq 0x1090
leaq 0x1882(%rip), %rdi      # 0x303d
leaq 0x1856(%rip), %rsi      # 0x3018
leaq 0x1854(%rip), %rcx      # 0x301d
movl $0x88, %edx
callq 0x1090
leaq 0x1875(%rip), %rdi      # 0x304f
leaq 0x1837(%rip), %rsi      # 0x3018
leaq 0x1835(%rip), %rcx      # 0x301d
movl $0x89, %edx
callq 0x1090
leaq 0x1867(%rip), %rdi      # 0x3060
leaq 0x1818(%rip), %rsi      # 0x3018
leaq 0x1816(%rip), %rcx      # 0x301d
movl $0x92, %edx
callq 0x1090
leaq 0x1861(%rip), %rdi      # 0x3079
leaq 0x17f9(%rip), %rsi      # 0x3018
leaq 0x17f7(%rip), %rcx      # 0x301d
movl $0x93, %edx
callq 0x1090
leaq 0x185b(%rip), %rdi      # 0x3092
leaq 0x17da(%rip), %rsi      # 0x3018
leaq 0x17d8(%rip), %rcx      # 0x301d
movl $0x94, %edx
callq 0x1090
leaq 0x1855(%rip), %rdi      # 0x30ab
leaq 0x17bb(%rip), %rsi      # 0x3018
leaq 0x17b9(%rip), %rcx      # 0x301d
movl $0x99, %edx
callq 0x1090
leaq 0x1850(%rip), %rdi      # 0x30c5
leaq 0x179c(%rip), %rsi      # 0x3018
leaq 0x179a(%rip), %rcx      # 0x301d
movl $0x9a, %edx
callq 0x1090
leaq 0x184a(%rip), %rdi      # 0x30de
leaq 0x177d(%rip), %rsi      # 0x3018
leaq 0x177b(%rip), %rcx      # 0x301d
movl $0x9b, %edx
callq 0x1090
leaq 0x1845(%rip), %rdi      # 0x30f8
leaq 0x175e(%rip), %rsi      # 0x3018
leaq 0x175c(%rip), %rcx      # 0x301d
movl $0xaa, %edx
callq 0x1090
leaq 0x17c0(%rip), %rdi      # 0x3092
leaq 0x173f(%rip), %rsi      # 0x3018
leaq 0x173d(%rip), %rcx      # 0x301d
movl $0xab, %edx
callq 0x1090
nop