#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 curve25519xsalsa20poly1305_box_afternm(unsigned char *,
                                           unsigned char const *,
                                           unsigned long long,
                                           unsigned char const *,
                                           unsigned char *);
int /*<<< orphan*/
curve25519xsalsa20poly1305_box_beforenm(unsigned char *, unsigned char const *,
                                        unsigned char const *);
int curve25519xsalsa20poly1305_box(unsigned char *c, const unsigned char *m,
                                   unsigned long long mlen,
                                   const unsigned char *n,
                                   const unsigned char *pk,
                                   const unsigned char *sk) {
  unsigned char k[32];
  curve25519xsalsa20poly1305_box_beforenm(k, pk, sk);
  return curve25519xsalsa20poly1305_box_afternm(c, m, mlen, n, k);
}


x86 assembly (clang, -O0):
<curve25519xsalsa20poly1305_box>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
lea    -0x50(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
call   1030 <curve25519xsalsa20poly1305_box_beforenm@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    -0x50(%rbp),%r8
call   1040 <curve25519xsalsa20poly1305_box_afternm@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<curve25519xsalsa20poly1305_box>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
mov    %rsp,%r13
mov    %r13,%rdi
mov    %r8,%rsi
mov    %r9,%rdx
call   1030 <curve25519xsalsa20poly1305_box_beforenm@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r14,%rcx
mov    %r13,%r8
call   1040 <curve25519xsalsa20poly1305_box_afternm@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @curve25519xsalsa20poly1305_box(i8* %0, i8* %1, i64 %2, i8* %3, i8* %4, i8* %5) {
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca [32 x i8]
store i8* %0, i8** %7
store i8* %1, i8** %8
store i64 %2, i64* %9
store i8* %3, i8** %10
store i8* %4, i8** %11
store i8* %5, i8** %12
%14 = getelementptr inbounds [32 x i8], [32 x i8]* %13, i64 0, i64 0
%15 = load i8*, i8** %11
%16 = load i8*, i8** %12
%17 = call i32 @curve25519xsalsa20poly1305_box_beforenm(i8* %14, i8* %15, i8* %16)
%18 = load i8*, i8** %7
%19 = load i8*, i8** %8
%20 = load i64, i64* %9
%21 = load i8*, i8** %10
%22 = getelementptr inbounds [32 x i8], [32 x i8]* %13, i64 0, i64 0
%23 = call i32 @curve25519xsalsa20poly1305_box_afternm(i8* %18, i8* %19, i64 %20, i8* %21, i8* %22)
ret i32 %23
}

LLVM IR (-O2):
define i32 @curve25519xsalsa20poly1305_box(i8* %0, i8* %1, i64 %2, i8* %3, i8* %4, i8* %5) {
%7 = alloca [32 x i8]
%8 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%9 = call i32 @curve25519xsalsa20poly1305_box_beforenm(i8* %8, i8* %4, i8* %5)
%10 = call i32 @curve25519xsalsa20poly1305_box_afternm(i8* %0, i8* %1, i64 %2, i8* %3, i8* %8)
ret i32 %10
}