#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);
int /*<<< orphan*/ handle_vortex_image(char *, short);
int /*<<< orphan*/ help(char *);
int /*<<< orphan*/ printf(char *, char *, char *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  short action;
  if (argc == 1) {
    help(argv[0]);
    exit(0);
  }
  if (strcmp(argv[1], "help") == 0) {
    help(argv[0]);
    exit(0);
  } else if (strcmp(argv[1], "ls") == 0) {
    action = 1;
  } else if (strcmp(argv[1], "dump") == 0) {
    action = 2;
  } else {
    printf("%s: %s (ls|dump) file [files]\n", argv[0], argv[0]);
    exit(1);
  }
  for (short i = 2; i < argc; i++)
    handle_vortex_image(argv[i], action);
}


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   $0x1,-0x8(%rbp)
jne    1183 <main+0x33>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <help@plt>
xor    %edi,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe6e(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11b4 <main+0x64>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <help@plt>
xor    %edi,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe42(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11dd <main+0x8d>
movw   $0x1,-0x12(%rbp)
jmp    122f <main+0xdf>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe1c(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1206 <main+0xb6>
movw   $0x2,-0x12(%rbp)
jmp    122a <main+0xda>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdf2(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
jmp    122f <main+0xdf>
jmp    1234 <main+0xe4>
movw   $0x2,-0x14(%rbp)
movswl -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    126e <main+0x11e>
mov    -0x10(%rbp),%rax
movswq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
movswl -0x12(%rbp),%esi
call   1050 <handle_vortex_image@plt>
mov    -0x14(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x14(%rbp)
jmp    123a <main+0xea>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
cmp    $0x1,%edi
je     11f7 <main+0xa7>
mov    %edi,%r15d
mov    0x8(%r14),%rdi
lea    0xe8f(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11f7 <main+0xa7>
mov    0x8(%r14),%rdi
lea    0xe7f(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     11b1 <main+0x61>
mov    0x8(%r14),%rdi
lea    0xe6d(%rip),%rsi
call   1040 <strcmp@plt>
mov    $0x2,%cx
test   %rax,%rax
jne    1206 <main+0xb6>
cmp    $0x3,%r15d
jge    11bb <main+0x6b>
jmp    11ea <main+0x9a>
mov    $0x1,%cx
cmp    $0x3,%r15d
jl     11ea <main+0x9a>
mov    $0x2,%bp
movzwl %cx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movswq %bp,%rax
mov    (%r14,%rax,8),%rdi
mov    %ebx,%esi
call   1050 <handle_vortex_image@plt>
add    $0x1,%ebp
movswl %bp,%eax
cmp    %r15d,%eax
jl     11d0 <main+0x80>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    (%r14),%rdi
call   1060 <help@plt>
xor    %edi,%edi
call   1070 <exit@plt>
mov    (%r14),%rdx
lea    0xdfd(%rip),%rdi
mov    %rdx,%rsi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"help\00"
@.str.1 = [3 x i8] c"ls\00"
@.str.2 = [5 x i8] c"dump\00"
@.str.3 = [31 x i8] c"%s: %s (ls|dump) file [files]\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i16
%7 = alloca i16
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 1
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 @help(i8* %13)
%15 = call i32 @exit(i32 0)
unreachable
16: ; preds = %2
%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 ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %28
22: ; preds = %16
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 0
%25 = load i8*, i8** %24
%26 = call i32 @help(i8* %25)
%27 = call i32 @exit(i32 0)
unreachable
28: ; preds = %16
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i64 @strcmp(i8* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %28
store i16 1, i16* %6
br label %52
35: ; preds = %28
%36 = load i8**, i8*** %5
%37 = getelementptr inbounds i8*, i8** %36, i64 1
%38 = load i8*, i8** %37
%39 = call i64 @strcmp(i8* %38, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %42
41: ; preds = %35
store i16 2, i16* %6
br label %51
42: ; preds = %35
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 0
%45 = load i8*, i8** %44
%46 = load i8**, i8*** %5
%47 = getelementptr inbounds i8*, i8** %46, i64 0
%48 = load i8*, i8** %47
%49 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* %45, i8* %48)
%50 = call i32 @exit(i32 1)
unreachable
51: ; preds = %41
br label %52
52: ; preds = %51, %34
br label %53
53: ; preds = %52
store i16 2, i16* %7
br label %54
54: ; preds = %67, %53
%55 = load i16, i16* %7
%56 = sext i16 %55 to i32
%57 = load i32, i32* %4
%58 = icmp slt i32 %56, %57
br i1 %58, label %59, label %70
59: ; preds = %54
%60 = load i8**, i8*** %5
%61 = load i16, i16* %7
%62 = sext i16 %61 to i64
%63 = getelementptr inbounds i8*, i8** %60, i64 %62
%64 = load i8*, i8** %63
%65 = load i16, i16* %6
%66 = call i32 @handle_vortex_image(i8* %64, i16 signext %65)
br label %67
67: ; preds = %59
%68 = load i16, i16* %7
%69 = add i16 %68, 1
store i16 %69, i16* %7
br label %54
70: ; preds = %54
%71 = load i32, i32* %3
ret i32 %71
}

LLVM IR (-O2):
@.str = [5 x i8] c"help\00"
@.str.1 = [3 x i8] c"ls\00"
@.str.2 = [5 x i8] c"dump\00"
@.str.3 = [31 x i8] c"%s: %s (ls|dump) file [files]\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 @help(i8* %5)
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %8
%14 = load i8*, i8** %1
%15 = tail call i32 @help(i8* %14)
%16 = tail call i32 @exit(i32 0)
unreachable
17: ; preds = %8
%18 = load i8*, i8** %9
%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 %29, label %21
21: ; preds = %17
%22 = load i8*, i8** %9
%23 = tail call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %29, label %25
25: ; preds = %21
%26 = load i8*, i8** %1
%27 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* %26, i8* %26)
%28 = tail call i32 @exit(i32 1)
unreachable
29: ; preds = %21, %17
%30 = phi i16 [ 1, %17 ], [ 2, %21 ]
%31 = icmp sgt i32 %0, 2
br i1 %31, label %33, label %32
32: ; preds = %33, %29
ret i32 0
33: ; preds = %29, %33
%34 = phi i16 [ %39, %33 ], [ 2, %29 ]
%35 = sext i16 %34 to i64
%36 = getelementptr inbounds i8*, i8** %1, i64 %35
%37 = load i8*, i8** %36
%38 = tail call i32 @handle_vortex_image(i8* %37, i16 signext %30)
%39 = add i16 %34, 1
%40 = sext i16 %39 to i32
%41 = icmp slt i32 %40, %0
br i1 %41, label %33, label %32
}