#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 *,
                           unsigned long long, int, unsigned char *,
                           unsigned char *);
int MAC_GEN(const unsigned char *_K, 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], t[32], zero[13];
  i = 1;
  mp = _M;
  cp = C_;
  pad = _mlen % 32;
  blocknum = _mlen / 32;
  if ((pad != 0) || (_mlen == 0))
    blocknum += 1;
  do {
    int u;
    for (u = 0; u < 32; u++)
      (t)[u] = 0x00;
  } while (0);
  do {
    int u;
    for (u = 0; u < 13; u++)
      (zero)[u] = 0x00;
  } while (0);
  while (blocknum > 1) {
    do {
      int u;
      for (u = 0; u < 32; u++)
        (in)[u] = (mp)[u];
    } while (0);
    TEM_ENC(_K, 0x80, zero, i, 0, in, out);
    do {
      int u;
      for (u = 0; u < 32; u++)
        (t)[u] ^= (out)[u];
    } while (0);
    i++;
    blocknum--;
    mp += 32;
  }
  if ((pad == 0) && (_mlen != 0)) {
    do {
      int u;
      for (u = 0; u < 32; u++)
        (in)[u] = (mp)[u];
    } while (0);
  } else {
    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;
  }
  do {
    int u;
    for (u = 0; u < 32; u++)
      (in)[u] ^= (t)[u];
  } while (0);
  if ((pad == 0) && (_mlen != 0)) {
    TEM_ENC(_K, 0x80, zero, i - 1, 1, in, out);
  } else {
    TEM_ENC(_K, 0x80, zero, i - 1, 2, in, out);
  }
  do {
    int u;
    for (u = 0; u < 16; u++)
      (cp)[u] = (out)[u];
  } while (0);
  *clen_ = 16;
  return 0;
}


x86 assembly (clang, -O0):
<MAC_GEN>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movq   $0x1,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x18(%rbp),%rax
and    $0x1f,%rax
mov    %eax,-0x30(%rbp)
mov    -0x18(%rbp),%rax
shr    $0x5,%rax
mov    %rax,-0x40(%rbp)
cmpl   $0x0,-0x30(%rbp)
jne    1173 <MAC_GEN+0x63>
cmpq   $0x0,-0x18(%rbp)
jne    117f <MAC_GEN+0x6f>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    1184 <MAC_GEN+0x74>
movl   $0x0,-0xc4(%rbp)
cmpl   $0x20,-0xc4(%rbp)
jge    11be <MAC_GEN+0xae>
movslq -0xc4(%rbp),%rax
movb   $0x0,-0xb0(%rbp,%rax,1)
mov    -0xc4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc4(%rbp)
jmp    118e <MAC_GEN+0x7e>
jmp    11c3 <MAC_GEN+0xb3>
jmp    11c8 <MAC_GEN+0xb8>
movl   $0x0,-0xc8(%rbp)
cmpl   $0xd,-0xc8(%rbp)
jge    1202 <MAC_GEN+0xf2>
movslq -0xc8(%rbp),%rax
movb   $0x0,-0xbd(%rbp,%rax,1)
mov    -0xc8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc8(%rbp)
jmp    11d2 <MAC_GEN+0xc2>
jmp    1207 <MAC_GEN+0xf7>
jmp    120c <MAC_GEN+0xfc>
cmpq   $0x1,-0x40(%rbp)
jbe    1310 <MAC_GEN+0x200>
jmp    121c <MAC_GEN+0x10c>
movl   $0x0,-0xcc(%rbp)
cmpl   $0x20,-0xcc(%rbp)
jge    1260 <MAC_GEN+0x150>
mov    -0x48(%rbp),%rax
movslq -0xcc(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
movslq -0xcc(%rbp),%rax
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0xcc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xcc(%rbp)
jmp    1226 <MAC_GEN+0x116>
jmp    1265 <MAC_GEN+0x155>
mov    -0x8(%rbp),%rdi
lea    -0xbd(%rbp),%rdx
mov    -0x38(%rbp),%rcx
lea    -0x70(%rbp),%r9
lea    -0x90(%rbp),%rax
mov    $0x80,%esi
xor    %r8d,%r8d
mov    %rax,(%rsp)
call   1030 <TEM_ENC@plt>
movl   $0x0,-0xd0(%rbp)
cmpl   $0x20,-0xd0(%rbp)
jge    12e2 <MAC_GEN+0x1d2>
movslq -0xd0(%rbp),%rax
movzbl -0x90(%rbp,%rax,1),%edx
ff
movslq -0xd0(%rbp),%rax
movzbl -0xb0(%rbp,%rax,1),%ecx
ff
xor    %edx,%ecx
mov    %cl,-0xb0(%rbp,%rax,1)
mov    -0xd0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd0(%rbp)
jmp    129a <MAC_GEN+0x18a>
jmp    12e7 <MAC_GEN+0x1d7>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x40(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x40(%rbp)
mov    -0x48(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x48(%rbp)
jmp    120c <MAC_GEN+0xfc>
cmpl   $0x0,-0x30(%rbp)
jne    1378 <MAC_GEN+0x268>
cmpq   $0x0,-0x18(%rbp)
je     1378 <MAC_GEN+0x268>
jmp    132a <MAC_GEN+0x21a>
movl   $0x0,-0xd4(%rbp)
cmpl   $0x20,-0xd4(%rbp)
jge    136e <MAC_GEN+0x25e>
mov    -0x48(%rbp),%rax
movslq -0xd4(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
movslq -0xd4(%rbp),%rax
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
jmp    1334 <MAC_GEN+0x224>
jmp    1373 <MAC_GEN+0x263>
jmp    1400 <MAC_GEN+0x2f0>
jmp    137d <MAC_GEN+0x26d>
movl   $0x0,-0xd8(%rbp)
mov    -0xd8(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    13c3 <MAC_GEN+0x2b3>
mov    -0x48(%rbp),%rax
movslq -0xd8(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
movslq -0xd8(%rbp),%rax
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0xd8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd8(%rbp)
jmp    1387 <MAC_GEN+0x277>
jmp    13c8 <MAC_GEN+0x2b8>
movslq -0x30(%rbp),%rax
movb   $0x80,-0x70(%rbp,%rax,1)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x20,-0x2c(%rbp)
jge    13fb <MAC_GEN+0x2eb>
movslq -0x2c(%rbp),%rax
movb   $0x0,-0x70(%rbp,%rax,1)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    13da <MAC_GEN+0x2ca>
jmp    1400 <MAC_GEN+0x2f0>
jmp    1405 <MAC_GEN+0x2f5>
movl   $0x0,-0xdc(%rbp)
cmpl   $0x20,-0xdc(%rbp)
jge    1451 <MAC_GEN+0x341>
movslq -0xdc(%rbp),%rax
movzbl -0xb0(%rbp,%rax,1),%edx
ff
movslq -0xdc(%rbp),%rax
movzbl -0x70(%rbp,%rax,1),%ecx
xor    %edx,%ecx
mov    %cl,-0x70(%rbp,%rax,1)
mov    -0xdc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xdc(%rbp)
jmp    140f <MAC_GEN+0x2ff>
jmp    1456 <MAC_GEN+0x346>
cmpl   $0x0,-0x30(%rbp)
jne    14a2 <MAC_GEN+0x392>
cmpq   $0x0,-0x18(%rbp)
je     14a2 <MAC_GEN+0x392>
mov    -0x8(%rbp),%rdi
lea    -0xbd(%rbp),%rdx
mov    -0x38(%rbp),%rcx
sub    $0x1,%rcx
lea    -0x70(%rbp),%r9
lea    -0x90(%rbp),%rax
mov    $0x80,%esi
mov    $0x1,%r8d
mov    %rax,(%rsp)
call   1030 <TEM_ENC@plt>
jmp    14d4 <MAC_GEN+0x3c4>
mov    -0x8(%rbp),%rdi
lea    -0xbd(%rbp),%rdx
mov    -0x38(%rbp),%rcx
sub    $0x1,%rcx
lea    -0x70(%rbp),%r9
lea    -0x90(%rbp),%rax
mov    $0x80,%esi
mov    $0x2,%r8d
mov    %rax,(%rsp)
call   1030 <TEM_ENC@plt>
jmp    14d9 <MAC_GEN+0x3c9>
movl   $0x0,-0xe0(%rbp)
cmpl   $0x10,-0xe0(%rbp)
jge    1520 <MAC_GEN+0x410>
movslq -0xe0(%rbp),%rax
mov    -0x90(%rbp,%rax,1),%dl
mov    -0x50(%rbp),%rax
movslq -0xe0(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xe0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe0(%rbp)
jmp    14e3 <MAC_GEN+0x3d3>
jmp    1525 <MAC_GEN+0x415>
mov    -0x28(%rbp),%rax
movq   $0x10,(%rax)
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MAC_GEN>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc8,%rsp
mov    %r8,%r15
mov    %rcx,%r12
mov    %rsi,%rbp
mov    %rdi,%rbx
mov    %edx,%r8d
and    $0x1f,%r8d
test   %r8,%r8
setne  %al
test   %rdx,%rdx
sete   %cl
or     %al,%cl
movzbl %cl,%eax
xorps  %xmm0,%xmm0
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x50(%rsp)
mov    %rdx,%r10
shr    $0x5,%r10
add    %rax,%r10
movq   $0x0,0x30(%rsp)
movq   $0x0,0x35(%rsp)
cmp    $0x2,%r10
jb     125e <MAC_GEN+0x13e>
mov    %rdx,0x60(%rsp)
mov    %r8,0x68(%rsp)
mov    %r12,0x70(%rsp)
mov    %r15,0x78(%rsp)
movaps 0x40(%rsp),%xmm1
movaps 0x50(%rsp),%xmm0
mov    $0x1,%r14d
lea    0x30(%rsp),%r15
lea    0x10(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
movaps %xmm1,0xa0(%rsp)
movaps %xmm0,0xb0(%rsp)
movups 0x0(%rbp),%xmm0
movups 0x10(%rbp),%xmm1
movaps %xmm1,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
lea    0x80(%rsp),%rax
mov    %rax,(%rsp)
mov    %rbx,%rdi
mov    $0x80,%esi
mov    %r15,%rdx
mov    %r14,%rcx
xor    %r8d,%r8d
mov    %r13,%r9
mov    %r10,%r12
call   1040 <TEM_ENC@plt>
movaps 0xa0(%rsp),%xmm1
movaps 0xb0(%rsp),%xmm0
mov    %r12,%r10
xorps  0x80(%rsp),%xmm1
xorps  0x90(%rsp),%xmm0
add    $0x1,%r14
add    $0x20,%rbp
cmp    %r14,%r12
jne    11c0 <MAC_GEN+0xa0>
movaps %xmm1,0x40(%rsp)
movaps %xmm0,0x50(%rsp)
add    $0xffffffffffffffff,%r10
mov    0x78(%rsp),%r15
mov    0x70(%rsp),%r12
mov    0x68(%rsp),%r8
mov    0x60(%rsp),%rdx
jmp    1261 <MAC_GEN+0x141>
xor    %r10d,%r10d
test   %r8d,%r8d
sete   %al
test   %rdx,%rdx
setne  %r14b
and    %al,%r14b
cmp    $0x1,%r14b
jne    128e <MAC_GEN+0x16e>
movups 0x0(%rbp),%xmm0
movaps %xmm0,0x10(%rsp)
movups 0x10(%rbp),%xmm0
movaps %xmm0,0x20(%rsp)
jmp    136e <MAC_GEN+0x24e>
test   %r8d,%r8d
je     133b <MAC_GEN+0x21b>
cmp    $0x8,%r8d
jb     12c0 <MAC_GEN+0x1a0>
lea    (%r8,%rbp,1),%rax
lea    0x10(%rsp),%rcx
cmp    %rax,%rcx
jae    13e7 <MAC_GEN+0x2c7>
lea    (%rsp,%r8,1),%rax
add    $0x10,%rax
cmp    %rax,%rbp
jae    13e7 <MAC_GEN+0x2c7>
xor    %eax,%eax
mov    %rax,%rsi
not    %rsi
add    %r8,%rsi
mov    %r8,%rdi
and    $0x3,%rdi
je     12f3 <MAC_GEN+0x1d3>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl 0x0(%rbp,%rax,1),%ecx
mov    %cl,0x10(%rsp,%rax,1)
add    $0x1,%rax
add    $0xffffffffffffffff,%rdi
jne    12e0 <MAC_GEN+0x1c0>
cmp    $0x3,%rsi
jb     132d <MAC_GEN+0x20d>
nopl   0x0(%rax)
movzbl 0x0(%rbp,%rax,1),%ecx
mov    %cl,0x10(%rsp,%rax,1)
movzbl 0x1(%rbp,%rax,1),%ecx
mov    %cl,0x11(%rsp,%rax,1)
movzbl 0x2(%rbp,%rax,1),%ecx
mov    %cl,0x12(%rsp,%rax,1)
movzbl 0x3(%rbp,%rax,1),%ecx
mov    %cl,0x13(%rsp,%rax,1)
add    $0x4,%rax
cmp    %rax,%r8
jne    1300 <MAC_GEN+0x1e0>
movb   $0x80,0x10(%rsp,%r8,1)
cmp    $0x1f,%r8d
je     136e <MAC_GEN+0x24e>
jmp    1341 <MAC_GEN+0x221>
movb   $0x80,0x10(%rsp,%r8,1)
and    $0x1f,%edx
lea    0x10(%rsp),%rax
lea    (%rdx,%rax,1),%rdi
add    $0x1,%rdi
xor    %eax,%eax
mov    $0x1e,%edx
sub    %r8d,%edx
cmovb  %eax,%edx
add    $0x1,%edx
xor    %esi,%esi
mov    %r10,%rbp
call   1030 <memset@plt>
mov    %rbp,%r10
movaps 0x10(%rsp),%xmm0
xorps  0x40(%rsp),%xmm0
movaps 0x20(%rsp),%xmm1
movaps %xmm0,0x10(%rsp)
xorps  0x50(%rsp),%xmm1
movaps %xmm1,0x20(%rsp)
movzbl %r14b,%eax
mov    $0x2,%r8d
sub    %eax,%r8d
lea    0x80(%rsp),%rax
mov    %rax,(%rsp)
lea    0x30(%rsp),%rdx
lea    0x10(%rsp),%r9
mov    %rbx,%rdi
mov    $0x80,%esi
mov    %r10,%rcx
call   1040 <TEM_ENC@plt>
movaps 0x80(%rsp),%xmm0
movups %xmm0,(%r12)
movq   $0x10,(%r15)
xor    %eax,%eax
add    $0xc8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    $0x10,%r8d
jae    13f4 <MAC_GEN+0x2d4>
xor    %eax,%eax
jmp    14c4 <MAC_GEN+0x3a4>
mov    %r8d,%eax
and    $0xfffffff0,%eax
lea    -0x10(%rax),%rdi
mov    %rdi,%rsi
shr    $0x4,%rsi
add    $0x1,%rsi
mov    %esi,%r9d
and    $0x7,%r9d
cmp    $0x70,%rdi
jae    141a <MAC_GEN+0x2fa>
xor    %ecx,%ecx
jmp    147d <MAC_GEN+0x35d>
and    $0xfffffffffffffff8,%rsi
xor    %ecx,%ecx
movups 0x0(%rbp,%rcx,1),%xmm0
movaps %xmm0,0x10(%rsp,%rcx,1)
movups 0x10(%rbp,%rcx,1),%xmm0
movaps %xmm0,0x20(%rsp,%rcx,1)
movups 0x20(%rbp,%rcx,1),%xmm0
movaps %xmm0,0x30(%rsp,%rcx,1)
movups 0x30(%rbp,%rcx,1),%xmm0
movaps %xmm0,0x40(%rsp,%rcx,1)
movups 0x40(%rbp,%rcx,1),%xmm0
movaps %xmm0,0x50(%rsp,%rcx,1)
movups 0x50(%rbp,%rcx,1),%xmm0
movaps %xmm0,0x60(%rsp,%rcx,1)
movups 0x60(%rbp,%rcx,1),%xmm0
movaps %xmm0,0x70(%rsp,%rcx,1)
movups 0x70(%rbp,%rcx,1),%xmm0
movaps %xmm0,0x80(%rsp,%rcx,1)
sub    $0xffffffffffffff80,%rcx
add    $0xfffffffffffffff8,%rsi
jne    1420 <MAC_GEN+0x300>
test   %r9,%r9
je     14b1 <MAC_GEN+0x391>
lea    (%rsp,%rcx,1),%rsi
add    $0x10,%rsi
add    %rbp,%rcx
shl    $0x4,%r9
xor    %edi,%edi
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movups (%rcx,%rdi,1),%xmm0
movaps %xmm0,(%rsi,%rdi,1)
add    $0x10,%rdi
cmp    %rdi,%r9
jne    14a0 <MAC_GEN+0x380>
cmp    %r8,%rax
je     132d <MAC_GEN+0x20d>
test   $0x8,%r8b
je     12c2 <MAC_GEN+0x1a2>
mov    %rax,%rcx
mov    %r8d,%eax
and    $0xfffffff8,%eax
nopl   (%rax)
mov    0x0(%rbp,%rcx,1),%rsi
mov    %rsi,0x10(%rsp,%rcx,1)
add    $0x8,%rcx
cmp    %rcx,%rax
jne    14d0 <MAC_GEN+0x3b0>
cmp    %r8,%rax
je     132d <MAC_GEN+0x20d>
jmp    12c2 <MAC_GEN+0x1a2>

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

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