#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*/ showBadCharMessage(char);
int convertSingleCharacterToInt(char numeral) {
  switch (numeral) {
  case 'I':
    return 1;
  case 'V':
    return 5;
  case 'X':
    return 10;
  case 'L':
    return 50;
  case 'C':
    return 100;
  case 'D':
    return 500;
  case 'M':
    return 1000;
  }
  showBadCharMessage(numeral);
  return -1;
}


x86 assembly (clang, -O0):
<convertSingleCharacterToInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
add    $0xffffffbd,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x15,%eax
ja     119c <convertSingleCharacterToInt+0x8c>
mov    -0x10(%rbp),%rax
lea    0xec1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x1,-0x4(%rbp)
jmp    11ac <convertSingleCharacterToInt+0x9c>
movl   $0x5,-0x4(%rbp)
jmp    11ac <convertSingleCharacterToInt+0x9c>
movl   $0xa,-0x4(%rbp)
jmp    11ac <convertSingleCharacterToInt+0x9c>
movl   $0x32,-0x4(%rbp)
jmp    11ac <convertSingleCharacterToInt+0x9c>
movl   $0x64,-0x4(%rbp)
jmp    11ac <convertSingleCharacterToInt+0x9c>
movl   $0x1f4,-0x4(%rbp)
jmp    11ac <convertSingleCharacterToInt+0x9c>
movl   $0x3e8,-0x4(%rbp)
jmp    11ac <convertSingleCharacterToInt+0x9c>
movsbl -0x5(%rbp),%edi
call   1030 <showBadCharMessage@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convertSingleCharacterToInt>:
push   %rax
lea    -0x43(%rdi),%ecx
cmp    $0x15,%ecx
ja     113c <convertSingleCharacterToInt+0x2c>
mov    $0x1,%eax
lea    0xedb(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
mov    $0x64,%eax
pop    %rcx
ret
mov    $0x1f4,%eax
pop    %rcx
ret
movsbl %dil,%edi
call   1030 <showBadCharMessage@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret
mov    $0x32,%eax
pop    %rcx
ret
mov    $0x5,%eax
pop    %rcx
ret
mov    $0xa,%eax
pop    %rcx
ret
mov    $0x3e8,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @convertSingleCharacterToInt(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 %13 [
i32 73, label %6
i32 86, label %7
i32 88, label %8
i32 76, label %9
i32 67, label %10
i32 68, label %11
i32 77, label %12
]
6: ; preds = %1
store i32 1, i32* %2
br label %16
7: ; preds = %1
store i32 5, i32* %2
br label %16
8: ; preds = %1
store i32 10, i32* %2
br label %16
9: ; preds = %1
store i32 50, i32* %2
br label %16
10: ; preds = %1
store i32 100, i32* %2
br label %16
11: ; preds = %1
store i32 500, i32* %2
br label %16
12: ; preds = %1
store i32 1000, i32* %2
br label %16
13: ; preds = %1
%14 = load i8, i8* %3
%15 = call i32 @showBadCharMessage(i8 signext %14)
store i32 -1, i32* %2
br label %16
16: ; preds = %13, %12, %11, %10, %9, %8, %7, %6
%17 = load i32, i32* %2
ret i32 %17
}

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