#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 digitalRead(int);
int /*<<< orphan*/ digitalWrite(int /*<<< orphan*/, int);
int /*<<< orphan*/ pinMode(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ wiringXSetup();
int main(void) {
  wiringXSetup();
  pinMode(0, 1);
  pinMode(1, 0);
  while (1) {
    printf("Writing to pin 0: High\n");
    digitalWrite(0, 1);
    printf("Reading from pin 1: %d\n", digitalRead(1));
    sleep(1);
    printf("Writing to pin 0: Low\n");
    digitalWrite(0, 0);
    printf("Reading from pin 1: %d\n", digitalRead(1));
    sleep(1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <wiringXSetup@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1070 <pinMode@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1070 <pinMode@plt>
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1050 <digitalWrite@plt>
mov    $0x1,%edi
call   1040 <digitalRead@plt>
mov    %eax,%esi
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1050 <digitalWrite@plt>
mov    $0x1,%edi
call   1040 <digitalRead@plt>
mov    %eax,%esi
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1080 <sleep@plt>
jmp    118e <main+0x2e>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %eax,%eax
call   1030 <wiringXSetup@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1080 <pinMode@plt>
mov    $0x1,%edi
xor    %esi,%esi
call   1080 <pinMode@plt>
lea    0xe7d(%rip),%r14
lea    0xe5e(%rip),%rbx
lea    0xe86(%rip),%r15
nopl   0x0(%rax)
mov    %r14,%rdi
call   1050 <puts@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1060 <digitalWrite@plt>
mov    $0x1,%edi
call   1040 <digitalRead@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
call   1090 <sleep@plt>
mov    %r15,%rdi
call   1050 <puts@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1060 <digitalWrite@plt>
mov    $0x1,%edi
call   1040 <digitalRead@plt>
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
call   1090 <sleep@plt>
jmp    11b0 <main+0x40>

LLVM IR (-O0):
@.str = [24 x i8] c"Writing to pin 0: High\0A\00"
@.str.1 = [24 x i8] c"Reading from pin 1: %d\0A\00"
@.str.2 = [23 x i8] c"Writing to pin 0: Low\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @wiringXSetup()
%3 = call i32 @pinMode(i32 0, i32 1)
%4 = call i32 @pinMode(i32 1, i32 0)
br label %5
5: ; preds = %0, %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @digitalWrite(i32 0, i32 1)
%8 = call i32 @digitalRead(i32 1)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = call i32 @sleep(i32 1)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @digitalWrite(i32 0, i32 0)
%13 = call i32 @digitalRead(i32 1)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = call i32 @sleep(i32 1)
br label %5
}

LLVM IR (-O2):
@.str.1 = [24 x i8] c"Reading from pin 1: %d\0A\00"
@str = [23 x i8] c"Writing to pin 0: High\00"
@str.3 = [22 x i8] c"Writing to pin 0: Low\00"
define i32 @main() {
%1 = tail call i32 (...) @wiringXSetup()
%2 = tail call i32 @pinMode(i32 0, i32 1)
%3 = tail call i32 @pinMode(i32 1, i32 0)
br label %4
4: ; preds = %0, %4
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @digitalWrite(i32 0, i32 1)
%7 = tail call i32 @digitalRead(i32 1)
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %7)
%9 = tail call i32 @sleep(i32 1)
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.3, i64 0, i64 0))
%11 = tail call i32 @digitalWrite(i32 0, i32 0)
%12 = tail call i32 @digitalRead(i32 1)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = tail call i32 @sleep(i32 1)
br label %4
}