#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*/ closeJetduino();
int /*<<< orphan*/ dynamixelAddSynchMove(int, int, int);
int /*<<< orphan*/ dynamixelExecuteSynchMove();
int /*<<< orphan*/ dynamixelSetRegister(int, int, int, int);
int /*<<< orphan*/ dynamixelStartSynchMove();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ jet_sleep(int);
int openJetduino();
int /*<<< orphan*/ printf(char *);
int main(void) {
  int dval;
  int i = 0, servo_a = 1, servo_b = 2;
  int pin = 4;
  if (openJetduino() == -1)
    exit(1);
  printf("setting return status level to 1\n");
  dynamixelSetRegister(servo_a, 16, 1, 1);
  dynamixelSetRegister(servo_b, 16, 1, 1);
  for (i = 0; i < 10; i++) {
    dynamixelStartSynchMove();
    printf("Moving 1 to 1023 at 100\n");
    printf("Moving 2 to 10 at 1000\n");
    dynamixelAddSynchMove(servo_a, 1023, 200);
    dynamixelAddSynchMove(servo_b, 10, 1000);
    dynamixelExecuteSynchMove();
    jet_sleep(4000);
    dynamixelStartSynchMove();
    printf("Moving 1 to 10 at 100\n");
    printf("Moving 2 to 1023 at 1000\n");
    dynamixelAddSynchMove(servo_a, 10, 1000);
    dynamixelAddSynchMove(servo_b, 1023, 200);
    dynamixelExecuteSynchMove();
    jet_sleep(4000);
  }
  closeJetduino();
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
movl   $0x2,-0x14(%rbp)
movl   $0x4,-0x18(%rbp)
mov    $0x0,%al
call   1060 <openJetduino@plt>
cmp    $0xffffffff,%eax
jne    11d5 <main+0x45>
mov    $0x1,%edi
call   10a0 <exit@plt>
lea    0xe24(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%edi
mov    $0x10,%esi
mov    $0x1,%ecx
mov    %ecx,%edx
call   1070 <dynamixelSetRegister@plt>
mov    -0x14(%rbp),%edi
mov    $0x10,%esi
mov    $0x1,%ecx
mov    %ecx,%edx
call   1070 <dynamixelSetRegister@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    12d0 <main+0x140>
mov    $0x0,%al
call   1030 <dynamixelStartSynchMove@plt>
lea    0xdfa(%rip),%rdi
call   1050 <printf@plt>
lea    0xe07(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%edi
mov    $0x3ff,%esi
mov    $0xc8,%edx
call   1040 <dynamixelAddSynchMove@plt>
mov    -0x14(%rbp),%edi
mov    $0xa,%esi
mov    $0x3e8,%edx
call   1040 <dynamixelAddSynchMove@plt>
mov    $0x0,%al
call   1080 <dynamixelExecuteSynchMove@plt>
mov    $0xfa0,%edi
call   10b0 <jet_sleep@plt>
mov    $0x0,%al
call   1030 <dynamixelStartSynchMove@plt>
lea    0xdd7(%rip),%rdi
call   1050 <printf@plt>
lea    0xde2(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%edi
mov    $0xa,%esi
mov    $0x3e8,%edx
call   1040 <dynamixelAddSynchMove@plt>
mov    -0x14(%rbp),%edi
mov    $0x3ff,%esi
mov    $0xc8,%edx
call   1040 <dynamixelAddSynchMove@plt>
mov    $0x0,%al
call   1080 <dynamixelExecuteSynchMove@plt>
mov    $0xfa0,%edi
call   10b0 <jet_sleep@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1210 <main+0x80>
mov    $0x0,%al
call   1090 <closeJetduino@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %eax,%eax
call   1060 <openJetduino@plt>
cmp    $0xffffffff,%eax
je     12ce <main+0x13e>
lea    0xe51(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
mov    $0x10,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
call   1070 <dynamixelSetRegister@plt>
mov    $0x2,%edi
mov    $0x10,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
call   1070 <dynamixelSetRegister@plt>
mov    $0xa,%ebp
lea    0xe2f(%rip),%r14
lea    0xe40(%rip),%r15
lea    0xe50(%rip),%r12
lea    0xe5f(%rip),%rbx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <dynamixelStartSynchMove@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
mov    $0x3ff,%esi
mov    $0xc8,%edx
call   1050 <dynamixelAddSynchMove@plt>
mov    $0x2,%edi
mov    $0xa,%esi
mov    $0x3e8,%edx
call   1050 <dynamixelAddSynchMove@plt>
xor    %eax,%eax
call   1080 <dynamixelExecuteSynchMove@plt>
mov    $0xfa0,%edi
call   10b0 <jet_sleep@plt>
xor    %eax,%eax
call   1030 <dynamixelStartSynchMove@plt>
mov    %r12,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
mov    $0xa,%esi
mov    $0x3e8,%edx
call   1050 <dynamixelAddSynchMove@plt>
mov    $0x2,%edi
mov    $0x3ff,%esi
mov    $0xc8,%edx
call   1050 <dynamixelAddSynchMove@plt>
xor    %eax,%eax
call   1080 <dynamixelExecuteSynchMove@plt>
mov    $0xfa0,%edi
call   10b0 <jet_sleep@plt>
add    $0xffffffff,%ebp
jne    1210 <main+0x80>
xor    %eax,%eax
call   1090 <closeJetduino@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"setting return status level to 1\0A\00"
@.str.1 = [25 x i8] c"Moving 1 to 1023 at 100\0A\00"
@.str.2 = [24 x i8] c"Moving 2 to 10 at 1000\0A\00"
@.str.3 = [23 x i8] c"Moving 1 to 10 at 100\0A\00"
@.str.4 = [26 x i8] c"Moving 2 to 1023 at 1000\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 1, i32* %4
store i32 2, i32* %5
store i32 4, i32* %6
%7 = call i32 (...) @openJetduino()
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @exit(i32 1)
unreachable
11: ; preds = %0
%12 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* %4
%14 = call i32 @dynamixelSetRegister(i32 %13, i32 16, i32 1, i32 1)
%15 = load i32, i32* %5
%16 = call i32 @dynamixelSetRegister(i32 %15, i32 16, i32 1, i32 1)
store i32 0, i32* %3
br label %17
17: ; preds = %39, %11
%18 = load i32, i32* %3
%19 = icmp slt i32 %18, 10
br i1 %19, label %20, label %42
20: ; preds = %17
%21 = call i32 (...) @dynamixelStartSynchMove()
%22 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%24 = load i32, i32* %4
%25 = call i32 @dynamixelAddSynchMove(i32 %24, i32 1023, i32 200)
%26 = load i32, i32* %5
%27 = call i32 @dynamixelAddSynchMove(i32 %26, i32 10, i32 1000)
%28 = call i32 (...) @dynamixelExecuteSynchMove()
%29 = call i32 @jet_sleep(i32 4000)
%30 = call i32 (...) @dynamixelStartSynchMove()
%31 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%32 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
%33 = load i32, i32* %4
%34 = call i32 @dynamixelAddSynchMove(i32 %33, i32 10, i32 1000)
%35 = load i32, i32* %5
%36 = call i32 @dynamixelAddSynchMove(i32 %35, i32 1023, i32 200)
%37 = call i32 (...) @dynamixelExecuteSynchMove()
%38 = call i32 @jet_sleep(i32 4000)
br label %39
39: ; preds = %20
%40 = load i32, i32* %3
%41 = add nsw i32 %40, 1
store i32 %41, i32* %3
br label %17
42: ; preds = %17
%43 = call i32 (...) @closeJetduino()
ret i32 1
}

LLVM IR (-O2):
@str = [33 x i8] c"setting return status level to 1\00"
@str.5 = [24 x i8] c"Moving 1 to 1023 at 100\00"
@str.6 = [23 x i8] c"Moving 2 to 10 at 1000\00"
@str.7 = [22 x i8] c"Moving 1 to 10 at 100\00"
@str.8 = [25 x i8] c"Moving 2 to 1023 at 1000\00"
define i32 @main() {
%1 = tail call i32 (...) @openJetduino()
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @exit(i32 1)
unreachable
5: ; preds = %0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @dynamixelSetRegister(i32 1, i32 16, i32 1, i32 1)
%8 = tail call i32 @dynamixelSetRegister(i32 2, i32 16, i32 1, i32 1)
br label %9
9: ; preds = %5, %9
%10 = phi i32 [ 0, %5 ], [ %25, %9 ]
%11 = tail call i32 (...) @dynamixelStartSynchMove()
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.5, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.6, i64 0, i64 0))
%14 = tail call i32 @dynamixelAddSynchMove(i32 1, i32 1023, i32 200)
%15 = tail call i32 @dynamixelAddSynchMove(i32 2, i32 10, i32 1000)
%16 = tail call i32 (...) @dynamixelExecuteSynchMove()
%17 = tail call i32 @jet_sleep(i32 4000)
%18 = tail call i32 (...) @dynamixelStartSynchMove()
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.7, i64 0, i64 0))
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.8, i64 0, i64 0))
%21 = tail call i32 @dynamixelAddSynchMove(i32 1, i32 10, i32 1000)
%22 = tail call i32 @dynamixelAddSynchMove(i32 2, i32 1023, i32 200)
%23 = tail call i32 (...) @dynamixelExecuteSynchMove()
%24 = tail call i32 @jet_sleep(i32 4000)
%25 = add nuw nsw i32 %10, 1
%26 = icmp eq i32 %25, 10
br i1 %26, label %27, label %9
27: ; preds = %9
%28 = tail call i32 (...) @closeJetduino()
ret i32 1
}