#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 aes256gcmdecrypt(unsigned char *, unsigned char *, unsigned long long,
                     unsigned char *, unsigned char *);
int /*<<< orphan*/ memcpy(unsigned char *, unsigned char *, int);
int crypto_secretbox_aes256gcm_open(unsigned char *m, unsigned char *c,
                                    unsigned long long clen, unsigned char *n,
                                    unsigned char *k) {
  unsigned char j0[12];
  j0[0] = 'U';
  j0[1] = 'o';
  j0[2] = 'f';
  j0[3] = 'C';
  memcpy(j0 + 4, n, 8);
  return aes256gcmdecrypt(m, c, clen, j0, k);
}


x86 assembly (clang, -O0):
<crypto_secretbox_aes256gcm_open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movb   $0x55,-0x34(%rbp)
movb   $0x6f,-0x33(%rbp)
movb   $0x66,-0x32(%rbp)
movb   $0x43,-0x31(%rbp)
lea    -0x34(%rbp),%rdi
add    $0x4,%rdi
mov    -0x20(%rbp),%rsi
mov    $0x8,%edx
call   1030 <memcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    -0x34(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1040 <aes256gcmdecrypt@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crypto_secretbox_aes256gcm_open>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
movl   $0x43666f55,0xc(%rsp)
43
lea    0x10(%rsp),%rdi
mov    %rcx,%rsi
mov    $0x8,%edx
call   1030 <memcpy@plt>
lea    0xc(%rsp),%rcx
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
mov    %r14,%r8
call   1040 <aes256gcmdecrypt@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @crypto_secretbox_aes256gcm_open(i8* %0, i8* %1, i64 %2, i8* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca [12 x i8]
store i8* %0, i8** %6
store i8* %1, i8** %7
store i64 %2, i64* %8
store i8* %3, i8** %9
store i8* %4, i8** %10
%12 = getelementptr inbounds [12 x i8], [12 x i8]* %11, i64 0, i64 0
store i8 85, i8* %12
%13 = getelementptr inbounds [12 x i8], [12 x i8]* %11, i64 0, i64 1
store i8 111, i8* %13
%14 = getelementptr inbounds [12 x i8], [12 x i8]* %11, i64 0, i64 2
store i8 102, i8* %14
%15 = getelementptr inbounds [12 x i8], [12 x i8]* %11, i64 0, i64 3
store i8 67, i8* %15
%16 = getelementptr inbounds [12 x i8], [12 x i8]* %11, i64 0, i64 0
%17 = getelementptr inbounds i8, i8* %16, i64 4
%18 = load i8*, i8** %9
%19 = call i32 @memcpy(i8* %17, i8* %18, i32 8)
%20 = load i8*, i8** %6
%21 = load i8*, i8** %7
%22 = load i64, i64* %8
%23 = getelementptr inbounds [12 x i8], [12 x i8]* %11, i64 0, i64 0
%24 = load i8*, i8** %10
%25 = call i32 @aes256gcmdecrypt(i8* %20, i8* %21, i64 %22, i8* %23, i8* %24)
ret i32 %25
}

LLVM IR (-O2):
define i32 @crypto_secretbox_aes256gcm_open(i8* %0, i8* %1, i64 %2, i8* %3, i8* %4) {
%6 = alloca [12 x i8]
%7 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 0
store i8 85, i8* %7
%8 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 1
store i8 111, i8* %8
%9 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 2
store i8 102, i8* %9
%10 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 3
store i8 67, i8* %10
%11 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 4
%12 = call i32 @memcpy(i8* %11, i8* %3, i32 8)
%13 = call i32 @aes256gcmdecrypt(i8* %0, i8* %1, i64 %2, i8* %7, i8* %4)
ret i32 %13
}