#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*/ cycle();
int distance(int /*<<< orphan*/, int /*<<< orphan*/, int, int);
int /*<<< orphan*/ drive(int, int);
int /*<<< orphan*/ loc_x();
int /*<<< orphan*/ loc_y();
int plot_course(int, int);
scalar_t__ speed();
void go(int x, int y) {
  int angle = plot_course(x, y);
  drive(angle, 100);
  while (distance(loc_x(), loc_y(), x, y) > 100 && speed() > 0)
    cycle();
  drive(angle, 20);
  while (distance(loc_x(), loc_y(), x, y) > 10 && speed() > 0)
    cycle();
  drive(angle, 0);
}


x86 assembly (clang, -O0):
<go>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <plot_course@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x64,%esi
call   1070 <drive@plt>
mov    $0x0,%al
call   1050 <loc_x@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1030 <loc_y@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%esi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
call   1090 <distance@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x64,%ecx
mov    %al,-0xd(%rbp)
jle    11db <go+0x6b>
mov    $0x0,%al
call   1060 <speed@plt>
cmp    $0x0,%rax
setg   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    11eb <go+0x7b>
jmp    11f7 <go+0x87>
mov    $0x0,%al
call   1080 <cycle@plt>
jmp    1199 <go+0x29>
mov    -0xc(%rbp),%edi
mov    $0x14,%esi
call   1070 <drive@plt>
mov    $0x0,%al
call   1050 <loc_x@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x0,%al
call   1030 <loc_y@plt>
mov    -0x1c(%rbp),%edi
mov    %eax,%esi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
call   1090 <distance@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x15(%rbp)
jle    1246 <go+0xd6>
mov    $0x0,%al
call   1060 <speed@plt>
cmp    $0x0,%rax
setg   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1256 <go+0xe6>
jmp    1262 <go+0xf2>
mov    $0x0,%al
call   1080 <cycle@plt>
jmp    1204 <go+0x94>
mov    -0xc(%rbp),%edi
xor    %esi,%esi
call   1070 <drive@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<go>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r12d
mov    %edi,%ebp
call   1040 <plot_course@plt>
mov    %eax,%r14d
mov    %eax,%edi
mov    $0x64,%esi
call   1070 <drive@plt>
xor    %eax,%eax
call   1050 <loc_x@plt>
mov    %eax,%r15d
xor    %eax,%eax
call   1030 <loc_y@plt>
mov    %r15d,%edi
mov    %eax,%esi
mov    %ebp,%edx
mov    %r12d,%ecx
call   1090 <distance@plt>
cmp    $0x65,%eax
jl     11f6 <go+0x86>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <speed@plt>
test   %rax,%rax
jle    11f6 <go+0x86>
xor    %eax,%eax
call   1080 <cycle@plt>
xor    %eax,%eax
call   1050 <loc_x@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <loc_y@plt>
mov    %ebx,%edi
mov    %eax,%esi
mov    %ebp,%edx
mov    %r12d,%ecx
call   1090 <distance@plt>
cmp    $0x64,%eax
jg     11c0 <go+0x50>
mov    %r14d,%edi
mov    $0x14,%esi
call   1070 <drive@plt>
xor    %eax,%eax
call   1050 <loc_x@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <loc_y@plt>
mov    %ebx,%edi
mov    %eax,%esi
mov    %ebp,%edx
mov    %r12d,%ecx
call   1090 <distance@plt>
cmp    $0xb,%eax
jl     1266 <go+0xf6>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <speed@plt>
test   %rax,%rax
jle    1266 <go+0xf6>
xor    %eax,%eax
call   1080 <cycle@plt>
xor    %eax,%eax
call   1050 <loc_x@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <loc_y@plt>
mov    %ebx,%edi
mov    %eax,%esi
mov    %ebp,%edx
mov    %r12d,%ecx
call   1090 <distance@plt>
cmp    $0xa,%eax
jg     1230 <go+0xc0>
mov    %r14d,%edi
xor    %esi,%esi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1070 <drive@plt>

LLVM IR (-O0):
define void @go(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = call i32 @plot_course(i32 %6, i32 %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = call i32 @drive(i32 %9, i32 100)
br label %11
11: ; preds = %23, %2
%12 = call i32 (...) @loc_x()
%13 = call i32 (...) @loc_y()
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = call i32 @distance(i32 %12, i32 %13, i32 %14, i32 %15)
%17 = icmp sgt i32 %16, 100
br i1 %17, label %18, label %21
18: ; preds = %11
%19 = call i64 (...) @speed()
%20 = icmp sgt i64 %19, 0
br label %21
21: ; preds = %18, %11
%22 = phi i1 [ false, %11 ], [ %20, %18 ]
br i1 %22, label %23, label %25
23: ; preds = %21
%24 = call i32 (...) @cycle()
br label %11
25: ; preds = %21
%26 = load i32, i32* %5
%27 = call i32 @drive(i32 %26, i32 20)
br label %28
28: ; preds = %40, %25
%29 = call i32 (...) @loc_x()
%30 = call i32 (...) @loc_y()
%31 = load i32, i32* %3
%32 = load i32, i32* %4
%33 = call i32 @distance(i32 %29, i32 %30, i32 %31, i32 %32)
%34 = icmp sgt i32 %33, 10
br i1 %34, label %35, label %38
35: ; preds = %28
%36 = call i64 (...) @speed()
%37 = icmp sgt i64 %36, 0
br label %38
38: ; preds = %35, %28
%39 = phi i1 [ false, %28 ], [ %37, %35 ]
br i1 %39, label %40, label %42
40: ; preds = %38
%41 = call i32 (...) @cycle()
br label %28
42: ; preds = %38
%43 = load i32, i32* %5
%44 = call i32 @drive(i32 %43, i32 0)
ret void
}

LLVM IR (-O2):
define void @go(i32 %0, i32 %1) {
%3 = tail call i32 @plot_course(i32 %0, i32 %1)
%4 = tail call i32 @drive(i32 %3, i32 100)
%5 = tail call i32 (...) @loc_x()
%6 = tail call i32 (...) @loc_y()
%7 = tail call i32 @distance(i32 %5, i32 %6, i32 %0, i32 %1)
%8 = icmp sgt i32 %7, 100
br i1 %8, label %9, label %18
9: ; preds = %2, %12
%10 = tail call i64 (...) @speed()
%11 = icmp sgt i64 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %9
%13 = tail call i32 (...) @cycle()
%14 = tail call i32 (...) @loc_x()
%15 = tail call i32 (...) @loc_y()
%16 = tail call i32 @distance(i32 %14, i32 %15, i32 %0, i32 %1)
%17 = icmp sgt i32 %16, 100
br i1 %17, label %9, label %18
18: ; preds = %9, %12, %2
%19 = tail call i32 @drive(i32 %3, i32 20)
%20 = tail call i32 (...) @loc_x()
%21 = tail call i32 (...) @loc_y()
%22 = tail call i32 @distance(i32 %20, i32 %21, i32 %0, i32 %1)
%23 = icmp sgt i32 %22, 10
br i1 %23, label %24, label %33
24: ; preds = %18, %27
%25 = tail call i64 (...) @speed()
%26 = icmp sgt i64 %25, 0
br i1 %26, label %27, label %33
27: ; preds = %24
%28 = tail call i32 (...) @cycle()
%29 = tail call i32 (...) @loc_x()
%30 = tail call i32 (...) @loc_y()
%31 = tail call i32 @distance(i32 %29, i32 %30, i32 %0, i32 %1)
%32 = icmp sgt i32 %31, 10
br i1 %32, label %24, label %33
33: ; preds = %24, %27, %18
%34 = tail call i32 @drive(i32 %3, i32 0)
ret void
}