#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*/ CD_usage_error(char *);
int PARSE_command_line(int, char **);
int /*<<< orphan*/ initialize(char *);
int /*<<< orphan*/ list_directory();
int /*<<< orphan*/ list_stack();
int /*<<< orphan*/ sort_list();
int main_list(int argc, char **argv) {
  initialize(argv[1]);
  switch (PARSE_command_line(argc, argv)) {
  case 1:
    list_directory();
    break;
  case 3:
    sort_list();
    list_directory();
    break;
  case 2:
    list_stack();
    break;
  default:
    CD_usage_error("[ stack | by name ]");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <initialize@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1070 <PARSE_command_line@plt>
mov    %eax,%ecx
mov    %ecx,-0x14(%rbp)
sub    $0x1,%eax
je     11bd <main_list+0x5d>
jmp    119b <main_list+0x3b>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     11dc <main_list+0x7c>
jmp    11ac <main_list+0x4c>
mov    -0x14(%rbp),%eax
sub    $0x3,%eax
je     11c9 <main_list+0x69>
jmp    11e8 <main_list+0x88>
mov    $0x0,%al
call   1040 <list_directory@plt>
jmp    11f4 <main_list+0x94>
mov    $0x0,%al
call   1080 <sort_list@plt>
mov    $0x0,%al
call   1040 <list_directory@plt>
jmp    11f4 <main_list+0x94>
mov    $0x0,%al
call   1050 <list_stack@plt>
jmp    11f4 <main_list+0x94>
lea    0xe11(%rip),%rdi
call   1060 <CD_usage_error@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main_list>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x8(%rsi),%rdi
call   1030 <initialize@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1070 <PARSE_command_line@plt>
cmp    $0x3,%eax
je     1198 <main_list+0x38>
cmp    $0x2,%eax
je     11a8 <main_list+0x48>
cmp    $0x1,%eax
je     119f <main_list+0x3f>
lea    0xe6f(%rip),%rdi
call   1060 <CD_usage_error@plt>
jmp    11af <main_list+0x4f>
xor    %eax,%eax
call   1080 <sort_list@plt>
xor    %eax,%eax
call   1040 <list_directory@plt>
jmp    11af <main_list+0x4f>
xor    %eax,%eax
call   1050 <list_stack@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"[ stack | by name ]\00"
define i32 @main_list(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i8**, i8*** %4
%6 = getelementptr inbounds i8*, i8** %5, i64 1
%7 = load i8*, i8** %6
%8 = call i32 @initialize(i8* %7)
%9 = load i32, i32* %3
%10 = load i8**, i8*** %4
%11 = call i32 @PARSE_command_line(i32 %9, i8** %10)
switch i32 %11, label %19 [
i32 1, label %12
i32 3, label %14
i32 2, label %17
]
12: ; preds = %2
%13 = call i32 (...) @list_directory()
br label %21
14: ; preds = %2
%15 = call i32 (...) @sort_list()
%16 = call i32 (...) @list_directory()
br label %21
17: ; preds = %2
%18 = call i32 (...) @list_stack()
br label %21
19: ; preds = %2
%20 = call i32 @CD_usage_error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %21
21: ; preds = %19, %17, %14, %12
ret i32 0
}

LLVM IR (-O2):
@.str = [20 x i8] c"[ stack | by name ]\00"
define i32 @main_list(i32 %0, i8** %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @initialize(i8* %4)
%6 = tail call i32 @PARSE_command_line(i32 %0, i8** %1)
switch i32 %6, label %14 [
i32 1, label %7
i32 3, label %9
i32 2, label %12
]
7: ; preds = %2
%8 = tail call i32 (...) @list_directory()
br label %16
9: ; preds = %2
%10 = tail call i32 (...) @sort_list()
%11 = tail call i32 (...) @list_directory()
br label %16
12: ; preds = %2
%13 = tail call i32 (...) @list_stack()
br label %16
14: ; preds = %2
%15 = tail call i32 @CD_usage_error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14, %12, %9, %7
ret i32 0
}