#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 */

/* Variables and functions */
int /*<<< orphan*/ IsParked(int);
int GetPlayerShipIndex() {
  if (!IsParked(0))
    return 0;
  if (!IsParked(51))
    return 51;
  if (!IsParked(53))
    return 53;
  if (!IsParked(55))
    return 55;
  return 8;
}


x86 assembly (clang, -O0):
<GetPlayerShipIndex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1030 <IsParked@plt>
cmp    $0x0,%eax
jne    1134 <GetPlayerShipIndex+0x24>
movl   $0x0,-0x4(%rbp)
jmp    1198 <GetPlayerShipIndex+0x88>
mov    $0x33,%edi
call   1030 <IsParked@plt>
cmp    $0x0,%eax
jne    1153 <GetPlayerShipIndex+0x43>
movl   $0x33,-0x4(%rbp)
jmp    1198 <GetPlayerShipIndex+0x88>
mov    $0x35,%edi
call   1030 <IsParked@plt>
cmp    $0x0,%eax
jne    1172 <GetPlayerShipIndex+0x62>
movl   $0x35,-0x4(%rbp)
jmp    1198 <GetPlayerShipIndex+0x88>
mov    $0x37,%edi
call   1030 <IsParked@plt>
cmp    $0x0,%eax
jne    1191 <GetPlayerShipIndex+0x81>
movl   $0x37,-0x4(%rbp)
jmp    1198 <GetPlayerShipIndex+0x88>
movl   $0x8,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetPlayerShipIndex>:
push   %rbp
push   %rbx
push   %rax
xor    %ebx,%ebx
xor    %edi,%edi
call   1030 <IsParked@plt>
test   %eax,%eax
je     115f <GetPlayerShipIndex+0x4f>
mov    $0x33,%ebx
mov    $0x33,%edi
call   1030 <IsParked@plt>
test   %eax,%eax
je     115f <GetPlayerShipIndex+0x4f>
mov    $0x35,%ebx
mov    $0x35,%edi
call   1030 <IsParked@plt>
test   %eax,%eax
je     115f <GetPlayerShipIndex+0x4f>
mov    $0x37,%ebp
mov    $0x37,%edi
call   1030 <IsParked@plt>
test   %eax,%eax
mov    $0x8,%ebx
cmove  %ebp,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @GetPlayerShipIndex() {
%1 = alloca i32
%2 = call i32 @IsParked(i32 0)
%3 = icmp ne i32 %2, 0
br i1 %3, label %5, label %4
4: ; preds = %0
store i32 0, i32* %1
br label %18
5: ; preds = %0
%6 = call i32 @IsParked(i32 51)
%7 = icmp ne i32 %6, 0
br i1 %7, label %9, label %8
8: ; preds = %5
store i32 51, i32* %1
br label %18
9: ; preds = %5
%10 = call i32 @IsParked(i32 53)
%11 = icmp ne i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %9
store i32 53, i32* %1
br label %18
13: ; preds = %9
%14 = call i32 @IsParked(i32 55)
%15 = icmp ne i32 %14, 0
br i1 %15, label %17, label %16
16: ; preds = %13
store i32 55, i32* %1
br label %18
17: ; preds = %13
store i32 8, i32* %1
br label %18
18: ; preds = %17, %16, %12, %8, %4
%19 = load i32, i32* %1
ret i32 %19
}

LLVM IR (-O2):
define i32 @GetPlayerShipIndex() {
%1 = tail call i32 @IsParked(i32 0)
%2 = icmp eq i32 %1, 0
br i1 %2, label %13, label %3
3: ; preds = %0
%4 = tail call i32 @IsParked(i32 51)
%5 = icmp eq i32 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %3
%7 = tail call i32 @IsParked(i32 53)
%8 = icmp eq i32 %7, 0
br i1 %8, label %13, label %9
9: ; preds = %6
%10 = tail call i32 @IsParked(i32 55)
%11 = icmp eq i32 %10, 0
%12 = select i1 %11, i32 55, i32 8
br label %13
13: ; preds = %9, %6, %3, %0
%14 = phi i32 [ 0, %0 ], [ 51, %3 ], [ 53, %6 ], [ %12, %9 ]
ret i32 %14
}