#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*/ shellaesEnc(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_encrypt(unsigned char *c, unsigned long long *clen,
                        const unsigned char *m, unsigned long long mlen,
                        const unsigned char *ad, unsigned long long adlen,
                        const unsigned char *nsec, const unsigned char *npub,
                        const unsigned char *k) {
  *clen = mlen + 16 - (mlen % 16) + 16;
  shellaesEnc(k, npub, ad, adlen, m, mlen, c, *clen);
  return 0;
}


x86 assembly (clang, -O0):
<crypto_aead_encrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x20(%rbp),%rcx
add    $0x10,%rcx
mov    -0x20(%rbp),%rax
and    $0xf,%rax
sub    %rax,%rcx
add    $0x10,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    0x20(%rbp),%rdi
mov    0x18(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x20(%rbp),%r9
mov    -0x8(%rbp),%r10
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <shellaesEnc@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crypto_aead_encrypt>:
push   %rbx
mov    %rcx,%rax
mov    %rdx,%r10
mov    %rdi,%r11
mov    0x20(%rsp),%rdi
mov    0x18(%rsp),%rcx
lea    0x20(%rax),%rbx
and    $0xfffffffffffffff0,%rbx
mov    %rbx,(%rsi)
mov    %rcx,%rsi
mov    %r8,%rdx
mov    %r9,%rcx
mov    %r10,%r8
mov    %rax,%r9
push   %rbx
push   %r11
call   1030 <shellaesEnc@plt>
add    $0x10,%rsp
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @crypto_aead_encrypt(i8* %0, i64* %1, i8* %2, i64 %3, i8* %4, i64 %5, i8* %6, i8* %7, i8* %8) {
%10 = alloca i8*
%11 = alloca i64*
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i8*
%15 = alloca i64
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i8*
store i8* %0, i8** %10
store i64* %1, i64** %11
store i8* %2, i8** %12
store i64 %3, i64* %13
store i8* %4, i8** %14
store i64 %5, i64* %15
store i8* %6, i8** %16
store i8* %7, i8** %17
store i8* %8, i8** %18
%19 = load i64, i64* %13
%20 = add i64 %19, 16
%21 = load i64, i64* %13
%22 = urem i64 %21, 16
%23 = sub i64 %20, %22
%24 = add i64 %23, 16
%25 = load i64*, i64** %11
store i64 %24, i64* %25
%26 = load i8*, i8** %18
%27 = load i8*, i8** %17
%28 = load i8*, i8** %14
%29 = load i64, i64* %15
%30 = load i8*, i8** %12
%31 = load i64, i64* %13
%32 = load i8*, i8** %10
%33 = load i64*, i64** %11
%34 = load i64, i64* %33
%35 = call i32 @shellaesEnc(i8* %26, i8* %27, i8* %28, i64 %29, i8* %30, i64 %31, i8* %32, i64 %34)
ret i32 0
}

LLVM IR (-O2):
define i32 @crypto_aead_encrypt(i8* %0, i64* nocapture writeonly %1, i8* %2, i64 %3, i8* %4, i64 %5, i8* nocapture readnone %6, i8* %7, i8* %8) {
%10 = add i64 %3, 32
%11 = and i64 %10, -16
store i64 %11, i64* %1
%12 = tail call i32 @shellaesEnc(i8* %8, i8* %7, i8* %4, i64 %5, i8* %2, i64 %3, i8* %0, i64 %11)
ret i32 0
}