// File: /workspace/github_c_makefile_star2_O1/mjosaarinen[P]brutus/crypto_aead/stribob192r2/8bit/wbob_pi8.c
// Function: wbob_pi
void wbob_pi(w512_t *s512)
{
    int r, i, j;
    uint8_t t[64], x, *pt;

    for (r = 0; r < 12; r++) {                      // 12 rounds

        for (i = 0; i < 64; i++) {
            t[(i & 7) + ((i + (i << 3)) & 070)] =   // P
                wbob_sbox[s512->b[i]];              // S
        }

        // The round constants C comes from the S-box
        pt = (uint8_t *) &wbob_sbox[8 * r];
        for (i = 0; i < 8; i++)
            s512->b[i] = pt[i];                     // C in first 8
        for (i = 8; i < 64; i++)
            s512->b[i] = 0;                         // zero the rest

        // Apply the circular, low weight MDS matrix
        for (i = 0; i < 64; i += 8) {
            pt = &s512->b[i];                       // start of row
            for (j = 0; j < 8; j++) {
                x = t[i + j];                       // Circular MDS
                pt[j & 7] ^= x;                     // 01
                pt[(j + 1) & 7] ^= x;               // 01
                pt[(j + 3) & 7] ^= x;               // 01
                pt[(j + 5) & 7] ^= x;
                pt[(j + 7) & 7] ^= x;

                // x <- 02
                x = (x << 1) ^ (x & 0x80 ? 0x1D : 0x00);
                pt[(j + 6) & 7] ^= x;               // 02

                // x <- 04
                x = (x << 1) ^ (x & 0x80 ? 0x1D : 0x00);
                pt[(j + 2) & 7] ^= x;               // 04
                pt[(j + 5) & 7] ^= x;               // 01 + 04 = 05

                // x <- 08
                x = (x << 1) ^ (x & 0x80 ? 0x1D : 0x00);
                pt[(j + 4) & 7] ^= x;               // 08
                pt[(j + 7) & 7] ^= x;               // 01 + 08 = 09
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
leaq 0x8(%rdi), %rax
vpmovsxbq 0xa89(%rip), %ymm0 # 0x2098
vpmovsxbq 0xa84(%rip), %ymm1 # 0x209c
vpmovsxbq 0xa7f(%rip), %ymm2 # 0x20a0
xorl %ecx, %ecx
vpmovsxbq 0xa78(%rip), %ymm3 # 0x20a4
leaq 0xa7d(%rip), %rdx       # 0x20b0
vpbroadcastq 0xa44(%rip), %ymm4 # 0x2080
vpbroadcastq 0xa43(%rip), %ymm5 # 0x2088
vpbroadcastq 0xa42(%rip), %ymm6 # 0x2090
vxorps %xmm7, %xmm7, %xmm7
leaq (,%rcx,8), %r8
xorl %r9d, %r9d
vmovdqa %ymm3, %ymm8
vmovdqa %ymm2, %ymm9
vmovdqa %ymm1, %ymm10
vmovdqa %ymm0, %ymm11
vpmovzxbq 0xc(%rdi,%r9), %ymm12
vpmovzxbq 0x8(%rdi,%r9), %ymm13
vpmovzxbq 0x4(%rdi,%r9), %ymm14
vpmovzxbq (%rdi,%r9), %ymm15
vpextrq $0x1, %xmm15, %r10
vmovq %xmm15, %r11
vextracti128 $0x1, %ymm15, %xmm15
movb (%r11,%rdx), %r11b
movb (%r10,%rdx), %r10b
vpsllq $0x3, %ymm8, %ymm16
vpaddq %ymm8, %ymm16, %ymm16
vpandq %ymm5, %ymm16, %ymm16
vpternlogq $0xf8, %ymm4, %ymm8, %ymm16
vmovq %xmm16, %rbx
movb %r11b, -0x48(%rsp,%rbx)
vpextrq $0x1, %xmm16, %r11
vmovq %xmm15, %rbx
movb %r10b, -0x48(%rsp,%r11)
vpextrq $0x1, %xmm15, %r10
movb (%rbx,%rdx), %r11b
vextracti32x4 $0x1, %ymm16, %xmm15
vmovq %xmm15, %rbx
movb %r11b, -0x48(%rsp,%rbx)
vmovq %xmm14, %r11
movb (%r10,%rdx), %r10b
vpextrq $0x1, %xmm15, %rbx
movb (%r11,%rdx), %r11b
vpsllq $0x3, %ymm9, %ymm15
vpaddq %ymm9, %ymm15, %ymm15
vpand %ymm5, %ymm15, %ymm15
vpternlogq $0xf8, %ymm4, %ymm9, %ymm15
movb %r10b, -0x48(%rsp,%rbx)
vmovq %xmm15, %r10
movb %r11b, -0x48(%rsp,%r10)
vpextrq $0x1, %xmm14, %r10
vextracti128 $0x1, %ymm14, %xmm14
vmovq %xmm14, %r11
movb (%r10,%rdx), %r10b
movb (%r11,%rdx), %r11b
vpextrq $0x1, %xmm15, %rbx
vextracti128 $0x1, %ymm15, %xmm15
movb %r10b, -0x48(%rsp,%rbx)
vmovq %xmm15, %r10
movb %r11b, -0x48(%rsp,%r10)
vpextrq $0x1, %xmm14, %r10
vpextrq $0x1, %xmm15, %r11
movb (%r10,%rdx), %r10b
movb %r10b, -0x48(%rsp,%r11)
vmovq %xmm13, %r10
movb (%r10,%rdx), %r10b
vpsllq $0x3, %ymm10, %ymm14
vpaddq %ymm10, %ymm14, %ymm14
vpand %ymm5, %ymm14, %ymm14
vpternlogq $0xf8, %ymm4, %ymm10, %ymm14
vmovq %xmm14, %r11
movb %r10b, -0x48(%rsp,%r11)
vpextrq $0x1, %xmm13, %r10
vextracti128 $0x1, %ymm13, %xmm13
movb (%r10,%rdx), %r10b
vpextrq $0x1, %xmm14, %r11
movb %r10b, -0x48(%rsp,%r11)
vmovq %xmm13, %r10
movb (%r10,%rdx), %r10b
vextracti128 $0x1, %ymm14, %xmm14
vmovq %xmm14, %r11
movb %r10b, -0x48(%rsp,%r11)
vpextrq $0x1, %xmm13, %r10
movb (%r10,%rdx), %r10b
vpextrq $0x1, %xmm14, %r11
movb %r10b, -0x48(%rsp,%r11)
vmovq %xmm12, %r10
movb (%r10,%rdx), %r10b
vpsllq $0x3, %ymm11, %ymm13
vpaddq %ymm11, %ymm13, %ymm13
vpand %ymm5, %ymm13, %ymm13
vpternlogq $0xf8, %ymm4, %ymm11, %ymm13
vmovq %xmm13, %r11
movb %r10b, -0x48(%rsp,%r11)
vpextrq $0x1, %xmm12, %r10
vextracti128 $0x1, %ymm12, %xmm12
movb (%r10,%rdx), %r10b
vpextrq $0x1, %xmm13, %r11
movb %r10b, -0x48(%rsp,%r11)
vmovq %xmm12, %r10
movb (%r10,%rdx), %r10b
vextracti128 $0x1, %ymm13, %xmm13
vmovq %xmm13, %r11
movb %r10b, -0x48(%rsp,%r11)
vpextrq $0x1, %xmm12, %r10
movb (%r10,%rdx), %r10b
vpextrq $0x1, %xmm13, %r11
movb %r10b, -0x48(%rsp,%r11)
addq $0x10, %r9
vpaddq %ymm6, %ymm8, %ymm8
vpaddq %ymm6, %ymm9, %ymm9
vpaddq %ymm6, %ymm10, %ymm10
vpaddq %ymm6, %ymm11, %ymm11
cmpq $0x40, %r9
jne 0x166d
movq (%r8,%rdx), %r8
movq %r8, (%rdi)
vmovups %ymm7, 0x18(%rax)
vmovups %ymm7, (%rax)
movq %rdi, %r8
leaq -0x48(%rsp), %r9
xorl %r10d, %r10d
leaq (%rdi,%r10), %r11
xorl %ebx, %ebx
movb (%r9,%rbx), %r15b
xorb %r15b, (%r8,%rbx)
leaq 0x1(%rbx), %r14
movl %r14d, %r12d
andl $0x7, %r12d
xorb %r15b, (%r11,%r12)
leal 0x3(%rbx), %r12d
andl $0x7, %r12d
xorb %r15b, (%r11,%r12)
leal 0x5(%rbx), %r13d
andl $0x7, %r13d
xorb %r15b, (%r11,%r13)
leal -0x1(%rbx), %r12d
andl $0x7, %r12d
xorb %r15b, (%r11,%r12)
leal (%r15,%r15), %ebp
sarb $0x7, %r15b
andb $0x1d, %r15b
xorb %bpl, %r15b
leal 0x6(%rbx), %esi
andl $0x7, %esi
xorb %r15b, (%r11,%rsi)
addb %r15b, %r15b
sarb $0x7, %bpl
andb $0x1d, %bpl
xorb %r15b, %bpl
leal 0x2(%rbx), %esi
andl $0x7, %esi
xorb %bpl, (%r11,%rsi)
xorb %bpl, (%r11,%r13)
addb %bpl, %bpl
sarb $0x7, %r15b
andb $0x1d, %r15b
xorb %bpl, %r15b
xorq $0x4, %rbx
xorb %r15b, (%r11,%rbx)
xorb %r15b, (%r11,%r12)
movq %r14, %rbx
cmpq $0x8, %r14
jne 0x1896
leaq 0x8(%r10), %rsi
addq $0x8, %r9
addq $0x8, %r8
cmpq $0x38, %r10
movq %rsi, %r10
jb 0x1890
incq %rcx
cmpq $0xc, %rcx
jne 0x1652
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
vzeroupper
retq
nopl (%rax)