#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*/ create_drive_straight(int);
int get_create_lfcliff_amt();
int get_create_rfcliff_amt();
double seconds();
int /*<<< orphan*/ turnLeftDegrees(int);
int /*<<< orphan*/ turnRightDegrees(int);
void goAlongLine(double time) {
  int left, right, speed = 200;
  double sTime, cTime = 0;
  sTime = seconds();
  create_drive_straight(speed);
  while (cTime - sTime <= time) {
    left = get_create_lfcliff_amt();
    right = get_create_rfcliff_amt();
    if (left < 800) {
      turnLeftDegrees(2);
      cTime = cTime - 500;
      create_drive_straight(speed);
    }
    if (right < 800) {
      turnRightDegrees(2);
      cTime = cTime - 500;
      create_drive_straight(speed);
    }
    cTime = seconds();
  }
}


x86 assembly (clang, -O0):
<goAlongLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movl   $0xc8,-0x14(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    $0x0,%al
call   1040 <seconds@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <create_drive_straight@plt>
movsd  -0x28(%rbp),%xmm1
subsd  -0x20(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1238 <goAlongLine+0xd8>
mov    $0x0,%al
call   1060 <get_create_lfcliff_amt@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1070 <get_create_rfcliff_amt@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x320,-0xc(%rbp)
jge    11f2 <goAlongLine+0x92>
mov    $0x2,%edi
call   1080 <turnLeftDegrees@plt>
movsd  -0x28(%rbp),%xmm0
movsd  0xe1f(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <create_drive_straight@plt>
cmpl   $0x320,-0x10(%rbp)
jge    1227 <goAlongLine+0xc7>
mov    $0x2,%edi
call   1030 <turnRightDegrees@plt>
movsd  -0x28(%rbp),%xmm0
movsd  0xdea(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x14(%rbp),%edi
call   1050 <create_drive_straight@plt>
mov    $0x0,%al
call   1040 <seconds@plt>
movsd  %xmm0,-0x28(%rbp)
jmp    1190 <goAlongLine+0x30>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<goAlongLine>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movsd  %xmm0,0x10(%rsp)
xor    %eax,%eax
call   1040 <seconds@plt>
movsd  %xmm0,0x8(%rsp)
mov    $0xc8,%edi
call   1050 <create_drive_straight@plt>
xorpd  %xmm0,%xmm0
jmp    1197 <goAlongLine+0x37>
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <seconds@plt>
subsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
ucomisd %xmm0,%xmm1
jb     11f5 <goAlongLine+0x95>
xor    %eax,%eax
call   1060 <get_create_lfcliff_amt@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1070 <get_create_rfcliff_amt@plt>
mov    %eax,%ebx
cmp    $0x31f,%ebp
jg     11d7 <goAlongLine+0x77>
mov    $0x2,%edi
call   1080 <turnLeftDegrees@plt>
mov    $0xc8,%edi
call   1050 <create_drive_straight@plt>
cmp    $0x31f,%ebx
jg     1190 <goAlongLine+0x30>
mov    $0x2,%edi
call   1030 <turnRightDegrees@plt>
mov    $0xc8,%edi
call   1050 <create_drive_straight@plt>
jmp    1190 <goAlongLine+0x30>
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @goAlongLine(double %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
%7 = alloca double
store double %0, double* %2
store i32 200, i32* %5
store double 0.000000e+00, double* %7
%8 = call double (...) @seconds()
store double %8, double* %6
%9 = load i32, i32* %5
%10 = call i32 @create_drive_straight(i32 %9)
br label %11
11: ; preds = %37, %1
%12 = load double, double* %7
%13 = load double, double* %6
%14 = fsub double %12, %13
%15 = load double, double* %2
%16 = fcmp ole double %14, %15
br i1 %16, label %17, label %39
17: ; preds = %11
%18 = call i32 (...) @get_create_lfcliff_amt()
store i32 %18, i32* %3
%19 = call i32 (...) @get_create_rfcliff_amt()
store i32 %19, i32* %4
%20 = load i32, i32* %3
%21 = icmp slt i32 %20, 800
br i1 %21, label %22, label %28
22: ; preds = %17
%23 = call i32 @turnLeftDegrees(i32 2)
%24 = load double, double* %7
%25 = fsub double %24, 5.000000e+02
store double %25, double* %7
%26 = load i32, i32* %5
%27 = call i32 @create_drive_straight(i32 %26)
br label %28
28: ; preds = %22, %17
%29 = load i32, i32* %4
%30 = icmp slt i32 %29, 800
br i1 %30, label %31, label %37
31: ; preds = %28
%32 = call i32 @turnRightDegrees(i32 2)
%33 = load double, double* %7
%34 = fsub double %33, 5.000000e+02
store double %34, double* %7
%35 = load i32, i32* %5
%36 = call i32 @create_drive_straight(i32 %35)
br label %37
37: ; preds = %31, %28
%38 = call double (...) @seconds()
store double %38, double* %7
br label %11
39: ; preds = %11
ret void
}

LLVM IR (-O2):
define void @goAlongLine(double %0) {
%2 = tail call double (...) @seconds()
%3 = tail call i32 @create_drive_straight(i32 200)
%4 = fsub double 0.000000e+00, %2
%5 = fcmp ugt double %4, %0
br i1 %5, label %22, label %6
6: ; preds = %1, %18
%7 = tail call i32 (...) @get_create_lfcliff_amt()
%8 = tail call i32 (...) @get_create_rfcliff_amt()
%9 = icmp slt i32 %7, 800
br i1 %9, label %10, label %13
10: ; preds = %6
%11 = tail call i32 @turnLeftDegrees(i32 2)
%12 = tail call i32 @create_drive_straight(i32 200)
br label %13
13: ; preds = %10, %6
%14 = icmp slt i32 %8, 800
br i1 %14, label %15, label %18
15: ; preds = %13
%16 = tail call i32 @turnRightDegrees(i32 2)
%17 = tail call i32 @create_drive_straight(i32 200)
br label %18
18: ; preds = %15, %13
%19 = tail call double (...) @seconds()
%20 = fsub double %19, %2
%21 = fcmp ugt double %20, %0
br i1 %21, label %22, label %6
22: ; preds = %18, %1
ret void
}