int Roman_Value(char character) {
  int n = 0;
  if (character == 'I')
    n = 1;
  else if (character == 'V')
    n = 5;
  else if (character == 'X')
    n = 10;
  else if (character == 'L')
    n = 50;
  else if (character == 'C')
    n = 100;
  else if (character == '\0')
    n = 0;
  return n;
}


x86 assembly (clang, -O0):
<Roman_Value>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x0,-0x8(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x49,%eax
jne    112a <Roman_Value+0x2a>
movl   $0x1,-0x8(%rbp)
jmp    11bb <Roman_Value+0xbb>
movsbl -0x1(%rbp),%eax
cmp    $0x56,%eax
jne    1143 <Roman_Value+0x43>
movl   $0x5,-0x8(%rbp)
jmp    11b6 <Roman_Value+0xb6>
movsbl -0x1(%rbp),%eax
cmp    $0x58,%eax
jne    115c <Roman_Value+0x5c>
movl   $0xa,-0x8(%rbp)
jmp    11b1 <Roman_Value+0xb1>
movsbl -0x1(%rbp),%eax
cmp    $0x4c,%eax
jne    1175 <Roman_Value+0x75>
movl   $0x32,-0x8(%rbp)
jmp    11ac <Roman_Value+0xac>
movsbl -0x1(%rbp),%eax
cmp    $0x43,%eax
jne    118e <Roman_Value+0x8e>
movl   $0x64,-0x8(%rbp)
jmp    11a7 <Roman_Value+0xa7>
movsbl -0x1(%rbp),%eax
cmp    $0x0,%eax
jne    11a2 <Roman_Value+0xa2>
movl   $0x0,-0x8(%rbp)
jmp    11a7 <Roman_Value+0xa7>
jmp    11ac <Roman_Value+0xac>
jmp    11b1 <Roman_Value+0xb1>
jmp    11b6 <Roman_Value+0xb6>
jmp    11bb <Roman_Value+0xbb>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Roman_Value>:
lea    -0x43(%rdi),%ecx
cmp    $0x15,%cl
ja     1126 <Roman_Value+0x26>
mov    $0x1,%eax
movzbl %cl,%ecx
lea    0xee9(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x64,%eax
ret
test   %dil,%dil
xor    %eax,%eax
ret
mov    $0x32,%eax
ret
mov    $0x5,%eax
ret
mov    $0xa,%eax
ret

LLVM IR (-O0):
define i32 @Roman_Value(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
store i32 0, i32* %3
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = icmp eq i32 %5, 73
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 1, i32* %3
br label %38
8: ; preds = %1
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 86
br i1 %11, label %12, label %13
12: ; preds = %8
store i32 5, i32* %3
br label %37
13: ; preds = %8
%14 = load i8, i8* %2
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 88
br i1 %16, label %17, label %18
17: ; preds = %13
store i32 10, i32* %3
br label %36
18: ; preds = %13
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 76
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 50, i32* %3
br label %35
23: ; preds = %18
%24 = load i8, i8* %2
%25 = sext i8 %24 to i32
%26 = icmp eq i32 %25, 67
br i1 %26, label %27, label %28
27: ; preds = %23
store i32 100, i32* %3
br label %34
28: ; preds = %23
%29 = load i8, i8* %2
%30 = sext i8 %29 to i32
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %33
32: ; preds = %28
store i32 0, i32* %3
br label %33
33: ; preds = %32, %28
br label %34
34: ; preds = %33, %27
br label %35
35: ; preds = %34, %22
br label %36
36: ; preds = %35, %17
br label %37
37: ; preds = %36, %12
br label %38
38: ; preds = %37, %7
%39 = load i32, i32* %3
ret i32 %39
}

LLVM IR (-O2):
define i32 @Roman_Value(i8 signext %0) {
switch i8 %0, label %7 [
i8 73, label %8
i8 86, label %2
i8 88, label %3
i8 76, label %4
i8 67, label %5
i8 0, label %6
]
2: ; preds = %1
br label %8
3: ; preds = %1
br label %8
4: ; preds = %1
br label %8
5: ; preds = %1
br label %8
6: ; preds = %1
br label %8
7: ; preds = %1
br label %8
8: ; preds = %1, %7, %2, %4, %6, %5, %3
%9 = phi i32 [ 5, %2 ], [ 10, %3 ], [ 50, %4 ], [ 100, %5 ], [ 0, %6 ], [ 1, %1 ], [ 0, %7 ]
ret i32 %9
}