#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(
      "Please input the range of the numbers you want to find in the array:\n");
  scanf("%d", &range);
  printf("Please input the length of the array:\n");
  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    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x39(%rbp)
call   1030 <printf@plt>
lea    0xeff(%rip),%rdi
mov    %rdi,-0x38(%rbp)
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x39(%rbp),%al
lea    0xeeb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x38(%rbp),%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    11e1 <main+0xc1>
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe78(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    119e <main+0x7e>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1269 <main+0x149>
mov    -0x10(%rbp),%esi
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    124d <main+0x12d>
mov    -0x30(%rbp),%rcx
mov    -0x10(%rbp),%eax
movslq -0x14(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jne    123a <main+0x11a>
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123f <main+0x11f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    120c <main+0xec>
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11e8 <main+0xc8>
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),%rbx
lea    -0x30(%rbp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xed6(%rip),%rdi
call   1040 <puts@plt>
lea    -0x2c(%rbp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    %rsp,-0x38(%rbp)
mov    -0x2c(%rbp),%eax
mov    %rsp,%r13
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
cmpl   $0x0,-0x2c(%rbp)
jle    11e4 <main+0xa4>
xor    %r12d,%r12d
lea    0xebf(%rip),%r14
lea    0xe45(%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     11c0 <main+0x80>
cmpl   $0x0,-0x30(%rbp)
js     1252 <main+0x112>
lea    0xe12(%rip),%r14
xor    %r15d,%r15d
jmp    1217 <main+0xd7>
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    1252 <main+0x112>
mov    %r14,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x2c(%rbp),%eax
test   %eax,%eax
jle    1200 <main+0xc0>
xor    %ebx,%ebx
jmp    123c <main+0xfc>
nop
add    $0x1,%rbx
movslq %eax,%rcx
cmp    %rcx,%rbx
jge    1200 <main+0xc0>
cmp    0x0(%r13,%rbx,4),%r15d
jne    1230 <main+0xf0>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    -0x2c(%rbp),%eax
jmp    1230 <main+0xf0>
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 = [70 x i8] c"Please input the range of the numbers you want to find in the array:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [39 x i8] c"Please input the length of the array:\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 ([70 x i8], [70 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 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%12 = load i32, i32* %3
%13 = zext i32 %12 to i64
%14 = call i8* @llvm.stacksave()
store i8* %14, i8** %6
%15 = alloca i32, i64 %13
store i64 %13, i64* %7
store i32 0, i32* %5
br label %16
16: ; preds = %26, %0
%17 = load i32, i32* %5
%18 = load i32, i32* %3
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %29
20: ; preds = %16
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i32, i32* %15, i64 %23
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %24)
br label %26
26: ; preds = %20
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %16
29: ; preds = %16
store i32 0, i32* %4
br label %30
30: ; preds = %56, %29
%31 = load i32, i32* %4
%32 = load i32, i32* %2
%33 = icmp sle i32 %31, %32
br i1 %33, label %34, label %59
34: ; preds = %30
%35 = load i32, i32* %4
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %35)
store i32 0, i32* %5
br label %37
37: ; preds = %51, %34
%38 = load i32, i32* %5
%39 = load i32, i32* %3
%40 = icmp slt i32 %38, %39
br i1 %40, label %41, label %54
41: ; preds = %37
%42 = load i32, i32* %4
%43 = load i32, i32* %5
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i32, i32* %15, i64 %44
%46 = load i32, i32* %45
%47 = icmp eq i32 %42, %46
br i1 %47, label %48, label %50
48: ; preds = %41
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %50
50: ; preds = %48, %41
br label %51
51: ; preds = %50
%52 = load i32, i32* %5
%53 = add nsw i32 %52, 1
store i32 %53, i32* %5
br label %37
54: ; preds = %37
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %56
56: ; preds = %54
%57 = load i32, i32* %4
%58 = add nsw i32 %57, 1
store i32 %58, i32* %4
br label %30
59: ; preds = %30
store i32 0, i32* %1
%60 = load i8*, i8** %6
%61 = load i32, i32* %1
ret i32 %61
}

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