#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 S_IRGRP;
int S_IROTH;
int S_IRUSR;
int S_IWGRP;
int S_IWOTH;
int S_IWUSR;
int mkfifo(char *, int);
int /*<<< orphan*/ perror(char *);
int main(int argc, char **argv) {
  if (argc < 2)
    return 1;
  int i, err = 0;
  for (i = 1; i < argc; i++) {
    int ret = mkfifo(
        argv[i], (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH));
    if (ret < 0) {
      perror("mkfifo");
      err = 1;
    }
  }
  return err;
}


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)
cmpl   $0x2,-0x8(%rbp)
jge    114c <main+0x2c>
movl   $0x1,-0x4(%rbp)
jmp    11e6 <main+0xc6>
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11e0 <main+0xc0>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    0x2e47(%rip),%rax
mov    (%rax),%esi
mov    0x2e5e(%rip),%rax
or     (%rax),%esi
mov    0x2e45(%rip),%rax
or     (%rax),%esi
mov    0x2e54(%rip),%rax
or     (%rax),%esi
mov    0x2e2b(%rip),%rax
or     (%rax),%esi
mov    0x2e0a(%rip),%rax
or     (%rax),%esi
call   1030 <mkfifo@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    11cd <main+0xad>
lea    0xe3f(%rip),%rdi
call   1040 <perror@plt>
movl   $0x1,-0x18(%rbp)
jmp    11d2 <main+0xb2>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115a <main+0x3a>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x1,0x4(%rsp)
cmp    $0x2,%edi
jge    114b <main+0x2b>
mov    0x4(%rsp),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rsi,%r12
mov    %edi,%ebp
movl   $0x0,0x4(%rsp)
mov    $0x1,%ebx
mov    0x2e84(%rip),%r13
mov    0x2e5d(%rip),%r14
mov    0x2e3e(%rip),%r15
jmp    1189 <main+0x69>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rbx
cmp    %rbx,%rbp
je     1138 <main+0x18>
mov    (%r12,%rbx,8),%rdi
mov    0x2e4c(%rip),%rax
mov    (%rax),%esi
mov    0x2e23(%rip),%rax
or     (%rax),%esi
mov    0x2e2a(%rip),%rax
or     (%rax),%esi
or     0x0(%r13),%esi
or     (%r14),%esi
or     (%r15),%esi
call   1030 <mkfifo@plt>
test   %eax,%eax
jns    1180 <main+0x60>
lea    0xe3e(%rip),%rdi
call   1040 <perror@plt>
movl   $0x1,0x4(%rsp)
jmp    1180 <main+0x60>

LLVM IR (-O0):
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@S_IROTH = global i32 0
@S_IWOTH = global i32 0
@.str = [7 x i8] c"mkfifo\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 i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 2
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 1, i32* %3
br label %45
12: ; preds = %2
store i32 0, i32* %7
store i32 1, i32* %6
br label %13
13: ; preds = %40, %12
%14 = load i32, i32* %6
%15 = load i32, i32* %4
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %43
17: ; preds = %13
%18 = load i8**, i8*** %5
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = load i32, i32* @S_IRUSR
%24 = load i32, i32* @S_IWUSR
%25 = or i32 %23, %24
%26 = load i32, i32* @S_IRGRP
%27 = or i32 %25, %26
%28 = load i32, i32* @S_IWGRP
%29 = or i32 %27, %28
%30 = load i32, i32* @S_IROTH
%31 = or i32 %29, %30
%32 = load i32, i32* @S_IWOTH
%33 = or i32 %31, %32
%34 = call i32 @mkfifo(i8* %22, i32 %33)
store i32 %34, i32* %8
%35 = load i32, i32* %8
%36 = icmp slt i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %17
%38 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %7
br label %39
39: ; preds = %37, %17
br label %40
40: ; preds = %39
%41 = load i32, i32* %6
%42 = add nsw i32 %41, 1
store i32 %42, i32* %6
br label %13
43: ; preds = %13
%44 = load i32, i32* %7
store i32 %44, i32* %3
br label %45
45: ; preds = %43, %11
%46 = load i32, i32* %3
ret i32 %46
}

LLVM IR (-O2):
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@S_IROTH = global i32 0
@S_IWOTH = global i32 0
@.str = [7 x i8] c"mkfifo\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %30, label %4
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %26
%7 = phi i64 [ 1, %4 ], [ %28, %26 ]
%8 = phi i32 [ 0, %4 ], [ %27, %26 ]
%9 = getelementptr inbounds i8*, i8** %1, i64 %7
%10 = load i8*, i8** %9
%11 = load i32, i32* @S_IRUSR
%12 = load i32, i32* @S_IWUSR
%13 = or i32 %12, %11
%14 = load i32, i32* @S_IRGRP
%15 = or i32 %13, %14
%16 = load i32, i32* @S_IWGRP
%17 = or i32 %15, %16
%18 = load i32, i32* @S_IROTH
%19 = or i32 %17, %18
%20 = load i32, i32* @S_IWOTH
%21 = or i32 %19, %20
%22 = tail call i32 @mkfifo(i8* %10, i32 %21)
%23 = icmp slt i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %6
%25 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
br label %26
26: ; preds = %24, %6
%27 = phi i32 [ 1, %24 ], [ %8, %6 ]
%28 = add nuw nsw i64 %7, 1
%29 = icmp eq i64 %28, %5
br i1 %29, label %30, label %6
30: ; preds = %26, %2
%31 = phi i32 [ 1, %2 ], [ %27, %26 ]
ret i32 %31
}