#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*/ CHECK(int, int, int, int, int, char *);
int get_mode(int, int);
int gpio_read(int, int);
int /*<<< orphan*/ gpio_write(int, int, int);
int pigpio_start(char *, char *);
int /*<<< orphan*/ pigpio_stop(int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ set_mode(int, int, int /*<<< orphan*/);
int /*<<< orphan*/ set_pull_up_down(int, int, int);
void t1(int pi) {
  int v;
  printf("Mode/PUD/read/write tests.\n");
  set_mode(pi, 25, 0);
  v = get_mode(pi, 25);
  CHECK(1, 1, v, 0, 0, "set mode, get mode");
  set_pull_up_down(pi, 25, 2);
  v = gpio_read(pi, 25);
  CHECK(1, 2, v, 1, 0, "set pull up down, read");
  set_pull_up_down(pi, 25, 1);
  v = gpio_read(pi, 25);
  CHECK(1, 3, v, 0, 0, "set pull up down, read");
  gpio_write(pi, 25, 0);
  v = get_mode(pi, 25);
  CHECK(1, 4, v, 1, 0, "write, get mode");
  v = gpio_read(pi, 25);
  CHECK(1, 5, v, 0, 0, "read");
  gpio_write(pi, 25, 1);
  v = gpio_read(pi, 25);
  CHECK(1, 6, v, 1, 0, "write, read");
  v = pigpio_start("localhost", "8888");
  CHECK(1, 7, v, 31, 100, "pigpio_start with non-default arguments");
  pigpio_stop(v);
}


x86 assembly (clang, -O0):
<t1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xe5e(%rip),%rdi
call   1070 <printf@plt>
mov    -0x4(%rbp),%edi
mov    $0x19,%esi
xor    %edx,%edx
call   1060 <set_mode@plt>
mov    -0x4(%rbp),%edi
mov    $0x19,%esi
call   10b0 <get_mode@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
mov    $0x1,%esi
xor    %r8d,%r8d
lea    0xe44(%rip),%r9
mov    %esi,%edi
mov    %r8d,%ecx
call   1030 <CHECK@plt>
mov    -0x4(%rbp),%edi
mov    $0x19,%esi
mov    $0x2,%edx
call   1050 <set_pull_up_down@plt>
mov    -0x4(%rbp),%edi
mov    $0x19,%esi
call   10a0 <gpio_read@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
mov    $0x1,%ecx
mov    $0x2,%esi
xor    %r8d,%r8d
lea    0xe14(%rip),%r9
mov    %ecx,%edi
call   1030 <CHECK@plt>
mov    -0x4(%rbp),%edi
mov    $0x19,%esi
mov    $0x1,%edx
call   1050 <set_pull_up_down@plt>
mov    -0x4(%rbp),%edi
mov    $0x19,%esi
call   10a0 <gpio_read@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
mov    $0x1,%edi
mov    $0x3,%esi
xor    %r8d,%r8d
lea    0xdd4(%rip),%r9
mov    %r8d,%ecx
call   1030 <CHECK@plt>
mov    -0x4(%rbp),%edi
mov    $0x19,%esi
xor    %edx,%edx
call   1090 <gpio_write@plt>
mov    -0x4(%rbp),%edi
mov    $0x19,%esi
call   10b0 <get_mode@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
mov    $0x1,%ecx
mov    $0x4,%esi
xor    %r8d,%r8d
lea    0xdad(%rip),%r9
mov    %ecx,%edi
call   1030 <CHECK@plt>
mov    -0x4(%rbp),%edi
mov    $0x19,%esi
call   10a0 <gpio_read@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
mov    $0x1,%edi
mov    $0x5,%esi
xor    %r8d,%r8d
lea    0xd96(%rip),%r9
mov    %r8d,%ecx
call   1030 <CHECK@plt>
mov    -0x4(%rbp),%edi
mov    $0x19,%esi
mov    $0x1,%edx
call   1090 <gpio_write@plt>
mov    -0x4(%rbp),%edi
mov    $0x19,%esi
call   10a0 <gpio_read@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
mov    $0x1,%ecx
mov    $0x6,%esi
xor    %r8d,%r8d
lea    0xd4e(%rip),%r9
mov    %ecx,%edi
call   1030 <CHECK@plt>
lea    0xd4c(%rip),%rdi
lea    0xd4f(%rip),%rsi
call   1040 <pigpio_start@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edx
mov    $0x1,%edi
mov    $0x7,%esi
mov    $0x1f,%ecx
mov    $0x64,%r8d
lea    0xd2d(%rip),%r9
call   1030 <CHECK@plt>
mov    -0x8(%rbp),%edi
call   1080 <pigpio_stop@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t1>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0xee0(%rip),%rdi
call   1060 <puts@plt>
mov    %ebx,%edi
mov    $0x19,%esi
xor    %edx,%edx
call   1070 <set_mode@plt>
mov    %ebx,%edi
mov    $0x19,%esi
call   10b0 <get_mode@plt>
lea    0xe3d(%rip),%r9
mov    $0x1,%edi
mov    $0x1,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <CHECK@plt>
mov    %ebx,%edi
mov    $0x19,%esi
mov    $0x2,%edx
call   1050 <set_pull_up_down@plt>
mov    %ebx,%edi
mov    $0x19,%esi
call   10a0 <gpio_read@plt>
lea    0xe16(%rip),%r14
mov    $0x1,%edi
mov    $0x2,%esi
mov    %eax,%edx
mov    $0x1,%ecx
xor    %r8d,%r8d
mov    %r14,%r9
call   1030 <CHECK@plt>
mov    %ebx,%edi
mov    $0x19,%esi
mov    $0x1,%edx
call   1050 <set_pull_up_down@plt>
mov    %ebx,%edi
mov    $0x19,%esi
call   10a0 <gpio_read@plt>
mov    $0x1,%edi
mov    $0x3,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %r14,%r9
call   1030 <CHECK@plt>
mov    %ebx,%edi
mov    $0x19,%esi
xor    %edx,%edx
call   1090 <gpio_write@plt>
mov    %ebx,%edi
mov    $0x19,%esi
call   10b0 <get_mode@plt>
lea    0xdba(%rip),%r9
mov    $0x1,%edi
mov    $0x4,%esi
mov    %eax,%edx
mov    $0x1,%ecx
xor    %r8d,%r8d
call   1030 <CHECK@plt>
mov    %ebx,%edi
mov    $0x19,%esi
call   10a0 <gpio_read@plt>
lea    0xda5(%rip),%r9
mov    $0x1,%edi
mov    $0x5,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <CHECK@plt>
mov    %ebx,%edi
mov    $0x19,%esi
mov    $0x1,%edx
call   1090 <gpio_write@plt>
mov    %ebx,%edi
mov    $0x19,%esi
call   10a0 <gpio_read@plt>
lea    0xd64(%rip),%r9
mov    $0x1,%edi
mov    $0x6,%esi
mov    %eax,%edx
mov    $0x1,%ecx
xor    %r8d,%r8d
call   1030 <CHECK@plt>
lea    0xd50(%rip),%rdi
lea    0xd53(%rip),%rsi
call   1040 <pigpio_start@plt>
mov    %eax,%ebx
lea    0xd4a(%rip),%r9
mov    $0x1,%edi
mov    $0x7,%esi
mov    %eax,%edx
mov    $0x1f,%ecx
mov    $0x64,%r8d
call   1030 <CHECK@plt>
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1080 <pigpio_stop@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"Mode/PUD/read/write tests.\0A\00"
@.str.1 = [19 x i8] c"set mode, get mode\00"
@.str.2 = [23 x i8] c"set pull up down, read\00"
@.str.3 = [16 x i8] c"write, get mode\00"
@.str.4 = [5 x i8] c"read\00"
@.str.5 = [12 x i8] c"write, read\00"
@.str.6 = [10 x i8] c"localhost\00"
@.str.7 = [5 x i8] c"8888\00"
@.str.8 = [40 x i8] c"pigpio_start with non-default arguments\00"
define void @t1(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%5 = load i32, i32* %2
%6 = call i32 @set_mode(i32 %5, i32 25, i32 0)
%7 = load i32, i32* %2
%8 = call i32 @get_mode(i32 %7, i32 25)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = call i32 @CHECK(i32 1, i32 1, i32 %9, i32 0, i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%11 = load i32, i32* %2
%12 = call i32 @set_pull_up_down(i32 %11, i32 25, i32 2)
%13 = load i32, i32* %2
%14 = call i32 @gpio_read(i32 %13, i32 25)
store i32 %14, i32* %3
%15 = load i32, i32* %3
%16 = call i32 @CHECK(i32 1, i32 2, i32 %15, i32 1, i32 0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32, i32* %2
%18 = call i32 @set_pull_up_down(i32 %17, i32 25, i32 1)
%19 = load i32, i32* %2
%20 = call i32 @gpio_read(i32 %19, i32 25)
store i32 %20, i32* %3
%21 = load i32, i32* %3
%22 = call i32 @CHECK(i32 1, i32 3, i32 %21, i32 0, i32 0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%23 = load i32, i32* %2
%24 = call i32 @gpio_write(i32 %23, i32 25, i32 0)
%25 = load i32, i32* %2
%26 = call i32 @get_mode(i32 %25, i32 25)
store i32 %26, i32* %3
%27 = load i32, i32* %3
%28 = call i32 @CHECK(i32 1, i32 4, i32 %27, i32 1, i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%29 = load i32, i32* %2
%30 = call i32 @gpio_read(i32 %29, i32 25)
store i32 %30, i32* %3
%31 = load i32, i32* %3
%32 = call i32 @CHECK(i32 1, i32 5, i32 %31, i32 0, i32 0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%33 = load i32, i32* %2
%34 = call i32 @gpio_write(i32 %33, i32 25, i32 1)
%35 = load i32, i32* %2
%36 = call i32 @gpio_read(i32 %35, i32 25)
store i32 %36, i32* %3
%37 = load i32, i32* %3
%38 = call i32 @CHECK(i32 1, i32 6, i32 %37, i32 1, i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%39 = call i32 @pigpio_start(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
store i32 %39, i32* %3
%40 = load i32, i32* %3
%41 = call i32 @CHECK(i32 1, i32 7, i32 %40, i32 31, i32 100, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0))
%42 = load i32, i32* %3
%43 = call i32 @pigpio_stop(i32 %42)
ret void
}

LLVM IR (-O2):
@.str.1 = [19 x i8] c"set mode, get mode\00"
@.str.2 = [23 x i8] c"set pull up down, read\00"
@.str.3 = [16 x i8] c"write, get mode\00"
@.str.4 = [5 x i8] c"read\00"
@.str.5 = [12 x i8] c"write, read\00"
@.str.6 = [10 x i8] c"localhost\00"
@.str.7 = [5 x i8] c"8888\00"
@.str.8 = [40 x i8] c"pigpio_start with non-default arguments\00"
@str = [27 x i8] c"Mode/PUD/read/write tests.\00"
define void @t1(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @set_mode(i32 %0, i32 25, i32 0)
%4 = tail call i32 @get_mode(i32 %0, i32 25)
%5 = tail call i32 @CHECK(i32 1, i32 1, i32 %4, i32 0, i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @set_pull_up_down(i32 %0, i32 25, i32 2)
%7 = tail call i32 @gpio_read(i32 %0, i32 25)
%8 = tail call i32 @CHECK(i32 1, i32 2, i32 %7, i32 1, i32 0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%9 = tail call i32 @set_pull_up_down(i32 %0, i32 25, i32 1)
%10 = tail call i32 @gpio_read(i32 %0, i32 25)
%11 = tail call i32 @CHECK(i32 1, i32 3, i32 %10, i32 0, i32 0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%12 = tail call i32 @gpio_write(i32 %0, i32 25, i32 0)
%13 = tail call i32 @get_mode(i32 %0, i32 25)
%14 = tail call i32 @CHECK(i32 1, i32 4, i32 %13, i32 1, i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%15 = tail call i32 @gpio_read(i32 %0, i32 25)
%16 = tail call i32 @CHECK(i32 1, i32 5, i32 %15, i32 0, i32 0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%17 = tail call i32 @gpio_write(i32 %0, i32 25, i32 1)
%18 = tail call i32 @gpio_read(i32 %0, i32 25)
%19 = tail call i32 @CHECK(i32 1, i32 6, i32 %18, i32 1, i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%20 = tail call i32 @pigpio_start(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%21 = tail call i32 @CHECK(i32 1, i32 7, i32 %20, i32 31, i32 100, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0))
%22 = tail call i32 @pigpio_stop(i32 %20)
ret void
}