#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*/ _IONBF;
int /*<<< orphan*/ enable_allcall_address(int);
int /*<<< orphan*/ printf(char *);
int servopi_init(int, int);
int /*<<< orphan*/ set_allcall_address(int, int);
int /*<<< orphan*/ setvbuf(int /*<<< orphan*/, int /*<<< orphan*/ *,
                           int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  setvbuf(stdout, NULL, _IONBF, 0);
  int a;
  a = servopi_init(0x40, 1);
  if (a != 0) {
    if (a == 1) {
      printf("Error enabling GPIO Pin");
    }
    if (a == 2) {
      printf("Error setting GPIO Pin direction");
    }
    return (0);
  }
  set_allcall_address(0x60, 0x40);
  enable_allcall_address(0x40);
  (void)argc;
  (void)argv;
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
mov    0x2e72(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
xor    %ecx,%ecx
call   1060 <setvbuf@plt>
mov    $0x40,%edi
mov    $0x1,%esi
call   1070 <servopi_init@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11d7 <main+0x87>
cmpl   $0x1,-0x14(%rbp)
jne    11b5 <main+0x65>
lea    0xe50(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x2,-0x14(%rbp)
jne    11cb <main+0x7b>
lea    0xe52(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11f7 <main+0xa7>
mov    $0x60,%edi
mov    $0x40,%esi
call   1050 <set_allcall_address@plt>
mov    $0x40,%edi
call   1030 <enable_allcall_address@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
mov    0x2e87(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
xor    %ecx,%ecx
call   1060 <setvbuf@plt>
mov    $0x40,%edi
mov    $0x1,%esi
call   1070 <servopi_init@plt>
test   %eax,%eax
je     1192 <main+0x42>
cmp    $0x2,%eax
je     11ad <main+0x5d>
cmp    $0x1,%eax
jne    11b9 <main+0x69>
lea    0xe70(%rip),%rdi
jmp    11b4 <main+0x64>
mov    $0x60,%edi
mov    $0x40,%esi
call   1050 <set_allcall_address@plt>
mov    $0x40,%edi
call   1030 <enable_allcall_address@plt>
jmp    11b9 <main+0x69>
lea    0xe64(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdout = global i32 0
@_IONBF = global i32 0
@.str = [24 x i8] c"Error enabling GPIO Pin\00"
@.str.1 = [33 x i8] c"Error setting GPIO Pin direction\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* @stdout
%8 = load i32, i32* @_IONBF
%9 = call i32 @setvbuf(i32 %7, i32* null, i32 %8, i32 0)
%10 = call i32 @servopi_init(i32 64, i32 1)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %24
13: ; preds = %2
%14 = load i32, i32* %6
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %13
%19 = load i32, i32* %6
%20 = icmp eq i32 %19, 2
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
br label %23
23: ; preds = %21, %18
store i32 0, i32* %3
br label %29
24: ; preds = %2
%25 = call i32 @set_allcall_address(i32 96, i32 64)
%26 = call i32 @enable_allcall_address(i32 64)
%27 = load i32, i32* %4
%28 = load i8**, i8*** %5
store i32 0, i32* %3
br label %29
29: ; preds = %24, %23
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
@stdout = global i32 0
@_IONBF = global i32 0
@.str = [24 x i8] c"Error enabling GPIO Pin\00"
@.str.1 = [33 x i8] c"Error setting GPIO Pin direction\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @stdout
%4 = load i32, i32* @_IONBF
%5 = tail call i32 @setvbuf(i32 %3, i32* null, i32 %4, i32 0)
%6 = tail call i32 @servopi_init(i32 64, i32 1)
switch i32 %6, label %14 [
i32 0, label %11
i32 1, label %7
i32 2, label %9
]
7: ; preds = %2
%8 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %14
9: ; preds = %2
%10 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
br label %14
11: ; preds = %2
%12 = tail call i32 @set_allcall_address(i32 96, i32 64)
%13 = tail call i32 @enable_allcall_address(i32 64)
br label %14
14: ; preds = %7, %9, %2, %11
ret i32 0
}