#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 gpioRead(int);
int gpioRead_Bits_0_31();
int gpioRead_Bits_32_53();
int /*<<< orphan*/ gpioWrite(int, int);
int /*<<< orphan*/ gpioWrite_Bits_0_31_Clear(int);
int /*<<< orphan*/ gpioWrite_Bits_0_31_Set(int);
int gpioWrite_Bits_32_53_Clear(int /*<<< orphan*/);
int gpioWrite_Bits_32_53_Set(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void t8() {
  int v;
  printf("Bank read/write tests.\n");
  gpioWrite(25, 0);
  v = gpioRead_Bits_0_31() & (1 << 25);
  CHECK(8, 1, v, 0, 0, "read bank 1");
  gpioWrite(25, 1);
  v = gpioRead_Bits_0_31() & (1 << 25);
  CHECK(8, 2, v, (1 << 25), 0, "read bank 1");
  gpioWrite_Bits_0_31_Clear(1 << 25);
  v = gpioRead(25);
  CHECK(8, 3, v, 0, 0, "clear bank 1");
  gpioWrite_Bits_0_31_Set(1 << 25);
  v = gpioRead(25);
  CHECK(8, 4, v, 1, 0, "set bank 1");
  v = gpioRead_Bits_32_53();
  if (v)
    v = 0;
  else
    v = 1;
  CHECK(8, 5, v, 0, 0, "read bank 2");
  v = gpioWrite_Bits_32_53_Clear(0);
  CHECK(8, 6, v, 0, 0, "clear bank 2");
  CHECK(8, 7, 0, 0, 0, "NOT APPLICABLE");
  v = gpioWrite_Bits_32_53_Set(0);
  CHECK(8, 8, v, 0, 0, "set bank 2");
  CHECK(8, 9, 0, 0, 0, "NOT APPLICABLE");
}


x86 assembly (clang, -O0):
<t8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xe51(%rip),%rdi
call   1070 <printf@plt>
mov    $0x19,%edi
xor    %esi,%esi
call   10c0 <gpioWrite@plt>
mov    $0x0,%al
call   1060 <gpioRead_Bits_0_31@plt>
and    $0x2000000,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x8,%edi
mov    $0x1,%esi
xor    %r8d,%r8d
lea    0xe32(%rip),%r9
mov    %r8d,%ecx
call   1030 <CHECK@plt>
mov    $0x19,%edi
mov    $0x1,%esi
call   10c0 <gpioWrite@plt>
mov    $0x0,%al
call   1060 <gpioRead_Bits_0_31@plt>
and    $0x2000000,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x8,%edi
mov    $0x2,%esi
mov    $0x2000000,%ecx
xor    %r8d,%r8d
lea    0xdf0(%rip),%r9
call   1030 <CHECK@plt>
mov    $0x2000000,%edi
call   1040 <gpioWrite_Bits_0_31_Clear@plt>
mov    $0x19,%edi
call   10b0 <gpioRead@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x8,%edi
mov    $0x3,%esi
xor    %r8d,%r8d
lea    0xdc9(%rip),%r9
mov    %r8d,%ecx
call   1030 <CHECK@plt>
mov    $0x2000000,%edi
call   10a0 <gpioWrite_Bits_0_31_Set@plt>
mov    $0x19,%edi
call   10b0 <gpioRead@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x8,%edi
mov    $0x4,%esi
mov    $0x1,%ecx
xor    %r8d,%r8d
lea    0xd9b(%rip),%r9
call   1030 <CHECK@plt>
mov    $0x0,%al
call   1080 <gpioRead_Bits_32_53@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     12bb <t8+0x11b>
movl   $0x0,-0x4(%rbp)
jmp    12c2 <t8+0x122>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x8,%edi
mov    $0x5,%esi
xor    %r8d,%r8d
lea    0xd63(%rip),%r9
mov    %r8d,%ecx
call   1030 <CHECK@plt>
xor    %edi,%edi
call   1090 <gpioWrite_Bits_32_53_Clear@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x8,%edi
mov    $0x6,%esi
xor    %r8d,%r8d
lea    0xd46(%rip),%r9
mov    %r8d,%ecx
call   1030 <CHECK@plt>
mov    $0x8,%edi
mov    $0x7,%esi
xor    %r8d,%r8d
lea    0xd37(%rip),%r9
mov    %r8d,%edx
mov    %r8d,%ecx
call   1030 <CHECK@plt>
xor    %edi,%edi
call   1050 <gpioWrite_Bits_32_53_Set@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edx
mov    $0x8,%esi
xor    %r8d,%r8d
lea    0xd1f(%rip),%r9
mov    %esi,%edi
mov    %r8d,%ecx
call   1030 <CHECK@plt>
mov    $0x8,%edi
mov    $0x9,%esi
xor    %r8d,%r8d
lea    0xcf2(%rip),%r9
mov    %r8d,%edx
mov    %r8d,%ecx
call   1030 <CHECK@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t8>:
push   %rbx
lea    0xeaf(%rip),%rdi
call   1040 <puts@plt>
mov    $0x19,%edi
xor    %esi,%esi
call   10c0 <gpioWrite@plt>
xor    %eax,%eax
call   1070 <gpioRead_Bits_0_31@plt>
and    $0x2000000,%eax
lea    0xe34(%rip),%rbx
mov    $0x8,%edi
mov    $0x1,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %rbx,%r9
call   1030 <CHECK@plt>
mov    $0x19,%edi
mov    $0x1,%esi
call   10c0 <gpioWrite@plt>
xor    %eax,%eax
call   1070 <gpioRead_Bits_0_31@plt>
and    $0x2000000,%eax
mov    $0x8,%edi
mov    $0x2,%esi
mov    %eax,%edx
mov    $0x2000000,%ecx
xor    %r8d,%r8d
mov    %rbx,%r9
call   1030 <CHECK@plt>
mov    $0x2000000,%edi
call   1050 <gpioWrite_Bits_0_31_Clear@plt>
mov    $0x19,%edi
call   10b0 <gpioRead@plt>
lea    0xdd5(%rip),%r9
mov    $0x8,%edi
mov    $0x3,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <CHECK@plt>
mov    $0x2000000,%edi
call   10a0 <gpioWrite_Bits_0_31_Set@plt>
mov    $0x19,%edi
call   10b0 <gpioRead@plt>
lea    0xdb1(%rip),%r9
mov    $0x8,%edi
mov    $0x4,%esi
mov    %eax,%edx
mov    $0x1,%ecx
xor    %r8d,%r8d
call   1030 <CHECK@plt>
xor    %eax,%eax
call   1080 <gpioRead_Bits_32_53@plt>
xor    %edx,%edx
test   %eax,%eax
sete   %dl
lea    0xd8e(%rip),%r9
mov    $0x8,%edi
mov    $0x5,%esi
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <CHECK@plt>
xor    %edi,%edi
call   1090 <gpioWrite_Bits_32_53_Clear@plt>
lea    0xd78(%rip),%r9
mov    $0x8,%edi
mov    $0x6,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <CHECK@plt>
lea    0xd68(%rip),%rbx
mov    $0x8,%edi
mov    $0x7,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %rbx,%r9
call   1030 <CHECK@plt>
xor    %edi,%edi
call   1060 <gpioWrite_Bits_32_53_Set@plt>
lea    0xd50(%rip),%r9
mov    $0x8,%edi
mov    $0x8,%esi
mov    %eax,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1030 <CHECK@plt>
mov    $0x8,%edi
mov    $0x9,%esi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
mov    %rbx,%r9
pop    %rbx
jmp    1030 <CHECK@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"Bank read/write tests.\0A\00"
@.str.1 = [12 x i8] c"read bank 1\00"
@.str.2 = [13 x i8] c"clear bank 1\00"
@.str.3 = [11 x i8] c"set bank 1\00"
@.str.4 = [12 x i8] c"read bank 2\00"
@.str.5 = [13 x i8] c"clear bank 2\00"
@.str.6 = [15 x i8] c"NOT APPLICABLE\00"
@.str.7 = [11 x i8] c"set bank 2\00"
define void @t8() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @gpioWrite(i32 25, i32 0)
%4 = call i32 (...) @gpioRead_Bits_0_31()
%5 = and i32 %4, 33554432
store i32 %5, i32* %1
%6 = load i32, i32* %1
%7 = call i32 @CHECK(i32 8, i32 1, i32 %6, i32 0, i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @gpioWrite(i32 25, i32 1)
%9 = call i32 (...) @gpioRead_Bits_0_31()
%10 = and i32 %9, 33554432
store i32 %10, i32* %1
%11 = load i32, i32* %1
%12 = call i32 @CHECK(i32 8, i32 2, i32 %11, i32 33554432, i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 @gpioWrite_Bits_0_31_Clear(i32 33554432)
%14 = call i32 @gpioRead(i32 25)
store i32 %14, i32* %1
%15 = load i32, i32* %1
%16 = call i32 @CHECK(i32 8, i32 3, i32 %15, i32 0, i32 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 @gpioWrite_Bits_0_31_Set(i32 33554432)
%18 = call i32 @gpioRead(i32 25)
store i32 %18, i32* %1
%19 = load i32, i32* %1
%20 = call i32 @CHECK(i32 8, i32 4, i32 %19, i32 1, i32 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 (...) @gpioRead_Bits_32_53()
store i32 %21, i32* %1
%22 = load i32, i32* %1
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %25
24: ; preds = %0
store i32 0, i32* %1
br label %26
25: ; preds = %0
store i32 1, i32* %1
br label %26
26: ; preds = %25, %24
%27 = load i32, i32* %1
%28 = call i32 @CHECK(i32 8, i32 5, i32 %27, i32 0, i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%29 = call i32 @gpioWrite_Bits_32_53_Clear(i32 0)
store i32 %29, i32* %1
%30 = load i32, i32* %1
%31 = call i32 @CHECK(i32 8, i32 6, i32 %30, i32 0, i32 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%32 = call i32 @CHECK(i32 8, i32 7, i32 0, i32 0, i32 0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
%33 = call i32 @gpioWrite_Bits_32_53_Set(i32 0)
store i32 %33, i32* %1
%34 = load i32, i32* %1
%35 = call i32 @CHECK(i32 8, i32 8, i32 %34, i32 0, i32 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%36 = call i32 @CHECK(i32 8, i32 9, i32 0, i32 0, i32 0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"read bank 1\00"
@.str.2 = [13 x i8] c"clear bank 1\00"
@.str.3 = [11 x i8] c"set bank 1\00"
@.str.4 = [12 x i8] c"read bank 2\00"
@.str.5 = [13 x i8] c"clear bank 2\00"
@.str.6 = [15 x i8] c"NOT APPLICABLE\00"
@.str.7 = [11 x i8] c"set bank 2\00"
@str = [23 x i8] c"Bank read/write tests.\00"
define void @t8() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @gpioWrite(i32 25, i32 0)
%3 = tail call i32 (...) @gpioRead_Bits_0_31()
%4 = and i32 %3, 33554432
%5 = tail call i32 @CHECK(i32 8, i32 1, i32 %4, i32 0, i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @gpioWrite(i32 25, i32 1)
%7 = tail call i32 (...) @gpioRead_Bits_0_31()
%8 = and i32 %7, 33554432
%9 = tail call i32 @CHECK(i32 8, i32 2, i32 %8, i32 33554432, i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%10 = tail call i32 @gpioWrite_Bits_0_31_Clear(i32 33554432)
%11 = tail call i32 @gpioRead(i32 25)
%12 = tail call i32 @CHECK(i32 8, i32 3, i32 %11, i32 0, i32 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%13 = tail call i32 @gpioWrite_Bits_0_31_Set(i32 33554432)
%14 = tail call i32 @gpioRead(i32 25)
%15 = tail call i32 @CHECK(i32 8, i32 4, i32 %14, i32 1, i32 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%16 = tail call i32 (...) @gpioRead_Bits_32_53()
%17 = icmp eq i32 %16, 0
%18 = zext i1 %17 to i32
%19 = tail call i32 @CHECK(i32 8, i32 5, i32 %18, i32 0, i32 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%20 = tail call i32 @gpioWrite_Bits_32_53_Clear(i32 0)
%21 = tail call i32 @CHECK(i32 8, i32 6, i32 %20, i32 0, i32 0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%22 = tail call i32 @CHECK(i32 8, i32 7, i32 0, i32 0, i32 0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
%23 = tail call i32 @gpioWrite_Bits_32_53_Set(i32 0)
%24 = tail call i32 @CHECK(i32 8, i32 8, i32 %23, i32 0, i32 0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%25 = tail call i32 @CHECK(i32 8, i32 9, i32 0, i32 0, i32 0, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
ret void
}