#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 *, char *, char *);
void moveWheel(int direction, int wheel) {
  char *dir = "in";
  char *wh = "left wheel";
  if (direction < 0) {
    dir = "out";
  }
  if (wheel == 3) {
    wh = "right wheel";
  }
  printf("You put your %s %s\n", wh, dir);
  motor(wheel, 25 * direction);
  msleep(1000);
  off(wheel);
}


x86 assembly (clang, -O0):
<moveWheel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    0xeab(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xea3(%rip),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1179 <moveWheel+0x39>
lea    0xe99(%rip),%rax
mov    %rax,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    118e <moveWheel+0x4e>
lea    0xe88(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xe81(%rip),%rdi
call   1060 <printf@plt>
mov    -0x8(%rbp),%edi
imul   $0x19,-0x4(%rbp),%esi
call   1030 <motor@plt>
mov    $0x3e8,%edi
call   1050 <msleep@plt>
mov    -0x8(%rbp),%edi
call   1040 <off@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<moveWheel>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%r14d
test   %edi,%edi
lea    0xebc(%rip),%rax
lea    0xea7(%rip),%rdx
cmovs  %rax,%rdx
cmp    $0x3,%esi
lea    0xeab(%rip),%rax
lea    0xe95(%rip),%rsi
cmove  %rax,%rsi
lea    0xea5(%rip),%rdi
call   1060 <printf@plt>
lea    (%r14,%r14,4),%eax
lea    (%rax,%rax,4),%esi
mov    %ebx,%edi
call   1030 <motor@plt>
mov    $0x3e8,%edi
call   1050 <msleep@plt>
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <off@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"in\00"
@.str.1 = [11 x i8] c"left wheel\00"
@.str.2 = [4 x i8] c"out\00"
@.str.3 = [12 x i8] c"right wheel\00"
@.str.4 = [20 x i8] c"You put your %s %s\0A\00"
define void @moveWheel(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store i32 %0, i32* %3
store i32 %1, i32* %4
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %5
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8** %6
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %2
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %5
br label %10
10: ; preds = %9, %2
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 3
br i1 %12, label %13, label %14
13: ; preds = %10
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8** %6
br label %14
14: ; preds = %13, %10
%15 = load i8*, i8** %6
%16 = load i8*, i8** %5
%17 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %15, i8* %16)
%18 = load i32, i32* %4
%19 = load i32, i32* %3
%20 = mul nsw i32 25, %19
%21 = call i32 @motor(i32 %18, i32 %20)
%22 = call i32 @msleep(i32 1000)
%23 = load i32, i32* %4
%24 = call i32 @off(i32 %23)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"in\00"
@.str.1 = [11 x i8] c"left wheel\00"
@.str.2 = [4 x i8] c"out\00"
@.str.3 = [12 x i8] c"right wheel\00"
@.str.4 = [20 x i8] c"You put your %s %s\0A\00"
define void @moveWheel(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, 0
%4 = select i1 %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0)
%5 = icmp eq i32 %1, 3
%6 = select i1 %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0), i8* %6, i8* %4)
%8 = mul nsw i32 %0, 25
%9 = tail call i32 @motor(i32 %1, i32 %8)
%10 = tail call i32 @msleep(i32 1000)
%11 = tail call i32 @off(i32 %1)
ret void
}