#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 /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ O_WRONLY;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int mkfifo(char *, int);
int open(char *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ unlink(char *);
int /*<<< orphan*/ write(int, char *, int);
int main(int argc, char **argv) {
  int sta;
  int fd;
  char buf[256];
  if (argc != 2) {
    printf("args error\n");
    exit(1);
  }
  sta = mkfifo(argv[1], 0750);
  if (sta < 0) {
    perror("mkpipe fail");
    exit(1);
  }
  fd = open(argv[1], O_WRONLY);
  if (fd < 0) {
    perror("open error");
    exit(1);
  }
  printf("Server: \n");
  printf("Input the message: ");
  fgets(buf, sizeof(buf), stdin);
  write(fd, buf, sizeof(buf));
  printf("Send!\n");
  unlink(argv[1]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11b9 <main+0x39>
lea    0xe56(%rip),%rdi
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    $0x1e8,%esi
call   1070 <mkfifo@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    11ee <main+0x6e>
lea    0xe2d(%rip),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2dd3(%rip),%rax
mov    (%rax),%esi
call   1080 <open@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1227 <main+0xa7>
lea    0xe00(%rip),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
lea    0xdf5(%rip),%rdi
call   1050 <printf@plt>
lea    0xdf3(%rip),%rdi
call   1050 <printf@plt>
lea    -0x120(%rbp),%rdi
mov    0x2d9b(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1060 <fgets@plt>
mov    -0x18(%rbp),%edi
lea    -0x120(%rbp),%rsi
mov    $0x100,%edx
call   1040 <write@plt>
lea    0xdcd(%rip),%rdi
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <unlink@plt>
xor    %eax,%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x100,%rsp
cmp    $0x2,%edi
jne    123c <main+0xac>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
mov    $0x1e8,%esi
call   1080 <mkfifo@plt>
test   %eax,%eax
js     1252 <main+0xc2>
mov    0x8(%rbx),%rdi
mov    0x2e08(%rip),%rax
mov    (%rax),%esi
call   1090 <open@plt>
test   %eax,%eax
js     125b <main+0xcb>
mov    %eax,%ebp
lea    0xe4b(%rip),%rdi
call   1040 <puts@plt>
lea    0xe2b(%rip),%rdi
call   1060 <printf@plt>
mov    0x2df0(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x100,%esi
call   1070 <fgets@plt>
mov    %ebp,%edi
mov    %r14,%rsi
mov    $0x100,%edx
call   1050 <write@plt>
lea    0xe14(%rip),%rdi
call   1040 <puts@plt>
mov    0x8(%rbx),%rdi
call   1030 <unlink@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
lea    0xdf7(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
lea    0xda7(%rip),%rdi
jmp    1262 <main+0xd2>
lea    0xdaa(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"args error\0A\00"
@.str.1 = [12 x i8] c"mkpipe fail\00"
@O_WRONLY = global i32 0
@.str.2 = [11 x i8] c"open error\00"
@.str.3 = [10 x i8] c"Server: \0A\00"
@.str.4 = [20 x i8] c"Input the message: \00"
@stdin = global i32 0
@.str.5 = [7 x i8] c"Send!\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [256 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 2
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @exit(i32 1)
unreachable
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @mkfifo(i8* %17, i32 488)
store i32 %18, i32* %6
%19 = load i32, i32* %6
%20 = icmp slt i32 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %14
%22 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %14
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = load i32, i32* @O_WRONLY
%29 = call i32 @open(i8* %27, i32 %28)
store i32 %29, i32* %7
%30 = load i32, i32* %7
%31 = icmp slt i32 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %24
%33 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%34 = call i32 @exit(i32 1)
unreachable
35: ; preds = %24
%36 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%37 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%38 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%39 = load i32, i32* @stdin
%40 = call i32 @fgets(i8* %38, i32 256, i32 %39)
%41 = load i32, i32* %7
%42 = getelementptr inbounds [256 x i8], [256 x i8]* %8, i64 0, i64 0
%43 = call i32 @write(i32 %41, i8* %42, i32 256)
%44 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 1
%47 = load i8*, i8** %46
%48 = call i32 @unlink(i8* %47)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"mkpipe fail\00"
@O_WRONLY = global i32 0
@.str.2 = [11 x i8] c"open error\00"
@.str.4 = [20 x i8] c"Input the message: \00"
@stdin = global i32 0
@str = [9 x i8] c"Server: \00"
@str.6 = [6 x i8] c"Send!\00"
@str.7 = [11 x i8] c"args error\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 2
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str.7, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @mkfifo(i8* %11, i32 488)
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %9
%15 = tail call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%16 = tail call i32 @exit(i32 1)
unreachable
17: ; preds = %9
%18 = load i8*, i8** %10
%19 = load i32, i32* @O_WRONLY
%20 = tail call i32 @open(i8* %18, i32 %19)
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %25
22: ; preds = %17
%23 = tail call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%24 = tail call i32 @exit(i32 1)
unreachable
25: ; preds = %17
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
%27 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
%28 = load i32, i32* @stdin
%29 = call i32 @fgets(i8* %4, i32 256, i32 %28)
%30 = call i32 @write(i32 %20, i8* %4, i32 256)
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.6, i64 0, i64 0))
%32 = load i8*, i8** %10
%33 = call i32 @unlink(i8* %32)
ret i32 0
}