#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;
scalar_t__ errno;
scalar_t__ getenv(char *);
scalar_t__ mkdir(char *, int);
int /*<<< orphan*/ perror(char *);
int main(int argc, char **argv) {
  if (argc < 2)
    return 125;
  if (mkdir(argv[1], 0000) < 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/"
             "t006_mkdir.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/"
           "t006_mkdir.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    125d <main+0x12d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %esi,%esi
call   1040 <mkdir@plt>
cmp    $0x0,%rax
jge    123d <main+0x10d>
lea    0xe84(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     11a3 <main+0x73>
lea    0xe83(%rip),%rdi
call   1050 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    125d <main+0x12d>
lea    0xef7(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     11df <main+0xaf>
mov    0x2e18(%rip),%rax
mov    (%rax),%rax
mov    0x2dfe(%rip),%rcx
cmp    (%rcx),%rax
jne    11df <main+0xaf>
movl   $0x0,-0x4(%rbp)
jmp    125d <main+0x12d>
lea    0xece(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     121b <main+0xeb>
mov    0x2ddc(%rip),%rax
mov    (%rax),%rax
mov    0x2dda(%rip),%rcx
cmp    (%rcx),%rax
jne    121b <main+0xeb>
movl   $0x0,-0x4(%rbp)
jmp    125d <main+0x12d>
jmp    1220 <main+0xf0>
jmp    1225 <main+0xf5>
lea    0xde9(%rip),%rdi
call   1050 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    125d <main+0x12d>
lea    0xdbc(%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     11c4 <main+0x94>
mov    0x8(%rsi),%rdi
xor    %esi,%esi
call   1040 <mkdir@plt>
mov    %rax,%rbx
lea    0xeac(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rcx
test   %rbx,%rbx
js     116d <main+0x3d>
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
add    %eax,%eax
jmp    11c4 <main+0x94>
test   %rcx,%rcx
jne    11c6 <main+0x96>
lea    0xf28(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     119b <main+0x6b>
mov    0x2e4e(%rip),%rax
mov    (%rax),%rcx
mov    0x2e34(%rip),%rdx
xor    %eax,%eax
cmp    (%rdx),%rcx
je     11c4 <main+0x94>
lea    0xf12(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     11c6 <main+0x96>
mov    0x2e25(%rip),%rax
mov    (%rax),%rcx
mov    0x2e23(%rip),%rdx
xor    %eax,%eax
cmp    (%rdx),%rcx
jne    11c6 <main+0x96>
pop    %rbx
ret
lea    0xe48(%rip),%rdi
call   1050 <perror@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.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/t006_mkdir.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 %45
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i64 @mkdir(i8* %12, i32 0)
%14 = icmp slt i64 %13, 0
br i1 %14, label %15, label %40
15: ; preds = %9
%16 = call i64 @getenv(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %15
%19 = 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 %45
20: ; preds = %15
%21 = call i64 @getenv(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %28
23: ; preds = %20
%24 = load i64, i64* @errno
%25 = load i64, i64* @EPERM
%26 = icmp eq i64 %24, %25
br i1 %26, label %27, label %28
27: ; preds = %23
store i32 0, i32* %3
br label %45
28: ; preds = %23, %20
%29 = call i64 @getenv(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %36
31: ; preds = %28
%32 = load i64, i64* @errno
%33 = load i64, i64* @EEXIST
%34 = icmp eq i64 %32, %33
br i1 %34, label %35, label %36
35: ; preds = %31
store i32 0, i32* %3
br label %45
36: ; preds = %31, %28
br label %37
37: ; preds = %36
br label %38
38: ; preds = %37
%39 = 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 %45
40: ; preds = %9
%41 = call i64 @getenv(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%42 = icmp ne i64 %41, 0
%43 = zext i1 %42 to i64
%44 = select i1 %42, i32 0, i32 2
store i32 %44, i32* %3
br label %45
45: ; preds = %40, %38, %35, %27, %18, %8
%46 = load i32, i32* %3
ret i32 %46
}

LLVM IR (-O2):
@.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/t006_mkdir.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 %32, label %4
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @mkdir(i8* %6, i32 0)
%8 = icmp slt i64 %7, 0
%9 = tail call i64 @getenv(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %8, label %11, label %30
11: ; preds = %4
br i1 %10, label %14, label %12
12: ; preds = %11
%13 = tail call i32 @perror(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.1, i64 0, i64 0))
br label %32
14: ; preds = %11
%15 = tail call i64 @getenv(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %21, label %17
17: ; preds = %14
%18 = load i64, i64* @errno
%19 = load i64, i64* @EPERM
%20 = icmp eq i64 %18, %19
br i1 %20, label %32, label %21
21: ; preds = %17, %14
%22 = tail call i64 @getenv(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %28, label %24
24: ; preds = %21
%25 = load i64, i64* @errno
%26 = load i64, i64* @EEXIST
%27 = icmp eq i64 %25, %26
br i1 %27, label %32, label %28
28: ; preds = %24, %21
%29 = tail call i32 @perror(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str.1, i64 0, i64 0))
br label %32
30: ; preds = %4
%31 = select i1 %10, i32 2, i32 0
br label %32
32: ; preds = %24, %17, %2, %30, %28, %12
%33 = phi i32 [ 1, %12 ], [ 1, %28 ], [ %31, %30 ], [ 125, %2 ], [ 0, %17 ], [ 0, %24 ]
ret i32 %33
}