#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*/ sprintf(char *, char *, int);
const char *dumpRegister(int regid) {
  static char tmp[16];
  switch (regid) {
  default:
    sprintf(tmp, "%d", regid);
    return tmp;
  case 0x01:
    return "A1";
  case 0x02:
    return "B1";
  case 0x03:
    return "B2";
  case 0x04:
    return "C1";
  case 0x05:
    return "C2";
  case 0x06:
    return "CF";
  case 0x07:
    return "NF";
  case 0x08:
    return "EX";
  }
}


x86 assembly (clang, -O0):
<dumpRegister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x7,%eax
ja     1144 <dumpRegister+0x34>
mov    -0x18(%rbp),%rax
lea    0xec5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0xc(%rbp),%edx
lea    0x2ef2(%rip),%rdi
lea    0xecb(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2edf(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e5 <dumpRegister+0xd5>
lea    0xeb2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e5 <dumpRegister+0xd5>
lea    0xea5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e5 <dumpRegister+0xd5>
lea    0xe98(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e5 <dumpRegister+0xd5>
lea    0xe8b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e5 <dumpRegister+0xd5>
lea    0xe7e(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e5 <dumpRegister+0xd5>
lea    0xe71(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e5 <dumpRegister+0xd5>
lea    0xe64(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11e5 <dumpRegister+0xd5>
lea    0xe57(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dumpRegister>:
push   %rbx
mov    %edi,%edx
lea    -0x1(%rdx),%eax
cmp    $0x8,%eax
jae    112d <dumpRegister+0x1d>
cltq
lea    0xef8(%rip),%rcx
movslq (%rcx,%rax,4),%rbx
add    %rcx,%rbx
jmp    1143 <dumpRegister+0x33>
lea    0x2f0c(%rip),%rbx
lea    0xec5(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@dumpRegister.tmp = internal global [16 x i8] zeroinitializer
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"A1\00"
@.str.2 = [3 x i8] c"B1\00"
@.str.3 = [3 x i8] c"B2\00"
@.str.4 = [3 x i8] c"C1\00"
@.str.5 = [3 x i8] c"C2\00"
@.str.6 = [3 x i8] c"CF\00"
@.str.7 = [3 x i8] c"NF\00"
@.str.8 = [3 x i8] c"EX\00"
define i8* @dumpRegister(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %5 [
i32 1, label %8
i32 2, label %9
i32 3, label %10
i32 4, label %11
i32 5, label %12
i32 6, label %13
i32 7, label %14
i32 8, label %15
]
5: ; preds = %1
%6 = load i32, i32* %3
%7 = call i32 @sprintf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @dumpRegister.tmp, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
store i8* getelementptr inbounds ([16 x i8], [16 x i8]* @dumpRegister.tmp, i64 0, i64 0), i8** %2
br label %16
8: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %16
9: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %16
10: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %16
11: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %16
12: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8** %2
br label %16
13: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8** %2
br label %16
14: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i8** %2
br label %16
15: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i8** %2
br label %16
16: ; preds = %15, %14, %13, %12, %11, %10, %9, %8, %5
%17 = load i8*, i8** %2
ret i8* %17
}

LLVM IR (-O2):
@dumpRegister.tmp = internal global [16 x i8] zeroinitializer
@.str = [3 x i8] c"%d\00"
@.str.1 = [3 x i8] c"A1\00"
@.str.2 = [3 x i8] c"B1\00"
@.str.3 = [3 x i8] c"B2\00"
@.str.4 = [3 x i8] c"C1\00"
@.str.5 = [3 x i8] c"C2\00"
@.str.6 = [3 x i8] c"CF\00"
@.str.7 = [3 x i8] c"NF\00"
@.str.8 = [3 x i8] c"EX\00"
@reltable.dumpRegister = [8 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.1 to i64), i64 ptrtoint ([8 x i32]* @reltable.dumpRegister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.2 to i64), i64 ptrtoint ([8 x i32]* @reltable.dumpRegister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.3 to i64), i64 ptrtoint ([8 x i32]* @reltable.dumpRegister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.4 to i64), i64 ptrtoint ([8 x i32]* @reltable.dumpRegister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.5 to i64), i64 ptrtoint ([8 x i32]* @reltable.dumpRegister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.6 to i64), i64 ptrtoint ([8 x i32]* @reltable.dumpRegister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.7 to i64), i64 ptrtoint ([8 x i32]* @reltable.dumpRegister to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.8 to i64), i64 ptrtoint ([8 x i32]* @reltable.dumpRegister to i64)) to i32)]
define i8* @dumpRegister(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 8
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @dumpRegister.tmp, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
br label %10
6: ; preds = %1
%7 = sext i32 %2 to i64
%8 = shl i64 %7, 2
%9 = call i8* @llvm.load.relative.i64(i8* bitcast ([8 x i32]* @reltable.dumpRegister to i8*), i64 %8)
br label %10
10: ; preds = %6, %4
%11 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @dumpRegister.tmp, i64 0, i64 0), %4 ], [ %9, %6 ]
ret i8* %11
}