#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*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ rcmdfn(int, int, char **);
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  int cmdarg = 0;
  if (argc > 1) {
    if (strcmp(argv[1], "CMD") == 0)
      cmdarg = 2;
    else if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0)
      cmdarg = 1;
  }
  exit(rcmdfn(cmdarg, argc, argv));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    11ce <main+0x9e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe9a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1181 <main+0x51>
movl   $0x2,-0x14(%rbp)
jmp    11c9 <main+0x99>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe74(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     11bd <main+0x8d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe59(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11c4 <main+0x94>
movl   $0x1,-0x14(%rbp)
jmp    11c9 <main+0x99>
jmp    11ce <main+0x9e>
mov    -0x14(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1030 <rcmdfn@plt>
mov    %eax,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %edi,%edi
cmp    $0x2,%ebp
jl     118d <main+0x5d>
mov    0x8(%rbx),%rdi
lea    0xeb6(%rip),%rsi
call   1040 <strcmp@plt>
mov    $0x2,%edi
test   %rax,%rax
je     118d <main+0x5d>
mov    0x8(%rbx),%rdi
lea    0xea0(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1188 <main+0x58>
mov    0x8(%rbx),%rdi
lea    0xe8e(%rip),%rsi
call   1040 <strcmp@plt>
mov    $0x0,%edi
test   %rax,%rax
jne    118d <main+0x5d>
mov    $0x1,%edi
mov    %ebp,%esi
mov    %rbx,%rdx
call   1030 <rcmdfn@plt>
mov    %eax,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"CMD\00"
@.str.1 = [3 x i8] c"-h\00"
@.str.2 = [7 x i8] c"--help\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %18
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %18, label %9
9: ; preds = %4
%10 = load i8*, i8** %5
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %9
%14 = load i8*, i8** %5
%15 = tail call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %13, %9
br label %18
18: ; preds = %4, %17, %13, %2
%19 = phi i32 [ 1, %17 ], [ 0, %13 ], [ 0, %2 ], [ 2, %4 ]
%20 = tail call i32 @rcmdfn(i32 %19, i32 %0, i8** %1)
%21 = tail call i32 @exit(i32 %20)
unreachable
}