#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 /*<<< orphan*/, char *);
int gpioGetMode(int);
int gpioRead(int);
int /*<<< orphan*/ gpioSetMode(int, int /*<<< orphan*/);
int /*<<< orphan*/ gpioSetPullUpDown(int, int);
int /*<<< orphan*/ gpioWrite(int, int);
int /*<<< orphan*/ printf(char *);
void t1() {
  int v;
  printf("Mode/PUD/read/write tests.\n");
  gpioSetMode(25, 0);
  v = gpioGetMode(25);
  CHECK(1, 1, v, 0, 0, "set mode, get mode");
  gpioSetPullUpDown(25, 2);
  v = gpioRead(25);
  CHECK(1, 2, v, 1, 0, "set pull up down, read");
  gpioSetPullUpDown(25, 1);
  v = gpioRead(25);
  CHECK(1, 3, v, 0, 0, "set pull up down, read");
  gpioWrite(25, 0);
  v = gpioGetMode(25);
  CHECK(1, 4, v, 1, 0, "write, get mode");
  v = gpioRead(25);
  CHECK(1, 5, v, 0, 0, "read");
  gpioWrite(25, 1);
  v = gpioRead(25);
  CHECK(1, 6, v, 1, 0, "write, read");
}


x86 assembly (clang, -O0):
<t1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe81(%rip),%rdi
call   1050 <printf@plt>
mov    $0x19,%edi
xor    %esi,%esi
call   1060 <gpioSetMode@plt>
mov    $0x19,%edi
call   1040 <gpioGetMode@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x1,%esi
xor    %r8d,%r8d
lea    0xe6d(%rip),%r9
mov    %esi,%edi
mov    %r8d,%ecx
call   1030 <CHECK@plt>
mov    $0x19,%edi
mov    $0x2,%esi
call   1070 <gpioSetPullUpDown@plt>
mov    $0x19,%edi
call   1080 <gpioRead@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x1,%ecx
mov    $0x2,%esi
xor    %r8d,%r8d
lea    0xe43(%rip),%r9
mov    %ecx,%edi
call   1030 <CHECK@plt>
mov    $0x19,%edi
mov    $0x1,%esi
call   1070 <gpioSetPullUpDown@plt>
mov    $0x19,%edi
call   1080 <gpioRead@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x1,%edi
mov    $0x3,%esi
xor    %r8d,%r8d
lea    0xe09(%rip),%r9
mov    %r8d,%ecx
call   1030 <CHECK@plt>
mov    $0x19,%edi
xor    %esi,%esi
call   1090 <gpioWrite@plt>
mov    $0x19,%edi
call   1040 <gpioGetMode@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x1,%ecx
mov    $0x4,%esi
xor    %r8d,%r8d
lea    0xde8(%rip),%r9
mov    %ecx,%edi
call   1030 <CHECK@plt>
mov    $0x19,%edi
call   1080 <gpioRead@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x1,%edi
mov    $0x5,%esi
xor    %r8d,%r8d
lea    0xdd4(%rip),%r9
mov    %r8d,%ecx
call   1030 <CHECK@plt>
mov    $0x19,%edi
mov    $0x1,%esi
call   1090 <gpioWrite@plt>
mov    $0x19,%edi
call   1080 <gpioRead@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x1,%ecx
mov    $0x6,%esi
xor    %r8d,%r8d
lea    0xd92(%rip),%r9
mov    %ecx,%edi
call   1030 <CHECK@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t1>:
push   %rbx
lea    0xece(%rip),%rdi
call   1040 <puts@plt>
mov    $0x19,%edi
xor    %esi,%esi
call   1060 <gpioSetMode@plt>
mov    $0x19,%edi
call   1050 <gpioGetMode@plt>
lea    0xe66(%rip),%r9
mov    $0x1,%edi
mov    $0x1,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <CHECK@plt>
mov    $0x19,%edi
mov    $0x2,%esi
call   1070 <gpioSetPullUpDown@plt>
mov    $0x19,%edi
call   1080 <gpioRead@plt>
lea    0xe43(%rip),%rbx
mov    $0x1,%edi
mov    $0x2,%esi
mov    %eax,%edx
mov    $0x1,%ecx
xor    %r8d,%r8d
mov    %rbx,%r9
call   1030 <CHECK@plt>
mov    $0x19,%edi
mov    $0x1,%esi
call   1070 <gpioSetPullUpDown@plt>
mov    $0x19,%edi
call   1080 <gpioRead@plt>
mov    $0x1,%edi
mov    $0x3,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %rbx,%r9
call   1030 <CHECK@plt>
mov    $0x19,%edi
xor    %esi,%esi
call   1090 <gpioWrite@plt>
mov    $0x19,%edi
call   1050 <gpioGetMode@plt>
lea    0xdef(%rip),%r9
mov    $0x1,%edi
mov    $0x4,%esi
mov    %eax,%edx
mov    $0x1,%ecx
xor    %r8d,%r8d
call   1030 <CHECK@plt>
mov    $0x19,%edi
call   1080 <gpioRead@plt>
lea    0xddc(%rip),%r9
mov    $0x1,%edi
mov    $0x5,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <CHECK@plt>
mov    $0x19,%edi
mov    $0x1,%esi
call   1090 <gpioWrite@plt>
mov    $0x19,%edi
call   1080 <gpioRead@plt>
lea    0xd9f(%rip),%r9
mov    $0x1,%edi
mov    $0x6,%esi
mov    %eax,%edx
mov    $0x1,%ecx
xor    %r8d,%r8d
pop    %rbx
jmp    1030 <CHECK@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"
define void @t1() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @gpioSetMode(i32 25, i32 0)
%4 = call i32 @gpioGetMode(i32 25)
store i32 %4, i32* %1
%5 = load i32, i32* %1
%6 = call i32 @CHECK(i32 1, i32 1, i32 %5, i32 0, i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @gpioSetPullUpDown(i32 25, i32 2)
%8 = call i32 @gpioRead(i32 25)
store i32 %8, i32* %1
%9 = load i32, i32* %1
%10 = call i32 @CHECK(i32 1, i32 2, i32 %9, i32 1, i32 0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @gpioSetPullUpDown(i32 25, i32 1)
%12 = call i32 @gpioRead(i32 25)
store i32 %12, i32* %1
%13 = load i32, i32* %1
%14 = call i32 @CHECK(i32 1, i32 3, i32 %13, i32 0, i32 0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @gpioWrite(i32 25, i32 0)
%16 = call i32 @gpioGetMode(i32 25)
store i32 %16, i32* %1
%17 = load i32, i32* %1
%18 = call i32 @CHECK(i32 1, i32 4, i32 %17, i32 1, i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%19 = call i32 @gpioRead(i32 25)
store i32 %19, i32* %1
%20 = load i32, i32* %1
%21 = call i32 @CHECK(i32 1, i32 5, i32 %20, i32 0, i32 0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%22 = call i32 @gpioWrite(i32 25, i32 1)
%23 = call i32 @gpioRead(i32 25)
store i32 %23, i32* %1
%24 = load i32, i32* %1
%25 = call i32 @CHECK(i32 1, i32 6, i32 %24, i32 1, i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
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 = [27 x i8] c"Mode/PUD/read/write tests.\00"
define void @t1() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @gpioSetMode(i32 25, i32 0)
%3 = tail call i32 @gpioGetMode(i32 25)
%4 = tail call i32 @CHECK(i32 1, i32 1, i32 %3, i32 0, i32 0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @gpioSetPullUpDown(i32 25, i32 2)
%6 = tail call i32 @gpioRead(i32 25)
%7 = tail call i32 @CHECK(i32 1, i32 2, i32 %6, i32 1, i32 0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 @gpioSetPullUpDown(i32 25, i32 1)
%9 = tail call i32 @gpioRead(i32 25)
%10 = tail call i32 @CHECK(i32 1, i32 3, i32 %9, i32 0, i32 0, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%11 = tail call i32 @gpioWrite(i32 25, i32 0)
%12 = tail call i32 @gpioGetMode(i32 25)
%13 = tail call i32 @CHECK(i32 1, i32 4, i32 %12, i32 1, i32 0, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%14 = tail call i32 @gpioRead(i32 25)
%15 = tail call i32 @CHECK(i32 1, i32 5, i32 %14, i32 0, i32 0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%16 = tail call i32 @gpioWrite(i32 25, i32 1)
%17 = tail call i32 @gpioRead(i32 25)
%18 = tail call i32 @CHECK(i32 1, i32 6, i32 %17, i32 1, i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
ret void
}