#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 */
struct key {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ print_key_struct(int /*<<< orphan*/ *, struct key *, char *);
int /*<<< orphan*/ print_lc_key(int /*<<< orphan*/ *, struct key *, char *);
int /*<<< orphan*/ print_rec_key(int /*<<< orphan*/ *, struct key *, char *);
void print_key(FILE *list, int index, struct key *k, char caption[]) {
  if (index == 0)
    print_key_struct(list, k, caption);
  else if (index == 1)
    print_rec_key(list, k, caption);
  else if (index == 2)
    print_lc_key(list, k, caption);
}


x86 assembly (clang, -O0):
<print_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1167 <print_key+0x37>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1040 <print_key_struct@plt>
jmp    11ac <print_key+0x7c>
cmpl   $0x1,-0xc(%rbp)
jne    1187 <print_key+0x57>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1050 <print_rec_key@plt>
jmp    11a7 <print_key+0x77>
cmpl   $0x2,-0xc(%rbp)
jne    11a2 <print_key+0x72>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1030 <print_lc_key@plt>
jmp    11a7 <print_key+0x77>
jmp    11ac <print_key+0x7c>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_key>:
cmp    $0x2,%esi
je     1149 <print_key+0x19>
cmp    $0x1,%esi
je     1154 <print_key+0x24>
test   %esi,%esi
jne    115f <print_key+0x2f>
mov    %rdx,%rsi
mov    %rcx,%rdx
jmp    1040 <print_key_struct@plt>
mov    %rdx,%rsi
mov    %rcx,%rdx
jmp    1030 <print_lc_key@plt>
mov    %rdx,%rsi
mov    %rcx,%rdx
jmp    1050 <print_rec_key@plt>
ret

LLVM IR (-O0):
%struct.key = type { i32 }
define void @print_key(i32* %0, i32 %1, %struct.key* %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca %struct.key*
%8 = alloca i8*
store i32* %0, i32** %5
store i32 %1, i32* %6
store %struct.key* %2, %struct.key** %7
store i8* %3, i8** %8
%9 = load i32, i32* %6
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %4
%12 = load i32*, i32** %5
%13 = load %struct.key*, %struct.key** %7
%14 = load i8*, i8** %8
%15 = call i32 @print_key_struct(i32* %12, %struct.key* %13, i8* %14)
br label %34
16: ; preds = %4
%17 = load i32, i32* %6
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %24
19: ; preds = %16
%20 = load i32*, i32** %5
%21 = load %struct.key*, %struct.key** %7
%22 = load i8*, i8** %8
%23 = call i32 @print_rec_key(i32* %20, %struct.key* %21, i8* %22)
br label %33
24: ; preds = %16
%25 = load i32, i32* %6
%26 = icmp eq i32 %25, 2
br i1 %26, label %27, label %32
27: ; preds = %24
%28 = load i32*, i32** %5
%29 = load %struct.key*, %struct.key** %7
%30 = load i8*, i8** %8
%31 = call i32 @print_lc_key(i32* %28, %struct.key* %29, i8* %30)
br label %32
32: ; preds = %27, %24
br label %33
33: ; preds = %32, %19
br label %34
34: ; preds = %33, %11
ret void
}

LLVM IR (-O2):
%struct.key = type { i32 }
define void @print_key(i32* %0, i32 %1, %struct.key* %2, i8* %3) {
switch i32 %1, label %11 [
i32 0, label %5
i32 1, label %7
i32 2, label %9
]
5: ; preds = %4
%6 = tail call i32 @print_key_struct(i32* %0, %struct.key* %2, i8* %3)
br label %11
7: ; preds = %4
%8 = tail call i32 @print_rec_key(i32* %0, %struct.key* %2, i8* %3)
br label %11
9: ; preds = %4
%10 = tail call i32 @print_lc_key(i32* %0, %struct.key* %2, i8* %3)
br label %11
11: ; preds = %4, %7, %9, %5
ret void
}