#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*/);
void aes_enc_128(__m128i *state, __m128i *key) {
  *state = _mm_xor_si128(*state, key[0]);
  *state = _mm_aesenc_si128(*state, key[1]);
  *state = _mm_aesenc_si128(*state, key[2]);
  *state = _mm_aesenc_si128(*state, key[3]);
  *state = _mm_aesenc_si128(*state, key[4]);
  *state = _mm_aesenc_si128(*state, key[5]);
  *state = _mm_aesenc_si128(*state, key[6]);
  *state = _mm_aesenc_si128(*state, key[7]);
  *state = _mm_aesenc_si128(*state, key[8]);
  *state = _mm_aesenc_si128(*state, key[9]);
  *state = _mm_aesenclast_si128(*state, key[10]);
}


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

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

LLVM IR (-O0):
define void @aes_enc_128(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %5
%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)
%11 = load i32*, i32** %3
store i32 %10, i32* %11
%12 = load i32*, i32** %3
%13 = load i32, i32* %12
%14 = load i32*, i32** %4
%15 = getelementptr inbounds i32, i32* %14, i64 1
%16 = load i32, i32* %15
%17 = call i32 @_mm_aesenc_si128(i32 %13, i32 %16)
%18 = load i32*, i32** %3
store i32 %17, i32* %18
%19 = load i32*, i32** %3
%20 = load i32, i32* %19
%21 = load i32*, i32** %4
%22 = getelementptr inbounds i32, i32* %21, i64 2
%23 = load i32, i32* %22
%24 = call i32 @_mm_aesenc_si128(i32 %20, i32 %23)
%25 = load i32*, i32** %3
store i32 %24, i32* %25
%26 = load i32*, i32** %3
%27 = load i32, i32* %26
%28 = load i32*, i32** %4
%29 = getelementptr inbounds i32, i32* %28, i64 3
%30 = load i32, i32* %29
%31 = call i32 @_mm_aesenc_si128(i32 %27, i32 %30)
%32 = load i32*, i32** %3
store i32 %31, i32* %32
%33 = load i32*, i32** %3
%34 = load i32, i32* %33
%35 = load i32*, i32** %4
%36 = getelementptr inbounds i32, i32* %35, i64 4
%37 = load i32, i32* %36
%38 = call i32 @_mm_aesenc_si128(i32 %34, i32 %37)
%39 = load i32*, i32** %3
store i32 %38, i32* %39
%40 = load i32*, i32** %3
%41 = load i32, i32* %40
%42 = load i32*, i32** %4
%43 = getelementptr inbounds i32, i32* %42, i64 5
%44 = load i32, i32* %43
%45 = call i32 @_mm_aesenc_si128(i32 %41, i32 %44)
%46 = load i32*, i32** %3
store i32 %45, i32* %46
%47 = load i32*, i32** %3
%48 = load i32, i32* %47
%49 = load i32*, i32** %4
%50 = getelementptr inbounds i32, i32* %49, i64 6
%51 = load i32, i32* %50
%52 = call i32 @_mm_aesenc_si128(i32 %48, i32 %51)
%53 = load i32*, i32** %3
store i32 %52, i32* %53
%54 = load i32*, i32** %3
%55 = load i32, i32* %54
%56 = load i32*, i32** %4
%57 = getelementptr inbounds i32, i32* %56, i64 7
%58 = load i32, i32* %57
%59 = call i32 @_mm_aesenc_si128(i32 %55, i32 %58)
%60 = load i32*, i32** %3
store i32 %59, i32* %60
%61 = load i32*, i32** %3
%62 = load i32, i32* %61
%63 = load i32*, i32** %4
%64 = getelementptr inbounds i32, i32* %63, i64 8
%65 = load i32, i32* %64
%66 = call i32 @_mm_aesenc_si128(i32 %62, i32 %65)
%67 = load i32*, i32** %3
store i32 %66, i32* %67
%68 = load i32*, i32** %3
%69 = load i32, i32* %68
%70 = load i32*, i32** %4
%71 = getelementptr inbounds i32, i32* %70, i64 9
%72 = load i32, i32* %71
%73 = call i32 @_mm_aesenc_si128(i32 %69, i32 %72)
%74 = load i32*, i32** %3
store i32 %73, i32* %74
%75 = load i32*, i32** %3
%76 = load i32, i32* %75
%77 = load i32*, i32** %4
%78 = getelementptr inbounds i32, i32* %77, i64 10
%79 = load i32, i32* %78
%80 = call i32 @_mm_aesenclast_si128(i32 %76, i32 %79)
%81 = load i32*, i32** %3
store i32 %80, i32* %81
ret void
}

LLVM IR (-O2):
define void @aes_enc_128(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
%5 = tail call i32 @_mm_xor_si128(i32 %3, i32 %4)
store i32 %5, i32* %0
%6 = getelementptr inbounds i32, i32* %1, i64 1
%7 = load i32, i32* %6
%8 = tail call i32 @_mm_aesenc_si128(i32 %5, i32 %7)
store i32 %8, i32* %0
%9 = getelementptr inbounds i32, i32* %1, i64 2
%10 = load i32, i32* %9
%11 = tail call i32 @_mm_aesenc_si128(i32 %8, i32 %10)
store i32 %11, i32* %0
%12 = getelementptr inbounds i32, i32* %1, i64 3
%13 = load i32, i32* %12
%14 = tail call i32 @_mm_aesenc_si128(i32 %11, i32 %13)
store i32 %14, i32* %0
%15 = getelementptr inbounds i32, i32* %1, i64 4
%16 = load i32, i32* %15
%17 = tail call i32 @_mm_aesenc_si128(i32 %14, i32 %16)
store i32 %17, i32* %0
%18 = getelementptr inbounds i32, i32* %1, i64 5
%19 = load i32, i32* %18
%20 = tail call i32 @_mm_aesenc_si128(i32 %17, i32 %19)
store i32 %20, i32* %0
%21 = getelementptr inbounds i32, i32* %1, i64 6
%22 = load i32, i32* %21
%23 = tail call i32 @_mm_aesenc_si128(i32 %20, i32 %22)
store i32 %23, i32* %0
%24 = getelementptr inbounds i32, i32* %1, i64 7
%25 = load i32, i32* %24
%26 = tail call i32 @_mm_aesenc_si128(i32 %23, i32 %25)
store i32 %26, i32* %0
%27 = getelementptr inbounds i32, i32* %1, i64 8
%28 = load i32, i32* %27
%29 = tail call i32 @_mm_aesenc_si128(i32 %26, i32 %28)
store i32 %29, i32* %0
%30 = getelementptr inbounds i32, i32* %1, i64 9
%31 = load i32, i32* %30
%32 = tail call i32 @_mm_aesenc_si128(i32 %29, i32 %31)
store i32 %32, i32* %0
%33 = getelementptr inbounds i32, i32* %1, i64 10
%34 = load i32, i32* %33
%35 = tail call i32 @_mm_aesenclast_si128(i32 %32, i32 %34)
store i32 %35, i32* %0
ret void
}