#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 uint8_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ add_round_key(int *, int *);
scalar_t__ calloc(int, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ expand_key(int *, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, int);
int /*<<< orphan*/ free(int *);
int /*<<< orphan*/ inv_mix_columns(int *);
int /*<<< orphan*/ inv_shift_rows(int *);
int /*<<< orphan*/ inv_sub_bytes(int *);
int /*<<< orphan*/ stderr;
void aes256_decrypt(uint8_t *state, uint8_t *key) {
  uint8_t *key_schedule = (uint8_t *)calloc(240, sizeof(uint8_t));
  uint8_t *round_key = (uint8_t *)calloc(16, sizeof(uint8_t));
  do {
    if (key_schedule == NULL) {
      fprintf(stderr, "memory allocation failure in %s:%d\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/tronje/simple_aes/refs/heads/master/"
              "simple_aes.c",
              539);
      exit(EXIT_FAILURE);
    }
  } while (0);
  do {
    if (round_key == NULL) {
      fprintf(stderr, "memory allocation failure in %s:%d\n",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/tronje/simple_aes/refs/heads/master/"
              "simple_aes.c",
              540);
      exit(EXIT_FAILURE);
    }
  } while (0);
  for (uint8_t i = 0; i < 32; i++) {
    key_schedule[i] = key[i];
  }
  expand_key(key_schedule, 256);
  for (uint8_t i = 0; i < 16; i++) {
    round_key[i] = key_schedule[240 - 16 + i];
  }
  add_round_key(state, round_key);
  for (uint8_t i = 1; i <= 13; i++) {
    inv_shift_rows(state);
    inv_sub_bytes(state);
    for (uint8_t j = 0; j < 16; j++) {
      round_key[j] = key_schedule[j + ((240 - 16) - i * 16)];
    }
    add_round_key(state, round_key);
    inv_mix_columns(state);
  }
  for (uint8_t i = 0; i < 16; i++) {
    round_key[i] = key_schedule[i];
  }
  inv_shift_rows(state);
  inv_sub_bytes(state);
  add_round_key(state, round_key);
  free(key_schedule);
  free(round_key);
}


x86 assembly (clang, -O0):
<aes256_decrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0xf0,%edi
mov    $0x4,%esi
call   1060 <calloc@plt>
mov    %rax,-0x18(%rbp)
mov    $0x10,%edi
mov    $0x4,%esi
call   1060 <calloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1200 <aes256_decrypt+0x70>
mov    0x2e08(%rip),%rax
mov    (%rax),%edi
lea    0xe1f(%rip),%rsi
lea    0xe3c(%rip),%rdx
mov    $0x21b,%ecx
call   1070 <fprintf@plt>
mov    0x2ddf(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
jmp    1205 <aes256_decrypt+0x75>
jmp    120a <aes256_decrypt+0x7a>
cmpq   $0x0,-0x20(%rbp)
jne    1244 <aes256_decrypt+0xb4>
mov    0x2dc4(%rip),%rax
mov    (%rax),%edi
lea    0xddb(%rip),%rsi
lea    0xdf8(%rip),%rdx
mov    $0x21c,%ecx
call   1070 <fprintf@plt>
mov    0x2d9b(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>
jmp    1249 <aes256_decrypt+0xb9>
movl   $0x0,-0x24(%rbp)
cmpl   $0x20,-0x24(%rbp)
jge    127e <aes256_decrypt+0xee>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1250 <aes256_decrypt+0xc0>
mov    -0x18(%rbp),%rdi
mov    $0x100,%esi
call   1080 <expand_key@plt>
movl   $0x0,-0x28(%rbp)
cmpl   $0x10,-0x28(%rbp)
jge    12c9 <aes256_decrypt+0x139>
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%ecx
add    $0xe0,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x20(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1293 <aes256_decrypt+0x103>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10b0 <add_round_key@plt>
movl   $0x1,-0x2c(%rbp)
cmpl   $0xd,-0x2c(%rbp)
jg     1363 <aes256_decrypt+0x1d3>
mov    -0x8(%rbp),%rdi
call   1090 <inv_shift_rows@plt>
mov    -0x8(%rbp),%rdi
call   1050 <inv_sub_bytes@plt>
movl   $0x0,-0x30(%rbp)
cmpl   $0x10,-0x30(%rbp)
jge    133f <aes256_decrypt+0x1af>
mov    -0x18(%rbp),%rax
mov    -0x30(%rbp),%ecx
mov    -0x2c(%rbp),%esi
shl    $0x4,%esi
mov    $0xe0,%edx
sub    %esi,%edx
add    %edx,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x20(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1300 <aes256_decrypt+0x170>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10b0 <add_round_key@plt>
mov    -0x8(%rbp),%rdi
call   1040 <inv_mix_columns@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    12dd <aes256_decrypt+0x14d>
movl   $0x0,-0x34(%rbp)
cmpl   $0x10,-0x34(%rbp)
jge    1398 <aes256_decrypt+0x208>
mov    -0x18(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x20(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    136a <aes256_decrypt+0x1da>
mov    -0x8(%rbp),%rdi
call   1090 <inv_shift_rows@plt>
mov    -0x8(%rbp),%rdi
call   1050 <inv_sub_bytes@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10b0 <add_round_key@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aes256_decrypt>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r12
mov    %rdi,%r14
mov    $0xf0,%edi
mov    $0x4,%esi
call   1060 <calloc@plt>
mov    %rax,%r15
mov    $0x10,%edi
mov    $0x4,%esi
call   1060 <calloc@plt>
test   %r15,%r15
je     152f <aes256_decrypt+0x39f>
mov    %rax,%r13
test   %rax,%rax
je     154d <aes256_decrypt+0x3bd>
mov    (%r12),%eax
mov    %eax,(%r15)
mov    0x4(%r12),%eax
mov    %eax,0x4(%r15)
mov    0x8(%r12),%eax
mov    %eax,0x8(%r15)
mov    0xc(%r12),%eax
mov    %eax,0xc(%r15)
mov    0x10(%r12),%eax
mov    %eax,0x10(%r15)
mov    0x14(%r12),%eax
mov    %eax,0x14(%r15)
mov    0x18(%r12),%eax
mov    %eax,0x18(%r15)
mov    0x1c(%r12),%eax
mov    %eax,0x1c(%r15)
mov    0x20(%r12),%eax
mov    %eax,0x20(%r15)
mov    0x24(%r12),%eax
mov    %eax,0x24(%r15)
mov    0x28(%r12),%eax
mov    %eax,0x28(%r15)
mov    0x2c(%r12),%eax
mov    %eax,0x2c(%r15)
mov    0x30(%r12),%eax
mov    %eax,0x30(%r15)
mov    0x34(%r12),%eax
mov    %eax,0x34(%r15)
mov    0x38(%r12),%eax
mov    %eax,0x38(%r15)
mov    0x3c(%r12),%eax
mov    %eax,0x3c(%r15)
mov    0x40(%r12),%eax
mov    %eax,0x40(%r15)
mov    0x44(%r12),%eax
mov    %eax,0x44(%r15)
mov    0x48(%r12),%eax
mov    %eax,0x48(%r15)
mov    0x4c(%r12),%eax
mov    %eax,0x4c(%r15)
mov    0x50(%r12),%eax
mov    %eax,0x50(%r15)
mov    0x54(%r12),%eax
mov    %eax,0x54(%r15)
mov    0x58(%r12),%eax
mov    %eax,0x58(%r15)
mov    0x5c(%r12),%eax
mov    %eax,0x5c(%r15)
mov    0x60(%r12),%eax
mov    %eax,0x60(%r15)
mov    0x64(%r12),%eax
mov    %eax,0x64(%r15)
mov    0x68(%r12),%eax
mov    %eax,0x68(%r15)
mov    0x6c(%r12),%eax
mov    %eax,0x6c(%r15)
mov    0x70(%r12),%eax
mov    %eax,0x70(%r15)
mov    0x74(%r12),%eax
mov    %eax,0x74(%r15)
mov    0x78(%r12),%eax
mov    %eax,0x78(%r15)
mov    0x7c(%r12),%eax
mov    %eax,0x7c(%r15)
mov    %r15,%rdi
mov    $0x100,%esi
call   1080 <expand_key@plt>
mov    0x380(%r15),%eax
mov    %eax,0x0(%r13)
mov    0x384(%r15),%eax
mov    %eax,0x4(%r13)
mov    0x388(%r15),%eax
mov    %eax,0x8(%r13)
mov    0x38c(%r15),%eax
mov    %eax,0xc(%r13)
mov    0x390(%r15),%eax
mov    %eax,0x10(%r13)
mov    0x394(%r15),%eax
mov    %eax,0x14(%r13)
mov    0x398(%r15),%eax
mov    %eax,0x18(%r13)
mov    0x39c(%r15),%eax
mov    %eax,0x1c(%r13)
mov    0x3a0(%r15),%eax
mov    %eax,0x20(%r13)
mov    0x3a4(%r15),%eax
mov    %eax,0x24(%r13)
mov    0x3a8(%r15),%eax
mov    %eax,0x28(%r13)
mov    0x3ac(%r15),%eax
mov    %eax,0x2c(%r13)
mov    0x3b0(%r15),%eax
mov    %eax,0x30(%r13)
mov    0x3b4(%r15),%eax
mov    %eax,0x34(%r13)
mov    0x3b8(%r15),%eax
mov    %eax,0x38(%r13)
mov    0x3bc(%r15),%eax
mov    %eax,0x3c(%r13)
mov    %r14,%rdi
mov    %r13,%rsi
call   10b0 <add_round_key@plt>
mov    $0x340,%ebx
mov    %r14,%rdi
call   1090 <inv_shift_rows@plt>
mov    %r14,%rdi
call   1050 <inv_sub_bytes@plt>
mov    (%r15,%rbx,1),%eax
mov    %eax,0x0(%r13)
mov    0x4(%r15,%rbx,1),%eax
mov    %eax,0x4(%r13)
mov    0x8(%r15,%rbx,1),%eax
mov    %eax,0x8(%r13)
mov    0xc(%r15,%rbx,1),%eax
mov    %eax,0xc(%r13)
mov    0x10(%r15,%rbx,1),%eax
mov    %eax,0x10(%r13)
mov    0x14(%r15,%rbx,1),%eax
mov    %eax,0x14(%r13)
mov    0x18(%r15,%rbx,1),%eax
mov    %eax,0x18(%r13)
mov    0x1c(%r15,%rbx,1),%eax
mov    %eax,0x1c(%r13)
mov    0x20(%r15,%rbx,1),%eax
mov    %eax,0x20(%r13)
mov    0x24(%r15,%rbx,1),%eax
mov    %eax,0x24(%r13)
mov    0x28(%r15,%rbx,1),%eax
mov    %eax,0x28(%r13)
mov    0x2c(%r15,%rbx,1),%eax
mov    %eax,0x2c(%r13)
mov    0x30(%r15,%rbx,1),%eax
mov    %eax,0x30(%r13)
mov    0x34(%r15,%rbx,1),%eax
mov    %eax,0x34(%r13)
mov    0x38(%r15,%rbx,1),%eax
mov    %eax,0x38(%r13)
mov    0x3c(%r15,%rbx,1),%eax
mov    %eax,0x3c(%r13)
mov    %r14,%rdi
mov    %r13,%rsi
call   10b0 <add_round_key@plt>
mov    %r14,%rdi
call   1040 <inv_mix_columns@plt>
add    $0xffffffffffffffc0,%rbx
jne    13c0 <aes256_decrypt+0x230>
mov    (%r15),%eax
mov    %eax,0x0(%r13)
mov    0x4(%r15),%eax
mov    %eax,0x4(%r13)
mov    0x8(%r15),%eax
mov    %eax,0x8(%r13)
mov    0xc(%r15),%eax
mov    %eax,0xc(%r13)
mov    0x10(%r15),%eax
mov    %eax,0x10(%r13)
mov    0x14(%r15),%eax
mov    %eax,0x14(%r13)
mov    0x18(%r15),%eax
mov    %eax,0x18(%r13)
mov    0x1c(%r15),%eax
mov    %eax,0x1c(%r13)
mov    0x20(%r15),%eax
mov    %eax,0x20(%r13)
mov    0x24(%r15),%eax
mov    %eax,0x24(%r13)
mov    0x28(%r15),%eax
mov    %eax,0x28(%r13)
mov    0x2c(%r15),%eax
mov    %eax,0x2c(%r13)
mov    0x30(%r15),%eax
mov    %eax,0x30(%r13)
mov    0x34(%r15),%eax
mov    %eax,0x34(%r13)
mov    0x38(%r15),%eax
mov    %eax,0x38(%r13)
mov    0x3c(%r15),%eax
mov    %eax,0x3c(%r13)
mov    %r14,%rdi
call   1090 <inv_shift_rows@plt>
mov    %r14,%rdi
call   1050 <inv_sub_bytes@plt>
mov    %r14,%rdi
mov    %r13,%rsi
call   10b0 <add_round_key@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1030 <free@plt>
mov    0x2aaa(%rip),%rax
mov    (%rax),%edi
lea    0xac1(%rip),%rsi
lea    0xade(%rip),%rdx
mov    $0x21b,%ecx
jmp    1569 <aes256_decrypt+0x3d9>
mov    0x2a8c(%rip),%rax
mov    (%rax),%edi
lea    0xaa3(%rip),%rsi
lea    0xac0(%rip),%rdx
mov    $0x21c,%ecx
call   1070 <fprintf@plt>
mov    0x2a63(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [36 x i8] c"memory allocation failure in %s:%d\0A\00"
@.str.1 = [139 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/tronje/simple_aes/refs/heads/master/simple_aes.c\00"
@EXIT_FAILURE = global i32 0
define void @aes256_decrypt(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%12 = call i64 @calloc(i32 240, i32 4)
%13 = inttoptr i64 %12 to i32*
store i32* %13, i32** %5
%14 = call i64 @calloc(i32 16, i32 4)
%15 = inttoptr i64 %14 to i32*
store i32* %15, i32** %6
br label %16
16: ; preds = %2
%17 = load i32*, i32** %5
%18 = icmp eq i32* %17, null
br i1 %18, label %19, label %24
19: ; preds = %16
%20 = load i32, i32* @stderr
%21 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.1, i64 0, i64 0), i32 539)
%22 = load i32, i32* @EXIT_FAILURE
%23 = call i32 @exit(i32 %22)
unreachable
24: ; preds = %16
br label %25
25: ; preds = %24
br label %26
26: ; preds = %25
%27 = load i32*, i32** %6
%28 = icmp eq i32* %27, null
br i1 %28, label %29, label %34
29: ; preds = %26
%30 = load i32, i32* @stderr
%31 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.1, i64 0, i64 0), i32 540)
%32 = load i32, i32* @EXIT_FAILURE
%33 = call i32 @exit(i32 %32)
unreachable
34: ; preds = %26
br label %35
35: ; preds = %34
store i32 0, i32* %7
br label %36
36: ; preds = %49, %35
%37 = load i32, i32* %7
%38 = icmp slt i32 %37, 32
br i1 %38, label %39, label %52
39: ; preds = %36
%40 = load i32*, i32** %4
%41 = load i32, i32* %7
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds i32, i32* %40, i64 %42
%44 = load i32, i32* %43
%45 = load i32*, i32** %5
%46 = load i32, i32* %7
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i32, i32* %45, i64 %47
store i32 %44, i32* %48
br label %49
49: ; preds = %39
%50 = load i32, i32* %7
%51 = add nsw i32 %50, 1
store i32 %51, i32* %7
br label %36
52: ; preds = %36
%53 = load i32*, i32** %5
%54 = call i32 @expand_key(i32* %53, i32 256)
store i32 0, i32* %8
br label %55
55: ; preds = %69, %52
%56 = load i32, i32* %8
%57 = icmp slt i32 %56, 16
br i1 %57, label %58, label %72
58: ; preds = %55
%59 = load i32*, i32** %5
%60 = load i32, i32* %8
%61 = add nsw i32 224, %60
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i32, i32* %59, i64 %62
%64 = load i32, i32* %63
%65 = load i32*, i32** %6
%66 = load i32, i32* %8
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i32, i32* %65, i64 %67
store i32 %64, i32* %68
br label %69
69: ; preds = %58
%70 = load i32, i32* %8
%71 = add nsw i32 %70, 1
store i32 %71, i32* %8
br label %55
72: ; preds = %55
%73 = load i32*, i32** %3
%74 = load i32*, i32** %6
%75 = call i32 @add_round_key(i32* %73, i32* %74)
store i32 1, i32* %9
br label %76
76: ; preds = %110, %72
%77 = load i32, i32* %9
%78 = icmp sle i32 %77, 13
br i1 %78, label %79, label %113
79: ; preds = %76
%80 = load i32*, i32** %3
%81 = call i32 @inv_shift_rows(i32* %80)
%82 = load i32*, i32** %3
%83 = call i32 @inv_sub_bytes(i32* %82)
store i32 0, i32* %10
br label %84
84: ; preds = %101, %79
%85 = load i32, i32* %10
%86 = icmp slt i32 %85, 16
br i1 %86, label %87, label %104
87: ; preds = %84
%88 = load i32*, i32** %5
%89 = load i32, i32* %10
%90 = load i32, i32* %9
%91 = mul nsw i32 %90, 16
%92 = sub nsw i32 224, %91
%93 = add nsw i32 %89, %92
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds i32, i32* %88, i64 %94
%96 = load i32, i32* %95
%97 = load i32*, i32** %6
%98 = load i32, i32* %10
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds i32, i32* %97, i64 %99
store i32 %96, i32* %100
br label %101
101: ; preds = %87
%102 = load i32, i32* %10
%103 = add nsw i32 %102, 1
store i32 %103, i32* %10
br label %84
104: ; preds = %84
%105 = load i32*, i32** %3
%106 = load i32*, i32** %6
%107 = call i32 @add_round_key(i32* %105, i32* %106)
%108 = load i32*, i32** %3
%109 = call i32 @inv_mix_columns(i32* %108)
br label %110
110: ; preds = %104
%111 = load i32, i32* %9
%112 = add nsw i32 %111, 1
store i32 %112, i32* %9
br label %76
113: ; preds = %76
store i32 0, i32* %11
br label %114
114: ; preds = %127, %113
%115 = load i32, i32* %11
%116 = icmp slt i32 %115, 16
br i1 %116, label %117, label %130
117: ; preds = %114
%118 = load i32*, i32** %5
%119 = load i32, i32* %11
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds i32, i32* %118, i64 %120
%122 = load i32, i32* %121
%123 = load i32*, i32** %6
%124 = load i32, i32* %11
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds i32, i32* %123, i64 %125
store i32 %122, i32* %126
br label %127
127: ; preds = %117
%128 = load i32, i32* %11
%129 = add nsw i32 %128, 1
store i32 %129, i32* %11
br label %114
130: ; preds = %114
%131 = load i32*, i32** %3
%132 = call i32 @inv_shift_rows(i32* %131)
%133 = load i32*, i32** %3
%134 = call i32 @inv_sub_bytes(i32* %133)
%135 = load i32*, i32** %3
%136 = load i32*, i32** %6
%137 = call i32 @add_round_key(i32* %135, i32* %136)
%138 = load i32*, i32** %5
%139 = call i32 @free(i32* %138)
%140 = load i32*, i32** %6
%141 = call i32 @free(i32* %140)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [36 x i8] c"memory allocation failure in %s:%d\0A\00"
@.str.1 = [139 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/tronje/simple_aes/refs/heads/master/simple_aes.c\00"
@EXIT_FAILURE = global i32 0
define void @aes256_decrypt(i32* %0, i32* nocapture %1) {
%3 = tail call i64 @calloc(i32 240, i32 4)
%4 = inttoptr i64 %3 to i32*
%5 = tail call i64 @calloc(i32 16, i32 4)
%6 = inttoptr i64 %5 to i32*
%7 = icmp eq i64 %3, 0
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.1, i64 0, i64 0), i32 539)
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
13: ; preds = %2
%14 = icmp eq i64 %5, 0
br i1 %14, label %159, label %15
15: ; preds = %13
%16 = load i32, i32* %1
store i32 %16, i32* %4
%17 = getelementptr inbounds i32, i32* %1, i64 1
%18 = load i32, i32* %17
%19 = getelementptr inbounds i32, i32* %4, i64 1
store i32 %18, i32* %19
%20 = getelementptr inbounds i32, i32* %1, i64 2
%21 = load i32, i32* %20
%22 = getelementptr inbounds i32, i32* %4, i64 2
store i32 %21, i32* %22
%23 = getelementptr inbounds i32, i32* %1, i64 3
%24 = load i32, i32* %23
%25 = getelementptr inbounds i32, i32* %4, i64 3
store i32 %24, i32* %25
%26 = getelementptr inbounds i32, i32* %1, i64 4
%27 = load i32, i32* %26
%28 = getelementptr inbounds i32, i32* %4, i64 4
store i32 %27, i32* %28
%29 = getelementptr inbounds i32, i32* %1, i64 5
%30 = load i32, i32* %29
%31 = getelementptr inbounds i32, i32* %4, i64 5
store i32 %30, i32* %31
%32 = getelementptr inbounds i32, i32* %1, i64 6
%33 = load i32, i32* %32
%34 = getelementptr inbounds i32, i32* %4, i64 6
store i32 %33, i32* %34
%35 = getelementptr inbounds i32, i32* %1, i64 7
%36 = load i32, i32* %35
%37 = getelementptr inbounds i32, i32* %4, i64 7
store i32 %36, i32* %37
%38 = getelementptr inbounds i32, i32* %1, i64 8
%39 = load i32, i32* %38
%40 = getelementptr inbounds i32, i32* %4, i64 8
store i32 %39, i32* %40
%41 = getelementptr inbounds i32, i32* %1, i64 9
%42 = load i32, i32* %41
%43 = getelementptr inbounds i32, i32* %4, i64 9
store i32 %42, i32* %43
%44 = getelementptr inbounds i32, i32* %1, i64 10
%45 = load i32, i32* %44
%46 = getelementptr inbounds i32, i32* %4, i64 10
store i32 %45, i32* %46
%47 = getelementptr inbounds i32, i32* %1, i64 11
%48 = load i32, i32* %47
%49 = getelementptr inbounds i32, i32* %4, i64 11
store i32 %48, i32* %49
%50 = getelementptr inbounds i32, i32* %1, i64 12
%51 = load i32, i32* %50
%52 = getelementptr inbounds i32, i32* %4, i64 12
store i32 %51, i32* %52
%53 = getelementptr inbounds i32, i32* %1, i64 13
%54 = load i32, i32* %53
%55 = getelementptr inbounds i32, i32* %4, i64 13
store i32 %54, i32* %55
%56 = getelementptr inbounds i32, i32* %1, i64 14
%57 = load i32, i32* %56
%58 = getelementptr inbounds i32, i32* %4, i64 14
store i32 %57, i32* %58
%59 = getelementptr inbounds i32, i32* %1, i64 15
%60 = load i32, i32* %59
%61 = getelementptr inbounds i32, i32* %4, i64 15
store i32 %60, i32* %61
%62 = getelementptr inbounds i32, i32* %1, i64 16
%63 = load i32, i32* %62
%64 = getelementptr inbounds i32, i32* %4, i64 16
store i32 %63, i32* %64
%65 = getelementptr inbounds i32, i32* %1, i64 17
%66 = load i32, i32* %65
%67 = getelementptr inbounds i32, i32* %4, i64 17
store i32 %66, i32* %67
%68 = getelementptr inbounds i32, i32* %1, i64 18
%69 = load i32, i32* %68
%70 = getelementptr inbounds i32, i32* %4, i64 18
store i32 %69, i32* %70
%71 = getelementptr inbounds i32, i32* %1, i64 19
%72 = load i32, i32* %71
%73 = getelementptr inbounds i32, i32* %4, i64 19
store i32 %72, i32* %73
%74 = getelementptr inbounds i32, i32* %1, i64 20
%75 = load i32, i32* %74
%76 = getelementptr inbounds i32, i32* %4, i64 20
store i32 %75, i32* %76
%77 = getelementptr inbounds i32, i32* %1, i64 21
%78 = load i32, i32* %77
%79 = getelementptr inbounds i32, i32* %4, i64 21
store i32 %78, i32* %79
%80 = getelementptr inbounds i32, i32* %1, i64 22
%81 = load i32, i32* %80
%82 = getelementptr inbounds i32, i32* %4, i64 22
store i32 %81, i32* %82
%83 = getelementptr inbounds i32, i32* %1, i64 23
%84 = load i32, i32* %83
%85 = getelementptr inbounds i32, i32* %4, i64 23
store i32 %84, i32* %85
%86 = getelementptr inbounds i32, i32* %1, i64 24
%87 = load i32, i32* %86
%88 = getelementptr inbounds i32, i32* %4, i64 24
store i32 %87, i32* %88
%89 = getelementptr inbounds i32, i32* %1, i64 25
%90 = load i32, i32* %89
%91 = getelementptr inbounds i32, i32* %4, i64 25
store i32 %90, i32* %91
%92 = getelementptr inbounds i32, i32* %1, i64 26
%93 = load i32, i32* %92
%94 = getelementptr inbounds i32, i32* %4, i64 26
store i32 %93, i32* %94
%95 = getelementptr inbounds i32, i32* %1, i64 27
%96 = load i32, i32* %95
%97 = getelementptr inbounds i32, i32* %4, i64 27
store i32 %96, i32* %97
%98 = getelementptr inbounds i32, i32* %1, i64 28
%99 = load i32, i32* %98
%100 = getelementptr inbounds i32, i32* %4, i64 28
store i32 %99, i32* %100
%101 = getelementptr inbounds i32, i32* %1, i64 29
%102 = load i32, i32* %101
%103 = getelementptr inbounds i32, i32* %4, i64 29
store i32 %102, i32* %103
%104 = getelementptr inbounds i32, i32* %1, i64 30
%105 = load i32, i32* %104
%106 = getelementptr inbounds i32, i32* %4, i64 30
store i32 %105, i32* %106
%107 = getelementptr inbounds i32, i32* %1, i64 31
%108 = load i32, i32* %107
%109 = getelementptr inbounds i32, i32* %4, i64 31
store i32 %108, i32* %109
%110 = tail call i32 @expand_key(i32* %4, i32 256)
%111 = getelementptr inbounds i32, i32* %4, i64 224
%112 = load i32, i32* %111
store i32 %112, i32* %6
%113 = getelementptr inbounds i32, i32* %4, i64 225
%114 = load i32, i32* %113
%115 = getelementptr inbounds i32, i32* %6, i64 1
store i32 %114, i32* %115
%116 = getelementptr inbounds i32, i32* %4, i64 226
%117 = load i32, i32* %116
%118 = getelementptr inbounds i32, i32* %6, i64 2
store i32 %117, i32* %118
%119 = getelementptr inbounds i32, i32* %4, i64 227
%120 = load i32, i32* %119
%121 = getelementptr inbounds i32, i32* %6, i64 3
store i32 %120, i32* %121
%122 = getelementptr inbounds i32, i32* %4, i64 228
%123 = load i32, i32* %122
%124 = getelementptr inbounds i32, i32* %6, i64 4
store i32 %123, i32* %124
%125 = getelementptr inbounds i32, i32* %4, i64 229
%126 = load i32, i32* %125
%127 = getelementptr inbounds i32, i32* %6, i64 5
store i32 %126, i32* %127
%128 = getelementptr inbounds i32, i32* %4, i64 230
%129 = load i32, i32* %128
%130 = getelementptr inbounds i32, i32* %6, i64 6
store i32 %129, i32* %130
%131 = getelementptr inbounds i32, i32* %4, i64 231
%132 = load i32, i32* %131
%133 = getelementptr inbounds i32, i32* %6, i64 7
store i32 %132, i32* %133
%134 = getelementptr inbounds i32, i32* %4, i64 232
%135 = load i32, i32* %134
%136 = getelementptr inbounds i32, i32* %6, i64 8
store i32 %135, i32* %136
%137 = getelementptr inbounds i32, i32* %4, i64 233
%138 = load i32, i32* %137
%139 = getelementptr inbounds i32, i32* %6, i64 9
store i32 %138, i32* %139
%140 = getelementptr inbounds i32, i32* %4, i64 234
%141 = load i32, i32* %140
%142 = getelementptr inbounds i32, i32* %6, i64 10
store i32 %141, i32* %142
%143 = getelementptr inbounds i32, i32* %4, i64 235
%144 = load i32, i32* %143
%145 = getelementptr inbounds i32, i32* %6, i64 11
store i32 %144, i32* %145
%146 = getelementptr inbounds i32, i32* %4, i64 236
%147 = load i32, i32* %146
%148 = getelementptr inbounds i32, i32* %6, i64 12
store i32 %147, i32* %148
%149 = getelementptr inbounds i32, i32* %4, i64 237
%150 = load i32, i32* %149
%151 = getelementptr inbounds i32, i32* %6, i64 13
store i32 %150, i32* %151
%152 = getelementptr inbounds i32, i32* %4, i64 238
%153 = load i32, i32* %152
%154 = getelementptr inbounds i32, i32* %6, i64 14
store i32 %153, i32* %154
%155 = getelementptr inbounds i32, i32* %4, i64 239
%156 = load i32, i32* %155
%157 = getelementptr inbounds i32, i32* %6, i64 15
store i32 %156, i32* %157
%158 = tail call i32 @add_round_key(i32* %0, i32* %6)
br label %164
159: ; preds = %13
%160 = load i32, i32* @stderr
%161 = tail call i32 @fprintf(i32 %160, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([139 x i8], [139 x i8]* @.str.1, i64 0, i64 0), i32 540)
%162 = load i32, i32* @EXIT_FAILURE
%163 = tail call i32 @exit(i32 %162)
unreachable
164: ; preds = %15, %164
%165 = phi i64 [ 1, %15 ], [ %219, %164 ]
%166 = tail call i32 @inv_shift_rows(i32* %0)
%167 = tail call i32 @inv_sub_bytes(i32* %0)
%168 = mul nsw i64 %165, -16
%169 = add nsw i64 %168, 224
%170 = getelementptr inbounds i32, i32* %4, i64 %169
%171 = load i32, i32* %170
store i32 %171, i32* %6
%172 = add nsw i64 %168, 225
%173 = getelementptr inbounds i32, i32* %4, i64 %172
%174 = load i32, i32* %173
store i32 %174, i32* %115
%175 = add nsw i64 %168, 226
%176 = getelementptr inbounds i32, i32* %4, i64 %175
%177 = load i32, i32* %176
store i32 %177, i32* %118
%178 = add nsw i64 %168, 227
%179 = getelementptr inbounds i32, i32* %4, i64 %178
%180 = load i32, i32* %179
store i32 %180, i32* %121
%181 = add nsw i64 %168, 228
%182 = getelementptr inbounds i32, i32* %4, i64 %181
%183 = load i32, i32* %182
store i32 %183, i32* %124
%184 = add nsw i64 %168, 229
%185 = getelementptr inbounds i32, i32* %4, i64 %184
%186 = load i32, i32* %185
store i32 %186, i32* %127
%187 = add nsw i64 %168, 230
%188 = getelementptr inbounds i32, i32* %4, i64 %187
%189 = load i32, i32* %188
store i32 %189, i32* %130
%190 = add nsw i64 %168, 231
%191 = getelementptr inbounds i32, i32* %4, i64 %190
%192 = load i32, i32* %191
store i32 %192, i32* %133
%193 = add nsw i64 %168, 232
%194 = getelementptr inbounds i32, i32* %4, i64 %193
%195 = load i32, i32* %194
store i32 %195, i32* %136
%196 = add nsw i64 %168, 233
%197 = getelementptr inbounds i32, i32* %4, i64 %196
%198 = load i32, i32* %197
store i32 %198, i32* %139
%199 = add nsw i64 %168, 234
%200 = getelementptr inbounds i32, i32* %4, i64 %199
%201 = load i32, i32* %200
store i32 %201, i32* %142
%202 = add nsw i64 %168, 235
%203 = getelementptr inbounds i32, i32* %4, i64 %202
%204 = load i32, i32* %203
store i32 %204, i32* %145
%205 = add nsw i64 %168, 236
%206 = getelementptr inbounds i32, i32* %4, i64 %205
%207 = load i32, i32* %206
store i32 %207, i32* %148
%208 = add nsw i64 %168, 237
%209 = getelementptr inbounds i32, i32* %4, i64 %208
%210 = load i32, i32* %209
store i32 %210, i32* %151
%211 = add nsw i64 %168, 238
%212 = getelementptr inbounds i32, i32* %4, i64 %211
%213 = load i32, i32* %212
store i32 %213, i32* %154
%214 = add nsw i64 %168, 239
%215 = getelementptr inbounds i32, i32* %4, i64 %214
%216 = load i32, i32* %215
store i32 %216, i32* %157
%217 = tail call i32 @add_round_key(i32* %0, i32* %6)
%218 = tail call i32 @inv_mix_columns(i32* %0)
%219 = add nuw nsw i64 %165, 1
%220 = icmp eq i64 %219, 14
br i1 %220, label %221, label %164
221: ; preds = %164
%222 = load i32, i32* %4
store i32 %222, i32* %6
%223 = load i32, i32* %19
store i32 %223, i32* %115
%224 = load i32, i32* %22
store i32 %224, i32* %118
%225 = load i32, i32* %25
store i32 %225, i32* %121
%226 = load i32, i32* %28
store i32 %226, i32* %124
%227 = load i32, i32* %31
store i32 %227, i32* %127
%228 = load i32, i32* %34
store i32 %228, i32* %130
%229 = load i32, i32* %37
store i32 %229, i32* %133
%230 = load i32, i32* %40
store i32 %230, i32* %136
%231 = load i32, i32* %43
store i32 %231, i32* %139
%232 = load i32, i32* %46
store i32 %232, i32* %142
%233 = load i32, i32* %49
store i32 %233, i32* %145
%234 = load i32, i32* %52
store i32 %234, i32* %148
%235 = load i32, i32* %55
store i32 %235, i32* %151
%236 = load i32, i32* %58
store i32 %236, i32* %154
%237 = load i32, i32* %61
store i32 %237, i32* %157
%238 = tail call i32 @inv_shift_rows(i32* %0)
%239 = tail call i32 @inv_sub_bytes(i32* %0)
%240 = tail call i32 @add_round_key(i32* %0, i32* %6)
%241 = tail call i32 @free(i32* %4)
%242 = tail call i32 @free(i32* %6)
ret void
}