#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() {
  int range, length, range_counter, length_counter;
  printf("Insert range:\n");
  scanf("%d", &range);
  if (range < 0) {
    scanf("%d", &range);
  }
  printf("Insert length:\n");
  scanf("%d", &length);
  if (length < 0) {
    scanf("%d", &length);
  }
  int arr[length];
  for (length_counter = 0; length_counter < length; length_counter++) {
    printf("Please input a number:\n");
    scanf("%d", &arr[length_counter]);
  }
  for (range_counter = 0; range_counter <= range; range_counter++) {
    printf("%d: ", range_counter);
    for (length_counter = 0; length_counter < length; length_counter++) {
      if (range_counter == arr[length_counter]) {
        printf("*");
      }
    }
    printf("\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jge    1167 <main+0x47>
lea    0xeb1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe93(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jge    119f <main+0x7f>
lea    0xe79(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1210 <main+0xf0>
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe12(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11cd <main+0xad>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1298 <main+0x178>
mov    -0x10(%rbp),%esi
lea    0xe0d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    127c <main+0x15c>
mov    -0x30(%rbp),%rcx
mov    -0x10(%rbp),%eax
movslq -0x14(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jne    1269 <main+0x149>
lea    0xddd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    126e <main+0x14e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    123b <main+0x11b>
lea    0xd8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1217 <main+0xf7>
movl   $0x0,-0x4(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xeb0(%rip),%rdi
call   1040 <puts@plt>
lea    0xe9c(%rip),%rdi
lea    -0x30(%rbp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,-0x30(%rbp)
jns    1183 <main+0x43>
lea    0xe86(%rip),%rdi
lea    -0x30(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xe8c(%rip),%rdi
call   1040 <puts@plt>
lea    0xe6a(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x2c(%rbp),%eax
test   %eax,%eax
jns    11b9 <main+0x79>
lea    0xe53(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x2c(%rbp),%eax
mov    %rsp,-0x38(%rbp)
mov    %eax,%eax
mov    %rsp,%r13
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
cmpl   $0x0,-0x2c(%rbp)
jle    1214 <main+0xd4>
xor    %r12d,%r12d
lea    0xe41(%rip),%r14
lea    0xe15(%rip),%r15
mov    %r13,%rbx
xchg   %ax,%ax
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
add    $0x1,%r12
movslq -0x2c(%rbp),%rax
add    $0x4,%rbx
cmp    %rax,%r12
jl     11f0 <main+0xb0>
cmpl   $0x0,-0x30(%rbp)
js     1282 <main+0x142>
lea    0xde2(%rip),%r14
xor    %r15d,%r15d
jmp    1247 <main+0x107>
cs nopw 0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0x1(%r15),%eax
cmp    -0x30(%rbp),%r15d
mov    %eax,%r15d
jge    1282 <main+0x142>
mov    %r14,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x2c(%rbp),%eax
test   %eax,%eax
jle    1230 <main+0xf0>
xor    %ebx,%ebx
jmp    126c <main+0x12c>
nop
add    $0x1,%rbx
movslq %eax,%rcx
cmp    %rcx,%rbx
jge    1230 <main+0xf0>
cmp    0x0(%r13,%rbx,4),%r15d
jne    1260 <main+0x120>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    -0x2c(%rbp),%eax
jmp    1260 <main+0x120>
mov    -0x38(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Insert range:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [16 x i8] c"Insert length:\0A\00"
@.str.3 = [24 x i8] c"Please input a number:\0A\00"
@.str.4 = [5 x i8] c"%d: \00"
@.str.5 = [2 x i8] c"*\00"
@.str.6 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %14
14: ; preds = %12, %0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%17 = load i32, i32* %3
%18 = icmp slt i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %14
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
br label %21
21: ; preds = %19, %14
%22 = load i32, i32* %3
%23 = zext i32 %22 to i64
%24 = call i8* @llvm.stacksave()
store i8* %24, i8** %6
%25 = alloca i32, i64 %23
store i64 %23, i64* %7
store i32 0, i32* %5
br label %26
26: ; preds = %36, %21
%27 = load i32, i32* %5
%28 = load i32, i32* %3
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %39
30: ; preds = %26
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%32 = load i32, i32* %5
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %25, i64 %33
%35 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %34)
br label %36
36: ; preds = %30
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
store i32 %38, i32* %5
br label %26
39: ; preds = %26
store i32 0, i32* %4
br label %40
40: ; preds = %66, %39
%41 = load i32, i32* %4
%42 = load i32, i32* %2
%43 = icmp sle i32 %41, %42
br i1 %43, label %44, label %69
44: ; preds = %40
%45 = load i32, i32* %4
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %45)
store i32 0, i32* %5
br label %47
47: ; preds = %61, %44
%48 = load i32, i32* %5
%49 = load i32, i32* %3
%50 = icmp slt i32 %48, %49
br i1 %50, label %51, label %64
51: ; preds = %47
%52 = load i32, i32* %4
%53 = load i32, i32* %5
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i32, i32* %25, i64 %54
%56 = load i32, i32* %55
%57 = icmp eq i32 %52, %56
br i1 %57, label %58, label %60
58: ; preds = %51
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %60
60: ; preds = %58, %51
br label %61
61: ; preds = %60
%62 = load i32, i32* %5
%63 = add nsw i32 %62, 1
store i32 %63, i32* %5
br label %47
64: ; preds = %47
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %66
66: ; preds = %64
%67 = load i32, i32* %4
%68 = add nsw i32 %67, 1
store i32 %68, i32* %4
br label %40
69: ; preds = %40
store i32 0, i32* %1
%70 = load i8*, i8** %6
%71 = load i32, i32* %1
ret i32 %71
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.4 = [5 x i8] c"%d: \00"
@str = [14 x i8] c"Insert range:\00"
@str.7 = [15 x i8] c"Insert length:\00"
@str.8 = [23 x i8] c"Please input a number:\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 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
br label %11
11: ; preds = %9, %0
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.7, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%14 = load i32, i32* %2
%15 = icmp slt i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %11
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%18 = load i32, i32* %2
br label %19
19: ; preds = %16, %11
%20 = phi i32 [ %18, %16 ], [ %14, %11 ]
%21 = zext i32 %20 to i64
%22 = call i8* @llvm.stacksave()
%23 = alloca i32, i64 %21
%24 = load i32, i32* %2
%25 = icmp sgt i32 %24, 0
br i1 %25, label %29, label %26
26: ; preds = %29, %19
%27 = load i32, i32* %1
%28 = icmp slt i32 %27, 0
br i1 %28, label %62, label %38
29: ; preds = %19, %29
%30 = phi i64 [ %34, %29 ], [ 0, %19 ]
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.8, i64 0, i64 0))
%32 = getelementptr inbounds i32, i32* %23, i64 %30
%33 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %32)
%34 = add nuw nsw i64 %30, 1
%35 = load i32, i32* %2
%36 = sext i32 %35 to i64
%37 = icmp slt i64 %34, %36
br i1 %37, label %29, label %26
38: ; preds = %26, %57
%39 = phi i32 [ %59, %57 ], [ 0, %26 ]
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %39)
%41 = load i32, i32* %2
%42 = icmp sgt i32 %41, 0
br i1 %42, label %43, label %57
43: ; preds = %38, %52
%44 = phi i32 [ %53, %52 ], [ %41, %38 ]
%45 = phi i64 [ %54, %52 ], [ 0, %38 ]
%46 = getelementptr inbounds i32, i32* %23, i64 %45
%47 = load i32, i32* %46
%48 = icmp eq i32 %39, %47
br i1 %48, label %49, label %52
49: ; preds = %43
%50 = call i32 @putchar(i32 42)
%51 = load i32, i32* %2
br label %52
52: ; preds = %43, %49
%53 = phi i32 [ %44, %43 ], [ %51, %49 ]
%54 = add nuw nsw i64 %45, 1
%55 = sext i32 %53 to i64
%56 = icmp slt i64 %54, %55
br i1 %56, label %43, label %57
57: ; preds = %52, %38
%58 = call i32 @putchar(i32 10)
%59 = add nuw nsw i32 %39, 1
%60 = load i32, i32* %1
%61 = icmp slt i32 %39, %60
br i1 %61, label %38, label %62
62: ; preds = %57, %26
ret i32 0
}