#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 main() {
  int a[6] = {3, 2, 4, 2, 3, 5};
  int b[100];
  int i;
  for (i = 0; i < 100; i++) {
    b[i] = 0;
  }
  for (i = 0; i < 6; i++) {
    b[a[i]]++;
  }
  for (i = 0; i < 100; i++) {
    while (b[i] > 0) {
      printf(" %d", i);
      b[i]--;
    }
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed1(%rip),%rax
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x1b4(%rbp)
cmpl   $0x64,-0x1b4(%rbp)
jge    1180 <main+0x70>
movslq -0x1b4(%rbp),%rax
movl   $0x0,-0x1b0(%rbp,%rax,4)
mov    -0x1b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b4(%rbp)
jmp    114d <main+0x3d>
movl   $0x0,-0x1b4(%rbp)
cmpl   $0x6,-0x1b4(%rbp)
jge    11c8 <main+0xb8>
movslq -0x1b4(%rbp),%rax
movslq -0x20(%rbp,%rax,4),%rax
mov    -0x1b0(%rbp,%rax,4),%ecx
add    $0x1,%ecx
mov    %ecx,-0x1b0(%rbp,%rax,4)
mov    -0x1b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b4(%rbp)
jmp    118a <main+0x7a>
movl   $0x0,-0x1b4(%rbp)
cmpl   $0x64,-0x1b4(%rbp)
jge    1243 <main+0x133>
jmp    11e4 <main+0xd4>
movslq -0x1b4(%rbp),%rax
cmpl   $0x0,-0x1b0(%rbp,%rax,4)
jle    122a <main+0x11a>
mov    -0x1b4(%rbp),%esi
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x1b4(%rbp),%rax
mov    -0x1b0(%rbp,%rax,4),%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x1b0(%rbp,%rax,4)
jmp    11e4 <main+0xd4>
jmp    122f <main+0x11f>
mov    -0x1b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1b4(%rbp)
jmp    11d2 <main+0xc2>
lea    0xdd2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x198,%rsp
mov    %rsp,%rdi
xor    %r15d,%r15d
mov    $0x190,%edx
xor    %esi,%esi
call   1050 <memset@plt>
movaps 0xeaa(%rip),%xmm0
movups %xmm0,0x8(%rsp)
lea    0xeae(%rip),%r14
jmp    117e <main+0x4e>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebx,(%rsp,%r15,4)
add    $0x1,%r15
cmp    $0x64,%r15
je     11a9 <main+0x79>
mov    (%rsp,%r15,4),%ebx
test   %ebx,%ebx
jle    1170 <main+0x40>
add    $0x1,%ebx
mov    %ebx,%ebp
nopl   0x0(%rax,%rax,1)
xor    %ebx,%ebx
mov    %r14,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     1190 <main+0x60>
jmp    1170 <main+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x198,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c" %d\00"
define i32 @main() {
%1 = alloca [100 x i32]
%2 = bitcast [100 x i32]* %1 to i8*
%3 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 2
%4 = bitcast i32* %3 to <4 x i32>*
store <4 x i32> <i32 2, i32 2, i32 1, i32 1>, <4 x i32>* %4
br label %5
5: ; preds = %0, %17
%6 = phi i64 [ 0, %0 ], [ %19, %17 ]
%7 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %6
%8 = load i32, i32* %7
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %17
10: ; preds = %5
%11 = trunc i64 %6 to i32
br label %12
12: ; preds = %10, %12
%13 = phi i32 [ %15, %12 ], [ %8, %10 ]
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%15 = add nsw i32 %13, -1
%16 = icmp ugt i32 %13, 1
br i1 %16, label %12, label %17
17: ; preds = %12, %5
%18 = phi i32 [ %8, %5 ], [ 0, %12 ]
store i32 %18, i32* %7
%19 = add nuw nsw i64 %6, 1
%20 = icmp eq i64 %19, 100
br i1 %20, label %21, label %5
21: ; preds = %17
%22 = tail call i32 @putchar(i32 10)
ret i32 0
}