#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 */
char *malloc(int);
int /*<<< orphan*/ memcpy(char *, char *, int);
char *MergeOperatorFullMerge(void *arg, const char *key, size_t key_length,
                             const char *existing_value,
                             size_t existing_value_length,
                             const char *const *operands_list,
                             const size_t *operands_list_length,
                             int num_operands, unsigned char *success,
                             size_t *new_value_length) {
  *new_value_length = 4;
  *success = 1;
  char *result = malloc(4);
  memcpy(result, "fake", 4);
  return result;
}


x86 assembly (clang, -O0):
<MergeOperatorFullMerge>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    0x28(%rbp),%rax
movq   $0x4,(%rax)
mov    0x20(%rbp),%rax
movb   $0x1,(%rax)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
lea    0xe86(%rip),%rsi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    -0x38(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MergeOperatorFullMerge>:
push   %rbx
mov    0x20(%rsp),%rax
mov    0x28(%rsp),%rcx
movq   $0x4,(%rcx)
movb   $0x1,(%rax)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
lea    0xeb7(%rip),%rsi
mov    %rax,%rdi
mov    $0x4,%edx
call   1030 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"fake\00"
define i8* @MergeOperatorFullMerge(i8* %0, i8* %1, i64 %2, i8* %3, i64 %4, i8** %5, i64* %6, i32 %7, i8* %8, i64* %9) {
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i8*
%15 = alloca i64
%16 = alloca i8**
%17 = alloca i64*
%18 = alloca i32
%19 = alloca i8*
%20 = alloca i64*
%21 = alloca i8*
store i8* %0, i8** %11
store i8* %1, i8** %12
store i64 %2, i64* %13
store i8* %3, i8** %14
store i64 %4, i64* %15
store i8** %5, i8*** %16
store i64* %6, i64** %17
store i32 %7, i32* %18
store i8* %8, i8** %19
store i64* %9, i64** %20
%22 = load i64*, i64** %20
store i64 4, i64* %22
%23 = load i8*, i8** %19
store i8 1, i8* %23
%24 = call i8* @malloc(i32 4)
store i8* %24, i8** %21
%25 = load i8*, i8** %21
%26 = call i32 @memcpy(i8* %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%27 = load i8*, i8** %21
ret i8* %27
}

LLVM IR (-O2):
@.str = [5 x i8] c"fake\00"
define i8* @MergeOperatorFullMerge(i8* nocapture readnone %0, i8* nocapture readnone %1, i64 %2, i8* nocapture readnone %3, i64 %4, i8** nocapture readnone %5, i64* nocapture readnone %6, i32 %7, i8* nocapture writeonly %8, i64* nocapture writeonly %9) {
store i64 4, i64* %9
store i8 1, i8* %8
%11 = tail call dereferenceable_or_null(4) i8* @malloc(i32 4)
%12 = tail call i32 @memcpy(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
ret i8* %11
}