#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_on(int);
int /*<<< orphan*/ all_output();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ setup_io();
int /*<<< orphan*/ sleep(int);
int main() {
  int GPIOselect;
  setup_io();
  all_output();
  printf("Which GPIO should I set up?\n");
  scanf("%d", &GPIOselect);
  printf("Switching on GPIO %d!\n", GPIOselect);
  GPIO_on(GPIOselect);
  printf("GPIO %d is on!\n", GPIOselect);
  sleep(600);
  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>
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8b(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%esi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
call   1040 <GPIO_on@plt>
mov    -0x8(%rbp),%esi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x258,%edi
call   1060 <sleep@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1080 <setup_io@plt>
xor    %eax,%eax
call   1090 <all_output@plt>
lea    0xea4(%rip),%rdi
call   1030 <puts@plt>
lea    0xe6e(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%esi
lea    0xe5c(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%edi
call   1050 <GPIO_on@plt>
mov    0x4(%rsp),%esi
lea    0xe58(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x258,%edi
call   1070 <sleep@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Which GPIO should I set up?\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [23 x i8] c"Switching on GPIO %d!\0A\00"
@.str.3 = [16 x i8] c"GPIO %d is on!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @setup_io()
%4 = call i32 (...) @all_output()
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = load i32, i32* %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %2
%10 = call i32 @GPIO_on(i32 %9)
%11 = load i32, i32* %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %11)
%13 = call i32 @sleep(i32 600)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [23 x i8] c"Switching on GPIO %d!\0A\00"
@.str.3 = [16 x i8] c"GPIO %d is on!\0A\00"
@str = [28 x i8] c"Which GPIO should I set up?\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()
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %1
%10 = call i32 @GPIO_on(i32 %9)
%11 = load i32, i32* %1
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %11)
%13 = call i32 @sleep(i32 600)
ret i32 0
}