#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*/ ed(char *, char *, char *, int);
int /*<<< orphan*/ generate(char *, char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  if (argc == 5)
    if (strcmp(argv[1], "-e") == 0)
      ed(argv[2], argv[3], argv[4], 0);
    else if (strcmp(argv[1], "-d") == 0)
      ed(argv[2], argv[3], argv[4], 1);
    else if (strcmp(argv[1], "-g") == 0)
      generate(argv[2], argv[3], argv[4]);
    else
      usage();
  else
    usage();
  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   $0x5,-0x8(%rbp)
jne    123d <main+0xfd>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe91(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11a2 <main+0x62>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdx
xor    %ecx,%ecx
call   1040 <ed@plt>
jmp    1238 <main+0xf8>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe52(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    11e7 <main+0xa7>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdx
mov    $0x1,%ecx
call   1040 <ed@plt>
jmp    1233 <main+0xf3>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe10(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1227 <main+0xe7>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdx
call   1060 <generate@plt>
jmp    122e <main+0xee>
mov    $0x0,%al
call   1050 <usage@plt>
jmp    1233 <main+0xf3>
jmp    1238 <main+0xf8>
jmp    1244 <main+0x104>
mov    $0x0,%al
call   1050 <usage@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x5,%edi
jne    1188 <main+0x48>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
lea    0xeac(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1191 <main+0x51>
mov    0x8(%rbx),%rdi
lea    0xe9a(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11a6 <main+0x66>
mov    0x8(%rbx),%rdi
lea    0xe88(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     11be <main+0x7e>
xor    %eax,%eax
call   1050 <usage@plt>
jmp    11cf <main+0x8f>
mov    0x10(%rbx),%rdi
mov    0x18(%rbx),%rsi
mov    0x20(%rbx),%rdx
xor    %ecx,%ecx
call   1040 <ed@plt>
jmp    11cf <main+0x8f>
mov    0x10(%rbx),%rdi
mov    0x18(%rbx),%rsi
mov    0x20(%rbx),%rdx
mov    $0x1,%ecx
call   1040 <ed@plt>
jmp    11cf <main+0x8f>
mov    0x10(%rbx),%rdi
mov    0x18(%rbx),%rsi
mov    0x20(%rbx),%rdx
call   1060 <generate@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"-e\00"
@.str.1 = [3 x i8] c"-d\00"
@.str.2 = [3 x i8] c"-g\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, 5
br i1 %7, label %8, label %64
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %25
14: ; preds = %8
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 2
%17 = load i8*, i8** %16
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 3
%20 = load i8*, i8** %19
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 4
%23 = load i8*, i8** %22
%24 = call i32 @ed(i8* %17, i8* %20, i8* %23, i32 0)
br label %63
25: ; preds = %8
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i64 @strcmp(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%30 = icmp eq i64 %29, 0
br i1 %30, label %31, label %42
31: ; preds = %25
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 2
%34 = load i8*, i8** %33
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 3
%37 = load i8*, i8** %36
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 4
%40 = load i8*, i8** %39
%41 = call i32 @ed(i8* %34, i8* %37, i8* %40, i32 1)
br label %62
42: ; preds = %25
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 1
%45 = load i8*, i8** %44
%46 = call i64 @strcmp(i8* %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %59
48: ; preds = %42
%49 = load i8**, i8*** %5
%50 = getelementptr inbounds i8*, i8** %49, i64 2
%51 = load i8*, i8** %50
%52 = load i8**, i8*** %5
%53 = getelementptr inbounds i8*, i8** %52, i64 3
%54 = load i8*, i8** %53
%55 = load i8**, i8*** %5
%56 = getelementptr inbounds i8*, i8** %55, i64 4
%57 = load i8*, i8** %56
%58 = call i32 @generate(i8* %51, i8* %54, i8* %57)
br label %61
59: ; preds = %42
%60 = call i32 (...) @usage()
br label %61
61: ; preds = %59, %48
br label %62
62: ; preds = %61, %31
br label %63
63: ; preds = %62, %14
br label %66
64: ; preds = %2
%65 = call i32 (...) @usage()
br label %66
66: ; preds = %64, %63
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"-e\00"
@.str.1 = [3 x i8] c"-d\00"
@.str.2 = [3 x i8] c"-g\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 5
br i1 %3, label %4, label %43
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 ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %4
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8*, i8** %1, i64 3
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8*, i8** %1, i64 4
%15 = load i8*, i8** %14
%16 = tail call i32 @ed(i8* %11, i8* %13, i8* %15, i32 0)
br label %45
17: ; preds = %4
%18 = load i8*, i8** %5
%19 = tail call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %29
21: ; preds = %17
%22 = getelementptr inbounds i8*, i8** %1, i64 2
%23 = load i8*, i8** %22
%24 = getelementptr inbounds i8*, i8** %1, i64 3
%25 = load i8*, i8** %24
%26 = getelementptr inbounds i8*, i8** %1, i64 4
%27 = load i8*, i8** %26
%28 = tail call i32 @ed(i8* %23, i8* %25, i8* %27, i32 1)
br label %45
29: ; preds = %17
%30 = load i8*, i8** %5
%31 = tail call i64 @strcmp(i8* %30, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%32 = icmp eq i64 %31, 0
br i1 %32, label %33, label %41
33: ; preds = %29
%34 = getelementptr inbounds i8*, i8** %1, i64 2
%35 = load i8*, i8** %34
%36 = getelementptr inbounds i8*, i8** %1, i64 3
%37 = load i8*, i8** %36
%38 = getelementptr inbounds i8*, i8** %1, i64 4
%39 = load i8*, i8** %38
%40 = tail call i32 @generate(i8* %35, i8* %37, i8* %39)
br label %45
41: ; preds = %29
%42 = tail call i32 (...) @usage()
br label %45
43: ; preds = %2
%44 = tail call i32 (...) @usage()
br label %45
45: ; preds = %9, %33, %41, %21, %43
ret i32 0
}