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


x86 assembly (clang, -O0):
<biscTimedSpin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jg     1154 <biscTimedSpin+0x24>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b1 <biscTimedSpin+0x81>
mov    -0x8(%rbp),%edi
call   1040 <biscSpin@plt>
cmp    $0xffffffff,%eax
jne    1171 <biscTimedSpin+0x41>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b1 <biscTimedSpin+0x81>
mov    -0xc(%rbp),%edi
call   1030 <biscWaitTime@plt>
cmp    $0xffffffff,%eax
jne    118e <biscTimedSpin+0x5e>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b1 <biscTimedSpin+0x81>
mov    $0x0,%al
call   1050 <biscDriveStop@plt>
cmp    $0xffffffff,%eax
jne    11aa <biscTimedSpin+0x7a>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b1 <biscTimedSpin+0x81>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<biscTimedSpin>:
push   %rbp
push   %rbx
push   %rax
mov    $0xffffffff,%ebx
test   %esi,%esi
jle    1165 <biscTimedSpin+0x35>
mov    %esi,%ebp
call   1040 <biscSpin@plt>
cmp    $0xffffffff,%eax
je     1165 <biscTimedSpin+0x35>
mov    %ebp,%edi
call   1030 <biscWaitTime@plt>
cmp    $0xffffffff,%eax
je     1165 <biscTimedSpin+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 @biscTimedSpin(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp sle i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 -1, i32* %3
br label %24
9: ; preds = %2
%10 = load i32, i32* %4
%11 = call i32 @biscSpin(i32 %10)
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %14
13: ; preds = %9
store i32 -1, i32* %3
br label %24
14: ; preds = %9
%15 = load i32, i32* %5
%16 = call i32 @biscWaitTime(i32 %15)
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %19
18: ; preds = %14
store i32 -1, i32* %3
br label %24
19: ; preds = %14
%20 = call i32 (...) @biscDriveStop()
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %23
22: ; preds = %19
store i32 -1, i32* %3
br label %24
23: ; preds = %19
store i32 0, i32* %3
br label %24
24: ; preds = %23, %22, %18, %13, %8
%25 = load i32, i32* %3
ret i32 %25
}

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