#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*/ printf(char *);
void convert_tens(char number) {
  if (number == '1')
    printf("X");
  else if (number == '2')
    printf("XX");
  else if (number == '3')
    printf("XXX");
  else if (number == '4')
    printf("XL");
  else if (number == '5')
    printf("L");
  else if (number == '6')
    printf("LX");
  else if (number == '7')
    printf("LXX");
  else if (number == '8')
    printf("LXXX");
  else if (number == '9')
    printf("XC");
}


x86 assembly (clang, -O0):
<convert_tens>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x31,%eax
jne    113c <convert_tens+0x2c>
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
jmp    124f <convert_tens+0x13f>
movsbl -0x1(%rbp),%eax
cmp    $0x32,%eax
jne    115a <convert_tens+0x4a>
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
jmp    124a <convert_tens+0x13a>
movsbl -0x1(%rbp),%eax
cmp    $0x33,%eax
jne    1178 <convert_tens+0x68>
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
jmp    1245 <convert_tens+0x135>
movsbl -0x1(%rbp),%eax
cmp    $0x34,%eax
jne    1196 <convert_tens+0x86>
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
jmp    1240 <convert_tens+0x130>
movsbl -0x1(%rbp),%eax
cmp    $0x35,%eax
jne    11b4 <convert_tens+0xa4>
lea    0xe57(%rip),%rdi
call   1030 <printf@plt>
jmp    123b <convert_tens+0x12b>
movsbl -0x1(%rbp),%eax
cmp    $0x36,%eax
jne    11d2 <convert_tens+0xc2>
lea    0xe3b(%rip),%rdi
call   1030 <printf@plt>
jmp    1236 <convert_tens+0x126>
movsbl -0x1(%rbp),%eax
cmp    $0x37,%eax
jne    11f0 <convert_tens+0xe0>
lea    0xe20(%rip),%rdi
call   1030 <printf@plt>
jmp    1231 <convert_tens+0x121>
movsbl -0x1(%rbp),%eax
cmp    $0x38,%eax
jne    120e <convert_tens+0xfe>
lea    0xe06(%rip),%rdi
call   1030 <printf@plt>
jmp    122c <convert_tens+0x11c>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
jne    1227 <convert_tens+0x117>
lea    0xded(%rip),%rdi
call   1030 <printf@plt>
jmp    122c <convert_tens+0x11c>
jmp    1231 <convert_tens+0x121>
jmp    1236 <convert_tens+0x126>
jmp    123b <convert_tens+0x12b>
jmp    1240 <convert_tens+0x130>
jmp    1245 <convert_tens+0x135>
jmp    124a <convert_tens+0x13a>
jmp    124f <convert_tens+0x13f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_tens>:
add    $0xcf,%dil
cmp    $0x8,%dil
ja     1148 <convert_tens+0x28>
movzbl %dil,%eax
lea    0xecb(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x58,%edi
jmp    1030 <putchar@plt>
ret
lea    0xedb(%rip),%rdi
jmp    1040 <printf@plt>
lea    0xed3(%rip),%rdi
jmp    1040 <printf@plt>
lea    0xebc(%rip),%rdi
jmp    1040 <printf@plt>
mov    $0x4c,%edi
jmp    1030 <putchar@plt>
lea    0xea9(%rip),%rdi
jmp    1040 <printf@plt>
lea    0xea0(%rip),%rdi
jmp    1040 <printf@plt>
lea    0xe98(%rip),%rdi
jmp    1040 <printf@plt>
lea    0xe91(%rip),%rdi
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"X\00"
@.str.1 = [3 x i8] c"XX\00"
@.str.2 = [4 x i8] c"XXX\00"
@.str.3 = [3 x i8] c"XL\00"
@.str.4 = [2 x i8] c"L\00"
@.str.5 = [3 x i8] c"LX\00"
@.str.6 = [4 x i8] c"LXX\00"
@.str.7 = [5 x i8] c"LXXX\00"
@.str.8 = [3 x i8] c"XC\00"
define void @convert_tens(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 49
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %64
8: ; preds = %1
%9 = load i8, i8* %2
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 50
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %63
14: ; preds = %8
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 51
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %62
20: ; preds = %14
%21 = load i8, i8* %2
%22 = sext i8 %21 to i32
%23 = icmp eq i32 %22, 52
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %61
26: ; preds = %20
%27 = load i8, i8* %2
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 53
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %60
32: ; preds = %26
%33 = load i8, i8* %2
%34 = sext i8 %33 to i32
%35 = icmp eq i32 %34, 54
br i1 %35, label %36, label %38
36: ; preds = %32
%37 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %59
38: ; preds = %32
%39 = load i8, i8* %2
%40 = sext i8 %39 to i32
%41 = icmp eq i32 %40, 55
br i1 %41, label %42, label %44
42: ; preds = %38
%43 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
br label %58
44: ; preds = %38
%45 = load i8, i8* %2
%46 = sext i8 %45 to i32
%47 = icmp eq i32 %46, 56
br i1 %47, label %48, label %50
48: ; preds = %44
%49 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
br label %57
50: ; preds = %44
%51 = load i8, i8* %2
%52 = sext i8 %51 to i32
%53 = icmp eq i32 %52, 57
br i1 %53, label %54, label %56
54: ; preds = %50
%55 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
br label %56
56: ; preds = %54, %50
br label %57
57: ; preds = %56, %48
br label %58
58: ; preds = %57, %42
br label %59
59: ; preds = %58, %36
br label %60
60: ; preds = %59, %30
br label %61
61: ; preds = %60, %24
br label %62
62: ; preds = %61, %18
br label %63
63: ; preds = %62, %12
br label %64
64: ; preds = %63, %6
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"XX\00"
@.str.2 = [4 x i8] c"XXX\00"
@.str.3 = [3 x i8] c"XL\00"
@.str.5 = [3 x i8] c"LX\00"
@.str.6 = [4 x i8] c"LXX\00"
@.str.7 = [5 x i8] c"LXXX\00"
@.str.8 = [3 x i8] c"XC\00"
define void @convert_tens(i8 signext %0) {
switch i8 %0, label %20 [
i8 49, label %2
i8 50, label %4
i8 51, label %6
i8 52, label %8
i8 53, label %10
i8 54, label %12
i8 55, label %14
i8 56, label %16
i8 57, label %18
]
2: ; preds = %1
%3 = tail call i32 @putchar(i32 88)
br label %20
4: ; preds = %1
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %20
6: ; preds = %1
%7 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %20
8: ; preds = %1
%9 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %20
10: ; preds = %1
%11 = tail call i32 @putchar(i32 76)
br label %20
12: ; preds = %1
%13 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %20
14: ; preds = %1
%15 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
br label %20
16: ; preds = %1
%17 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
br label %20
18: ; preds = %1
%19 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
br label %20
20: ; preds = %1, %4, %8, %12, %16, %18, %14, %10, %6, %2
ret void
}