#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 scalar_t__ __mode_t;

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
scalar_t__ mkfifo(char *, scalar_t__);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
scalar_t__ umask(int /*<<< orphan*/);
int main(int argc, char **argv) {
  __mode_t mask = umask(0);
  if (argc < 2) {
    fputs("Usage: mp <fifo>\n", stderr);
    return 1;
  }
  ++argv;
  if (mkfifo(*argv, 0777 - mask) != 0) {
    printf("mf: %s: ", *argv);
    (void)fflush(stdout);
    perror("");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
call   1060 <umask@plt>
mov    %rax,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    11ac <main+0x4c>
mov    0x2e4e(%rip),%rax
mov    (%rax),%esi
lea    0xe65(%rip),%rdi
call   1040 <fputs@plt>
movl   $0x1,-0x4(%rbp)
jmp    1217 <main+0xb7>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    $0x1ff,%esi
sub    -0x18(%rbp),%rsi
call   1050 <mkfifo@plt>
cmp    $0x0,%rax
je     1210 <main+0xb0>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe2d(%rip),%rdi
call   1030 <printf@plt>
mov    0x2de7(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
lea    0xe12(%rip),%rdi
call   1080 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1217 <main+0xb7>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
xor    %ebx,%ebx
xor    %edi,%edi
call   1060 <umask@plt>
cmp    $0x1,%ebp
jg     1193 <main+0x33>
mov    0x2e62(%rip),%rax
mov    (%rax),%esi
lea    0xe79(%rip),%rdi
call   1040 <fputs@plt>
mov    $0x1,%ebx
jmp    11a9 <main+0x49>
mov    0x8(%r14),%rdi
mov    $0x1ff,%esi
sub    %rax,%rsi
call   1050 <mkfifo@plt>
test   %rax,%rax
jne    11b0 <main+0x50>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x8(%r14),%rsi
lea    0xe57(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e11(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
lea    0xe3c(%rip),%rdi
call   1080 <perror@plt>
jmp    118c <main+0x2c>

LLVM IR (-O0):
@.str = [18 x i8] c"Usage: mp <fifo>\0A\00"
@stderr = global i32 0
@.str.1 = [9 x i8] c"mf: %s: \00"
@stdout = global i32 0
@.str.2 = [1 x i8] zeroinitializer
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i64 @umask(i32 0)
store i64 %7, i64* %6
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i32, i32* @stderr
%12 = call i32 @fputs(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %11)
store i32 1, i32* %3
br label %30
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i32 1
store i8** %15, i8*** %5
%16 = load i8**, i8*** %5
%17 = load i8*, i8** %16
%18 = load i64, i64* %6
%19 = sub nsw i64 511, %18
%20 = call i64 @mkfifo(i8* %17, i64 %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %29
22: ; preds = %13
%23 = load i8**, i8*** %5
%24 = load i8*, i8** %23
%25 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %24)
%26 = load i32, i32* @stdout
%27 = call i32 @fflush(i32 %26)
%28 = call i32 @perror(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %30
29: ; preds = %13
store i32 0, i32* %3
br label %30
30: ; preds = %29, %22, %10
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
@.str = [18 x i8] c"Usage: mp <fifo>\0A\00"
@stderr = global i32 0
@.str.1 = [9 x i8] c"mf: %s: \00"
@stdout = global i32 0
@.str.2 = [1 x i8] zeroinitializer
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i64 @umask(i32 0)
%4 = icmp slt i32 %0, 2
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fputs(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %20
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = sub nsw i64 511, %3
%12 = tail call i64 @mkfifo(i8* %10, i64 %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %20, label %14
14: ; preds = %8
%15 = load i8*, i8** %9
%16 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %15)
%17 = load i32, i32* @stdout
%18 = tail call i32 @fflush(i32 %17)
%19 = tail call i32 @perror(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.2, i64 0, i64 0))
br label %20
20: ; preds = %8, %14, %5
%21 = phi i32 [ 1, %5 ], [ 1, %14 ], [ 0, %8 ]
ret i32 %21
}