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

/* Variables and functions */
int /*<<< orphan*/ parser_get_int(struct PData *, char *, int *);
int terrain_detect(struct PData *pd) {
  int dummy;
  if (!parser_get_int(pd, "hex_width", &dummy))
    return 0;
  if (!parser_get_int(pd, "hex_height", &dummy))
    return 0;
  if (!parser_get_int(pd, "hex_x_offset", &dummy))
    return 0;
  if (!parser_get_int(pd, "hex_y_offset", &dummy))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<terrain_detect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1030 <parser_get_int@plt>
cmp    $0x0,%eax
jne    1145 <terrain_detect+0x35>
movl   $0x0,-0x4(%rbp)
jmp    11c7 <terrain_detect+0xb7>
mov    -0x10(%rbp),%rdi
lea    0xeba(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1030 <parser_get_int@plt>
cmp    $0x0,%eax
jne    116e <terrain_detect+0x5e>
movl   $0x0,-0x4(%rbp)
jmp    11c7 <terrain_detect+0xb7>
mov    -0x10(%rbp),%rdi
lea    0xe9c(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1030 <parser_get_int@plt>
cmp    $0x0,%eax
jne    1197 <terrain_detect+0x87>
movl   $0x0,-0x4(%rbp)
jmp    11c7 <terrain_detect+0xb7>
mov    -0x10(%rbp),%rdi
lea    0xe80(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1030 <parser_get_int@plt>
cmp    $0x0,%eax
jne    11c0 <terrain_detect+0xb0>
movl   $0x0,-0x4(%rbp)
jmp    11c7 <terrain_detect+0xb7>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<terrain_detect>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xee3(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1030 <parser_get_int@plt>
xor    %ebp,%ebp
test   %eax,%eax
je     1179 <terrain_detect+0x69>
lea    0xed6(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %rbx,%rdi
call   1030 <parser_get_int@plt>
test   %eax,%eax
je     1179 <terrain_detect+0x69>
lea    0xec9(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %rbx,%rdi
call   1030 <parser_get_int@plt>
test   %eax,%eax
je     1179 <terrain_detect+0x69>
lea    0xebe(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %rbx,%rdi
call   1030 <parser_get_int@plt>
xor    %ebp,%ebp
test   %eax,%eax
setne  %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.PData = type { i32 }
@.str = [10 x i8] c"hex_width\00"
@.str.1 = [11 x i8] c"hex_height\00"
@.str.2 = [13 x i8] c"hex_x_offset\00"
@.str.3 = [13 x i8] c"hex_y_offset\00"
define i32 @terrain_detect(%struct.PData* %0) {
%2 = alloca i32
%3 = alloca %struct.PData*
%4 = alloca i32
store %struct.PData* %0, %struct.PData** %3
%5 = load %struct.PData*, %struct.PData** %3
%6 = call i32 @parser_get_int(%struct.PData* %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %4)
%7 = icmp ne i32 %6, 0
br i1 %7, label %9, label %8
8: ; preds = %1
store i32 0, i32* %2
br label %25
9: ; preds = %1
%10 = load %struct.PData*, %struct.PData** %3
%11 = call i32 @parser_get_int(%struct.PData* %10, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%12 = icmp ne i32 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %9
store i32 0, i32* %2
br label %25
14: ; preds = %9
%15 = load %struct.PData*, %struct.PData** %3
%16 = call i32 @parser_get_int(%struct.PData* %15, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%17 = icmp ne i32 %16, 0
br i1 %17, label %19, label %18
18: ; preds = %14
store i32 0, i32* %2
br label %25
19: ; preds = %14
%20 = load %struct.PData*, %struct.PData** %3
%21 = call i32 @parser_get_int(%struct.PData* %20, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32* %4)
%22 = icmp ne i32 %21, 0
br i1 %22, label %24, label %23
23: ; preds = %19
store i32 0, i32* %2
br label %25
24: ; preds = %19
store i32 1, i32* %2
br label %25
25: ; preds = %24, %23, %18, %13, %8
%26 = load i32, i32* %2
ret i32 %26
}

LLVM IR (-O2):
%struct.PData = type { i32 }
@.str = [10 x i8] c"hex_width\00"
@.str.1 = [11 x i8] c"hex_height\00"
@.str.2 = [13 x i8] c"hex_x_offset\00"
@.str.3 = [13 x i8] c"hex_y_offset\00"
define i32 @terrain_detect(%struct.PData* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @parser_get_int(%struct.PData* %0, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %2)
%5 = icmp eq i32 %4, 0
br i1 %5, label %16, label %6
6: ; preds = %1
%7 = call i32 @parser_get_int(%struct.PData* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%8 = icmp eq i32 %7, 0
br i1 %8, label %16, label %9
9: ; preds = %6
%10 = call i32 @parser_get_int(%struct.PData* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%11 = icmp eq i32 %10, 0
br i1 %11, label %16, label %12
12: ; preds = %9
%13 = call i32 @parser_get_int(%struct.PData* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%14 = icmp ne i32 %13, 0
%15 = zext i1 %14 to i32
br label %16
16: ; preds = %12, %9, %6, %1
%17 = phi i32 [ 0, %1 ], [ 0, %6 ], [ 0, %9 ], [ %15, %12 ]
ret i32 %17
}