#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 */
typedef int uint32_t;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ functionQ(int *);
int /*<<< orphan*/ functionR(int *);
int /*<<< orphan*/ memcpy(int *, int const *, int);
void functionG(uint32_t *output, uint32_t key, const uint32_t *input) {
  uint32_t buf[2] = {0x00};
  memcpy(buf, input, sizeof(buf));
  buf[0] ^= key;
  functionQ(buf + 0);
  functionQ(buf + 1);
  functionR(buf);
  memcpy(output, buf, sizeof(buf));
}


x86 assembly (clang, -O0):
<functionG>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1030 <memset@plt>
lea    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x8,%edx
call   1050 <memcpy@plt>
mov    -0xc(%rbp),%eax
xor    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
lea    -0x20(%rbp),%rdi
call   1040 <functionQ@plt>
lea    -0x20(%rbp),%rdi
add    $0x4,%rdi
call   1040 <functionQ@plt>
lea    -0x20(%rbp),%rdi
call   1060 <functionR@plt>
mov    -0x8(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x8,%edx
call   1050 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<functionG>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebx
mov    %rdi,%r14
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%r15
mov    %r15,%rdi
mov    %rdx,%rsi
mov    $0x8,%edx
call   1040 <memcpy@plt>
xor    %ebx,0x8(%rsp)
mov    %r15,%rdi
call   1030 <functionQ@plt>
lea    0xc(%rsp),%rdi
call   1030 <functionQ@plt>
mov    %r15,%rdi
call   1050 <functionR@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    $0x8,%edx
call   1040 <memcpy@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @functionG(i32* %0, i32 %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca [2 x i32]
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%8 = bitcast [2 x i32]* %7 to i8*
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%10 = load i32*, i32** %6
%11 = call i32 @memcpy(i32* %9, i32* %10, i32 8)
%12 = load i32, i32* %5
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%14 = load i32, i32* %13
%15 = xor i32 %14, %12
store i32 %15, i32* %13
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%17 = getelementptr inbounds i32, i32* %16, i64 0
%18 = call i32 @functionQ(i32* %17)
%19 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%20 = getelementptr inbounds i32, i32* %19, i64 1
%21 = call i32 @functionQ(i32* %20)
%22 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%23 = call i32 @functionR(i32* %22)
%24 = load i32*, i32** %4
%25 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%26 = call i32 @memcpy(i32* %24, i32* %25, i32 8)
ret void
}

LLVM IR (-O2):
define void @functionG(i32* %0, i32 %1, i32* %2) {
%4 = alloca i64
%5 = bitcast i64* %4 to i8*
store i64 0, i64* %4
%6 = bitcast i64* %4 to i32*
%7 = call i32 @memcpy(i32* %6, i32* %2, i32 8)
%8 = load i32, i32* %6
%9 = xor i32 %8, %1
store i32 %9, i32* %6
%10 = call i32 @functionQ(i32* %6)
%11 = getelementptr inbounds i32, i32* %6, i64 1
%12 = call i32 @functionQ(i32* %11)
%13 = call i32 @functionR(i32* %6)
%14 = call i32 @memcpy(i32* %0, i32* %6, i32 8)
ret void
}