#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 biscDrive(int, int);
int biscDriveStop();
int biscWaitTime(int);
int biscTimedDrive(int velocity, int radius, int mseconds) {
  if (mseconds <= 0)
    return -1;
  if (biscDrive(velocity, radius) == -1)
    return -1;
  if (biscWaitTime(mseconds) == -1)
    return -1;
  if (biscDriveStop() == -1)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<biscTimedDrive>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jg     1157 <biscTimedDrive+0x27>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b7 <biscTimedDrive+0x87>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <biscDrive@plt>
cmp    $0xffffffff,%eax
jne    1177 <biscTimedDrive+0x47>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b7 <biscTimedDrive+0x87>
mov    -0x10(%rbp),%edi
call   1040 <biscWaitTime@plt>
cmp    $0xffffffff,%eax
jne    1194 <biscTimedDrive+0x64>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b7 <biscTimedDrive+0x87>
mov    $0x0,%al
call   1050 <biscDriveStop@plt>
cmp    $0xffffffff,%eax
jne    11b0 <biscTimedDrive+0x80>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b7 <biscTimedDrive+0x87>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<biscTimedDrive>:
push   %rbp
push   %rbx
push   %rax
mov    $0xffffffff,%ebx
test   %edx,%edx
jle    1165 <biscTimedDrive+0x35>
mov    %edx,%ebp
call   1030 <biscDrive@plt>
cmp    $0xffffffff,%eax
je     1165 <biscTimedDrive+0x35>
mov    %ebp,%edi
call   1040 <biscWaitTime@plt>
cmp    $0xffffffff,%eax
je     1165 <biscTimedDrive+0x35>
xor    %eax,%eax
call   1050 <biscDriveStop@plt>
xor    %ebx,%ebx
cmp    $0xffffffff,%eax
sete   %bl
neg    %ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @biscTimedDrive(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load i32, i32* %7
%9 = icmp sle i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %3
store i32 -1, i32* %4
br label %27
11: ; preds = %3
%12 = load i32, i32* %5
%13 = load i32, i32* %6
%14 = call i32 @biscDrive(i32 %12, i32 %13)
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %17
16: ; preds = %11
store i32 -1, i32* %4
br label %27
17: ; preds = %11
%18 = load i32, i32* %7
%19 = call i32 @biscWaitTime(i32 %18)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %22
21: ; preds = %17
store i32 -1, i32* %4
br label %27
22: ; preds = %17
%23 = call i32 (...) @biscDriveStop()
%24 = icmp eq i32 %23, -1
br i1 %24, label %25, label %26
25: ; preds = %22
store i32 -1, i32* %4
br label %27
26: ; preds = %22
store i32 0, i32* %4
br label %27
27: ; preds = %26, %25, %21, %16, %10
%28 = load i32, i32* %4
ret i32 %28
}

LLVM IR (-O2):
define i32 @biscTimedDrive(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %2, 1
br i1 %4, label %15, label %5
5: ; preds = %3
%6 = tail call i32 @biscDrive(i32 %0, i32 %1)
%7 = icmp eq i32 %6, -1
br i1 %7, label %15, label %8
8: ; preds = %5
%9 = tail call i32 @biscWaitTime(i32 %2)
%10 = icmp eq i32 %9, -1
br i1 %10, label %15, label %11
11: ; preds = %8
%12 = tail call i32 (...) @biscDriveStop()
%13 = icmp eq i32 %12, -1
%14 = sext i1 %13 to i32
br label %15
15: ; preds = %11, %8, %5, %3
%16 = phi i32 [ -1, %3 ], [ -1, %5 ], [ -1, %8 ], [ %14, %11 ]
ret i32 %16
}