#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 */
unsigned int atoi(int /*<<< orphan*/ *);
int /*<<< orphan*/ fatalError(char *);
int /*<<< orphan*/ *getenv(char *);
int checkEnvPHI(unsigned int *NLOOP, unsigned int *smin, unsigned int *smed,
                unsigned int *smax) {
  if (getenv("NLOOP_PHI_MAX") != NULL) {
    if (atoi(getenv("NLOOP_PHI_MAX")) <= 0)
      fatalError("NLOOP_PHI_MAX must be a positive integer");
    else
      *NLOOP = atoi(getenv("NLOOP_PHI_MAX"));
  }
  if (getenv("MIN_PHI_SIZE") != NULL) {
    if (atoi(getenv("MIN_PHI_SIZE")) <= 0)
      fatalError("MIN_PHI_SIZE must be a positive integer");
    else
      *smin = atoi(getenv("MIN_PHI_SIZE"));
  }
  if (getenv("MED_PHI_SIZE") != NULL) {
    if (atoi(getenv("MED_PHI_SIZE")) <= 0)
      fatalError("MED_PHI_SIZE must be a positive integer");
    else
      *smed = atoi(getenv("MED_PHI_SIZE"));
  }
  if (getenv("MAX_PHI_SIZE") != NULL) {
    if (atoi(getenv("MAX_PHI_SIZE")) <= 0)
      fatalError("MAX_PHI_SIZE must be a positive integer");
    else
      *smax = atoi(getenv("MAX_PHI_SIZE"));
  }
  return 0;
}


x86 assembly (clang, -O0):
<checkEnvPHI>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    0xeb1(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     11ad <checkEnvPHI+0x7d>
lea    0xe9b(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rdi
call   1050 <atoi@plt>
cmp    $0x0,%eax
ja     118c <checkEnvPHI+0x5c>
lea    0xe8c(%rip),%rdi
call   1040 <fatalError@plt>
jmp    11a8 <checkEnvPHI+0x78>
lea    0xe6d(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rdi
call   1050 <atoi@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
jmp    11ad <checkEnvPHI+0x7d>
lea    0xe83(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     1212 <checkEnvPHI+0xe2>
lea    0xe6d(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rdi
call   1050 <atoi@plt>
cmp    $0x0,%eax
ja     11f1 <checkEnvPHI+0xc1>
lea    0xe5d(%rip),%rdi
call   1040 <fatalError@plt>
jmp    120d <checkEnvPHI+0xdd>
lea    0xe3f(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rdi
call   1050 <atoi@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
jmp    1212 <checkEnvPHI+0xe2>
lea    0xe53(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     1277 <checkEnvPHI+0x147>
lea    0xe3d(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rdi
call   1050 <atoi@plt>
cmp    $0x0,%eax
ja     1256 <checkEnvPHI+0x126>
lea    0xe2d(%rip),%rdi
call   1040 <fatalError@plt>
jmp    1272 <checkEnvPHI+0x142>
lea    0xe0f(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rdi
call   1050 <atoi@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
jmp    1277 <checkEnvPHI+0x147>
lea    0xe23(%rip),%rdi
call   1030 <getenv@plt>
cmp    $0x0,%rax
je     12dc <checkEnvPHI+0x1ac>
lea    0xe0d(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rdi
call   1050 <atoi@plt>
cmp    $0x0,%eax
ja     12bb <checkEnvPHI+0x18b>
lea    0xdfd(%rip),%rdi
call   1040 <fatalError@plt>
jmp    12d7 <checkEnvPHI+0x1a7>
lea    0xddf(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,%rdi
call   1050 <atoi@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
jmp    12dc <checkEnvPHI+0x1ac>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkEnvPHI>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
lea    0xeb5(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1171 <checkEnvPHI+0x41>
mov    %rax,%rdi
call   1050 <atoi@plt>
test   %eax,%eax
je     1165 <checkEnvPHI+0x35>
mov    %eax,(%rbx)
jmp    1171 <checkEnvPHI+0x41>
lea    0xea2(%rip),%rdi
call   1040 <fatalError@plt>
lea    0xebf(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     11a0 <checkEnvPHI+0x70>
mov    %rax,%rdi
call   1050 <atoi@plt>
test   %eax,%eax
je     1194 <checkEnvPHI+0x64>
mov    %eax,(%r12)
jmp    11a0 <checkEnvPHI+0x70>
lea    0xea9(%rip),%rdi
call   1040 <fatalError@plt>
lea    0xec5(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     11ce <checkEnvPHI+0x9e>
mov    %rax,%rdi
call   1050 <atoi@plt>
test   %eax,%eax
je     11c2 <checkEnvPHI+0x92>
mov    %eax,(%r15)
jmp    11ce <checkEnvPHI+0x9e>
lea    0xeb0(%rip),%rdi
call   1040 <fatalError@plt>
lea    0xecc(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     11fc <checkEnvPHI+0xcc>
mov    %rax,%rdi
call   1050 <atoi@plt>
test   %eax,%eax
je     11f0 <checkEnvPHI+0xc0>
mov    %eax,(%r14)
jmp    11fc <checkEnvPHI+0xcc>
lea    0xeb7(%rip),%rdi
call   1040 <fatalError@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [14 x i8] c"NLOOP_PHI_MAX\00"
@.str.1 = [41 x i8] c"NLOOP_PHI_MAX must be a positive integer\00"
@.str.2 = [13 x i8] c"MIN_PHI_SIZE\00"
@.str.3 = [40 x i8] c"MIN_PHI_SIZE must be a positive integer\00"
@.str.4 = [13 x i8] c"MED_PHI_SIZE\00"
@.str.5 = [40 x i8] c"MED_PHI_SIZE must be a positive integer\00"
@.str.6 = [13 x i8] c"MAX_PHI_SIZE\00"
@.str.7 = [40 x i8] c"MAX_PHI_SIZE must be a positive integer\00"
define i32 @checkEnvPHI(i32* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%9 = call i32* @getenv(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%10 = icmp ne i32* %9, null
br i1 %10, label %11, label %22
11: ; preds = %4
%12 = call i32* @getenv(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @atoi(i32* %12)
%14 = icmp ule i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = call i32 @fatalError(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
br label %21
17: ; preds = %11
%18 = call i32* @getenv(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @atoi(i32* %18)
%20 = load i32*, i32** %5
store i32 %19, i32* %20
br label %21
21: ; preds = %17, %15
br label %22
22: ; preds = %21, %4
%23 = call i32* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp ne i32* %23, null
br i1 %24, label %25, label %36
25: ; preds = %22
%26 = call i32* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%27 = call i32 @atoi(i32* %26)
%28 = icmp ule i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = call i32 @fatalError(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0))
br label %35
31: ; preds = %25
%32 = call i32* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%33 = call i32 @atoi(i32* %32)
%34 = load i32*, i32** %6
store i32 %33, i32* %34
br label %35
35: ; preds = %31, %29
br label %36
36: ; preds = %35, %22
%37 = call i32* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%38 = icmp ne i32* %37, null
br i1 %38, label %39, label %50
39: ; preds = %36
%40 = call i32* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%41 = call i32 @atoi(i32* %40)
%42 = icmp ule i32 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %39
%44 = call i32 @fatalError(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0))
br label %49
45: ; preds = %39
%46 = call i32* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%47 = call i32 @atoi(i32* %46)
%48 = load i32*, i32** %7
store i32 %47, i32* %48
br label %49
49: ; preds = %45, %43
br label %50
50: ; preds = %49, %36
%51 = call i32* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
%52 = icmp ne i32* %51, null
br i1 %52, label %53, label %64
53: ; preds = %50
%54 = call i32* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
%55 = call i32 @atoi(i32* %54)
%56 = icmp ule i32 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %53
%58 = call i32 @fatalError(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0))
br label %63
59: ; preds = %53
%60 = call i32* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
%61 = call i32 @atoi(i32* %60)
%62 = load i32*, i32** %8
store i32 %61, i32* %62
br label %63
63: ; preds = %59, %57
br label %64
64: ; preds = %63, %50
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"NLOOP_PHI_MAX\00"
@.str.1 = [41 x i8] c"NLOOP_PHI_MAX must be a positive integer\00"
@.str.2 = [13 x i8] c"MIN_PHI_SIZE\00"
@.str.3 = [40 x i8] c"MIN_PHI_SIZE must be a positive integer\00"
@.str.4 = [13 x i8] c"MED_PHI_SIZE\00"
@.str.5 = [40 x i8] c"MED_PHI_SIZE must be a positive integer\00"
@.str.6 = [13 x i8] c"MAX_PHI_SIZE\00"
@.str.7 = [40 x i8] c"MAX_PHI_SIZE must be a positive integer\00"
define i32 @checkEnvPHI(i32* nocapture writeonly %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
%5 = tail call i32* @getenv(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %13, label %7
7: ; preds = %4
%8 = tail call i32 @atoi(i32* %5)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = tail call i32 @fatalError(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
br label %13
12: ; preds = %7
store i32 %8, i32* %0
br label %13
13: ; preds = %10, %12, %4
%14 = tail call i32* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%15 = icmp eq i32* %14, null
br i1 %15, label %22, label %16
16: ; preds = %13
%17 = tail call i32 @atoi(i32* %14)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %16
%20 = tail call i32 @fatalError(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0))
br label %22
21: ; preds = %16
store i32 %17, i32* %1
br label %22
22: ; preds = %19, %21, %13
%23 = tail call i32* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%24 = icmp eq i32* %23, null
br i1 %24, label %31, label %25
25: ; preds = %22
%26 = tail call i32 @atoi(i32* %23)
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %30
28: ; preds = %25
%29 = tail call i32 @fatalError(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0))
br label %31
30: ; preds = %25
store i32 %26, i32* %2
br label %31
31: ; preds = %28, %30, %22
%32 = tail call i32* @getenv(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
%33 = icmp eq i32* %32, null
br i1 %33, label %40, label %34
34: ; preds = %31
%35 = tail call i32 @atoi(i32* %32)
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %34
%38 = tail call i32 @fatalError(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.7, i64 0, i64 0))
br label %40
39: ; preds = %34
store i32 %35, i32* %3
br label %40
40: ; preds = %37, %39, %31
ret i32 0
}