#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_aesenclast_si128(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ _mm_xor_si128(int /*<<< orphan*/, int /*<<< orphan*/);
__m128i aes_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]);
  x = _mm_aesenc_si128(x, k[4]);
  x = _mm_aesenc_si128(x, k[5]);
  x = _mm_aesenc_si128(x, k[6]);
  x = _mm_aesenc_si128(x, k[7]);
  x = _mm_aesenc_si128(x, k[8]);
  x = _mm_aesenc_si128(x, k[9]);
  return _mm_aesenclast_si128(x, k[10]);
}


x86 assembly (clang, -O0):
<aes_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   1050 <_mm_xor_si128@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%esi
call   1040 <_mm_aesenc_si128@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%esi
call   1040 <_mm_aesenc_si128@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0xc(%rax),%esi
call   1040 <_mm_aesenc_si128@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%esi
call   1040 <_mm_aesenc_si128@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x14(%rax),%esi
call   1040 <_mm_aesenc_si128@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%esi
call   1040 <_mm_aesenc_si128@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x1c(%rax),%esi
call   1040 <_mm_aesenc_si128@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%esi
call   1040 <_mm_aesenc_si128@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x24(%rax),%esi
call   1040 <_mm_aesenc_si128@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x28(%rax),%esi
call   1030 <_mm_aesenclast_si128@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aes_encrypt>:
push   %rbx
mov    %rsi,%rbx
mov    (%rsi),%esi
call   1050 <_mm_xor_si128@plt>
mov    0x4(%rbx),%esi
mov    %eax,%edi
call   1040 <_mm_aesenc_si128@plt>
mov    0x8(%rbx),%esi
mov    %eax,%edi
call   1040 <_mm_aesenc_si128@plt>
mov    0xc(%rbx),%esi
mov    %eax,%edi
call   1040 <_mm_aesenc_si128@plt>
mov    0x10(%rbx),%esi
mov    %eax,%edi
call   1040 <_mm_aesenc_si128@plt>
mov    0x14(%rbx),%esi
mov    %eax,%edi
call   1040 <_mm_aesenc_si128@plt>
mov    0x18(%rbx),%esi
mov    %eax,%edi
call   1040 <_mm_aesenc_si128@plt>
mov    0x1c(%rbx),%esi
mov    %eax,%edi
call   1040 <_mm_aesenc_si128@plt>
mov    0x20(%rbx),%esi
mov    %eax,%edi
call   1040 <_mm_aesenc_si128@plt>
mov    0x24(%rbx),%esi
mov    %eax,%edi
call   1040 <_mm_aesenc_si128@plt>
mov    0x28(%rbx),%esi
mov    %eax,%edi
pop    %rbx
jmp    1030 <_mm_aesenclast_si128@plt>

LLVM IR (-O0):
define i32 @aes_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)
store i32 %30, i32* %5
%31 = load i32, i32* %5
%32 = load i32*, i32** %4
%33 = getelementptr inbounds i32, i32* %32, i64 5
%34 = load i32, i32* %33
%35 = call i32 @_mm_aesenc_si128(i32 %31, i32 %34)
store i32 %35, i32* %5
%36 = load i32, i32* %5
%37 = load i32*, i32** %4
%38 = getelementptr inbounds i32, i32* %37, i64 6
%39 = load i32, i32* %38
%40 = call i32 @_mm_aesenc_si128(i32 %36, i32 %39)
store i32 %40, i32* %5
%41 = load i32, i32* %5
%42 = load i32*, i32** %4
%43 = getelementptr inbounds i32, i32* %42, i64 7
%44 = load i32, i32* %43
%45 = call i32 @_mm_aesenc_si128(i32 %41, i32 %44)
store i32 %45, i32* %5
%46 = load i32, i32* %5
%47 = load i32*, i32** %4
%48 = getelementptr inbounds i32, i32* %47, i64 8
%49 = load i32, i32* %48
%50 = call i32 @_mm_aesenc_si128(i32 %46, i32 %49)
store i32 %50, i32* %5
%51 = load i32, i32* %5
%52 = load i32*, i32** %4
%53 = getelementptr inbounds i32, i32* %52, i64 9
%54 = load i32, i32* %53
%55 = call i32 @_mm_aesenc_si128(i32 %51, i32 %54)
store i32 %55, i32* %5
%56 = load i32, i32* %5
%57 = load i32*, i32** %4
%58 = getelementptr inbounds i32, i32* %57, i64 10
%59 = load i32, i32* %58
%60 = call i32 @_mm_aesenclast_si128(i32 %56, i32 %59)
ret i32 %60
}

LLVM IR (-O2):
define i32 @aes_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)
%17 = getelementptr inbounds i32, i32* %1, i64 5
%18 = load i32, i32* %17
%19 = tail call i32 @_mm_aesenc_si128(i32 %16, i32 %18)
%20 = getelementptr inbounds i32, i32* %1, i64 6
%21 = load i32, i32* %20
%22 = tail call i32 @_mm_aesenc_si128(i32 %19, i32 %21)
%23 = getelementptr inbounds i32, i32* %1, i64 7
%24 = load i32, i32* %23
%25 = tail call i32 @_mm_aesenc_si128(i32 %22, i32 %24)
%26 = getelementptr inbounds i32, i32* %1, i64 8
%27 = load i32, i32* %26
%28 = tail call i32 @_mm_aesenc_si128(i32 %25, i32 %27)
%29 = getelementptr inbounds i32, i32* %1, i64 9
%30 = load i32, i32* %29
%31 = tail call i32 @_mm_aesenc_si128(i32 %28, i32 %30)
%32 = getelementptr inbounds i32, i32* %1, i64 10
%33 = load i32, i32* %32
%34 = tail call i32 @_mm_aesenclast_si128(i32 %31, i32 %33)
ret i32 %34
}