#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*/
aegis128L_dec_aut_step(unsigned char *, unsigned char const *, unsigned char *);
int /*<<< orphan*/ aegis128L_enc_aut_step(unsigned char const *,
                                          unsigned char *, unsigned char *);
int /*<<< orphan*/ aegis128L_initialization(unsigned char const *,
                                            unsigned char const *,
                                            unsigned char *);
int /*<<< orphan*/ aegis128L_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[32], ciphertextblock[32];
  unsigned char tag[16];
  unsigned char check = 0;
  unsigned char aegis128L_state[128];
  if (clen < 16)
    return -1;
  aegis128L_initialization(k, npub, aegis128L_state);
  for (i = 0; (i + 32) <= adlen; i += 32) {
    aegis128L_enc_aut_step(ad + i, ciphertextblock, aegis128L_state);
  }
  if ((adlen & 0x1f) != 0) {
    memset(plaintextblock, 0, 32);
    memcpy(plaintextblock, ad + i, adlen & 0x1f);
    aegis128L_enc_aut_step(plaintextblock, ciphertextblock, aegis128L_state);
  }
  *mlen = clen - 16;
  for (i = 0; (i + 32) <= *mlen; i += 32) {
    aegis128L_dec_aut_step(m + i, c + i, aegis128L_state);
  }
  if ((*mlen & 0x1f) != 0) {
    memset(ciphertextblock, 0, 32);
    memcpy(ciphertextblock, c + i, *mlen & 0x1f);
    aegis128L_dec_aut_step(plaintextblock, ciphertextblock, aegis128L_state);
    memcpy(m + i, plaintextblock, *mlen & 0x1f);
    memset(plaintextblock, 0, *mlen & 0x1f);
    {
      ((unsigned long long *)(aegis128L_state))[0] =
          ((unsigned long long *)(aegis128L_state))[0] ^
          ((unsigned long long *)(plaintextblock))[0];
      ((unsigned long long *)(aegis128L_state))[1] =
          ((unsigned long long *)(aegis128L_state))[1] ^
          ((unsigned long long *)(plaintextblock))[1];
    };
    {
      ((unsigned long long *)(aegis128L_state + 64))[0] =
          ((unsigned long long *)(aegis128L_state + 64))[0] ^
          ((unsigned long long *)(plaintextblock + 16))[0];
      ((unsigned long long *)(aegis128L_state + 64))[1] =
          ((unsigned long long *)(aegis128L_state + 64))[1] ^
          ((unsigned long long *)(plaintextblock + 16))[1];
    };
  }
  aegis128L_tag_generation(*mlen, adlen, 16, tag, aegis128L_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    $0x120,%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,-0x91(%rbp)
cmpq   $0x10,-0x30(%rbp)
jae    11ad <crypto_aead_decrypt+0x4d>
movl   $0xffffffff,-0x4(%rbp)
jmp    1416 <crypto_aead_decrypt+0x2b6>
mov    0x20(%rbp),%rdi
mov    0x18(%rbp),%rsi
lea    -0x120(%rbp),%rdx
call   1070 <aegis128L_initialization@plt>
movq   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%rax
add    $0x20,%rax
cmp    0x10(%rbp),%rax
ja     1204 <crypto_aead_decrypt+0xa4>
mov    -0x38(%rbp),%rdi
add    -0x40(%rbp),%rdi
lea    -0x80(%rbp),%rsi
lea    -0x120(%rbp),%rdx
call   1080 <aegis128L_enc_aut_step@plt>
mov    -0x40(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x40(%rbp)
jmp    11c9 <crypto_aead_decrypt+0x69>
mov    0x10(%rbp),%rax
and    $0x1f,%rax
cmp    $0x0,%rax
je     1253 <crypto_aead_decrypt+0xf3>
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1030 <memset@plt>
lea    -0x60(%rbp),%rdi
mov    -0x38(%rbp),%rsi
add    -0x40(%rbp),%rsi
mov    0x10(%rbp),%rdx
and    $0x1f,%rdx
call   1050 <memcpy@plt>
lea    -0x60(%rbp),%rdi
lea    -0x80(%rbp),%rsi
lea    -0x120(%rbp),%rdx
call   1080 <aegis128L_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    $0x20,%rax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%rax
ja     12ac <crypto_aead_decrypt+0x14c>
mov    -0x10(%rbp),%rdi
add    -0x40(%rbp),%rdi
mov    -0x28(%rbp),%rsi
add    -0x40(%rbp),%rsi
lea    -0x120(%rbp),%rdx
call   1040 <aegis128L_dec_aut_step@plt>
mov    -0x40(%rbp),%rax
add    $0x20,%rax
mov    %rax,-0x40(%rbp)
jmp    126a <crypto_aead_decrypt+0x10a>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
and    $0x1f,%rax
cmp    $0x0,%rax
je     137b <crypto_aead_decrypt+0x21b>
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1030 <memset@plt>
lea    -0x80(%rbp),%rdi
mov    -0x28(%rbp),%rsi
add    -0x40(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
and    $0x1f,%rdx
call   1050 <memcpy@plt>
lea    -0x60(%rbp),%rdi
lea    -0x80(%rbp),%rsi
lea    -0x120(%rbp),%rdx
call   1040 <aegis128L_dec_aut_step@plt>
mov    -0x10(%rbp),%rdi
add    -0x40(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
and    $0x1f,%rdx
call   1050 <memcpy@plt>
lea    -0x60(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    (%rax),%rdx
and    $0x1f,%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x120(%rbp),%rax
xor    -0x60(%rbp),%rax
mov    %rax,-0x120(%rbp)
mov    -0x118(%rbp),%rax
xor    -0x58(%rbp),%rax
mov    %rax,-0x118(%rbp)
mov    -0xe0(%rbp),%rax
xor    -0x50(%rbp),%rax
mov    %rax,-0xe0(%rbp)
mov    -0xd8(%rbp),%rax
xor    -0x48(%rbp),%rax
mov    %rax,-0xd8(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    0x10(%rbp),%rsi
lea    -0x90(%rbp),%rcx
lea    -0x120(%rbp),%r8
mov    $0x10,%edx
call   1060 <aegis128L_tag_generation@plt>
movq   $0x0,-0x40(%rbp)
cmpq   $0x10,-0x40(%rbp)
jae    13f3 <crypto_aead_decrypt+0x293>
mov    -0x40(%rbp),%rax
movzbl -0x90(%rbp,%rax,1),%ecx
ff
mov    -0x28(%rbp),%rax
mov    -0x30(%rbp),%rdx
sub    $0x10,%rdx
add    -0x40(%rbp),%rdx
movzbl (%rax,%rdx,1),%eax
xor    %eax,%ecx
movzbl -0x91(%rbp),%eax
or     %ecx,%eax
mov    %al,-0x91(%rbp)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    13a6 <crypto_aead_decrypt+0x246>
movzbl -0x91(%rbp),%eax
cmp    $0x0,%eax
jne    140f <crypto_aead_decrypt+0x2af>
movl   $0x0,-0x4(%rbp)
jmp    1416 <crypto_aead_decrypt+0x2b6>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crypto_aead_decrypt>:
mov    $0xffffffff,%eax
cmp    $0x10,%r8
jb     1398 <crypto_aead_decrypt+0x238>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xf8,%rsp
mov    %r9,%rbp
mov    %rdi,0x18(%rsp)
mov    %rsi,%r15
mov    %rcx,0x10(%rsp)
mov    %r8,0x8(%rsp)
mov    0x140(%rsp),%rdi
mov    0x138(%rsp),%rsi
mov    0x130(%rsp),%rbx
lea    0x70(%rsp),%rdx
call   1070 <aegis128L_initialization@plt>
cmp    $0x20,%rbx
jae    11c5 <crypto_aead_decrypt+0x65>
mov    %rbx,%rax
xor    %r13d,%r13d
jmp    1207 <crypto_aead_decrypt+0xa7>
xor    %ebx,%ebx
lea    0x50(%rsp),%r14
lea    0x70(%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 <aegis128L_enc_aut_step@plt>
mov    0x130(%rsp),%rax
lea    0x20(%rbx),%r13
add    $0x40,%rbx
cmp    %rax,%rbx
mov    %r13,%rbx
jbe    11e0 <crypto_aead_decrypt+0x80>
mov    %rax,%r14
and    $0x1f,%r14
je     1247 <crypto_aead_decrypt+0xe7>
lea    0x30(%rsp),%r12
mov    $0x20,%edx
mov    %r12,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
add    %r13,%rbp
mov    %r12,%rdi
mov    %rbp,%rsi
mov    %r14,%rdx
call   1050 <memcpy@plt>
lea    0x50(%rsp),%rsi
lea    0x70(%rsp),%rdx
mov    %r12,%rdi
call   1080 <aegis128L_enc_aut_step@plt>
mov    0x8(%rsp),%rdi
add    $0xfffffffffffffff0,%rdi
mov    %rdi,(%r15)
cmp    $0x20,%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    0x70(%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 <aegis128L_dec_aut_step@plt>
mov    %r15,%rax
mov    (%r15),%rdi
lea    0x20(%rbx),%rbp
add    $0x40,%rbx
cmp    %rdi,%rbx
mov    %rbp,%rbx
jbe    1280 <crypto_aead_decrypt+0x120>
test   $0x1f,%dil
je     1340 <crypto_aead_decrypt+0x1e0>
lea    0x50(%rsp),%r15
mov    $0x20,%edx
mov    %r15,%rdi
mov    %rax,%rbx
xor    %esi,%esi
call   1030 <memset@plt>
mov    %r13,%rsi
add    %rbp,%rsi
mov    (%rbx),%rdx
and    $0x1f,%edx
mov    %r15,%rdi
call   1050 <memcpy@plt>
lea    0x30(%rsp),%r14
lea    0x70(%rsp),%rdx
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <aegis128L_dec_aut_step@plt>
mov    0x18(%rsp),%rdi
add    %rbp,%rdi
mov    (%rbx),%rdx
and    $0x1f,%edx
mov    %r14,%rsi
call   1050 <memcpy@plt>
mov    (%rbx),%rdx
and    $0x1f,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
movaps 0x30(%rsp),%xmm0
movdqa 0x40(%rsp),%xmm1
xorps  0x70(%rsp),%xmm0
movaps %xmm0,0x70(%rsp)
pxor   0xb0(%rsp),%xmm1
movdqa %xmm1,0xb0(%rsp)
mov    (%rbx),%rdi
lea    0x20(%rsp),%rcx
lea    0x70(%rsp),%r8
mov    0x130(%rsp),%rsi
mov    $0x10,%edx
call   1060 <aegis128L_tag_generation@plt>
mov    0x8(%rsp),%rax
movdqu 0x0(%r13,%rax,1),%xmm0
pxor   0x20(%rsp),%xmm0
pxor   %xmm1,%xmm1
pcmpeqb %xmm0,%xmm1
pmovmskb %xmm1,%ecx
xor    %eax,%eax
cmp    $0xffff,%ecx
setne  %al
neg    %eax
add    $0xf8,%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 [32 x i8]
%22 = alloca [32 x i8]
%23 = alloca [16 x i8]
%24 = alloca i8
%25 = alloca [128 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 %213
29: ; preds = %9
%30 = load i8*, i8** %19
%31 = load i8*, i8** %18
%32 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%33 = call i32 @aegis128L_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, 32
%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 [32 x i8], [32 x i8]* %22, i64 0, i64 0
%44 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%45 = call i32 @aegis128L_enc_aut_step(i8* %42, i8* %43, i8* %44)
br label %46
46: ; preds = %39
%47 = load i64, i64* %20
%48 = add i64 %47, 32
store i64 %48, i64* %20
br label %34
49: ; preds = %34
%50 = load i64, i64* %17
%51 = and i64 %50, 31
%52 = icmp ne i64 %51, 0
br i1 %52, label %53, label %67
53: ; preds = %49
%54 = getelementptr inbounds [32 x i8], [32 x i8]* %21, i64 0, i64 0
%55 = call i32 @memset(i8* %54, i32 0, i64 32)
%56 = getelementptr inbounds [32 x i8], [32 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, 31
%62 = call i32 @memcpy(i8* %56, i8* %59, i64 %61)
%63 = getelementptr inbounds [32 x i8], [32 x i8]* %21, i64 0, i64 0
%64 = getelementptr inbounds [32 x i8], [32 x i8]* %22, i64 0, i64 0
%65 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%66 = call i32 @aegis128L_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, 32
%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 [128 x i8], [128 x i8]* %25, i64 0, i64 0
%85 = call i32 @aegis128L_dec_aut_step(i8* %80, i8* %83, i8* %84)
br label %86
86: ; preds = %77
%87 = load i64, i64* %20
%88 = add i64 %87, 32
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, 31
%93 = icmp ne i64 %92, 0
br i1 %93, label %94, label %176
94: ; preds = %89
%95 = getelementptr inbounds [32 x i8], [32 x i8]* %22, i64 0, i64 0
%96 = call i32 @memset(i8* %95, i32 0, i64 32)
%97 = getelementptr inbounds [32 x i8], [32 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, 31
%104 = call i32 @memcpy(i8* %97, i8* %100, i64 %103)
%105 = getelementptr inbounds [32 x i8], [32 x i8]* %21, i64 0, i64 0
%106 = getelementptr inbounds [32 x i8], [32 x i8]* %22, i64 0, i64 0
%107 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%108 = call i32 @aegis128L_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 [32 x i8], [32 x i8]* %21, i64 0, i64 0
%113 = load i64*, i64** %12
%114 = load i64, i64* %113
%115 = and i64 %114, 31
%116 = call i32 @memcpy(i8* %111, i8* %112, i64 %115)
%117 = getelementptr inbounds [32 x i8], [32 x i8]* %21, i64 0, i64 0
%118 = load i64*, i64** %12
%119 = load i64, i64* %118
%120 = and i64 %119, 31
%121 = call i32 @memset(i8* %117, i32 0, i64 %120)
%122 = getelementptr inbounds [128 x i8], [128 x i8]* %25, 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 [32 x i8], [32 x i8]* %21, 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 %125, %129
%131 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%132 = bitcast i8* %131 to i64*
%133 = getelementptr inbounds i64, i64* %132, i64 0
store i64 %130, i64* %133
%134 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%135 = bitcast i8* %134 to i64*
%136 = getelementptr inbounds i64, i64* %135, i64 1
%137 = load i64, i64* %136
%138 = getelementptr inbounds [32 x i8], [32 x i8]* %21, i64 0, i64 0
%139 = bitcast i8* %138 to i64*
%140 = getelementptr inbounds i64, i64* %139, i64 1
%141 = load i64, i64* %140
%142 = xor i64 %137, %141
%143 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%144 = bitcast i8* %143 to i64*
%145 = getelementptr inbounds i64, i64* %144, i64 1
store i64 %142, i64* %145
%146 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%147 = getelementptr inbounds i8, i8* %146, i64 64
%148 = bitcast i8* %147 to i64*
%149 = getelementptr inbounds i64, i64* %148, i64 0
%150 = load i64, i64* %149
%151 = getelementptr inbounds [32 x i8], [32 x i8]* %21, i64 0, i64 0
%152 = getelementptr inbounds i8, i8* %151, i64 16
%153 = bitcast i8* %152 to i64*
%154 = getelementptr inbounds i64, i64* %153, i64 0
%155 = load i64, i64* %154
%156 = xor i64 %150, %155
%157 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%158 = getelementptr inbounds i8, i8* %157, i64 64
%159 = bitcast i8* %158 to i64*
%160 = getelementptr inbounds i64, i64* %159, i64 0
store i64 %156, i64* %160
%161 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%162 = getelementptr inbounds i8, i8* %161, i64 64
%163 = bitcast i8* %162 to i64*
%164 = getelementptr inbounds i64, i64* %163, i64 1
%165 = load i64, i64* %164
%166 = getelementptr inbounds [32 x i8], [32 x i8]* %21, i64 0, i64 0
%167 = getelementptr inbounds i8, i8* %166, i64 16
%168 = bitcast i8* %167 to i64*
%169 = getelementptr inbounds i64, i64* %168, i64 1
%170 = load i64, i64* %169
%171 = xor i64 %165, %170
%172 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%173 = getelementptr inbounds i8, i8* %172, i64 64
%174 = bitcast i8* %173 to i64*
%175 = getelementptr inbounds i64, i64* %174, i64 1
store i64 %171, i64* %175
br label %176
176: ; preds = %94, %89
%177 = load i64*, i64** %12
%178 = load i64, i64* %177
%179 = load i64, i64* %17
%180 = getelementptr inbounds [16 x i8], [16 x i8]* %23, i64 0, i64 0
%181 = getelementptr inbounds [128 x i8], [128 x i8]* %25, i64 0, i64 0
%182 = call i32 @aegis128L_tag_generation(i64 %178, i64 %179, i32 16, i8* %180, i8* %181)
store i64 0, i64* %20
br label %183
183: ; preds = %204, %176
%184 = load i64, i64* %20
%185 = icmp ult i64 %184, 16
br i1 %185, label %186, label %207
186: ; preds = %183
%187 = load i64, i64* %20
%188 = getelementptr inbounds [16 x i8], [16 x i8]* %23, i64 0, i64 %187
%189 = load i8, i8* %188
%190 = zext i8 %189 to i32
%191 = load i8*, i8** %14
%192 = load i64, i64* %15
%193 = sub i64 %192, 16
%194 = load i64, i64* %20
%195 = add i64 %193, %194
%196 = getelementptr inbounds i8, i8* %191, i64 %195
%197 = load i8, i8* %196
%198 = zext i8 %197 to i32
%199 = xor i32 %190, %198
%200 = load i8, i8* %24
%201 = zext i8 %200 to i32
%202 = or i32 %201, %199
%203 = trunc i32 %202 to i8
store i8 %203, i8* %24
br label %204
204: ; preds = %186
%205 = load i64, i64* %20
%206 = add i64 %205, 1
store i64 %206, i64* %20
br label %183
207: ; preds = %183
%208 = load i8, i8* %24
%209 = zext i8 %208 to i32
%210 = icmp eq i32 %209, 0
br i1 %210, label %211, label %212
211: ; preds = %207
store i32 0, i32* %10
br label %213
212: ; preds = %207
store i32 -1, i32* %10
br label %213
213: ; preds = %212, %211, %28
%214 = load i32, i32* %10
ret i32 %214
}

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