#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_RDWR;
int /*<<< orphan*/ close(int);
scalar_t__ malloc(int);
int open(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ read(int, char *, int);
int main(int argc, char *argv[]) {
  int fd;
  char *buf, *data;
  fd = open("/tmp/markFifo", O_RDWR, (0666));
  buf = (char *)malloc(64);
  data = (char *)malloc(64);
  read(fd, data, 64);
  printf("Fifo Data:%s\n", data);
  close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e7b(%rip),%rax
mov    (%rax),%esi
lea    0xe8a(%rip),%rdi
mov    $0x1b6,%edx
call   1070 <open@plt>
mov    %eax,-0x14(%rbp)
mov    $0x40,%edi
call   1060 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    $0x40,%edi
call   1060 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    $0x40,%edx
call   1050 <read@plt>
mov    -0x28(%rbp),%rsi
lea    0xe53(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
call   1040 <close@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    0x2e8e(%rip),%rax
mov    (%rax),%esi
lea    0xe9d(%rip),%rdi
mov    $0x1b6,%edx
call   1070 <open@plt>
mov    %eax,%ebp
mov    $0x40,%edi
call   1060 <malloc@plt>
mov    $0x40,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %ebp,%edi
mov    %rax,%rsi
mov    $0x40,%edx
call   1050 <read@plt>
lea    0xe72(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    %ebp,%edi
call   1040 <close@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"/tmp/markFifo\00"
@O_RDWR = global i32 0
@.str.1 = [14 x i8] c"Fifo Data:%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* @O_RDWR
%10 = call i32 @open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %9, i32 438)
store i32 %10, i32* %6
%11 = call i64 @malloc(i32 64)
%12 = inttoptr i64 %11 to i8*
store i8* %12, i8** %7
%13 = call i64 @malloc(i32 64)
%14 = inttoptr i64 %13 to i8*
store i8* %14, i8** %8
%15 = load i32, i32* %6
%16 = load i8*, i8** %8
%17 = call i32 @read(i32 %15, i8* %16, i32 64)
%18 = load i8*, i8** %8
%19 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%20 = load i32, i32* %6
%21 = call i32 @close(i32 %20)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"/tmp/markFifo\00"
@O_RDWR = global i32 0
@.str.1 = [14 x i8] c"Fifo Data:%s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @O_RDWR
%4 = tail call i32 @open(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %3, i32 438)
%5 = tail call i64 @malloc(i32 64)
%6 = tail call i64 @malloc(i32 64)
%7 = inttoptr i64 %6 to i8*
%8 = tail call i32 @read(i32 %4, i8* %7, i32 64)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%10 = tail call i32 @close(i32 %4)
ret i32 0
}