#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_slice {
  int dummy;
};
struct pbc_rmessage {
  int dummy;
};
struct pbc_env {
  int dummy;
};

/* Variables and functions */
char *pbc_error(struct pbc_env *);
int /*<<< orphan*/ pbc_rmessage_delete(struct pbc_rmessage *);
struct pbc_rmessage *pbc_rmessage_new(struct pbc_env *, char *,
                                      struct pbc_slice *);
char *pbc_rmessage_string(struct pbc_rmessage *, char *, int /*<<< orphan*/,
                          int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, ...);
void test_rmessage(struct pbc_env *env, struct pbc_slice *slice) {
  struct pbc_rmessage *m =
      pbc_rmessage_new(env, "hadoop.common.HadoopRpcRequestProto", slice);
  if (m == NULL) {
    printf("Error : %s", pbc_error(env));
    return;
  }
  printf("methodName = %s\n", pbc_rmessage_string(m, "methodName", 0, NULL));
  int *buffer = (int *)pbc_rmessage_string(m, "request", 0, NULL);
  printf("request = %d %d\n", buffer[0], buffer[1]);
  pbc_rmessage_delete(m);
}


x86 assembly (clang, -O0):
<test_rmessage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe91(%rip),%rsi
call   1060 <pbc_rmessage_new@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11a2 <test_rmessage+0x52>
mov    -0x8(%rbp),%rdi
call   1050 <pbc_error@plt>
mov    %rax,%rsi
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1207 <test_rmessage+0xb7>
mov    -0x18(%rbp),%rdi
lea    0xe93(%rip),%rsi
xor    %edx,%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1030 <pbc_rmessage_string@plt>
mov    %rax,%rsi
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
lea    0xe77(%rip),%rsi
xor    %edx,%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1030 <pbc_rmessage_string@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rax
mov    0x4(%rax),%edx
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1070 <pbc_rmessage_delete@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_rmessage>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rdx
mov    %rdi,%rbx
lea    0xe9f(%rip),%rsi
call   1060 <pbc_rmessage_new@plt>
test   %rax,%rax
je     11c7 <test_rmessage+0x77>
mov    %rax,%r14
lea    0xecb(%rip),%rsi
mov    %rax,%rdi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <pbc_rmessage_string@plt>
lea    0xea7(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb2(%rip),%rsi
mov    %r14,%rdi
xor    %edx,%edx
xor    %ecx,%ecx
call   1030 <pbc_rmessage_string@plt>
mov    (%rax),%esi
mov    0x4(%rax),%edx
lea    0xea2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1070 <pbc_rmessage_delete@plt>
mov    %rbx,%rdi
call   1050 <pbc_error@plt>
lea    0xe4e(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <printf@plt>

LLVM IR (-O0):
%struct.pbc_env = type { i32 }
%struct.pbc_slice = type { i32 }
%struct.pbc_rmessage = type { i32 }
@.str = [36 x i8] c"hadoop.common.HadoopRpcRequestProto\00"
@.str.1 = [11 x i8] c"Error : %s\00"
@.str.2 = [17 x i8] c"methodName = %s\0A\00"
@.str.3 = [11 x i8] c"methodName\00"
@.str.4 = [8 x i8] c"request\00"
@.str.5 = [17 x i8] c"request = %d %d\0A\00"
define void @test_rmessage(%struct.pbc_env* %0, %struct.pbc_slice* %1) {
%3 = alloca %struct.pbc_env*
%4 = alloca %struct.pbc_slice*
%5 = alloca %struct.pbc_rmessage*
%6 = alloca i32*
store %struct.pbc_env* %0, %struct.pbc_env** %3
store %struct.pbc_slice* %1, %struct.pbc_slice** %4
%7 = load %struct.pbc_env*, %struct.pbc_env** %3
%8 = load %struct.pbc_slice*, %struct.pbc_slice** %4
%9 = call %struct.pbc_rmessage* @pbc_rmessage_new(%struct.pbc_env* %7, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), %struct.pbc_slice* %8)
store %struct.pbc_rmessage* %9, %struct.pbc_rmessage** %5
%10 = load %struct.pbc_rmessage*, %struct.pbc_rmessage** %5
%11 = icmp eq %struct.pbc_rmessage* %10, null
br i1 %11, label %12, label %16
12: ; preds = %2
%13 = load %struct.pbc_env*, %struct.pbc_env** %3
%14 = call i8* @pbc_error(%struct.pbc_env* %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %14)
br label %32
16: ; preds = %2
%17 = load %struct.pbc_rmessage*, %struct.pbc_rmessage** %5
%18 = call i8* @pbc_rmessage_string(%struct.pbc_rmessage* %17, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 0, i32* null)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%20 = load %struct.pbc_rmessage*, %struct.pbc_rmessage** %5
%21 = call i8* @pbc_rmessage_string(%struct.pbc_rmessage* %20, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 0, i32* null)
%22 = bitcast i8* %21 to i32*
store i32* %22, i32** %6
%23 = load i32*, i32** %6
%24 = getelementptr inbounds i32, i32* %23, i64 0
%25 = load i32, i32* %24
%26 = load i32*, i32** %6
%27 = getelementptr inbounds i32, i32* %26, i64 1
%28 = load i32, i32* %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %25, i32 %28)
%30 = load %struct.pbc_rmessage*, %struct.pbc_rmessage** %5
%31 = call i32 @pbc_rmessage_delete(%struct.pbc_rmessage* %30)
br label %32
32: ; preds = %16, %12
ret void
}

LLVM IR (-O2):
%struct.pbc_env = type { i32 }
%struct.pbc_slice = type { i32 }
%struct.pbc_rmessage = type { i32 }
@.str = [36 x i8] c"hadoop.common.HadoopRpcRequestProto\00"
@.str.1 = [11 x i8] c"Error : %s\00"
@.str.2 = [17 x i8] c"methodName = %s\0A\00"
@.str.3 = [11 x i8] c"methodName\00"
@.str.4 = [8 x i8] c"request\00"
@.str.5 = [17 x i8] c"request = %d %d\0A\00"
define void @test_rmessage(%struct.pbc_env* %0, %struct.pbc_slice* %1) {
%3 = tail call %struct.pbc_rmessage* @pbc_rmessage_new(%struct.pbc_env* %0, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), %struct.pbc_slice* %1)
%4 = icmp eq %struct.pbc_rmessage* %3, null
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i8* @pbc_error(%struct.pbc_env* %0)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %6)
br label %19
8: ; preds = %2
%9 = tail call i8* @pbc_rmessage_string(%struct.pbc_rmessage* %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 0, i32* null)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i8* %9)
%11 = tail call i8* @pbc_rmessage_string(%struct.pbc_rmessage* %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 0, i32* null)
%12 = bitcast i8* %11 to i32*
%13 = load i32, i32* %12
%14 = getelementptr inbounds i8, i8* %11, i64 4
%15 = bitcast i8* %14 to i32*
%16 = load i32, i32* %15
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0), i32 %13, i32 %16)
%18 = tail call i32 @pbc_rmessage_delete(%struct.pbc_rmessage* %3)
br label %19
19: ; preds = %8, %5
ret void
}