#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*/ error(char *);
int getreg(int);
regno() {
  switch (getreg(
      (0x01 | 0x02 | 0x04 | 0x06 | 0x08 | 0x10 | 0x20 | 0x40 | 0x80 | 0x100))) {
  case 0x06:
    return 0;
  case 0x10:
    return 1;
  case 0x20:
    return 2;
  case 0x40:
    return 3;
  case 0x80:
    return 4;
  case 0x100:
    return 5;
  case 0x02:
    return 8;
  case 0x04:
    return 9;
  case 0x01:
    return 10;
  case 0x08:
    return 11;
  default:
    error("funny register");
    return 0;
  }
}


x86 assembly (clang, -O0):
<regno>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1ff,%edi
call   1030 <getreg@plt>
mov    %eax,%ecx
mov    %ecx,-0x8(%rbp)
sub    $0x1,%eax
je     1242 <regno+0x122>
jmp    1145 <regno+0x25>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
je     122a <regno+0x10a>
jmp    1156 <regno+0x36>
mov    -0x8(%rbp),%eax
sub    $0x4,%eax
je     1236 <regno+0x116>
jmp    1167 <regno+0x47>
mov    -0x8(%rbp),%eax
sub    $0x6,%eax
je     11e2 <regno+0xc2>
jmp    1178 <regno+0x58>
mov    -0x8(%rbp),%eax
sub    $0x8,%eax
je     124e <regno+0x12e>
jmp    1189 <regno+0x69>
mov    -0x8(%rbp),%eax
sub    $0x10,%eax
je     11ee <regno+0xce>
jmp    119a <regno+0x7a>
mov    -0x8(%rbp),%eax
sub    $0x20,%eax
je     11fa <regno+0xda>
jmp    11ab <regno+0x8b>
mov    -0x8(%rbp),%eax
sub    $0x40,%eax
je     1206 <regno+0xe6>
jmp    11bc <regno+0x9c>
mov    -0x8(%rbp),%eax
sub    $0x80,%eax
je     1212 <regno+0xf2>
jmp    11cf <regno+0xaf>
mov    -0x8(%rbp),%eax
sub    $0x100,%eax
je     121e <regno+0xfe>
jmp    125a <regno+0x13a>
movl   $0x0,-0x4(%rbp)
jmp    126d <regno+0x14d>
movl   $0x1,-0x4(%rbp)
jmp    126d <regno+0x14d>
movl   $0x2,-0x4(%rbp)
jmp    126d <regno+0x14d>
movl   $0x3,-0x4(%rbp)
jmp    126d <regno+0x14d>
movl   $0x4,-0x4(%rbp)
jmp    126d <regno+0x14d>
movl   $0x5,-0x4(%rbp)
jmp    126d <regno+0x14d>
movl   $0x8,-0x4(%rbp)
jmp    126d <regno+0x14d>
movl   $0x9,-0x4(%rbp)
jmp    126d <regno+0x14d>
movl   $0xa,-0x4(%rbp)
jmp    126d <regno+0x14d>
movl   $0xb,-0x4(%rbp)
jmp    126d <regno+0x14d>
lea    0xd9f(%rip),%rdi
call   1040 <error@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<regno>:
push   %rbx
mov    $0x1ff,%edi
call   1030 <getreg@plt>
xor    %ebx,%ebx
lea    -0x1(%rax),%ecx
cmp    $0x3f,%ecx
ja     114c <regno+0x2c>
lea    0xec4(%rip),%rax
movslq (%rax,%rcx,4),%rcx
add    %rax,%rcx
jmp    *%rcx
mov    $0xa,%ebx
jmp    119e <regno+0x7e>
cmp    $0x80,%eax
je     1199 <regno+0x79>
cmp    $0x100,%eax
jne    1161 <regno+0x41>
mov    $0x5,%ebx
jmp    119e <regno+0x7e>
lea    0xf98(%rip),%rdi
call   1040 <error@plt>
jmp    119e <regno+0x7e>
mov    $0x8,%ebx
jmp    119e <regno+0x7e>
mov    $0x9,%ebx
jmp    119e <regno+0x7e>
mov    $0xb,%ebx
jmp    119e <regno+0x7e>
mov    $0x1,%ebx
jmp    119e <regno+0x7e>
mov    $0x2,%ebx
jmp    119e <regno+0x7e>
mov    $0x3,%ebx
jmp    119e <regno+0x7e>
mov    $0x4,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"funny register\00"
define i32 @regno() {
%1 = alloca i32
%2 = call i32 @getreg(i32 511)
switch i32 %2, label %13 [
i32 6, label %3
i32 16, label %4
i32 32, label %5
i32 64, label %6
i32 128, label %7
i32 256, label %8
i32 2, label %9
i32 4, label %10
i32 1, label %11
i32 8, label %12
]
3: ; preds = %0
store i32 0, i32* %1
br label %15
4: ; preds = %0
store i32 1, i32* %1
br label %15
5: ; preds = %0
store i32 2, i32* %1
br label %15
6: ; preds = %0
store i32 3, i32* %1
br label %15
7: ; preds = %0
store i32 4, i32* %1
br label %15
8: ; preds = %0
store i32 5, i32* %1
br label %15
9: ; preds = %0
store i32 8, i32* %1
br label %15
10: ; preds = %0
store i32 9, i32* %1
br label %15
11: ; preds = %0
store i32 10, i32* %1
br label %15
12: ; preds = %0
store i32 11, i32* %1
br label %15
13: ; preds = %0
%14 = call i32 @error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %1
br label %15
15: ; preds = %13, %12, %11, %10, %9, %8, %7, %6, %5, %4, %3
%16 = load i32, i32* %1
ret i32 %16
}

LLVM IR (-O2):
@.str = [15 x i8] c"funny register\00"
define i32 @regno() {
%1 = tail call i32 @getreg(i32 511)
switch i32 %1, label %11 [
i32 6, label %13
i32 16, label %2
i32 32, label %3
i32 64, label %4
i32 128, label %5
i32 256, label %6
i32 2, label %7
i32 4, label %8
i32 1, label %9
i32 8, label %10
]
2: ; preds = %0
br label %13
3: ; preds = %0
br label %13
4: ; preds = %0
br label %13
5: ; preds = %0
br label %13
6: ; preds = %0
br label %13
7: ; preds = %0
br label %13
8: ; preds = %0
br label %13
9: ; preds = %0
br label %13
10: ; preds = %0
br label %13
11: ; preds = %0
%12 = tail call i32 @error(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %0, %11, %10, %9, %8, %7, %6, %5, %4, %3, %2
%14 = phi i32 [ 0, %11 ], [ 11, %10 ], [ 10, %9 ], [ 9, %8 ], [ 8, %7 ], [ 5, %6 ], [ 4, %5 ], [ 3, %4 ], [ 2, %3 ], [ 1, %2 ], [ 0, %0 ]
ret i32 %14
}