#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*/ interpret_command(char *);
int /*<<< orphan*/ print_help();
int /*<<< orphan*/ send_command(char *, char *, int);
scalar_t__ strcasecmp(char *, char *);
int /*<<< orphan*/ winusbtmc_deinit();
int main(int argc, char *argv[]) {
  if (argc == 1) {
    print_help();
  } else if (argc == 2) {
    interpret_command(argv[1]);
  } else if (argc == 3) {
    send_command(argv[1], argv[2], false);
  } else if (argc == 4) {
    if (strcasecmp(argv[1], "/R") == 0) {
      send_command(argv[2], argv[3], true);
    }
  }
  winusbtmc_deinit();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    117c <main+0x2c>
mov    $0x0,%al
call   1070 <print_help@plt>
jmp    1214 <main+0xc4>
cmpl   $0x2,-0x8(%rbp)
jne    1198 <main+0x48>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <interpret_command@plt>
jmp    120f <main+0xbf>
cmpl   $0x3,-0x8(%rbp)
jne    11be <main+0x6e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
xor    %edx,%edx
call   1060 <send_command@plt>
jmp    120a <main+0xba>
cmpl   $0x4,-0x8(%rbp)
jne    1205 <main+0xb5>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe29(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1200 <main+0xb0>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
mov    $0x1,%edx
call   1060 <send_command@plt>
jmp    1205 <main+0xb5>
jmp    120a <main+0xba>
jmp    120f <main+0xbf>
jmp    1214 <main+0xc4>
mov    $0x0,%al
call   1050 <winusbtmc_deinit@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
add    $0xffffffff,%edi
cmp    $0x3,%edi
ja     11b3 <main+0x63>
mov    %rsi,%rbx
lea    0xe9d(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
xor    %eax,%eax
call   1070 <print_help@plt>
jmp    11b3 <main+0x63>
mov    0x8(%rbx),%rdi
call   1040 <interpret_command@plt>
jmp    11b3 <main+0x63>
mov    0x8(%rbx),%rdi
mov    0x10(%rbx),%rsi
xor    %edx,%edx
jmp    11ae <main+0x5e>
mov    0x8(%rbx),%rdi
lea    0xe79(%rip),%rsi
call   1030 <strcasecmp@plt>
test   %rax,%rax
jne    11b3 <main+0x63>
mov    0x10(%rbx),%rdi
mov    0x18(%rbx),%rsi
mov    $0x1,%edx
call   1060 <send_command@plt>
xor    %eax,%eax
call   1050 <winusbtmc_deinit@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"/R\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 1
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (...) @print_help()
br label %50
10: ; preds = %2
%11 = load i32, i32* %4
%12 = icmp eq i32 %11, 2
br i1 %12, label %13, label %18
13: ; preds = %10
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @interpret_command(i8* %16)
br label %49
18: ; preds = %10
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, 3
br i1 %20, label %21, label %29
21: ; preds = %18
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 1
%24 = load i8*, i8** %23
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 2
%27 = load i8*, i8** %26
%28 = call i32 @send_command(i8* %24, i8* %27, i32 0)
br label %48
29: ; preds = %18
%30 = load i32, i32* %4
%31 = icmp eq i32 %30, 4
br i1 %31, label %32, label %47
32: ; preds = %29
%33 = load i8**, i8*** %5
%34 = getelementptr inbounds i8*, i8** %33, i64 1
%35 = load i8*, i8** %34
%36 = call i64 @strcasecmp(i8* %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %38, label %46
38: ; preds = %32
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 2
%41 = load i8*, i8** %40
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 3
%44 = load i8*, i8** %43
%45 = call i32 @send_command(i8* %41, i8* %44, i32 1)
br label %46
46: ; preds = %38, %32
br label %47
47: ; preds = %46, %29
br label %48
48: ; preds = %47, %21
br label %49
49: ; preds = %48, %13
br label %50
50: ; preds = %49, %8
%51 = call i32 (...) @winusbtmc_deinit()
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"/R\00"
define i32 @main(i32 %0, i8** nocapture %1) {
switch i32 %0, label %26 [
i32 1, label %3
i32 2, label %5
i32 3, label %9
i32 4, label %15
]
3: ; preds = %2
%4 = tail call i32 (...) @print_help()
br label %26
5: ; preds = %2
%6 = getelementptr inbounds i8*, i8** %1, i64 1
%7 = load i8*, i8** %6
%8 = tail call i32 @interpret_command(i8* %7)
br label %26
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = tail call i32 @send_command(i8* %11, i8* %13, i32 0)
br label %26
15: ; preds = %2
%16 = getelementptr inbounds i8*, i8** %1, i64 1
%17 = load i8*, i8** %16
%18 = tail call i64 @strcasecmp(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 %20, label %26
20: ; preds = %15
%21 = getelementptr inbounds i8*, i8** %1, i64 2
%22 = load i8*, i8** %21
%23 = getelementptr inbounds i8*, i8** %1, i64 3
%24 = load i8*, i8** %23
%25 = tail call i32 @send_command(i8* %22, i8* %24, i32 1)
br label %26
26: ; preds = %2, %5, %20, %15, %9, %3
%27 = tail call i32 (...) @winusbtmc_deinit()
ret i32 0
}