#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 /*<<< orphan*/ arabicos;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main() {
  for (int i = 1; i < 3000; i++) {
    int numero = i;
    char *romanos[] = {"I",  "IV", "V",  "IX", "X",  "XL", "L",
                       "XC", "C",  "CD", "D",  "CM", "M"};
    int arabicos[] = {1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000};
    int indice = (sizeof(arabicos) / sizeof(arabicos[0])) - 1;
    while (numero > 0) {
      if (numero >= arabicos[indice]) {
        printf("%s", romanos[indice]);
        numero -= arabicos[indice];
      } else {
        indice--;
      }
    }
    printf("\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0xbb8,-0x8(%rbp)
jge    1209 <main+0xe9>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
lea    -0x80(%rbp),%rdi
lea    0x2c59(%rip),%rsi
mov    $0x68,%edx
call   1040 <memcpy@plt>
lea    -0xc0(%rbp),%rdi
lea    0xeb1(%rip),%rsi
mov    $0x34,%edx
call   1040 <memcpy@plt>
movl   $0xc,-0xc4(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    11ed <main+0xcd>
mov    -0xc(%rbp),%eax
movslq -0xc4(%rbp),%rcx
cmp    -0xc0(%rbp,%rcx,4),%eax
jl     11d9 <main+0xb9>
movslq -0xc4(%rbp),%rax
mov    -0x80(%rbp,%rax,8),%rsi
lea    0xe5d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0xc4(%rbp),%rax
mov    -0xc0(%rbp,%rax,4),%ecx
mov    -0xc(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    11e8 <main+0xc8>
mov    -0xc4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc4(%rbp)
jmp    1183 <main+0x63>
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1139 <main+0x19>
mov    -0x4(%rbp),%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x1,%r14d
lea    0xf28(%rip),%r12
lea    0xee1(%rip),%r13
lea    0xece(%rip),%r15
jmp    1167 <main+0x47>
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r14d
cmp    $0xbb8,%r14d
je     11ae <main+0x8e>
mov    $0xc,%ebp
mov    %r14d,%eax
jmp    1189 <main+0x69>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0xffffffff,%ebp
mov    %eax,%ebx
test   %ebx,%ebx
jle    1150 <main+0x30>
movslq %ebp,%rcx
mov    %eax,%ebx
sub    (%r12,%rcx,4),%ebx
jl     1180 <main+0x60>
movslq 0x0(%r13,%rcx,4),%rsi
add    %r13,%rsi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
test   %ebx,%ebx
jg     1189 <main+0x69>
jmp    1150 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"I\00"
@.str.1 = [3 x i8] c"IV\00"
@.str.2 = [2 x i8] c"V\00"
@.str.3 = [3 x i8] c"IX\00"
@.str.4 = [2 x i8] c"X\00"
@.str.5 = [3 x i8] c"XL\00"
@.str.6 = [2 x i8] c"L\00"
@.str.7 = [3 x i8] c"XC\00"
@.str.8 = [2 x i8] c"C\00"
@.str.9 = [3 x i8] c"CD\00"
@.str.10 = [2 x i8] c"D\00"
@.str.11 = [3 x i8] c"CM\00"
@.str.12 = [2 x i8] c"M\00"
@__const.main.romanos = [13 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 ([2 x i8], [2 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 ([2 x i8], [2 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.12, i32 0, i32 0)]
@__const.main.arabicos = [13 x i32] [i32 1, i32 4, i32 5, i32 9, i32 10, i32 40, i32 50, i32 90, i32 100, i32 400, i32 500, i32 900, i32 1000]
@.str.13 = [3 x i8] c"%s\00"
@.str.14 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [13 x i8*]
%5 = alloca [13 x i32]
%6 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
br label %7
7: ; preds = %42, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 3000
br i1 %9, label %10, label %45
10: ; preds = %7
%11 = load i32, i32* %2
store i32 %11, i32* %3
%12 = bitcast [13 x i8*]* %4 to i8*
%13 = bitcast [13 x i32]* %5 to i8*
store i32 12, i32* %6
br label %14
14: ; preds = %39, %10
%15 = load i32, i32* %3
%16 = icmp sgt i32 %15, 0
br i1 %16, label %17, label %40
17: ; preds = %14
%18 = load i32, i32* %3
%19 = load i32, i32* %6
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [13 x i32], [13 x i32]* %5, i64 0, i64 %20
%22 = load i32, i32* %21
%23 = icmp sge i32 %18, %22
br i1 %23, label %24, label %36
24: ; preds = %17
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [13 x i8*], [13 x i8*]* %4, i64 0, i64 %26
%28 = load i8*, i8** %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* %28)
%30 = load i32, i32* %6
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [13 x i32], [13 x i32]* %5, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = load i32, i32* %3
%35 = sub nsw i32 %34, %33
store i32 %35, i32* %3
br label %39
36: ; preds = %17
%37 = load i32, i32* %6
%38 = add nsw i32 %37, -1
store i32 %38, i32* %6
br label %39
39: ; preds = %36, %24
br label %14
40: ; preds = %14
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.14, i64 0, i64 0))
br label %42
42: ; preds = %40
%43 = load i32, i32* %2
%44 = add nsw i32 %43, 1
store i32 %44, i32* %2
br label %7
45: ; preds = %7
%46 = load i32, i32* %1
ret i32 %46
}

LLVM IR (-O2):
@.str = [2 x i8] c"I\00"
@.str.1 = [3 x i8] c"IV\00"
@.str.2 = [2 x i8] c"V\00"
@.str.3 = [3 x i8] c"IX\00"
@.str.4 = [2 x i8] c"X\00"
@.str.5 = [3 x i8] c"XL\00"
@.str.6 = [2 x i8] c"L\00"
@.str.7 = [3 x i8] c"XC\00"
@.str.8 = [2 x i8] c"C\00"
@.str.9 = [3 x i8] c"CD\00"
@.str.10 = [2 x i8] c"D\00"
@.str.11 = [3 x i8] c"CM\00"
@.str.12 = [2 x i8] c"M\00"
@reltable.main = [13 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str to i64), i64 ptrtoint ([13 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.1 to i64), i64 ptrtoint ([13 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.2 to i64), i64 ptrtoint ([13 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.3 to i64), i64 ptrtoint ([13 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.4 to i64), i64 ptrtoint ([13 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.5 to i64), i64 ptrtoint ([13 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.6 to i64), i64 ptrtoint ([13 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.7 to i64), i64 ptrtoint ([13 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.8 to i64), i64 ptrtoint ([13 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.9 to i64), i64 ptrtoint ([13 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.10 to i64), i64 ptrtoint ([13 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.11 to i64), i64 ptrtoint ([13 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([2 x i8]* @.str.12 to i64), i64 ptrtoint ([13 x i32]* @reltable.main to i64)) to i32)]
@__const.main.arabicos = [13 x i32] [i32 1, i32 4, i32 5, i32 9, i32 10, i32 40, i32 50, i32 90, i32 100, i32 400, i32 500, i32 900, i32 1000]
@.str.13 = [3 x i8] c"%s\00"
define i32 @main() {
br label %1
1: ; preds = %0, %22
%2 = phi i32 [ 1, %0 ], [ %24, %22 ]
br label %4
3: ; preds = %22
ret i32 0
4: ; preds = %1, %18
%5 = phi i32 [ 12, %1 ], [ %20, %18 ]
%6 = phi i32 [ %2, %1 ], [ %19, %18 ]
%7 = sext i32 %5 to i64
%8 = getelementptr inbounds [13 x i32], [13 x i32]* @__const.main.arabicos, i64 0, i64 %7
%9 = load i32, i32* %8
%10 = icmp slt i32 %6, %9
br i1 %10, label %16, label %11
11: ; preds = %4
%12 = shl i64 %7, 2
%13 = call i8* @llvm.load.relative.i64(i8* bitcast ([13 x i32]* @reltable.main to i8*), i64 %12)
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* %13)
%15 = sub nsw i32 %6, %9
br label %18
16: ; preds = %4
%17 = add nsw i32 %5, -1
br label %18
18: ; preds = %16, %11
%19 = phi i32 [ %15, %11 ], [ %6, %16 ]
%20 = phi i32 [ %5, %11 ], [ %17, %16 ]
%21 = icmp sgt i32 %19, 0
br i1 %21, label %4, label %22
22: ; preds = %18
%23 = tail call i32 @putchar(i32 10)
%24 = add nuw nsw i32 %2, 1
%25 = icmp eq i32 %24, 3000
br i1 %25, label %3, label %1
}