#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 n, i, i1, i2, length;
  int arr[100];
  printf("enter range:");
  scanf("%d", &n);
  printf("enter length:");
  scanf("%d", &length);
  printf("enter array:");
  for (i = 0; i < length; i++) {
    do {
      scanf("%d", &arr[i]);
    } while (arr[i] < 0 || arr[i] > n);
  }
  for (i1 = 0; i1 <= n; i1++) {
    printf("\n%d:", i1);
    for (i2 = 0; i2 < length; i2++) {
      if (arr[i2] == i1) {
        printf("*");
      }
    }
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec6(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea8(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1204 <main+0xe4>
jmp    1194 <main+0x74>
movslq -0xc(%rbp),%rax
lea    -0x1b0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe60(%rip),%rdi
call   1040 <scanf@plt>
movslq -0xc(%rbp),%rcx
mov    $0x1,%al
cmpl   $0x0,-0x1b0(%rbp,%rcx,4)
mov    %al,-0x1b1(%rbp)
jl     11e3 <main+0xc3>
movslq -0xc(%rbp),%rax
mov    -0x1b0(%rbp,%rax,4),%eax
cmp    -0x8(%rbp),%eax
setg   %al
mov    %al,-0x1b1(%rbp)
mov    -0x1b1(%rbp),%al
test   $0x1,%al
jne    1194 <main+0x74>
jmp    11f6 <main+0xd6>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1183 <main+0x63>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1283 <main+0x163>
mov    -0x10(%rbp),%esi
lea    0xe0a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1270 <main+0x150>
movslq -0x14(%rbp),%rax
mov    -0x1b0(%rbp,%rax,4),%eax
cmp    -0x10(%rbp),%eax
jne    125d <main+0x13d>
lea    0xdda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1262 <main+0x142>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    122f <main+0x10f>
jmp    1275 <main+0x155>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    120b <main+0xeb>
lea    0xda8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x1a0,%rsp
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebc(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xeab(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xe9e(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,0x8(%rsp)
jle    11dd <main+0xad>
xor    %r15d,%r15d
lea    0xe75(%rip),%r14
nopl   0x0(%rax,%rax,1)
lea    (%rsp,%r15,4),%rbx
add    $0x10,%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    (%rbx),%ecx
test   %ecx,%ecx
js     11b0 <main+0x80>
mov    0xc(%rsp),%eax
cmp    %eax,%ecx
jg     11b0 <main+0x80>
add    $0x1,%r15
movslq 0x8(%rsp),%rcx
cmp    %rcx,%r15
jl     11a0 <main+0x70>
test   %eax,%eax
jns    11e5 <main+0xb5>
jmp    1253 <main+0x123>
mov    0xc(%rsp),%eax
test   %eax,%eax
js     1253 <main+0x123>
lea    0xe3f(%rip),%r14
xor    %r15d,%r15d
jmp    120e <main+0xde>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0x1(%r15),%eax
cmp    0xc(%rsp),%r15d
mov    %eax,%r15d
jge    1253 <main+0x123>
mov    %r14,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
jle    1200 <main+0xd0>
xor    %ebx,%ebx
jmp    123c <main+0x10c>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbx
movslq %eax,%rcx
cmp    %rcx,%rbx
jge    1200 <main+0xd0>
cmp    %r15d,0x10(%rsp,%rbx,4)
jne    1230 <main+0x100>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    0x8(%rsp),%eax
jmp    1230 <main+0x100>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x1a0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"enter range:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [14 x i8] c"enter length:\00"
@.str.3 = [13 x i8] c"enter array:\00"
@.str.4 = [5 x i8] c"\0A%d:\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [100 x i32]
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast [100 x i32]* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%12 = load i32, i32* %2
%13 = icmp sgt i32 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %0
%15 = load i32, i32* %1
br label %19
16: ; preds = %0, %29
%17 = phi i64 [ %30, %29 ], [ 0, %0 ]
%18 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %17
br label %22
19: ; preds = %29, %14
%20 = phi i32 [ %15, %14 ], [ %26, %29 ]
%21 = icmp slt i32 %20, 0
br i1 %21, label %57, label %34
22: ; preds = %16, %22
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %18)
%24 = load i32, i32* %18
%25 = icmp slt i32 %24, 0
%26 = load i32, i32* %1
%27 = icmp sgt i32 %24, %26
%28 = select i1 %25, i1 true, i1 %27
br i1 %28, label %22, label %29
29: ; preds = %22
%30 = add nuw nsw i64 %17, 1
%31 = load i32, i32* %2
%32 = sext i32 %31 to i64
%33 = icmp slt i64 %30, %32
br i1 %33, label %16, label %19
34: ; preds = %19, %53
%35 = phi i32 [ %54, %53 ], [ 0, %19 ]
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 %35)
%37 = load i32, i32* %2
%38 = icmp sgt i32 %37, 0
br i1 %38, label %39, label %53
39: ; preds = %34, %48
%40 = phi i32 [ %49, %48 ], [ %37, %34 ]
%41 = phi i64 [ %50, %48 ], [ 0, %34 ]
%42 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = icmp eq i32 %43, %35
br i1 %44, label %45, label %48
45: ; preds = %39
%46 = call i32 @putchar(i32 42)
%47 = load i32, i32* %2
br label %48
48: ; preds = %39, %45
%49 = phi i32 [ %40, %39 ], [ %47, %45 ]
%50 = add nuw nsw i64 %41, 1
%51 = sext i32 %49 to i64
%52 = icmp slt i64 %50, %51
br i1 %52, label %39, label %53
53: ; preds = %48, %34
%54 = add nuw nsw i32 %35, 1
%55 = load i32, i32* %1
%56 = icmp slt i32 %35, %55
br i1 %56, label %34, label %57
57: ; preds = %53, %19
%58 = call i32 @putchar(i32 10)
ret i32 0
}