#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 mmo_homunstatus {
  int dummy;
};

/* Variables and functions */
struct mmo_homunstatus *homundb_sql_load(int);
int /*<<< orphan*/ mapif_hom_info(int, int, int, struct mmo_homunstatus const *,
                                  int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int, int, int);
int mapif_load_hom(int fd, int account_id, int char_id, int homun_id) {
  const struct mmo_homunstatus *h = homundb_sql_load(homun_id);
  if (h != NULL) {
    mapif_hom_info(fd, account_id, char_id, h, 0);
  } else {
    printf("inter hom: data load error %d %d %d\n", account_id, char_id,
           homun_id);
  }
  return 0;
}


x86 assembly (clang, -O0):
<mapif_load_hom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <homundb_sql_load@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1175 <mapif_load_hom+0x45>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
xor    %r8d,%r8d
call   1050 <mapif_hom_info@plt>
jmp    118a <mapif_load_hom+0x5a>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe7b(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mapif_load_hom>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %edx,%r14d
mov    %esi,%ebp
mov    %edi,%r15d
mov    %ecx,%edi
call   1030 <homundb_sql_load@plt>
test   %rax,%rax
je     1162 <mapif_load_hom+0x32>
mov    %r15d,%edi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %rax,%rcx
xor    %r8d,%r8d
call   1050 <mapif_hom_info@plt>
jmp    1175 <mapif_load_hom+0x45>
lea    0xe97(%rip),%rdi
mov    %ebp,%esi
mov    %r14d,%edx
mov    %ebx,%ecx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.mmo_homunstatus = type { i32 }
@.str = [37 x i8] c"inter hom: data load error %d %d %d\0A\00"
define i32 @mapif_load_hom(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca %struct.mmo_homunstatus*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %8
%11 = call %struct.mmo_homunstatus* @homundb_sql_load(i32 %10)
store %struct.mmo_homunstatus* %11, %struct.mmo_homunstatus** %9
%12 = load %struct.mmo_homunstatus*, %struct.mmo_homunstatus** %9
%13 = icmp ne %struct.mmo_homunstatus* %12, null
br i1 %13, label %14, label %20
14: ; preds = %4
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = load i32, i32* %7
%18 = load %struct.mmo_homunstatus*, %struct.mmo_homunstatus** %9
%19 = call i32 @mapif_hom_info(i32 %15, i32 %16, i32 %17, %struct.mmo_homunstatus* %18, i32 0)
br label %25
20: ; preds = %4
%21 = load i32, i32* %6
%22 = load i32, i32* %7
%23 = load i32, i32* %8
%24 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %21, i32 %22, i32 %23)
br label %25
25: ; preds = %20, %14
ret i32 0
}

LLVM IR (-O2):
%struct.mmo_homunstatus = type { i32 }
@.str = [37 x i8] c"inter hom: data load error %d %d %d\0A\00"
define i32 @mapif_load_hom(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call %struct.mmo_homunstatus* @homundb_sql_load(i32 %3)
%6 = icmp eq %struct.mmo_homunstatus* %5, null
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @mapif_hom_info(i32 %0, i32 %1, i32 %2, %struct.mmo_homunstatus* %5, i32 0)
br label %11
9: ; preds = %4
%10 = tail call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2, i32 %3)
br label %11
11: ; preds = %9, %7
ret i32 0
}