#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 *, int);
void print_reg(int r) {
  switch (r) {
  case 2001:
    printf(" %d SAME_VAL ", r);
    break;
  case 2000:
    printf(" %d UNDEF_VAL ", r);
    break;
  case 2002:
    printf(" %d (CFA) ", r);
    break;
  default:
    printf(" r%d ", r);
    break;
  }
}


x86 assembly (clang, -O0):
<print_reg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x7d0,%eax
je     116b <print_reg+0x5b>
jmp    1131 <print_reg+0x21>
mov    -0x8(%rbp),%eax
sub    $0x7d1,%eax
je     1157 <print_reg+0x47>
jmp    1144 <print_reg+0x34>
mov    -0x8(%rbp),%eax
sub    $0x7d2,%eax
je     117f <print_reg+0x6f>
jmp    1193 <print_reg+0x83>
mov    -0x4(%rbp),%esi
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
jmp    11a2 <print_reg+0x92>
mov    -0x4(%rbp),%esi
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
jmp    11a2 <print_reg+0x92>
mov    -0x4(%rbp),%esi
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
jmp    11a2 <print_reg+0x92>
mov    -0x4(%rbp),%esi
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_reg>:
cmp    $0x7d0,%edi
je     113b <print_reg+0x2b>
mov    %edi,%esi
cmp    $0x7d2,%edi
je     114c <print_reg+0x3c>
cmp    $0x7d1,%esi
jne    115d <print_reg+0x4d>
lea    0xecf(%rip),%rdi
mov    $0x7d1,%esi
jmp    1030 <printf@plt>
lea    0xecc(%rip),%rdi
mov    $0x7d0,%esi
jmp    1030 <printf@plt>
lea    0xeca(%rip),%rdi
mov    $0x7d2,%esi
jmp    1030 <printf@plt>
lea    0xec4(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c" %d SAME_VAL \00"
@.str.1 = [15 x i8] c" %d UNDEF_VAL \00"
@.str.2 = [11 x i8] c" %d (CFA) \00"
@.str.3 = [6 x i8] c" r%d \00"
define void @print_reg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %13 [
i32 2001, label %4
i32 2000, label %7
i32 2002, label %10
]
4: ; preds = %1
%5 = load i32, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %5)
br label %16
7: ; preds = %1
%8 = load i32, i32* %2
%9 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %8)
br label %16
10: ; preds = %1
%11 = load i32, i32* %2
%12 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %11)
br label %16
13: ; preds = %1
%14 = load i32, i32* %2
%15 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %14)
br label %16
16: ; preds = %13, %10, %7, %4
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c" %d SAME_VAL \00"
@.str.1 = [15 x i8] c" %d UNDEF_VAL \00"
@.str.2 = [11 x i8] c" %d (CFA) \00"
@.str.3 = [6 x i8] c" r%d \00"
define void @print_reg(i32 %0) {
switch i32 %0, label %8 [
i32 2001, label %2
i32 2000, label %4
i32 2002, label %6
]
2: ; preds = %1
%3 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 2001)
br label %10
4: ; preds = %1
%5 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 2000)
br label %10
6: ; preds = %1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 2002)
br label %10
8: ; preds = %1
%9 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %0)
br label %10
10: ; preds = %8, %6, %4, %2
ret void
}