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

/* Variables and functions */
int AES_BLOCK_SIZE;
int /*<<< orphan*/ AES_ENCRYPT;
int /*<<< orphan*/ AES_cbc_encrypt(unsigned char *, unsigned char *,
                                   unsigned int, int /*<<< orphan*/ *,
                                   unsigned char *, int /*<<< orphan*/);
scalar_t__ AES_set_encrypt_key(unsigned char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ base64encrypt(unsigned char *, unsigned int, char *);
scalar_t__ calloc(unsigned int, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(unsigned char *);
int /*<<< orphan*/ stderr;
unsigned int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, unsigned int);
int aesbase64encrypt(unsigned char *data, unsigned char *key, char **out) {
  AES_KEY aes;
  unsigned char iv[AES_BLOCK_SIZE];
  unsigned char *input_string;
  unsigned char *encrypt_string;
  unsigned int string_len;
  unsigned int data_len;
  unsigned int bstr_len;
  unsigned int i;
  unsigned int pad;
  unsigned char tmp[3] = {'\0'};
  for (i = 0; i < AES_BLOCK_SIZE; ++i) {
    iv[i] = key[i];
  }
  if (AES_set_encrypt_key(key, 128, &aes) < 0) {
    fprintf(stderr, "Unable to set encryption key in AES\n");
    return -1;
  }
  data_len = strlen((char *)data);
  string_len = 0;
  if ((data_len + 1) % AES_BLOCK_SIZE == 0) {
    string_len = data_len + 1;
  } else {
    string_len = ((data_len + 1) / AES_BLOCK_SIZE + 1) * AES_BLOCK_SIZE;
    pad = string_len - (data_len + 1);
  }
  input_string = (unsigned char *)calloc(string_len, sizeof(unsigned char));
  if (input_string == NULL) {
    fprintf(stderr, "Unable to allocate memory for input_string\n");
    exit(-1);
  }
  strncpy((char *)input_string, (char *)data, data_len);
  for (i = data_len; i < string_len; i++) {
    input_string[i] = pad;
  }
  encrypt_string = (unsigned char *)calloc(string_len, sizeof(unsigned char));
  if (encrypt_string == NULL) {
    fprintf(stderr, "Unable to allocate memory for encrypt_string\n");
    exit(-1);
  }
  AES_cbc_encrypt(input_string, encrypt_string, string_len, &aes,
                  (unsigned char *)iv, AES_ENCRYPT);
  bstr_len = (string_len / 3 + 1) * 4;
  *out = (char *)calloc(bstr_len, sizeof(unsigned char));
  if (*out == NULL) {
    fprintf(stderr, "Unable to allocate memory for out\n");
    exit(-1);
  }
  base64encrypt(encrypt_string, string_len, *out);
  free(encrypt_string);
  free(input_string);
  return 0;
}


x86 assembly (clang, -O0):
<aesbase64encrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    0x2e2d(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x70(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x38(%rbp)
lea    -0x5f(%rbp),%rdi
xor    %esi,%esi
mov    $0x3,%edx
call   1070 <memset@plt>
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
mov    0x2de7(%rip),%rcx
cmp    (%rcx),%eax
jae    122b <aesbase64encrypt+0x8b>
mov    -0x70(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    -0x58(%rbp),%edx
mov    (%rcx,%rdx,1),%dl
mov    -0x58(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    11f7 <aesbase64encrypt+0x57>
mov    -0x18(%rbp),%rdi
mov    $0x80,%esi
lea    -0x24(%rbp),%rdx
call   1050 <AES_set_encrypt_key@plt>
cmp    $0x0,%rax
jge    126f <aesbase64encrypt+0xcf>
mov    0x2d8a(%rip),%rax
mov    (%rax),%edi
lea    0xda9(%rip),%rsi
call   10a0 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
movl   $0x1,-0x64(%rbp)
jmp    143c <aesbase64encrypt+0x29c>
mov    -0x10(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x50(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    0x2d59(%rip),%rcx
xor    %edx,%edx
divl   (%rcx)
cmp    $0x0,%edx
jne    12aa <aesbase64encrypt+0x10a>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    12d9 <aesbase64encrypt+0x139>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    0x2d31(%rip),%rcx
xor    %edx,%edx
divl   (%rcx)
add    $0x1,%eax
mov    0x2d23(%rip),%rcx
imul   (%rcx),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    -0x50(%rbp),%ecx
add    $0x1,%ecx
sub    %ecx,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x4c(%rbp),%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1314 <aesbase64encrypt+0x174>
mov    0x2cdc(%rip),%rax
mov    (%rax),%edi
lea    0xd20(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x50(%rbp),%edx
call   1040 <strncpy@plt>
mov    -0x50(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jae    1353 <aesbase64encrypt+0x1b3>
mov    -0x5c(%rbp),%eax
mov    %al,%dl
mov    -0x40(%rbp),%rax
mov    -0x58(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    132a <aesbase64encrypt+0x18a>
mov    -0x4c(%rbp),%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    138e <aesbase64encrypt+0x1ee>
mov    0x2c62(%rip),%rax
mov    (%rax),%edi
lea    0xcd2(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    -0x70(%rbp),%r8
mov    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    -0x4c(%rbp),%edx
mov    0x2c2c(%rip),%rax
mov    (%rax),%r9d
lea    -0x24(%rbp),%rcx
call   1090 <AES_cbc_encrypt@plt>
mov    -0x4c(%rbp),%eax
mov    $0x3,%ecx
xor    %edx,%edx
div    %ecx
add    $0x1,%eax
shl    $0x2,%eax
mov    %eax,-0x54(%rbp)
mov    -0x54(%rbp),%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1409 <aesbase64encrypt+0x269>
mov    0x2be7(%rip),%rax
mov    (%rax),%edi
lea    0xc85(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    -0x48(%rbp),%rdi
mov    -0x4c(%rbp),%esi
mov    -0x20(%rbp),%rax
mov    (%rax),%rdx
call   10c0 <base64encrypt@plt>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x64(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aesbase64encrypt>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdx,-0x50(%rbp)
mov    %rsi,%rbx
mov    %rdi,%r15
mov    %rsp,%r14
mov    0x2e13(%rip),%r13
mov    0x0(%r13),%eax
mov    %rsp,%r12
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
mov    0x0(%r13),%edx
test   %rdx,%rdx
je     11fe <aesbase64encrypt+0x4e>
mov    %r12,%rdi
mov    %rbx,%rsi
call   10b0 <memcpy@plt>
lea    -0x2c(%rbp),%rdx
mov    %rbx,%rdi
mov    $0x80,%esi
call   1050 <AES_set_encrypt_key@plt>
test   %rax,%rax
js     132c <aesbase64encrypt+0x17c>
mov    %r14,-0x40(%rbp)
mov    %r15,-0x48(%rbp)
mov    %r15,%rdi
call   1060 <strlen@plt>
mov    %eax,%r14d
lea    0x1(%r14),%r15d
mov    0x0(%r13),%ecx
mov    %r15d,%eax
xor    %edx,%edx
div    %ecx
mov    %eax,%ebx
add    $0x1,%ebx
imul   %ecx,%ebx
test   %edx,%edx
mov    %ebx,%r13d
cmove  %r15d,%r13d
mov    %r13d,%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
test   %rax,%rax
je     1358 <aesbase64encrypt+0x1a8>
mov    %rax,-0x38(%rbp)
mov    %rax,%rdi
mov    -0x48(%rbp),%rsi
mov    %r14d,%edx
call   1040 <strncpy@plt>
cmp    %r13d,%r14d
jae    129b <aesbase64encrypt+0xeb>
sub    %r15d,%ebx
mov    %r14d,%eax
mov    -0x38(%rbp),%rdi
add    %rax,%rdi
not    %r14d
add    %r13d,%r14d
add    $0x1,%r14
movzbl %bl,%esi
mov    %r14,%rdx
call   1070 <memset@plt>
mov    %r13d,%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
test   %rax,%rax
je     136a <aesbase64encrypt+0x1ba>
mov    %rax,%r14
mov    0x2d15(%rip),%rax
mov    (%rax),%r9d
lea    -0x2c(%rbp),%rcx
mov    -0x38(%rbp),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r13d,%edx
mov    %r12,%r8
call   1090 <AES_cbc_encrypt@plt>
mov    %r13d,%eax
mov    $0xaaaaaaab,%ecx
imul   %rax,%rcx
shr    $0x20,%rcx
and    $0xfffffffe,%ecx
lea    (%rcx,%rcx,1),%edi
add    $0x4,%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
mov    -0x50(%rbp),%rcx
mov    %rax,(%rcx)
test   %rax,%rax
je     137c <aesbase64encrypt+0x1cc>
mov    %r14,%rdi
mov    %r13d,%esi
mov    %rax,%rdx
call   10d0 <base64encrypt@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
mov    -0x40(%rbp),%r14
jmp    1346 <aesbase64encrypt+0x196>
mov    0x2ca5(%rip),%rax
mov    (%rax),%edi
lea    0xcc4(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0xffffffff,%eax
mov    %r14,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c79(%rip),%rax
mov    (%rax),%edi
lea    0xcbd(%rip),%rsi
jmp    138c <aesbase64encrypt+0x1dc>
mov    0x2c67(%rip),%rax
mov    (%rax),%edi
lea    0xcd7(%rip),%rsi
jmp    138c <aesbase64encrypt+0x1dc>
mov    0x2c55(%rip),%rax
mov    (%rax),%edi
lea    0xcf3(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@AES_BLOCK_SIZE = global i32 0
@stderr = global i32 0
@.str = [37 x i8] c"Unable to set encryption key in AES\0A\00"
@.str.1 = [44 x i8] c"Unable to allocate memory for input_string\0A\00"
@.str.2 = [46 x i8] c"Unable to allocate memory for encrypt_string\0A\00"
@AES_ENCRYPT = global i32 0
@.str.3 = [35 x i8] c"Unable to allocate memory for out\0A\00"
define i32 @aesbase64encrypt(i8* %0, i8* %1, i8** %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8**
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca [3 x i8]
%19 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8** %2, i8*** %7
%20 = load i32, i32* @AES_BLOCK_SIZE
%21 = zext i32 %20 to i64
%22 = call i8* @llvm.stacksave()
store i8* %22, i8** %9
%23 = alloca i8, i64 %21
store i64 %21, i64* %10
%24 = bitcast [3 x i8]* %18 to i8*
store i32 0, i32* %16
br label %25
25: ; preds = %38, %3
%26 = load i32, i32* %16
%27 = load i32, i32* @AES_BLOCK_SIZE
%28 = icmp ult i32 %26, %27
br i1 %28, label %29, label %41
29: ; preds = %25
%30 = load i8*, i8** %6
%31 = load i32, i32* %16
%32 = zext i32 %31 to i64
%33 = getelementptr inbounds i8, i8* %30, i64 %32
%34 = load i8, i8* %33
%35 = load i32, i32* %16
%36 = zext i32 %35 to i64
%37 = getelementptr inbounds i8, i8* %23, i64 %36
store i8 %34, i8* %37
br label %38
38: ; preds = %29
%39 = load i32, i32* %16
%40 = add i32 %39, 1
store i32 %40, i32* %16
br label %25
41: ; preds = %25
%42 = load i8*, i8** %6
%43 = call i64 @AES_set_encrypt_key(i8* %42, i32 128, i32* %8)
%44 = icmp slt i64 %43, 0
br i1 %44, label %45, label %48
45: ; preds = %41
%46 = load i32, i32* @stderr
%47 = call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %4
store i32 1, i32* %19
br label %142
48: ; preds = %41
%49 = load i8*, i8** %5
%50 = call i32 @strlen(i8* %49)
store i32 %50, i32* %14
store i32 0, i32* %13
%51 = load i32, i32* %14
%52 = add i32 %51, 1
%53 = load i32, i32* @AES_BLOCK_SIZE
%54 = urem i32 %52, %53
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %59
56: ; preds = %48
%57 = load i32, i32* %14
%58 = add i32 %57, 1
store i32 %58, i32* %13
br label %71
59: ; preds = %48
%60 = load i32, i32* %14
%61 = add i32 %60, 1
%62 = load i32, i32* @AES_BLOCK_SIZE
%63 = udiv i32 %61, %62
%64 = add i32 %63, 1
%65 = load i32, i32* @AES_BLOCK_SIZE
%66 = mul i32 %64, %65
store i32 %66, i32* %13
%67 = load i32, i32* %13
%68 = load i32, i32* %14
%69 = add i32 %68, 1
%70 = sub i32 %67, %69
store i32 %70, i32* %17
br label %71
71: ; preds = %59, %56
%72 = load i32, i32* %13
%73 = call i64 @calloc(i32 %72, i32 1)
%74 = inttoptr i64 %73 to i8*
store i8* %74, i8** %11
%75 = load i8*, i8** %11
%76 = icmp eq i8* %75, null
br i1 %76, label %77, label %81
77: ; preds = %71
%78 = load i32, i32* @stderr
%79 = call i32 @fprintf(i32 %78, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%80 = call i32 @exit(i32 -1)
unreachable
81: ; preds = %71
%82 = load i8*, i8** %11
%83 = load i8*, i8** %5
%84 = load i32, i32* %14
%85 = call i32 @strncpy(i8* %82, i8* %83, i32 %84)
%86 = load i32, i32* %14
store i32 %86, i32* %16
br label %87
87: ; preds = %98, %81
%88 = load i32, i32* %16
%89 = load i32, i32* %13
%90 = icmp ult i32 %88, %89
br i1 %90, label %91, label %101
91: ; preds = %87
%92 = load i32, i32* %17
%93 = trunc i32 %92 to i8
%94 = load i8*, i8** %11
%95 = load i32, i32* %16
%96 = zext i32 %95 to i64
%97 = getelementptr inbounds i8, i8* %94, i64 %96
store i8 %93, i8* %97
br label %98
98: ; preds = %91
%99 = load i32, i32* %16
%100 = add i32 %99, 1
store i32 %100, i32* %16
br label %87
101: ; preds = %87
%102 = load i32, i32* %13
%103 = call i64 @calloc(i32 %102, i32 1)
%104 = inttoptr i64 %103 to i8*
store i8* %104, i8** %12
%105 = load i8*, i8** %12
%106 = icmp eq i8* %105, null
br i1 %106, label %107, label %111
107: ; preds = %101
%108 = load i32, i32* @stderr
%109 = call i32 @fprintf(i32 %108, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
%110 = call i32 @exit(i32 -1)
unreachable
111: ; preds = %101
%112 = load i8*, i8** %11
%113 = load i8*, i8** %12
%114 = load i32, i32* %13
%115 = load i32, i32* @AES_ENCRYPT
%116 = call i32 @AES_cbc_encrypt(i8* %112, i8* %113, i32 %114, i32* %8, i8* %23, i32 %115)
%117 = load i32, i32* %13
%118 = udiv i32 %117, 3
%119 = add i32 %118, 1
%120 = mul i32 %119, 4
store i32 %120, i32* %15
%121 = load i32, i32* %15
%122 = call i64 @calloc(i32 %121, i32 1)
%123 = inttoptr i64 %122 to i8*
%124 = load i8**, i8*** %7
store i8* %123, i8** %124
%125 = load i8**, i8*** %7
%126 = load i8*, i8** %125
%127 = icmp eq i8* %126, null
br i1 %127, label %128, label %132
128: ; preds = %111
%129 = load i32, i32* @stderr
%130 = call i32 @fprintf(i32 %129, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%131 = call i32 @exit(i32 -1)
unreachable
132: ; preds = %111
%133 = load i8*, i8** %12
%134 = load i32, i32* %13
%135 = load i8**, i8*** %7
%136 = load i8*, i8** %135
%137 = call i32 @base64encrypt(i8* %133, i32 %134, i8* %136)
%138 = load i8*, i8** %12
%139 = call i32 @free(i8* %138)
%140 = load i8*, i8** %11
%141 = call i32 @free(i8* %140)
store i32 0, i32* %4
store i32 1, i32* %19
br label %142
142: ; preds = %132, %45
%143 = load i8*, i8** %9
%144 = load i32, i32* %4
ret i32 %144
}

LLVM IR (-O2):
@AES_BLOCK_SIZE = global i32 0
@stderr = global i32 0
@.str = [37 x i8] c"Unable to set encryption key in AES\0A\00"
@.str.1 = [44 x i8] c"Unable to allocate memory for input_string\0A\00"
@.str.2 = [46 x i8] c"Unable to allocate memory for encrypt_string\0A\00"
@AES_ENCRYPT = global i32 0
@.str.3 = [35 x i8] c"Unable to allocate memory for out\0A\00"
define i32 @aesbase64encrypt(i8* %0, i8* %1, i8** nocapture writeonly %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = load i32, i32* @AES_BLOCK_SIZE
%7 = zext i32 %6 to i64
%8 = tail call i8* @llvm.stacksave()
%9 = alloca i8, i64 %7
%10 = load i32, i32* @AES_BLOCK_SIZE
%11 = icmp eq i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %3
%13 = zext i32 %10 to i64
br label %14
14: ; preds = %12, %3
%15 = call i64 @AES_set_encrypt_key(i8* %1, i32 128, i32* %4)
%16 = icmp slt i64 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
br label %75
20: ; preds = %14
%21 = call i32 @strlen(i8* %0)
%22 = add i32 %21, 1
%23 = load i32, i32* @AES_BLOCK_SIZE
%24 = urem i32 %22, %23
%25 = udiv i32 %22, %23
%26 = icmp eq i32 %24, 0
%27 = add i32 %25, 1
%28 = mul i32 %27, %23
%29 = sub i32 %28, %22
%30 = trunc i32 %29 to i8
%31 = select i1 %26, i32 %22, i32 %28
%32 = select i1 %26, i8 undef, i8 %30
%33 = call i64 @calloc(i32 %31, i32 1)
%34 = inttoptr i64 %33 to i8*
%35 = icmp eq i64 %33, 0
br i1 %35, label %36, label %40
36: ; preds = %20
%37 = load i32, i32* @stderr
%38 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.1, i64 0, i64 0))
%39 = call i32 @exit(i32 -1)
unreachable
40: ; preds = %20
%41 = call i32 @strncpy(i8* %34, i8* %0, i32 %21)
%42 = icmp ult i32 %21, %31
br i1 %42, label %43, label %50
43: ; preds = %40
%44 = zext i32 %21 to i64
%45 = getelementptr i8, i8* %34, i64 %44
%46 = xor i32 %21, -1
%47 = add i32 %31, %46
%48 = zext i32 %47 to i64
%49 = add nuw nsw i64 %48, 1
br label %50
50: ; preds = %43, %40
%51 = call i64 @calloc(i32 %31, i32 1)
%52 = inttoptr i64 %51 to i8*
%53 = icmp eq i64 %51, 0
br i1 %53, label %54, label %58
54: ; preds = %50
%55 = load i32, i32* @stderr
%56 = call i32 @fprintf(i32 %55, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0))
%57 = call i32 @exit(i32 -1)
unreachable
58: ; preds = %50
%59 = load i32, i32* @AES_ENCRYPT
%60 = call i32 @AES_cbc_encrypt(i8* %34, i8* %52, i32 %31, i32* %4, i8* %9, i32 %59)
%61 = udiv i32 %31, 3
%62 = shl i32 %61, 2
%63 = add i32 %62, 4
%64 = call i64 @calloc(i32 %63, i32 1)
%65 = inttoptr i64 %64 to i8*
store i8* %65, i8** %2
%66 = icmp eq i64 %64, 0
br i1 %66, label %67, label %71
67: ; preds = %58
%68 = load i32, i32* @stderr
%69 = call i32 @fprintf(i32 %68, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
%70 = call i32 @exit(i32 -1)
unreachable
71: ; preds = %58
%72 = call i32 @base64encrypt(i8* %52, i32 %31, i8* %65)
%73 = call i32 @free(i8* %52)
%74 = call i32 @free(i8* %34)
br label %75
75: ; preds = %71, %17
%76 = phi i32 [ -1, %17 ], [ 0, %71 ]
ret i32 %76
}