#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*/ O_RDONLY;
int /*<<< orphan*/ assertOnPosixError(int);
int close(int);
int /*<<< orphan*/ getTimeString();
int open(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int read(int, char *, int);
void performOneRead(const char *fileName) {
  char temperatureString[512] = {'\0'};
  int fd = open(fileName, O_RDONLY);
  assertOnPosixError(fd);
  assertOnPosixError(read(fd, temperatureString, 512));
  getTimeString();
  printf("\t%s\n", temperatureString);
  assertOnPosixError(close(fd));
}


x86 assembly (clang, -O0):
<performOneRead>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x210(%rbp),%rdi
xor    %esi,%esi
mov    $0x200,%edx
call   1040 <memset@plt>
mov    -0x8(%rbp),%rdi
mov    0x2e4b(%rip),%rax
mov    (%rax),%esi
call   1080 <open@plt>
mov    %eax,-0x214(%rbp)
mov    -0x214(%rbp),%edi
call   1070 <assertOnPosixError@plt>
mov    -0x214(%rbp),%edi
lea    -0x210(%rbp),%rsi
mov    $0x200,%edx
call   1060 <read@plt>
mov    %eax,%edi
call   1070 <assertOnPosixError@plt>
mov    $0x0,%al
call   1090 <getTimeString@plt>
lea    -0x210(%rbp),%rsi
lea    0xe18(%rip),%rdi
call   1030 <printf@plt>
mov    -0x214(%rbp),%edi
call   1050 <close@plt>
mov    %eax,%edi
call   1070 <assertOnPosixError@plt>
add    $0x220,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<performOneRead>:
push   %r14
push   %rbx
sub    $0x208,%rsp
mov    %rdi,%rbx
mov    %rsp,%r14
mov    $0x200,%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
mov    0x2e52(%rip),%rax
mov    (%rax),%esi
mov    %rbx,%rdi
call   1080 <open@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1070 <assertOnPosixError@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x200,%edx
call   1060 <read@plt>
mov    %eax,%edi
call   1070 <assertOnPosixError@plt>
xor    %eax,%eax
call   1090 <getTimeString@plt>
lea    0xe33(%rip),%rdi
mov    %r14,%rsi
call   1030 <printf@plt>
mov    %ebx,%edi
call   1050 <close@plt>
mov    %eax,%edi
call   1070 <assertOnPosixError@plt>
add    $0x208,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@O_RDONLY = global i32 0
@.str = [5 x i8] c"\09%s\0A\00"
define void @performOneRead(i8* %0) {
%2 = alloca i8*
%3 = alloca [512 x i8]
%4 = alloca i32
store i8* %0, i8** %2
%5 = bitcast [512 x i8]* %3 to i8*
%6 = load i8*, i8** %2
%7 = load i32, i32* @O_RDONLY
%8 = call i32 @open(i8* %6, i32 %7)
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = call i32 @assertOnPosixError(i32 %9)
%11 = load i32, i32* %4
%12 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%13 = call i32 @read(i32 %11, i8* %12, i32 512)
%14 = call i32 @assertOnPosixError(i32 %13)
%15 = call i32 (...) @getTimeString()
%16 = getelementptr inbounds [512 x i8], [512 x i8]* %3, i64 0, i64 0
%17 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = load i32, i32* %4
%19 = call i32 @close(i32 %18)
%20 = call i32 @assertOnPosixError(i32 %19)
ret void
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
@.str = [5 x i8] c"\09%s\0A\00"
define void @performOneRead(i8* nocapture %0) {
%2 = alloca [512 x i8]
%3 = getelementptr inbounds [512 x i8], [512 x i8]* %2, i64 0, i64 0
%4 = load i32, i32* @O_RDONLY
%5 = tail call i32 @open(i8* %0, i32 %4)
%6 = tail call i32 @assertOnPosixError(i32 %5)
%7 = call i32 @read(i32 %5, i8* %3, i32 512)
%8 = tail call i32 @assertOnPosixError(i32 %7)
%9 = tail call i32 (...) @getTimeString()
%10 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %3)
%11 = call i32 @close(i32 %5)
%12 = call i32 @assertOnPosixError(i32 %11)
ret void
}