#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*/ EXIT_SUCCESS;
int S_IRGRP;
int S_IROTH;
int S_IRUSR;
int S_IWUSR;
int /*<<< orphan*/ close(int);
int create_pipe(char *, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ handle_fatal_error(char *);
int open_pipe(char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ unlink(char *);
int /*<<< orphan*/ write(int, char *, int);
int main(void) {
  char buffer[100];
  int pd;
  int pipe;
  pipe = create_pipe("./testfifo", S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH);
  if (pipe == -1) {
    handle_fatal_error("\nError when trying to create the named pipe.\n");
  }
  pd = open_pipe("./testfifo");
  if (pd == -1) {
    handle_fatal_error("\nError when trying to open the named pipe.\n");
  }
  strcpy(buffer, "Sed ut perspiciatis unde omnis iste natus error sit "
                 "voluptatem accusantium doloremque laudantium...");
  write(pd, buffer, 100);
  close(pd);
  unlink("./testfifo");
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e4f(%rip),%rax
mov    (%rax),%esi
mov    0x2e26(%rip),%rax
or     (%rax),%esi
mov    0x2e2d(%rip),%rax
or     (%rax),%esi
mov    0x2e1c(%rip),%rax
or     (%rax),%esi
lea    0xe43(%rip),%rdi
call   1080 <create_pipe@plt>
mov    %eax,-0x78(%rbp)
cmpl   $0xffffffff,-0x78(%rbp)
jne    11db <main+0x5b>
lea    0xe35(%rip),%rdi
call   1070 <handle_fatal_error@plt>
lea    0xe1e(%rip),%rdi
call   1090 <open_pipe@plt>
mov    %eax,-0x74(%rbp)
cmpl   $0xffffffff,-0x74(%rbp)
jne    1200 <main+0x80>
lea    0xe3e(%rip),%rdi
call   1070 <handle_fatal_error@plt>
lea    -0x70(%rbp),%rdi
lea    0xe5a(%rip),%rsi
call   1040 <strcpy@plt>
mov    -0x74(%rbp),%edi
lea    -0x70(%rbp),%rsi
mov    $0x64,%edx
call   1050 <write@plt>
mov    -0x74(%rbp),%edi
call   1060 <close@plt>
lea    0xdd0(%rip),%rdi
call   1030 <unlink@plt>
mov    0x2d84(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x68,%rsp
mov    0x2e5a(%rip),%rax
mov    0x2e33(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2e38(%rip),%rax
or     (%rax),%esi
mov    0x2e27(%rip),%rax
or     (%rax),%esi
lea    0xe4e(%rip),%rdi
call   1080 <create_pipe@plt>
cmp    $0xffffffff,%eax
jne    11c8 <main+0x48>
lea    0xe48(%rip),%rdi
call   1070 <handle_fatal_error@plt>
lea    0xe31(%rip),%rdi
call   1090 <open_pipe@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    11e7 <main+0x67>
lea    0xe57(%rip),%rdi
call   1070 <handle_fatal_error@plt>
lea    0xe77(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <strcpy@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x64,%edx
call   1050 <write@plt>
mov    %ebx,%edi
call   1060 <close@plt>
lea    0xdea(%rip),%rdi
call   1030 <unlink@plt>
mov    0x2d9e(%rip),%rax
mov    (%rax),%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"./testfifo\00"
@S_IWUSR = global i32 0
@S_IRUSR = global i32 0
@S_IRGRP = global i32 0
@S_IROTH = global i32 0
@.str.1 = [46 x i8] c"\0AError when trying to create the named pipe.\0A\00"
@.str.2 = [44 x i8] c"\0AError when trying to open the named pipe.\0A\00"
@.str.3 = [100 x i8] c"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium...\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = load i32, i32* @S_IWUSR
%6 = load i32, i32* @S_IRUSR
%7 = or i32 %5, %6
%8 = load i32, i32* @S_IRGRP
%9 = or i32 %7, %8
%10 = load i32, i32* @S_IROTH
%11 = or i32 %9, %10
%12 = call i32 @create_pipe(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %11)
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = call i32 @handle_fatal_error(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %15, %0
%18 = call i32 @open_pipe(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i32 %18, i32* %3
%19 = load i32, i32* %3
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %23
21: ; preds = %17
%22 = call i32 @handle_fatal_error(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0))
br label %23
23: ; preds = %21, %17
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%25 = call i32 @strcpy(i8* %24, i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.3, i64 0, i64 0))
%26 = load i32, i32* %3
%27 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%28 = call i32 @write(i32 %26, i8* %27, i32 100)
%29 = load i32, i32* %3
%30 = call i32 @close(i32 %29)
%31 = call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%32 = load i32, i32* @EXIT_SUCCESS
%33 = call i32 @exit(i32 %32)
unreachable
}

LLVM IR (-O2):
@.str = [11 x i8] c"./testfifo\00"
@S_IWUSR = global i32 0
@S_IRUSR = global i32 0
@S_IRGRP = global i32 0
@S_IROTH = global i32 0
@.str.1 = [46 x i8] c"\0AError when trying to create the named pipe.\0A\00"
@.str.2 = [44 x i8] c"\0AError when trying to open the named pipe.\0A\00"
@.str.3 = [100 x i8] c"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium...\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @S_IWUSR
%4 = load i32, i32* @S_IRUSR
%5 = or i32 %4, %3
%6 = load i32, i32* @S_IRGRP
%7 = or i32 %5, %6
%8 = load i32, i32* @S_IROTH
%9 = or i32 %7, %8
%10 = tail call i32 @create_pipe(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = tail call i32 @handle_fatal_error(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
br label %14
14: ; preds = %12, %0
%15 = tail call i32 @open_pipe(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%16 = icmp eq i32 %15, -1
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = tail call i32 @handle_fatal_error(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0))
br label %19
19: ; preds = %17, %14
%20 = call i32 @strcpy(i8* %2, i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.3, i64 0, i64 0))
%21 = call i32 @write(i32 %15, i8* %2, i32 100)
%22 = call i32 @close(i32 %15)
%23 = call i32 @unlink(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%24 = load i32, i32* @EXIT_SUCCESS
%25 = call i32 @exit(i32 %24)
unreachable
}