#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*/ prand(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int numnums, max;
  int x = 0;
  printf("\x1B[33m"
         "***************************\n"
         "\033[0m");
  printf("\x1B[33m"
         "*"
         "\033[0m"
         "RANDOM NUMBER GENERATOR"
         "\x1B[33m"
         "*"
         "\033[0m"
         "\n");
  printf("\x1B[33m"
         "***************************\n"
         "\033[0m");
  printf("Please enter how many random numbers to produce ("
         "\x1B[32m"
         "max %d"
         "\033[0m"
         "):",
         13);
  scanf("%d", &numnums);
  printf("Please enter maximum number value ("
         "\x1B[32m"
         "default 45"
         "\033[0m"
         "):");
  scanf("%d", &max);
  if (numnums < 0 || numnums == 0) {
    printf("\nProducing 6 numbers...");
    numnums = 6;
  } else if (numnums > 13) {
    printf("\nProducing  13 numbers...");
    numnums = 13;
  } else {
    printf("\nProducing %d numbers...", numnums);
  }
  if (max < 0 || max == 0) {
    max = 45;
  }
  if (max < numnums) {
    printf("\x1B[31m"
           "\n You cannot choose less numbers to be produced than the max "
           "possible value of them!\n"
           "\033[0m");
    return 1;
  }
  printf("\n--------------");
  prand(numnums, max);
  printf("\n--------------\n thats all folks!\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedc(%rip),%rdi
mov    $0xd,%esi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf0c(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xeff(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeee(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jl     11c5 <main+0x95>
cmpl   $0x0,-0x8(%rbp)
jne    11df <main+0xaf>
lea    0xf06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x6,-0x8(%rbp)
jmp    1219 <main+0xe9>
cmpl   $0xd,-0x8(%rbp)
jle    1203 <main+0xd3>
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xd,-0x8(%rbp)
jmp    1214 <main+0xe4>
mov    -0x8(%rbp),%esi
lea    0xef7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1219 <main+0xe9>
cmpl   $0x0,-0xc(%rbp)
jl     122d <main+0xfd>
cmpl   $0x0,-0xc(%rbp)
jne    1234 <main+0x104>
movl   $0x2d,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    125a <main+0x12a>
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1288 <main+0x158>
lea    0xf1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <prand@plt>
lea    0xf12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x1002(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb3(%rip),%rdi
mov    $0xd,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee3(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xed2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    0x8(%rsp),%esi
test   %esi,%esi
jle    11d3 <main+0x93>
cmp    $0xe,%esi
jb     11eb <main+0xab>
lea    0xefb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movl   $0xd,0x8(%rsp)
jmp    11f9 <main+0xb9>
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movl   $0x6,0x8(%rsp)
jmp    11f9 <main+0xb9>
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    121c <main+0xdc>
cmp    0x8(%rsp),%eax
jge    122f <main+0xef>
lea    0xee2(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%ebx
jmp    1258 <main+0x118>
movl   $0x2d,0xc(%rsp)
mov    $0x2d,%eax
cmp    0x8(%rsp),%eax
jl     1207 <main+0xc7>
lea    0xf19(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%edi
mov    0xc(%rsp),%esi
call   1050 <prand@plt>
lea    0xf38(%rip),%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"\1B[33m***************************\0A\1B[0m\00"
@.str.1 = [45 x i8] c"\1B[33m*\1B[0mRANDOM NUMBER GENERATOR\1B[33m*\1B[0m\0A\00"
@.str.2 = [67 x i8] c"Please enter how many random numbers to produce (\1B[32mmax %d\1B[0m):\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [57 x i8] c"Please enter maximum number value (\1B[32mdefault 45\1B[0m):\00"
@.str.5 = [24 x i8] c"\0AProducing 6 numbers...\00"
@.str.6 = [26 x i8] c"\0AProducing 13 numbers...\00"
@.str.7 = [25 x i8] c"\0AProducing %d numbers...\00"
@.str.8 = [95 x i8] c"\1B[31m\0A You cannot choose less numbers to be produced than the max possible value of them!\0A\1B[0m\00"
@.str.9 = [16 x i8] c"\0A--------------\00"
@.str.10 = [35 x i8] c"\0A--------------\0A thats all folks!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str.2, i64 0, i64 0), i32 13)
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%12 = load i32, i32* %2
%13 = icmp slt i32 %12, 0
br i1 %13, label %17, label %14
14: ; preds = %0
%15 = load i32, i32* %2
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %14, %0
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
store i32 6, i32* %2
br label %28
19: ; preds = %14
%20 = load i32, i32* %2
%21 = icmp sgt i32 %20, 13
br i1 %21, label %22, label %24
22: ; preds = %19
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
store i32 13, i32* %2
br label %27
24: ; preds = %19
%25 = load i32, i32* %2
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %24, %22
br label %28
28: ; preds = %27, %17
%29 = load i32, i32* %3
%30 = icmp slt i32 %29, 0
br i1 %30, label %34, label %31
31: ; preds = %28
%32 = load i32, i32* %3
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %31, %28
store i32 45, i32* %3
br label %35
35: ; preds = %34, %31
%36 = load i32, i32* %3
%37 = load i32, i32* %2
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %41
39: ; preds = %35
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([95 x i8], [95 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %1
br label %47
41: ; preds = %35
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0))
%43 = load i32, i32* %2
%44 = load i32, i32* %3
%45 = call i32 @prand(i32 %43, i32 %44)
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.10, i64 0, i64 0))
store i32 0, i32* %1
br label %47
47: ; preds = %41, %39
%48 = load i32, i32* %1
ret i32 %48
}

LLVM IR (-O2):
@.str = [38 x i8] c"\1B[33m***************************\0A\1B[0m\00"
@.str.2 = [67 x i8] c"Please enter how many random numbers to produce (\1B[32mmax %d\1B[0m):\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [57 x i8] c"Please enter maximum number value (\1B[32mdefault 45\1B[0m):\00"
@.str.5 = [24 x i8] c"\0AProducing 6 numbers...\00"
@.str.6 = [26 x i8] c"\0AProducing 13 numbers...\00"
@.str.7 = [25 x i8] c"\0AProducing %d numbers...\00"
@.str.8 = [95 x i8] c"\1B[31m\0A You cannot choose less numbers to be produced than the max possible value of them!\0A\1B[0m\00"
@.str.9 = [16 x i8] c"\0A--------------\00"
@str = [44 x i8] c"\1B[33m*\1B[0mRANDOM NUMBER GENERATOR\1B[33m*\1B[0m\00"
@str.11 = [34 x i8] c"\0A--------------\0A thats all folks!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @.str.2, i64 0, i64 0), i32 13)
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.4, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%12 = load i32, i32* %1
%13 = icmp slt i32 %12, 1
br i1 %13, label %14, label %16
14: ; preds = %0
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.5, i64 0, i64 0))
store i32 6, i32* %1
br label %22
16: ; preds = %0
%17 = icmp ugt i32 %12, 13
br i1 %17, label %18, label %20
18: ; preds = %16
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.6, i64 0, i64 0))
store i32 13, i32* %1
br label %22
20: ; preds = %16
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 %12)
br label %22
22: ; preds = %18, %20, %14
%23 = load i32, i32* %2
%24 = icmp slt i32 %23, 1
br i1 %24, label %25, label %26
25: ; preds = %22
store i32 45, i32* %2
br label %26
26: ; preds = %22, %25
%27 = phi i32 [ %23, %22 ], [ 45, %25 ]
%28 = load i32, i32* %1
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([95 x i8], [95 x i8]* @.str.8, i64 0, i64 0))
br label %38
32: ; preds = %26
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0))
%34 = load i32, i32* %1
%35 = load i32, i32* %2
%36 = call i32 @prand(i32 %34, i32 %35)
%37 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.11, i64 0, i64 0))
br label %38
38: ; preds = %32, %30
%39 = phi i32 [ 1, %30 ], [ 0, %32 ]
ret i32 %39
}