// File: /workspace/github_c_makefile_star2_O2/mjosaarinen[P]brutus/crypto_aead/icepole128v2/ref/icepole.c
// Function: initState
void initState(ICESTATE S, const unsigned char * k, const unsigned char * nonce)
{
    ICESTATE T;

    /* init state */
    S[0][0] = 0xFF97A42D7F8E6FD4ULL;
    S[0][1] = 0x90FEE5A0A44647C4ULL;
    S[0][2] = 0x8C5BDA0CD6192E76ULL;
    S[0][3] = 0xAD30A6F71B19059CULL;
    S[0][4] = 0x30935AB7D08FFC64ULL;

    S[1][0] = 0xEB5AA93F2317D635ULL;
    S[1][1] = 0xA9A6E6260D712103ULL;
    S[1][2] = 0x81A57C16DBCF555FULL;
    S[1][3] = 0x43B831CD0347C826ULL;
    S[1][4] = 0x01F22F1A11A5569FULL;

    S[2][0] = 0x05E5635A21D9AE61ULL;
    S[2][1] = 0x64BEFEF28CC970F2ULL;
    S[2][2] = 0x613670957BC46611ULL;
    S[2][3] = 0xB87C5A554FD00ECBULL;
    S[2][4] = 0x8C3EE88A1CCF32C8ULL;

    S[3][0] = 0x940C7922AE3A2614ULL;
    S[3][1] = 0x1841F924A2C509E4ULL;
    S[3][2] = 0x16F53526E70465C2ULL;
    S[3][3] = 0x75F644E97F30A13BULL;
    S[3][4] = 0xEAF1FF7B5CECA249ULL;

    /* xor key, nonce */
    S[0][0] = S[0][0] ^ load64(k, 8);
    S[1][0] = S[1][0] ^ load64(k+8, 8);
    S[2][0] = S[2][0] ^ load64(nonce, 8);
    S[3][0] = S[3][0] ^ load64(nonce+8, 8);

    /* do P_12 */
    oneround(T,S,0);
    oneround(S,T,1);
    oneround(T,S,2);
    oneround(S,T,3);
    oneround(T,S,4);
    oneround(S,T,5);
    oneround(T,S,6);
    oneround(S,T,7);
    oneround(T,S,8);
    oneround(S,T,9);
    oneround(T,S,10);
    oneround(S,T,11);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xa0, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
vmovaps 0x149f(%rip), %ymm0     # 0x3000
vmovups %ymm0, (%rdi)
vmovaps 0x14b3(%rip), %ymm0     # 0x3020
vmovups %ymm0, 0x20(%rdi)
vmovaps 0x14c6(%rip), %ymm0     # 0x3040
vmovups %ymm0, 0x40(%rdi)
vmovaps 0x14d9(%rip), %ymm0     # 0x3060
vmovups %ymm0, 0x60(%rdi)
vmovaps 0x14ec(%rip), %ymm0     # 0x3080
vmovups %ymm0, 0x80(%rdi)
pushq $0x8
popq %rbp
movq %rsi, %rdi
movl %ebp, %esi
vzeroupper
callq 0x1090
movabsq $-0x685bd28071902c, %rcx # imm = 0xFF97A42D7F8E6FD4
xorq %rax, %rcx
movq %rcx, (%rbx)
movq 0x28(%rbx), %r12
addq $0x8, %r15
movq %r15, %rdi
movl %ebp, %esi
callq 0x1090
xorq %r12, %rax
movq %rax, 0x28(%rbx)
movq 0x50(%rbx), %r15
movq %r14, %rdi
movl %ebp, %esi
callq 0x1090
xorq %r15, %rax
movq %rax, 0x50(%rbx)
movq 0x78(%rbx), %r15
addq $0x8, %r14
movq %r14, %rdi
movl %ebp, %esi
callq 0x1090
xorq %r15, %rax
movq %rax, 0x78(%rbx)
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x1100
pushq $0x1
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1100
pushq $0x2
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1100
pushq $0x3
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1100
pushq $0x4
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1100
pushq $0x5
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1100
pushq $0x6
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1100
pushq $0x7
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1100
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0x1100
pushq $0x9
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1100
pushq $0xa
popq %rdx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x1100
pushq $0xb
popq %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1100
addq $0xa0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq