#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*/ set_out(int);
int /*<<< orphan*/ setup_io();
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ switch_gpio(int, int);
int main(int argc, char **argv) {
  int g, rep;
  setup_io();
  for (g = 7; g <= 11; g++) {
    set_out(g);
  }
  for (rep = 0; rep < 10; rep++) {
    for (g = 7; g <= 11; g++) {
      switch_gpio(1, g);
      sleep(1);
    }
    for (g = 7; g <= 11; g++) {
      switch_gpio(0, g);
      sleep(1);
    }
  }
  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    $0x0,%al
call   1060 <setup_io@plt>
movl   $0x7,-0x14(%rbp)
cmpl   $0xb,-0x14(%rbp)
jg     1184 <main+0x44>
mov    -0x14(%rbp),%edi
call   1030 <set_out@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1164 <main+0x24>
movl   $0x0,-0x18(%rbp)
cmpl   $0xa,-0x18(%rbp)
jge    1211 <main+0xd1>
movl   $0x7,-0x14(%rbp)
cmpl   $0xb,-0x14(%rbp)
jg     11cb <main+0x8b>
mov    -0x14(%rbp),%esi
mov    $0x1,%edi
call   1040 <switch_gpio@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    119c <main+0x5c>
movl   $0x7,-0x14(%rbp)
cmpl   $0xb,-0x14(%rbp)
jg     11fe <main+0xbe>
mov    -0x14(%rbp),%esi
xor    %edi,%edi
call   1040 <switch_gpio@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11d2 <main+0x92>
jmp    1203 <main+0xc3>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    118b <main+0x4b>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1060 <setup_io@plt>
mov    $0x7,%edi
call   1030 <set_out@plt>
mov    $0x8,%edi
call   1030 <set_out@plt>
mov    $0x9,%edi
call   1030 <set_out@plt>
mov    $0xa,%ebx
mov    $0xa,%edi
call   1030 <set_out@plt>
mov    $0xb,%edi
call   1030 <set_out@plt>
nop
mov    $0x1,%edi
mov    $0x7,%esi
call   1040 <switch_gpio@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    $0x1,%edi
mov    $0x8,%esi
call   1040 <switch_gpio@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    $0x1,%edi
mov    $0x9,%esi
call   1040 <switch_gpio@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    $0x1,%edi
mov    $0xa,%esi
call   1040 <switch_gpio@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
mov    $0x1,%edi
mov    $0xb,%esi
call   1040 <switch_gpio@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
xor    %edi,%edi
mov    $0x7,%esi
call   1040 <switch_gpio@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
xor    %edi,%edi
mov    $0x8,%esi
call   1040 <switch_gpio@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
xor    %edi,%edi
mov    $0x9,%esi
call   1040 <switch_gpio@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
xor    %edi,%edi
mov    $0xa,%esi
call   1040 <switch_gpio@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
xor    %edi,%edi
mov    $0xb,%esi
call   1040 <switch_gpio@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
add    $0xffffffff,%ebx
jne    1180 <main+0x40>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (...) @setup_io()
store i32 7, i32* %6
br label %9
9: ; preds = %15, %2
%10 = load i32, i32* %6
%11 = icmp sle i32 %10, 11
br i1 %11, label %12, label %18
12: ; preds = %9
%13 = load i32, i32* %6
%14 = call i32 @set_out(i32 %13)
br label %15
15: ; preds = %12
%16 = load i32, i32* %6
%17 = add nsw i32 %16, 1
store i32 %17, i32* %6
br label %9
18: ; preds = %9
store i32 0, i32* %7
br label %19
19: ; preds = %45, %18
%20 = load i32, i32* %7
%21 = icmp slt i32 %20, 10
br i1 %21, label %22, label %48
22: ; preds = %19
store i32 7, i32* %6
br label %23
23: ; preds = %30, %22
%24 = load i32, i32* %6
%25 = icmp sle i32 %24, 11
br i1 %25, label %26, label %33
26: ; preds = %23
%27 = load i32, i32* %6
%28 = call i32 @switch_gpio(i32 1, i32 %27)
%29 = call i32 @sleep(i32 1)
br label %30
30: ; preds = %26
%31 = load i32, i32* %6
%32 = add nsw i32 %31, 1
store i32 %32, i32* %6
br label %23
33: ; preds = %23
store i32 7, i32* %6
br label %34
34: ; preds = %41, %33
%35 = load i32, i32* %6
%36 = icmp sle i32 %35, 11
br i1 %36, label %37, label %44
37: ; preds = %34
%38 = load i32, i32* %6
%39 = call i32 @switch_gpio(i32 0, i32 %38)
%40 = call i32 @sleep(i32 1)
br label %41
41: ; preds = %37
%42 = load i32, i32* %6
%43 = add nsw i32 %42, 1
store i32 %43, i32* %6
br label %34
44: ; preds = %34
br label %45
45: ; preds = %44
%46 = load i32, i32* %7
%47 = add nsw i32 %46, 1
store i32 %47, i32* %7
br label %19
48: ; preds = %19
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @setup_io()
%4 = tail call i32 @set_out(i32 7)
%5 = tail call i32 @set_out(i32 8)
%6 = tail call i32 @set_out(i32 9)
%7 = tail call i32 @set_out(i32 10)
%8 = tail call i32 @set_out(i32 11)
br label %9
9: ; preds = %2, %9
%10 = phi i32 [ %31, %9 ], [ 0, %2 ]
%11 = tail call i32 @switch_gpio(i32 1, i32 7)
%12 = tail call i32 @sleep(i32 1)
%13 = tail call i32 @switch_gpio(i32 1, i32 8)
%14 = tail call i32 @sleep(i32 1)
%15 = tail call i32 @switch_gpio(i32 1, i32 9)
%16 = tail call i32 @sleep(i32 1)
%17 = tail call i32 @switch_gpio(i32 1, i32 10)
%18 = tail call i32 @sleep(i32 1)
%19 = tail call i32 @switch_gpio(i32 1, i32 11)
%20 = tail call i32 @sleep(i32 1)
%21 = tail call i32 @switch_gpio(i32 0, i32 7)
%22 = tail call i32 @sleep(i32 1)
%23 = tail call i32 @switch_gpio(i32 0, i32 8)
%24 = tail call i32 @sleep(i32 1)
%25 = tail call i32 @switch_gpio(i32 0, i32 9)
%26 = tail call i32 @sleep(i32 1)
%27 = tail call i32 @switch_gpio(i32 0, i32 10)
%28 = tail call i32 @sleep(i32 1)
%29 = tail call i32 @switch_gpio(i32 0, i32 11)
%30 = tail call i32 @sleep(i32 1)
%31 = add nuw nsw i32 %10, 1
%32 = icmp eq i32 %31, 10
br i1 %32, label %33, label %9
33: ; preds = %9
ret i32 0
}