#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 /*<<< orphan*/ parser_get_value(struct PData *, char *, char **,
                                    int /*<<< orphan*/);
int map_detect(struct PData *pd) {
  int dummy;
  char *str;
  if (!parser_get_int(pd, "width", &dummy))
    return 0;
  if (!parser_get_int(pd, "height", &dummy))
    return 0;
  if (!parser_get_value(pd, "terrain_db", &str, 0))
    return 0;
  if (!parser_get_value(pd, "tiles", &str, 0))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<map_detect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1040 <parser_get_int@plt>
cmp    $0x0,%eax
jne    1155 <map_detect+0x35>
movl   $0x0,-0x4(%rbp)
jmp    11db <map_detect+0xbb>
mov    -0x10(%rbp),%rdi
lea    0xea6(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1040 <parser_get_int@plt>
cmp    $0x0,%eax
jne    117e <map_detect+0x5e>
movl   $0x0,-0x4(%rbp)
jmp    11db <map_detect+0xbb>
mov    -0x10(%rbp),%rdi
lea    0xe84(%rip),%rsi
lea    -0x20(%rbp),%rdx
xor    %ecx,%ecx
call   1030 <parser_get_value@plt>
cmp    $0x0,%eax
jne    11a9 <map_detect+0x89>
movl   $0x0,-0x4(%rbp)
jmp    11db <map_detect+0xbb>
mov    -0x10(%rbp),%rdi
lea    0xe64(%rip),%rsi
lea    -0x20(%rbp),%rdx
xor    %ecx,%ecx
call   1030 <parser_get_value@plt>
cmp    $0x0,%eax
jne    11d4 <map_detect+0xb4>
movl   $0x0,-0x4(%rbp)
jmp    11db <map_detect+0xbb>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<map_detect>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
lea    0xed0(%rip),%rsi
lea    0xc(%rsp),%rdx
call   1040 <parser_get_int@plt>
xor    %ebp,%ebp
test   %eax,%eax
je     1192 <map_detect+0x72>
lea    0xebf(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rbx,%rdi
call   1040 <parser_get_int@plt>
test   %eax,%eax
je     1192 <map_detect+0x72>
lea    0xeae(%rip),%rsi
lea    0x10(%rsp),%rdx
xor    %ebp,%ebp
mov    %rbx,%rdi
xor    %ecx,%ecx
call   1030 <parser_get_value@plt>
test   %eax,%eax
je     1192 <map_detect+0x72>
lea    0xe9d(%rip),%rsi
lea    0x10(%rsp),%rdx
mov    %rbx,%rdi
xor    %ecx,%ecx
call   1030 <parser_get_value@plt>
xor    %ebp,%ebp
test   %eax,%eax
setne  %bpl
mov    %ebp,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

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

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