#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*/ TEM_ENC(unsigned char const *, int, unsigned char const *,
                           unsigned long long, int /*<<< orphan*/,
                           unsigned char *, unsigned char *);
void AEAD_CGEN(const unsigned char *_K, const unsigned char *_N,
               const unsigned char *_M, unsigned long long _mlen,
               unsigned char *C_, unsigned long long *clen_) {
  int d, pad;
  unsigned long long i, blocknum;
  const unsigned char *mp;
  unsigned char *cp, in[32], out[32];
  i = 1;
  mp = _M;
  cp = C_;
  pad = _mlen % 32;
  blocknum = _mlen / 32 + 1;
  *clen_ = blocknum * 32;
  while (blocknum > 1) {
    do {
      int u;
      for (u = 0; u < 32; u++)
        (in)[u] = (mp)[u];
    } while (0);
    TEM_ENC(_K, 0x40, _N, i, 0, in, out);
    do {
      int u;
      for (u = 0; u < 32; u++)
        (cp)[u] = (out)[u];
    } while (0);
    i += 2;
    blocknum--;
    mp += 32;
    cp += 32;
  }
  do {
    int u;
    for (u = 0; u < pad; u++)
      (in)[u] = (mp)[u];
  } while (0);
  in[pad] = 0x80;
  for (d = pad + 1; d < 32; d++)
    in[d] = 0x00;
  TEM_ENC(_K, 0x40, _N, i, 0, in, out);
  do {
    int u;
    for (u = 0; u < 32; u++)
      (cp)[u] = (out)[u];
  } while (0);
}


x86 assembly (clang, -O0):
<AEAD_CGEN>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
movq   $0x1,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x20(%rbp),%rax
and    $0x1f,%rax
mov    %eax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
shr    $0x5,%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rcx
shl    $0x5,%rcx
mov    -0x30(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x1,-0x48(%rbp)
jbe    1277 <AEAD_CGEN+0x167>
jmp    1185 <AEAD_CGEN+0x75>
movl   $0x0,-0xa4(%rbp)
cmpl   $0x20,-0xa4(%rbp)
jge    11c9 <AEAD_CGEN+0xb9>
mov    -0x50(%rbp),%rax
movslq -0xa4(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
movslq -0xa4(%rbp),%rax
mov    %cl,-0x80(%rbp,%rax,1)
mov    -0xa4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa4(%rbp)
jmp    118f <AEAD_CGEN+0x7f>
jmp    11ce <AEAD_CGEN+0xbe>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x40(%rbp),%rcx
lea    -0x80(%rbp),%r9
lea    -0xa0(%rbp),%rax
mov    $0x40,%esi
xor    %r8d,%r8d
mov    %rax,(%rsp)
call   1030 <TEM_ENC@plt>
movl   $0x0,-0xa8(%rbp)
cmpl   $0x20,-0xa8(%rbp)
jge    123d <AEAD_CGEN+0x12d>
movslq -0xa8(%rbp),%rax
mov    -0xa0(%rbp,%rax,1),%dl
mov    -0x58(%rbp),%rax
movslq -0xa8(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xa8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa8(%rbp)
jmp    1200 <AEAD_CGEN+0xf0>
jmp    1242 <AEAD_CGEN+0x132>
mov    -0x40(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x40(%rbp)
mov    -0x48(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x48(%rbp)
mov    -0x50(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x50(%rbp)
mov    -0x58(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x58(%rbp)
jmp    1175 <AEAD_CGEN+0x65>
jmp    127c <AEAD_CGEN+0x16c>
movl   $0x0,-0xac(%rbp)
mov    -0xac(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    12c2 <AEAD_CGEN+0x1b2>
mov    -0x50(%rbp),%rax
movslq -0xac(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
movslq -0xac(%rbp),%rax
mov    %cl,-0x80(%rbp,%rax,1)
mov    -0xac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xac(%rbp)
jmp    1286 <AEAD_CGEN+0x176>
jmp    12c7 <AEAD_CGEN+0x1b7>
movslq -0x38(%rbp),%rax
movb   $0x80,-0x80(%rbp,%rax,1)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x20,-0x34(%rbp)
jge    12fa <AEAD_CGEN+0x1ea>
movslq -0x34(%rbp),%rax
movb   $0x0,-0x80(%rbp,%rax,1)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12d9 <AEAD_CGEN+0x1c9>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x40(%rbp),%rcx
lea    -0x80(%rbp),%r9
lea    -0xa0(%rbp),%rax
mov    $0x40,%esi
xor    %r8d,%r8d
mov    %rax,(%rsp)
call   1030 <TEM_ENC@plt>
movl   $0x0,-0xb0(%rbp)
cmpl   $0x20,-0xb0(%rbp)
jge    1369 <AEAD_CGEN+0x259>
movslq -0xb0(%rbp),%rax
mov    -0xa0(%rbp,%rax,1),%dl
mov    -0x58(%rbp),%rax
movslq -0xb0(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xb0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb0(%rbp)
jmp    132c <AEAD_CGEN+0x21c>
jmp    136e <AEAD_CGEN+0x25e>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AEAD_CGEN>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %r8,%rbx
mov    %rdx,%rbp
mov    %rsi,%r8
mov    %rdi,%r13
mov    %ecx,%eax
and    $0x1f,%eax
mov    %rax,0x60(%rsp)
mov    %rcx,%r15
shr    $0x5,%r15
add    $0x1,%r15
mov    %r15,%rax
shl    $0x5,%rax
mov    %rax,(%r9)
mov    $0x1,%r12d
mov    %rcx,0x58(%rsp)
cmp    $0x20,%rcx
jb     11d3 <AEAD_CGEN+0xb3>
mov    $0x1,%r12d
movups 0x0(%rbp),%xmm0
movups 0x10(%rbp),%xmm1
movaps %xmm1,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
lea    0x10(%rsp),%rax
mov    %rax,(%rsp)
mov    %r13,%rdi
mov    $0x40,%esi
mov    %r8,%rdx
mov    %r12,%rcx
mov    %r8,%r14
xor    %r8d,%r8d
lea    0x30(%rsp),%r9
call   1040 <TEM_ENC@plt>
mov    %r14,%r8
movaps 0x10(%rsp),%xmm0
movaps 0x20(%rsp),%xmm1
movups %xmm0,(%rbx)
movups %xmm1,0x10(%rbx)
add    $0x2,%r12
add    $0xffffffffffffffff,%r15
add    $0x20,%rbp
add    $0x20,%rbx
cmp    $0x1,%r15
ja     1170 <AEAD_CGEN+0x50>
mov    0x60(%rsp),%r9
test   %r9d,%r9d
je     127b <AEAD_CGEN+0x15b>
cmp    $0x8,%r9d
jb     120a <AEAD_CGEN+0xea>
lea    (%r9,%rbp,1),%rax
lea    0x30(%rsp),%rcx
cmp    %rax,%rcx
jae    13c5 <AEAD_CGEN+0x2a5>
lea    (%rsp,%r9,1),%rax
add    $0x30,%rax
cmp    %rax,%rbp
jae    13c5 <AEAD_CGEN+0x2a5>
xor    %eax,%eax
mov    %rax,%rsi
not    %rsi
add    %r9,%rsi
mov    %r9,%rdx
and    $0x3,%rdx
je     1233 <AEAD_CGEN+0x113>
xchg   %ax,%ax
movzbl 0x0(%rbp,%rax,1),%ecx
mov    %cl,0x30(%rsp,%rax,1)
add    $0x1,%rax
add    $0xffffffffffffffff,%rdx
jne    1220 <AEAD_CGEN+0x100>
cmp    $0x3,%rsi
jb     126d <AEAD_CGEN+0x14d>
nopl   0x0(%rax)
movzbl 0x0(%rbp,%rax,1),%ecx
mov    %cl,0x30(%rsp,%rax,1)
movzbl 0x1(%rbp,%rax,1),%ecx
mov    %cl,0x31(%rsp,%rax,1)
movzbl 0x2(%rbp,%rax,1),%ecx
mov    %cl,0x32(%rsp,%rax,1)
movzbl 0x3(%rbp,%rax,1),%ecx
mov    %cl,0x33(%rsp,%rax,1)
add    $0x4,%rax
cmp    %rax,%r9
jne    1240 <AEAD_CGEN+0x120>
movb   $0x80,0x30(%rsp,%r9,1)
cmp    $0x1f,%r9d
je     12b3 <AEAD_CGEN+0x193>
jmp    1281 <AEAD_CGEN+0x161>
movb   $0x80,0x30(%rsp,%r9,1)
mov    0x58(%rsp),%rcx
and    $0x1f,%ecx
lea    0x30(%rsp),%rax
lea    (%rcx,%rax,1),%rdi
add    $0x1,%rdi
xor    %eax,%eax
mov    $0x1e,%edx
sub    %r9d,%edx
cmovb  %eax,%edx
add    $0x1,%edx
xor    %esi,%esi
mov    %r8,%rbp
call   1030 <memset@plt>
mov    %rbp,%r8
lea    0x10(%rsp),%rax
mov    %rax,(%rsp)
lea    0x30(%rsp),%r9
mov    %r13,%rdi
mov    $0x40,%esi
mov    %r8,%rdx
mov    %r12,%rcx
xor    %r8d,%r8d
call   1040 <TEM_ENC@plt>
mov    0x10(%rsp),%al
mov    %al,(%rbx)
mov    0x11(%rsp),%al
mov    %al,0x1(%rbx)
mov    0x12(%rsp),%al
mov    %al,0x2(%rbx)
mov    0x13(%rsp),%al
mov    %al,0x3(%rbx)
mov    0x14(%rsp),%al
mov    %al,0x4(%rbx)
mov    0x15(%rsp),%al
mov    %al,0x5(%rbx)
mov    0x16(%rsp),%al
mov    %al,0x6(%rbx)
mov    0x17(%rsp),%al
mov    %al,0x7(%rbx)
mov    0x18(%rsp),%al
mov    %al,0x8(%rbx)
mov    0x19(%rsp),%al
mov    %al,0x9(%rbx)
mov    0x1a(%rsp),%al
mov    %al,0xa(%rbx)
mov    0x1b(%rsp),%al
mov    %al,0xb(%rbx)
mov    0x1c(%rsp),%al
mov    %al,0xc(%rbx)
mov    0x1d(%rsp),%al
mov    %al,0xd(%rbx)
mov    0x1e(%rsp),%al
mov    %al,0xe(%rbx)
mov    0x1f(%rsp),%al
mov    %al,0xf(%rbx)
mov    0x20(%rsp),%al
mov    %al,0x10(%rbx)
mov    0x21(%rsp),%al
mov    %al,0x11(%rbx)
mov    0x22(%rsp),%al
mov    %al,0x12(%rbx)
mov    0x23(%rsp),%al
mov    %al,0x13(%rbx)
mov    0x24(%rsp),%al
mov    %al,0x14(%rbx)
mov    0x25(%rsp),%al
mov    %al,0x15(%rbx)
mov    0x26(%rsp),%al
mov    %al,0x16(%rbx)
mov    0x27(%rsp),%al
mov    %al,0x17(%rbx)
mov    0x28(%rsp),%al
mov    %al,0x18(%rbx)
mov    0x29(%rsp),%al
mov    %al,0x19(%rbx)
mov    0x2a(%rsp),%al
mov    %al,0x1a(%rbx)
mov    0x2b(%rsp),%al
mov    %al,0x1b(%rbx)
mov    0x2c(%rsp),%al
mov    %al,0x1c(%rbx)
mov    0x2d(%rsp),%al
mov    %al,0x1d(%rbx)
mov    0x2e(%rsp),%al
mov    %al,0x1e(%rbx)
mov    0x2f(%rsp),%al
mov    %al,0x1f(%rbx)
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    $0x10,%r9d
jae    13d2 <AEAD_CGEN+0x2b2>
xor    %eax,%eax
jmp    14a4 <AEAD_CGEN+0x384>
mov    %r9d,%eax
and    $0xfffffff0,%eax
lea    -0x10(%rax),%rdx
mov    %rdx,%rsi
shr    $0x4,%rsi
add    $0x1,%rsi
mov    %esi,%ecx
and    $0x7,%ecx
cmp    $0x70,%rdx
jae    13f6 <AEAD_CGEN+0x2d6>
xor    %edx,%edx
jmp    1463 <AEAD_CGEN+0x343>
and    $0xfffffffffffffff8,%rsi
xor    %edx,%edx
nopl   0x0(%rax)
movups 0x0(%rbp,%rdx,1),%xmm0
movaps %xmm0,0x30(%rsp,%rdx,1)
movups 0x10(%rbp,%rdx,1),%xmm0
movaps %xmm0,0x40(%rsp,%rdx,1)
movups 0x20(%rbp,%rdx,1),%xmm0
movaps %xmm0,0x50(%rsp,%rdx,1)
movups 0x30(%rbp,%rdx,1),%xmm0
movaps %xmm0,0x60(%rsp,%rdx,1)
movups 0x40(%rbp,%rdx,1),%xmm0
movaps %xmm0,0x70(%rsp,%rdx,1)
movups 0x50(%rbp,%rdx,1),%xmm0
movaps %xmm0,0x80(%rsp,%rdx,1)
movups 0x60(%rbp,%rdx,1),%xmm0
movaps %xmm0,0x90(%rsp,%rdx,1)
movups 0x70(%rbp,%rdx,1),%xmm0
movaps %xmm0,0xa0(%rsp,%rdx,1)
sub    $0xffffffffffffff80,%rdx
add    $0xfffffffffffffff8,%rsi
jne    1400 <AEAD_CGEN+0x2e0>
test   %rcx,%rcx
je     1491 <AEAD_CGEN+0x371>
lea    (%rsp,%rdx,1),%rsi
add    $0x30,%rsi
add    %rbp,%rdx
shl    $0x4,%rcx
xor    %edi,%edi
nopl   0x0(%rax)
movups (%rdx,%rdi,1),%xmm0
movaps %xmm0,(%rsi,%rdi,1)
add    $0x10,%rdi
cmp    %rdi,%rcx
jne    1480 <AEAD_CGEN+0x360>
cmp    %r9,%rax
je     126d <AEAD_CGEN+0x14d>
test   $0x8,%r9b
je     120c <AEAD_CGEN+0xec>
mov    %rax,%rcx
mov    %r9d,%eax
and    $0xfffffff8,%eax
nopl   (%rax)
mov    0x0(%rbp,%rcx,1),%rdx
mov    %rdx,0x30(%rsp,%rcx,1)
add    $0x8,%rcx
cmp    %rcx,%rax
jne    14b0 <AEAD_CGEN+0x390>
cmp    %r9,%rax
je     126d <AEAD_CGEN+0x14d>
jmp    120c <AEAD_CGEN+0xec>

LLVM IR (-O0):
define void @AEAD_CGEN(i8* %0, i8* %1, i8* %2, i64 %3, i8* %4, i64* %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i8*
%12 = alloca i64*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i64
%16 = alloca i64
%17 = alloca i8*
%18 = alloca i8*
%19 = alloca [32 x i8]
%20 = alloca [32 x i8]
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
store i8* %0, i8** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i64 %3, i64* %10
store i8* %4, i8** %11
store i64* %5, i64** %12
store i64 1, i64* %15
%25 = load i8*, i8** %9
store i8* %25, i8** %17
%26 = load i8*, i8** %11
store i8* %26, i8** %18
%27 = load i64, i64* %10
%28 = urem i64 %27, 32
%29 = trunc i64 %28 to i32
store i32 %29, i32* %14
%30 = load i64, i64* %10
%31 = udiv i64 %30, 32
%32 = add i64 %31, 1
store i64 %32, i64* %16
%33 = load i64, i64* %16
%34 = mul i64 %33, 32
%35 = load i64*, i64** %12
store i64 %34, i64* %35
br label %36
36: ; preds = %81, %6
%37 = load i64, i64* %16
%38 = icmp ugt i64 %37, 1
br i1 %38, label %39, label %90
39: ; preds = %36
br label %40
40: ; preds = %39
store i32 0, i32* %21
br label %41
41: ; preds = %53, %40
%42 = load i32, i32* %21
%43 = icmp slt i32 %42, 32
br i1 %43, label %44, label %56
44: ; preds = %41
%45 = load i8*, i8** %17
%46 = load i32, i32* %21
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %45, i64 %47
%49 = load i8, i8* %48
%50 = load i32, i32* %21
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [32 x i8], [32 x i8]* %19, i64 0, i64 %51
store i8 %49, i8* %52
br label %53
53: ; preds = %44
%54 = load i32, i32* %21
%55 = add nsw i32 %54, 1
store i32 %55, i32* %21
br label %41
56: ; preds = %41
br label %57
57: ; preds = %56
%58 = load i8*, i8** %7
%59 = load i8*, i8** %8
%60 = load i64, i64* %15
%61 = getelementptr inbounds [32 x i8], [32 x i8]* %19, i64 0, i64 0
%62 = getelementptr inbounds [32 x i8], [32 x i8]* %20, i64 0, i64 0
%63 = call i32 @TEM_ENC(i8* %58, i32 64, i8* %59, i64 %60, i32 0, i8* %61, i8* %62)
br label %64
64: ; preds = %57
store i32 0, i32* %22
br label %65
65: ; preds = %77, %64
%66 = load i32, i32* %22
%67 = icmp slt i32 %66, 32
br i1 %67, label %68, label %80
68: ; preds = %65
%69 = load i32, i32* %22
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds [32 x i8], [32 x i8]* %20, i64 0, i64 %70
%72 = load i8, i8* %71
%73 = load i8*, i8** %18
%74 = load i32, i32* %22
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds i8, i8* %73, i64 %75
store i8 %72, i8* %76
br label %77
77: ; preds = %68
%78 = load i32, i32* %22
%79 = add nsw i32 %78, 1
store i32 %79, i32* %22
br label %65
80: ; preds = %65
br label %81
81: ; preds = %80
%82 = load i64, i64* %15
%83 = add i64 %82, 2
store i64 %83, i64* %15
%84 = load i64, i64* %16
%85 = add i64 %84, -1
store i64 %85, i64* %16
%86 = load i8*, i8** %17
%87 = getelementptr inbounds i8, i8* %86, i64 32
store i8* %87, i8** %17
%88 = load i8*, i8** %18
%89 = getelementptr inbounds i8, i8* %88, i64 32
store i8* %89, i8** %18
br label %36
90: ; preds = %36
br label %91
91: ; preds = %90
store i32 0, i32* %23
br label %92
92: ; preds = %105, %91
%93 = load i32, i32* %23
%94 = load i32, i32* %14
%95 = icmp slt i32 %93, %94
br i1 %95, label %96, label %108
96: ; preds = %92
%97 = load i8*, i8** %17
%98 = load i32, i32* %23
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds i8, i8* %97, i64 %99
%101 = load i8, i8* %100
%102 = load i32, i32* %23
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds [32 x i8], [32 x i8]* %19, i64 0, i64 %103
store i8 %101, i8* %104
br label %105
105: ; preds = %96
%106 = load i32, i32* %23
%107 = add nsw i32 %106, 1
store i32 %107, i32* %23
br label %92
108: ; preds = %92
br label %109
109: ; preds = %108
%110 = load i32, i32* %14
%111 = sext i32 %110 to i64
%112 = getelementptr inbounds [32 x i8], [32 x i8]* %19, i64 0, i64 %111
store i8 -128, i8* %112
%113 = load i32, i32* %14
%114 = add nsw i32 %113, 1
store i32 %114, i32* %13
br label %115
115: ; preds = %122, %109
%116 = load i32, i32* %13
%117 = icmp slt i32 %116, 32
br i1 %117, label %118, label %125
118: ; preds = %115
%119 = load i32, i32* %13
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds [32 x i8], [32 x i8]* %19, i64 0, i64 %120
store i8 0, i8* %121
br label %122
122: ; preds = %118
%123 = load i32, i32* %13
%124 = add nsw i32 %123, 1
store i32 %124, i32* %13
br label %115
125: ; preds = %115
%126 = load i8*, i8** %7
%127 = load i8*, i8** %8
%128 = load i64, i64* %15
%129 = getelementptr inbounds [32 x i8], [32 x i8]* %19, i64 0, i64 0
%130 = getelementptr inbounds [32 x i8], [32 x i8]* %20, i64 0, i64 0
%131 = call i32 @TEM_ENC(i8* %126, i32 64, i8* %127, i64 %128, i32 0, i8* %129, i8* %130)
br label %132
132: ; preds = %125
store i32 0, i32* %24
br label %133
133: ; preds = %145, %132
%134 = load i32, i32* %24
%135 = icmp slt i32 %134, 32
br i1 %135, label %136, label %148
136: ; preds = %133
%137 = load i32, i32* %24
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds [32 x i8], [32 x i8]* %20, i64 0, i64 %138
%140 = load i8, i8* %139
%141 = load i8*, i8** %18
%142 = load i32, i32* %24
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds i8, i8* %141, i64 %143
store i8 %140, i8* %144
br label %145
145: ; preds = %136
%146 = load i32, i32* %24
%147 = add nsw i32 %146, 1
store i32 %147, i32* %24
br label %133
148: ; preds = %133
br label %149
149: ; preds = %148
ret void
}

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