#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 */

/* Variables and functions */
int /*<<< orphan*/ AddRoundKey(unsigned int *, unsigned int *);
int /*<<< orphan*/ MixSubColumns(unsigned char *);
int /*<<< orphan*/ ShiftRows(unsigned char *);
void Encrypt(unsigned char *InText, unsigned char *ExpKey,
             unsigned char *OutText) {
  unsigned round, idx;
  unsigned char State[4 * 4];
  for (idx = 0; idx < 4; idx++) {
    State[4 * idx + 0] = *InText++;
    State[4 * idx + 1] = *InText++;
    State[4 * idx + 2] = *InText++;
    State[4 * idx + 3] = *InText++;
  }
  AddRoundKey((unsigned *)State, (unsigned *)ExpKey);
  for (round = 1; round < 10 + 1; round++) {
    if (round < 10)
      MixSubColumns(State);
    else
      ShiftRows(State);
    AddRoundKey((unsigned *)State, (unsigned *)ExpKey + round * 4);
  }
  for (idx = 0; idx < 4; idx++) {
    *OutText++ = State[4 * idx + 0];
    *OutText++ = State[4 * idx + 1];
    *OutText++ = State[4 * idx + 2];
    *OutText++ = State[4 * idx + 3];
  }
}


x86 assembly (clang, -O0):
<Encrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x4,-0x20(%rbp)
jae    11e3 <Encrypt+0xb3>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x20(%rbp),%eax
shl    $0x2,%eax
add    $0x0,%eax
mov    %eax,%eax
mov    %cl,-0x30(%rbp,%rax,1)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x20(%rbp),%eax
shl    $0x2,%eax
add    $0x1,%eax
mov    %eax,%eax
mov    %cl,-0x30(%rbp,%rax,1)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x20(%rbp),%eax
shl    $0x2,%eax
add    $0x2,%eax
mov    %eax,%eax
mov    %cl,-0x30(%rbp,%rax,1)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%cl
mov    -0x20(%rbp),%eax
shl    $0x2,%eax
add    $0x3,%eax
mov    %eax,%eax
mov    %cl,-0x30(%rbp,%rax,1)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    114b <Encrypt+0x1b>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <AddRoundKey@plt>
movl   $0x1,-0x1c(%rbp)
cmpl   $0xb,-0x1c(%rbp)
jae    124c <Encrypt+0x11c>
cmpl   $0xa,-0x1c(%rbp)
jae    1219 <Encrypt+0xe9>
lea    -0x30(%rbp),%rdi
call   1050 <MixSubColumns@plt>
jmp    1222 <Encrypt+0xf2>
lea    -0x30(%rbp),%rdi
call   1030 <ShiftRows@plt>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%eax
shl    $0x2,%eax
mov    %eax,%eax
shl    $0x2,%rax
add    %rax,%rsi
call   1040 <AddRoundKey@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11f7 <Encrypt+0xc7>
movl   $0x0,-0x20(%rbp)
cmpl   $0x4,-0x20(%rbp)
jae    12eb <Encrypt+0x1bb>
mov    -0x20(%rbp),%eax
shl    $0x2,%eax
add    $0x0,%eax
mov    %eax,%eax
mov    -0x30(%rbp,%rax,1),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
mov    -0x20(%rbp),%eax
shl    $0x2,%eax
add    $0x1,%eax
mov    %eax,%eax
mov    -0x30(%rbp,%rax,1),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
mov    -0x20(%rbp),%eax
shl    $0x2,%eax
add    $0x2,%eax
mov    %eax,%eax
mov    -0x30(%rbp,%rax,1),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
mov    -0x20(%rbp),%eax
shl    $0x2,%eax
add    $0x3,%eax
mov    %eax,%eax
mov    -0x30(%rbp,%rax,1),%cl
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cl,(%rax)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1253 <Encrypt+0x123>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Encrypt>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%rbx
movups (%rdi),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%r15
mov    %r15,%rdi
call   1040 <AddRoundKey@plt>
mov    %r15,%rdi
call   1050 <MixSubColumns@plt>
lea    0x10(%rbx),%rsi
mov    %r15,%rdi
call   1040 <AddRoundKey@plt>
mov    %r15,%rdi
call   1050 <MixSubColumns@plt>
lea    0x20(%rbx),%rsi
mov    %r15,%rdi
call   1040 <AddRoundKey@plt>
mov    %r15,%rdi
call   1050 <MixSubColumns@plt>
lea    0x30(%rbx),%rsi
mov    %r15,%rdi
call   1040 <AddRoundKey@plt>
mov    %r15,%rdi
call   1050 <MixSubColumns@plt>
lea    0x40(%rbx),%rsi
mov    %r15,%rdi
call   1040 <AddRoundKey@plt>
mov    %r15,%rdi
call   1050 <MixSubColumns@plt>
lea    0x50(%rbx),%rsi
mov    %r15,%rdi
call   1040 <AddRoundKey@plt>
mov    %r15,%rdi
call   1050 <MixSubColumns@plt>
lea    0x60(%rbx),%rsi
mov    %r15,%rdi
call   1040 <AddRoundKey@plt>
mov    %r15,%rdi
call   1050 <MixSubColumns@plt>
lea    0x70(%rbx),%rsi
mov    %r15,%rdi
call   1040 <AddRoundKey@plt>
mov    %r15,%rdi
call   1050 <MixSubColumns@plt>
lea    0x80(%rbx),%rsi
mov    %r15,%rdi
call   1040 <AddRoundKey@plt>
mov    %r15,%rdi
call   1050 <MixSubColumns@plt>
lea    0x90(%rbx),%rsi
mov    %r15,%rdi
call   1040 <AddRoundKey@plt>
mov    %r15,%rdi
call   1030 <ShiftRows@plt>
add    $0xa0,%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
call   1040 <AddRoundKey@plt>
movaps (%rsp),%xmm0
movups %xmm0,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @Encrypt(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca [16 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
store i32 0, i32* %8
br label %10
10: ; preds = %46, %3
%11 = load i32, i32* %8
%12 = icmp ult i32 %11, 4
br i1 %12, label %13, label %49
13: ; preds = %10
%14 = load i8*, i8** %4
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %4
%16 = load i8, i8* %14
%17 = load i32, i32* %8
%18 = mul i32 4, %17
%19 = add i32 %18, 0
%20 = zext i32 %19 to i64
%21 = getelementptr inbounds [16 x i8], [16 x i8]* %9, i64 0, i64 %20
store i8 %16, i8* %21
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %4
%24 = load i8, i8* %22
%25 = load i32, i32* %8
%26 = mul i32 4, %25
%27 = add i32 %26, 1
%28 = zext i32 %27 to i64
%29 = getelementptr inbounds [16 x i8], [16 x i8]* %9, i64 0, i64 %28
store i8 %24, i8* %29
%30 = load i8*, i8** %4
%31 = getelementptr inbounds i8, i8* %30, i32 1
store i8* %31, i8** %4
%32 = load i8, i8* %30
%33 = load i32, i32* %8
%34 = mul i32 4, %33
%35 = add i32 %34, 2
%36 = zext i32 %35 to i64
%37 = getelementptr inbounds [16 x i8], [16 x i8]* %9, i64 0, i64 %36
store i8 %32, i8* %37
%38 = load i8*, i8** %4
%39 = getelementptr inbounds i8, i8* %38, i32 1
store i8* %39, i8** %4
%40 = load i8, i8* %38
%41 = load i32, i32* %8
%42 = mul i32 4, %41
%43 = add i32 %42, 3
%44 = zext i32 %43 to i64
%45 = getelementptr inbounds [16 x i8], [16 x i8]* %9, i64 0, i64 %44
store i8 %40, i8* %45
br label %46
46: ; preds = %13
%47 = load i32, i32* %8
%48 = add i32 %47, 1
store i32 %48, i32* %8
br label %10
49: ; preds = %10
%50 = getelementptr inbounds [16 x i8], [16 x i8]* %9, i64 0, i64 0
%51 = bitcast i8* %50 to i32*
%52 = load i8*, i8** %5
%53 = bitcast i8* %52 to i32*
%54 = call i32 @AddRoundKey(i32* %51, i32* %53)
store i32 1, i32* %7
br label %55
55: ; preds = %77, %49
%56 = load i32, i32* %7
%57 = icmp ult i32 %56, 11
br i1 %57, label %58, label %80
58: ; preds = %55
%59 = load i32, i32* %7
%60 = icmp ult i32 %59, 10
br i1 %60, label %61, label %64
61: ; preds = %58
%62 = getelementptr inbounds [16 x i8], [16 x i8]* %9, i64 0, i64 0
%63 = call i32 @MixSubColumns(i8* %62)
br label %67
64: ; preds = %58
%65 = getelementptr inbounds [16 x i8], [16 x i8]* %9, i64 0, i64 0
%66 = call i32 @ShiftRows(i8* %65)
br label %67
67: ; preds = %64, %61
%68 = getelementptr inbounds [16 x i8], [16 x i8]* %9, i64 0, i64 0
%69 = bitcast i8* %68 to i32*
%70 = load i8*, i8** %5
%71 = bitcast i8* %70 to i32*
%72 = load i32, i32* %7
%73 = mul i32 %72, 4
%74 = zext i32 %73 to i64
%75 = getelementptr inbounds i32, i32* %71, i64 %74
%76 = call i32 @AddRoundKey(i32* %69, i32* %75)
br label %77
77: ; preds = %67
%78 = load i32, i32* %7
%79 = add i32 %78, 1
store i32 %79, i32* %7
br label %55
80: ; preds = %55
store i32 0, i32* %8
br label %81
81: ; preds = %117, %80
%82 = load i32, i32* %8
%83 = icmp ult i32 %82, 4
br i1 %83, label %84, label %120
84: ; preds = %81
%85 = load i32, i32* %8
%86 = mul i32 4, %85
%87 = add i32 %86, 0
%88 = zext i32 %87 to i64
%89 = getelementptr inbounds [16 x i8], [16 x i8]* %9, i64 0, i64 %88
%90 = load i8, i8* %89
%91 = load i8*, i8** %6
%92 = getelementptr inbounds i8, i8* %91, i32 1
store i8* %92, i8** %6
store i8 %90, i8* %91
%93 = load i32, i32* %8
%94 = mul i32 4, %93
%95 = add i32 %94, 1
%96 = zext i32 %95 to i64
%97 = getelementptr inbounds [16 x i8], [16 x i8]* %9, i64 0, i64 %96
%98 = load i8, i8* %97
%99 = load i8*, i8** %6
%100 = getelementptr inbounds i8, i8* %99, i32 1
store i8* %100, i8** %6
store i8 %98, i8* %99
%101 = load i32, i32* %8
%102 = mul i32 4, %101
%103 = add i32 %102, 2
%104 = zext i32 %103 to i64
%105 = getelementptr inbounds [16 x i8], [16 x i8]* %9, i64 0, i64 %104
%106 = load i8, i8* %105
%107 = load i8*, i8** %6
%108 = getelementptr inbounds i8, i8* %107, i32 1
store i8* %108, i8** %6
store i8 %106, i8* %107
%109 = load i32, i32* %8
%110 = mul i32 4, %109
%111 = add i32 %110, 3
%112 = zext i32 %111 to i64
%113 = getelementptr inbounds [16 x i8], [16 x i8]* %9, i64 0, i64 %112
%114 = load i8, i8* %113
%115 = load i8*, i8** %6
%116 = getelementptr inbounds i8, i8* %115, i32 1
store i8* %116, i8** %6
store i8 %114, i8* %115
br label %117
117: ; preds = %84
%118 = load i32, i32* %8
%119 = add i32 %118, 1
store i32 %119, i32* %8
br label %81
120: ; preds = %81
ret void
}

LLVM IR (-O2):
define void @Encrypt(i8* nocapture %0, i8* %1, i8* nocapture writeonly %2) {
%4 = alloca <16 x i8>
%5 = getelementptr inbounds <16 x i8>, <16 x i8>* %4, i64 0, i64 0
%6 = bitcast i8* %0 to <16 x i8>*
%7 = load <16 x i8>, <16 x i8>* %6
store <16 x i8> %7, <16 x i8>* %4
%8 = bitcast <16 x i8>* %4 to i32*
%9 = bitcast i8* %1 to i32*
%10 = call i32 @AddRoundKey(i32* %8, i32* %9)
%11 = call i32 @MixSubColumns(i8* %5)
%12 = getelementptr inbounds i8, i8* %1, i64 16
%13 = bitcast i8* %12 to i32*
%14 = call i32 @AddRoundKey(i32* %8, i32* %13)
%15 = call i32 @MixSubColumns(i8* %5)
%16 = getelementptr inbounds i8, i8* %1, i64 32
%17 = bitcast i8* %16 to i32*
%18 = call i32 @AddRoundKey(i32* %8, i32* %17)
%19 = call i32 @MixSubColumns(i8* %5)
%20 = getelementptr inbounds i8, i8* %1, i64 48
%21 = bitcast i8* %20 to i32*
%22 = call i32 @AddRoundKey(i32* %8, i32* %21)
%23 = call i32 @MixSubColumns(i8* %5)
%24 = getelementptr inbounds i8, i8* %1, i64 64
%25 = bitcast i8* %24 to i32*
%26 = call i32 @AddRoundKey(i32* %8, i32* %25)
%27 = call i32 @MixSubColumns(i8* %5)
%28 = getelementptr inbounds i8, i8* %1, i64 80
%29 = bitcast i8* %28 to i32*
%30 = call i32 @AddRoundKey(i32* %8, i32* %29)
%31 = call i32 @MixSubColumns(i8* %5)
%32 = getelementptr inbounds i8, i8* %1, i64 96
%33 = bitcast i8* %32 to i32*
%34 = call i32 @AddRoundKey(i32* %8, i32* %33)
%35 = call i32 @MixSubColumns(i8* %5)
%36 = getelementptr inbounds i8, i8* %1, i64 112
%37 = bitcast i8* %36 to i32*
%38 = call i32 @AddRoundKey(i32* %8, i32* %37)
%39 = call i32 @MixSubColumns(i8* %5)
%40 = getelementptr inbounds i8, i8* %1, i64 128
%41 = bitcast i8* %40 to i32*
%42 = call i32 @AddRoundKey(i32* %8, i32* %41)
%43 = call i32 @MixSubColumns(i8* %5)
%44 = getelementptr inbounds i8, i8* %1, i64 144
%45 = bitcast i8* %44 to i32*
%46 = call i32 @AddRoundKey(i32* %8, i32* %45)
%47 = call i32 @ShiftRows(i8* %5)
%48 = getelementptr inbounds i8, i8* %1, i64 160
%49 = bitcast i8* %48 to i32*
%50 = call i32 @AddRoundKey(i32* %8, i32* %49)
%51 = load <16 x i8>, <16 x i8>* %4
%52 = bitcast i8* %2 to <16 x i8>*
store <16 x i8> %51, <16 x i8>* %52
ret void
}