#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*/ print_usage();
int /*<<< orphan*/ start_asm(char *, char *);
int /*<<< orphan*/ start_dis(char *);
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  if (argc >= 2) {
    char *cmd = argv[1];
    if (!strcmp(cmd, "asm")) {
      if (argc >= 4) {
        start_asm(argv[2], argv[3]);
      } else {
        print_usage();
      }
    } else if (!strcmp(cmd, "dis")) {
      if (argc >= 3) {
        start_dis(argv[2]);
      } else {
        print_usage();
      }
    } else {
      print_usage();
    }
  } else {
    print_usage();
  }
  return 0;
}


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)
cmpl   $0x2,-0x8(%rbp)
jl     1207 <main+0xc7>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe89(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11b5 <main+0x75>
cmpl   $0x4,-0x8(%rbp)
jl     11a9 <main+0x69>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1040 <start_asm@plt>
jmp    11b0 <main+0x70>
mov    $0x0,%al
call   1050 <print_usage@plt>
jmp    1202 <main+0xc2>
mov    -0x18(%rbp),%rdi
lea    0xe44(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11f6 <main+0xb6>
cmpl   $0x3,-0x8(%rbp)
jl     11ea <main+0xaa>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <start_dis@plt>
jmp    11f1 <main+0xb1>
mov    $0x0,%al
call   1050 <print_usage@plt>
jmp    11fd <main+0xbd>
mov    $0x0,%al
call   1050 <print_usage@plt>
jmp    1202 <main+0xc2>
jmp    120e <main+0xce>
mov    $0x0,%al
call   1050 <print_usage@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x2,%edi
jl     119c <main+0x5c>
mov    %rsi,%r14
mov    %edi,%ebp
mov    0x8(%rsi),%rbx
lea    0xea7(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1188 <main+0x48>
lea    0xe98(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
jne    119c <main+0x5c>
cmp    $0x3,%ebp
jb     119c <main+0x5c>
mov    0x10(%r14),%rdi
call   1060 <start_dis@plt>
jmp    11a3 <main+0x63>
cmp    $0x4,%ebp
jb     119c <main+0x5c>
mov    0x10(%r14),%rdi
mov    0x18(%r14),%rsi
call   1040 <start_asm@plt>
jmp    11a3 <main+0x63>
xor    %eax,%eax
call   1050 <print_usage@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"asm\00"
@.str.1 = [4 x i8] c"dis\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %32
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %6, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %4
%10 = icmp ugt i32 %0, 3
br i1 %10, label %11, label %17
11: ; preds = %9
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8*, i8** %1, i64 3
%15 = load i8*, i8** %14
%16 = tail call i32 @start_asm(i8* %13, i8* %15)
br label %34
17: ; preds = %9
%18 = tail call i32 (...) @print_usage()
br label %34
19: ; preds = %4
%20 = tail call i32 @strcmp(i8* dereferenceable(1) %6, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %30
22: ; preds = %19
%23 = icmp ugt i32 %0, 2
br i1 %23, label %24, label %28
24: ; preds = %22
%25 = getelementptr inbounds i8*, i8** %1, i64 2
%26 = load i8*, i8** %25
%27 = tail call i32 @start_dis(i8* %26)
br label %34
28: ; preds = %22
%29 = tail call i32 (...) @print_usage()
br label %34
30: ; preds = %19
%31 = tail call i32 (...) @print_usage()
br label %34
32: ; preds = %2
%33 = tail call i32 (...) @print_usage()
br label %34
34: ; preds = %17, %11, %24, %28, %30, %32
ret i32 0
}