#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*/ motor(int, int);
int /*<<< orphan*/ msleep(int);
int /*<<< orphan*/ off(int);
int /*<<< orphan*/ printf(char *);
void shakeWheels() {
  printf("and you shake it all about.\n");
  for (int i = 0; i < 5; ++i) {
    motor(3, 100);
    motor(1, -100);
    msleep(100);
    motor(3, -100);
    motor(1, 100);
    msleep(100);
  }
  motor(3, 100);
  motor(1, -100);
  msleep(100);
  off(3);
  off(1);
}


x86 assembly (clang, -O0):
<shakeWheels>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
cmpl   $0x5,-0x4(%rbp)
jge    11c3 <shakeWheels+0x83>
mov    $0x3,%edi
mov    $0x64,%esi
call   1030 <motor@plt>
mov    $0x1,%edi
mov    $0xffffff9c,%esi
call   1030 <motor@plt>
mov    $0x64,%edi
call   1050 <msleep@plt>
mov    $0x3,%edi
mov    $0xffffff9c,%esi
call   1030 <motor@plt>
mov    $0x1,%edi
mov    $0x64,%esi
call   1030 <motor@plt>
mov    $0x64,%edi
call   1050 <msleep@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    115b <shakeWheels+0x1b>
mov    $0x3,%edi
mov    $0x64,%esi
call   1030 <motor@plt>
mov    $0x1,%edi
mov    $0xffffff9c,%esi
call   1030 <motor@plt>
mov    $0x64,%edi
call   1050 <msleep@plt>
mov    $0x3,%edi
call   1040 <off@plt>
mov    $0x1,%edi
call   1040 <off@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<shakeWheels>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1040 <puts@plt>
mov    $0x3,%edi
mov    $0x64,%esi
call   1030 <motor@plt>
mov    $0x1,%edi
mov    $0xffffff9c,%esi
call   1030 <motor@plt>
mov    $0x64,%edi
call   1060 <msleep@plt>
mov    $0x3,%edi
mov    $0xffffff9c,%esi
call   1030 <motor@plt>
mov    $0x1,%edi
mov    $0x64,%esi
call   1030 <motor@plt>
mov    $0x64,%edi
call   1060 <msleep@plt>
mov    $0x3,%edi
mov    $0x64,%esi
call   1030 <motor@plt>
mov    $0x1,%edi
mov    $0xffffff9c,%esi
call   1030 <motor@plt>
mov    $0x64,%edi
call   1060 <msleep@plt>
mov    $0x3,%edi
mov    $0xffffff9c,%esi
call   1030 <motor@plt>
mov    $0x1,%edi
mov    $0x64,%esi
call   1030 <motor@plt>
mov    $0x64,%edi
call   1060 <msleep@plt>
mov    $0x3,%edi
mov    $0x64,%esi
call   1030 <motor@plt>
mov    $0x1,%edi
mov    $0xffffff9c,%esi
call   1030 <motor@plt>
mov    $0x64,%edi
call   1060 <msleep@plt>
mov    $0x3,%edi
mov    $0xffffff9c,%esi
call   1030 <motor@plt>
mov    $0x1,%edi
mov    $0x64,%esi
call   1030 <motor@plt>
mov    $0x64,%edi
call   1060 <msleep@plt>
mov    $0x3,%edi
mov    $0x64,%esi
call   1030 <motor@plt>
mov    $0x1,%edi
mov    $0xffffff9c,%esi
call   1030 <motor@plt>
mov    $0x64,%edi
call   1060 <msleep@plt>
mov    $0x3,%edi
mov    $0xffffff9c,%esi
call   1030 <motor@plt>
mov    $0x1,%edi
mov    $0x64,%esi
call   1030 <motor@plt>
mov    $0x64,%edi
call   1060 <msleep@plt>
mov    $0x3,%edi
mov    $0x64,%esi
call   1030 <motor@plt>
mov    $0x1,%edi
mov    $0xffffff9c,%esi
call   1030 <motor@plt>
mov    $0x64,%edi
call   1060 <msleep@plt>
mov    $0x3,%edi
mov    $0xffffff9c,%esi
call   1030 <motor@plt>
mov    $0x1,%edi
mov    $0x64,%esi
call   1030 <motor@plt>
mov    $0x64,%edi
call   1060 <msleep@plt>
mov    $0x3,%edi
mov    $0x64,%esi
call   1030 <motor@plt>
mov    $0x1,%edi
mov    $0xffffff9c,%esi
call   1030 <motor@plt>
mov    $0x64,%edi
call   1060 <msleep@plt>
mov    $0x3,%edi
call   1050 <off@plt>
mov    $0x1,%edi
pop    %rax
jmp    1050 <off@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"and you shake it all about.\0A\00"
define void @shakeWheels() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %3
3: ; preds = %13, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 5
br i1 %5, label %6, label %16
6: ; preds = %3
%7 = call i32 @motor(i32 3, i32 100)
%8 = call i32 @motor(i32 1, i32 -100)
%9 = call i32 @msleep(i32 100)
%10 = call i32 @motor(i32 3, i32 -100)
%11 = call i32 @motor(i32 1, i32 100)
%12 = call i32 @msleep(i32 100)
br label %13
13: ; preds = %6
%14 = load i32, i32* %1
%15 = add nsw i32 %14, 1
store i32 %15, i32* %1
br label %3
16: ; preds = %3
%17 = call i32 @motor(i32 3, i32 100)
%18 = call i32 @motor(i32 1, i32 -100)
%19 = call i32 @msleep(i32 100)
%20 = call i32 @off(i32 3)
%21 = call i32 @off(i32 1)
ret void
}

LLVM IR (-O2):
@str = [28 x i8] c"and you shake it all about.\00"
define void @shakeWheels() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @motor(i32 3, i32 100)
%3 = tail call i32 @motor(i32 1, i32 -100)
%4 = tail call i32 @msleep(i32 100)
%5 = tail call i32 @motor(i32 3, i32 -100)
%6 = tail call i32 @motor(i32 1, i32 100)
%7 = tail call i32 @msleep(i32 100)
%8 = tail call i32 @motor(i32 3, i32 100)
%9 = tail call i32 @motor(i32 1, i32 -100)
%10 = tail call i32 @msleep(i32 100)
%11 = tail call i32 @motor(i32 3, i32 -100)
%12 = tail call i32 @motor(i32 1, i32 100)
%13 = tail call i32 @msleep(i32 100)
%14 = tail call i32 @motor(i32 3, i32 100)
%15 = tail call i32 @motor(i32 1, i32 -100)
%16 = tail call i32 @msleep(i32 100)
%17 = tail call i32 @motor(i32 3, i32 -100)
%18 = tail call i32 @motor(i32 1, i32 100)
%19 = tail call i32 @msleep(i32 100)
%20 = tail call i32 @motor(i32 3, i32 100)
%21 = tail call i32 @motor(i32 1, i32 -100)
%22 = tail call i32 @msleep(i32 100)
%23 = tail call i32 @motor(i32 3, i32 -100)
%24 = tail call i32 @motor(i32 1, i32 100)
%25 = tail call i32 @msleep(i32 100)
%26 = tail call i32 @motor(i32 3, i32 100)
%27 = tail call i32 @motor(i32 1, i32 -100)
%28 = tail call i32 @msleep(i32 100)
%29 = tail call i32 @motor(i32 3, i32 -100)
%30 = tail call i32 @motor(i32 1, i32 100)
%31 = tail call i32 @msleep(i32 100)
%32 = tail call i32 @motor(i32 3, i32 100)
%33 = tail call i32 @motor(i32 1, i32 -100)
%34 = tail call i32 @msleep(i32 100)
%35 = tail call i32 @off(i32 3)
%36 = tail call i32 @off(i32 1)
ret void
}