#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*/ marker_setposition(int);
int /*<<< orphan*/ road_build(int, int);
int road_prospect(int, int);
int road_vertbuild(int player, int origin, int dest, int pregame) {
  marker_setposition(origin);
  int dir = 0;
  if (dest == origin - 1)
    dir = 2;
  else if (dest == origin + 1)
    dir = 3;
  else if (dest < origin)
    dir = 0;
  else if (dest > origin)
    dir = 1;
  int ret = road_prospect(player, dir);
  if (ret)
    road_build(player, pregame);
  return ret;
}


x86 assembly (clang, -O0):
<road_vertbuild>:
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    -0x8(%rbp),%edi
call   1050 <marker_setposition@plt>
movl   $0x0,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1170 <road_vertbuild+0x40>
movl   $0x2,-0x14(%rbp)
jmp    11c7 <road_vertbuild+0x97>
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jne    118d <road_vertbuild+0x5d>
movl   $0x3,-0x14(%rbp)
jmp    11c2 <road_vertbuild+0x92>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11a5 <road_vertbuild+0x75>
movl   $0x0,-0x14(%rbp)
jmp    11bd <road_vertbuild+0x8d>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    11b8 <road_vertbuild+0x88>
movl   $0x1,-0x14(%rbp)
jmp    11bd <road_vertbuild+0x8d>
jmp    11c2 <road_vertbuild+0x92>
jmp    11c7 <road_vertbuild+0x97>
mov    -0x4(%rbp),%edi
mov    -0x14(%rbp),%esi
call   1030 <road_prospect@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     11ea <road_vertbuild+0xba>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <road_build@plt>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<road_vertbuild>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %edx,%ebx
mov    %esi,%ebp
mov    %edi,%r15d
mov    %esi,%edi
call   1050 <marker_setposition@plt>
lea    -0x1(%rbp),%eax
mov    $0x2,%esi
cmp    %ebx,%eax
je     1168 <road_vertbuild+0x38>
lea    0x1(%rbp),%eax
mov    $0x3,%esi
cmp    %ebx,%eax
je     1168 <road_vertbuild+0x38>
xor    %esi,%esi
cmp    %ebp,%ebx
setg   %sil
mov    %r15d,%edi
call   1030 <road_prospect@plt>
mov    %eax,%ebx
test   %eax,%eax
je     1181 <road_vertbuild+0x51>
mov    %r15d,%edi
mov    %r14d,%esi
call   1040 <road_build@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @road_vertbuild(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %6
%12 = call i32 @marker_setposition(i32 %11)
store i32 0, i32* %9
%13 = load i32, i32* %7
%14 = load i32, i32* %6
%15 = sub nsw i32 %14, 1
%16 = icmp eq i32 %13, %15
br i1 %16, label %17, label %18
17: ; preds = %4
store i32 2, i32* %9
br label %37
18: ; preds = %4
%19 = load i32, i32* %7
%20 = load i32, i32* %6
%21 = add nsw i32 %20, 1
%22 = icmp eq i32 %19, %21
br i1 %22, label %23, label %24
23: ; preds = %18
store i32 3, i32* %9
br label %36
24: ; preds = %18
%25 = load i32, i32* %7
%26 = load i32, i32* %6
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %29
28: ; preds = %24
store i32 0, i32* %9
br label %35
29: ; preds = %24
%30 = load i32, i32* %7
%31 = load i32, i32* %6
%32 = icmp sgt i32 %30, %31
br i1 %32, label %33, label %34
33: ; preds = %29
store i32 1, i32* %9
br label %34
34: ; preds = %33, %29
br label %35
35: ; preds = %34, %28
br label %36
36: ; preds = %35, %23
br label %37
37: ; preds = %36, %17
%38 = load i32, i32* %5
%39 = load i32, i32* %9
%40 = call i32 @road_prospect(i32 %38, i32 %39)
store i32 %40, i32* %10
%41 = load i32, i32* %10
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %47
43: ; preds = %37
%44 = load i32, i32* %5
%45 = load i32, i32* %8
%46 = call i32 @road_build(i32 %44, i32 %45)
br label %47
47: ; preds = %43, %37
%48 = load i32, i32* %10
ret i32 %48
}

LLVM IR (-O2):
define i32 @road_vertbuild(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @marker_setposition(i32 %1)
%6 = add nsw i32 %1, -1
%7 = icmp eq i32 %6, %2
br i1 %7, label %14, label %8
8: ; preds = %4
%9 = add nsw i32 %1, 1
%10 = icmp eq i32 %9, %2
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = icmp sgt i32 %2, %1
%13 = zext i1 %12 to i32
br label %14
14: ; preds = %11, %8, %4
%15 = phi i32 [ 2, %4 ], [ 3, %8 ], [ %13, %11 ]
%16 = tail call i32 @road_prospect(i32 %0, i32 %15)
%17 = icmp eq i32 %16, 0
br i1 %17, label %20, label %18
18: ; preds = %14
%19 = tail call i32 @road_build(i32 %0, i32 %3)
br label %20
20: ; preds = %18, %14
ret i32 %16
}