#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*/ IOPi_init(int, int);
int /*<<< orphan*/ set_port_direction(int, int, int);
int /*<<< orphan*/ usleep(int);
int /*<<< orphan*/ write_pin(int, int, int);
int /*<<< orphan*/ write_port(int, int, int);
int main(int argc, char **argv) {
  IOPi_init(0x20, 1);
  set_port_direction(0x20, 0, 0x00);
  set_port_direction(0x20, 1, 0x00);
  write_port(0x20, 1, 0xFF);
  while (1) {
    write_pin(0x20, 1, 1);
    usleep(1000000);
    write_pin(0x20, 1, 0);
    usleep(1000000);
  }
  (void)argc;
  (void)argv;
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x20,%edi
mov    $0x1,%esi
call   1050 <IOPi_init@plt>
mov    $0x20,%edi
xor    %edx,%edx
mov    %edx,%esi
call   1060 <set_port_direction@plt>
mov    $0x20,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1060 <set_port_direction@plt>
mov    $0x20,%edi
mov    $0x1,%esi
mov    $0xff,%edx
call   1040 <write_port@plt>
mov    $0x20,%edi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <write_pin@plt>
mov    $0xf4240,%edi
call   1070 <usleep@plt>
mov    $0x20,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1030 <write_pin@plt>
mov    $0xf4240,%edi
call   1070 <usleep@plt>
jmp    11a8 <main+0x58>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x20,%edi
mov    $0x1,%esi
call   1050 <IOPi_init@plt>
mov    $0x20,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1060 <set_port_direction@plt>
mov    $0x20,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1060 <set_port_direction@plt>
mov    $0x20,%edi
mov    $0x1,%esi
mov    $0xff,%edx
call   1040 <write_port@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x20,%edi
mov    $0x1,%esi
mov    $0x1,%edx
call   1030 <write_pin@plt>
mov    $0xf4240,%edi
call   1070 <usleep@plt>
mov    $0x20,%edi
mov    $0x1,%esi
xor    %edx,%edx
call   1030 <write_pin@plt>
mov    $0xf4240,%edi
call   1070 <usleep@plt>
jmp    11a0 <main+0x50>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @IOPi_init(i32 32, i32 1)
%7 = call i32 @set_port_direction(i32 32, i32 0, i32 0)
%8 = call i32 @set_port_direction(i32 32, i32 1, i32 0)
%9 = call i32 @write_port(i32 32, i32 1, i32 255)
br label %10
10: ; preds = %2, %10
%11 = call i32 @write_pin(i32 32, i32 1, i32 1)
%12 = call i32 @usleep(i32 1000000)
%13 = call i32 @write_pin(i32 32, i32 1, i32 0)
%14 = call i32 @usleep(i32 1000000)
br label %10
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @IOPi_init(i32 32, i32 1)
%4 = tail call i32 @set_port_direction(i32 32, i32 0, i32 0)
%5 = tail call i32 @set_port_direction(i32 32, i32 1, i32 0)
%6 = tail call i32 @write_port(i32 32, i32 1, i32 255)
br label %7
7: ; preds = %2, %7
%8 = tail call i32 @write_pin(i32 32, i32 1, i32 1)
%9 = tail call i32 @usleep(i32 1000000)
%10 = tail call i32 @write_pin(i32 32, i32 1, i32 0)
%11 = tail call i32 @usleep(i32 1000000)
br label %7
}