#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*/ dumpFun();
int /*<<< orphan*/ dumpVarTab();
int /*<<< orphan*/ printf(char *);
void db_dump(char *param) {
  int kase = *param;
  switch (kase) {
  case 'f':
    dumpFun();
    printf("\n");
    break;
  case 'v':
    dumpVarTab();
    printf("\n");
    break;
  default:
    printf("d needs f (fcn table) or v (var table) parameter");
    break;
  }
}


x86 assembly (clang, -O0):
<db_dump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x66,%eax
je     116b <db_dump+0x3b>
jmp    115a <db_dump+0x2a>
mov    -0x10(%rbp),%eax
sub    $0x76,%eax
je     1183 <db_dump+0x53>
jmp    119b <db_dump+0x6b>
mov    $0x0,%al
call   1030 <dumpFun@plt>
lea    0xe87(%rip),%rdi
call   1040 <printf@plt>
jmp    11a7 <db_dump+0x77>
mov    $0x0,%al
call   1050 <dumpVarTab@plt>
lea    0xe6f(%rip),%rdi
call   1040 <printf@plt>
jmp    11a7 <db_dump+0x77>
lea    0xe60(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<db_dump>:
push   %rax
movsbl (%rdi),%eax
cmp    $0x76,%eax
je     1157 <db_dump+0x17>
cmp    $0x66,%eax
jne    1169 <db_dump+0x29>
xor    %eax,%eax
call   1040 <dumpFun@plt>
jmp    115e <db_dump+0x1e>
xor    %eax,%eax
call   1060 <dumpVarTab@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <putchar@plt>
lea    0xe90(%rip),%rdi
pop    %rax
jmp    1050 <printf@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [49 x i8] c"d needs f (fcn table) or v (var table) parameter\00"
define void @db_dump(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
store i32 %6, i32* %3
%7 = load i32, i32* %3
switch i32 %7, label %14 [
i32 102, label %8
i32 118, label %11
]
8: ; preds = %1
%9 = call i32 (...) @dumpFun()
%10 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %16
11: ; preds = %1
%12 = call i32 (...) @dumpVarTab()
%13 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %16
14: ; preds = %1
%15 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %11, %8
ret void
}

LLVM IR (-O2):
@.str.1 = [49 x i8] c"d needs f (fcn table) or v (var table) parameter\00"
define void @db_dump(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
switch i32 %3, label %10 [
i32 102, label %4
i32 118, label %7
]
4: ; preds = %1
%5 = tail call i32 (...) @dumpFun()
%6 = tail call i32 @putchar(i32 10)
br label %12
7: ; preds = %1
%8 = tail call i32 (...) @dumpVarTab()
%9 = tail call i32 @putchar(i32 10)
br label %12
10: ; preds = %1
%11 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %7, %4
ret void
}