#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_ext(int);
int /*<<< orphan*/ gpio_init();
int /*<<< orphan*/ gpio_layer(int);
int /*<<< orphan*/ gpio_le(int /*<<< orphan*/);
int /*<<< orphan*/ gpio_plane(unsigned char *);
int /*<<< orphan*/ usleep(int);
int main() {
  static unsigned char data[8] = {
      0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  };
  int i;
  gpio_init();
  gpio_le(0);
  gpio_plane(data);
  gpio_ext(1);
  for (;;) {
    for (i = 0; i < 8; i++) {
      gpio_layer(i);
      usleep(100000);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1070 <gpio_init@plt>
xor    %edi,%edi
call   1060 <gpio_le@plt>
lea    0x2ecc(%rip),%rdi
call   1050 <gpio_plane@plt>
mov    $0x1,%edi
call   1030 <gpio_ext@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x8,-0x8(%rbp)
jge    11c4 <main+0x64>
mov    -0x8(%rbp),%edi
call   1040 <gpio_layer@plt>
mov    $0x186a0,%edi
call   1080 <usleep@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    119a <main+0x3a>
jmp    1193 <main+0x33>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1070 <gpio_init@plt>
xor    %edi,%edi
call   1060 <gpio_le@plt>
lea    0x2eda(%rip),%rdi
call   1050 <gpio_plane@plt>
mov    $0x1,%edi
call   1030 <gpio_ext@plt>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %edi,%edi
call   1040 <gpio_layer@plt>
mov    $0x186a0,%edi
call   1080 <usleep@plt>
mov    $0x1,%edi
call   1040 <gpio_layer@plt>
mov    $0x186a0,%edi
call   1080 <usleep@plt>
mov    $0x2,%edi
call   1040 <gpio_layer@plt>
mov    $0x186a0,%edi
call   1080 <usleep@plt>
mov    $0x3,%edi
call   1040 <gpio_layer@plt>
mov    $0x186a0,%edi
call   1080 <usleep@plt>
mov    $0x4,%edi
call   1040 <gpio_layer@plt>
mov    $0x186a0,%edi
call   1080 <usleep@plt>
mov    $0x5,%edi
call   1040 <gpio_layer@plt>
mov    $0x186a0,%edi
call   1080 <usleep@plt>
mov    $0x6,%edi
call   1040 <gpio_layer@plt>
mov    $0x186a0,%edi
call   1080 <usleep@plt>
mov    $0x7,%edi
call   1040 <gpio_layer@plt>
mov    $0x186a0,%edi
call   1080 <usleep@plt>
jmp    1190 <main+0x30>

LLVM IR (-O0):
@main.data = internal global [8 x i8] c"\FF\FF\FF\FF\FF\FF\FF\FF"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @gpio_init()
%4 = call i32 @gpio_le(i32 0)
%5 = call i32 @gpio_plane(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @main.data, i64 0, i64 0))
%6 = call i32 @gpio_ext(i32 1)
br label %7
7: ; preds = %18, %0
store i32 0, i32* %2
br label %8
8: ; preds = %15, %7
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 8
br i1 %10, label %11, label %18
11: ; preds = %8
%12 = load i32, i32* %2
%13 = call i32 @gpio_layer(i32 %12)
%14 = call i32 @usleep(i32 100000)
br label %15
15: ; preds = %11
%16 = load i32, i32* %2
%17 = add nsw i32 %16, 1
store i32 %17, i32* %2
br label %8
18: ; preds = %8
br label %7
}

LLVM IR (-O2):
@main.data = internal global [8 x i8] c"\FF\FF\FF\FF\FF\FF\FF\FF"
define i32 @main() {
%1 = tail call i32 (...) @gpio_init()
%2 = tail call i32 @gpio_le(i32 0)
%3 = tail call i32 @gpio_plane(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @main.data, i64 0, i64 0))
%4 = tail call i32 @gpio_ext(i32 1)
br label %5
5: ; preds = %5, %0
%6 = tail call i32 @gpio_layer(i32 0)
%7 = tail call i32 @usleep(i32 100000)
%8 = tail call i32 @gpio_layer(i32 1)
%9 = tail call i32 @usleep(i32 100000)
%10 = tail call i32 @gpio_layer(i32 2)
%11 = tail call i32 @usleep(i32 100000)
%12 = tail call i32 @gpio_layer(i32 3)
%13 = tail call i32 @usleep(i32 100000)
%14 = tail call i32 @gpio_layer(i32 4)
%15 = tail call i32 @usleep(i32 100000)
%16 = tail call i32 @gpio_layer(i32 5)
%17 = tail call i32 @usleep(i32 100000)
%18 = tail call i32 @gpio_layer(i32 6)
%19 = tail call i32 @usleep(i32 100000)
%20 = tail call i32 @gpio_layer(i32 7)
%21 = tail call i32 @usleep(i32 100000)
br label %5
}