#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 do_test_crypto_aead(unsigned char const *, unsigned long long,
                        unsigned char const *, unsigned long long,
                        unsigned char const *, unsigned long long,
                        unsigned char const *, unsigned long long,
                        unsigned char const *, unsigned int, unsigned char *,
                        unsigned char *);
int /*<<< orphan*/ free(unsigned char *);
unsigned char *malloc(unsigned long long);
int test_crypto_aead(const unsigned char *key, unsigned long long keyLen,
                     const unsigned char *nonce, unsigned long long nonceLen,
                     const unsigned char *AD, unsigned long long ADlen,
                     const unsigned char *plaintext,
                     unsigned long long plaintextLen,
                     const unsigned char *ciphertext, unsigned int tagLen) {
  unsigned char *temp1 = malloc(plaintextLen + tagLen);
  unsigned char *temp2 = malloc(plaintextLen + tagLen);
  int retcode =
      do_test_crypto_aead(key, keyLen, nonce, nonceLen, AD, ADlen, plaintext,
                          plaintextLen, ciphertext, tagLen, temp1, temp2);
  free(temp1);
  free(temp2);
  return retcode;
}


x86 assembly (clang, -O0):
<test_crypto_aead>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %rbx
sub    $0x78,%rsp
mov    0x28(%rbp),%eax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %rcx,-0x38(%rbp)
mov    %r8,-0x40(%rbp)
mov    %r9,-0x48(%rbp)
mov    0x18(%rbp),%rdi
mov    0x28(%rbp),%eax
add    %rax,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x50(%rbp)
mov    0x18(%rbp),%rdi
mov    0x28(%rbp),%eax
add    %rax,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x58(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x38(%rbp),%rcx
mov    -0x40(%rbp),%r8
mov    -0x48(%rbp),%r9
mov    0x10(%rbp),%r15
mov    0x18(%rbp),%r14
mov    0x20(%rbp),%rbx
mov    0x28(%rbp),%r11d
mov    -0x50(%rbp),%r10
mov    -0x58(%rbp),%rax
mov    %r15,(%rsp)
mov    %r14,0x8(%rsp)
mov    %rbx,0x10(%rsp)
mov    %r11d,0x18(%rsp)
mov    %r10,0x20(%rsp)
mov    %rax,0x28(%rsp)
call   1050 <do_test_crypto_aead@plt>
mov    %eax,-0x5c(%rbp)
mov    -0x50(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    -0x5c(%rbp),%eax
add    $0x78,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_crypto_aead>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,0x10(%rsp)
mov    %r8,0x8(%rsp)
mov    %rcx,(%rsp)
mov    %rdx,%r13
mov    %rsi,%r12
mov    %rdi,%rbp
mov    0x68(%rsp),%r14d
add    0x58(%rsp),%r14
mov    %r14,%rdi
call   1040 <malloc@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rbp,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
mov    (%rsp),%rcx
mov    0x8(%rsp),%r8
mov    0x10(%rsp),%r9
push   %rax
push   %r15
mov    0x78(%rsp),%eax
push   %rax
push   0x78(%rsp)
push   0x78(%rsp)
push   0x78(%rsp)
call   1050 <do_test_crypto_aead@plt>
add    $0x30,%rsp
mov    %eax,%ebp
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @test_crypto_aead(i8* %0, i64 %1, i8* %2, i64 %3, i8* %4, i64 %5, i8* %6, i64 %7, i8* %8, i32 %9) {
%11 = alloca i8*
%12 = alloca i64
%13 = alloca i8*
%14 = alloca i64
%15 = alloca i8*
%16 = alloca i64
%17 = alloca i8*
%18 = alloca i64
%19 = alloca i8*
%20 = alloca i32
%21 = alloca i8*
%22 = alloca i8*
%23 = alloca i32
store i8* %0, i8** %11
store i64 %1, i64* %12
store i8* %2, i8** %13
store i64 %3, i64* %14
store i8* %4, i8** %15
store i64 %5, i64* %16
store i8* %6, i8** %17
store i64 %7, i64* %18
store i8* %8, i8** %19
store i32 %9, i32* %20
%24 = load i64, i64* %18
%25 = load i32, i32* %20
%26 = zext i32 %25 to i64
%27 = add i64 %24, %26
%28 = call i8* @malloc(i64 %27)
store i8* %28, i8** %21
%29 = load i64, i64* %18
%30 = load i32, i32* %20
%31 = zext i32 %30 to i64
%32 = add i64 %29, %31
%33 = call i8* @malloc(i64 %32)
store i8* %33, i8** %22
%34 = load i8*, i8** %11
%35 = load i64, i64* %12
%36 = load i8*, i8** %13
%37 = load i64, i64* %14
%38 = load i8*, i8** %15
%39 = load i64, i64* %16
%40 = load i8*, i8** %17
%41 = load i64, i64* %18
%42 = load i8*, i8** %19
%43 = load i32, i32* %20
%44 = load i8*, i8** %21
%45 = load i8*, i8** %22
%46 = call i32 @do_test_crypto_aead(i8* %34, i64 %35, i8* %36, i64 %37, i8* %38, i64 %39, i8* %40, i64 %41, i8* %42, i32 %43, i8* %44, i8* %45)
store i32 %46, i32* %23
%47 = load i8*, i8** %21
%48 = call i32 @free(i8* %47)
%49 = load i8*, i8** %22
%50 = call i32 @free(i8* %49)
%51 = load i32, i32* %23
ret i32 %51
}

LLVM IR (-O2):
define i32 @test_crypto_aead(i8* %0, i64 %1, i8* %2, i64 %3, i8* %4, i64 %5, i8* %6, i64 %7, i8* %8, i32 %9) {
%11 = zext i32 %9 to i64
%12 = add i64 %11, %7
%13 = tail call i8* @malloc(i64 %12)
%14 = tail call i8* @malloc(i64 %12)
%15 = tail call i32 @do_test_crypto_aead(i8* %0, i64 %1, i8* %2, i64 %3, i8* %4, i64 %5, i8* %6, i64 %7, i8* %8, i32 %9, i8* %13, i8* %14)
%16 = tail call i32 @free(i8* %13)
%17 = tail call i32 @free(i8* %14)
ret i32 %15
}