#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__ strcmp(char *, char *);
int testArgs(int argc, char **argv) {
  int currentIndex;
  if (argc == 1 ||
      (argc == 2 && (strcmp(argv[currentIndex], "-h") == 0 ||
                     strcmp(argv[currentIndex], "--help") == 0)) ||
      argc == 3)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<testArgs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     1181 <testArgs+0x71>
cmpl   $0x2,-0x8(%rbp)
jne    1177 <testArgs+0x67>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xeba(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     1181 <testArgs+0x71>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe9b(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     1181 <testArgs+0x71>
cmpl   $0x3,-0x8(%rbp)
jne    118d <testArgs+0x7d>
movl   $0x0,-0x4(%rbp)
jmp    1194 <testArgs+0x84>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testArgs>:
push   %r14
push   %rbx
push   %rax
xor    %ebx,%ebx
cmp    $0x1,%edi
je     1155 <testArgs+0x45>
cmp    $0x3,%edi
je     1155 <testArgs+0x45>
cmp    $0x2,%edi
jne    1150 <testArgs+0x40>
mov    %rsi,%r14
mov    (%rsi),%rdi
lea    0xece(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1155 <testArgs+0x45>
mov    (%r14),%rdi
lea    0xebd(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1155 <testArgs+0x45>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"-h\00"
@.str.1 = [7 x i8] c"--help\00"
define i32 @testArgs(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp eq i32 %7, 1
br i1 %8, label %31, label %9
9: ; preds = %2
%10 = load i32, i32* %4
%11 = icmp eq i32 %10, 2
br i1 %11, label %12, label %28
12: ; preds = %9
%13 = load i8**, i8*** %5
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8*, i8** %13, i64 %15
%17 = load i8*, i8** %16
%18 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %31, label %20
20: ; preds = %12
%21 = load i8**, i8*** %5
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8*, i8** %21, i64 %23
%25 = load i8*, i8** %24
%26 = call i64 @strcmp(i8* %25, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %31, label %28
28: ; preds = %20, %9
%29 = load i32, i32* %4
%30 = icmp eq i32 %29, 3
br i1 %30, label %31, label %32
31: ; preds = %28, %20, %12, %2
store i32 0, i32* %3
br label %33
32: ; preds = %28
store i32 1, i32* %3
br label %33
33: ; preds = %32, %31
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
@.str = [3 x i8] c"-h\00"
@.str.1 = [7 x i8] c"--help\00"
define i32 @testArgs(i32 %0, i8** nocapture %1) {
switch i32 %0, label %11 [
i32 1, label %12
i32 2, label %3
i32 3, label %12
]
3: ; preds = %2
%4 = load i8*, i8** %1
%5 = tail call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %12, label %7
7: ; preds = %3
%8 = load i8*, i8** %1
%9 = tail call i64 @strcmp(i8* %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %2, %7
br label %12
12: ; preds = %3, %7, %2, %2, %11
%13 = phi i32 [ 1, %11 ], [ 0, %2 ], [ 0, %2 ], [ 0, %7 ], [ 0, %3 ]
ret i32 %13
}