#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 *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ toRoman(int);
int main() {
  int n;
  char *roman;
  printf("Please enter a decimal number (1-3999):");
  scanf("%d", &n);
  if (n < 1 || n > 3999) {
    printf("Illegal Parameter!\n");
    return 1;
  }
  toRoman(n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
lea    0xed6(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x1,-0x8(%rbp)
jl     1172 <main+0x42>
cmpl   $0xf9f,-0x8(%rbp)
jle    118a <main+0x5a>
lea    0xeb2(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1199 <main+0x69>
mov    -0x8(%rbp),%edi
call   1030 <toRoman@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1050 <printf@plt>
lea    0xed4(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
mov    0x4(%rsp),%edi
lea    -0xfa0(%rdi),%eax
cmp    $0xfffff060,%eax
ja     1182 <main+0x42>
lea    0xeb5(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%eax
pop    %rcx
ret
call   1030 <toRoman@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [40 x i8] c"Please enter a decimal number (1-3999):\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"Illegal Parameter!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
store i32 0, i32* %1
%4 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 1
br i1 %7, label %11, label %8
8: ; preds = %0
%9 = load i32, i32* %2
%10 = icmp sgt i32 %9, 3999
br i1 %10, label %11, label %13
11: ; preds = %8, %0
%12 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %16
13: ; preds = %8
%14 = load i32, i32* %2
%15 = call i32 @toRoman(i32 %14)
store i32 0, i32* %1
br label %16
16: ; preds = %13, %11
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
@.str = [40 x i8] c"Please enter a decimal number (1-3999):\00"
@.str.1 = [3 x i8] c"%d\00"
@str = [19 x i8] c"Illegal Parameter!\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = add i32 %5, -4000
%7 = icmp ult i32 %6, -3999
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
br label %12
10: ; preds = %0
%11 = call i32 @toRoman(i32 %5)
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ 1, %8 ], [ 0, %10 ]
ret i32 %13
}