#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ S_IFIFO;
scalar_t__ chdir(char *);
scalar_t__ mknod(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char **argv) {
  char *long_dir, *fname;
  if (3 > argc)
    return EXIT_FAILURE;
  else {
    long_dir = argv[1];
    fname = argv[2];
  }
  for (int i = 0; i < 64; i++) {
    if (0 > chdir(long_dir))
      return EXIT_FAILURE;
  }
  if (0 > mknod(fname, S_IFIFO, 0))
    return EXIT_FAILURE;
  else
    return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x3,%eax
cmp    -0x8(%rbp),%eax
jle    1155 <main+0x35>
mov    0x2e95(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11f8 <main+0xd8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x40,-0x24(%rbp)
jge    11b9 <main+0x99>
mov    -0x18(%rbp),%rdi
call   1030 <chdir@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jle    11a6 <main+0x86>
mov    0x2e44(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11f8 <main+0xd8>
jmp    11ab <main+0x8b>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1174 <main+0x54>
mov    -0x20(%rbp),%rdi
mov    0x2e0c(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1040 <mknod@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jle    11ec <main+0xcc>
mov    0x2dfe(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11f8 <main+0xd8>
mov    0x2de5(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    0x2eb2(%rip),%r15
cmp    $0x3,%edi
jl     117a <main+0x5a>
mov    0x8(%rsi),%rbx
mov    0x10(%rsi),%r14
mov    $0x40,%ebp
mov    %rbx,%rdi
call   1030 <chdir@plt>
test   %rax,%rax
js     117a <main+0x5a>
add    $0xffffffff,%ebp
jne    1140 <main+0x20>
mov    0x2e77(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
xor    %edx,%edx
call   1040 <mknod@plt>
test   %rax,%rax
jns    1173 <main+0x53>
mov    0x2e6f(%rip),%r15
jmp    117a <main+0x5a>
mov    0x2e5e(%rip),%r15
mov    (%r15),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@S_IFIFO = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%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 sgt i32 3, %9
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = load i32, i32* @EXIT_FAILURE
store i32 %12, i32* %3
br label %43
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
store i8* %16, i8** %6
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
store i8* %19, i8** %7
br label %20
20: ; preds = %13
store i32 0, i32* %8
br label %21
21: ; preds = %31, %20
%22 = load i32, i32* %8
%23 = icmp slt i32 %22, 64
br i1 %23, label %24, label %34
24: ; preds = %21
%25 = load i8*, i8** %6
%26 = call i64 @chdir(i8* %25)
%27 = icmp sgt i64 0, %26
br i1 %27, label %28, label %30
28: ; preds = %24
%29 = load i32, i32* @EXIT_FAILURE
store i32 %29, i32* %3
br label %43
30: ; preds = %24
br label %31
31: ; preds = %30
%32 = load i32, i32* %8
%33 = add nsw i32 %32, 1
store i32 %33, i32* %8
br label %21
34: ; preds = %21
%35 = load i8*, i8** %7
%36 = load i32, i32* @S_IFIFO
%37 = call i64 @mknod(i8* %35, i32 %36, i32 0)
%38 = icmp sgt i64 0, %37
br i1 %38, label %39, label %41
39: ; preds = %34
%40 = load i32, i32* @EXIT_FAILURE
store i32 %40, i32* %3
br label %43
41: ; preds = %34
%42 = load i32, i32* @EXIT_SUCCESS
store i32 %42, i32* %3
br label %43
43: ; preds = %41, %39, %28, %11
%44 = load i32, i32* %3
ret i32 %44
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@S_IFIFO = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %21, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = getelementptr inbounds i8*, i8** %1, i64 2
%8 = load i8*, i8** %7
br label %12
9: ; preds = %12
%10 = add nuw nsw i32 %13, 1
%11 = icmp eq i32 %10, 64
br i1 %11, label %16, label %12
12: ; preds = %4, %9
%13 = phi i32 [ 0, %4 ], [ %10, %9 ]
%14 = tail call i64 @chdir(i8* %6)
%15 = icmp slt i64 %14, 0
br i1 %15, label %21, label %9
16: ; preds = %9
%17 = load i32, i32* @S_IFIFO
%18 = tail call i64 @mknod(i8* %8, i32 %17, i32 0)
%19 = icmp slt i64 %18, 0
%20 = select i1 %19, i32* @EXIT_FAILURE, i32* @EXIT_SUCCESS
br label %21
21: ; preds = %12, %16, %2
%22 = phi i32* [ @EXIT_FAILURE, %2 ], [ %20, %16 ], [ @EXIT_FAILURE, %12 ]
%23 = load i32, i32* %22
ret i32 %23
}