#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 getFileType(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sclList(char *);
int /*<<< orphan*/ tapList(char *);
int /*<<< orphan*/ trdList(char *);
void list(char *path) {
  int mode = getFileType(path);
  switch (mode) {
  case 3:
    tapList(path);
    break;
  case 1:
    sclList(path);
    break;
  case 2:
    trdList(path);
    break;
  default:
    printf("Unknown image type\n");
    break;
  }
}


x86 assembly (clang, -O0):
<list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <getFileType@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     11ac <list+0x5c>
jmp    117c <list+0x2c>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     11ba <list+0x6a>
jmp    118d <list+0x3d>
mov    -0x10(%rbp),%eax
sub    $0x3,%eax
jne    11c8 <list+0x78>
jmp    119e <list+0x4e>
mov    -0x8(%rbp),%rdi
call   1040 <tapList@plt>
jmp    11d4 <list+0x84>
mov    -0x8(%rbp),%rdi
call   1030 <sclList@plt>
jmp    11d4 <list+0x84>
mov    -0x8(%rbp),%rdi
call   1070 <trdList@plt>
jmp    11d4 <list+0x84>
lea    0xe31(%rip),%rdi
call   1060 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list>:
push   %rbx
mov    %rdi,%rbx
call   1060 <getFileType@plt>
cmp    $0x1,%eax
je     1171 <list+0x21>
cmp    $0x2,%eax
je     117a <list+0x2a>
cmp    $0x3,%eax
jne    1183 <list+0x33>
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <tapList@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <sclList@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1070 <trdList@plt>
lea    0xe76(%rip),%rdi
pop    %rbx
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"Unknown image type\0A\00"
define void @list(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @getFileType(i8* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
switch i32 %6, label %16 [
i32 3, label %7
i32 1, label %10
i32 2, label %13
]
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = call i32 @tapList(i8* %8)
br label %18
10: ; preds = %1
%11 = load i8*, i8** %2
%12 = call i32 @sclList(i8* %11)
br label %18
13: ; preds = %1
%14 = load i8*, i8** %2
%15 = call i32 @trdList(i8* %14)
br label %18
16: ; preds = %1
%17 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %13, %10, %7
ret void
}

LLVM IR (-O2):
@str = [19 x i8] c"Unknown image type\00"
define void @list(i8* %0) {
%2 = tail call i32 @getFileType(i8* %0)
switch i32 %2, label %9 [
i32 3, label %3
i32 1, label %5
i32 2, label %7
]
3: ; preds = %1
%4 = tail call i32 @tapList(i8* %0)
br label %11
5: ; preds = %1
%6 = tail call i32 @sclList(i8* %0)
br label %11
7: ; preds = %1
%8 = tail call i32 @trdList(i8* %0)
br label %11
9: ; preds = %1
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
br label %11
11: ; preds = %9, %7, %5, %3
ret void
}