#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*/ aegis256_dec_aut_step(unsigned char *, unsigned char const *,
                                         unsigned char *);
int /*<<< orphan*/ aegis256_enc_aut_step(unsigned char const *, unsigned char *,
                                         unsigned char *);
int /*<<< orphan*/ aegis256_initialization(unsigned char const *,
                                           unsigned char const *,
                                           unsigned char *);
int /*<<< orphan*/ aegis256_tag_generation(unsigned long long,
                                           unsigned long long, int,
                                           unsigned char *, unsigned char *);
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char const *,
                          unsigned long long);
int /*<<< orphan*/ memset(unsigned char *, int /*<<< orphan*/,
                          unsigned long long);
int crypto_aead_decrypt(unsigned char *m, unsigned long long *mlen,
                        unsigned char *nsec, const unsigned char *c,
                        unsigned long long clen, const unsigned char *ad,
                        unsigned long long adlen, const unsigned char *npub,
                        const unsigned char *k) {
  unsigned long i;
  unsigned char plaintextblock[16], ciphertextblock[16];
  unsigned char tag[16];
  unsigned char check = 0;
  unsigned char aegis256_state[96];
  if (clen < 16)
    return -1;
  aegis256_initialization(k, npub, aegis256_state);
  for (i = 0; (i + 16) <= adlen; i += 16) {
    aegis256_enc_aut_step(ad + i, ciphertextblock, aegis256_state);
  }
  if ((adlen & 0xf) != 0) {
    memset(plaintextblock, 0, 16);
    memcpy(plaintextblock, ad + i, adlen & 0xf);
    aegis256_enc_aut_step(plaintextblock, ciphertextblock, aegis256_state);
  }
  *mlen = clen - 16;
  for (i = 0; (i + 16) <= *mlen; i += 16) {
    aegis256_dec_aut_step(m + i, c + i, aegis256_state);
  }
  if ((*mlen & 0xf) != 0) {
    memset(ciphertextblock, 0, 16);
    memcpy(ciphertextblock, c + i, *mlen & 0xf);
    aegis256_dec_aut_step(plaintextblock, ciphertextblock, aegis256_state);
    memcpy(m + i, plaintextblock, *mlen & 0xf);
    memset(plaintextblock, 0, *mlen & 0xf);
    ((unsigned long long *)aegis256_state)[0] ^=
        ((unsigned long long *)plaintextblock)[0];
    ((unsigned long long *)aegis256_state)[1] ^=
        ((unsigned long long *)plaintextblock)[1];
  }
  aegis256_tag_generation(*mlen, adlen, 16, tag, aegis256_state);
  for (i = 0; i < 16; i++)
    check |= (tag[i] ^ c[clen - 16 + i]);
  if (check == 0)
    return 0;
  else
    return -1;
}


x86 assembly (clang, -O0):
<crypto_aead_decrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
movb   $0x0,-0x71(%rbp)
cmpq   $0x10,-0x30(%rbp)
jae    11aa <crypto_aead_decrypt+0x4a>
movl   $0xffffffff,-0x4(%rbp)
jmp    13e0 <crypto_aead_decrypt+0x280>
mov    0x20(%rbp),%rdi
mov    0x18(%rbp),%rsi
lea    -0xe0(%rbp),%rdx
call   1060 <aegis256_initialization@plt>
movq   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%rax
add    $0x10,%rax
cmp    0x10(%rbp),%rax
ja     1201 <crypto_aead_decrypt+0xa1>
mov    -0x38(%rbp),%rdi
add    -0x40(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0xe0(%rbp),%rdx
call   1080 <aegis256_enc_aut_step@plt>
mov    -0x40(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x40(%rbp)
jmp    11c6 <crypto_aead_decrypt+0x66>
mov    0x10(%rbp),%rax
and    $0xf,%rax
cmp    $0x0,%rax
je     1250 <crypto_aead_decrypt+0xf0>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1050 <memset@plt>
lea    -0x50(%rbp),%rdi
mov    -0x38(%rbp),%rsi
add    -0x40(%rbp),%rsi
mov    0x10(%rbp),%rdx
and    $0xf,%rdx
call   1070 <memcpy@plt>
lea    -0x50(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0xe0(%rbp),%rdx
call   1080 <aegis256_enc_aut_step@plt>
mov    -0x30(%rbp),%rcx
sub    $0x10,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
movq   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%rax
add    $0x10,%rax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%rax
ja     12a9 <crypto_aead_decrypt+0x149>
mov    -0x10(%rbp),%rdi
add    -0x40(%rbp),%rdi
mov    -0x28(%rbp),%rsi
add    -0x40(%rbp),%rsi
lea    -0xe0(%rbp),%rdx
call   1040 <aegis256_dec_aut_step@plt>
mov    -0x40(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x40(%rbp)
jmp    1267 <crypto_aead_decrypt+0x107>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
and    $0xf,%rax
cmp    $0x0,%rax
je     1354 <crypto_aead_decrypt+0x1f4>
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1050 <memset@plt>
lea    -0x60(%rbp),%rdi
mov    -0x28(%rbp),%rsi
add    -0x40(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
and    $0xf,%rdx
call   1070 <memcpy@plt>
lea    -0x50(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0xe0(%rbp),%rdx
call   1040 <aegis256_dec_aut_step@plt>
mov    -0x10(%rbp),%rdi
add    -0x40(%rbp),%rdi
lea    -0x50(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
and    $0xf,%rdx
call   1070 <memcpy@plt>
lea    -0x50(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
and    $0xf,%rdx
xor    %esi,%esi
call   1050 <memset@plt>
mov    -0x50(%rbp),%rax
xor    -0xe0(%rbp),%rax
mov    %rax,-0xe0(%rbp)
mov    -0x48(%rbp),%rax
xor    -0xd8(%rbp),%rax
mov    %rax,-0xd8(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    0x10(%rbp),%rsi
lea    -0x70(%rbp),%rcx
lea    -0xe0(%rbp),%r8
mov    $0x10,%edx
call   1030 <aegis256_tag_generation@plt>
movq   $0x0,-0x40(%rbp)
cmpq   $0x10,-0x40(%rbp)
jae    13c0 <crypto_aead_decrypt+0x260>
mov    -0x40(%rbp),%rax
movzbl -0x70(%rbp,%rax,1),%ecx
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%rdx
sub    $0x10,%rdx
add    -0x40(%rbp),%rdx
movzbl (%rax,%rdx,1),%eax
xor    %eax,%ecx
movzbl -0x71(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x71(%rbp)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    137c <crypto_aead_decrypt+0x21c>
movzbl -0x71(%rbp),%eax
cmp    $0x0,%eax
jne    13d9 <crypto_aead_decrypt+0x279>
movl   $0x0,-0x4(%rbp)
jmp    13e0 <crypto_aead_decrypt+0x280>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crypto_aead_decrypt>:
mov    $0xffffffff,%eax
cmp    $0x10,%r8
jb     137c <crypto_aead_decrypt+0x21c>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
mov    %r9,%rbp
mov    %rdi,0x18(%rsp)
mov    %rsi,%r15
mov    %rcx,0x10(%rsp)
mov    %r8,0x8(%rsp)
mov    0x100(%rsp),%rdi
mov    0xf8(%rsp),%rsi
mov    0xf0(%rsp),%rbx
lea    0x50(%rsp),%rdx
call   1060 <aegis256_initialization@plt>
cmp    $0x10,%rbx
jae    11c5 <crypto_aead_decrypt+0x65>
mov    %rbx,%rax
xor    %r13d,%r13d
jmp    1207 <crypto_aead_decrypt+0xa7>
xor    %ebx,%ebx
lea    0x20(%rsp),%r14
lea    0x50(%rsp),%r12
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    (%rbx,%rbp,1),%rdi
mov    %r14,%rsi
mov    %r12,%rdx
call   1080 <aegis256_enc_aut_step@plt>
mov    0xf0(%rsp),%rax
lea    0x10(%rbx),%r13
add    $0x20,%rbx
cmp    %rax,%rbx
mov    %r13,%rbx
jbe    11e0 <crypto_aead_decrypt+0x80>
mov    %rax,%r14
and    $0xf,%r14
je     1247 <crypto_aead_decrypt+0xe7>
lea    0x30(%rsp),%r12
mov    $0x10,%edx
mov    %r12,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
add    %r13,%rbp
mov    %r12,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
call   1070 <memcpy@plt>
lea    0x20(%rsp),%rsi
lea    0x50(%rsp),%rdx
mov    %r12,%rdi
call   1080 <aegis256_enc_aut_step@plt>
mov    0x8(%rsp),%rdi
add    $0xfffffffffffffff0,%rdi
mov    %rdi,(%r15)
cmp    $0x10,%rdi
mov    %rdi,0x8(%rsp)
jae    126a <crypto_aead_decrypt+0x10a>
mov    %r15,%rax
xor    %ebp,%ebp
mov    0x10(%rsp),%r13
jmp    12a6 <crypto_aead_decrypt+0x146>
xor    %ebx,%ebx
lea    0x50(%rsp),%r14
mov    0x10(%rsp),%r13
mov    0x18(%rsp),%r12
nopl   0x0(%rax,%rax,1)
lea    (%r12,%rbx,1),%rdi
lea    (%rbx,%r13,1),%rsi
mov    %r14,%rdx
call   1040 <aegis256_dec_aut_step@plt>
mov    %r15,%rax
mov    (%r15),%rdi
lea    0x10(%rbx),%rbp
add    $0x20,%rbx
cmp    %rdi,%rbx
mov    %rbp,%rbx
jbe    1280 <crypto_aead_decrypt+0x120>
test   $0xf,%dil
je     1324 <crypto_aead_decrypt+0x1c4>
lea    0x20(%rsp),%r15
mov    $0x10,%edx
mov    %r15,%rdi
mov    %rax,%rbx
xor    %esi,%esi
call   1050 <memset@plt>
mov    %r13,%rsi
add    %rbp,%rsi
mov    (%rbx),%rdx
and    $0xf,%edx
mov    %r15,%rdi
call   1070 <memcpy@plt>
lea    0x30(%rsp),%r14
lea    0x50(%rsp),%rdx
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <aegis256_dec_aut_step@plt>
mov    0x18(%rsp),%rdi
add    %rbp,%rdi
mov    (%rbx),%rdx
and    $0xf,%edx
mov    %r14,%rsi
call   1070 <memcpy@plt>
mov    (%rbx),%rdx
and    $0xf,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1050 <memset@plt>
movaps 0x50(%rsp),%xmm0
xorps  0x30(%rsp),%xmm0
movaps %xmm0,0x50(%rsp)
mov    (%rbx),%rdi
lea    0x40(%rsp),%rcx
lea    0x50(%rsp),%r8
mov    0xf0(%rsp),%rsi
mov    $0x10,%edx
call   1030 <aegis256_tag_generation@plt>
mov    0x8(%rsp),%rax
movdqu 0x0(%r13,%rax,1),%xmm0
pxor   0x40(%rsp),%xmm0
pxor   %xmm1,%xmm1
pcmpeqb %xmm0,%xmm1
pmovmskb %xmm1,%ecx
xor    %eax,%eax
cmp    $0xffff,%ecx
setne  %al
neg    %eax
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @crypto_aead_decrypt(i8* %0, i64* nocapture %1, i8* nocapture readnone %2, i8* %3, i64 %4, i8* %5, i64 %6, i8* %7, i8* %8) {
%10 = alloca <2 x i64>
%11 = alloca [16 x i8]
%12 = alloca <16 x i8>
%13 = alloca [96 x i8]
%14 = bitcast <2 x i64>* %10 to i8*
%15 = getelementptr inbounds [16 x i8], [16 x i8]* %11, i64 0, i64 0
%16 = getelementptr inbounds <16 x i8>, <16 x i8>* %12, i64 0, i64 0
%17 = getelementptr inbounds [96 x i8], [96 x i8]* %13, i64 0, i64 0
%18 = icmp ult i64 %4, 16
br i1 %18, label %86, label %19
19: ; preds = %9
%20 = call i32 @aegis256_initialization(i8* %8, i8* %7, i8* %17)
%21 = icmp ult i64 %6, 16
br i1 %21, label %29, label %22
22: ; preds = %19, %22
%23 = phi i64 [ %27, %22 ], [ 16, %19 ]
%24 = phi i64 [ %23, %22 ], [ 0, %19 ]
%25 = getelementptr inbounds i8, i8* %5, i64 %24
%26 = call i32 @aegis256_enc_aut_step(i8* %25, i8* %15, i8* %17)
%27 = add i64 %23, 16
%28 = icmp ugt i64 %27, %6
br i1 %28, label %29, label %22
29: ; preds = %22, %19
%30 = phi i64 [ 0, %19 ], [ %23, %22 ]
%31 = and i64 %6, 15
%32 = icmp eq i64 %31, 0
br i1 %32, label %38, label %33
33: ; preds = %29
%34 = call i32 @memset(i8* %14, i32 0, i64 16)
%35 = getelementptr inbounds i8, i8* %5, i64 %30
%36 = call i32 @memcpy(i8* %14, i8* %35, i64 %31)
%37 = call i32 @aegis256_enc_aut_step(i8* %14, i8* %15, i8* %17)
br label %38
38: ; preds = %33, %29
%39 = add i64 %4, -16
store i64 %39, i64* %1
%40 = icmp ult i64 %39, 16
br i1 %40, label %50, label %41
41: ; preds = %38, %41
%42 = phi i64 [ %47, %41 ], [ 16, %38 ]
%43 = phi i64 [ %42, %41 ], [ 0, %38 ]
%44 = getelementptr inbounds i8, i8* %0, i64 %43
%45 = getelementptr inbounds i8, i8* %3, i64 %43
%46 = call i32 @aegis256_dec_aut_step(i8* %44, i8* %45, i8* %17)
%47 = add i64 %42, 16
%48 = load i64, i64* %1
%49 = icmp ugt i64 %47, %48
br i1 %49, label %50, label %41
50: ; preds = %41, %38
%51 = phi i64 [ 0, %38 ], [ %42, %41 ]
%52 = phi i64 [ %39, %38 ], [ %48, %41 ]
%53 = and i64 %52, 15
%54 = icmp eq i64 %53, 0
br i1 %54, label %75, label %55
55: ; preds = %50
%56 = call i32 @memset(i8* %15, i32 0, i64 16)
%57 = getelementptr inbounds i8, i8* %3, i64 %51
%58 = load i64, i64* %1
%59 = and i64 %58, 15
%60 = call i32 @memcpy(i8* %15, i8* %57, i64 %59)
%61 = call i32 @aegis256_dec_aut_step(i8* %14, i8* %15, i8* %17)
%62 = getelementptr inbounds i8, i8* %0, i64 %51
%63 = load i64, i64* %1
%64 = and i64 %63, 15
%65 = call i32 @memcpy(i8* %62, i8* %14, i64 %64)
%66 = load i64, i64* %1
%67 = and i64 %66, 15
%68 = call i32 @memset(i8* %14, i32 0, i64 %67)
%69 = load <2 x i64>, <2 x i64>* %10
%70 = bitcast [96 x i8]* %13 to <2 x i64>*
%71 = load <2 x i64>, <2 x i64>* %70
%72 = xor <2 x i64> %71, %69
%73 = bitcast [96 x i8]* %13 to <2 x i64>*
store <2 x i64> %72, <2 x i64>* %73
%74 = load i64, i64* %1
br label %75
75: ; preds = %55, %50
%76 = phi i64 [ %74, %55 ], [ %52, %50 ]
%77 = call i32 @aegis256_tag_generation(i64 %76, i64 %6, i32 16, i8* %16, i8* %17)
%78 = getelementptr inbounds i8, i8* %3, i64 %39
%79 = load <16 x i8>, <16 x i8>* %12
%80 = bitcast i8* %78 to <16 x i8>*
%81 = load <16 x i8>, <16 x i8>* %80
%82 = xor <16 x i8> %81, %79
%83 = call i8 @llvm.vector.reduce.or.v16i8(<16 x i8> %82)
%84 = icmp ne i8 %83, 0
%85 = sext i1 %84 to i32
br label %86
86: ; preds = %75, %9
%87 = phi i32 [ -1, %9 ], [ %85, %75 ]
ret i32 %87
}