#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 shellaesDec(unsigned char const *, unsigned char const *,
                unsigned char const *, unsigned long long,
                unsigned char const *, unsigned long long, unsigned char *,
                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) {
  int flag;
  *mlen = clen - 16;
  flag = shellaesDec(k, npub, ad, adlen, c, clen, m, mlen);
  if (flag != 0) {
    return 0;
  } else {
    return -1;
  }
}


x86 assembly (clang, -O0):
<crypto_aead_decrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%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)
mov    -0x30(%rbp),%rcx
sub    $0x10,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    0x20(%rbp),%rdi
mov    0x18(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    0x10(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
mov    -0x10(%rbp),%r10
mov    -0x18(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <shellaesDec@plt>
mov    %eax,-0x3c(%rbp)
cmpl   $0x0,-0x3c(%rbp)
je     1192 <crypto_aead_decrypt+0x82>
movl   $0x0,-0x4(%rbp)
jmp    1199 <crypto_aead_decrypt+0x89>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crypto_aead_decrypt>:
push   %rax
mov    %r9,%rdx
mov    %r8,%r9
mov    %rcx,%r8
mov    %rsi,%r11
mov    %rdi,%r10
mov    0x20(%rsp),%rdi
mov    0x18(%rsp),%rsi
mov    0x10(%rsp),%rcx
lea    -0x10(%r9),%rax
mov    %rax,(%r11)
push   %r11
push   %r10
call   1030 <shellaesDec@plt>
add    $0x10,%rsp
cmp    $0x1,%eax
sbb    %eax,%eax
pop    %rcx
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 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
%21 = load i64, i64* %15
%22 = sub i64 %21, 16
%23 = load i64*, i64** %12
store i64 %22, i64* %23
%24 = load i8*, i8** %19
%25 = load i8*, i8** %18
%26 = load i8*, i8** %16
%27 = load i64, i64* %17
%28 = load i8*, i8** %14
%29 = load i64, i64* %15
%30 = load i8*, i8** %11
%31 = load i64*, i64** %12
%32 = call i32 @shellaesDec(i8* %24, i8* %25, i8* %26, i64 %27, i8* %28, i64 %29, i8* %30, i64* %31)
store i32 %32, i32* %20
%33 = load i32, i32* %20
%34 = icmp ne i32 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %9
store i32 0, i32* %10
br label %37
36: ; preds = %9
store i32 -1, i32* %10
br label %37
37: ; preds = %36, %35
%38 = load i32, i32* %10
ret i32 %38
}

LLVM IR (-O2):
define i32 @crypto_aead_decrypt(i8* %0, i64* %1, i8* nocapture readnone %2, i8* %3, i64 %4, i8* %5, i64 %6, i8* %7, i8* %8) {
%10 = add i64 %4, -16
store i64 %10, i64* %1
%11 = tail call i32 @shellaesDec(i8* %8, i8* %7, i8* %5, i64 %6, i8* %3, i64 %4, i8* %0, i64* %1)
%12 = icmp eq i32 %11, 0
%13 = sext i1 %12 to i32
ret i32 %13
}