#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 */
struct pbc_wmessage {
  int dummy;
};
struct pbc_env {
  int dummy;
};

/* Variables and functions */
struct pbc_wmessage *pbc_wmessage_new(struct pbc_env *, char *);
int /*<<< orphan*/ pbc_wmessage_string(struct pbc_wmessage *, char *, char *,
                                       int);
struct pbc_wmessage *test_wmessage(struct pbc_env *env) {
  struct pbc_wmessage *msg =
      pbc_wmessage_new(env, "hadoop.common.HadoopRpcRequestProto");
  int a[2];
  a[0] = 0;
  a[1] = 3399;
  pbc_wmessage_string(msg, "methodName", "name", -1);
  pbc_wmessage_string(msg, "request", (char *)(&(a[0])), sizeof(int) * 2);
  return msg;
}


x86 assembly (clang, -O0):
<test_wmessage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <pbc_wmessage_new@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0xd47,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xecb(%rip),%rsi
lea    0xecf(%rip),%rdx
mov    $0xffffffff,%ecx
call   1030 <pbc_wmessage_string@plt>
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rdx
lea    0xebb(%rip),%rsi
mov    $0x8,%ecx
call   1030 <pbc_wmessage_string@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_wmessage>:
push   %rbx
sub    $0x10,%rsp
lea    0xed4(%rip),%rsi
call   1040 <pbc_wmessage_new@plt>
mov    %rax,%rbx
movabs $0xd4700000000,%rax
mov    %rax,0x8(%rsp)
lea    0xeda(%rip),%rsi
lea    0xede(%rip),%rdx
mov    %rbx,%rdi
mov    $0xffffffff,%ecx
call   1030 <pbc_wmessage_string@plt>
lea    0xecf(%rip),%rsi
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    $0x8,%ecx
call   1030 <pbc_wmessage_string@plt>
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.pbc_wmessage = type { i32 }
%struct.pbc_env = type { i32 }
@.str = [36 x i8] c"hadoop.common.HadoopRpcRequestProto\00"
@.str.1 = [11 x i8] c"methodName\00"
@.str.2 = [5 x i8] c"name\00"
@.str.3 = [8 x i8] c"request\00"
define %struct.pbc_wmessage* @test_wmessage(%struct.pbc_env* %0) {
%2 = alloca %struct.pbc_env*
%3 = alloca %struct.pbc_wmessage*
%4 = alloca [2 x i32]
store %struct.pbc_env* %0, %struct.pbc_env** %2
%5 = load %struct.pbc_env*, %struct.pbc_env** %2
%6 = call %struct.pbc_wmessage* @pbc_wmessage_new(%struct.pbc_env* %5, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
store %struct.pbc_wmessage* %6, %struct.pbc_wmessage** %3
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
store i32 0, i32* %7
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
store i32 3399, i32* %8
%9 = load %struct.pbc_wmessage*, %struct.pbc_wmessage** %3
%10 = call i32 @pbc_wmessage_string(%struct.pbc_wmessage* %9, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 -1)
%11 = load %struct.pbc_wmessage*, %struct.pbc_wmessage** %3
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%13 = bitcast i32* %12 to i8*
%14 = call i32 @pbc_wmessage_string(%struct.pbc_wmessage* %11, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %13, i32 8)
%15 = load %struct.pbc_wmessage*, %struct.pbc_wmessage** %3
ret %struct.pbc_wmessage* %15
}

LLVM IR (-O2):
%struct.pbc_wmessage = type { i32 }
%struct.pbc_env = type { i32 }
@.str = [36 x i8] c"hadoop.common.HadoopRpcRequestProto\00"
@.str.1 = [11 x i8] c"methodName\00"
@.str.2 = [5 x i8] c"name\00"
@.str.3 = [8 x i8] c"request\00"
define %struct.pbc_wmessage* @test_wmessage(%struct.pbc_env* %0) {
%2 = alloca [2 x i32]
%3 = tail call %struct.pbc_wmessage* @pbc_wmessage_new(%struct.pbc_env* %0, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
%4 = bitcast [2 x i32]* %2 to i8*
%5 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
store i32 0, i32* %5
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
store i32 3399, i32* %6
%7 = tail call i32 @pbc_wmessage_string(%struct.pbc_wmessage* %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 -1)
%8 = call i32 @pbc_wmessage_string(%struct.pbc_wmessage* %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0), i8* %4, i32 8)
ret %struct.pbc_wmessage* %3
}