#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 mkboot_iaudio(char *, char *, char *, int);
int mkboot_iriver(char *, char *, char *, int);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  if (argc != 5) {
    usage();
    return 1;
  }
  if (!strcmp(argv[1], "-h100"))
    return mkboot_iriver(argv[2], argv[3], argv[4], 0x1f0000);
  if (!strcmp(argv[1], "-h300"))
    return mkboot_iriver(argv[2], argv[3], argv[4], 0x3f0000);
  if (!strcmp(argv[1], "-iax5"))
    return mkboot_iaudio(argv[2], argv[3], argv[4], 0);
  if (!strcmp(argv[1], "-iam5"))
    return mkboot_iaudio(argv[2], argv[3], argv[4], 1);
  usage();
  return 1;
}


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)
je     1173 <main+0x33>
mov    $0x0,%al
call   1050 <usage@plt>
movl   $0x1,-0x4(%rbp)
jmp    129a <main+0x15a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe7e(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11ba <main+0x7a>
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    $0x1f0000,%ecx
call   1030 <mkboot_iriver@plt>
mov    %eax,-0x4(%rbp)
jmp    129a <main+0x15a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe3d(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1201 <main+0xc1>
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    $0x3f0000,%ecx
call   1030 <mkboot_iriver@plt>
mov    %eax,-0x4(%rbp)
jmp    129a <main+0x15a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdfc(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    1245 <main+0x105>
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   1060 <mkboot_iaudio@plt>
mov    %eax,-0x4(%rbp)
jmp    129a <main+0x15a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdbe(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    128c <main+0x14c>
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   1060 <mkboot_iaudio@plt>
mov    %eax,-0x4(%rbp)
jmp    129a <main+0x15a>
mov    $0x0,%al
call   1050 <usage@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x5,%edi
jne    119c <main+0x5c>
mov    %rsi,%rbx
mov    0x8(%rsi),%r14
lea    0xea9(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11b0 <main+0x70>
lea    0xe9c(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11c3 <main+0x83>
lea    0xe8f(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11e0 <main+0xa0>
lea    0xe82(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11f0 <main+0xb0>
xor    %eax,%eax
call   1050 <usage@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x10(%rbx),%rdi
mov    0x18(%rbx),%rsi
mov    0x20(%rbx),%rdx
mov    $0x1f0000,%ecx
jmp    11d4 <main+0x94>
mov    0x10(%rbx),%rdi
mov    0x18(%rbx),%rsi
mov    0x20(%rbx),%rdx
mov    $0x3f0000,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <mkboot_iriver@plt>
mov    0x10(%rbx),%rdi
mov    0x18(%rbx),%rsi
mov    0x20(%rbx),%rdx
xor    %ecx,%ecx
jmp    1201 <main+0xc1>
mov    0x10(%rbx),%rdi
mov    0x18(%rbx),%rsi
mov    0x20(%rbx),%rdx
mov    $0x1,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1060 <mkboot_iaudio@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"-h100\00"
@.str.1 = [6 x i8] c"-h300\00"
@.str.2 = [6 x i8] c"-iax5\00"
@.str.3 = [6 x i8] c"-iam5\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 ne i32 %6, 5
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (...) @usage()
store i32 1, i32* %3
br label %80
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i32 @strcmp(i8* %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%15 = icmp ne i32 %14, 0
br i1 %15, label %27, label %16
16: ; preds = %10
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 3
%22 = load i8*, i8** %21
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 4
%25 = load i8*, i8** %24
%26 = call i32 @mkboot_iriver(i8* %19, i8* %22, i8* %25, i32 2031616)
store i32 %26, i32* %3
br label %80
27: ; preds = %10
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i32 @strcmp(i8* %30, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
%32 = icmp ne i32 %31, 0
br i1 %32, label %44, label %33
33: ; preds = %27
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 2
%36 = load i8*, i8** %35
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 3
%39 = load i8*, i8** %38
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 4
%42 = load i8*, i8** %41
%43 = call i32 @mkboot_iriver(i8* %36, i8* %39, i8* %42, i32 4128768)
store i32 %43, i32* %3
br label %80
44: ; preds = %27
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 1
%47 = load i8*, i8** %46
%48 = call i32 @strcmp(i8* %47, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%49 = icmp ne i32 %48, 0
br i1 %49, label %61, label %50
50: ; preds = %44
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 2
%53 = load i8*, i8** %52
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 3
%56 = load i8*, i8** %55
%57 = load i8**, i8*** %5
%58 = getelementptr inbounds i8*, i8** %57, i64 4
%59 = load i8*, i8** %58
%60 = call i32 @mkboot_iaudio(i8* %53, i8* %56, i8* %59, i32 0)
store i32 %60, i32* %3
br label %80
61: ; preds = %44
%62 = load i8**, i8*** %5
%63 = getelementptr inbounds i8*, i8** %62, i64 1
%64 = load i8*, i8** %63
%65 = call i32 @strcmp(i8* %64, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%66 = icmp ne i32 %65, 0
br i1 %66, label %78, label %67
67: ; preds = %61
%68 = load i8**, i8*** %5
%69 = getelementptr inbounds i8*, i8** %68, i64 2
%70 = load i8*, i8** %69
%71 = load i8**, i8*** %5
%72 = getelementptr inbounds i8*, i8** %71, i64 3
%73 = load i8*, i8** %72
%74 = load i8**, i8*** %5
%75 = getelementptr inbounds i8*, i8** %74, i64 4
%76 = load i8*, i8** %75
%77 = call i32 @mkboot_iaudio(i8* %70, i8* %73, i8* %76, i32 1)
store i32 %77, i32* %3
br label %80
78: ; preds = %61
%79 = call i32 (...) @usage()
store i32 1, i32* %3
br label %80
80: ; preds = %78, %67, %50, %33, %16, %8
%81 = load i32, i32* %3
ret i32 %81
}

LLVM IR (-O2):
@.str = [6 x i8] c"-h100\00"
@.str.1 = [6 x i8] c"-h300\00"
@.str.2 = [6 x i8] c"-iax5\00"
@.str.3 = [6 x i8] c"-iam5\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 5
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (...) @usage()
br label %54
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %19
11: ; preds = %6
%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 = getelementptr inbounds i8*, i8** %1, i64 4
%17 = load i8*, i8** %16
%18 = tail call i32 @mkboot_iriver(i8* %13, i8* %15, i8* %17, i32 2031616)
br label %54
19: ; preds = %6
%20 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 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 = getelementptr inbounds i8*, i8** %1, i64 2
%24 = load i8*, i8** %23
%25 = getelementptr inbounds i8*, i8** %1, i64 3
%26 = load i8*, i8** %25
%27 = getelementptr inbounds i8*, i8** %1, i64 4
%28 = load i8*, i8** %27
%29 = tail call i32 @mkboot_iriver(i8* %24, i8* %26, i8* %28, i32 4128768)
br label %54
30: ; preds = %19
%31 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %41
33: ; preds = %30
%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 @mkboot_iaudio(i8* %35, i8* %37, i8* %39, i32 0)
br label %54
41: ; preds = %30
%42 = tail call i32 @strcmp(i8* dereferenceable(1) %8, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%43 = icmp eq i32 %42, 0
br i1 %43, label %44, label %52
44: ; preds = %41
%45 = getelementptr inbounds i8*, i8** %1, i64 2
%46 = load i8*, i8** %45
%47 = getelementptr inbounds i8*, i8** %1, i64 3
%48 = load i8*, i8** %47
%49 = getelementptr inbounds i8*, i8** %1, i64 4
%50 = load i8*, i8** %49
%51 = tail call i32 @mkboot_iaudio(i8* %46, i8* %48, i8* %50, i32 1)
br label %54
52: ; preds = %41
%53 = tail call i32 (...) @usage()
br label %54
54: ; preds = %52, %44, %33, %22, %11, %4
%55 = phi i32 [ 1, %4 ], [ 1, %52 ], [ %51, %44 ], [ %40, %33 ], [ %29, %22 ], [ %18, %11 ]
ret i32 %55
}