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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1e0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea9(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1150 <main+0x30>
movl   $0x0,-0x10(%rbp)
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x10(%rbp),%rax
lea    -0x1b0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe66(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     1181 <main+0x61>
movl   $0x0,-0x10(%rbp)
cmpl   $0x9,-0x10(%rbp)
jg     1248 <main+0x128>
mov    -0x10(%rbp),%esi
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     122c <main+0x10c>
movslq -0x18(%rbp),%rax
mov    -0x1b0(%rbp,%rax,4),%eax
cmp    -0x10(%rbp),%eax
jne    1219 <main+0xf9>
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    121e <main+0xfe>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11eb <main+0xcb>
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11c9 <main+0xa9>
mov    -0x8(%rbp),%esi
lea    0xde3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1e0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x1a8,%rsp
lea    0xebc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xebc(%rip),%r14
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
lea    0xeab(%rip),%rbp
lea    0x8(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    0x8(%rsp),%eax
cmp    0xc(%rsp),%eax
jg     1170 <main+0x40>
lea    0x10(%rsp),%rbx
lea    0xe85(%rip),%r14
lea    0xe6c(%rip),%r15
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
add    $0x1,%rbp
movslq 0x8(%rsp),%rax
add    $0x4,%rbx
cmp    %rax,%rbp
jl     11b0 <main+0x80>
lea    0xe50(%rip),%r14
xor    %ebp,%ebp
jmp    1202 <main+0xd2>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    $0xa,%ebp
je     1242 <main+0x112>
mov    %r14,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%eax
test   %eax,%eax
js     11f0 <main+0xc0>
mov    $0xffffffffffffffff,%rbx
jmp    122c <main+0xfc>
nop
movslq %eax,%rcx
add    $0x1,%rbx
cmp    %rcx,%rbx
jge    11f0 <main+0xc0>
cmp    %ebp,0x14(%rsp,%rbx,4)
jne    1220 <main+0xf0>
mov    $0x2a,%edi
call   1030 <putchar@plt>
mov    0x8(%rsp),%eax
jmp    1220 <main+0xf0>
mov    0xc(%rsp),%esi
lea    0xde6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x1a8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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