#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 *const, unsigned char const *);
int /*<<< orphan*/ mixColumns(unsigned char *const);
int /*<<< orphan*/ shiftRows(unsigned char *const);
int /*<<< orphan*/ subBytes(unsigned char *const, int);
void encryptBlock(unsigned char *const block,
                  const unsigned char *const expandedKey) {
  int keyIndex = 0;
  int i;
  addRoundKey(block, &expandedKey[(keyIndex++) * 16]);
  for (i = 0; i < 9; i++) {
    subBytes(block, 16);
    shiftRows(block);
    mixColumns(block);
    addRoundKey(block, &expandedKey[(keyIndex++) * 16]);
  }
  subBytes(block, 16);
  shiftRows(block);
  addRoundKey(block, &expandedKey[(keyIndex++) * 16]);
}


x86 assembly (clang, -O0):
<encryptBlock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
shl    $0x4,%eax
cltq
add    %rax,%rsi
call   1050 <addRoundKey@plt>
movl   $0x0,-0x18(%rbp)
cmpl   $0x9,-0x18(%rbp)
jge    11d6 <encryptBlock+0x96>
mov    -0x8(%rbp),%rdi
mov    $0x10,%esi
call   1040 <subBytes@plt>
mov    -0x8(%rbp),%rdi
call   1030 <shiftRows@plt>
mov    -0x8(%rbp),%rdi
call   1060 <mixColumns@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
shl    $0x4,%eax
cltq
add    %rax,%rsi
call   1050 <addRoundKey@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    117e <encryptBlock+0x3e>
mov    -0x8(%rbp),%rdi
mov    $0x10,%esi
call   1040 <subBytes@plt>
mov    -0x8(%rbp),%rdi
call   1030 <shiftRows@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
shl    $0x4,%eax
cltq
add    %rax,%rsi
call   1050 <addRoundKey@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<encryptBlock>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1050 <addRoundKey@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1040 <subBytes@plt>
mov    %rbx,%rdi
call   1030 <shiftRows@plt>
mov    %rbx,%rdi
call   1060 <mixColumns@plt>
lea    0x10(%r14),%rsi
mov    %rbx,%rdi
call   1050 <addRoundKey@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1040 <subBytes@plt>
mov    %rbx,%rdi
call   1030 <shiftRows@plt>
mov    %rbx,%rdi
call   1060 <mixColumns@plt>
lea    0x20(%r14),%rsi
mov    %rbx,%rdi
call   1050 <addRoundKey@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1040 <subBytes@plt>
mov    %rbx,%rdi
call   1030 <shiftRows@plt>
mov    %rbx,%rdi
call   1060 <mixColumns@plt>
lea    0x30(%r14),%rsi
mov    %rbx,%rdi
call   1050 <addRoundKey@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1040 <subBytes@plt>
mov    %rbx,%rdi
call   1030 <shiftRows@plt>
mov    %rbx,%rdi
call   1060 <mixColumns@plt>
lea    0x40(%r14),%rsi
mov    %rbx,%rdi
call   1050 <addRoundKey@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1040 <subBytes@plt>
mov    %rbx,%rdi
call   1030 <shiftRows@plt>
mov    %rbx,%rdi
call   1060 <mixColumns@plt>
lea    0x50(%r14),%rsi
mov    %rbx,%rdi
call   1050 <addRoundKey@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1040 <subBytes@plt>
mov    %rbx,%rdi
call   1030 <shiftRows@plt>
mov    %rbx,%rdi
call   1060 <mixColumns@plt>
lea    0x60(%r14),%rsi
mov    %rbx,%rdi
call   1050 <addRoundKey@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1040 <subBytes@plt>
mov    %rbx,%rdi
call   1030 <shiftRows@plt>
mov    %rbx,%rdi
call   1060 <mixColumns@plt>
lea    0x70(%r14),%rsi
mov    %rbx,%rdi
call   1050 <addRoundKey@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1040 <subBytes@plt>
mov    %rbx,%rdi
call   1030 <shiftRows@plt>
mov    %rbx,%rdi
call   1060 <mixColumns@plt>
lea    0x80(%r14),%rsi
mov    %rbx,%rdi
call   1050 <addRoundKey@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1040 <subBytes@plt>
mov    %rbx,%rdi
call   1030 <shiftRows@plt>
mov    %rbx,%rdi
call   1060 <mixColumns@plt>
lea    0x90(%r14),%rsi
mov    %rbx,%rdi
call   1050 <addRoundKey@plt>
mov    %rbx,%rdi
mov    $0x10,%esi
call   1040 <subBytes@plt>
mov    %rbx,%rdi
call   1030 <shiftRows@plt>
add    $0xa0,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <addRoundKey@plt>

LLVM IR (-O0):
define void @encryptBlock(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
store i32 0, i32* %5
%7 = load i8*, i8** %3
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = add nsw i32 %9, 1
store i32 %10, i32* %5
%11 = mul nsw i32 %9, 16
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %8, i64 %12
%14 = call i32 @addRoundKey(i8* %7, i8* %13)
store i32 0, i32* %6
br label %15
15: ; preds = %33, %2
%16 = load i32, i32* %6
%17 = icmp slt i32 %16, 9
br i1 %17, label %18, label %36
18: ; preds = %15
%19 = load i8*, i8** %3
%20 = call i32 @subBytes(i8* %19, i32 16)
%21 = load i8*, i8** %3
%22 = call i32 @shiftRows(i8* %21)
%23 = load i8*, i8** %3
%24 = call i32 @mixColumns(i8* %23)
%25 = load i8*, i8** %3
%26 = load i8*, i8** %4
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
%29 = mul nsw i32 %27, 16
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i8, i8* %26, i64 %30
%32 = call i32 @addRoundKey(i8* %25, i8* %31)
br label %33
33: ; preds = %18
%34 = load i32, i32* %6
%35 = add nsw i32 %34, 1
store i32 %35, i32* %6
br label %15
36: ; preds = %15
%37 = load i8*, i8** %3
%38 = call i32 @subBytes(i8* %37, i32 16)
%39 = load i8*, i8** %3
%40 = call i32 @shiftRows(i8* %39)
%41 = load i8*, i8** %3
%42 = load i8*, i8** %4
%43 = load i32, i32* %5
%44 = add nsw i32 %43, 1
store i32 %44, i32* %5
%45 = mul nsw i32 %43, 16
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %42, i64 %46
%48 = call i32 @addRoundKey(i8* %41, i8* %47)
ret void
}

LLVM IR (-O2):
define void @encryptBlock(i8* %0, i8* %1) {
%3 = tail call i32 @addRoundKey(i8* %0, i8* %1)
%4 = tail call i32 @subBytes(i8* %0, i32 16)
%5 = tail call i32 @shiftRows(i8* %0)
%6 = tail call i32 @mixColumns(i8* %0)
%7 = getelementptr inbounds i8, i8* %1, i64 16
%8 = tail call i32 @addRoundKey(i8* %0, i8* %7)
%9 = tail call i32 @subBytes(i8* %0, i32 16)
%10 = tail call i32 @shiftRows(i8* %0)
%11 = tail call i32 @mixColumns(i8* %0)
%12 = getelementptr inbounds i8, i8* %1, i64 32
%13 = tail call i32 @addRoundKey(i8* %0, i8* %12)
%14 = tail call i32 @subBytes(i8* %0, i32 16)
%15 = tail call i32 @shiftRows(i8* %0)
%16 = tail call i32 @mixColumns(i8* %0)
%17 = getelementptr inbounds i8, i8* %1, i64 48
%18 = tail call i32 @addRoundKey(i8* %0, i8* %17)
%19 = tail call i32 @subBytes(i8* %0, i32 16)
%20 = tail call i32 @shiftRows(i8* %0)
%21 = tail call i32 @mixColumns(i8* %0)
%22 = getelementptr inbounds i8, i8* %1, i64 64
%23 = tail call i32 @addRoundKey(i8* %0, i8* %22)
%24 = tail call i32 @subBytes(i8* %0, i32 16)
%25 = tail call i32 @shiftRows(i8* %0)
%26 = tail call i32 @mixColumns(i8* %0)
%27 = getelementptr inbounds i8, i8* %1, i64 80
%28 = tail call i32 @addRoundKey(i8* %0, i8* %27)
%29 = tail call i32 @subBytes(i8* %0, i32 16)
%30 = tail call i32 @shiftRows(i8* %0)
%31 = tail call i32 @mixColumns(i8* %0)
%32 = getelementptr inbounds i8, i8* %1, i64 96
%33 = tail call i32 @addRoundKey(i8* %0, i8* %32)
%34 = tail call i32 @subBytes(i8* %0, i32 16)
%35 = tail call i32 @shiftRows(i8* %0)
%36 = tail call i32 @mixColumns(i8* %0)
%37 = getelementptr inbounds i8, i8* %1, i64 112
%38 = tail call i32 @addRoundKey(i8* %0, i8* %37)
%39 = tail call i32 @subBytes(i8* %0, i32 16)
%40 = tail call i32 @shiftRows(i8* %0)
%41 = tail call i32 @mixColumns(i8* %0)
%42 = getelementptr inbounds i8, i8* %1, i64 128
%43 = tail call i32 @addRoundKey(i8* %0, i8* %42)
%44 = tail call i32 @subBytes(i8* %0, i32 16)
%45 = tail call i32 @shiftRows(i8* %0)
%46 = tail call i32 @mixColumns(i8* %0)
%47 = getelementptr inbounds i8, i8* %1, i64 144
%48 = tail call i32 @addRoundKey(i8* %0, i8* %47)
%49 = tail call i32 @subBytes(i8* %0, i32 16)
%50 = tail call i32 @shiftRows(i8* %0)
%51 = getelementptr inbounds i8, i8* %1, i64 160
%52 = tail call i32 @addRoundKey(i8* %0, i8* %51)
ret void
}