#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*/ printf(char *, ...);
void showcard(int c) {
  if (c <= 10)
    printf("%d", c);
  else
    switch (c) {
    case 11:
      printf("Jack");
      break;
    case 12:
      printf("Queen");
      break;
    case 13:
      printf("King");
      break;
    case 14:
      printf("Ace");
    }
}


x86 assembly (clang, -O0):
<showcard>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jg     113b <showcard+0x2b>
mov    -0x4(%rbp),%esi
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b0 <showcard+0xa0>
mov    -0x4(%rbp),%eax
add    $0xfffffff5,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     11ab <showcard+0x9b>
mov    -0x10(%rbp),%rax
lea    0xea5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ab <showcard+0x9b>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ab <showcard+0x9b>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ab <showcard+0x9b>
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b0 <showcard+0xa0>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showcard>:
mov    %edi,%esi
cmp    $0xa,%edi
jg     1125 <showcard+0x15>
lea    0xef2(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
add    $0xfffffff5,%esi
cmp    $0x3,%esi
ja     114b <showcard+0x3b>
lea    0xecc(%rip),%rax
movslq (%rax,%rsi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0xecf(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
ret
lea    0xec5(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xebd(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>
lea    0xeb4(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"Jack\00"
@.str.2 = [6 x i8] c"Queen\00"
@.str.3 = [5 x i8] c"King\00"
@.str.4 = [4 x i8] c"Ace\00"
define void @showcard(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sle i32 %3, 10
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
br label %19
8: ; preds = %1
%9 = load i32, i32* %2
switch i32 %9, label %18 [
i32 11, label %10
i32 12, label %12
i32 13, label %14
i32 14, label %16
]
10: ; preds = %8
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %18
12: ; preds = %8
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %18
14: ; preds = %8
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %18
16: ; preds = %8
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %18
18: ; preds = %16, %8, %14, %12, %10
br label %19
19: ; preds = %18, %5
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"Jack\00"
@.str.2 = [6 x i8] c"Queen\00"
@.str.3 = [5 x i8] c"King\00"
@.str.4 = [4 x i8] c"Ace\00"
define void @showcard(i32 %0) {
%2 = icmp slt i32 %0, 11
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %14
5: ; preds = %1
switch i32 %0, label %14 [
i32 11, label %6
i32 12, label %8
i32 13, label %10
i32 14, label %12
]
6: ; preds = %5
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %14
8: ; preds = %5
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %14
10: ; preds = %5
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
br label %14
12: ; preds = %5
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %14
14: ; preds = %6, %8, %10, %5, %12, %3
ret void
}