// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movl %edx, 0x14(%rsp)
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
movl 0x14(%rsp), %edx
callq 0x10a0
movl %eax, 0x8(%rsp)
movl $0x0, 0x10(%rsp)
movl 0x8(%rsp), %eax
shll $0x2, %eax
movl %eax, 0xc(%rsp)
movl 0x10(%rsp), %eax
cmpl 0xc(%rsp), %eax
jge 0x2d01
movq 0x20(%rsp), %rax
movslq 0x10(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x4(%rsp)
movq 0x20(%rsp), %rax
movslq 0xc(%rsp), %rcx
movl (%rax,%rcx,4), %edx
movq 0x20(%rsp), %rax
movslq 0x10(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x4(%rsp), %edx
movq 0x20(%rsp), %rax
movslq 0xc(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movq 0x20(%rsp), %rax
movl 0x10(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x4(%rsp)
movq 0x20(%rsp), %rax
movl 0xc(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq 0x20(%rsp), %rax
movl 0x10(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl 0x4(%rsp), %edx
movq 0x20(%rsp), %rax
movl 0xc(%rsp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq 0x20(%rsp), %rax
movl 0x10(%rsp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x4(%rsp)
movq 0x20(%rsp), %rax
movl 0xc(%rsp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq 0x20(%rsp), %rax
movl 0x10(%rsp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl 0x4(%rsp), %edx
movq 0x20(%rsp), %rax
movl 0xc(%rsp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movq 0x20(%rsp), %rax
movl 0x10(%rsp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x4(%rsp)
movq 0x20(%rsp), %rax
movl 0xc(%rsp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %edx
movq 0x20(%rsp), %rax
movl 0x10(%rsp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl 0x4(%rsp), %edx
movq 0x20(%rsp), %rax
movl 0xc(%rsp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
movl 0x10(%rsp), %eax
addl $0x4, %eax
movl %eax, 0x10(%rsp)
movl 0xc(%rsp), %eax
subl $0x4, %eax
movl %eax, 0xc(%rsp)
jmp 0x2bac
movl $0x1, 0x10(%rsp)
movl 0x10(%rsp), %eax
cmpl 0x8(%rsp), %eax
jg 0x3040
movq 0x20(%rsp), %rax
addq $0x10, %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movl (%rax), %eax
shrl $0x18, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x57f6(%rip), %rax      # 0x8530
movl (%rax,%rcx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x53e3(%rip), %rax      # 0x8130
movl (%rax,%rcx,4), %ecx
movq 0x20(%rsp), %rax
movl (%rax), %eax
shrl $0x10, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x57c6(%rip), %rax      # 0x8530
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x5bb3(%rip), %rax      # 0x8930
xorl (%rax,%rdx,4), %ecx
movq 0x20(%rsp), %rax
movl (%rax), %eax
shrl $0x8, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x5796(%rip), %rax      # 0x8530
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x5f83(%rip), %rax      # 0x8d30
xorl (%rax,%rdx,4), %ecx
movq 0x20(%rsp), %rax
movl (%rax), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x5769(%rip), %rax      # 0x8530
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x6356(%rip), %rax      # 0x9130
xorl (%rax,%rdx,4), %ecx
movq 0x20(%rsp), %rax
movl %ecx, (%rax)
movq 0x20(%rsp), %rax
movl 0x4(%rax), %eax
shrl $0x18, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x5736(%rip), %rax      # 0x8530
movl (%rax,%rcx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x5323(%rip), %rax      # 0x8130
movl (%rax,%rcx,4), %ecx
movq 0x20(%rsp), %rax
movl 0x4(%rax), %eax
shrl $0x10, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x5705(%rip), %rax      # 0x8530
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x5af2(%rip), %rax      # 0x8930
xorl (%rax,%rdx,4), %ecx
movq 0x20(%rsp), %rax
movl 0x4(%rax), %eax
shrl $0x8, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x56d4(%rip), %rax      # 0x8530
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x5ec1(%rip), %rax      # 0x8d30
xorl (%rax,%rdx,4), %ecx
movq 0x20(%rsp), %rax
movl 0x4(%rax), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x56a6(%rip), %rax      # 0x8530
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x6293(%rip), %rax      # 0x9130
xorl (%rax,%rdx,4), %ecx
movq 0x20(%rsp), %rax
movl %ecx, 0x4(%rax)
movq 0x20(%rsp), %rax
movl 0x8(%rax), %eax
shrl $0x18, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x5672(%rip), %rax      # 0x8530
movl (%rax,%rcx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x525f(%rip), %rax      # 0x8130
movl (%rax,%rcx,4), %ecx
movq 0x20(%rsp), %rax
movl 0x8(%rax), %eax
shrl $0x10, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x5641(%rip), %rax      # 0x8530
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x5a2e(%rip), %rax      # 0x8930
xorl (%rax,%rdx,4), %ecx
movq 0x20(%rsp), %rax
movl 0x8(%rax), %eax
shrl $0x8, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x5610(%rip), %rax      # 0x8530
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x5dfd(%rip), %rax      # 0x8d30
xorl (%rax,%rdx,4), %ecx
movq 0x20(%rsp), %rax
movl 0x8(%rax), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x55e2(%rip), %rax      # 0x8530
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x61cf(%rip), %rax      # 0x9130
xorl (%rax,%rdx,4), %ecx
movq 0x20(%rsp), %rax
movl %ecx, 0x8(%rax)
movq 0x20(%rsp), %rax
movl 0xc(%rax), %eax
shrl $0x18, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x55ae(%rip), %rax      # 0x8530
movl (%rax,%rcx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %ecx
leaq 0x519b(%rip), %rax      # 0x8130
movl (%rax,%rcx,4), %ecx
movq 0x20(%rsp), %rax
movl 0xc(%rax), %eax
shrl $0x10, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x557d(%rip), %rax      # 0x8530
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x596a(%rip), %rax      # 0x8930
xorl (%rax,%rdx,4), %ecx
movq 0x20(%rsp), %rax
movl 0xc(%rax), %eax
shrl $0x8, %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x554c(%rip), %rax      # 0x8530
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x5d39(%rip), %rax      # 0x8d30
xorl (%rax,%rdx,4), %ecx
movq 0x20(%rsp), %rax
movl 0xc(%rax), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x551e(%rip), %rax      # 0x8530
movl (%rax,%rdx,4), %eax
andl $0xff, %eax
movl %eax, %eax
movl %eax, %edx
leaq 0x610b(%rip), %rax      # 0x9130
xorl (%rax,%rdx,4), %ecx
movq 0x20(%rsp), %rax
movl %ecx, 0xc(%rax)
movl 0x10(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0x2d09
movl 0x8(%rsp), %eax
addq $0x28, %rsp
retq
nopl (%rax)