#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 */
scalar_t__ EEXIST;
scalar_t__ EPERM;
int /*<<< orphan*/ S_IFIFO;
scalar_t__ errno;
scalar_t__ getenv(char *);
scalar_t__ mknod(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int main(int argc, char **argv) {
  if (argc < 2)
    return 125;
  if (mknod(argv[1], S_IFIFO, 0) < 0) {
    if (getenv("PANDORA_TEST_SUCCESS")) {
      perror("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/alip/pandora/refs/heads/master/tests/"
             "t007_mknod.c");
      return 1;
    } else if (getenv("PANDORA_TEST_EPERM") && errno == EPERM)
      return 0;
    else if (getenv("PANDORA_TEST_EEXIST") && errno == EEXIST)
      return 0;
    perror("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/alip/pandora/refs/heads/master/tests/"
           "t007_mknod.c");
    return 1;
  }
  return getenv("PANDORA_TEST_SUCCESS") ? 0 : 2;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    115c <main+0x2c>
movl   $0x7d,-0x4(%rbp)
jmp    1266 <main+0x136>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    0x2e65(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1040 <mknod@plt>
cmp    $0x0,%rax
jge    1246 <main+0x116>
lea    0xe7b(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     11ac <main+0x7c>
lea    0xe7a(%rip),%rdi
call   1050 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1266 <main+0x136>
lea    0xeee(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     11e8 <main+0xb8>
mov    0x2e0f(%rip),%rax
mov    (%rax),%rax
mov    0x2ded(%rip),%rcx
cmp    (%rcx),%rax
jne    11e8 <main+0xb8>
movl   $0x0,-0x4(%rbp)
jmp    1266 <main+0x136>
lea    0xec5(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     1224 <main+0xf4>
mov    0x2dd3(%rip),%rax
mov    (%rax),%rax
mov    0x2dd1(%rip),%rcx
cmp    (%rcx),%rax
jne    1224 <main+0xf4>
movl   $0x0,-0x4(%rbp)
jmp    1266 <main+0x136>
jmp    1229 <main+0xf9>
jmp    122e <main+0xfe>
lea    0xde0(%rip),%rdi
call   1050 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1266 <main+0x136>
lea    0xdb3(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rdx
mov    $0x2,%eax
xor    %ecx,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x7d,%eax
cmp    $0x2,%edi
jl     11cd <main+0x9d>
mov    0x8(%rsi),%rdi
mov    0x2e86(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1040 <mknod@plt>
mov    %rax,%rbx
lea    0xea3(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rcx
test   %rbx,%rbx
js     1176 <main+0x46>
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
add    %eax,%eax
jmp    11cd <main+0x9d>
test   %rcx,%rcx
jne    11cf <main+0x9f>
lea    0xf1f(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     11a4 <main+0x74>
mov    0x2e45(%rip),%rax
mov    (%rax),%rcx
mov    0x2e23(%rip),%rdx
xor    %eax,%eax
cmp    (%rdx),%rcx
je     11cd <main+0x9d>
lea    0xf09(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     11cf <main+0x9f>
mov    0x2e1c(%rip),%rax
mov    (%rax),%rcx
mov    0x2e1a(%rip),%rdx
xor    %eax,%eax
cmp    (%rdx),%rcx
jne    11cf <main+0x9f>
pop    %rbx
ret
lea    0xe3f(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@S_IFIFO = global i32 0
@.str = [21 x i8] c"PANDORA_TEST_SUCCESS\00"
@.str.1 = [140 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/alip/pandora/refs/heads/master/tests/t007_mknod.c\00"
@.str.2 = [19 x i8] c"PANDORA_TEST_EPERM\00"
@errno = global i64 0
@EPERM = global i64 0
@.str.3 = [20 x i8] c"PANDORA_TEST_EEXIST\00"
@EEXIST = global i64 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 2
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 125, i32* %3
br label %46
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = load i32, i32* @S_IFIFO
%14 = call i64 @mknod(i8* %12, i32 %13, i32 0)
%15 = icmp slt i64 %14, 0
br i1 %15, label %16, label %41
16: ; preds = %9
%17 = call i64 @getenv(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = call i32 @perror(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %46
21: ; preds = %16
%22 = call i64 @getenv(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %29
24: ; preds = %21
%25 = load i64, i64* @errno
%26 = load i64, i64* @EPERM
%27 = icmp eq i64 %25, %26
br i1 %27, label %28, label %29
28: ; preds = %24
store i32 0, i32* %3
br label %46
29: ; preds = %24, %21
%30 = call i64 @getenv(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%31 = icmp ne i64 %30, 0
br i1 %31, label %32, label %37
32: ; preds = %29
%33 = load i64, i64* @errno
%34 = load i64, i64* @EEXIST
%35 = icmp eq i64 %33, %34
br i1 %35, label %36, label %37
36: ; preds = %32
store i32 0, i32* %3
br label %46
37: ; preds = %32, %29
br label %38
38: ; preds = %37
br label %39
39: ; preds = %38
%40 = call i32 @perror(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %46
41: ; preds = %9
%42 = call i64 @getenv(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%43 = icmp ne i64 %42, 0
%44 = zext i1 %43 to i64
%45 = select i1 %43, i32 0, i32 2
store i32 %45, i32* %3
br label %46
46: ; preds = %41, %39, %36, %28, %19, %8
%47 = load i32, i32* %3
ret i32 %47
}

LLVM IR (-O2):
@S_IFIFO = global i32 0
@.str = [21 x i8] c"PANDORA_TEST_SUCCESS\00"
@.str.1 = [140 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/alip/pandora/refs/heads/master/tests/t007_mknod.c\00"
@.str.2 = [19 x i8] c"PANDORA_TEST_EPERM\00"
@errno = global i64 0
@EPERM = global i64 0
@.str.3 = [20 x i8] c"PANDORA_TEST_EEXIST\00"
@EEXIST = global i64 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %33, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = load i32, i32* @S_IFIFO
%8 = tail call i64 @mknod(i8* %6, i32 %7, i32 0)
%9 = icmp slt i64 %8, 0
%10 = tail call i64 @getenv(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %9, label %12, label %31
12: ; preds = %4
br i1 %11, label %15, label %13
13: ; preds = %12
%14 = tail call i32 @perror(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.1, i64 0, i64 0))
br label %33
15: ; preds = %12
%16 = tail call i64 @getenv(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i64 %16, 0
br i1 %17, label %22, label %18
18: ; preds = %15
%19 = load i64, i64* @errno
%20 = load i64, i64* @EPERM
%21 = icmp eq i64 %19, %20
br i1 %21, label %33, label %22
22: ; preds = %18, %15
%23 = tail call i64 @getenv(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %29, label %25
25: ; preds = %22
%26 = load i64, i64* @errno
%27 = load i64, i64* @EEXIST
%28 = icmp eq i64 %26, %27
br i1 %28, label %33, label %29
29: ; preds = %25, %22
%30 = tail call i32 @perror(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.1, i64 0, i64 0))
br label %33
31: ; preds = %4
%32 = select i1 %11, i32 2, i32 0
br label %33
33: ; preds = %25, %18, %2, %31, %29, %13
%34 = phi i32 [ 1, %13 ], [ 1, %29 ], [ %32, %31 ], [ 125, %2 ], [ 0, %18 ], [ 0, %25 ]
ret i32 %34
}