#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 shakeWheel(int wheel) {
  printf("and you shake it all about.\n");
  for (int i = 0; i < 5; ++i) {
    motor(wheel, 100);
    msleep(100);
    motor(wheel, -100);
    msleep(100);
  }
  motor(wheel, 100);
  msleep(100);
  off(wheel);
}


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

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

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

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