#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ closeFile(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *openFile(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
void readGPIOValue() {
  FILE *jsupFile = openFile("/sys/class/gpio/gpio26/value", "r");
  printf("Reading: '%s'", "/sys/class/gpio/gpio26/value");
  char buff[1024];
  fgets(buff, 1024, jsupFile);
  printf("Read: '%s'", buff);
  closeFile(jsupFile);
}


x86 assembly (clang, -O0):
<readGPIOValue>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
lea    0xeae(%rip),%rdi
lea    0xec4(%rip),%rsi
call   1030 <openFile@plt>
mov    %rax,-0x8(%rbp)
lea    0xeb6(%rip),%rdi
lea    0xe90(%rip),%rsi
call   1040 <printf@plt>
lea    -0x410(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x400,%esi
call   1050 <fgets@plt>
lea    -0x410(%rbp),%rsi
lea    0xe95(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1060 <closeFile@plt>
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readGPIOValue>:
push   %r14
push   %rbx
sub    $0x408,%rsp
lea    0xeaf(%rip),%r14
lea    0xec5(%rip),%rsi
mov    %r14,%rdi
call   1030 <openFile@plt>
mov    %rax,%rbx
lea    0xeb5(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x400,%esi
mov    %rbx,%rdx
call   1050 <fgets@plt>
lea    0xea1(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1060 <closeFile@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [29 x i8] c"/sys/class/gpio/gpio26/value\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [14 x i8] c"Reading: '%s'\00"
@.str.3 = [11 x i8] c"Read: '%s'\00"
define void @readGPIOValue() {
%1 = alloca i32*
%2 = alloca [1024 x i8]
%3 = call i32* @openFile(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %1
%4 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%6 = load i32*, i32** %1
%7 = call i32 @fgets(i8* %5, i32 1024, i32* %6)
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%9 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %8)
%10 = load i32*, i32** %1
%11 = call i32 @closeFile(i32* %10)
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"/sys/class/gpio/gpio26/value\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [14 x i8] c"Reading: '%s'\00"
@.str.3 = [11 x i8] c"Read: '%s'\00"
define void @readGPIOValue() {
%1 = alloca [1024 x i8]
%2 = tail call i32* @openFile(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%5 = call i32 @fgets(i8* %4, i32 1024, i32* %2)
%6 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%7 = call i32 @closeFile(i32* %2)
ret void
}