#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 /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ strcmp(char const *, char *);
int checkArgs(int argc, const char *arg2) {
  switch (argc) {
  case 4:
    if ((strcmp(arg2, "-e") != 0) && (strcmp(arg2, "-d") != 0)) {
      printf("Please use \'-e\' or \'-d\'\n");
      return -1;
    }
    break;
  default:
    printf("Too many arguments\n");
    return -2;
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<checkArgs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sub    $0x4,%eax
jne    118f <checkArgs+0x6f>
jmp    1140 <checkArgs+0x20>
mov    -0x10(%rbp),%rdi
lea    0xeb5(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
je     118a <checkArgs+0x6a>
mov    -0x10(%rbp),%rdi
lea    0xe9f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
je     118a <checkArgs+0x6a>
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    11ae <checkArgs+0x8e>
jmp    11a7 <checkArgs+0x87>
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    11ae <checkArgs+0x8e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkArgs>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x4,%edi
jne    1161 <checkArgs+0x41>
mov    %rsi,%rbx
lea    0xece(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
xor    %ebp,%ebp
test   %eax,%eax
je     1172 <checkArgs+0x52>
lea    0xebc(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     1172 <checkArgs+0x52>
mov    $0xffffffff,%ebp
lea    0xeba(%rip),%rdi
jmp    116d <checkArgs+0x4d>
mov    $0xfffffffe,%ebp
lea    0xe99(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"-e\00"
@.str.1 = [3 x i8] c"-d\00"
@.str.2 = [25 x i8] c"Please use '-e' or '-d'\0A\00"
@.str.3 = [20 x i8] c"Too many arguments\0A\00"
define i32 @checkArgs(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = load i32, i32* %4
switch i32 %6, label %18 [
i32 4, label %7
]
7: ; preds = %2
%8 = load i8*, i8** %5
%9 = call i32 @strcmp(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %17
11: ; preds = %7
%12 = load i8*, i8** %5
%13 = call i32 @strcmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
store i32 -1, i32* %3
br label %21
17: ; preds = %11, %7
br label %20
18: ; preds = %2
%19 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
store i32 -2, i32* %3
br label %21
20: ; preds = %17
store i32 0, i32* %3
br label %21
21: ; preds = %20, %18, %15
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
@.str = [3 x i8] c"-e\00"
@.str.1 = [3 x i8] c"-d\00"
@str = [19 x i8] c"Too many arguments\00"
@str.4 = [24 x i8] c"Please use '-e' or '-d'\00"
define i32 @checkArgs(i32 %0, i8* nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %4, label %10
4: ; preds = %2
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %4
%8 = tail call i32 @strcmp(i8* dereferenceable(1) %1, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %2, %7
%11 = phi i8* [ getelementptr inbounds ([24 x i8], [24 x i8]* @str.4, i64 0, i64 0), %7 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0), %2 ]
%12 = phi i32 [ -1, %7 ], [ -2, %2 ]
%13 = tail call i32 @puts(i8* dereferenceable(1) %11)
br label %14
14: ; preds = %10, %7, %4
%15 = phi i32 [ 0, %4 ], [ 0, %7 ], [ %12, %10 ]
ret i32 %15
}