#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 ssize_t;
typedef scalar_t__ pid_t;
typedef int /*<<< orphan*/ fifoname;
typedef int /*<<< orphan*/ buff;

/* Variables and functions */
scalar_t__ EEXIST;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ O_WRONLY;
int S_IRGRP;
int S_IROTH;
int S_IRUSR;
int S_IWUSR;
scalar_t__ atol(char *);
int /*<<< orphan*/ close(int);
scalar_t__ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ mkfifo(char *, int);
int open(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, ...);
int read(int, char *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, ...);
char *strchr(char *, char);
char *strerror(scalar_t__);
int strlen(char *);
int /*<<< orphan*/ write(int, char *, int);
int main(int argc, char **argv) {
  int readfifo, writefifo, dummyfd, fd;
  char *ptr, buff[(100)], fifoname[(100)];
  pid_t pid;
  ssize_t n;
  if ((0 > mkfifo("/tmp/fifo.serv", (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH))) &&
      (EEXIST != errno)) {
    printf("mkfifo %s error: %s", "/tmp/fifo.serv", strerror(errno));
    exit(EXIT_FAILURE);
  }
  if (0 > (readfifo = open("/tmp/fifo.serv", O_RDONLY, 0))) {
    printf("open %s error: %s", "/tmp/fifo.serv", strerror(errno));
    exit(EXIT_FAILURE);
  }
  if (0 > (dummyfd = open("/tmp/fifo.serv", O_WRONLY, 0))) {
    printf("open %s error: %s", "/tmp/fifo.serv", strerror(errno));
    exit(EXIT_FAILURE);
  }
  while (0 < (n = read(readfifo, buff, (100)))) {
    if ('\n' == buff[n - 1]) {
      --n;
    }
    buff[n] = '\0';
    if (NULL == (ptr = strchr(buff, ' '))) {
      printf("** request: %s, error input from client", buff);
      continue;
    }
    *ptr++ = 0;
    pid = atol(buff);
    snprintf(fifoname, sizeof(fifoname), "/tmp/fifo.%ld", (long)pid);
    if (0 > (writefifo = open(fifoname, O_WRONLY, 0))) {
      printf("open %s error: %s", fifoname, strerror(errno));
      continue;
    }
    if (0 > (fd = open(ptr, O_RDONLY, 0))) {
      snprintf(buff + n, sizeof(buff) - n, ": can't open, %s\n",
               strerror(errno));
      n = strlen(ptr);
      write(writefifo, ptr, n);
      close(writefifo);
    } else {
      while (0 < (n = read(fd, buff, (100)))) {
        write(writefifo, buff, n);
      }
      close(fd);
      close(writefifo);
    }
  }
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2dc8(%rip),%rax
mov    (%rax),%esi
mov    0x2df7(%rip),%rax
or     (%rax),%esi
mov    0x2dce(%rip),%rax
or     (%rax),%esi
mov    0x2dbd(%rip),%rax
or     (%rax),%esi
lea    0xdfc(%rip),%rdi
call   10a0 <mkfifo@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jle    1266 <main+0xa6>
mov    0x2db2(%rip),%rax
mov    (%rax),%rax
mov    0x2da0(%rip),%rcx
cmp    (%rcx),%rax
je     1266 <main+0xa6>
mov    0x2d90(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
mov    %rax,%rdx
lea    0xdc5(%rip),%rdi
lea    0xdaf(%rip),%rsi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x2d51(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
mov    0x2d7b(%rip),%rax
mov    (%rax),%esi
lea    0xd8a(%rip),%rdi
xor    %edx,%edx
call   10c0 <open@plt>
mov    %eax,%ecx
mov    %ecx,-0x14(%rbp)
xor    %eax,%eax
cmp    %ecx,%eax
jle    12c1 <main+0x101>
mov    0x2d35(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
mov    %rax,%rdx
lea    0xd7e(%rip),%rdi
lea    0xd54(%rip),%rsi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x2cf6(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
mov    0x2cc8(%rip),%rax
mov    (%rax),%esi
lea    0xd2f(%rip),%rdi
xor    %edx,%edx
call   10c0 <open@plt>
mov    %eax,%ecx
mov    %ecx,-0x1c(%rbp)
xor    %eax,%eax
cmp    %ecx,%eax
jle    131c <main+0x15c>
mov    0x2cda(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
mov    %rax,%rdx
lea    0xd23(%rip),%rdi
lea    0xcf9(%rip),%rsi
mov    $0x0,%al
call   1060 <printf@plt>
mov    0x2c9b(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
jmp    1321 <main+0x161>
mov    -0x14(%rbp),%edi
lea    -0x90(%rbp),%rsi
mov    $0x64,%edx
call   1090 <read@plt>
mov    %eax,%ecx
mov    %ecx,-0x10c(%rbp)
xor    %eax,%eax
cmp    %ecx,%eax
jge    156d <main+0x3ad>
mov    -0x10c(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x90(%rbp,%rax,1),%ecx
ff
mov    $0xa,%eax
cmp    %ecx,%eax
jne    1376 <main+0x1b6>
mov    -0x10c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10c(%rbp)
movslq -0x10c(%rbp),%rax
movb   $0x0,-0x90(%rbp,%rax,1)
lea    -0x90(%rbp),%rdi
mov    $0x20,%esi
call   1050 <strchr@plt>
mov    %rax,%rcx
mov    %rcx,-0x28(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
jne    13c2 <main+0x202>
lea    -0x90(%rbp),%rsi
lea    0xc7f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1321 <main+0x161>
mov    -0x28(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x28(%rbp)
movb   $0x0,(%rax)
lea    -0x90(%rbp),%rdi
call   10b0 <atol@plt>
mov    %rax,-0x108(%rbp)
lea    -0x100(%rbp),%rdi
mov    -0x108(%rbp),%rcx
mov    $0x64,%esi
lea    0xc5c(%rip),%rdx
mov    $0x0,%al
call   1070 <snprintf@plt>
lea    -0x100(%rbp),%rdi
mov    0x2b7a(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10c0 <open@plt>
mov    %eax,%ecx
mov    %ecx,-0x18(%rbp)
xor    %eax,%eax
cmp    %ecx,%eax
jle    1468 <main+0x2a8>
lea    -0x100(%rbp),%rax
mov    %rax,-0x118(%rbp)
mov    0x2b85(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
mov    -0x118(%rbp),%rsi
mov    %rax,%rdx
lea    0xbc7(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1321 <main+0x161>
mov    -0x28(%rbp),%rdi
mov    0x2b75(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10c0 <open@plt>
mov    %eax,%ecx
mov    %ecx,-0x20(%rbp)
xor    %eax,%eax
cmp    %ecx,%eax
jle    1513 <main+0x353>
lea    -0x90(%rbp),%rax
movslq -0x10c(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x128(%rbp)
movslq -0x10c(%rbp),%rcx
mov    $0x64,%eax
sub    %rcx,%rax
mov    %eax,-0x11c(%rbp)
mov    0x2b09(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
mov    -0x128(%rbp),%rdi
mov    -0x11c(%rbp),%esi
mov    %rax,%rcx
lea    0xb8d(%rip),%rdx
mov    $0x0,%al
call   1070 <snprintf@plt>
mov    -0x28(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x10c(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    -0x10c(%rbp),%edx
call   1030 <write@plt>
mov    -0x18(%rbp),%edi
call   1080 <close@plt>
jmp    1568 <main+0x3a8>
jmp    1518 <main+0x358>
mov    -0x20(%rbp),%edi
lea    -0x90(%rbp),%rsi
mov    $0x64,%edx
call   1090 <read@plt>
mov    %eax,%ecx
mov    %ecx,-0x10c(%rbp)
xor    %eax,%eax
cmp    %ecx,%eax
jge    1558 <main+0x398>
mov    -0x18(%rbp),%edi
lea    -0x90(%rbp),%rsi
mov    -0x10c(%rbp),%edx
call   1030 <write@plt>
jmp    1518 <main+0x358>
mov    -0x20(%rbp),%edi
call   1080 <close@plt>
mov    -0x18(%rbp),%edi
call   1080 <close@plt>
jmp    1321 <main+0x161>
mov    0x2a2c(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
mov    0x2dd0(%rip),%rax
mov    0x2e01(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    0x2dd6(%rip),%rax
or     (%rax),%esi
mov    0x2dc5(%rip),%rax
or     (%rax),%esi
lea    0xe04(%rip),%rdi
call   10a0 <mkfifo@plt>
test   %rax,%rax
jns    121c <main+0x5c>
mov    0x2dc3(%rip),%rax
mov    0x2db4(%rip),%rcx
mov    (%rcx),%rdi
cmp    %rdi,(%rax)
jne    126d <main+0xad>
mov    0x2dc5(%rip),%rax
mov    (%rax),%esi
lea    0xdd4(%rip),%rdi
xor    %edx,%edx
call   10c0 <open@plt>
test   %eax,%eax
js     1255 <main+0x95>
mov    %eax,%r12d
mov    0x2d4f(%rip),%rax
mov    (%rax),%esi
lea    0xdb6(%rip),%rdi
xor    %edx,%edx
call   10c0 <open@plt>
test   %eax,%eax
jns    1298 <main+0xd8>
mov    0x2d6c(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
lea    0xdb8(%rip),%rdi
jmp    1279 <main+0xb9>
call   10e0 <strerror@plt>
lea    0xd96(%rip),%rdi
lea    0xd80(%rip),%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2d1f(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
lea    0x10(%rsp),%rsi
mov    %r12d,%edi
mov    $0x64,%edx
call   1090 <read@plt>
test   %eax,%eax
jle    144c <main+0x28c>
mov    %eax,%r14d
lea    0x10(%rsp),%rbx
lea    0x80(%rsp),%rbp
mov    %r12d,0xc(%rsp)
jmp    12fc <main+0x13c>
nopl   0x0(%rax)
lea    0xd5e(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
mov    $0x64,%edx
call   1090 <read@plt>
mov    %eax,%r14d
test   %eax,%eax
jle    144c <main+0x28c>
lea    -0x1(%r14),%eax
cmpb   $0xa,0x10(%rsp,%rax,1)
cmove  %eax,%r14d
movb   $0x0,0x10(%rsp,%r14,1)
mov    %rbx,%rdi
mov    $0x20,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     12d0 <main+0x110>
mov    %rax,%r15
movb   $0x0,(%rax)
mov    %rbx,%rdi
call   10b0 <atol@plt>
mov    %rbp,%rdi
mov    $0x64,%esi
lea    0xd1f(%rip),%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <snprintf@plt>
mov    0x2c41(%rip),%rax
mov    (%rax),%esi
mov    %rbp,%rdi
xor    %edx,%edx
call   10c0 <open@plt>
test   %eax,%eax
js     13c0 <main+0x200>
mov    %eax,%r13d
add    $0x1,%r15
mov    0x2c7b(%rip),%rax
mov    (%rax),%esi
mov    %r15,%rdi
xor    %edx,%edx
call   10c0 <open@plt>
test   %eax,%eax
js     13e8 <main+0x228>
mov    %eax,%r12d
mov    %r12d,%edi
mov    %rbx,%rsi
mov    $0x64,%edx
call   1090 <read@plt>
test   %eax,%eax
jle    13b0 <main+0x1f0>
mov    %r13d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
jmp    1380 <main+0x1c0>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r12d,%edi
call   1080 <close@plt>
jmp    1432 <main+0x272>
nopw   0x0(%rax,%rax,1)
mov    0x2c01(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
lea    0xc4d(%rip),%rdi
mov    %rbp,%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1060 <printf@plt>
jmp    12e1 <main+0x121>
lea    (%rsp,%r14,1),%r12
add    $0x10,%r12
mov    $0x64,%ebp
sub    %r14d,%ebp
mov    0x2bc9(%rip),%rax
mov    (%rax),%rdi
call   10e0 <strerror@plt>
mov    %r12,%rdi
mov    %ebp,%esi
lea    0xc58(%rip),%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   1070 <snprintf@plt>
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %r13d,%edi
mov    %r15,%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    %r13d,%edi
call   1080 <close@plt>
mov    0xc(%rsp),%r12d
lea    0x80(%rsp),%rbp
jmp    12e1 <main+0x121>
mov    0x2b4d(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"/tmp/fifo.serv\00"
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@S_IROTH = global i32 0
@EEXIST = global i64 0
@errno = global i64 0
@.str.1 = [20 x i8] c"mkfifo %s error: %s\00"
@EXIT_FAILURE = global i32 0
@O_RDONLY = global i32 0
@.str.2 = [18 x i8] c"open %s error: %s\00"
@O_WRONLY = global i32 0
@.str.3 = [40 x i8] c"** request: %s, error input from client\00"
@.str.4 = [14 x i8] c"/tmp/fifo.%ld\00"
@.str.5 = [18 x i8] c": can't open, %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca [100 x i8]
%12 = alloca [100 x i8]
%13 = alloca i64
%14 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = load i32, i32* @S_IRUSR
%16 = load i32, i32* @S_IWUSR
%17 = or i32 %15, %16
%18 = load i32, i32* @S_IRGRP
%19 = or i32 %17, %18
%20 = load i32, i32* @S_IROTH
%21 = or i32 %19, %20
%22 = call i64 @mkfifo(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = icmp sgt i64 0, %22
br i1 %23, label %24, label %34
24: ; preds = %2
%25 = load i64, i64* @EEXIST
%26 = load i64, i64* @errno
%27 = icmp ne i64 %25, %26
br i1 %27, label %28, label %34
28: ; preds = %24
%29 = load i64, i64* @errno
%30 = call i8* @strerror(i64 %29)
%31 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %30)
%32 = load i32, i32* @EXIT_FAILURE
%33 = call i32 @exit(i32 %32)
unreachable
34: ; preds = %24, %2
%35 = load i32, i32* @O_RDONLY
%36 = call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %35, i32 0)
store i32 %36, i32* %6
%37 = icmp sgt i32 0, %36
br i1 %37, label %38, label %44
38: ; preds = %34
%39 = load i64, i64* @errno
%40 = call i8* @strerror(i64 %39)
%41 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %40)
%42 = load i32, i32* @EXIT_FAILURE
%43 = call i32 @exit(i32 %42)
unreachable
44: ; preds = %34
%45 = load i32, i32* @O_WRONLY
%46 = call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %45, i32 0)
store i32 %46, i32* %8
%47 = icmp sgt i32 0, %46
br i1 %47, label %48, label %54
48: ; preds = %44
%49 = load i64, i64* @errno
%50 = call i8* @strerror(i64 %49)
%51 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %50)
%52 = load i32, i32* @EXIT_FAILURE
%53 = call i32 @exit(i32 %52)
unreachable
54: ; preds = %44
br label %55
55: ; preds = %139, %93, %78, %54
%56 = load i32, i32* %6
%57 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%58 = call i32 @read(i32 %56, i8* %57, i32 100)
store i32 %58, i32* %14
%59 = icmp slt i32 0, %58
br i1 %59, label %60, label %140
60: ; preds = %55
%61 = load i32, i32* %14
%62 = sub nsw i32 %61, 1
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 %63
%65 = load i8, i8* %64
%66 = sext i8 %65 to i32
%67 = icmp eq i32 10, %66
br i1 %67, label %68, label %71
68: ; preds = %60
%69 = load i32, i32* %14
%70 = add nsw i32 %69, -1
store i32 %70, i32* %14
br label %71
71: ; preds = %68, %60
%72 = load i32, i32* %14
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 %73
store i8 0, i8* %74
%75 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%76 = call i8* @strchr(i8* %75, i8 signext 32)
store i8* %76, i8** %10
%77 = icmp eq i8* null, %76
br i1 %77, label %78, label %81
78: ; preds = %71
%79 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%80 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i8* %79)
br label %55
81: ; preds = %71
%82 = load i8*, i8** %10
%83 = getelementptr inbounds i8, i8* %82, i32 1
store i8* %83, i8** %10
store i8 0, i8* %82
%84 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%85 = call i64 @atol(i8* %84)
store i64 %85, i64* %13
%86 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 0, i64 0
%87 = load i64, i64* %13
%88 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %86, i32 100, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i64 %87)
%89 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 0, i64 0
%90 = load i32, i32* @O_WRONLY
%91 = call i32 @open(i8* %89, i32 %90, i32 0)
store i32 %91, i32* %7
%92 = icmp sgt i32 0, %91
br i1 %92, label %93, label %98
93: ; preds = %81
%94 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 0, i64 0
%95 = load i64, i64* @errno
%96 = call i8* @strerror(i64 %95)
%97 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %94, i8* %96)
br label %55
98: ; preds = %81
%99 = load i8*, i8** %10
%100 = load i32, i32* @O_RDONLY
%101 = call i32 @open(i8* %99, i32 %100, i32 0)
store i32 %101, i32* %9
%102 = icmp sgt i32 0, %101
br i1 %102, label %103, label %123
103: ; preds = %98
%104 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%105 = load i32, i32* %14
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds i8, i8* %104, i64 %106
%108 = load i32, i32* %14
%109 = sext i32 %108 to i64
%110 = sub i64 100, %109
%111 = trunc i64 %110 to i32
%112 = load i64, i64* @errno
%113 = call i8* @strerror(i64 %112)
%114 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %107, i32 %111, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8* %113)
%115 = load i8*, i8** %10
%116 = call i32 @strlen(i8* %115)
store i32 %116, i32* %14
%117 = load i32, i32* %7
%118 = load i8*, i8** %10
%119 = load i32, i32* %14
%120 = call i32 @write(i32 %117, i8* %118, i32 %119)
%121 = load i32, i32* %7
%122 = call i32 @close(i32 %121)
br label %139
123: ; preds = %98
br label %124
124: ; preds = %129, %123
%125 = load i32, i32* %9
%126 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%127 = call i32 @read(i32 %125, i8* %126, i32 100)
store i32 %127, i32* %14
%128 = icmp slt i32 0, %127
br i1 %128, label %129, label %134
129: ; preds = %124
%130 = load i32, i32* %7
%131 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%132 = load i32, i32* %14
%133 = call i32 @write(i32 %130, i8* %131, i32 %132)
br label %124
134: ; preds = %124
%135 = load i32, i32* %9
%136 = call i32 @close(i32 %135)
%137 = load i32, i32* %7
%138 = call i32 @close(i32 %137)
br label %139
139: ; preds = %134, %103
br label %55
140: ; preds = %55
%141 = load i32, i32* @EXIT_SUCCESS
%142 = call i32 @exit(i32 %141)
unreachable
}

LLVM IR (-O2):
@.str = [15 x i8] c"/tmp/fifo.serv\00"
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@S_IROTH = global i32 0
@EEXIST = global i64 0
@errno = global i64 0
@.str.1 = [20 x i8] c"mkfifo %s error: %s\00"
@EXIT_FAILURE = global i32 0
@O_RDONLY = global i32 0
@.str.2 = [18 x i8] c"open %s error: %s\00"
@O_WRONLY = global i32 0
@.str.3 = [40 x i8] c"** request: %s, error input from client\00"
@.str.4 = [14 x i8] c"/tmp/fifo.%ld\00"
@.str.5 = [18 x i8] c": can't open, %s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%7 = load i32, i32* @S_IRUSR
%8 = load i32, i32* @S_IWUSR
%9 = or i32 %8, %7
%10 = load i32, i32* @S_IRGRP
%11 = or i32 %9, %10
%12 = load i32, i32* @S_IROTH
%13 = or i32 %11, %12
%14 = tail call i64 @mkfifo(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = icmp slt i64 %14, 0
br i1 %15, label %16, label %25
16: ; preds = %2
%17 = load i64, i64* @EEXIST
%18 = load i64, i64* @errno
%19 = icmp eq i64 %17, %18
br i1 %19, label %25, label %20
20: ; preds = %16
%21 = tail call i8* @strerror(i64 %18)
%22 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %21)
%23 = load i32, i32* @EXIT_FAILURE
%24 = tail call i32 @exit(i32 %23)
unreachable
25: ; preds = %16, %2
%26 = load i32, i32* @O_RDONLY
%27 = tail call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %26, i32 0)
%28 = icmp slt i32 %27, 0
br i1 %28, label %29, label %35
29: ; preds = %25
%30 = load i64, i64* @errno
%31 = tail call i8* @strerror(i64 %30)
%32 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %31)
%33 = load i32, i32* @EXIT_FAILURE
%34 = tail call i32 @exit(i32 %33)
unreachable
35: ; preds = %25
%36 = load i32, i32* @O_WRONLY
%37 = tail call i32 @open(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %36, i32 0)
%38 = icmp slt i32 %37, 0
br i1 %38, label %42, label %39
39: ; preds = %35
%40 = call i32 @read(i32 %27, i8* %5, i32 100)
%41 = icmp sgt i32 %40, 0
br i1 %41, label %48, label %99
42: ; preds = %35
%43 = load i64, i64* @errno
%44 = tail call i8* @strerror(i64 %43)
%45 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %44)
%46 = load i32, i32* @EXIT_FAILURE
%47 = tail call i32 @exit(i32 %46)
unreachable
48: ; preds = %39, %62
%49 = phi i32 [ %63, %62 ], [ %40, %39 ]
%50 = add nsw i32 %49, -1
%51 = zext i32 %50 to i64
%52 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %51
%53 = load i8, i8* %52
%54 = icmp eq i8 %53, 10
%55 = select i1 %54, i32 %50, i32 %49
%56 = zext i32 %55 to i64
%57 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 %56
store i8 0, i8* %57
%58 = call i8* @strchr(i8* %5, i8 signext 32)
%59 = icmp eq i8* %58, null
br i1 %59, label %60, label %65
60: ; preds = %48
%61 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0), i8* %5)
br label %62
62: ; preds = %83, %96, %60, %72
%63 = call i32 @read(i32 %27, i8* %5, i32 100)
%64 = icmp sgt i32 %63, 0
br i1 %64, label %48, label %99
65: ; preds = %48
%66 = getelementptr inbounds i8, i8* %58, i64 1
store i8 0, i8* %58
%67 = call i64 @atol(i8* %5)
%68 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %6, i32 100, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i64 %67)
%69 = load i32, i32* @O_WRONLY
%70 = call i32 @open(i8* %6, i32 %69, i32 0)
%71 = icmp slt i32 %70, 0
br i1 %71, label %72, label %76
72: ; preds = %65
%73 = load i64, i64* @errno
%74 = call i8* @strerror(i64 %73)
%75 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %6, i8* %74)
br label %62
76: ; preds = %65
%77 = load i32, i32* @O_RDONLY
%78 = call i32 @open(i8* %66, i32 %77, i32 0)
%79 = icmp slt i32 %78, 0
br i1 %79, label %83, label %80
80: ; preds = %76
%81 = call i32 @read(i32 %78, i8* %5, i32 100)
%82 = icmp sgt i32 %81, 0
br i1 %82, label %91, label %96
83: ; preds = %76
%84 = sub nsw i32 100, %55
%85 = load i64, i64* @errno
%86 = call i8* @strerror(i64 %85)
%87 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %57, i32 %84, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0), i8* %86)
%88 = call i32 @strlen(i8* %66)
%89 = call i32 @write(i32 %70, i8* %66, i32 %88)
%90 = call i32 @close(i32 %70)
br label %62
91: ; preds = %80, %91
%92 = phi i32 [ %94, %91 ], [ %81, %80 ]
%93 = call i32 @write(i32 %70, i8* %5, i32 %92)
%94 = call i32 @read(i32 %78, i8* %5, i32 100)
%95 = icmp sgt i32 %94, 0
br i1 %95, label %91, label %96
96: ; preds = %91, %80
%97 = call i32 @close(i32 %78)
%98 = call i32 @close(i32 %70)
br label %62
99: ; preds = %62, %39
%100 = load i32, i32* @EXIT_SUCCESS
%101 = call i32 @exit(i32 %100)
unreachable
}