#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*/ disable_servos();
int /*<<< orphan*/ enable_servos();
int /*<<< orphan*/ msleep(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ set_servo_position(int /*<<< orphan*/, int);
int main() {
  printf("Hello, World!\n");
  set_servo_position(0, 150);
  enable_servos();
  int i = 0;
  for (i = 0; i < 10; i = i + 1) {
    printf("i = %d\n", i);
    set_servo_position(0, 1024);
    msleep(1000);
    set_servo_position(0, 150);
    msleep(1000);
  }
  disable_servos();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
mov    $0x96,%esi
call   1070 <set_servo_position@plt>
mov    $0x0,%al
call   1060 <enable_servos@plt>
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11e3 <main+0x93>
mov    -0x8(%rbp),%esi
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %edi,%edi
mov    $0x400,%esi
call   1070 <set_servo_position@plt>
mov    $0x3e8,%edi
call   1040 <msleep@plt>
xor    %edi,%edi
mov    $0x96,%esi
call   1070 <set_servo_position@plt>
mov    $0x3e8,%edi
call   1040 <msleep@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    118e <main+0x3e>
mov    $0x0,%al
call   1030 <disable_servos@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xea0(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
mov    $0x96,%esi
call   1080 <set_servo_position@plt>
xor    %eax,%eax
call   1070 <enable_servos@plt>
lea    0xe79(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %edi,%edi
mov    $0x400,%esi
call   1080 <set_servo_position@plt>
mov    $0x3e8,%edi
call   1050 <msleep@plt>
xor    %edi,%edi
mov    $0x96,%esi
call   1080 <set_servo_position@plt>
mov    $0x3e8,%edi
call   1050 <msleep@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %edi,%edi
mov    $0x400,%esi
call   1080 <set_servo_position@plt>
mov    $0x3e8,%edi
call   1050 <msleep@plt>
xor    %edi,%edi
mov    $0x96,%esi
call   1080 <set_servo_position@plt>
mov    $0x3e8,%edi
call   1050 <msleep@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %edi,%edi
mov    $0x400,%esi
call   1080 <set_servo_position@plt>
mov    $0x3e8,%edi
call   1050 <msleep@plt>
xor    %edi,%edi
mov    $0x96,%esi
call   1080 <set_servo_position@plt>
mov    $0x3e8,%edi
call   1050 <msleep@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %edi,%edi
mov    $0x400,%esi
call   1080 <set_servo_position@plt>
mov    $0x3e8,%edi
call   1050 <msleep@plt>
xor    %edi,%edi
mov    $0x96,%esi
call   1080 <set_servo_position@plt>
mov    $0x3e8,%edi
call   1050 <msleep@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %edi,%edi
mov    $0x400,%esi
call   1080 <set_servo_position@plt>
mov    $0x3e8,%edi
call   1050 <msleep@plt>
xor    %edi,%edi
mov    $0x96,%esi
call   1080 <set_servo_position@plt>
mov    $0x3e8,%edi
call   1050 <msleep@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %edi,%edi
mov    $0x400,%esi
call   1080 <set_servo_position@plt>
mov    $0x3e8,%edi
call   1050 <msleep@plt>
xor    %edi,%edi
mov    $0x96,%esi
call   1080 <set_servo_position@plt>
mov    $0x3e8,%edi
call   1050 <msleep@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %edi,%edi
mov    $0x400,%esi
call   1080 <set_servo_position@plt>
mov    $0x3e8,%edi
call   1050 <msleep@plt>
xor    %edi,%edi
mov    $0x96,%esi
call   1080 <set_servo_position@plt>
mov    $0x3e8,%edi
call   1050 <msleep@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %edi,%edi
mov    $0x400,%esi
call   1080 <set_servo_position@plt>
mov    $0x3e8,%edi
call   1050 <msleep@plt>
xor    %edi,%edi
mov    $0x96,%esi
call   1080 <set_servo_position@plt>
mov    $0x3e8,%edi
call   1050 <msleep@plt>
mov    %rbx,%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %edi,%edi
mov    $0x400,%esi
call   1080 <set_servo_position@plt>
mov    $0x3e8,%edi
call   1050 <msleep@plt>
xor    %edi,%edi
mov    $0x96,%esi
call   1080 <set_servo_position@plt>
mov    $0x3e8,%edi
call   1050 <msleep@plt>
mov    %rbx,%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1060 <printf@plt>
xor    %edi,%edi
mov    $0x400,%esi
call   1080 <set_servo_position@plt>
mov    $0x3e8,%edi
call   1050 <msleep@plt>
xor    %edi,%edi
mov    $0x96,%esi
call   1080 <set_servo_position@plt>
mov    $0x3e8,%edi
call   1050 <msleep@plt>
xor    %eax,%eax
call   1040 <disable_servos@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Hello, World!\0A\00"
@.str.1 = [8 x i8] c"i = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @set_servo_position(i32 0, i32 150)
%5 = call i32 (...) @enable_servos()
store i32 0, i32* %2
store i32 0, i32* %2
br label %6
6: ; preds = %16, %0
%7 = load i32, i32* %2
%8 = icmp slt i32 %7, 10
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = load i32, i32* %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 %10)
%12 = call i32 @set_servo_position(i32 0, i32 1024)
%13 = call i32 @msleep(i32 1000)
%14 = call i32 @set_servo_position(i32 0, i32 150)
%15 = call i32 @msleep(i32 1000)
br label %16
16: ; preds = %9
%17 = load i32, i32* %2
%18 = add nsw i32 %17, 1
store i32 %18, i32* %2
br label %6
19: ; preds = %6
%20 = call i32 (...) @disable_servos()
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [8 x i8] c"i = %d\0A\00"
@str = [14 x i8] c"Hello, World!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @set_servo_position(i32 0, i32 150)
%3 = tail call i32 (...) @enable_servos()
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 0)
%5 = tail call i32 @set_servo_position(i32 0, i32 1024)
%6 = tail call i32 @msleep(i32 1000)
%7 = tail call i32 @set_servo_position(i32 0, i32 150)
%8 = tail call i32 @msleep(i32 1000)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 1)
%10 = tail call i32 @set_servo_position(i32 0, i32 1024)
%11 = tail call i32 @msleep(i32 1000)
%12 = tail call i32 @set_servo_position(i32 0, i32 150)
%13 = tail call i32 @msleep(i32 1000)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 2)
%15 = tail call i32 @set_servo_position(i32 0, i32 1024)
%16 = tail call i32 @msleep(i32 1000)
%17 = tail call i32 @set_servo_position(i32 0, i32 150)
%18 = tail call i32 @msleep(i32 1000)
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 3)
%20 = tail call i32 @set_servo_position(i32 0, i32 1024)
%21 = tail call i32 @msleep(i32 1000)
%22 = tail call i32 @set_servo_position(i32 0, i32 150)
%23 = tail call i32 @msleep(i32 1000)
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 4)
%25 = tail call i32 @set_servo_position(i32 0, i32 1024)
%26 = tail call i32 @msleep(i32 1000)
%27 = tail call i32 @set_servo_position(i32 0, i32 150)
%28 = tail call i32 @msleep(i32 1000)
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 5)
%30 = tail call i32 @set_servo_position(i32 0, i32 1024)
%31 = tail call i32 @msleep(i32 1000)
%32 = tail call i32 @set_servo_position(i32 0, i32 150)
%33 = tail call i32 @msleep(i32 1000)
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 6)
%35 = tail call i32 @set_servo_position(i32 0, i32 1024)
%36 = tail call i32 @msleep(i32 1000)
%37 = tail call i32 @set_servo_position(i32 0, i32 150)
%38 = tail call i32 @msleep(i32 1000)
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 7)
%40 = tail call i32 @set_servo_position(i32 0, i32 1024)
%41 = tail call i32 @msleep(i32 1000)
%42 = tail call i32 @set_servo_position(i32 0, i32 150)
%43 = tail call i32 @msleep(i32 1000)
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 8)
%45 = tail call i32 @set_servo_position(i32 0, i32 1024)
%46 = tail call i32 @msleep(i32 1000)
%47 = tail call i32 @set_servo_position(i32 0, i32 150)
%48 = tail call i32 @msleep(i32 1000)
%49 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 9)
%50 = tail call i32 @set_servo_position(i32 0, i32 1024)
%51 = tail call i32 @msleep(i32 1000)
%52 = tail call i32 @set_servo_position(i32 0, i32 150)
%53 = tail call i32 @msleep(i32 1000)
%54 = tail call i32 (...) @disable_servos()
ret i32 0
}