#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 char **, int);
int /*<<< orphan*/ ByteSub(unsigned char **);
int /*<<< orphan*/ MixColumn(unsigned char **);
int /*<<< orphan*/ ShiftRow(unsigned char **);
void Encrypt128(unsigned char State[4][4]) {
  int i;
  AddRoundKey(State, 0);
  for (i = 1; i <= 9; i++) {
    ByteSub(State);
    ShiftRow(State);
    MixColumn(State);
    AddRoundKey(State, i);
  }
  ByteSub(State);
  ShiftRow(State);
  AddRoundKey(State, 10);
}


x86 assembly (clang, -O0):
<Encrypt128>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <AddRoundKey@plt>
movl   $0x1,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jg     119d <Encrypt128+0x5d>
mov    -0x8(%rbp),%rdi
call   1050 <ByteSub@plt>
mov    -0x8(%rbp),%rdi
call   1040 <ShiftRow@plt>
mov    -0x8(%rbp),%rdi
call   1060 <MixColumn@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <AddRoundKey@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115e <Encrypt128+0x1e>
mov    -0x8(%rbp),%rdi
call   1050 <ByteSub@plt>
mov    -0x8(%rbp),%rdi
call   1040 <ShiftRow@plt>
mov    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1030 <AddRoundKey@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Encrypt128>:
push   %rbx
mov    %rdi,%rbx
xor    %esi,%esi
call   1030 <AddRoundKey@plt>
mov    %rbx,%rdi
call   1050 <ByteSub@plt>
mov    %rbx,%rdi
call   1040 <ShiftRow@plt>
mov    %rbx,%rdi
call   1060 <MixColumn@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <AddRoundKey@plt>
mov    %rbx,%rdi
call   1050 <ByteSub@plt>
mov    %rbx,%rdi
call   1040 <ShiftRow@plt>
mov    %rbx,%rdi
call   1060 <MixColumn@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
call   1030 <AddRoundKey@plt>
mov    %rbx,%rdi
call   1050 <ByteSub@plt>
mov    %rbx,%rdi
call   1040 <ShiftRow@plt>
mov    %rbx,%rdi
call   1060 <MixColumn@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1030 <AddRoundKey@plt>
mov    %rbx,%rdi
call   1050 <ByteSub@plt>
mov    %rbx,%rdi
call   1040 <ShiftRow@plt>
mov    %rbx,%rdi
call   1060 <MixColumn@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1030 <AddRoundKey@plt>
mov    %rbx,%rdi
call   1050 <ByteSub@plt>
mov    %rbx,%rdi
call   1040 <ShiftRow@plt>
mov    %rbx,%rdi
call   1060 <MixColumn@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
call   1030 <AddRoundKey@plt>
mov    %rbx,%rdi
call   1050 <ByteSub@plt>
mov    %rbx,%rdi
call   1040 <ShiftRow@plt>
mov    %rbx,%rdi
call   1060 <MixColumn@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1030 <AddRoundKey@plt>
mov    %rbx,%rdi
call   1050 <ByteSub@plt>
mov    %rbx,%rdi
call   1040 <ShiftRow@plt>
mov    %rbx,%rdi
call   1060 <MixColumn@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
call   1030 <AddRoundKey@plt>
mov    %rbx,%rdi
call   1050 <ByteSub@plt>
mov    %rbx,%rdi
call   1040 <ShiftRow@plt>
mov    %rbx,%rdi
call   1060 <MixColumn@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
call   1030 <AddRoundKey@plt>
mov    %rbx,%rdi
call   1050 <ByteSub@plt>
mov    %rbx,%rdi
call   1040 <ShiftRow@plt>
mov    %rbx,%rdi
call   1060 <MixColumn@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
call   1030 <AddRoundKey@plt>
mov    %rbx,%rdi
call   1050 <ByteSub@plt>
mov    %rbx,%rdi
call   1040 <ShiftRow@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
pop    %rbx
jmp    1030 <AddRoundKey@plt>

LLVM IR (-O0):
define void @Encrypt128([4 x i8]* %0) {
%2 = alloca [4 x i8]*
%3 = alloca i32
store [4 x i8]* %0, [4 x i8]** %2
%4 = load [4 x i8]*, [4 x i8]** %2
%5 = bitcast [4 x i8]* %4 to i8**
%6 = call i32 @AddRoundKey(i8** %5, i32 0)
store i32 1, i32* %3
br label %7
7: ; preds = %24, %1
%8 = load i32, i32* %3
%9 = icmp sle i32 %8, 9
br i1 %9, label %10, label %27
10: ; preds = %7
%11 = load [4 x i8]*, [4 x i8]** %2
%12 = bitcast [4 x i8]* %11 to i8**
%13 = call i32 @ByteSub(i8** %12)
%14 = load [4 x i8]*, [4 x i8]** %2
%15 = bitcast [4 x i8]* %14 to i8**
%16 = call i32 @ShiftRow(i8** %15)
%17 = load [4 x i8]*, [4 x i8]** %2
%18 = bitcast [4 x i8]* %17 to i8**
%19 = call i32 @MixColumn(i8** %18)
%20 = load [4 x i8]*, [4 x i8]** %2
%21 = bitcast [4 x i8]* %20 to i8**
%22 = load i32, i32* %3
%23 = call i32 @AddRoundKey(i8** %21, i32 %22)
br label %24
24: ; preds = %10
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 1
store i32 %26, i32* %3
br label %7
27: ; preds = %7
%28 = load [4 x i8]*, [4 x i8]** %2
%29 = bitcast [4 x i8]* %28 to i8**
%30 = call i32 @ByteSub(i8** %29)
%31 = load [4 x i8]*, [4 x i8]** %2
%32 = bitcast [4 x i8]* %31 to i8**
%33 = call i32 @ShiftRow(i8** %32)
%34 = load [4 x i8]*, [4 x i8]** %2
%35 = bitcast [4 x i8]* %34 to i8**
%36 = call i32 @AddRoundKey(i8** %35, i32 10)
ret void
}

LLVM IR (-O2):
define void @Encrypt128([4 x i8]* %0) {
%2 = bitcast [4 x i8]* %0 to i8**
%3 = tail call i32 @AddRoundKey(i8** %2, i32 0)
%4 = tail call i32 @ByteSub(i8** %2)
%5 = tail call i32 @ShiftRow(i8** %2)
%6 = tail call i32 @MixColumn(i8** %2)
%7 = tail call i32 @AddRoundKey(i8** %2, i32 1)
%8 = tail call i32 @ByteSub(i8** %2)
%9 = tail call i32 @ShiftRow(i8** %2)
%10 = tail call i32 @MixColumn(i8** %2)
%11 = tail call i32 @AddRoundKey(i8** %2, i32 2)
%12 = tail call i32 @ByteSub(i8** %2)
%13 = tail call i32 @ShiftRow(i8** %2)
%14 = tail call i32 @MixColumn(i8** %2)
%15 = tail call i32 @AddRoundKey(i8** %2, i32 3)
%16 = tail call i32 @ByteSub(i8** %2)
%17 = tail call i32 @ShiftRow(i8** %2)
%18 = tail call i32 @MixColumn(i8** %2)
%19 = tail call i32 @AddRoundKey(i8** %2, i32 4)
%20 = tail call i32 @ByteSub(i8** %2)
%21 = tail call i32 @ShiftRow(i8** %2)
%22 = tail call i32 @MixColumn(i8** %2)
%23 = tail call i32 @AddRoundKey(i8** %2, i32 5)
%24 = tail call i32 @ByteSub(i8** %2)
%25 = tail call i32 @ShiftRow(i8** %2)
%26 = tail call i32 @MixColumn(i8** %2)
%27 = tail call i32 @AddRoundKey(i8** %2, i32 6)
%28 = tail call i32 @ByteSub(i8** %2)
%29 = tail call i32 @ShiftRow(i8** %2)
%30 = tail call i32 @MixColumn(i8** %2)
%31 = tail call i32 @AddRoundKey(i8** %2, i32 7)
%32 = tail call i32 @ByteSub(i8** %2)
%33 = tail call i32 @ShiftRow(i8** %2)
%34 = tail call i32 @MixColumn(i8** %2)
%35 = tail call i32 @AddRoundKey(i8** %2, i32 8)
%36 = tail call i32 @ByteSub(i8** %2)
%37 = tail call i32 @ShiftRow(i8** %2)
%38 = tail call i32 @MixColumn(i8** %2)
%39 = tail call i32 @AddRoundKey(i8** %2, i32 9)
%40 = tail call i32 @ByteSub(i8** %2)
%41 = tail call i32 @ShiftRow(i8** %2)
%42 = tail call i32 @AddRoundKey(i8** %2, i32 10)
ret void
}