#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*/ count_number_times_in_array(int *, int, int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int array_size;
  printf("input array_size:\n");
  scanf("%d", &array_size);
  int array[array_size];
  int i;
  printf("input array element between 0~9.\n");
  for (i = 0; i < array_size; i++)
    scanf("%d", &array[i]);
  int number_count[9] = {};
  count_number_times_in_array(array, array_size, number_count);
  for (i = 0; i < 9; i++) {
    if (number_count[i] != 0)
      printf("%d--->%3d  times\n", i + 1, number_count[i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeaf(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11de <main+0x9e>
mov    -0x48(%rbp),%rsi
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe48(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a9 <main+0x69>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x24,%edx
call   1040 <memset@plt>
mov    -0x48(%rbp),%rdi
mov    -0x8(%rbp),%esi
lea    -0x40(%rbp),%rdx
call   1050 <count_number_times_in_array@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x9,-0x1c(%rbp)
jge    124d <main+0x10d>
movslq -0x1c(%rbp),%rax
cmpl   $0x0,-0x40(%rbp,%rax,4)
je     123a <main+0xfa>
mov    -0x1c(%rbp),%esi
add    $0x1,%esi
movslq -0x1c(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edx
lea    0xe05(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    123f <main+0xff>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1205 <main+0xc5>
lea    0xde2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x10(%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    $0x28,%rsp
lea    0xead(%rip),%rdi
call   1040 <puts@plt>
lea    0xe8c(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1070 <scanf@plt>
mov    %rsp,%r12
mov    -0x2c(%rbp),%eax
mov    %rsp,%r14
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
lea    0xe88(%rip),%rdi
call   1040 <puts@plt>
mov    -0x2c(%rbp),%esi
test   %esi,%esi
jle    11dc <main+0x8c>
xor    %r13d,%r13d
lea    0xe4b(%rip),%r15
mov    %r14,%rbx
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
add    $0x1,%r13
movslq -0x2c(%rbp),%rsi
add    $0x4,%rbx
cmp    %rsi,%r13
jl     11c0 <main+0x70>
xorps  %xmm0,%xmm0
movaps %xmm0,-0x40(%rbp)
movaps %xmm0,-0x50(%rbp)
movl   $0x0,-0x30(%rbp)
lea    -0x50(%rbp),%rdx
mov    %r14,%rdi
call   1060 <count_number_times_in_array@plt>
mov    -0x50(%rbp),%edx
test   %edx,%edx
je     1214 <main+0xc4>
lea    0xdfb(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x4c(%rbp),%edx
test   %edx,%edx
je     122e <main+0xde>
lea    0xde1(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x48(%rbp),%edx
test   %edx,%edx
je     1248 <main+0xf8>
lea    0xdc7(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x44(%rbp),%edx
test   %edx,%edx
je     1262 <main+0x112>
lea    0xdad(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x40(%rbp),%edx
test   %edx,%edx
je     127c <main+0x12c>
lea    0xd93(%rip),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x3c(%rbp),%edx
test   %edx,%edx
je     1296 <main+0x146>
lea    0xd79(%rip),%rdi
mov    $0x6,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x38(%rbp),%edx
test   %edx,%edx
je     12b0 <main+0x160>
lea    0xd5f(%rip),%rdi
mov    $0x7,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x34(%rbp),%edx
test   %edx,%edx
je     12ca <main+0x17a>
lea    0xd45(%rip),%rdi
mov    $0x8,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    -0x30(%rbp),%edx
test   %edx,%edx
je     12e4 <main+0x194>
lea    0xd2b(%rip),%rdi
mov    $0x9,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %r12,%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 = [19 x i8] c"input array_size:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [34 x i8] c"input array element between 0~9.\0A\00"
@.str.3 = [18 x i8] c"%d--->%3d times\0A\00"
@.str.4 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
%6 = alloca [9 x i32]
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 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* %2)
%9 = load i32, i32* %2
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %3
%12 = alloca i32, i64 %10
store i64 %10, i64* %4
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %5
br label %14
14: ; preds = %23, %0
%15 = load i32, i32* %5
%16 = load i32, i32* %2
%17 = icmp slt i32 %15, %16
br i1 %17, label %18, label %26
18: ; preds = %14
%19 = load i32, i32* %5
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %12, 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* %5
%25 = add nsw i32 %24, 1
store i32 %25, i32* %5
br label %14
26: ; preds = %14
%27 = bitcast [9 x i32]* %6 to i8*
%28 = load i32, i32* %2
%29 = getelementptr inbounds [9 x i32], [9 x i32]* %6, i64 0, i64 0
%30 = call i32 @count_number_times_in_array(i32* %12, i32 %28, i32* %29)
store i32 0, i32* %5
br label %31
31: ; preds = %49, %26
%32 = load i32, i32* %5
%33 = icmp slt i32 %32, 9
br i1 %33, label %34, label %52
34: ; preds = %31
%35 = load i32, i32* %5
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [9 x i32], [9 x i32]* %6, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %48
40: ; preds = %34
%41 = load i32, i32* %5
%42 = add nsw i32 %41, 1
%43 = load i32, i32* %5
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [9 x i32], [9 x i32]* %6, i64 0, i64 %44
%46 = load i32, i32* %45
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %42, i32 %46)
br label %48
48: ; preds = %40, %34
br label %49
49: ; preds = %48
%50 = load i32, i32* %5
%51 = add nsw i32 %50, 1
store i32 %51, i32* %5
br label %31
52: ; preds = %31
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %1
%54 = load i8*, i8** %3
%55 = load i32, i32* %1
ret i32 %55
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [18 x i8] c"%d--->%3d times\0A\00"
@str = [18 x i8] c"input array_size:\00"
@str.5 = [33 x i8] c"input array element between 0~9.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [9 x i32]
%3 = bitcast i32* %1 to i8*
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
%9 = alloca i32, i64 %7
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.5, i64 0, i64 0))
%11 = load i32, i32* %1
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %21
13: ; preds = %0, %13
%14 = phi i64 [ %17, %13 ], [ 0, %0 ]
%15 = getelementptr inbounds i32, i32* %9, i64 %14
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %15)
%17 = add nuw nsw i64 %14, 1
%18 = load i32, i32* %1
%19 = sext i32 %18 to i64
%20 = icmp slt i64 %17, %19
br i1 %20, label %13, label %21
21: ; preds = %13, %0
%22 = phi i32 [ %11, %0 ], [ %18, %13 ]
%23 = bitcast [9 x i32]* %2 to i8*
%24 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 0
%25 = call i32 @count_number_times_in_array(i32* %9, i32 %22, i32* %24)
%26 = load i32, i32* %24
%27 = icmp eq i32 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %21
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 1, i32 %26)
br label %30
30: ; preds = %21, %28
%31 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 1
%32 = load i32, i32* %31
%33 = icmp eq i32 %32, 0
br i1 %33, label %36, label %34
34: ; preds = %30
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 2, i32 %32)
br label %36
36: ; preds = %34, %30
%37 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 2
%38 = load i32, i32* %37
%39 = icmp eq i32 %38, 0
br i1 %39, label %42, label %40
40: ; preds = %36
%41 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 3, i32 %38)
br label %42
42: ; preds = %40, %36
%43 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 3
%44 = load i32, i32* %43
%45 = icmp eq i32 %44, 0
br i1 %45, label %48, label %46
46: ; preds = %42
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 4, i32 %44)
br label %48
48: ; preds = %46, %42
%49 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 4
%50 = load i32, i32* %49
%51 = icmp eq i32 %50, 0
br i1 %51, label %54, label %52
52: ; preds = %48
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 5, i32 %50)
br label %54
54: ; preds = %52, %48
%55 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 5
%56 = load i32, i32* %55
%57 = icmp eq i32 %56, 0
br i1 %57, label %60, label %58
58: ; preds = %54
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 6, i32 %56)
br label %60
60: ; preds = %58, %54
%61 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 6
%62 = load i32, i32* %61
%63 = icmp eq i32 %62, 0
br i1 %63, label %66, label %64
64: ; preds = %60
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 7, i32 %62)
br label %66
66: ; preds = %64, %60
%67 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 7
%68 = load i32, i32* %67
%69 = icmp eq i32 %68, 0
br i1 %69, label %72, label %70
70: ; preds = %66
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 8, i32 %68)
br label %72
72: ; preds = %70, %66
%73 = getelementptr inbounds [9 x i32], [9 x i32]* %2, i64 0, i64 8
%74 = load i32, i32* %73
%75 = icmp eq i32 %74, 0
br i1 %75, label %78, label %76
76: ; preds = %72
%77 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 9, i32 %74)
br label %78
78: ; preds = %76, %72
%79 = call i32 @putchar(i32 10)
ret i32 0
}