// File: /workspace/github_c_makefile_star2_O1/mjosaarinen[P]brutus/crypto_aead/deoxyseq256128v13/ref/tweakableBC.c
// Function: deoxysKeySetupDec256
int deoxysKeySetupDec256(uint32_t* rtweakey, 
                         const uint8_t* TweakKey,
                         int no_tweakeys)
{

    int i;
    int j;
    int Nr;
    uint32_t temp;

    /* Produce the round tweakeys used for the encryption */
    Nr=deoxysKeySetupEnc256 (rtweakey, TweakKey, no_tweakeys);

    /* invert their order */
    for (i = 0, j = 4*Nr; i < j; i += 4, j -= 4) {
        temp = rtweakey[i    ]; rtweakey[i    ] = rtweakey[j    ]; rtweakey[j    ] = temp;
        temp = rtweakey[i + 1]; rtweakey[i + 1] = rtweakey[j + 1]; rtweakey[j + 1] = temp;
        temp = rtweakey[i + 2]; rtweakey[i + 2] = rtweakey[j + 2]; rtweakey[j + 2] = temp;
        temp = rtweakey[i + 3]; rtweakey[i + 3] = rtweakey[j + 3]; rtweakey[j + 3] = temp;
    }

    /* apply the inverse MixColumn transform to all round keys but the first and the last */
    for (i = 1; i <= Nr; i++) {
        rtweakey += 4;
        rtweakey[0] =
            Td0[Te4[(rtweakey[0] >> 24)       ] & 0xff] ^
            Td1[Te4[(rtweakey[0] >> 16) & 0xff] & 0xff] ^
            Td2[Te4[(rtweakey[0] >>  8) & 0xff] & 0xff] ^
            Td3[Te4[(rtweakey[0]      ) & 0xff] & 0xff];
        rtweakey[1] =
            Td0[Te4[(rtweakey[1] >> 24)       ] & 0xff] ^
            Td1[Te4[(rtweakey[1] >> 16) & 0xff] & 0xff] ^
            Td2[Te4[(rtweakey[1] >>  8) & 0xff] & 0xff] ^
            Td3[Te4[(rtweakey[1]      ) & 0xff] & 0xff];
        rtweakey[2] =
            Td0[Te4[(rtweakey[2] >> 24)       ] & 0xff] ^
            Td1[Te4[(rtweakey[2] >> 16) & 0xff] & 0xff] ^
            Td2[Te4[(rtweakey[2] >>  8) & 0xff] & 0xff] ^
            Td3[Te4[(rtweakey[2]      ) & 0xff] & 0xff];
        rtweakey[3] =
            Td0[Te4[(rtweakey[3] >> 24)       ] & 0xff] ^
            Td1[Te4[(rtweakey[3] >> 16) & 0xff] & 0xff] ^
            Td2[Te4[(rtweakey[3] >>  8) & 0xff] & 0xff] ^
            Td3[Te4[(rtweakey[3]      ) & 0xff] & 0xff];
    }
    return Nr;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x1080
leal (,%rax,4), %ecx
movl $0x4, %edx
movl -0x10(%rbx,%rdx,4), %esi
movl (%rbx,%rcx,4), %edi
movl %edi, -0x10(%rbx,%rdx,4)
movl %esi, (%rbx,%rcx,4)
movl -0xc(%rbx,%rdx,4), %esi
movl 0x4(%rbx,%rcx,4), %edi
movl %edi, -0xc(%rbx,%rdx,4)
movl %esi, 0x4(%rbx,%rcx,4)
movl -0x8(%rbx,%rdx,4), %esi
movl 0x8(%rbx,%rcx,4), %edi
movl %edi, -0x8(%rbx,%rdx,4)
movl %esi, 0x8(%rbx,%rcx,4)
movl -0x4(%rbx,%rdx,4), %esi
movl 0xc(%rbx,%rcx,4), %edi
movl %edi, -0x4(%rbx,%rdx,4)
movl %esi, 0xc(%rbx,%rcx,4)
addq $-0x4, %rcx
leaq 0x4(%rdx), %rsi
cmpq %rcx, %rdx
movq %rsi, %rdx
jl 0x22f4
movl %eax, %edx
movl %eax, %ecx
addl $0x7, %ecx
andl $0x38, %ecx
decq %rdx
vpbroadcastq %rdx, %ymm0
vpmovsxbq 0x2e06(%rip), %ymm1 # 0x5164
xorl %edx, %edx
vpmovsxbq 0x2dff(%rip), %ymm2 # 0x5168
vpmovsxbd 0x2dfa(%rip), %ymm3 # 0x516c
leaq 0x3347(%rip), %rsi      # 0x56c0
vpbroadcastd 0x2dde(%rip), %ymm4 # 0x5160
leaq 0x2f37(%rip), %rdi      # 0x52c0
vmovdqa 0x2d0f(%rip), %ymm5     # 0x50a0
leaq 0x3728(%rip), %r8       # 0x5ac0
vmovdqa 0x2d20(%rip), %ymm6     # 0x50c0
leaq 0x3b19(%rip), %r9       # 0x5ec0
leaq 0x3f12(%rip), %r10      # 0x62c0
vpmovzxbd 0x2dbd(%rip), %ymm7 # 0x5174
vpmovzxbd 0x2dbc(%rip), %ymm8 # 0x517c
vpmovzxbd 0x2dbb(%rip), %ymm9 # 0x5184
vpmovzxbd 0x2dba(%rip), %ymm10 # 0x518c
vpbroadcastq %rdx, %ymm11
vpor %ymm1, %ymm11, %ymm12
vpor %ymm2, %ymm11, %ymm11
vpcmpleuq %ymm0, %ymm11, %k0
vpcmpleuq %ymm0, %ymm12, %k1
kshiftlb $0x4, %k1, %k1
korb %k1, %k0, %k1
vpxor %xmm11, %xmm11, %xmm11
kmovq %k1, %k2
vpgatherdd 0x10(%rbx,%ymm3), %ymm11 {%k2}
vpsrld $0x18, %ymm11, %ymm12
vpxor %xmm13, %xmm13, %xmm13
vpxor %xmm14, %xmm14, %xmm14
vpshufb %ymm5, %ymm11, %ymm15
kmovq %k1, %k2
kmovq %k1, %k3
vpshufb %ymm6, %ymm11, %ymm16
vpgatherdd (%rsi,%ymm12,4), %ymm13 {%k2}
vpxor %xmm12, %xmm12, %xmm12
kmovq %k1, %k2
vpgatherdd (%rsi,%ymm15,4), %ymm14 {%k3}
vpand %ymm4, %ymm11, %ymm11
vpgatherdd (%rsi,%ymm16,4), %ymm12 {%k2}
vpxor %xmm15, %xmm15, %xmm15
kmovq %k1, %k2
vpgatherdd (%rsi,%ymm11,4), %ymm15 {%k2}
vpand %ymm4, %ymm13, %ymm11
vpxor %xmm13, %xmm13, %xmm13
vpxord %xmm16, %xmm16, %xmm16
vpand %ymm4, %ymm14, %ymm14
kmovq %k1, %k2
kmovq %k1, %k3
vpand %ymm4, %ymm12, %ymm12
vpgatherdd (%rdi,%ymm11,4), %ymm13 {%k2}
vpxor %xmm11, %xmm11, %xmm11
kmovq %k1, %k2
vpgatherdd (%r8,%ymm14,4), %ymm16 {%k3}
vpand %ymm4, %ymm15, %ymm14
vpgatherdd (%r9,%ymm12,4), %ymm11 {%k2}
vpxor %xmm12, %xmm12, %xmm12
kmovq %k1, %k2
vpgatherdd (%r10,%ymm14,4), %ymm12 {%k2}
vpxord %ymm13, %ymm16, %ymm13
vpternlogd $0x96, %ymm11, %ymm13, %ymm12
kmovq %k1, %k2
vpscatterdd %ymm12, (%rbx,%ymm7) {%k2}
vpxor %xmm11, %xmm11, %xmm11
kmovq %k1, %k2
vpgatherdd (%rbx,%ymm8), %ymm11 {%k2}
vpsrld $0x18, %ymm11, %ymm12
vpxor %xmm13, %xmm13, %xmm13
vpxor %xmm14, %xmm14, %xmm14
vpshufb %ymm5, %ymm11, %ymm15
kmovq %k1, %k2
kmovq %k1, %k3
vpshufb %ymm6, %ymm11, %ymm16
vpgatherdd (%rsi,%ymm12,4), %ymm13 {%k2}
vpxor %xmm12, %xmm12, %xmm12
kmovq %k1, %k2
vpgatherdd (%rsi,%ymm15,4), %ymm14 {%k3}
vpand %ymm4, %ymm11, %ymm11
vpgatherdd (%rsi,%ymm16,4), %ymm12 {%k2}
vpxor %xmm15, %xmm15, %xmm15
kmovq %k1, %k2
vpgatherdd (%rsi,%ymm11,4), %ymm15 {%k2}
vpand %ymm4, %ymm13, %ymm11
vpxor %xmm13, %xmm13, %xmm13
vpxord %xmm16, %xmm16, %xmm16
vpand %ymm4, %ymm14, %ymm14
kmovq %k1, %k2
kmovq %k1, %k3
vpand %ymm4, %ymm12, %ymm12
vpgatherdd (%rdi,%ymm11,4), %ymm13 {%k2}
vpxor %xmm11, %xmm11, %xmm11
kmovq %k1, %k2
vpgatherdd (%r8,%ymm14,4), %ymm16 {%k3}
vpand %ymm4, %ymm15, %ymm14
vpgatherdd (%r9,%ymm12,4), %ymm11 {%k2}
vpxor %xmm12, %xmm12, %xmm12
kmovq %k1, %k2
vpgatherdd (%r10,%ymm14,4), %ymm12 {%k2}
vpxord %ymm13, %ymm16, %ymm13
vpternlogd $0x96, %ymm11, %ymm13, %ymm12
kmovq %k1, %k2
vpscatterdd %ymm12, (%rbx,%ymm8) {%k2}
vpxor %xmm11, %xmm11, %xmm11
kmovq %k1, %k2
vpgatherdd (%rbx,%ymm9), %ymm11 {%k2}
vpsrld $0x18, %ymm11, %ymm12
vpxor %xmm13, %xmm13, %xmm13
vpxor %xmm14, %xmm14, %xmm14
vpshufb %ymm5, %ymm11, %ymm15
kmovq %k1, %k2
kmovq %k1, %k3
vpshufb %ymm6, %ymm11, %ymm16
vpgatherdd (%rsi,%ymm12,4), %ymm13 {%k2}
vpxor %xmm12, %xmm12, %xmm12
kmovq %k1, %k2
vpgatherdd (%rsi,%ymm15,4), %ymm14 {%k3}
vpand %ymm4, %ymm11, %ymm11
vpgatherdd (%rsi,%ymm16,4), %ymm12 {%k2}
vpxor %xmm15, %xmm15, %xmm15
kmovq %k1, %k2
vpgatherdd (%rsi,%ymm11,4), %ymm15 {%k2}
vpand %ymm4, %ymm13, %ymm11
vpxor %xmm13, %xmm13, %xmm13
vpxord %xmm16, %xmm16, %xmm16
vpand %ymm4, %ymm14, %ymm14
kmovq %k1, %k2
kmovq %k1, %k3
vpand %ymm4, %ymm12, %ymm12
vpgatherdd (%rdi,%ymm11,4), %ymm13 {%k2}
vpxor %xmm11, %xmm11, %xmm11
kmovq %k1, %k2
vpgatherdd (%r8,%ymm14,4), %ymm16 {%k3}
vpand %ymm4, %ymm15, %ymm14
vpgatherdd (%r9,%ymm12,4), %ymm11 {%k2}
vpxor %xmm12, %xmm12, %xmm12
kmovq %k1, %k2
vpgatherdd (%r10,%ymm14,4), %ymm12 {%k2}
vpxord %ymm13, %ymm16, %ymm13
vpternlogd $0x96, %ymm11, %ymm13, %ymm12
kmovq %k1, %k2
vpscatterdd %ymm12, (%rbx,%ymm9) {%k2}
vpxor %xmm11, %xmm11, %xmm11
kmovq %k1, %k2
vpgatherdd (%rbx,%ymm10), %ymm11 {%k2}
vpsrld $0x18, %ymm11, %ymm12
vpxor %xmm13, %xmm13, %xmm13
vpxor %xmm14, %xmm14, %xmm14
vpshufb %ymm5, %ymm11, %ymm15
kmovq %k1, %k2
kmovq %k1, %k3
vpshufb %ymm6, %ymm11, %ymm16
vpgatherdd (%rsi,%ymm12,4), %ymm13 {%k2}
vpxor %xmm12, %xmm12, %xmm12
kmovq %k1, %k2
vpgatherdd (%rsi,%ymm15,4), %ymm14 {%k3}
vpand %ymm4, %ymm11, %ymm11
vpgatherdd (%rsi,%ymm16,4), %ymm12 {%k2}
vpxor %xmm15, %xmm15, %xmm15
kmovq %k1, %k2
vpgatherdd (%rsi,%ymm11,4), %ymm15 {%k2}
vpand %ymm4, %ymm13, %ymm11
vpxor %xmm13, %xmm13, %xmm13
vpxord %xmm16, %xmm16, %xmm16
vpand %ymm4, %ymm14, %ymm14
kmovq %k1, %k2
kmovq %k1, %k3
vpand %ymm4, %ymm12, %ymm12
vpgatherdd (%rdi,%ymm11,4), %ymm13 {%k2}
vpxor %xmm11, %xmm11, %xmm11
kmovq %k1, %k2
vpgatherdd (%r8,%ymm14,4), %ymm16 {%k3}
vpand %ymm4, %ymm15, %ymm14
vpgatherdd (%r9,%ymm12,4), %ymm11 {%k2}
vpxor %xmm12, %xmm12, %xmm12
kmovq %k1, %k2
vpgatherdd (%r10,%ymm14,4), %ymm12 {%k2}
vpxord %ymm13, %ymm16, %ymm13
vpternlogd $0x96, %ymm11, %ymm13, %ymm12
vpscatterdd %ymm12, (%rbx,%ymm10) {%k1}
addq $0x8, %rdx
subq $-0x80, %rbx
cmpq %rdx, %rcx
jne 0x23d2
popq %rbx
vzeroupper
retq