#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 atoi(char *);
int /*<<< orphan*/ checknum(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ to_roman(int, char *);
int main(int argc, char *argv[]) {
  int low, high;
  char roman[25];
  if (argc < 2) {
    printf("Usage:roman decimal numbel\n");
    exit(0);
  }
  high = low = atoi(argv[1]);
  checknum(low);
  if (argc > 2) {
    high = atoi(argv[2]);
    checknum(high);
    if (low > high) {
      low += high;
      high = low - high;
      low -= high;
    }
  } else
    low = 1;
  for (; low <= high; low++) {
    to_roman(low, roman);
    printf("%d\t%s\n", low, roman);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    1185 <main+0x35>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <checknum@plt>
cmpl   $0x2,-0x8(%rbp)
jle    11f0 <main+0xa0>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1040 <checknum@plt>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    11eb <main+0x9b>
mov    -0x18(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x14(%rbp)
jmp    11f7 <main+0xa7>
movl   $0x1,-0x14(%rbp)
jmp    11fc <main+0xac>
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     1237 <main+0xe7>
mov    -0x14(%rbp),%edi
lea    -0x40(%rbp),%rsi
call   1070 <to_roman@plt>
mov    -0x14(%rbp),%esi
lea    -0x40(%rbp),%rdx
lea    0xdfa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11fc <main+0xac>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
cmp    $0x1,%edi
jle    11fe <main+0x9e>
mov    %rsi,%rbx
mov    %edi,%ebp
mov    0x8(%rsi),%rdi
call   1060 <atoi@plt>
mov    %eax,%r14d
mov    %eax,%edi
call   1050 <checknum@plt>
cmp    $0x2,%ebp
jne    119f <main+0x3f>
test   %r14d,%r14d
jle    11f1 <main+0x91>
mov    $0x1,%ebp
mov    %r14d,%r15d
jmp    11c0 <main+0x60>
mov    0x10(%rbx),%rdi
call   1060 <atoi@plt>
mov    %eax,%r15d
mov    %eax,%edi
call   1050 <checknum@plt>
cmp    %r15d,%r14d
mov    %r14d,%ebp
cmovg  %r15d,%ebp
cmovg  %r14d,%r15d
add    $0x1,%r15d
mov    %rsp,%rbx
lea    0xe32(%rip),%r14
xchg   %ax,%ax
mov    %ebp,%edi
mov    %rbx,%rsi
call   1080 <to_roman@plt>
mov    %r14,%rdi
mov    %ebp,%esi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    %ebp,%r15d
jne    11d0 <main+0x70>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe02(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"Usage:roman decimal numbel\0A\00"
@.str.1 = [7 x i8] c"%d\09%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [25 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 2
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @exit(i32 0)
unreachable
14: ; preds = %2
%15 = load i8**, i8*** %5
%16 = getelementptr inbounds i8*, i8** %15, i64 1
%17 = load i8*, i8** %16
%18 = call i32 @atoi(i8* %17)
store i32 %18, i32* %6
store i32 %18, i32* %7
%19 = load i32, i32* %6
%20 = call i32 @checknum(i32 %19)
%21 = load i32, i32* %4
%22 = icmp sgt i32 %21, 2
br i1 %22, label %23, label %44
23: ; preds = %14
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 2
%26 = load i8*, i8** %25
%27 = call i32 @atoi(i8* %26)
store i32 %27, i32* %7
%28 = load i32, i32* %7
%29 = call i32 @checknum(i32 %28)
%30 = load i32, i32* %6
%31 = load i32, i32* %7
%32 = icmp sgt i32 %30, %31
br i1 %32, label %33, label %43
33: ; preds = %23
%34 = load i32, i32* %7
%35 = load i32, i32* %6
%36 = add nsw i32 %35, %34
store i32 %36, i32* %6
%37 = load i32, i32* %6
%38 = load i32, i32* %7
%39 = sub nsw i32 %37, %38
store i32 %39, i32* %7
%40 = load i32, i32* %7
%41 = load i32, i32* %6
%42 = sub nsw i32 %41, %40
store i32 %42, i32* %6
br label %43
43: ; preds = %33, %23
br label %45
44: ; preds = %14
store i32 1, i32* %6
br label %45
45: ; preds = %44, %43
br label %46
46: ; preds = %57, %45
%47 = load i32, i32* %6
%48 = load i32, i32* %7
%49 = icmp sle i32 %47, %48
br i1 %49, label %50, label %60
50: ; preds = %46
%51 = load i32, i32* %6
%52 = getelementptr inbounds [25 x i8], [25 x i8]* %8, i64 0, i64 0
%53 = call i32 @to_roman(i32 %51, i8* %52)
%54 = load i32, i32* %6
%55 = getelementptr inbounds [25 x i8], [25 x i8]* %8, i64 0, i64 0
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %54, i8* %55)
br label %57
57: ; preds = %50
%58 = load i32, i32* %6
%59 = add nsw i32 %58, 1
store i32 %59, i32* %6
br label %46
60: ; preds = %46
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [7 x i8] c"%d\09%s\0A\00"
@str = [27 x i8] c"Usage:roman decimal numbel\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [25 x i8]
%4 = getelementptr inbounds [25 x i8], [25 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 0)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
%13 = tail call i32 @checknum(i32 %12)
%14 = icmp eq i32 %0, 2
br i1 %14, label %23, label %15
15: ; preds = %9
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = tail call i32 @atoi(i8* %17)
%19 = tail call i32 @checknum(i32 %18)
%20 = icmp sgt i32 %12, %18
%21 = select i1 %20, i32 %18, i32 %12
%22 = select i1 %20, i32 %12, i32 %18
br label %25
23: ; preds = %9
%24 = icmp slt i32 %12, 1
br i1 %24, label %34, label %25
25: ; preds = %15, %23
%26 = phi i32 [ %22, %15 ], [ %12, %23 ]
%27 = phi i32 [ %21, %15 ], [ 1, %23 ]
br label %28
28: ; preds = %25, %28
%29 = phi i32 [ %32, %28 ], [ %27, %25 ]
%30 = call i32 @to_roman(i32 %29, i8* %4)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %29, i8* %4)
%32 = add i32 %29, 1
%33 = icmp eq i32 %29, %26
br i1 %33, label %34, label %28
34: ; preds = %28, %23
ret i32 0
}