#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 */
scalar_t__ EEXIST;
int S_IRGRP;
int S_IROTH;
int S_IRUSR;
int S_IWUSR;
scalar_t__ errno;
scalar_t__ mkfifo(char *, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ unlink(char *);
int mkfifos() {
  if ((mkfifo("/tmp/fifo.1", (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) < 0) &&
      errno != EEXIST) {
    perror("Can't create Fifo1: ");
  }
  if ((mkfifo("/tmp/fifo.2", (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)) < 0) &&
      errno != EEXIST) {
    perror("Can't create Fifo2: ");
    unlink("/tmp/fifo.1");
  }
}


x86 assembly (clang, -O0):
<mkfifos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e79(%rip),%rax
mov    (%rax),%esi
mov    0x2ea0(%rip),%rax
or     (%rax),%esi
mov    0x2e77(%rip),%rax
or     (%rax),%esi
mov    0x2e66(%rip),%rax
or     (%rax),%esi
lea    0xe9d(%rip),%rdi
call   1040 <mkfifo@plt>
cmp    $0x0,%rax
jge    1198 <mkfifos+0x68>
mov    0x2e57(%rip),%rax
mov    (%rax),%rax
mov    0x2e55(%rip),%rcx
cmp    (%rcx),%rax
je     1198 <mkfifos+0x68>
lea    0xe79(%rip),%rdi
call   1050 <perror@plt>
mov    0x2e19(%rip),%rax
mov    (%rax),%esi
mov    0x2e40(%rip),%rax
or     (%rax),%esi
mov    0x2e17(%rip),%rax
or     (%rax),%esi
mov    0x2e06(%rip),%rax
or     (%rax),%esi
lea    0xe5e(%rip),%rdi
call   1040 <mkfifo@plt>
cmp    $0x0,%rax
jge    1204 <mkfifos+0xd4>
mov    0x2df7(%rip),%rax
mov    (%rax),%rax
mov    0x2df5(%rip),%rcx
cmp    (%rcx),%rax
je     1204 <mkfifos+0xd4>
lea    0xe3a(%rip),%rdi
call   1050 <perror@plt>
lea    0xe01(%rip),%rdi
call   1030 <unlink@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkfifos>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    0x2e79(%rip),%r14
mov    0x2ea2(%rip),%r12
mov    (%r12),%esi
or     (%r14),%esi
mov    0x2e74(%rip),%r15
or     (%r15),%esi
mov    0x2e62(%rip),%rbx
or     (%rbx),%esi
lea    0xe99(%rip),%rdi
call   1040 <mkfifo@plt>
test   %rax,%rax
jns    1187 <mkfifos+0x57>
mov    0x2e58(%rip),%rax
mov    (%rax),%rax
mov    0x2e56(%rip),%rcx
cmp    (%rcx),%rax
jne    11c6 <mkfifos+0x96>
mov    (%r12),%esi
or     (%r14),%esi
or     (%r15),%esi
or     (%rbx),%esi
lea    0xe87(%rip),%rdi
call   1040 <mkfifo@plt>
test   %rax,%rax
jns    11ba <mkfifos+0x8a>
mov    0x2e25(%rip),%rax
mov    (%rax),%rax
mov    0x2e23(%rip),%rcx
cmp    (%rcx),%rax
jne    11d4 <mkfifos+0xa4>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xe3f(%rip),%rdi
call   1050 <perror@plt>
jmp    1187 <mkfifos+0x57>
lea    0xe52(%rip),%rdi
call   1050 <perror@plt>
lea    0xe19(%rip),%rdi
call   1030 <unlink@plt>
jmp    11ba <mkfifos+0x8a>

LLVM IR (-O0):
@.str = [12 x i8] c"/tmp/fifo.1\00"
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@S_IROTH = global i32 0
@errno = global i64 0
@EEXIST = global i64 0
@.str.1 = [21 x i8] c"Can't create Fifo1: \00"
@.str.2 = [12 x i8] c"/tmp/fifo.2\00"
@.str.3 = [21 x i8] c"Can't create Fifo2: \00"
define i32 @mkfifos() {
%1 = alloca i32
%2 = load i32, i32* @S_IRUSR
%3 = load i32, i32* @S_IWUSR
%4 = or i32 %2, %3
%5 = load i32, i32* @S_IRGRP
%6 = or i32 %4, %5
%7 = load i32, i32* @S_IROTH
%8 = or i32 %6, %7
%9 = call i64 @mkfifo(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = icmp slt i64 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %0
%12 = load i64, i64* @errno
%13 = load i64, i64* @EEXIST
%14 = icmp ne i64 %12, %13
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %17
17: ; preds = %15, %11, %0
%18 = load i32, i32* @S_IRUSR
%19 = load i32, i32* @S_IWUSR
%20 = or i32 %18, %19
%21 = load i32, i32* @S_IRGRP
%22 = or i32 %20, %21
%23 = load i32, i32* @S_IROTH
%24 = or i32 %22, %23
%25 = call i64 @mkfifo(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %24)
%26 = icmp slt i64 %25, 0
br i1 %26, label %27, label %34
27: ; preds = %17
%28 = load i64, i64* @errno
%29 = load i64, i64* @EEXIST
%30 = icmp ne i64 %28, %29
br i1 %30, label %31, label %34
31: ; preds = %27
%32 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%33 = call i32 @unlink(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %34
34: ; preds = %31, %27, %17
%35 = load i32, i32* %1
ret i32 %35
}

LLVM IR (-O2):
@.str = [12 x i8] c"/tmp/fifo.1\00"
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@S_IROTH = global i32 0
@errno = global i64 0
@EEXIST = global i64 0
@.str.1 = [21 x i8] c"Can't create Fifo1: \00"
@.str.2 = [12 x i8] c"/tmp/fifo.2\00"
@.str.3 = [21 x i8] c"Can't create Fifo2: \00"
define i32 @mkfifos() {
%1 = load i32, i32* @S_IRUSR
%2 = load i32, i32* @S_IWUSR
%3 = or i32 %2, %1
%4 = load i32, i32* @S_IRGRP
%5 = or i32 %3, %4
%6 = load i32, i32* @S_IROTH
%7 = or i32 %5, %6
%8 = tail call i64 @mkfifo(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = icmp slt i64 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %0
%11 = load i64, i64* @errno
%12 = load i64, i64* @EEXIST
%13 = icmp eq i64 %11, %12
br i1 %13, label %16, label %14
14: ; preds = %10
%15 = tail call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %10, %0
%17 = load i32, i32* @S_IRUSR
%18 = load i32, i32* @S_IWUSR
%19 = or i32 %18, %17
%20 = load i32, i32* @S_IRGRP
%21 = or i32 %19, %20
%22 = load i32, i32* @S_IROTH
%23 = or i32 %21, %22
%24 = tail call i64 @mkfifo(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = icmp slt i64 %24, 0
br i1 %25, label %26, label %33
26: ; preds = %16
%27 = load i64, i64* @errno
%28 = load i64, i64* @EEXIST
%29 = icmp eq i64 %27, %28
br i1 %29, label %33, label %30
30: ; preds = %26
%31 = tail call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%32 = tail call i32 @unlink(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %33
33: ; preds = %30, %26, %16
ret i32 undef
}