#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 *, char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  char *unidades[] = {"I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"};
  char *dezenas[] = {"X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"};
  char *centenas[] = {"C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"};
  int numero;
  scanf("%d", &numero);
  int unidade = (numero % 100) % 10;
  int dezena = (numero % 100) / 10;
  int centena = numero / 100;
  if (centena)
    printf("%s", centenas[centena - 1]);
  if (dezena)
    printf("%s", dezenas[dezena - 1]);
  if (unidade)
    printf("%s", unidades[unidade - 1]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x50(%rbp),%rdi
lea    0x2be3(%rip),%rsi
mov    $0x48,%edx
call   1040 <memcpy@plt>
lea    -0xa0(%rbp),%rdi
lea    0x2c1b(%rip),%rsi
mov    $0x48,%edx
call   1040 <memcpy@plt>
lea    -0xf0(%rbp),%rdi
lea    0x2c53(%rip),%rsi
mov    $0x48,%edx
call   1040 <memcpy@plt>
lea    0xea8(%rip),%rdi
lea    -0xf4(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0xf4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xf8(%rbp)
mov    -0xf4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xfc(%rbp)
mov    -0xf4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %eax,-0x100(%rbp)
cmpl   $0x0,-0x100(%rbp)
je     1216 <main+0xe6>
mov    -0x100(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0xf0(%rbp,%rax,8),%rsi
ff
lea    0xe28(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0xfc(%rbp)
je     1242 <main+0x112>
mov    -0xfc(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0xa0(%rbp,%rax,8),%rsi
ff
lea    0xdfc(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0xf8(%rbp)
je     126b <main+0x13b>
mov    -0xf8(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x50(%rbp,%rax,8),%rsi
lea    0xdd3(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xf08(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
movslq 0x4(%rsp),%rcx
imul   $0x51eb851f,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rax
add    %edx,%eax
imul   $0x64,%eax,%edx
lea    0x63(%rcx),%esi
mov    %ecx,%ebx
sub    %edx,%ebx
mov    %ebx,%r14d
movsbl %bl,%ecx
imul   $0x67,%ecx,%ecx
movzwl %cx,%ecx
movswl %cx,%ebp
shr    $0xf,%ecx
shr    $0xa,%ebp
add    %cl,%bpl
movzbl %bpl,%ecx
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%r15d
cmp    $0xc7,%esi
jb     11a2 <main+0x82>
cltq
lea    0xef6(%rip),%rcx
movslq -0x4(%rcx,%rax,4),%rsi
add    %rcx,%rsi
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
sub    %r15b,%r14b
add    $0x9,%ebx
cmp    $0x13,%ebx
jb     11cc <main+0xac>
movsbq %bpl,%rax
lea    0xea8(%rip),%rcx
movslq -0x4(%rcx,%rax,4),%rsi
add    %rcx,%rsi
lea    0xe72(%rip),%rdi
call   1030 <printf@plt>
test   %r14b,%r14b
je     11f0 <main+0xd0>
movsbq %r14b,%rax
lea    0xe60(%rip),%rcx
movslq -0x4(%rcx,%rax,4),%rsi
add    %rcx,%rsi
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"I\00"
@.str.1 = [3 x i8] c"II\00"
@.str.2 = [4 x i8] c"III\00"
@.str.3 = [3 x i8] c"IV\00"
@.str.4 = [2 x i8] c"V\00"
@.str.5 = [3 x i8] c"VI\00"
@.str.6 = [4 x i8] c"VII\00"
@.str.7 = [5 x i8] c"VIII\00"
@.str.8 = [3 x i8] c"IX\00"
@__const.main.unidades = [9 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i32 0, i32 0)]
@.str.9 = [2 x i8] c"X\00"
@.str.10 = [3 x i8] c"XX\00"
@.str.11 = [4 x i8] c"XXX\00"
@.str.12 = [3 x i8] c"XL\00"
@.str.13 = [2 x i8] c"L\00"
@.str.14 = [3 x i8] c"LX\00"
@.str.15 = [4 x i8] c"LXX\00"
@.str.16 = [5 x i8] c"LXXX\00"
@.str.17 = [3 x i8] c"XC\00"
@__const.main.dezenas = [9 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i32 0, i32 0)]
@.str.18 = [2 x i8] c"C\00"
@.str.19 = [3 x i8] c"CC\00"
@.str.20 = [4 x i8] c"CCC\00"
@.str.21 = [3 x i8] c"CD\00"
@.str.22 = [2 x i8] c"D\00"
@.str.23 = [3 x i8] c"DC\00"
@.str.24 = [4 x i8] c"DCC\00"
@.str.25 = [5 x i8] c"DCCC\00"
@.str.26 = [3 x i8] c"CM\00"
@__const.main.centenas = [9 x i8*] [i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.19, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.20, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.21, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.22, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.23, i32 0, i32 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.24, i32 0, i32 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.25, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.26, i32 0, i32 0)]
@.str.27 = [3 x i8] c"%d\00"
@.str.28 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [9 x i8*]
%3 = alloca [9 x i8*]
%4 = alloca [9 x i8*]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = bitcast [9 x i8*]* %2 to i8*
%10 = bitcast [9 x i8*]* %3 to i8*
%11 = bitcast [9 x i8*]* %4 to i8*
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.27, i64 0, i64 0), i32* %5)
%13 = load i32, i32* %5
%14 = srem i32 %13, 100
%15 = srem i32 %14, 10
store i32 %15, i32* %6
%16 = load i32, i32* %5
%17 = srem i32 %16, 100
%18 = sdiv i32 %17, 10
store i32 %18, i32* %7
%19 = load i32, i32* %5
%20 = sdiv i32 %19, 100
store i32 %20, i32* %8
%21 = load i32, i32* %8
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %30
23: ; preds = %0
%24 = load i32, i32* %8
%25 = sub nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [9 x i8*], [9 x i8*]* %4, i64 0, i64 %26
%28 = load i8*, i8** %27
%29 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.28, i64 0, i64 0), i8* %28)
br label %30
30: ; preds = %23, %0
%31 = load i32, i32* %7
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %40
33: ; preds = %30
%34 = load i32, i32* %7
%35 = sub nsw i32 %34, 1
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [9 x i8*], [9 x i8*]* %3, i64 0, i64 %36
%38 = load i8*, i8** %37
%39 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.28, i64 0, i64 0), i8* %38)
br label %40
40: ; preds = %33, %30
%41 = load i32, i32* %6
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %50
43: ; preds = %40
%44 = load i32, i32* %6
%45 = sub nsw i32 %44, 1
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [9 x i8*], [9 x i8*]* %2, i64 0, i64 %46
%48 = load i8*, i8** %47
%49 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.28, i64 0, i64 0), i8* %48)
br label %50
50: ; preds = %43, %40
%51 = load i32, i32* %1
ret i32 %51
}

LLVM IR (-O2):
@.str = [2 x i8] c"I\00"
@.str.1 = [3 x i8] c"II\00"
@.str.2 = [4 x i8] c"III\00"
@.str.3 = [3 x i8] c"IV\00"
@.str.4 = [2 x i8] c"V\00"
@.str.5 = [3 x i8] c"VI\00"
@.str.6 = [4 x i8] c"VII\00"
@.str.7 = [5 x i8] c"VIII\00"
@.str.8 = [3 x i8] c"IX\00"
@reltable.main = [9 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.1 to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.2 to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.3 to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.4 to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.5 to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.6 to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.7 to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.8 to i64), i64 ptrtoint ([9 x i32]* @reltable.main to i64)) to i32)]
@.str.9 = [2 x i8] c"X\00"
@.str.10 = [3 x i8] c"XX\00"
@.str.11 = [4 x i8] c"XXX\00"
@.str.12 = [3 x i8] c"XL\00"
@.str.13 = [2 x i8] c"L\00"
@.str.14 = [3 x i8] c"LX\00"
@.str.15 = [4 x i8] c"LXX\00"
@.str.16 = [5 x i8] c"LXXX\00"
@.str.17 = [3 x i8] c"XC\00"
@reltable.main.29 = [9 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.9 to i64), i64 ptrtoint ([9 x i32]* @reltable.main.29 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.10 to i64), i64 ptrtoint ([9 x i32]* @reltable.main.29 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.11 to i64), i64 ptrtoint ([9 x i32]* @reltable.main.29 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.12 to i64), i64 ptrtoint ([9 x i32]* @reltable.main.29 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.13 to i64), i64 ptrtoint ([9 x i32]* @reltable.main.29 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.14 to i64), i64 ptrtoint ([9 x i32]* @reltable.main.29 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.15 to i64), i64 ptrtoint ([9 x i32]* @reltable.main.29 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.16 to i64), i64 ptrtoint ([9 x i32]* @reltable.main.29 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.17 to i64), i64 ptrtoint ([9 x i32]* @reltable.main.29 to i64)) to i32)]
@.str.18 = [2 x i8] c"C\00"
@.str.19 = [3 x i8] c"CC\00"
@.str.20 = [4 x i8] c"CCC\00"
@.str.21 = [3 x i8] c"CD\00"
@.str.22 = [2 x i8] c"D\00"
@.str.23 = [3 x i8] c"DC\00"
@.str.24 = [4 x i8] c"DCC\00"
@.str.25 = [5 x i8] c"DCCC\00"
@.str.26 = [3 x i8] c"CM\00"
@reltable.main.30 = [9 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.18 to i64), i64 ptrtoint ([9 x i32]* @reltable.main.30 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.19 to i64), i64 ptrtoint ([9 x i32]* @reltable.main.30 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.20 to i64), i64 ptrtoint ([9 x i32]* @reltable.main.30 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.21 to i64), i64 ptrtoint ([9 x i32]* @reltable.main.30 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.22 to i64), i64 ptrtoint ([9 x i32]* @reltable.main.30 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.23 to i64), i64 ptrtoint ([9 x i32]* @reltable.main.30 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.24 to i64), i64 ptrtoint ([9 x i32]* @reltable.main.30 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str.25 to i64), i64 ptrtoint ([9 x i32]* @reltable.main.30 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.26 to i64), i64 ptrtoint ([9 x i32]* @reltable.main.30 to i64)) to i32)]
@.str.27 = [3 x i8] c"%d\00"
@.str.28 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.27, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = srem i32 %4, 100
%6 = sdiv i32 %4, 100
%7 = trunc i32 %5 to i8
%8 = srem i8 %7, 10
%9 = sdiv i8 %7, 10
%10 = add i32 %4, 99
%11 = icmp ult i32 %10, 199
br i1 %11, label %18, label %12
12: ; preds = %0
%13 = add nsw i32 %6, -1
%14 = sext i32 %13 to i64
%15 = shl i64 %14, 2
%16 = call i8* @llvm.load.relative.i64(i8* bitcast ([9 x i32]* @reltable.main.30 to i8*), i64 %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.28, i64 0, i64 0), i8* %16)
br label %18
18: ; preds = %12, %0
%19 = add nsw i32 %5, 9
%20 = icmp ult i32 %19, 19
br i1 %20, label %27, label %21
21: ; preds = %18
%22 = add nsw i8 %9, -1
%23 = sext i8 %22 to i64
%24 = shl i64 %23, 2
%25 = call i8* @llvm.load.relative.i64(i8* bitcast ([9 x i32]* @reltable.main.29 to i8*), i64 %24)
%26 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.28, i64 0, i64 0), i8* %25)
br label %27
27: ; preds = %21, %18
%28 = icmp eq i8 %8, 0
br i1 %28, label %35, label %29
29: ; preds = %27
%30 = add nsw i8 %8, -1
%31 = sext i8 %30 to i64
%32 = shl i64 %31, 2
%33 = call i8* @llvm.load.relative.i64(i8* bitcast ([9 x i32]* @reltable.main to i8*), i64 %32)
%34 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.28, i64 0, i64 0), i8* %33)
br label %35
35: ; preds = %29, %27
ret i32 0
}