#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 main() {
  char *rzym[] = {"I",  "IV", "V",  "IX", "X",  "XL", "L",
                  "XC", "C",  "CD", "D",  "CM", "M"};
  int arab[] = {1, 4, 5, 9, 10, 40, 50, 90, 100, 400, 500, 900, 1000};
  int i, liczba, wybor, rzymska;
  do {
    printf("rzymski-arabski - 1\n");
    printf("rzymski-arabski - 2\n");
    printf("wyjdz - 3\n");
    scanf("%i", &wybor);
    switch (wybor) {
    case 1: {
      do {
        printf("\n  Liczba calkowita wieksza od 0: ");
        scanf("%i", &liczba);
      } while (liczba <= 0);
      printf("  Rzymski odpowiednik: ");
      for (i = 12; i >= 0; i--) {
        while (liczba >= arab[i]) {
          printf("%s", rzym[i]);
          liczba -= arab[i];
        }
      }
    }
    case 2: {
    }
    }
    printf("\n\n");
  } while (wybor != 3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
lea    0x2c63(%rip),%rsi
mov    $0x68,%edx
call   1040 <memcpy@plt>
lea    -0xb0(%rbp),%rdi
lea    0xf2b(%rip),%rsi
mov    $0x34,%edx
call   1040 <memcpy@plt>
lea    0xe9e(%rip),%rdi
xor    %eax,%eax
mov    %al,-0xc5(%rbp)
call   1030 <printf@plt>
mov    -0xc5(%rbp),%al
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc5(%rbp),%al
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
lea    0xe9b(%rip),%rdi
lea    -0xbc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0xbc(%rbp),%eax
mov    %eax,-0xc4(%rbp)
sub    $0x1,%eax
je     11e8 <main+0xb8>
jmp    11d4 <main+0xa4>
mov    -0xc4(%rbp),%eax
sub    $0x2,%eax
je     12b8 <main+0x188>
jmp    12bd <main+0x18d>
jmp    11ed <main+0xbd>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe47(%rip),%rdi
lea    -0xb8(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0xb8(%rbp)
jle    11ed <main+0xbd>
lea    0xe4d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xc,-0xb4(%rbp)
cmpl   $0x0,-0xb4(%rbp)
jl     12b3 <main+0x183>
jmp    1245 <main+0x115>
mov    -0xb8(%rbp),%eax
movslq -0xb4(%rbp),%rcx
cmp    -0xb0(%rbp,%rcx,4),%eax
jl     129a <main+0x16a>
movslq -0xb4(%rbp),%rax
mov    -0x70(%rbp,%rax,8),%rsi
lea    0xe15(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0xb4(%rbp),%rax
mov    -0xb0(%rbp,%rax,4),%ecx
mov    -0xb8(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0xb8(%rbp)
jmp    1245 <main+0x115>
jmp    129f <main+0x16f>
mov    -0xb4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xb4(%rbp)
jmp    1233 <main+0x103>
jmp    12b8 <main+0x188>
jmp    12bd <main+0x18d>
lea    0xdc6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x3,-0xbc(%rbp)
jne    116f <main+0x3f>
xor    %eax,%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
lea    0xed2(%rip),%rbx
lea    0xf87(%rip),%rbp
lea    0xf02(%rip),%r15
jmp    117e <main+0x4e>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0xf20(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x3,0x4(%rsp)
lea    0xe9c(%rip),%rbx
je     124d <main+0x11d>
lea    0xed0(%rip),%rdi
call   1030 <puts@plt>
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xee0(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
cmpl   $0x1,0x4(%rsp)
jne    1160 <main+0x30>
mov    %rbp,%r12
lea    0xe57(%rip),%r14
mov    %rsp,%rbx
lea    0xe4a(%rip),%rbp
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
cmpl   $0x0,(%rsp)
jle    11d0 <main+0xa0>
lea    0xe48(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xc,%r14d
mov    (%rsp),%eax
mov    %r12,%rbp
lea    0xe84(%rip),%rbx
jmp    121a <main+0xea>
xchg   %ax,%ax
sub    $0x1,%r14
jb     1160 <main+0x30>
mov    0x0(%rbp,%r14,4),%r12d
cmp    %r12d,%eax
jl     1210 <main+0xe0>
movslq (%rbx,%r14,4),%r13
add    %rbx,%r13
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%eax
sub    %r12d,%eax
mov    %eax,(%rsp)
cmp    %r12d,%eax
jge    1230 <main+0x100>
jmp    1210 <main+0xe0>
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.rzym = [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.arab = [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 = [21 x i8] c"rzymski-arabski - 1\0A\00"
@.str.14 = [21 x i8] c"rzymski-arabski - 2\0A\00"
@.str.15 = [11 x i8] c"wyjdz - 3\0A\00"
@.str.16 = [3 x i8] c"%i\00"
@.str.17 = [35 x i8] c"\0A Liczba calkowita wieksza od 0: \00"
@.str.18 = [24 x i8] c" Rzymski odpowiednik: \00"
@.str.19 = [3 x i8] c"%s\00"
@.str.20 = [3 x i8] c"\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [13 x i8*]
%3 = alloca [13 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [13 x i8*]* %2 to i8*
%9 = bitcast [13 x i32]* %3 to i8*
br label %10
10: ; preds = %56, %0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0))
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.14, i64 0, i64 0))
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.15, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0), i32* %6)
%15 = load i32, i32* %6
switch i32 %15, label %54 [
i32 1, label %16
i32 2, label %53
]
16: ; preds = %10
br label %17
17: ; preds = %20, %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.17, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0), i32* %5)
br label %20
20: ; preds = %17
%21 = load i32, i32* %5
%22 = icmp sle i32 %21, 0
br i1 %22, label %17, label %23
23: ; preds = %20
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0))
store i32 12, i32* %4
br label %25
25: ; preds = %49, %23
%26 = load i32, i32* %4
%27 = icmp sge i32 %26, 0
br i1 %27, label %28, label %52
28: ; preds = %25
br label %29
29: ; preds = %36, %28
%30 = load i32, i32* %5
%31 = load i32, i32* %4
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [13 x i32], [13 x i32]* %3, i64 0, i64 %32
%34 = load i32, i32* %33
%35 = icmp sge i32 %30, %34
br i1 %35, label %36, label %48
36: ; preds = %29
%37 = load i32, i32* %4
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [13 x i8*], [13 x i8*]* %2, i64 0, i64 %38
%40 = load i8*, i8** %39
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.19, i64 0, i64 0), i8* %40)
%42 = load i32, i32* %4
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds [13 x i32], [13 x i32]* %3, i64 0, i64 %43
%45 = load i32, i32* %44
%46 = load i32, i32* %5
%47 = sub nsw i32 %46, %45
store i32 %47, i32* %5
br label %29
48: ; preds = %29
br label %49
49: ; preds = %48
%50 = load i32, i32* %4
%51 = add nsw i32 %50, -1
store i32 %51, i32* %4
br label %25
52: ; preds = %25
br label %53
53: ; preds = %10, %52
br label %54
54: ; preds = %53, %10
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0))
br label %56
56: ; preds = %54
%57 = load i32, i32* %6
%58 = icmp ne i32 %57, 3
br i1 %58, label %10, label %59
59: ; preds = %56
ret i32 0
}

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.arab = [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.16 = [3 x i8] c"%i\00"
@.str.17 = [35 x i8] c"\0A Liczba calkowita wieksza od 0: \00"
@.str.18 = [24 x i8] c" Rzymski odpowiednik: \00"
@.str.19 = [3 x i8] c"%s\00"
@str = [20 x i8] c"rzymski-arabski - 1\00"
@str.21 = [20 x i8] c"rzymski-arabski - 2\00"
@str.22 = [10 x i8] c"wyjdz - 3\00"
@str.23 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
br label %5
5: ; preds = %38, %0
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.21, i64 0, i64 0))
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.22, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 1
br i1 %11, label %12, label %38
12: ; preds = %5, %12
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.17, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0), i32* %1)
%15 = load i32, i32* %1
%16 = icmp slt i32 %15, 1
br i1 %16, label %12, label %17
17: ; preds = %12
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0))
%19 = load i32, i32* %1
br label %20
20: ; preds = %17, %34
%21 = phi i32 [ %19, %17 ], [ %35, %34 ]
%22 = phi i64 [ 12, %17 ], [ %36, %34 ]
%23 = getelementptr inbounds [13 x i32], [13 x i32]* @__const.main.arab, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = icmp slt i32 %21, %24
br i1 %25, label %34, label %26
26: ; preds = %20
%27 = shl i64 %22, 2
%28 = call i8* @llvm.load.relative.i64(i8* bitcast ([13 x i32]* @reltable.main to i8*), i64 %27)
br label %29
29: ; preds = %26, %29
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.19, i64 0, i64 0), i8* %28)
%31 = load i32, i32* %1
%32 = sub nsw i32 %31, %24
store i32 %32, i32* %1
%33 = icmp slt i32 %32, %24
br i1 %33, label %34, label %29
34: ; preds = %29, %20
%35 = phi i32 [ %21, %20 ], [ %32, %29 ]
%36 = add nsw i64 %22, -1
%37 = icmp eq i64 %22, 0
br i1 %37, label %38, label %20
38: ; preds = %34, %5
%39 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.23, i64 0, i64 0))
%40 = load i32, i32* %2
%41 = icmp eq i32 %40, 3
br i1 %41, label %42, label %5
42: ; preds = %38
ret i32 0
}