#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 dynamixelGetRegister(int, int, int);
int /*<<< orphan*/ dynamixelSetRegister(int, int, int, int);
int /*<<< orphan*/ exit(int);
int openJetduino();
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int dval;
  int i = 0, servo = 1;
  int pin = 4;
  if (openJetduino() == -1)
    exit(1);
  printf("setting return status level to 1\n");
  dynamixelSetRegister(servo, 16, 1, 1);
  int ret_level = dynamixelGetRegister(servo, 16, 1);
  printf("return status level: %d\n", ret_level);
  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   $0x4,-0x14(%rbp)
mov    $0x0,%al
call   1040 <openJetduino@plt>
cmp    $0xffffffff,%eax
jne    119e <main+0x3e>
mov    $0x1,%edi
call   1080 <exit@plt>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%edi
mov    $0x10,%esi
mov    $0x1,%ecx
mov    %ecx,%edx
call   1050 <dynamixelSetRegister@plt>
mov    -0x10(%rbp),%edi
mov    $0x10,%esi
mov    $0x1,%edx
call   1070 <dynamixelGetRegister@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1060 <closeJetduino@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <openJetduino@plt>
cmp    $0xffffffff,%eax
je     11d4 <main+0x64>
lea    0xe95(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
mov    $0x10,%esi
mov    $0x1,%edx
mov    $0x1,%ecx
call   1060 <dynamixelSetRegister@plt>
mov    $0x1,%edi
mov    $0x10,%esi
mov    $0x1,%edx
call   1080 <dynamixelGetRegister@plt>
lea    0xe43(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1070 <closeJetduino@plt>
mov    $0x1,%eax
pop    %rcx
ret
mov    $0x1,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@.str = [34 x i8] c"setting return status level to 1\0A\00"
@.str.1 = [25 x i8] c"return status level: %d\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 4, i32* %5
%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 (i8*, ...) @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* %4
%16 = call i32 @dynamixelGetRegister(i32 %15, i32 16, i32 1)
store i32 %16, i32* %6
%17 = load i32, i32* %6
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = call i32 (...) @closeJetduino()
ret i32 1
}

LLVM IR (-O2):
@.str.1 = [25 x i8] c"return status level: %d\0A\00"
@str = [33 x i8] c"setting return status level to 1\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 @dynamixelGetRegister(i32 1, i32 16, i32 1)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = tail call i32 (...) @closeJetduino()
ret i32 1
}