#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int promptInputChecker(int argc, char *argv[], FILE *textFile) {
  if (argc < 2) {
    printf("\nToo few parameters given\n");
    return 1;
  } else if (argc > 2) {
    printf("\nToo many parameters given\n");
    return 1;
  }
  if (textFile == NULL) {
    printf("\nTextfile used is NULL,unreadable, or does not exist\n");
    return 1;
  }
  int fclose(FILE * textFile);
  return 0;
}


x86 assembly (clang, -O0):
<promptInputChecker>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1145 <promptInputChecker+0x35>
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1196 <promptInputChecker+0x86>
cmpl   $0x2,-0x8(%rbp)
jle    1167 <promptInputChecker+0x57>
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1196 <promptInputChecker+0x86>
jmp    116c <promptInputChecker+0x5c>
cmpq   $0x0,-0x18(%rbp)
jne    118f <promptInputChecker+0x7f>
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1196 <promptInputChecker+0x86>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<promptInputChecker>:
cmp    $0x2,%edi
jge    111e <promptInputChecker+0xe>
lea    0xf34(%rip),%rdi
jmp    1138 <promptInputChecker+0x28>
jne    1128 <promptInputChecker+0x18>
xor    %eax,%eax
test   %rdx,%rdx
je     1131 <promptInputChecker+0x21>
ret
lea    0xf06(%rip),%rdi
jmp    1138 <promptInputChecker+0x28>
lea    0xec8(%rip),%rdi
push   %rax
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"\0AToo few parameters given\0A\00"
@.str.1 = [28 x i8] c"\0AToo many parameters given\0A\00"
@.str.2 = [54 x i8] c"\0ATextfile used is NULL,unreadable, or does not exist\0A\00"
define i32 @promptInputChecker(i32 %0, i8** %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i32*
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i32* %2, i32** %7
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 2
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %4
br label %24
12: ; preds = %3
%13 = load i32, i32* %5
%14 = icmp sgt i32 %13, 2
br i1 %14, label %15, label %17
15: ; preds = %12
%16 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %4
br label %24
17: ; preds = %12
br label %18
18: ; preds = %17
%19 = load i32*, i32** %7
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %23
21: ; preds = %18
%22 = call i32 @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %4
br label %24
23: ; preds = %18
store i32 0, i32* %4
br label %24
24: ; preds = %23, %21, %15, %10
%25 = load i32, i32* %4
ret i32 %25
}

LLVM IR (-O2):
@str = [53 x i8] c"\0ATextfile used is NULL,unreadable, or does not exist\00"
@str.3 = [27 x i8] c"\0AToo many parameters given\00"
@str.4 = [26 x i8] c"\0AToo few parameters given\00"
define i32 @promptInputChecker(i32 %0, i8** nocapture readnone %1, i32* readnone %2) {
%4 = icmp slt i32 %0, 2
br i1 %4, label %9, label %5
5: ; preds = %3
%6 = icmp eq i32 %0, 2
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = icmp eq i32* %2, null
br i1 %8, label %9, label %12
9: ; preds = %7, %5, %3
%10 = phi i8* [ getelementptr inbounds ([26 x i8], [26 x i8]* @str.4, i64 0, i64 0), %3 ], [ getelementptr inbounds ([27 x i8], [27 x i8]* @str.3, i64 0, i64 0), %5 ], [ getelementptr inbounds ([53 x i8], [53 x i8]* @str, i64 0, i64 0), %7 ]
%11 = tail call i32 @puts(i8* dereferenceable(1) %10)
br label %12
12: ; preds = %9, %7
%13 = phi i32 [ 0, %7 ], [ 1, %9 ]
ret i32 %13
}