#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_loadl_epi64(int /*<<< orphan*/ *);
int /*<<< orphan*/
_mm_set_epi8(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
             int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
             int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
             int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/,
             int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/, int);
int /*<<< orphan*/ _mm_xor_si128(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ aes_enc_128(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
void jambu_initialization(__m128i *key, const unsigned char *iv,
                          __m128i *stateS, __m128i *stateR) {
  __m128i c5 = _mm_set_epi8(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5);
  *stateS = _mm_loadl_epi64((__m128i *)iv);
  aes_enc_128(stateS, key);
  *stateR = *stateS;
  *stateS = _mm_xor_si128(*stateS, c5);
  return;
}


x86 assembly (clang, -O0):
<jambu_initialization>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
xor    %r9d,%r9d
mov    %r9d,%edi
mov    %r9d,%esi
mov    %r9d,%edx
mov    %r9d,%ecx
mov    %r9d,%r8d
movl   $0x0,(%rsp)
movl   $0x0,0x8(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0x18(%rsp)
movl   $0x0,0x20(%rsp)
movl   $0x0,0x28(%rsp)
movl   $0x0,0x30(%rsp)
movl   $0x0,0x38(%rsp)
movl   $0x0,0x40(%rsp)
movl   $0x5,0x48(%rsp)
call   1050 <_mm_set_epi8@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <_mm_loadl_epi64@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <aes_enc_128@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%edi
mov    -0x24(%rbp),%esi
call   1060 <_mm_xor_si128@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jambu_initialization>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %rsi,%r12
mov    %rdi,%r15
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
xor    %r9d,%r9d
push   $0x5
push   $0x0
push   $0x0
push   $0x0
push   $0x0
push   $0x0
push   $0x0
push   $0x0
push   $0x0
push   $0x0
call   1050 <_mm_set_epi8@plt>
add    $0x50,%rsp
mov    %eax,%ebp
mov    %r12,%rdi
call   1040 <_mm_loadl_epi64@plt>
mov    %eax,(%rbx)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <aes_enc_128@plt>
mov    (%rbx),%eax
mov    %eax,(%r14)
mov    (%rbx),%edi
mov    %ebp,%esi
call   1060 <_mm_xor_si128@plt>
mov    %eax,(%rbx)
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @jambu_initialization(i32* %0, i8* %1, i32* %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32
store i32* %0, i32** %5
store i8* %1, i8** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%10 = call i32 @_mm_set_epi8(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 5)
store i32 %10, i32* %9
%11 = load i8*, i8** %6
%12 = bitcast i8* %11 to i32*
%13 = call i32 @_mm_loadl_epi64(i32* %12)
%14 = load i32*, i32** %7
store i32 %13, i32* %14
%15 = load i32*, i32** %7
%16 = load i32*, i32** %5
%17 = call i32 @aes_enc_128(i32* %15, i32* %16)
%18 = load i32*, i32** %7
%19 = load i32, i32* %18
%20 = load i32*, i32** %8
store i32 %19, i32* %20
%21 = load i32*, i32** %7
%22 = load i32, i32* %21
%23 = load i32, i32* %9
%24 = call i32 @_mm_xor_si128(i32 %22, i32 %23)
%25 = load i32*, i32** %7
store i32 %24, i32* %25
ret void
}

LLVM IR (-O2):
define void @jambu_initialization(i32* %0, i8* %1, i32* %2, i32* nocapture writeonly %3) {
%5 = tail call i32 @_mm_set_epi8(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 0, i32 5)
%6 = bitcast i8* %1 to i32*
%7 = tail call i32 @_mm_loadl_epi64(i32* %6)
store i32 %7, i32* %2
%8 = tail call i32 @aes_enc_128(i32* %2, i32* %0)
%9 = load i32, i32* %2
store i32 %9, i32* %3
%10 = load i32, i32* %2
%11 = tail call i32 @_mm_xor_si128(i32 %10, i32 %5)
store i32 %11, i32* %2
ret void
}