// File: /workspace/github_c_makefile_star2_O1/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 %r14
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %rbx
vmovaps 0x1312(%rip), %ymm0     # 0x30a0
vmovups %ymm0, (%rdi)
vmovaps 0x1326(%rip), %ymm0     # 0x30c0
vmovups %ymm0, 0x20(%rdi)
vmovaps 0x1339(%rip), %ymm0     # 0x30e0
vmovups %ymm0, 0x40(%rdi)
vmovaps 0x134c(%rip), %ymm0     # 0x3100
vmovups %ymm0, 0x60(%rdi)
vmovaps 0x135f(%rip), %ymm0     # 0x3120
vmovups %ymm0, 0x80(%rdi)
vpxor %xmm1, %xmm1, %xmm1
vpmovsxbq 0x138a(%rip), %ymm2 # 0x3160
xorl %eax, %eax
vpbroadcastq 0x135f(%rip), %ymm0 # 0x3140
vpmovzxbq (%rsi,%rax), %ymm3
vpsllq $0x3, %ymm2, %ymm4
vpsllvq %ymm4, %ymm3, %ymm3
vpxor %ymm1, %ymm3, %ymm1
addq $0x4, %rax
vpaddq %ymm0, %ymm2, %ymm2
cmpq $0x8, %rax
jne 0x1de1
vextracti128 $0x1, %ymm1, %xmm2
vpxor %xmm2, %xmm1, %xmm1
vpshufd $0xee, %xmm1, %xmm2     # xmm2 = xmm1[2,3,2,3]
vpxor %xmm2, %xmm1, %xmm1
vmovq %xmm1, %rax
movabsq $-0x685bd28071902c, %rcx # imm = 0xFF97A42D7F8E6FD4
xorq %rax, %rcx
movq %rcx, (%rbx)
vpxor %xmm1, %xmm1, %xmm1
vpmovsxbq 0x1328(%rip), %ymm2 # 0x3160
xorl %eax, %eax
vpmovzxbq 0x8(%rsi,%rax), %ymm3
vpsllq $0x3, %ymm2, %ymm4
vpsllvq %ymm4, %ymm3, %ymm3
vpxor %ymm1, %ymm3, %ymm1
addq $0x4, %rax
vpaddq %ymm0, %ymm2, %ymm2
cmpq $0x8, %rax
jne 0x1e3a
vextracti128 $0x1, %ymm1, %xmm2
vpxor %xmm2, %xmm1, %xmm1
vpshufd $0xee, %xmm1, %xmm2     # xmm2 = xmm1[2,3,2,3]
vpxor %xmm2, %xmm1, %xmm1
vmovq %xmm1, %rax
movabsq $-0x14a556c0dce829cb, %rcx # imm = 0xEB5AA93F2317D635
xorq %rax, %rcx
movq %rcx, 0x28(%rbx)
vpxor %xmm1, %xmm1, %xmm1
vpmovsxbq 0x12cd(%rip), %ymm2 # 0x3160
xorl %eax, %eax
vpmovzxbq (%rdx,%rax), %ymm3
vpsllq $0x3, %ymm2, %ymm4
vpsllvq %ymm4, %ymm3, %ymm3
vpxor %ymm1, %ymm3, %ymm1
addq $0x4, %rax
vpaddq %ymm0, %ymm2, %ymm2
cmpq $0x8, %rax
jne 0x1e95
vextracti128 $0x1, %ymm1, %xmm2
vpxor %xmm2, %xmm1, %xmm1
vpshufd $0xee, %xmm1, %xmm2     # xmm2 = xmm1[2,3,2,3]
vpxor %xmm2, %xmm1, %xmm1
vmovq %xmm1, %rax
movabsq $0x5e5635a21d9ae61, %rcx # imm = 0x5E5635A21D9AE61
xorq %rax, %rcx
movq %rcx, 0x50(%rbx)
vpxor %xmm1, %xmm1, %xmm1
vpmovsxbq 0x1273(%rip), %ymm2 # 0x3160
xorl %eax, %eax
vpmovzxbq 0x8(%rdx,%rax), %ymm3
vpsllq $0x3, %ymm2, %ymm4
vpsllvq %ymm4, %ymm3, %ymm3
vpxor %ymm1, %ymm3, %ymm1
addq $0x4, %rax
vpaddq %ymm0, %ymm2, %ymm2
cmpq $0x8, %rax
jne 0x1eef
vextracti128 $0x1, %ymm1, %xmm0
vpxor %xmm0, %xmm1, %xmm0
vpshufd $0xee, %xmm0, %xmm1     # xmm1 = xmm0[2,3,2,3]
vpxor %xmm1, %xmm0, %xmm0
vmovq %xmm0, %rax
movabsq $-0x6bf386dd51c5d9ec, %rcx # imm = 0x940C7922AE3A2614
xorq %rax, %rcx
movq %rcx, 0x78(%rbx)
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
vzeroupper
callq 0x10e0
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x10e0
movq %r14, %rdi
movq %rbx, %rsi
movl $0x2, %edx
callq 0x10e0
movq %rbx, %rdi
movq %r14, %rsi
movl $0x3, %edx
callq 0x10e0
movq %r14, %rdi
movq %rbx, %rsi
movl $0x4, %edx
callq 0x10e0
movq %rbx, %rdi
movq %r14, %rsi
movl $0x5, %edx
callq 0x10e0
movq %r14, %rdi
movq %rbx, %rsi
movl $0x6, %edx
callq 0x10e0
movq %rbx, %rdi
movq %r14, %rsi
movl $0x7, %edx
callq 0x10e0
movq %r14, %rdi
movq %rbx, %rsi
movl $0x8, %edx
callq 0x10e0
movq %rbx, %rdi
movq %r14, %rsi
movl $0x9, %edx
callq 0x10e0
movq %r14, %rdi
movq %rbx, %rsi
movl $0xa, %edx
callq 0x10e0
movq %rbx, %rdi
movq %r14, %rsi
movl $0xb, %edx
callq 0x10e0
addq $0xa8, %rsp
popq %rbx
popq %r14
retq