#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ KeyExpansion(unsigned char const *, unsigned long *, int);
unsigned long long calc_ciphertext_len_regular_version(unsigned long long);
unsigned long long calc_pad_len_regular_version(unsigned long long,
                                                unsigned long long, int);
int /*<<< orphan*/ free(unsigned char *);
int /*<<< orphan*/ julius_regular_involution(unsigned char *,
                                             unsigned long long,
                                             unsigned long long,
                                             unsigned long *);
scalar_t__ malloc(unsigned long long);
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char const *,
                          unsigned long long);
int /*<<< orphan*/ regular_ecb_encrypt(unsigned char *, unsigned long long,
                                       unsigned long *);
int crypto_aead_encrypt(unsigned char *c, unsigned long long *clen,
                        const unsigned char *m, unsigned long long mlen,
                        const unsigned char *ad, unsigned long long adlen,
                        const unsigned char *nsec, const unsigned char *npub,
                        const unsigned char *k) {
  unsigned long expanded_key[44];
  KeyExpansion(k, expanded_key, 128);
  *clen = calc_ciphertext_len_regular_version(mlen);
  unsigned long long padlen = calc_pad_len_regular_version(mlen, adlen, 16);
  unsigned char *pad = (unsigned char *)malloc(padlen);
  int i;
  int adres, pres;
  if (adlen % 16 == 0) {
    adres = 0;
  } else {
    adres = 16 - (adlen % 16);
  }
  if (mlen % 16 == 0) {
    pres = 0;
  } else {
    pres = 16 - (mlen % 16);
  }
  unsigned long long tmp;
  unsigned long long reg_index;
  unsigned long long cur = 0;
  for (i = 0; i < 16 - 1; i++) {
    pad[cur] = 0;
    cur++;
  }
  pad[cur] = 1;
  cur++;
  memcpy(&pad[cur], npub, 16);
  cur = cur + 16;
  tmp = adlen;
  for (i = 0; i < 8; i++) {
    pad[cur + 7 - i] = tmp % 256;
    tmp = tmp / 256;
  }
  cur = cur + 8;
  tmp = mlen;
  for (i = 0; i < 8; i++) {
    pad[cur + 7 - i] = tmp % 256;
    tmp = tmp / 256;
  }
  cur = cur + 8;
  memcpy(&pad[cur], ad, adlen);
  cur = cur + adlen;
  reg_index = cur + adres;
  for (i = 0; i < 16 + adres + pres; i++) {
    pad[cur] = 0;
    cur++;
  }
  memcpy(&pad[cur], m, mlen);
  julius_regular_involution(pad, padlen, reg_index, expanded_key);
  regular_ecb_encrypt(&pad[reg_index], *clen, expanded_key);
  memcpy(c, &pad[reg_index], *clen);
  free(pad);
  return 0;
}


x86 assembly (clang, -O0):
<crypto_aead_encrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d0,%rsp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    0x20(%rbp),%rdi
lea    -0x190(%rbp),%rsi
mov    $0x80,%edx
call   1070 <KeyExpansion@plt>
mov    -0x20(%rbp),%rdi
call   1080 <calc_ciphertext_len_regular_version@plt>
mov    %rax,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    $0x10,%edx
call   1040 <calc_pad_len_regular_version@plt>
mov    %rax,-0x198(%rbp)
mov    -0x198(%rbp),%rdi
call   1090 <malloc@plt>
mov    %rax,-0x1a0(%rbp)
mov    -0x30(%rbp),%rax
and    $0xf,%rax
cmp    $0x0,%rax
jne    1224 <crypto_aead_encrypt+0xa4>
movl   $0x0,-0x1a8(%rbp)
jmp    123a <crypto_aead_encrypt+0xba>
mov    -0x30(%rbp),%rcx
and    $0xf,%rcx
mov    $0x10,%eax
sub    %rcx,%rax
mov    %eax,-0x1a8(%rbp)
mov    -0x20(%rbp),%rax
and    $0xf,%rax
cmp    $0x0,%rax
jne    125b <crypto_aead_encrypt+0xdb>
movl   $0x0,-0x1ac(%rbp)
jmp    1271 <crypto_aead_encrypt+0xf1>
mov    -0x20(%rbp),%rcx
and    $0xf,%rcx
mov    $0x10,%eax
sub    %rcx,%rax
mov    %eax,-0x1ac(%rbp)
movq   $0x0,-0x1c8(%rbp)
movl   $0x0,-0x1a4(%rbp)
cmpl   $0xf,-0x1a4(%rbp)
jge    12cb <crypto_aead_encrypt+0x14b>
mov    -0x1a0(%rbp),%rax
mov    -0x1c8(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x1c8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1c8(%rbp)
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    1286 <crypto_aead_encrypt+0x106>
mov    -0x1a0(%rbp),%rax
mov    -0x1c8(%rbp),%rcx
movb   $0x1,(%rax,%rcx,1)
mov    -0x1c8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1c8(%rbp)
mov    -0x1a0(%rbp),%rdi
add    -0x1c8(%rbp),%rdi
mov    0x18(%rbp),%rsi
mov    $0x10,%edx
call   1060 <memcpy@plt>
mov    -0x1c8(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x1c8(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x1b8(%rbp)
movl   $0x0,-0x1a4(%rbp)
cmpl   $0x8,-0x1a4(%rbp)
jge    1393 <crypto_aead_encrypt+0x213>
mov    -0x1b8(%rbp),%rax
and    $0xff,%rax
mov    %al,%dl
mov    -0x1a0(%rbp),%rax
mov    -0x1c8(%rbp),%rcx
add    $0x7,%rcx
movslq -0x1a4(%rbp),%rsi
sub    %rsi,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1b8(%rbp),%rax
shr    $0x8,%rax
mov    %rax,-0x1b8(%rbp)
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    1332 <crypto_aead_encrypt+0x1b2>
mov    -0x1c8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x1c8(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x1b8(%rbp)
movl   $0x0,-0x1a4(%rbp)
cmpl   $0x8,-0x1a4(%rbp)
jge    141b <crypto_aead_encrypt+0x29b>
mov    -0x1b8(%rbp),%rax
and    $0xff,%rax
mov    %al,%dl
mov    -0x1a0(%rbp),%rax
mov    -0x1c8(%rbp),%rcx
add    $0x7,%rcx
movslq -0x1a4(%rbp),%rsi
sub    %rsi,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x1b8(%rbp),%rax
shr    $0x8,%rax
mov    %rax,-0x1b8(%rbp)
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    13ba <crypto_aead_encrypt+0x23a>
mov    -0x1c8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x1c8(%rbp)
mov    -0x1a0(%rbp),%rdi
add    -0x1c8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   1060 <memcpy@plt>
mov    -0x1c8(%rbp),%rax
add    -0x30(%rbp),%rax
mov    %rax,-0x1c8(%rbp)
mov    -0x1c8(%rbp),%rax
movslq -0x1a8(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x1c0(%rbp)
movl   $0x0,-0x1a4(%rbp)
mov    -0x1a4(%rbp),%eax
mov    -0x1a8(%rbp),%ecx
add    $0x10,%ecx
add    -0x1ac(%rbp),%ecx
cmp    %ecx,%eax
jge    14d1 <crypto_aead_encrypt+0x351>
mov    -0x1a0(%rbp),%rax
mov    -0x1c8(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x1c8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1c8(%rbp)
mov    -0x1a4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1a4(%rbp)
jmp    147c <crypto_aead_encrypt+0x2fc>
mov    -0x1a0(%rbp),%rdi
add    -0x1c8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1060 <memcpy@plt>
mov    -0x1a0(%rbp),%rdi
mov    -0x198(%rbp),%rsi
mov    -0x1c0(%rbp),%rdx
lea    -0x190(%rbp),%rcx
call   1050 <julius_regular_involution@plt>
mov    -0x1a0(%rbp),%rdi
add    -0x1c0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    -0x190(%rbp),%rdx
call   10a0 <regular_ecb_encrypt@plt>
mov    -0x8(%rbp),%rdi
mov    -0x1a0(%rbp),%rsi
add    -0x1c0(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
call   1060 <memcpy@plt>
mov    -0x1a0(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x1d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crypto_aead_encrypt>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x198,%rsp
mov    %r9,%r14
mov    %r8,0x8(%rsp)
mov    %rcx,%r15
mov    %rdx,0x20(%rsp)
mov    %rsi,%rbx
mov    %rsi,0x18(%rsp)
mov    %rdi,0x28(%rsp)
mov    0x1d8(%rsp),%r12
mov    0x1e0(%rsp),%rdi
lea    0x30(%rsp),%rsi
mov    $0x80,%edx
call   1080 <KeyExpansion@plt>
mov    %r15,%rdi
call   1090 <calc_ciphertext_len_regular_version@plt>
mov    %rax,(%rbx)
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x10,%edx
call   1050 <calc_pad_len_regular_version@plt>
mov    %rax,0x10(%rsp)
mov    %rax,%rdi
call   10a0 <malloc@plt>
mov    %rax,%rbp
mov    %r14d,%eax
and    $0xf,%eax
mov    $0x10,%ebx
sub    %eax,%ebx
mov    %r15d,%r13d
and    $0xf,%r13d
movq   $0x0,0x0(%rbp)
movq   $0x0,0x7(%rbp)
xor    %ecx,%ecx
test   %rax,%rax
cmove  %ecx,%ebx
movb   $0x1,0xf(%rbp)
lea    0x10(%rbp),%rdi
mov    $0x10,%edx
mov    %r12,%rsi
call   1070 <memcpy@plt>
mov    %r14d,%eax
bswap  %eax
mov    %eax,0x24(%rbp)
mov    %r14,%rax
shr    $0x20,%rax
mov    %al,0x23(%rbp)
mov    %r14,%rax
shr    $0x28,%rax
mov    %al,0x22(%rbp)
mov    %r14,%rax
shr    $0x30,%rax
mov    %al,0x21(%rbp)
mov    %r14,%rax
shr    $0x38,%rax
mov    %al,0x20(%rbp)
mov    %r15,%rcx
mov    %cl,0x2f(%rbp)
mov    %ch,0x2e(%rbp)
mov    %r15,%rax
shr    $0x10,%rax
mov    %al,0x2d(%rbp)
mov    %r15,%rax
shr    $0x18,%rax
mov    %al,0x2c(%rbp)
mov    %r15,%rax
shr    $0x20,%rax
mov    %al,0x2b(%rbp)
mov    %r15,%rax
shr    $0x28,%rax
mov    %al,0x2a(%rbp)
mov    %r15,%rax
shr    $0x30,%rax
mov    %al,0x29(%rbp)
mov    %r15,%rax
mov    %r15,%r12
shr    $0x38,%rax
mov    %al,0x28(%rbp)
lea    0x30(%rbp),%rdi
mov    0x8(%rsp),%rsi
mov    %r14,%rdx
call   1070 <memcpy@plt>
mov    $0x20,%r15d
sub    %r13d,%r15d
test   %r13,%r13
mov    $0x10,%eax
cmove  %eax,%r15d
lea    (%r15,%rbx,1),%edx
lea    (%r14,%rbp,1),%rdi
add    $0x30,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
lea    (%r15,%rbx,1),%eax
add    $0xffffffff,%eax
add    %r14,%rax
add    %r14,%rbx
add    $0x30,%rbx
lea    (%rax,%rbp,1),%rdi
add    $0x31,%rdi
mov    0x20(%rsp),%rsi
mov    %r12,%rdx
call   1070 <memcpy@plt>
mov    %rbp,%rdi
mov    0x10(%rsp),%rsi
mov    %rbx,%rdx
lea    0x30(%rsp),%r14
mov    %r14,%rcx
call   1060 <julius_regular_involution@plt>
add    %rbp,%rbx
mov    0x18(%rsp),%r15
mov    (%r15),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
call   10b0 <regular_ecb_encrypt@plt>
mov    (%r15),%rdx
mov    0x28(%rsp),%rdi
mov    %rbx,%rsi
call   1070 <memcpy@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x198,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @crypto_aead_encrypt(i8* %0, i64* %1, i8* %2, i64 %3, i8* %4, i64 %5, i8* %6, i8* %7, i8* %8) {
%10 = alloca i8*
%11 = alloca i64*
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i8*
%15 = alloca i64
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca [44 x i64]
%20 = alloca i64
%21 = alloca i8*
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i64
%26 = alloca i64
%27 = alloca i64
store i8* %0, i8** %10
store i64* %1, i64** %11
store i8* %2, i8** %12
store i64 %3, i64* %13
store i8* %4, i8** %14
store i64 %5, i64* %15
store i8* %6, i8** %16
store i8* %7, i8** %17
store i8* %8, i8** %18
%28 = load i8*, i8** %18
%29 = getelementptr inbounds [44 x i64], [44 x i64]* %19, i64 0, i64 0
%30 = call i32 @KeyExpansion(i8* %28, i64* %29, i32 128)
%31 = load i64, i64* %13
%32 = call i64 @calc_ciphertext_len_regular_version(i64 %31)
%33 = load i64*, i64** %11
store i64 %32, i64* %33
%34 = load i64, i64* %13
%35 = load i64, i64* %15
%36 = call i64 @calc_pad_len_regular_version(i64 %34, i64 %35, i32 16)
store i64 %36, i64* %20
%37 = load i64, i64* %20
%38 = call i64 @malloc(i64 %37)
%39 = inttoptr i64 %38 to i8*
store i8* %39, i8** %21
%40 = load i64, i64* %15
%41 = urem i64 %40, 16
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %44
43: ; preds = %9
store i32 0, i32* %23
br label %49
44: ; preds = %9
%45 = load i64, i64* %15
%46 = urem i64 %45, 16
%47 = sub i64 16, %46
%48 = trunc i64 %47 to i32
store i32 %48, i32* %23
br label %49
49: ; preds = %44, %43
%50 = load i64, i64* %13
%51 = urem i64 %50, 16
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %54
53: ; preds = %49
store i32 0, i32* %24
br label %59
54: ; preds = %49
%55 = load i64, i64* %13
%56 = urem i64 %55, 16
%57 = sub i64 16, %56
%58 = trunc i64 %57 to i32
store i32 %58, i32* %24
br label %59
59: ; preds = %54, %53
store i64 0, i64* %27
store i32 0, i32* %22
br label %60
60: ; preds = %69, %59
%61 = load i32, i32* %22
%62 = icmp slt i32 %61, 15
br i1 %62, label %63, label %72
63: ; preds = %60
%64 = load i8*, i8** %21
%65 = load i64, i64* %27
%66 = getelementptr inbounds i8, i8* %64, i64 %65
store i8 0, i8* %66
%67 = load i64, i64* %27
%68 = add i64 %67, 1
store i64 %68, i64* %27
br label %69
69: ; preds = %63
%70 = load i32, i32* %22
%71 = add nsw i32 %70, 1
store i32 %71, i32* %22
br label %60
72: ; preds = %60
%73 = load i8*, i8** %21
%74 = load i64, i64* %27
%75 = getelementptr inbounds i8, i8* %73, i64 %74
store i8 1, i8* %75
%76 = load i64, i64* %27
%77 = add i64 %76, 1
store i64 %77, i64* %27
%78 = load i8*, i8** %21
%79 = load i64, i64* %27
%80 = getelementptr inbounds i8, i8* %78, i64 %79
%81 = load i8*, i8** %17
%82 = call i32 @memcpy(i8* %80, i8* %81, i64 16)
%83 = load i64, i64* %27
%84 = add i64 %83, 16
store i64 %84, i64* %27
%85 = load i64, i64* %15
store i64 %85, i64* %25
store i32 0, i32* %22
br label %86
86: ; preds = %102, %72
%87 = load i32, i32* %22
%88 = icmp slt i32 %87, 8
br i1 %88, label %89, label %105
89: ; preds = %86
%90 = load i64, i64* %25
%91 = urem i64 %90, 256
%92 = trunc i64 %91 to i8
%93 = load i8*, i8** %21
%94 = load i64, i64* %27
%95 = add i64 %94, 7
%96 = load i32, i32* %22
%97 = sext i32 %96 to i64
%98 = sub i64 %95, %97
%99 = getelementptr inbounds i8, i8* %93, i64 %98
store i8 %92, i8* %99
%100 = load i64, i64* %25
%101 = udiv i64 %100, 256
store i64 %101, i64* %25
br label %102
102: ; preds = %89
%103 = load i32, i32* %22
%104 = add nsw i32 %103, 1
store i32 %104, i32* %22
br label %86
105: ; preds = %86
%106 = load i64, i64* %27
%107 = add i64 %106, 8
store i64 %107, i64* %27
%108 = load i64, i64* %13
store i64 %108, i64* %25
store i32 0, i32* %22
br label %109
109: ; preds = %125, %105
%110 = load i32, i32* %22
%111 = icmp slt i32 %110, 8
br i1 %111, label %112, label %128
112: ; preds = %109
%113 = load i64, i64* %25
%114 = urem i64 %113, 256
%115 = trunc i64 %114 to i8
%116 = load i8*, i8** %21
%117 = load i64, i64* %27
%118 = add i64 %117, 7
%119 = load i32, i32* %22
%120 = sext i32 %119 to i64
%121 = sub i64 %118, %120
%122 = getelementptr inbounds i8, i8* %116, i64 %121
store i8 %115, i8* %122
%123 = load i64, i64* %25
%124 = udiv i64 %123, 256
store i64 %124, i64* %25
br label %125
125: ; preds = %112
%126 = load i32, i32* %22
%127 = add nsw i32 %126, 1
store i32 %127, i32* %22
br label %109
128: ; preds = %109
%129 = load i64, i64* %27
%130 = add i64 %129, 8
store i64 %130, i64* %27
%131 = load i8*, i8** %21
%132 = load i64, i64* %27
%133 = getelementptr inbounds i8, i8* %131, i64 %132
%134 = load i8*, i8** %14
%135 = load i64, i64* %15
%136 = call i32 @memcpy(i8* %133, i8* %134, i64 %135)
%137 = load i64, i64* %27
%138 = load i64, i64* %15
%139 = add i64 %137, %138
store i64 %139, i64* %27
%140 = load i64, i64* %27
%141 = load i32, i32* %23
%142 = sext i32 %141 to i64
%143 = add i64 %140, %142
store i64 %143, i64* %26
store i32 0, i32* %22
br label %144
144: ; preds = %157, %128
%145 = load i32, i32* %22
%146 = load i32, i32* %23
%147 = add nsw i32 16, %146
%148 = load i32, i32* %24
%149 = add nsw i32 %147, %148
%150 = icmp slt i32 %145, %149
br i1 %150, label %151, label %160
151: ; preds = %144
%152 = load i8*, i8** %21
%153 = load i64, i64* %27
%154 = getelementptr inbounds i8, i8* %152, i64 %153
store i8 0, i8* %154
%155 = load i64, i64* %27
%156 = add i64 %155, 1
store i64 %156, i64* %27
br label %157
157: ; preds = %151
%158 = load i32, i32* %22
%159 = add nsw i32 %158, 1
store i32 %159, i32* %22
br label %144
160: ; preds = %144
%161 = load i8*, i8** %21
%162 = load i64, i64* %27
%163 = getelementptr inbounds i8, i8* %161, i64 %162
%164 = load i8*, i8** %12
%165 = load i64, i64* %13
%166 = call i32 @memcpy(i8* %163, i8* %164, i64 %165)
%167 = load i8*, i8** %21
%168 = load i64, i64* %20
%169 = load i64, i64* %26
%170 = getelementptr inbounds [44 x i64], [44 x i64]* %19, i64 0, i64 0
%171 = call i32 @julius_regular_involution(i8* %167, i64 %168, i64 %169, i64* %170)
%172 = load i8*, i8** %21
%173 = load i64, i64* %26
%174 = getelementptr inbounds i8, i8* %172, i64 %173
%175 = load i64*, i64** %11
%176 = load i64, i64* %175
%177 = getelementptr inbounds [44 x i64], [44 x i64]* %19, i64 0, i64 0
%178 = call i32 @regular_ecb_encrypt(i8* %174, i64 %176, i64* %177)
%179 = load i8*, i8** %10
%180 = load i8*, i8** %21
%181 = load i64, i64* %26
%182 = getelementptr inbounds i8, i8* %180, i64 %181
%183 = load i64*, i64** %11
%184 = load i64, i64* %183
%185 = call i32 @memcpy(i8* %179, i8* %182, i64 %184)
%186 = load i8*, i8** %21
%187 = call i32 @free(i8* %186)
ret i32 0
}

LLVM IR (-O2):
define i32 @crypto_aead_encrypt(i8* %0, i64* nocapture %1, i8* %2, i64 %3, i8* %4, i64 %5, i8* nocapture readnone %6, i8* %7, i8* %8) {
%10 = alloca [44 x i64]
%11 = bitcast [44 x i64]* %10 to i8*
%12 = getelementptr inbounds [44 x i64], [44 x i64]* %10, i64 0, i64 0
%13 = call i32 @KeyExpansion(i8* %8, i64* %12, i32 128)
%14 = call i64 @calc_ciphertext_len_regular_version(i64 %3)
store i64 %14, i64* %1
%15 = call i64 @calc_pad_len_regular_version(i64 %3, i64 %5, i32 16)
%16 = call i64 @malloc(i64 %15)
%17 = inttoptr i64 %16 to i8*
%18 = and i64 %5, 15
%19 = trunc i64 %18 to i32
%20 = sub nuw nsw i32 16, %19
%21 = and i64 %3, 15
%22 = icmp eq i64 %21, 0
%23 = icmp eq i64 %18, 0
%24 = select i1 %23, i32 0, i32 %20
%25 = getelementptr inbounds i8, i8* %17, i64 15
store i8 1, i8* %25
%26 = getelementptr inbounds i8, i8* %17, i64 16
%27 = call i32 @memcpy(i8* %26, i8* %7, i64 16)
%28 = trunc i64 %5 to i8
%29 = getelementptr inbounds i8, i8* %17, i64 39
store i8 %28, i8* %29
%30 = lshr i64 %5, 8
%31 = trunc i64 %30 to i8
%32 = getelementptr inbounds i8, i8* %17, i64 38
store i8 %31, i8* %32
%33 = lshr i64 %5, 16
%34 = trunc i64 %33 to i8
%35 = getelementptr inbounds i8, i8* %17, i64 37
store i8 %34, i8* %35
%36 = lshr i64 %5, 24
%37 = trunc i64 %36 to i8
%38 = getelementptr inbounds i8, i8* %17, i64 36
store i8 %37, i8* %38
%39 = lshr i64 %5, 32
%40 = trunc i64 %39 to i8
%41 = getelementptr inbounds i8, i8* %17, i64 35
store i8 %40, i8* %41
%42 = lshr i64 %5, 40
%43 = trunc i64 %42 to i8
%44 = getelementptr inbounds i8, i8* %17, i64 34
store i8 %43, i8* %44
%45 = lshr i64 %5, 48
%46 = trunc i64 %45 to i8
%47 = getelementptr inbounds i8, i8* %17, i64 33
store i8 %46, i8* %47
%48 = lshr i64 %5, 56
%49 = trunc i64 %48 to i8
%50 = getelementptr inbounds i8, i8* %17, i64 32
store i8 %49, i8* %50
%51 = trunc i64 %3 to i8
%52 = getelementptr inbounds i8, i8* %17, i64 47
store i8 %51, i8* %52
%53 = lshr i64 %3, 8
%54 = trunc i64 %53 to i8
%55 = getelementptr inbounds i8, i8* %17, i64 46
store i8 %54, i8* %55
%56 = lshr i64 %3, 16
%57 = trunc i64 %56 to i8
%58 = getelementptr inbounds i8, i8* %17, i64 45
store i8 %57, i8* %58
%59 = lshr i64 %3, 24
%60 = trunc i64 %59 to i8
%61 = getelementptr inbounds i8, i8* %17, i64 44
store i8 %60, i8* %61
%62 = lshr i64 %3, 32
%63 = trunc i64 %62 to i8
%64 = getelementptr inbounds i8, i8* %17, i64 43
store i8 %63, i8* %64
%65 = lshr i64 %3, 40
%66 = trunc i64 %65 to i8
%67 = getelementptr inbounds i8, i8* %17, i64 42
store i8 %66, i8* %67
%68 = lshr i64 %3, 48
%69 = trunc i64 %68 to i8
%70 = getelementptr inbounds i8, i8* %17, i64 41
store i8 %69, i8* %70
%71 = lshr i64 %3, 56
%72 = trunc i64 %71 to i8
%73 = getelementptr inbounds i8, i8* %17, i64 40
store i8 %72, i8* %73
%74 = trunc i64 %21 to i32
%75 = getelementptr inbounds i8, i8* %17, i64 48
%76 = call i32 @memcpy(i8* %75, i8* %4, i64 %5)
%77 = add i64 %5, 48
%78 = zext i32 %24 to i64
%79 = sub nuw nsw i32 32, %74
%80 = select i1 %22, i32 16, i32 %79
%81 = add nuw nsw i32 %80, %24
%82 = getelementptr i8, i8* %17, i64 %77
%83 = zext i32 %81 to i64
%84 = add nsw i32 %81, -1
%85 = zext i32 %84 to i64
%86 = add i64 %85, %5
%87 = add i64 %77, %78
%88 = add i64 %86, 49
%89 = getelementptr inbounds i8, i8* %17, i64 %88
%90 = call i32 @memcpy(i8* %89, i8* %2, i64 %3)
%91 = call i32 @julius_regular_involution(i8* %17, i64 %15, i64 %87, i64* %12)
%92 = getelementptr inbounds i8, i8* %17, i64 %87
%93 = load i64, i64* %1
%94 = call i32 @regular_ecb_encrypt(i8* %92, i64 %93, i64* %12)
%95 = load i64, i64* %1
%96 = call i32 @memcpy(i8* %0, i8* %92, i64 %95)
%97 = call i32 @free(i8* %17)
ret i32 0
}