#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*/ clearSteering();
int /*<<< orphan*/ delay(int);
int /*<<< orphan*/ steering(int);
int /*<<< orphan*/ throttle(int);
int figureEight(int value) {
  int delayTime = value / 100;
  throttle(100);
  delay(delayTime);
  steering(1);
  delay(delayTime);
  clearSteering();
  delay(delayTime);
  steering(-1);
  delay(delayTime);
  clearSteering();
  delay(delayTime);
  throttle(0);
  return 0;
}


x86 assembly (clang, -O0):
<figureEight>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    $0x64,%edi
call   1040 <throttle@plt>
mov    -0x8(%rbp),%edi
call   1050 <delay@plt>
mov    $0x1,%edi
call   1060 <steering@plt>
mov    -0x8(%rbp),%edi
call   1050 <delay@plt>
mov    $0x0,%al
call   1030 <clearSteering@plt>
mov    -0x8(%rbp),%edi
call   1050 <delay@plt>
mov    $0xffffffff,%edi
call   1060 <steering@plt>
mov    -0x8(%rbp),%edi
call   1050 <delay@plt>
mov    $0x0,%al
call   1030 <clearSteering@plt>
mov    -0x8(%rbp),%edi
call   1050 <delay@plt>
xor    %edi,%edi
call   1040 <throttle@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<figureEight>:
push   %rbx
movslq %edi,%rax
imul   $0x51eb851f,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x25,%rbx
add    %eax,%ebx
mov    $0x64,%edi
call   1040 <throttle@plt>
mov    %ebx,%edi
call   1050 <delay@plt>
mov    $0x1,%edi
call   1060 <steering@plt>
mov    %ebx,%edi
call   1050 <delay@plt>
xor    %eax,%eax
call   1030 <clearSteering@plt>
mov    %ebx,%edi
call   1050 <delay@plt>
mov    $0xffffffff,%edi
call   1060 <steering@plt>
mov    %ebx,%edi
call   1050 <delay@plt>
xor    %eax,%eax
call   1030 <clearSteering@plt>
mov    %ebx,%edi
call   1050 <delay@plt>
xor    %edi,%edi
call   1040 <throttle@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @figureEight(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sdiv i32 %4, 100
store i32 %5, i32* %3
%6 = call i32 @throttle(i32 100)
%7 = load i32, i32* %3
%8 = call i32 @delay(i32 %7)
%9 = call i32 @steering(i32 1)
%10 = load i32, i32* %3
%11 = call i32 @delay(i32 %10)
%12 = call i32 (...) @clearSteering()
%13 = load i32, i32* %3
%14 = call i32 @delay(i32 %13)
%15 = call i32 @steering(i32 -1)
%16 = load i32, i32* %3
%17 = call i32 @delay(i32 %16)
%18 = call i32 (...) @clearSteering()
%19 = load i32, i32* %3
%20 = call i32 @delay(i32 %19)
%21 = call i32 @throttle(i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @figureEight(i32 %0) {
%2 = sdiv i32 %0, 100
%3 = tail call i32 @throttle(i32 100)
%4 = tail call i32 @delay(i32 %2)
%5 = tail call i32 @steering(i32 1)
%6 = tail call i32 @delay(i32 %2)
%7 = tail call i32 (...) @clearSteering()
%8 = tail call i32 @delay(i32 %2)
%9 = tail call i32 @steering(i32 -1)
%10 = tail call i32 @delay(i32 %2)
%11 = tail call i32 (...) @clearSteering()
%12 = tail call i32 @delay(i32 %2)
%13 = tail call i32 @throttle(i32 0)
ret i32 0
}