#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 */
unsigned char getSBoxValue(unsigned char);
void AES_KeyExpansion(int Nk, int Nr, unsigned char *RoundKey,
                      unsigned char *Key) {
  int Rcon[255] = {
      0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c,
      0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a,
      0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd,
      0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a,
      0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
      0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6,
      0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72,
      0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc,
      0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10,
      0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e,
      0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5,
      0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94,
      0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02,
      0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d,
      0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d,
      0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f,
      0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb,
      0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c,
      0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a,
      0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd,
      0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a,
      0x74, 0xe8, 0xcb};
  int i, j;
  unsigned char temp[4], k;
  for (i = 0; i < Nk; i++) {
    RoundKey[i * 4] = Key[i * 4];
    RoundKey[i * 4 + 1] = Key[i * 4 + 1];
    RoundKey[i * 4 + 2] = Key[i * 4 + 2];
    RoundKey[i * 4 + 3] = Key[i * 4 + 3];
  }
  while (i < (4 * (Nr + 1))) {
    for (j = 0; j < 4; j++) {
      temp[j] = RoundKey[(i - 1) * 4 + j];
    }
    if (i % Nk == 0) {
      k = temp[0];
      temp[0] = temp[1];
      temp[1] = temp[2];
      temp[2] = temp[3];
      temp[3] = k;
      temp[0] = getSBoxValue(temp[0]);
      temp[1] = getSBoxValue(temp[1]);
      temp[2] = getSBoxValue(temp[2]);
      temp[3] = getSBoxValue(temp[3]);
      temp[0] = temp[0] ^ Rcon[i / Nk];
    } else if (Nk > 6 && i % Nk == 4) {
      temp[0] = getSBoxValue(temp[0]);
      temp[1] = getSBoxValue(temp[1]);
      temp[2] = getSBoxValue(temp[2]);
      temp[3] = getSBoxValue(temp[3]);
    }
    RoundKey[i * 4] = RoundKey[(i - Nk) * 4] ^ temp[0];
    RoundKey[i * 4 + 1] = RoundKey[(i - Nk) * 4 + 1] ^ temp[1];
    RoundKey[i * 4 + 2] = RoundKey[(i - Nk) * 4 + 2] ^ temp[2];
    RoundKey[i * 4 + 3] = RoundKey[(i - Nk) * 4 + 3] ^ temp[3];
    i++;
  }
  return;
}


x86 assembly (clang, -O0):
<AES_KeyExpansion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
lea    -0x420(%rbp),%rdi
lea    0xeb9(%rip),%rsi
mov    $0x3fc,%edx
call   1040 <memcpy@plt>
movl   $0x0,-0x424(%rbp)
mov    -0x424(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1228 <AES_KeyExpansion+0x108>
mov    -0x18(%rbp),%rax
mov    -0x424(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
mov    -0x424(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x424(%rbp),%ecx
shl    $0x2,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
mov    -0x424(%rbp),%ecx
shl    $0x2,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x424(%rbp),%ecx
shl    $0x2,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
mov    -0x424(%rbp),%ecx
shl    $0x2,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
mov    -0x424(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
mov    -0x424(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x424(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x424(%rbp)
jmp    115b <AES_KeyExpansion+0x3b>
jmp    122d <AES_KeyExpansion+0x10d>
mov    -0x424(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
shl    $0x2,%ecx
cmp    %ecx,%eax
jge    14c8 <AES_KeyExpansion+0x3a8>
movl   $0x0,-0x428(%rbp)
cmpl   $0x4,-0x428(%rbp)
jge    1299 <AES_KeyExpansion+0x179>
mov    -0x10(%rbp),%rax
mov    -0x424(%rbp),%ecx
sub    $0x1,%ecx
shl    $0x2,%ecx
add    -0x428(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%cl
movslq -0x428(%rbp),%rax
mov    %cl,-0x42c(%rbp,%rax,1)
mov    -0x428(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x428(%rbp)
jmp    124e <AES_KeyExpansion+0x12e>
mov    -0x424(%rbp),%eax
cltd
idivl  -0x4(%rbp)
cmp    $0x0,%edx
jne    1364 <AES_KeyExpansion+0x244>
mov    -0x42c(%rbp),%al
mov    %al,-0x42d(%rbp)
mov    -0x42b(%rbp),%al
mov    %al,-0x42c(%rbp)
mov    -0x42a(%rbp),%al
mov    %al,-0x42b(%rbp)
mov    -0x429(%rbp),%al
mov    %al,-0x42a(%rbp)
mov    -0x42d(%rbp),%al
mov    %al,-0x429(%rbp)
movzbl -0x42c(%rbp),%edi
call   1030 <getSBoxValue@plt>
mov    %al,-0x42c(%rbp)
movzbl -0x42b(%rbp),%edi
call   1030 <getSBoxValue@plt>
mov    %al,-0x42b(%rbp)
movzbl -0x42a(%rbp),%edi
call   1030 <getSBoxValue@plt>
mov    %al,-0x42a(%rbp)
movzbl -0x429(%rbp),%edi
call   1030 <getSBoxValue@plt>
mov    %al,-0x429(%rbp)
movzbl -0x42c(%rbp),%eax
mov    %eax,-0x434(%rbp)
mov    -0x424(%rbp),%eax
cltd
idivl  -0x4(%rbp)
mov    %eax,%ecx
mov    -0x434(%rbp),%eax
movslq %ecx,%rcx
xor    -0x420(%rbp,%rcx,4),%eax
mov    %al,-0x42c(%rbp)
jmp    13ce <AES_KeyExpansion+0x2ae>
cmpl   $0x6,-0x4(%rbp)
jle    13c9 <AES_KeyExpansion+0x2a9>
mov    -0x424(%rbp),%eax
cltd
idivl  -0x4(%rbp)
cmp    $0x4,%edx
jne    13c9 <AES_KeyExpansion+0x2a9>
movzbl -0x42c(%rbp),%edi
call   1030 <getSBoxValue@plt>
mov    %al,-0x42c(%rbp)
movzbl -0x42b(%rbp),%edi
call   1030 <getSBoxValue@plt>
mov    %al,-0x42b(%rbp)
movzbl -0x42a(%rbp),%edi
call   1030 <getSBoxValue@plt>
mov    %al,-0x42a(%rbp)
movzbl -0x429(%rbp),%edi
call   1030 <getSBoxValue@plt>
mov    %al,-0x429(%rbp)
jmp    13ce <AES_KeyExpansion+0x2ae>
mov    -0x10(%rbp),%rax
mov    -0x424(%rbp),%ecx
sub    -0x4(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
movzbl -0x42c(%rbp),%ecx
xor    %ecx,%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
mov    -0x424(%rbp),%ecx
shl    $0x2,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    -0x424(%rbp),%ecx
sub    -0x4(%rbp),%ecx
shl    $0x2,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
movzbl -0x42b(%rbp),%ecx
xor    %ecx,%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
mov    -0x424(%rbp),%ecx
shl    $0x2,%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    -0x424(%rbp),%ecx
sub    -0x4(%rbp),%ecx
shl    $0x2,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
movzbl -0x42a(%rbp),%ecx
xor    %ecx,%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
mov    -0x424(%rbp),%ecx
shl    $0x2,%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%rax
mov    -0x424(%rbp),%ecx
sub    -0x4(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movzbl (%rax,%rcx,1),%eax
movzbl -0x429(%rbp),%ecx
xor    %ecx,%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
mov    -0x424(%rbp),%ecx
shl    $0x2,%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x424(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x424(%rbp)
jmp    122d <AES_KeyExpansion+0x10d>
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AES_KeyExpansion>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,%rbx
test   %edi,%edi
jle    1160 <AES_KeyExpansion+0x50>
mov    %edi,%ebp
xor    %edx,%edx
nopl   0x0(%rax)
movzbl (%rcx,%rdx,4),%eax
mov    %al,(%rbx,%rdx,4)
movzbl 0x1(%rcx,%rdx,4),%eax
mov    %al,0x1(%rbx,%rdx,4)
movzbl 0x2(%rcx,%rdx,4),%eax
mov    %al,0x2(%rbx,%rdx,4)
movzbl 0x3(%rcx,%rdx,4),%eax
mov    %al,0x3(%rbx,%rdx,4)
add    $0x1,%rdx
cmp    %rdx,%rbp
jne    1130 <AES_KeyExpansion+0x20>
mov    %edi,%r15d
jmp    1163 <AES_KeyExpansion+0x53>
xor    %r15d,%r15d
lea    0x4(,%rsi,4),%eax
mov    %eax,0x14(%rsp)
cmp    %r15d,%eax
jle    12ca <AES_KeyExpansion+0x1ba>
lea    0x0(,%r15,4),%ebp
lea    0x0(,%rdi,4),%eax
neg    %eax
mov    %rax,0x20(%rsp)
mov    %rdi,0x18(%rsp)
jmp    1250 <AES_KeyExpansion+0x140>
nopw   0x0(%rax,%rax,1)
movzbl %r13b,%edi
mov    %sil,0xe(%rsp)
mov    %eax,0x10(%rsp)
call   1030 <getSBoxValue@plt>
mov    %al,0xf(%rsp)
movzbl %r12b,%edi
call   1030 <getSBoxValue@plt>
mov    %eax,%r13d
movzbl 0xe(%rsp),%edi
call   1030 <getSBoxValue@plt>
mov    %eax,%r12d
movzbl %r14b,%edi
call   1030 <getSBoxValue@plt>
mov    0x18(%rsp),%rdi
mov    %eax,%esi
movslq 0x10(%rsp),%rax
lea    0xe15(%rip),%rcx
movzbl 0xf(%rsp),%r14d
xor    (%rcx,%rax,4),%r14b
mov    0x20(%rsp),%rcx
lea    (%rcx,%rbp,1),%eax
cltq
xor    (%rbx,%rax,1),%r14b
mov    %ebp,%eax
mov    %r14b,(%rbx,%rax,1)
lea    (%rcx,%rbp,1),%eax
add    $0x1,%eax
cltq
xor    (%rbx,%rax,1),%r13b
lea    0x1(%rbp),%eax
mov    %r13b,(%rbx,%rax,1)
lea    (%rcx,%rbp,1),%eax
add    $0x2,%eax
cltq
xor    (%rbx,%rax,1),%r12b
lea    0x2(%rbp),%eax
mov    %r12b,(%rbx,%rax,1)
lea    (%rcx,%rbp,1),%eax
add    $0x3,%eax
cltq
xor    (%rbx,%rax,1),%sil
lea    0x3(%rbp),%eax
mov    %sil,(%rbx,%rax,1)
add    $0x4,%ebp
add    $0x1,%r15d
cmp    %r15d,0x14(%rsp)
je     12ca <AES_KeyExpansion+0x1ba>
lea    -0x4(%rbp),%eax
cltq
movzbl (%rbx,%rax,1),%r14d
movzbl 0x1(%rbx,%rax,1),%r13d
movzbl 0x2(%rbx,%rax,1),%r12d
movzbl 0x3(%rbx,%rax,1),%esi
mov    %r15d,%eax
cltd
idiv   %edi
test   %edx,%edx
je     11a0 <AES_KeyExpansion+0x90>
cmp    $0x7,%edi
jl     11f5 <AES_KeyExpansion+0xe5>
cmp    $0x4,%edx
jne    11f5 <AES_KeyExpansion+0xe5>
movzbl %r14b,%edi
mov    %sil,0xe(%rsp)
call   1030 <getSBoxValue@plt>
mov    %eax,%r14d
movzbl %r13b,%edi
call   1030 <getSBoxValue@plt>
mov    %eax,%r13d
movzbl %r12b,%edi
call   1030 <getSBoxValue@plt>
mov    %eax,%r12d
movzbl 0xe(%rsp),%edi
call   1030 <getSBoxValue@plt>
mov    0x18(%rsp),%rdi
mov    %eax,%esi
jmp    11f5 <AES_KeyExpansion+0xe5>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.AES_KeyExpansion.Rcon = [255 x i32] [i32 141, i32 1, i32 2, i32 4, i32 8, i32 16, i32 32, i32 64, i32 128, i32 27, i32 54, i32 108, i32 216, i32 171, i32 77, i32 154, i32 47, i32 94, i32 188, i32 99, i32 198, i32 151, i32 53, i32 106, i32 212, i32 179, i32 125, i32 250, i32 239, i32 197, i32 145, i32 57, i32 114, i32 228, i32 211, i32 189, i32 97, i32 194, i32 159, i32 37, i32 74, i32 148, i32 51, i32 102, i32 204, i32 131, i32 29, i32 58, i32 116, i32 232, i32 203, i32 141, i32 1, i32 2, i32 4, i32 8, i32 16, i32 32, i32 64, i32 128, i32 27, i32 54, i32 108, i32 216, i32 171, i32 77, i32 154, i32 47, i32 94, i32 188, i32 99, i32 198, i32 151, i32 53, i32 106, i32 212, i32 179, i32 125, i32 250, i32 239, i32 197, i32 145, i32 57, i32 114, i32 228, i32 211, i32 189, i32 97, i32 194, i32 159, i32 37, i32 74, i32 148, i32 51, i32 102, i32 204, i32 131, i32 29, i32 58, i32 116, i32 232, i32 203, i32 141, i32 1, i32 2, i32 4, i32 8, i32 16, i32 32, i32 64, i32 128, i32 27, i32 54, i32 108, i32 216, i32 171, i32 77, i32 154, i32 47, i32 94, i32 188, i32 99, i32 198, i32 151, i32 53, i32 106, i32 212, i32 179, i32 125, i32 250, i32 239, i32 197, i32 145, i32 57, i32 114, i32 228, i32 211, i32 189, i32 97, i32 194, i32 159, i32 37, i32 74, i32 148, i32 51, i32 102, i32 204, i32 131, i32 29, i32 58, i32 116, i32 232, i32 203, i32 141, i32 1, i32 2, i32 4, i32 8, i32 16, i32 32, i32 64, i32 128, i32 27, i32 54, i32 108, i32 216, i32 171, i32 77, i32 154, i32 47, i32 94, i32 188, i32 99, i32 198, i32 151, i32 53, i32 106, i32 212, i32 179, i32 125, i32 250, i32 239, i32 197, i32 145, i32 57, i32 114, i32 228, i32 211, i32 189, i32 97, i32 194, i32 159, i32 37, i32 74, i32 148, i32 51, i32 102, i32 204, i32 131, i32 29, i32 58, i32 116, i32 232, i32 203, i32 141, i32 1, i32 2, i32 4, i32 8, i32 16, i32 32, i32 64, i32 128, i32 27, i32 54, i32 108, i32 216, i32 171, i32 77, i32 154, i32 47, i32 94, i32 188, i32 99, i32 198, i32 151, i32 53, i32 106, i32 212, i32 179, i32 125, i32 250, i32 239, i32 197, i32 145, i32 57, i32 114, i32 228, i32 211, i32 189, i32 97, i32 194, i32 159, i32 37, i32 74, i32 148, i32 51, i32 102, i32 204, i32 131, i32 29, i32 58, i32 116, i32 232, i32 203]
define void @AES_KeyExpansion(i32 %0, i32 %1, i8* %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [255 x i32]
%10 = alloca i32
%11 = alloca i32
%12 = alloca [4 x i8]
%13 = alloca i8
store i32 %0, i32* %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%14 = bitcast [255 x i32]* %9 to i8*
store i32 0, i32* %10
br label %15
15: ; preds = %70, %4
%16 = load i32, i32* %10
%17 = load i32, i32* %5
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %73
19: ; preds = %15
%20 = load i8*, i8** %8
%21 = load i32, i32* %10
%22 = mul nsw i32 %21, 4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %20, i64 %23
%25 = load i8, i8* %24
%26 = load i8*, i8** %7
%27 = load i32, i32* %10
%28 = mul nsw i32 %27, 4
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8, i8* %26, i64 %29
store i8 %25, i8* %30
%31 = load i8*, i8** %8
%32 = load i32, i32* %10
%33 = mul nsw i32 %32, 4
%34 = add nsw i32 %33, 1
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i8, i8* %31, i64 %35
%37 = load i8, i8* %36
%38 = load i8*, i8** %7
%39 = load i32, i32* %10
%40 = mul nsw i32 %39, 4
%41 = add nsw i32 %40, 1
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i8, i8* %38, i64 %42
store i8 %37, i8* %43
%44 = load i8*, i8** %8
%45 = load i32, i32* %10
%46 = mul nsw i32 %45, 4
%47 = add nsw i32 %46, 2
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8, i8* %44, i64 %48
%50 = load i8, i8* %49
%51 = load i8*, i8** %7
%52 = load i32, i32* %10
%53 = mul nsw i32 %52, 4
%54 = add nsw i32 %53, 2
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8, i8* %51, i64 %55
store i8 %50, i8* %56
%57 = load i8*, i8** %8
%58 = load i32, i32* %10
%59 = mul nsw i32 %58, 4
%60 = add nsw i32 %59, 3
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8, i8* %57, i64 %61
%63 = load i8, i8* %62
%64 = load i8*, i8** %7
%65 = load i32, i32* %10
%66 = mul nsw i32 %65, 4
%67 = add nsw i32 %66, 3
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds i8, i8* %64, i64 %68
store i8 %63, i8* %69
br label %70
70: ; preds = %19
%71 = load i32, i32* %10
%72 = add nsw i32 %71, 1
store i32 %72, i32* %10
br label %15
73: ; preds = %15
br label %74
74: ; preds = %173, %73
%75 = load i32, i32* %10
%76 = load i32, i32* %6
%77 = add nsw i32 %76, 1
%78 = mul nsw i32 4, %77
%79 = icmp slt i32 %75, %78
br i1 %79, label %80, label %258
80: ; preds = %74
store i32 0, i32* %11
br label %81
81: ; preds = %97, %80
%82 = load i32, i32* %11
%83 = icmp slt i32 %82, 4
br i1 %83, label %84, label %100
84: ; preds = %81
%85 = load i8*, i8** %7
%86 = load i32, i32* %10
%87 = sub nsw i32 %86, 1
%88 = mul nsw i32 %87, 4
%89 = load i32, i32* %11
%90 = add nsw i32 %88, %89
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds i8, i8* %85, i64 %91
%93 = load i8, i8* %92
%94 = load i32, i32* %11
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 %95
store i8 %93, i8* %96
br label %97
97: ; preds = %84
%98 = load i32, i32* %11
%99 = add nsw i32 %98, 1
store i32 %99, i32* %11
br label %81
100: ; preds = %81
%101 = load i32, i32* %10
%102 = load i32, i32* %5
%103 = srem i32 %101, %102
%104 = icmp eq i32 %103, 0
br i1 %104, label %105, label %147
105: ; preds = %100
%106 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 0
%107 = load i8, i8* %106
store i8 %107, i8* %13
%108 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 1
%109 = load i8, i8* %108
%110 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 0
store i8 %109, i8* %110
%111 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 2
%112 = load i8, i8* %111
%113 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 1
store i8 %112, i8* %113
%114 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 3
%115 = load i8, i8* %114
%116 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 2
store i8 %115, i8* %116
%117 = load i8, i8* %13
%118 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 3
store i8 %117, i8* %118
%119 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 0
%120 = load i8, i8* %119
%121 = call zeroext i8 @getSBoxValue(i8 zeroext %120)
%122 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 0
store i8 %121, i8* %122
%123 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 1
%124 = load i8, i8* %123
%125 = call zeroext i8 @getSBoxValue(i8 zeroext %124)
%126 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 1
store i8 %125, i8* %126
%127 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 2
%128 = load i8, i8* %127
%129 = call zeroext i8 @getSBoxValue(i8 zeroext %128)
%130 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 2
store i8 %129, i8* %130
%131 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 3
%132 = load i8, i8* %131
%133 = call zeroext i8 @getSBoxValue(i8 zeroext %132)
%134 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 3
store i8 %133, i8* %134
%135 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 0
%136 = load i8, i8* %135
%137 = zext i8 %136 to i32
%138 = load i32, i32* %10
%139 = load i32, i32* %5
%140 = sdiv i32 %138, %139
%141 = sext i32 %140 to i64
%142 = getelementptr inbounds [255 x i32], [255 x i32]* %9, i64 0, i64 %141
%143 = load i32, i32* %142
%144 = xor i32 %137, %143
%145 = trunc i32 %144 to i8
%146 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 0
store i8 %145, i8* %146
br label %173
147: ; preds = %100
%148 = load i32, i32* %5
%149 = icmp sgt i32 %148, 6
br i1 %149, label %150, label %172
150: ; preds = %147
%151 = load i32, i32* %10
%152 = load i32, i32* %5
%153 = srem i32 %151, %152
%154 = icmp eq i32 %153, 4
br i1 %154, label %155, label %172
155: ; preds = %150
%156 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 0
%157 = load i8, i8* %156
%158 = call zeroext i8 @getSBoxValue(i8 zeroext %157)
%159 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 0
store i8 %158, i8* %159
%160 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 1
%161 = load i8, i8* %160
%162 = call zeroext i8 @getSBoxValue(i8 zeroext %161)
%163 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 1
store i8 %162, i8* %163
%164 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 2
%165 = load i8, i8* %164
%166 = call zeroext i8 @getSBoxValue(i8 zeroext %165)
%167 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 2
store i8 %166, i8* %167
%168 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 3
%169 = load i8, i8* %168
%170 = call zeroext i8 @getSBoxValue(i8 zeroext %169)
%171 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 3
store i8 %170, i8* %171
br label %172
172: ; preds = %155, %150, %147
br label %173
173: ; preds = %172, %105
%174 = load i8*, i8** %7
%175 = load i32, i32* %10
%176 = load i32, i32* %5
%177 = sub nsw i32 %175, %176
%178 = mul nsw i32 %177, 4
%179 = sext i32 %178 to i64
%180 = getelementptr inbounds i8, i8* %174, i64 %179
%181 = load i8, i8* %180
%182 = zext i8 %181 to i32
%183 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 0
%184 = load i8, i8* %183
%185 = zext i8 %184 to i32
%186 = xor i32 %182, %185
%187 = trunc i32 %186 to i8
%188 = load i8*, i8** %7
%189 = load i32, i32* %10
%190 = mul nsw i32 %189, 4
%191 = sext i32 %190 to i64
%192 = getelementptr inbounds i8, i8* %188, i64 %191
store i8 %187, i8* %192
%193 = load i8*, i8** %7
%194 = load i32, i32* %10
%195 = load i32, i32* %5
%196 = sub nsw i32 %194, %195
%197 = mul nsw i32 %196, 4
%198 = add nsw i32 %197, 1
%199 = sext i32 %198 to i64
%200 = getelementptr inbounds i8, i8* %193, i64 %199
%201 = load i8, i8* %200
%202 = zext i8 %201 to i32
%203 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 1
%204 = load i8, i8* %203
%205 = zext i8 %204 to i32
%206 = xor i32 %202, %205
%207 = trunc i32 %206 to i8
%208 = load i8*, i8** %7
%209 = load i32, i32* %10
%210 = mul nsw i32 %209, 4
%211 = add nsw i32 %210, 1
%212 = sext i32 %211 to i64
%213 = getelementptr inbounds i8, i8* %208, i64 %212
store i8 %207, i8* %213
%214 = load i8*, i8** %7
%215 = load i32, i32* %10
%216 = load i32, i32* %5
%217 = sub nsw i32 %215, %216
%218 = mul nsw i32 %217, 4
%219 = add nsw i32 %218, 2
%220 = sext i32 %219 to i64
%221 = getelementptr inbounds i8, i8* %214, i64 %220
%222 = load i8, i8* %221
%223 = zext i8 %222 to i32
%224 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 2
%225 = load i8, i8* %224
%226 = zext i8 %225 to i32
%227 = xor i32 %223, %226
%228 = trunc i32 %227 to i8
%229 = load i8*, i8** %7
%230 = load i32, i32* %10
%231 = mul nsw i32 %230, 4
%232 = add nsw i32 %231, 2
%233 = sext i32 %232 to i64
%234 = getelementptr inbounds i8, i8* %229, i64 %233
store i8 %228, i8* %234
%235 = load i8*, i8** %7
%236 = load i32, i32* %10
%237 = load i32, i32* %5
%238 = sub nsw i32 %236, %237
%239 = mul nsw i32 %238, 4
%240 = add nsw i32 %239, 3
%241 = sext i32 %240 to i64
%242 = getelementptr inbounds i8, i8* %235, i64 %241
%243 = load i8, i8* %242
%244 = zext i8 %243 to i32
%245 = getelementptr inbounds [4 x i8], [4 x i8]* %12, i64 0, i64 3
%246 = load i8, i8* %245
%247 = zext i8 %246 to i32
%248 = xor i32 %244, %247
%249 = trunc i32 %248 to i8
%250 = load i8*, i8** %7
%251 = load i32, i32* %10
%252 = mul nsw i32 %251, 4
%253 = add nsw i32 %252, 3
%254 = sext i32 %253 to i64
%255 = getelementptr inbounds i8, i8* %250, i64 %254
store i8 %249, i8* %255
%256 = load i32, i32* %10
%257 = add nsw i32 %256, 1
store i32 %257, i32* %10
br label %74
258: ; preds = %74
ret void
}

LLVM IR (-O2):
@__const.AES_KeyExpansion.Rcon = [255 x i32] [i32 141, i32 1, i32 2, i32 4, i32 8, i32 16, i32 32, i32 64, i32 128, i32 27, i32 54, i32 108, i32 216, i32 171, i32 77, i32 154, i32 47, i32 94, i32 188, i32 99, i32 198, i32 151, i32 53, i32 106, i32 212, i32 179, i32 125, i32 250, i32 239, i32 197, i32 145, i32 57, i32 114, i32 228, i32 211, i32 189, i32 97, i32 194, i32 159, i32 37, i32 74, i32 148, i32 51, i32 102, i32 204, i32 131, i32 29, i32 58, i32 116, i32 232, i32 203, i32 141, i32 1, i32 2, i32 4, i32 8, i32 16, i32 32, i32 64, i32 128, i32 27, i32 54, i32 108, i32 216, i32 171, i32 77, i32 154, i32 47, i32 94, i32 188, i32 99, i32 198, i32 151, i32 53, i32 106, i32 212, i32 179, i32 125, i32 250, i32 239, i32 197, i32 145, i32 57, i32 114, i32 228, i32 211, i32 189, i32 97, i32 194, i32 159, i32 37, i32 74, i32 148, i32 51, i32 102, i32 204, i32 131, i32 29, i32 58, i32 116, i32 232, i32 203, i32 141, i32 1, i32 2, i32 4, i32 8, i32 16, i32 32, i32 64, i32 128, i32 27, i32 54, i32 108, i32 216, i32 171, i32 77, i32 154, i32 47, i32 94, i32 188, i32 99, i32 198, i32 151, i32 53, i32 106, i32 212, i32 179, i32 125, i32 250, i32 239, i32 197, i32 145, i32 57, i32 114, i32 228, i32 211, i32 189, i32 97, i32 194, i32 159, i32 37, i32 74, i32 148, i32 51, i32 102, i32 204, i32 131, i32 29, i32 58, i32 116, i32 232, i32 203, i32 141, i32 1, i32 2, i32 4, i32 8, i32 16, i32 32, i32 64, i32 128, i32 27, i32 54, i32 108, i32 216, i32 171, i32 77, i32 154, i32 47, i32 94, i32 188, i32 99, i32 198, i32 151, i32 53, i32 106, i32 212, i32 179, i32 125, i32 250, i32 239, i32 197, i32 145, i32 57, i32 114, i32 228, i32 211, i32 189, i32 97, i32 194, i32 159, i32 37, i32 74, i32 148, i32 51, i32 102, i32 204, i32 131, i32 29, i32 58, i32 116, i32 232, i32 203, i32 141, i32 1, i32 2, i32 4, i32 8, i32 16, i32 32, i32 64, i32 128, i32 27, i32 54, i32 108, i32 216, i32 171, i32 77, i32 154, i32 47, i32 94, i32 188, i32 99, i32 198, i32 151, i32 53, i32 106, i32 212, i32 179, i32 125, i32 250, i32 239, i32 197, i32 145, i32 57, i32 114, i32 228, i32 211, i32 189, i32 97, i32 194, i32 159, i32 37, i32 74, i32 148, i32 51, i32 102, i32 204, i32 131, i32 29, i32 58, i32 116, i32 232, i32 203]
define void @AES_KeyExpansion(i32 %0, i32 %1, i8* nocapture %2, i8* nocapture %3) {
%5 = icmp sgt i32 %0, 0
br i1 %5, label %6, label %8
6: ; preds = %4
%7 = zext i32 %0 to i64
br label %19
8: ; preds = %19, %4
%9 = phi i32 [ 0, %4 ], [ %0, %19 ]
%10 = shl i32 %1, 2
%11 = add i32 %10, 4
%12 = icmp sgt i32 %11, %9
br i1 %12, label %13, label %117
13: ; preds = %8
%14 = icmp sgt i32 %0, 6
%15 = shl i32 %9, 2
%16 = add i32 %15, -4
%17 = zext i32 %9 to i64
%18 = sub i32 %11, %9
br label %39
19: ; preds = %6, %19
%20 = phi i64 [ 0, %6 ], [ %37, %19 ]
%21 = shl nsw i64 %20, 2
%22 = getelementptr inbounds i8, i8* %3, i64 %21
%23 = load i8, i8* %22
%24 = getelementptr inbounds i8, i8* %2, i64 %21
store i8 %23, i8* %24
%25 = or i64 %21, 1
%26 = getelementptr inbounds i8, i8* %3, i64 %25
%27 = load i8, i8* %26
%28 = getelementptr inbounds i8, i8* %2, i64 %25
store i8 %27, i8* %28
%29 = or i64 %21, 2
%30 = getelementptr inbounds i8, i8* %3, i64 %29
%31 = load i8, i8* %30
%32 = getelementptr inbounds i8, i8* %2, i64 %29
store i8 %31, i8* %32
%33 = or i64 %21, 3
%34 = getelementptr inbounds i8, i8* %3, i64 %33
%35 = load i8, i8* %34
%36 = getelementptr inbounds i8, i8* %2, i64 %33
store i8 %35, i8* %36
%37 = add nuw nsw i64 %20, 1
%38 = icmp eq i64 %37, %7
br i1 %38, label %8, label %19
39: ; preds = %13, %75
%40 = phi i64 [ %17, %13 ], [ %114, %75 ]
%41 = phi i32 [ 0, %13 ], [ %115, %75 ]
%42 = shl i32 %41, 2
%43 = add i32 %16, %42
%44 = sext i32 %43 to i64
%45 = getelementptr i8, i8* %2, i64 %44
%46 = load i8, i8* %45
%47 = getelementptr inbounds i8, i8* %45, i64 1
%48 = load i8, i8* %47
%49 = getelementptr inbounds i8, i8* %45, i64 2
%50 = load i8, i8* %49
%51 = getelementptr inbounds i8, i8* %45, i64 3
%52 = load i8, i8* %51
%53 = trunc i64 %40 to i32
%54 = srem i32 %53, %0
%55 = sdiv i32 %53, %0
%56 = icmp eq i32 %54, 0
br i1 %56, label %57, label %67
57: ; preds = %39
%58 = tail call zeroext i8 @getSBoxValue(i8 zeroext %48)
%59 = tail call zeroext i8 @getSBoxValue(i8 zeroext %50)
%60 = tail call zeroext i8 @getSBoxValue(i8 zeroext %52)
%61 = tail call zeroext i8 @getSBoxValue(i8 zeroext %46)
%62 = sext i32 %55 to i64
%63 = getelementptr inbounds [255 x i32], [255 x i32]* @__const.AES_KeyExpansion.Rcon, i64 0, i64 %62
%64 = load i32, i32* %63
%65 = trunc i32 %64 to i8
%66 = xor i8 %58, %65
br label %75
67: ; preds = %39
%68 = icmp eq i32 %54, 4
%69 = select i1 %14, i1 %68, i1 false
br i1 %69, label %70, label %75
70: ; preds = %67
%71 = tail call zeroext i8 @getSBoxValue(i8 zeroext %46)
%72 = tail call zeroext i8 @getSBoxValue(i8 zeroext %48)
%73 = tail call zeroext i8 @getSBoxValue(i8 zeroext %50)
%74 = tail call zeroext i8 @getSBoxValue(i8 zeroext %52)
br label %75
75: ; preds = %67, %70, %57
%76 = phi i8 [ %61, %57 ], [ %74, %70 ], [ %52, %67 ]
%77 = phi i8 [ %60, %57 ], [ %73, %70 ], [ %50, %67 ]
%78 = phi i8 [ %59, %57 ], [ %72, %70 ], [ %48, %67 ]
%79 = phi i8 [ %66, %57 ], [ %71, %70 ], [ %46, %67 ]
%80 = trunc i64 %40 to i32
%81 = sub i32 %80, %0
%82 = shl nsw i32 %81, 2
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i8, i8* %2, i64 %83
%85 = load i8, i8* %84
%86 = xor i8 %79, %85
%87 = shl nsw i32 %53, 2
%88 = zext i32 %87 to i64
%89 = getelementptr inbounds i8, i8* %2, i64 %88
store i8 %86, i8* %89
%90 = or i32 %82, 1
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds i8, i8* %2, i64 %91
%93 = load i8, i8* %92
%94 = xor i8 %78, %93
%95 = or i32 %87, 1
%96 = zext i32 %95 to i64
%97 = getelementptr inbounds i8, i8* %2, i64 %96
store i8 %94, i8* %97
%98 = or i32 %82, 2
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds i8, i8* %2, i64 %99
%101 = load i8, i8* %100
%102 = xor i8 %77, %101
%103 = or i32 %87, 2
%104 = zext i32 %103 to i64
%105 = getelementptr inbounds i8, i8* %2, i64 %104
store i8 %102, i8* %105
%106 = or i32 %82, 3
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds i8, i8* %2, i64 %107
%109 = load i8, i8* %108
%110 = xor i8 %76, %109
%111 = or i32 %87, 3
%112 = zext i32 %111 to i64
%113 = getelementptr inbounds i8, i8* %2, i64 %112
store i8 %110, i8* %113
%114 = add nuw nsw i64 %40, 1
%115 = add nuw i32 %41, 1
%116 = icmp eq i32 %115, %18
br i1 %116, label %117, label %39
117: ; preds = %75, %8
ret void
}