#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_aesenc_si128(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_xor_si128(int /*<<< orphan*/, int /*<<< orphan*/);
__m128i aesfour_encrypt(__m128i in, __m128i *k) {
  __m128i x = _mm_xor_si128(in, k[0]);
  x = _mm_aesenc_si128(x, k[1]);
  x = _mm_aesenc_si128(x, k[2]);
  x = _mm_aesenc_si128(x, k[3]);
  return _mm_aesenc_si128(x, k[4]);
}


x86 assembly (clang, -O0):
<aesfour_encrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
call   1040 <_mm_xor_si128@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%esi
call   1030 <_mm_aesenc_si128@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%esi
call   1030 <_mm_aesenc_si128@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%esi
call   1030 <_mm_aesenc_si128@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%esi
call   1030 <_mm_aesenc_si128@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aesfour_encrypt>:
push   %rbx
mov    %rsi,%rbx
mov    (%rsi),%esi
call   1040 <_mm_xor_si128@plt>
mov    0x4(%rbx),%esi
mov    %eax,%edi
call   1030 <_mm_aesenc_si128@plt>
mov    0x8(%rbx),%esi
mov    %eax,%edi
call   1030 <_mm_aesenc_si128@plt>
mov    0xc(%rbx),%esi
mov    %eax,%edi
call   1030 <_mm_aesenc_si128@plt>
mov    0x10(%rbx),%esi
mov    %eax,%edi
pop    %rbx
jmp    1030 <_mm_aesenc_si128@plt>

LLVM IR (-O0):
define i32 @aesfour_encrypt(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
store i32 %0, i32* %3
store i32* %1, i32** %4
%6 = load i32, i32* %3
%7 = load i32*, i32** %4
%8 = getelementptr inbounds i32, i32* %7, i64 0
%9 = load i32, i32* %8
%10 = call i32 @_mm_xor_si128(i32 %6, i32 %9)
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = load i32*, i32** %4
%13 = getelementptr inbounds i32, i32* %12, i64 1
%14 = load i32, i32* %13
%15 = call i32 @_mm_aesenc_si128(i32 %11, i32 %14)
store i32 %15, i32* %5
%16 = load i32, i32* %5
%17 = load i32*, i32** %4
%18 = getelementptr inbounds i32, i32* %17, i64 2
%19 = load i32, i32* %18
%20 = call i32 @_mm_aesenc_si128(i32 %16, i32 %19)
store i32 %20, i32* %5
%21 = load i32, i32* %5
%22 = load i32*, i32** %4
%23 = getelementptr inbounds i32, i32* %22, i64 3
%24 = load i32, i32* %23
%25 = call i32 @_mm_aesenc_si128(i32 %21, i32 %24)
store i32 %25, i32* %5
%26 = load i32, i32* %5
%27 = load i32*, i32** %4
%28 = getelementptr inbounds i32, i32* %27, i64 4
%29 = load i32, i32* %28
%30 = call i32 @_mm_aesenc_si128(i32 %26, i32 %29)
ret i32 %30
}

LLVM IR (-O2):
define i32 @aesfour_encrypt(i32 %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = tail call i32 @_mm_xor_si128(i32 %0, i32 %3)
%5 = getelementptr inbounds i32, i32* %1, i64 1
%6 = load i32, i32* %5
%7 = tail call i32 @_mm_aesenc_si128(i32 %4, i32 %6)
%8 = getelementptr inbounds i32, i32* %1, i64 2
%9 = load i32, i32* %8
%10 = tail call i32 @_mm_aesenc_si128(i32 %7, i32 %9)
%11 = getelementptr inbounds i32, i32* %1, i64 3
%12 = load i32, i32* %11
%13 = tail call i32 @_mm_aesenc_si128(i32 %10, i32 %12)
%14 = getelementptr inbounds i32, i32* %1, i64 4
%15 = load i32, i32* %14
%16 = tail call i32 @_mm_aesenc_si128(i32 %13, i32 %15)
ret i32 %16
}