// File: /workspace/github_c_makefile_star2_O1/mjosaarinen[P]brutus/crypto_aead/aes128poetv1aes4/ref/gf_mul.h
// Function: gf_mul
void gf_mul(unsigned char *a, const unsigned char *x,
	    const unsigned char *y)
{
  int i;
  int j;
  unsigned int xlen = 16;
  unsigned char abits[128];
  unsigned char ybits[128];
  unsigned char prodbits[256];
  memcpy(a,x,xlen);
  for (i = 0;i < 128;++i) abits[i] = (a[i / 8] >> (7 - (i % 8))) & 1;
  for (i = 0;i < 128;++i) ybits[i] = (y[i / 8] >> (7 - (i % 8))) & 1;
  for (i = 0;i < 256;++i) prodbits[i] = 0;
  for (i = 0;i < 128;++i)
    for (j = 0;j < 128;++j)
      prodbits[i + j] ^= abits[i] & ybits[j];
  for (i = 127;i >= 0;--i) {
    prodbits[i] ^= prodbits[i + 128];
    prodbits[i + 1] ^= prodbits[i + 128];
    prodbits[i + 2] ^= prodbits[i + 128];
    prodbits[i + 7] ^= prodbits[i + 128];
    prodbits[i + 128] ^= prodbits[i + 128];
  }
  for (i = 0;i < 16;++i) a[i] = 0;
  for (i = 0;i < 128;++i) a[i / 8] |= (prodbits[i] << (7 - (i % 8)));
}

// Assembly:
subq $0x188, %rsp            # imm = 0x188
vmovups (%rsi), %xmm0
vmovups %xmm0, (%rdi)
vmovq 0x37d5(%rip), %xmm3     # 0x7130
xorl %eax, %eax
vpbroadcastb 0x37da(%rip), %xmm0 # 0x7140
vpbroadcastb 0x37d2(%rip), %xmm1 # 0x7141
vpbroadcastb 0x37ca(%rip), %xmm2 # 0x7142
movq %rdi, %rcx
vpbroadcastb (%rcx), %xmm4
vpandn %xmm0, %xmm3, %xmm5
vpmovzxbw %xmm5, %ymm5    # ymm5 = xmm5[0],zero,xmm5[1],zero,xmm5[2],zero,xmm5[3],zero,xmm5[4],zero,xmm5[5],zero,xmm5[6],zero,xmm5[7],zero,xmm5[8],zero,xmm5[9],zero,xmm5[10],zero,xmm5[11],zero,xmm5[12],zero,xmm5[13],zero,xmm5[14],zero,xmm5[15],zero
vpmovzxbw %xmm4, %ymm4    # ymm4 = xmm4[0],zero,xmm4[1],zero,xmm4[2],zero,xmm4[3],zero,xmm4[4],zero,xmm4[5],zero,xmm4[6],zero,xmm4[7],zero,xmm4[8],zero,xmm4[9],zero,xmm4[10],zero,xmm4[11],zero,xmm4[12],zero,xmm4[13],zero,xmm4[14],zero,xmm4[15],zero
vpsrlvw %ymm5, %ymm4, %ymm4
vpmovwb %ymm4, %xmm4
vpand %xmm1, %xmm4, %xmm4
vmovq %xmm4, 0x100(%rsp,%rax)
addq $0x8, %rax
vpaddb %xmm2, %xmm3, %xmm3
incq %rcx
cmpq $0x80, %rax
jne 0x397b
vmovq 0x376e(%rip), %xmm3     # 0x7130
xorl %eax, %eax
vpbroadcastb (%rdx), %xmm4
vpandn %xmm0, %xmm3, %xmm5
vpmovzxbw %xmm5, %ymm5    # ymm5 = xmm5[0],zero,xmm5[1],zero,xmm5[2],zero,xmm5[3],zero,xmm5[4],zero,xmm5[5],zero,xmm5[6],zero,xmm5[7],zero,xmm5[8],zero,xmm5[9],zero,xmm5[10],zero,xmm5[11],zero,xmm5[12],zero,xmm5[13],zero,xmm5[14],zero,xmm5[15],zero
vpmovzxbw %xmm4, %ymm4    # ymm4 = xmm4[0],zero,xmm4[1],zero,xmm4[2],zero,xmm4[3],zero,xmm4[4],zero,xmm4[5],zero,xmm4[6],zero,xmm4[7],zero,xmm4[8],zero,xmm4[9],zero,xmm4[10],zero,xmm4[11],zero,xmm4[12],zero,xmm4[13],zero,xmm4[14],zero,xmm4[15],zero
vpsrlvw %ymm5, %ymm4, %ymm4
vpmovwb %ymm4, %xmm4
vpand %xmm1, %xmm4, %xmm4
vmovq %xmm4, 0x80(%rsp,%rax)
addq $0x8, %rax
vpaddb %xmm2, %xmm3, %xmm3
incq %rdx
cmpq $0x80, %rax
jne 0x39c4
vpxor %xmm0, %xmm0, %xmm0
leaq -0x80(%rsp), %rax
vmovdqu %ymm0, 0xe0(%rax)
vmovdqu %ymm0, 0xc0(%rax)
vmovdqu %ymm0, 0xa0(%rax)
vmovdqu %ymm0, 0x80(%rax)
vmovdqu %ymm0, 0x60(%rax)
vmovdqu %ymm0, 0x40(%rax)
vmovdqu %ymm0, 0x20(%rax)
vmovdqu %ymm0, (%rax)
xorl %ecx, %ecx
vpbroadcastb 0x100(%rsp,%rcx), %ymm0
xorl %edx, %edx
vmovdqu 0x80(%rsp,%rdx), %ymm1
vpternlogq $0x6a, (%rax,%rdx), %ymm0, %ymm1
vmovdqu %ymm1, (%rax,%rdx)
addq $0x20, %rdx
cmpq $0x80, %rdx
jne 0x3a4d
incq %rcx
incq %rax
cmpq $0x80, %rcx
jne 0x3a41
movl $0x7f, %eax
movb (%rsp), %cl
movb (%rsp,%rax), %dl
movb -0x80(%rsp,%rax), %sil
xorb %dl, %sil
movb %sil, -0x80(%rsp,%rax)
xorb %dl, %cl
movb %cl, -0x7f(%rsp,%rax)
xorb %dl, -0x7e(%rsp,%rax)
xorb %dl, -0x79(%rsp,%rax)
movb $0x0, (%rsp,%rax)
movl %esi, %ecx
addq $-0x1, %rax
jb 0x3a87
vpxor %xmm0, %xmm0, %xmm0
vmovdqu %xmm0, (%rdi)
xorl %eax, %eax
movb -0x80(%rsp,%rax), %dl
movl %eax, %ecx
notb %cl
andb $0x7, %cl
shlb %cl, %dl
movl %eax, %ecx
shrl $0x3, %ecx
orb %dl, (%rdi,%rcx)
incq %rax
cmpq $0x80, %rax
jne 0x3abb
addq $0x188, %rsp            # imm = 0x188
vzeroupper
retq