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

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ __m128i;

/* Variables and functions */
int /*<<< orphan*/ _mm_load_si128(int /*<<< orphan*/ *);
int /*<<< orphan*/ _mm_xor_si128(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ aegis256_dec_aut_step(unsigned char *, unsigned char const *,
                                         int /*<<< orphan*/ *);
int /*<<< orphan*/ aegis256_enc_aut_step(unsigned char const *, unsigned char *,
                                         int /*<<< orphan*/ *);
int /*<<< orphan*/ aegis256_initialization(unsigned char const *,
                                           unsigned char const *,
                                           int /*<<< orphan*/ *);
int /*<<< orphan*/ aegis256_tag_generation(unsigned long long,
                                           unsigned long long, int,
                                           unsigned char *,
                                           int /*<<< orphan*/ *);
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 long i;
  unsigned char plaintextblock[16], ciphertextblock[16];
  unsigned char tag[16];
  unsigned char check = 0;
  __m128i aegis256_state[6];
  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);
    aegis256_state[0] = _mm_xor_si128(
        aegis256_state[0], _mm_load_si128((__m128i *)plaintextblock));
  }
  aegis256_tag_generation(*mlen, adlen, 16, tag, aegis256_state);
  for (i = 0; i < 16; i++)
    check |= (tag[i] ^ c[i + *mlen]);
  if (check == 0)
    return 0;
  else
    return -1;
}


x86 assembly (clang, -O0):
<crypto_aead_decrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%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    11ca <crypto_aead_decrypt+0x4a>
movl   $0xffffffff,-0x4(%rbp)
jmp    1403 <crypto_aead_decrypt+0x283>
mov    0x20(%rbp),%rdi
mov    0x18(%rbp),%rsi
lea    -0x90(%rbp),%rdx
call   1070 <aegis256_initialization@plt>
movq   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%rax
add    $0x10,%rax
cmp    0x10(%rbp),%rax
ja     1221 <crypto_aead_decrypt+0xa1>
mov    -0x38(%rbp),%rdi
add    -0x40(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x90(%rbp),%rdx
call   10a0 <aegis256_enc_aut_step@plt>
mov    -0x40(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x40(%rbp)
jmp    11e6 <crypto_aead_decrypt+0x66>
mov    0x10(%rbp),%rax
and    $0xf,%rax
cmp    $0x0,%rax
je     1270 <crypto_aead_decrypt+0xf0>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <memset@plt>
lea    -0x50(%rbp),%rdi
mov    -0x38(%rbp),%rsi
add    -0x40(%rbp),%rsi
mov    0x10(%rbp),%rdx
and    $0xf,%rdx
call   1080 <memcpy@plt>
lea    -0x50(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x90(%rbp),%rdx
call   10a0 <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     12c9 <crypto_aead_decrypt+0x149>
mov    -0x10(%rbp),%rdi
add    -0x40(%rbp),%rdi
mov    -0x28(%rbp),%rsi
add    -0x40(%rbp),%rsi
lea    -0x90(%rbp),%rdx
call   1050 <aegis256_dec_aut_step@plt>
mov    -0x40(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x40(%rbp)
jmp    1287 <crypto_aead_decrypt+0x107>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
and    $0xf,%rax
cmp    $0x0,%rax
je     1378 <crypto_aead_decrypt+0x1f8>
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1060 <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   1080 <memcpy@plt>
lea    -0x50(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x90(%rbp),%rdx
call   1050 <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   1080 <memcpy@plt>
lea    -0x50(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
and    $0xf,%rdx
xor    %esi,%esi
call   1060 <memset@plt>
mov    -0x90(%rbp),%eax
mov    %eax,-0x94(%rbp)
lea    -0x50(%rbp),%rdi
call   1030 <_mm_load_si128@plt>
mov    -0x94(%rbp),%edi
mov    %eax,%esi
call   1090 <_mm_xor_si128@plt>
mov    %eax,-0x90(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    0x10(%rbp),%rsi
lea    -0x70(%rbp),%rcx
lea    -0x90(%rbp),%r8
mov    $0x10,%edx
call   1040 <aegis256_tag_generation@plt>
movq   $0x0,-0x40(%rbp)
cmpq   $0x10,-0x40(%rbp)
jae    13e3 <crypto_aead_decrypt+0x263>
mov    -0x40(%rbp),%rax
movzbl -0x70(%rbp,%rax,1),%ecx
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%rdx
mov    -0x18(%rbp),%rsi
add    (%rsi),%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    13a0 <crypto_aead_decrypt+0x220>
movzbl -0x71(%rbp),%eax
cmp    $0x0,%eax
jne    13fc <crypto_aead_decrypt+0x27c>
movl   $0x0,-0x4(%rbp)
jmp    1403 <crypto_aead_decrypt+0x283>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crypto_aead_decrypt>:
mov    $0xffffffff,%eax
cmp    $0x10,%r8
jb     1393 <crypto_aead_decrypt+0x213>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %r9,%rbp
mov    %r8,%r13
mov    %rdi,0x18(%rsp)
mov    %rsi,0x8(%rsp)
mov    %rcx,0x10(%rsp)
mov    0xc0(%rsp),%rdi
mov    0xb8(%rsp),%rsi
mov    0xb0(%rsp),%rbx
lea    0x20(%rsp),%rdx
call   1070 <aegis256_initialization@plt>
cmp    $0x10,%rbx
jae    11e2 <crypto_aead_decrypt+0x62>
mov    %rbx,%rax
xor    %r12d,%r12d
jmp    1217 <crypto_aead_decrypt+0x97>
xor    %ebx,%ebx
lea    0x40(%rsp),%r15
lea    0x20(%rsp),%r14
xchg   %ax,%ax
lea    (%rbx,%rbp,1),%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   10a0 <aegis256_enc_aut_step@plt>
mov    0xb0(%rsp),%rax
lea    0x10(%rbx),%r12
add    $0x20,%rbx
cmp    %rax,%rbx
mov    %r12,%rbx
jbe    11f0 <crypto_aead_decrypt+0x70>
mov    %rax,%r15
and    $0xf,%r15
je     1257 <crypto_aead_decrypt+0xd7>
lea    0x60(%rsp),%r14
mov    $0x10,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1060 <memset@plt>
add    %r12,%rbp
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %r15,%rdx
call   1080 <memcpy@plt>
lea    0x40(%rsp),%rsi
lea    0x20(%rsp),%rdx
mov    %r14,%rdi
call   10a0 <aegis256_enc_aut_step@plt>
add    $0xfffffffffffffff0,%r13
mov    0x8(%rsp),%r15
mov    %r13,(%r15)
cmp    $0x10,%r13
jae    1272 <crypto_aead_decrypt+0xf2>
xor    %ebx,%ebx
mov    0x10(%rsp),%r14
jmp    12a5 <crypto_aead_decrypt+0x125>
xor    %ebp,%ebp
mov    0x10(%rsp),%r14
mov    0x18(%rsp),%r12
xchg   %ax,%ax
lea    (%r12,%rbp,1),%rdi
lea    (%r14,%rbp,1),%rsi
lea    0x20(%rsp),%rdx
call   1050 <aegis256_dec_aut_step@plt>
mov    (%r15),%r13
lea    0x10(%rbp),%rbx
add    $0x20,%rbp
cmp    %r13,%rbp
mov    %rbx,%rbp
jbe    1280 <crypto_aead_decrypt+0x100>
test   $0xf,%r13b
mov    %r14,%r12
je     133e <crypto_aead_decrypt+0x1be>
lea    0x40(%rsp),%r14
mov    $0x10,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1060 <memset@plt>
lea    (%r12,%rbx,1),%rsi
mov    (%r15),%rdx
and    $0xf,%edx
mov    %r14,%rdi
call   1080 <memcpy@plt>
lea    0x60(%rsp),%r15
lea    0x20(%rsp),%rdx
mov    %r15,%rdi
mov    %r14,%rsi
call   1050 <aegis256_dec_aut_step@plt>
mov    0x18(%rsp),%rdi
add    %rbx,%rdi
mov    0x8(%rsp),%rax
mov    (%rax),%rdx
and    $0xf,%edx
mov    %r15,%rsi
call   1080 <memcpy@plt>
mov    0x8(%rsp),%rax
mov    (%rax),%rdx
and    $0xf,%edx
mov    %r15,%rdi
xor    %esi,%esi
call   1060 <memset@plt>
mov    0x20(%rsp),%ebp
mov    %r15,%rdi
mov    0x8(%rsp),%r15
call   1030 <_mm_load_si128@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1090 <_mm_xor_si128@plt>
mov    %eax,0x20(%rsp)
mov    (%r15),%r13
lea    0x50(%rsp),%rcx
lea    0x20(%rsp),%r8
mov    %r13,%rdi
mov    0xb0(%rsp),%rsi
mov    $0x10,%edx
call   1040 <aegis256_tag_generation@plt>
mov    (%r15),%rax
movdqu (%r12,%rax,1),%xmm0
pxor   0x50(%rsp),%xmm0
pxor   %xmm1,%xmm1
pcmpeqb %xmm0,%xmm1
pmovmskb %xmm1,%ecx
xor    %eax,%eax
cmp    $0xffff,%ecx
setne  %al
neg    %eax
add    $0x78,%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 [6 x i32]
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 %166
29: ; preds = %9
%30 = load i8*, i8** %19
%31 = load i8*, i8** %18
%32 = getelementptr inbounds [6 x i32], [6 x i32]* %25, i64 0, i64 0
%33 = call i32 @aegis256_initialization(i8* %30, i8* %31, i32* %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 [6 x i32], [6 x i32]* %25, i64 0, i64 0
%45 = call i32 @aegis256_enc_aut_step(i8* %42, i8* %43, i32* %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 [6 x i32], [6 x i32]* %25, i64 0, i64 0
%66 = call i32 @aegis256_enc_aut_step(i8* %63, i8* %64, i32* %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 [6 x i32], [6 x i32]* %25, i64 0, i64 0
%85 = call i32 @aegis256_dec_aut_step(i8* %80, i8* %83, i32* %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 %129
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 [6 x i32], [6 x i32]* %25, i64 0, i64 0
%108 = call i32 @aegis256_dec_aut_step(i8* %105, i8* %106, i32* %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 [6 x i32], [6 x i32]* %25, i64 0, i64 0
%123 = load i32, i32* %122
%124 = getelementptr inbounds [16 x i8], [16 x i8]* %21, i64 0, i64 0
%125 = bitcast i8* %124 to i32*
%126 = call i32 @_mm_load_si128(i32* %125)
%127 = call i32 @_mm_xor_si128(i32 %123, i32 %126)
%128 = getelementptr inbounds [6 x i32], [6 x i32]* %25, i64 0, i64 0
store i32 %127, i32* %128
br label %129
129: ; preds = %94, %89
%130 = load i64*, i64** %12
%131 = load i64, i64* %130
%132 = load i64, i64* %17
%133 = getelementptr inbounds [16 x i8], [16 x i8]* %23, i64 0, i64 0
%134 = getelementptr inbounds [6 x i32], [6 x i32]* %25, i64 0, i64 0
%135 = call i32 @aegis256_tag_generation(i64 %131, i64 %132, i32 16, i8* %133, i32* %134)
store i64 0, i64* %20
br label %136
136: ; preds = %157, %129
%137 = load i64, i64* %20
%138 = icmp ult i64 %137, 16
br i1 %138, label %139, label %160
139: ; preds = %136
%140 = load i64, i64* %20
%141 = getelementptr inbounds [16 x i8], [16 x i8]* %23, i64 0, i64 %140
%142 = load i8, i8* %141
%143 = zext i8 %142 to i32
%144 = load i8*, i8** %14
%145 = load i64, i64* %20
%146 = load i64*, i64** %12
%147 = load i64, i64* %146
%148 = add i64 %145, %147
%149 = getelementptr inbounds i8, i8* %144, i64 %148
%150 = load i8, i8* %149
%151 = zext i8 %150 to i32
%152 = xor i32 %143, %151
%153 = load i8, i8* %24
%154 = zext i8 %153 to i32
%155 = or i32 %154, %152
%156 = trunc i32 %155 to i8
store i8 %156, i8* %24
br label %157
157: ; preds = %139
%158 = load i64, i64* %20
%159 = add i64 %158, 1
store i64 %159, i64* %20
br label %136
160: ; preds = %136
%161 = load i8, i8* %24
%162 = zext i8 %161 to i32
%163 = icmp eq i32 %162, 0
br i1 %163, label %164, label %165
164: ; preds = %160
store i32 0, i32* %10
br label %166
165: ; preds = %160
store i32 -1, i32* %10
br label %166
166: ; preds = %165, %164, %28
%167 = load i32, i32* %10
ret i32 %167
}

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