#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*/ GPIO_off(int);
int /*<<< orphan*/ GPIO_on(int);
int /*<<< orphan*/ all_output();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ setup_io();
int main() {
  int placeholder;
  int i;
  setup_io();
  all_output();
  for (i = 1; i <= 30; i++) {
    if (i == 6 || i == 7 || i == 8) {
      printf("Skipping GPIO %d\n", i);
    } else {
      GPIO_on(i);
      printf("GPIO %d is on!\n", i);
      scanf("%d", &placeholder);
      GPIO_off(i);
    }
    printf("%d\n", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1070 <setup_io@plt>
mov    $0x0,%al
call   1080 <all_output@plt>
movl   $0x1,-0xc(%rbp)
cmpl   $0x1e,-0xc(%rbp)
jg     120c <main+0xac>
cmpl   $0x6,-0xc(%rbp)
je     11ac <main+0x4c>
cmpl   $0x7,-0xc(%rbp)
je     11ac <main+0x4c>
cmpl   $0x8,-0xc(%rbp)
jne    11c0 <main+0x60>
mov    -0xc(%rbp),%esi
lea    0xe4a(%rip),%rdi
call   1030 <printf@plt>
jmp    11ef <main+0x8f>
mov    -0xc(%rbp),%edi
call   1040 <GPIO_on@plt>
mov    -0xc(%rbp),%esi
lea    0xe40(%rip),%rdi
call   1030 <printf@plt>
lea    0xe44(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%edi
call   1060 <GPIO_off@plt>
mov    -0xc(%rbp),%esi
lea    0xe15(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1184 <main+0x24>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %eax,%eax
call   1070 <setup_io@plt>
xor    %eax,%eax
call   1080 <all_output@plt>
mov    $0x1,%ebx
lea    0xe7b(%rip),%r14
lea    0xe82(%rip),%r15
lea    0xe7f(%rip),%r12
lea    0xe88(%rip),%r13
lea    0x4(%rsp),%rbp
jmp    11cc <main+0x6c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x1f,%ebx
je     1202 <main+0xa2>
cmp    $0x8,%ebx
je     11b0 <main+0x50>
mov    %ebx,%eax
and    $0x7ffffffe,%eax
cmp    $0x6,%eax
je     11b0 <main+0x50>
mov    %ebx,%edi
call   1040 <GPIO_on@plt>
mov    %r12,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
mov    %ebx,%edi
call   1060 <GPIO_off@plt>
jmp    11ba <main+0x5a>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Skipping GPIO %d\0A\00"
@.str.1 = [16 x i8] c"GPIO %d is on!\0A\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @setup_io()
%5 = call i32 (...) @all_output()
store i32 1, i32* %3
br label %6
6: ; preds = %32, %0
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 30
br i1 %8, label %9, label %35
9: ; preds = %6
%10 = load i32, i32* %3
%11 = icmp eq i32 %10, 6
br i1 %11, label %18, label %12
12: ; preds = %9
%13 = load i32, i32* %3
%14 = icmp eq i32 %13, 7
br i1 %14, label %18, label %15
15: ; preds = %12
%16 = load i32, i32* %3
%17 = icmp eq i32 %16, 8
br i1 %17, label %18, label %21
18: ; preds = %15, %12, %9
%19 = load i32, i32* %3
%20 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %19)
br label %29
21: ; preds = %15
%22 = load i32, i32* %3
%23 = call i32 @GPIO_on(i32 %22)
%24 = load i32, i32* %3
%25 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%27 = load i32, i32* %3
%28 = call i32 @GPIO_off(i32 %27)
br label %29
29: ; preds = %21, %18
%30 = load i32, i32* %3
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %29
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %6
35: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"Skipping GPIO %d\0A\00"
@.str.1 = [16 x i8] c"GPIO %d is on!\0A\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (...) @setup_io()
%4 = tail call i32 (...) @all_output()
br label %5
5: ; preds = %0, %18
%6 = phi i32 [ 1, %0 ], [ %20, %18 ]
%7 = and i32 %6, 2147483646
%8 = icmp eq i32 %7, 6
%9 = icmp eq i32 %6, 8
%10 = or i1 %9, %8
br i1 %10, label %11, label %13
11: ; preds = %5
%12 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %18
13: ; preds = %5
%14 = call i32 @GPIO_on(i32 %6)
%15 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%17 = call i32 @GPIO_off(i32 %6)
br label %18
18: ; preds = %13, %11
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %6)
%20 = add nuw nsw i32 %6, 1
%21 = icmp eq i32 %20, 31
br i1 %21, label %22, label %5
22: ; preds = %18
ret i32 0
}