#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*/ memcpy(unsigned char *, unsigned char const *, int);
int /*<<< orphan*/ shake256(unsigned char *, int, unsigned char *,
                            unsigned long long);
void gen_message_random(unsigned char *R, const unsigned char *sk_prf,
                        const unsigned char *optrand, unsigned char *m,
                        unsigned long long mlen) {
  memcpy(m - 2 * 16, sk_prf, 16);
  memcpy(m - 16, optrand, 16);
  shake256(R, 16, m - 2 * 16, mlen + 2 * 16);
}


x86 assembly (clang, -O0):
<gen_message_random>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
add    $0xffffffffffffffe0,%rdi
mov    -0x10(%rbp),%rsi
mov    $0x10,%edx
call   1030 <memcpy@plt>
mov    -0x20(%rbp),%rdi
add    $0xfffffffffffffff0,%rdi
mov    -0x18(%rbp),%rsi
mov    $0x10,%edx
call   1030 <memcpy@plt>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rdx
add    $0xffffffffffffffe0,%rdx
mov    -0x28(%rbp),%rcx
add    $0x20,%rcx
mov    $0x10,%esi
call   1040 <shake256@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_message_random>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %r8,%r14
mov    %rcx,%rbx
mov    %rdx,%r15
mov    %rdi,%r12
lea    -0x20(%rcx),%r13
mov    %r13,%rdi
mov    $0x10,%edx
call   1030 <memcpy@plt>
add    $0xfffffffffffffff0,%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x10,%edx
call   1030 <memcpy@plt>
add    $0x20,%r14
mov    %r12,%rdi
mov    $0x10,%esi
mov    %r13,%rdx
mov    %r14,%rcx
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1040 <shake256@plt>

LLVM IR (-O0):
define void @gen_message_random(i8* %0, i8* %1, i8* %2, i8* %3, i64 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i64
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i64 %4, i64* %10
%11 = load i8*, i8** %9
%12 = getelementptr inbounds i8, i8* %11, i64 -32
%13 = load i8*, i8** %7
%14 = call i32 @memcpy(i8* %12, i8* %13, i32 16)
%15 = load i8*, i8** %9
%16 = getelementptr inbounds i8, i8* %15, i64 -16
%17 = load i8*, i8** %8
%18 = call i32 @memcpy(i8* %16, i8* %17, i32 16)
%19 = load i8*, i8** %6
%20 = load i8*, i8** %9
%21 = getelementptr inbounds i8, i8* %20, i64 -32
%22 = load i64, i64* %10
%23 = add i64 %22, 32
%24 = call i32 @shake256(i8* %19, i32 16, i8* %21, i64 %23)
ret void
}

LLVM IR (-O2):
define void @gen_message_random(i8* %0, i8* %1, i8* %2, i8* %3, i64 %4) {
%6 = getelementptr inbounds i8, i8* %3, i64 -32
%7 = tail call i32 @memcpy(i8* %6, i8* %1, i32 16)
%8 = getelementptr inbounds i8, i8* %3, i64 -16
%9 = tail call i32 @memcpy(i8* %8, i8* %2, i32 16)
%10 = add i64 %4, 32
%11 = tail call i32 @shake256(i8* %0, i32 16, i8* %6, i64 %10)
ret void
}