#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;
typedef int /*<<< orphan*/ AES_KEY;

/* Variables and functions */
int /*<<< orphan*/ AES_ctr128_encrypt(int *, int *, size_t,
                                      int /*<<< orphan*/ *, int *, int *,
                                      unsigned int *);
int AES_set_encrypt_key(int *, size_t, int /*<<< orphan*/ *);
scalar_t__ calloc(size_t, int);
int /*<<< orphan*/ free(int *);
scalar_t__ malloc(size_t);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int strlen(char *);
int main(int ac, char **av) {
  uint8_t iv[16], ecount[16];
  char *hex = av[1];
  char *hkey;
  size_t klen = 16;
  if (ac > 2) {
    hkey = hex;
    hex = av[2];
    klen = strlen(hkey) / 2;
  }
  size_t xlen = strlen(hex);
  size_t blen = xlen / 2;
  memset(iv, 0, 16);
  memset(ecount, 0, 16);
  uint8_t *in = (uint8_t *)malloc(blen);
  uint8_t *out = (uint8_t *)malloc(blen);
  uint8_t *key = (uint8_t *)calloc(klen, 1);
  if (!in || !out || !key) {
    printf("FAIL!\n");
    return 1;
  }
  for (size_t i = 0; i < blen; ++i) {
    sscanf(hex, "%2hhx", &in[i]);
    hex += 2;
  }
  if (ac > 2) {
    for (size_t i = 0; i < klen; ++i) {
      sscanf(hkey, "%2hhx", &key[i]);
      hkey += 2;
    }
  }
  AES_KEY aes_key;
  int ret = AES_set_encrypt_key(key, klen * 8, &aes_key);
  if (ret) {
    printf("FAILED %d\n", ret);
    return 1;
  }
  unsigned int num = 0;
  AES_ctr128_encrypt(in, out, blen, &aes_key, iv, ecount, &num);
  for (size_t i = 0; i < blen; ++i)
    printf("%02x", out[i]);
  printf("\n");
  free(in);
  free(out);
  free(key);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x98(%rbp)
movq   $0x10,-0xa8(%rbp)
cmpl   $0x2,-0x8(%rbp)
jle    1207 <main+0x77>
mov    -0x98(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x98(%rbp)
mov    -0xa0(%rbp),%rdi
call   1060 <strlen@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
cltq
mov    %rax,-0xa8(%rbp)
mov    -0x98(%rbp),%rdi
call   1060 <strlen@plt>
cltq
mov    %rax,-0xb0(%rbp)
mov    -0xb0(%rbp),%rax
shr    $0x1,%rax
mov    %rax,-0xb8(%rbp)
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1080 <memset@plt>
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1080 <memset@plt>
mov    -0xb8(%rbp),%rdi
call   10a0 <malloc@plt>
mov    %rax,-0xc0(%rbp)
mov    -0xb8(%rbp),%rdi
call   10a0 <malloc@plt>
mov    %rax,-0xc8(%rbp)
mov    -0xa8(%rbp),%rdi
mov    $0x1,%esi
call   1090 <calloc@plt>
mov    %rax,-0xd0(%rbp)
cmpq   $0x0,-0xc0(%rbp)
je     12b9 <main+0x129>
cmpq   $0x0,-0xc8(%rbp)
je     12b9 <main+0x129>
cmpq   $0x0,-0xd0(%rbp)
jne    12d3 <main+0x143>
lea    0xd40(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14e2 <main+0x352>
movq   $0x0,-0xd8(%rbp)
mov    -0xd8(%rbp),%rax
cmp    -0xb8(%rbp),%rax
jae    1343 <main+0x1b3>
mov    -0x98(%rbp),%rdi
mov    -0xc0(%rbp),%rdx
mov    -0xd8(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
lea    0xcf2(%rip),%rsi
call   10b0 <sscanf@plt>
mov    -0x98(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x98(%rbp)
mov    -0xd8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xd8(%rbp)
jmp    12de <main+0x14e>
cmpl   $0x2,-0x8(%rbp)
jle    13c2 <main+0x232>
movq   $0x0,-0xe0(%rbp)
mov    -0xe0(%rbp),%rax
cmp    -0xa8(%rbp),%rax
jae    13bd <main+0x22d>
mov    -0xa0(%rbp),%rdi
mov    -0xd0(%rbp),%rdx
mov    -0xe0(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rdx
lea    0xc78(%rip),%rsi
call   10b0 <sscanf@plt>
mov    -0xa0(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0xa0(%rbp)
mov    -0xe0(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xe0(%rbp)
jmp    1358 <main+0x1c8>
jmp    13c2 <main+0x232>
mov    -0xd0(%rbp),%rdi
mov    -0xa8(%rbp),%rsi
shl    $0x3,%rsi
lea    -0xe4(%rbp),%rdx
call   1050 <AES_set_encrypt_key@plt>
mov    %eax,-0xe8(%rbp)
cmpl   $0x0,-0xe8(%rbp)
je     1413 <main+0x283>
mov    -0xe8(%rbp),%esi
lea    0xc0d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    14e2 <main+0x352>
movl   $0x0,-0xec(%rbp)
mov    -0xc0(%rbp),%rdi
mov    -0xc8(%rbp),%rsi
mov    -0xb8(%rbp),%rdx
lea    -0x50(%rbp),%r8
lea    -0x90(%rbp),%r9
lea    -0xe4(%rbp),%rcx
lea    -0xec(%rbp),%rax
mov    %rax,(%rsp)
call   1040 <AES_ctr128_encrypt@plt>
movq   $0x0,-0xf8(%rbp)
mov    -0xf8(%rbp),%rax
cmp    -0xb8(%rbp),%rax
jae    14a9 <main+0x319>
mov    -0xc8(%rbp),%rax
mov    -0xf8(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xb8d(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0xf8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0xf8(%rbp)
jmp    145f <main+0x2cf>
lea    0xb55(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0xc0(%rbp),%rdi
call   1030 <free@plt>
mov    -0xc8(%rbp),%rdi
call   1030 <free@plt>
mov    -0xd0(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
mov    0x8(%rsi),%r13
mov    $0x10,%r14d
mov    %r13,%rbp
mov    %edi,0x24(%rsp)
cmp    $0x3,%edi
jl     11ef <main+0x3f>
mov    0x10(%rsi),%rbp
mov    %r13,%rdi
call   1080 <strlen@plt>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
movslq %ecx,%r14
mov    %rbp,%rdi
call   1080 <strlen@plt>
mov    %eax,0x14(%rsp)
movslq %eax,%rbx
shr    %rbx
lea    0x90(%rsp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   10a0 <memset@plt>
lea    0x50(%rsp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   10a0 <memset@plt>
mov    %rbx,%rdi
call   10c0 <malloc@plt>
mov    %rax,%r12
mov    %rbx,0x40(%rsp)
mov    %rbx,%rdi
call   10c0 <malloc@plt>
mov    %rax,%rbx
mov    $0x1,%r15d
mov    %r14,0x48(%rsp)
mov    %r14,%rdi
mov    $0x1,%esi
call   10b0 <calloc@plt>
test   %r12,%r12
je     134b <main+0x19b>
test   %rbx,%rbx
je     134b <main+0x19b>
test   %rax,%rax
je     134b <main+0x19b>
mov    %rax,0x18(%rsp)
mov    %rbx,0x38(%rsp)
mov    %r12,0x30(%rsp)
cmpl   $0x2,0x14(%rsp)
mov    0x40(%rsp),%r14
jb     12cc <main+0x11c>
cmp    $0x2,%r14
mov    $0x1,%r12d
cmovae %r14,%r12
lea    0xd5c(%rip),%r15
mov    0x30(%rsp),%rbx
nopl   0x0(%rax)
mov    %rbp,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
call   10d0 <sscanf@plt>
add    $0x2,%rbp
add    $0x4,%rbx
add    $0xffffffffffffffff,%r12
jne    12b0 <main+0x100>
cmpl   $0x3,0x24(%rsp)
mov    0x48(%rsp),%r12
jl     130c <main+0x15c>
test   %r12,%r12
je     130c <main+0x15c>
lea    0xd1c(%rip),%r15
mov    0x18(%rsp),%rbp
mov    %r12,%rbx
nopl   0x0(%rax)
mov    %r13,%rdi
mov    %r15,%rsi
mov    %rbp,%rdx
call   10d0 <sscanf@plt>
add    $0x2,%r13
add    $0x4,%rbp
add    $0xffffffffffffffff,%rbx
jne    12f0 <main+0x140>
shl    $0x3,%r12
lea    0x2c(%rsp),%rdx
mov    0x18(%rsp),%rdi
mov    %r12,%rsi
call   1070 <AES_set_encrypt_key@plt>
test   %eax,%eax
mov    0x30(%rsp),%r15
mov    0x38(%rsp),%r12
je     135c <main+0x1ac>
lea    0xccf(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1090 <printf@plt>
mov    $0x1,%r15d
jmp    13ee <main+0x23e>
lea    0xcc4(%rip),%rdi
call   1050 <puts@plt>
jmp    13ee <main+0x23e>
movl   $0x0,0x28(%rsp)
lea    0x28(%rsp),%rax
mov    %rax,(%rsp)
lea    0x2c(%rsp),%rcx
lea    0x90(%rsp),%r8
lea    0x50(%rsp),%r9
mov    %r15,%rdi
mov    %r12,%rsi
mov    %r14,%rdx
call   1060 <AES_ctr128_encrypt@plt>
cmpl   $0x2,0x14(%rsp)
jb     13c7 <main+0x217>
cmp    $0x2,%r14
mov    $0x1,%ebp
cmovae %r14,%rbp
lea    0xc69(%rip),%r14
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    (%r12,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1090 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    13b0 <main+0x200>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
xor    %r15d,%r15d
mov    %r15d,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"FAIL!\0A\00"
@.str.1 = [6 x i8] c"%2hhx\00"
@.str.2 = [11 x i8] c"FAILED %d\0A\00"
@.str.3 = [5 x i8] c"%02x\00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [16 x i32]
%7 = alloca [16 x i32]
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i64
%17 = alloca i64
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
store i8* %24, i8** %8
store i64 16, i64* %10
%25 = load i32, i32* %4
%26 = icmp sgt i32 %25, 2
br i1 %26, label %27, label %36
27: ; preds = %2
%28 = load i8*, i8** %8
store i8* %28, i8** %9
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 2
%31 = load i8*, i8** %30
store i8* %31, i8** %8
%32 = load i8*, i8** %9
%33 = call i32 @strlen(i8* %32)
%34 = sdiv i32 %33, 2
%35 = sext i32 %34 to i64
store i64 %35, i64* %10
br label %36
36: ; preds = %27, %2
%37 = load i8*, i8** %8
%38 = call i32 @strlen(i8* %37)
%39 = sext i32 %38 to i64
store i64 %39, i64* %11
%40 = load i64, i64* %11
%41 = udiv i64 %40, 2
store i64 %41, i64* %12
%42 = getelementptr inbounds [16 x i32], [16 x i32]* %6, i64 0, i64 0
%43 = call i32 @memset(i32* %42, i32 0, i32 16)
%44 = getelementptr inbounds [16 x i32], [16 x i32]* %7, i64 0, i64 0
%45 = call i32 @memset(i32* %44, i32 0, i32 16)
%46 = load i64, i64* %12
%47 = call i64 @malloc(i64 %46)
%48 = inttoptr i64 %47 to i32*
store i32* %48, i32** %13
%49 = load i64, i64* %12
%50 = call i64 @malloc(i64 %49)
%51 = inttoptr i64 %50 to i32*
store i32* %51, i32** %14
%52 = load i64, i64* %10
%53 = call i64 @calloc(i64 %52, i32 1)
%54 = inttoptr i64 %53 to i32*
store i32* %54, i32** %15
%55 = load i32*, i32** %13
%56 = icmp ne i32* %55, null
br i1 %56, label %57, label %63
57: ; preds = %36
%58 = load i32*, i32** %14
%59 = icmp ne i32* %58, null
br i1 %59, label %60, label %63
60: ; preds = %57
%61 = load i32*, i32** %15
%62 = icmp ne i32* %61, null
br i1 %62, label %65, label %63
63: ; preds = %60, %57, %36
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %139
65: ; preds = %60
store i64 0, i64* %16
br label %66
66: ; preds = %78, %65
%67 = load i64, i64* %16
%68 = load i64, i64* %12
%69 = icmp ult i64 %67, %68
br i1 %69, label %70, label %81
70: ; preds = %66
%71 = load i8*, i8** %8
%72 = load i32*, i32** %13
%73 = load i64, i64* %16
%74 = getelementptr inbounds i32, i32* %72, i64 %73
%75 = call i32 @sscanf(i8* %71, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %74)
%76 = load i8*, i8** %8
%77 = getelementptr inbounds i8, i8* %76, i64 2
store i8* %77, i8** %8
br label %78
78: ; preds = %70
%79 = load i64, i64* %16
%80 = add i64 %79, 1
store i64 %80, i64* %16
br label %66
81: ; preds = %66
%82 = load i32, i32* %4
%83 = icmp sgt i32 %82, 2
br i1 %83, label %84, label %101
84: ; preds = %81
store i64 0, i64* %17
br label %85
85: ; preds = %97, %84
%86 = load i64, i64* %17
%87 = load i64, i64* %10
%88 = icmp ult i64 %86, %87
br i1 %88, label %89, label %100
89: ; preds = %85
%90 = load i8*, i8** %9
%91 = load i32*, i32** %15
%92 = load i64, i64* %17
%93 = getelementptr inbounds i32, i32* %91, i64 %92
%94 = call i32 @sscanf(i8* %90, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %93)
%95 = load i8*, i8** %9
%96 = getelementptr inbounds i8, i8* %95, i64 2
store i8* %96, i8** %9
br label %97
97: ; preds = %89
%98 = load i64, i64* %17
%99 = add i64 %98, 1
store i64 %99, i64* %17
br label %85
100: ; preds = %85
br label %101
101: ; preds = %100, %81
%102 = load i32*, i32** %15
%103 = load i64, i64* %10
%104 = mul i64 %103, 8
%105 = call i32 @AES_set_encrypt_key(i32* %102, i64 %104, i32* %18)
store i32 %105, i32* %19
%106 = load i32, i32* %19
%107 = icmp ne i32 %106, 0
br i1 %107, label %108, label %111
108: ; preds = %101
%109 = load i32, i32* %19
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %109)
store i32 1, i32* %3
br label %139
111: ; preds = %101
store i32 0, i32* %20
%112 = load i32*, i32** %13
%113 = load i32*, i32** %14
%114 = load i64, i64* %12
%115 = getelementptr inbounds [16 x i32], [16 x i32]* %6, i64 0, i64 0
%116 = getelementptr inbounds [16 x i32], [16 x i32]* %7, i64 0, i64 0
%117 = call i32 @AES_ctr128_encrypt(i32* %112, i32* %113, i64 %114, i32* %18, i32* %115, i32* %116, i32* %20)
store i64 0, i64* %21
br label %118
118: ; preds = %128, %111
%119 = load i64, i64* %21
%120 = load i64, i64* %12
%121 = icmp ult i64 %119, %120
br i1 %121, label %122, label %131
122: ; preds = %118
%123 = load i32*, i32** %14
%124 = load i64, i64* %21
%125 = getelementptr inbounds i32, i32* %123, i64 %124
%126 = load i32, i32* %125
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %126)
br label %128
128: ; preds = %122
%129 = load i64, i64* %21
%130 = add i64 %129, 1
store i64 %130, i64* %21
br label %118
131: ; preds = %118
%132 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%133 = load i32*, i32** %13
%134 = call i32 @free(i32* %133)
%135 = load i32*, i32** %14
%136 = call i32 @free(i32* %135)
%137 = load i32*, i32** %15
%138 = call i32 @free(i32* %137)
store i32 0, i32* %3
br label %139
139: ; preds = %131, %108, %63
%140 = load i32, i32* %3
ret i32 %140
}

LLVM IR (-O2):
@.str.1 = [6 x i8] c"%2hhx\00"
@.str.2 = [11 x i8] c"FAILED %d\0A\00"
@.str.3 = [5 x i8] c"%02x\00"
@str = [6 x i8] c"FAIL!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [16 x i32]
%4 = alloca [16 x i32]
%5 = alloca i32
%6 = alloca i32
%7 = bitcast [16 x i32]* %3 to i8*
%8 = bitcast [16 x i32]* %4 to i8*
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = icmp sgt i32 %0, 2
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 2
%14 = load i8*, i8** %13
%15 = tail call i32 @strlen(i8* %10)
%16 = sdiv i32 %15, 2
%17 = sext i32 %16 to i64
br label %18
18: ; preds = %12, %2
%19 = phi i64 [ %17, %12 ], [ 16, %2 ]
%20 = phi i8* [ %14, %12 ], [ %10, %2 ]
%21 = tail call i32 @strlen(i8* %20)
%22 = sext i32 %21 to i64
%23 = lshr i64 %22, 1
%24 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 0
%25 = call i32 @memset(i32* %24, i32 0, i32 16)
%26 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 0
%27 = call i32 @memset(i32* %26, i32 0, i32 16)
%28 = call i64 @malloc(i64 %23)
%29 = inttoptr i64 %28 to i32*
%30 = call i64 @malloc(i64 %23)
%31 = inttoptr i64 %30 to i32*
%32 = call i64 @calloc(i64 %19, i32 1)
%33 = inttoptr i64 %32 to i32*
%34 = icmp ne i64 %28, 0
%35 = icmp ne i64 %30, 0
%36 = select i1 %34, i1 %35, i1 false
%37 = icmp ne i64 %32, 0
%38 = select i1 %36, i1 %37, i1 false
br i1 %38, label %39, label %43
39: ; preds = %18
%40 = icmp ult i32 %21, 2
br i1 %40, label %45, label %41
41: ; preds = %39
%42 = call i64 @llvm.umax.i64(i64 %23, i64 1)
br label %48
43: ; preds = %18
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
br label %90
45: ; preds = %48, %39
%46 = icmp ne i64 %19, 0
%47 = select i1 %11, i1 %46, i1 false
br i1 %47, label %56, label %64
48: ; preds = %41, %48
%49 = phi i64 [ %54, %48 ], [ 0, %41 ]
%50 = phi i8* [ %53, %48 ], [ %20, %41 ]
%51 = getelementptr inbounds i32, i32* %29, i64 %49
%52 = call i32 @sscanf(i8* %50, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %51)
%53 = getelementptr inbounds i8, i8* %50, i64 2
%54 = add nuw nsw i64 %49, 1
%55 = icmp eq i64 %54, %42
br i1 %55, label %45, label %48
56: ; preds = %45, %56
%57 = phi i64 [ %62, %56 ], [ 0, %45 ]
%58 = phi i8* [ %61, %56 ], [ %10, %45 ]
%59 = getelementptr inbounds i32, i32* %33, i64 %57
%60 = call i32 @sscanf(i8* %58, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %59)
%61 = getelementptr inbounds i8, i8* %58, i64 2
%62 = add nuw i64 %57, 1
%63 = icmp eq i64 %62, %19
br i1 %63, label %64, label %56
64: ; preds = %56, %45
%65 = bitcast i32* %5 to i8*
%66 = shl nsw i64 %19, 3
%67 = call i32 @AES_set_encrypt_key(i32* %33, i64 %66, i32* %5)
%68 = icmp eq i32 %67, 0
br i1 %68, label %71, label %69
69: ; preds = %64
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %67)
br label %88
71: ; preds = %64
%72 = bitcast i32* %6 to i8*
store i32 0, i32* %6
%73 = call i32 @AES_ctr128_encrypt(i32* %29, i32* %31, i64 %23, i32* %5, i32* %24, i32* %26, i32* %6)
br i1 %40, label %76, label %74
74: ; preds = %71
%75 = call i64 @llvm.umax.i64(i64 %23, i64 1)
br label %81
76: ; preds = %81, %71
%77 = call i32 @putchar(i32 10)
%78 = call i32 @free(i32* %29)
%79 = call i32 @free(i32* %31)
%80 = call i32 @free(i32* %33)
br label %88
81: ; preds = %74, %81
%82 = phi i64 [ %86, %81 ], [ 0, %74 ]
%83 = getelementptr inbounds i32, i32* %31, i64 %82
%84 = load i32, i32* %83
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i32 %84)
%86 = add nuw nsw i64 %82, 1
%87 = icmp eq i64 %86, %75
br i1 %87, label %76, label %81
88: ; preds = %76, %69
%89 = phi i32 [ 1, %69 ], [ 0, %76 ]
br label %90
90: ; preds = %88, %43
%91 = phi i32 [ %89, %88 ], [ 1, %43 ]
ret i32 %91
}