#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 */
typedef int int32_t;

/* Variables and functions */
int32_t __romstr_v(const char c) {
  switch (c) {
  case 'n':
  case 'N':
    return 0;
  case 'i':
  case 'I':
    return 1;
  case 'v':
  case 'V':
    return 5;
  case 'x':
  case 'X':
    return 10;
  case 'l':
  case 'L':
    return 50;
  case 'c':
  case 'C':
    return 100;
  case 'd':
  case 'D':
    return 500;
  case 'm':
  case 'M':
    return 1000;
  default:
    return -1;
  }
}


x86 assembly (clang, -O0):
<__romstr_v>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
add    $0xffffffbd,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x35,%eax
ja     1194 <__romstr_v+0x94>
mov    -0x10(%rbp),%rax
lea    0xed5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x0,-0x4(%rbp)
jmp    119b <__romstr_v+0x9b>
movl   $0x1,-0x4(%rbp)
jmp    119b <__romstr_v+0x9b>
movl   $0x5,-0x4(%rbp)
jmp    119b <__romstr_v+0x9b>
movl   $0xa,-0x4(%rbp)
jmp    119b <__romstr_v+0x9b>
movl   $0x32,-0x4(%rbp)
jmp    119b <__romstr_v+0x9b>
movl   $0x64,-0x4(%rbp)
jmp    119b <__romstr_v+0x9b>
movl   $0x1f4,-0x4(%rbp)
jmp    119b <__romstr_v+0x9b>
movl   $0x3e8,-0x4(%rbp)
jmp    119b <__romstr_v+0x9b>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__romstr_v>:
add    $0xffffffbd,%edi
cmp    $0x35,%edi
ja     1144 <__romstr_v+0x44>
xor    %eax,%eax
lea    0xeef(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    $0x64,%eax
ret
mov    $0x1f4,%eax
ret
mov    $0x1,%eax
ret
mov    $0x32,%eax
ret
mov    $0x3e8,%eax
ret
mov    $0x5,%eax
ret
mov    $0xa,%eax
ret
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @__romstr_v(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
switch i32 %5, label %14 [
i32 110, label %6
i32 78, label %6
i32 105, label %7
i32 73, label %7
i32 118, label %8
i32 86, label %8
i32 120, label %9
i32 88, label %9
i32 108, label %10
i32 76, label %10
i32 99, label %11
i32 67, label %11
i32 100, label %12
i32 68, label %12
i32 109, label %13
i32 77, label %13
]
6: ; preds = %1, %1
store i32 0, i32* %2
br label %15
7: ; preds = %1, %1
store i32 1, i32* %2
br label %15
8: ; preds = %1, %1
store i32 5, i32* %2
br label %15
9: ; preds = %1, %1
store i32 10, i32* %2
br label %15
10: ; preds = %1, %1
store i32 50, i32* %2
br label %15
11: ; preds = %1, %1
store i32 100, i32* %2
br label %15
12: ; preds = %1, %1
store i32 500, i32* %2
br label %15
13: ; preds = %1, %1
store i32 1000, i32* %2
br label %15
14: ; preds = %1
store i32 -1, i32* %2
br label %15
15: ; preds = %14, %13, %12, %11, %10, %9, %8, %7, %6
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @__romstr_v(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %10 [
i32 110, label %11
i32 78, label %11
i32 105, label %3
i32 73, label %3
i32 118, label %4
i32 86, label %4
i32 120, label %5
i32 88, label %5
i32 108, label %6
i32 76, label %6
i32 99, label %7
i32 67, label %7
i32 100, label %8
i32 68, label %8
i32 109, label %9
i32 77, label %9
]
3: ; preds = %1, %1
br label %11
4: ; preds = %1, %1
br label %11
5: ; preds = %1, %1
br label %11
6: ; preds = %1, %1
br label %11
7: ; preds = %1, %1
br label %11
8: ; preds = %1, %1
br label %11
9: ; preds = %1, %1
br label %11
10: ; preds = %1
br label %11
11: ; preds = %1, %1, %10, %9, %8, %7, %6, %5, %4, %3
%12 = phi i32 [ -1, %10 ], [ 1000, %9 ], [ 500, %8 ], [ 100, %7 ], [ 50, %6 ], [ 10, %5 ], [ 5, %4 ], [ 1, %3 ], [ 0, %1 ], [ 0, %1 ]
ret i32 %12
}