#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 */
typedef int /*<<< orphan*/ m;

/* Variables and functions */
int /*<<< orphan*/ check(unsigned int *, unsigned int *, int);
int /*<<< orphan*/ countSort(unsigned int *, int);
int /*<<< orphan*/ init(unsigned int *, int);
int /*<<< orphan*/ memcpy(unsigned int *, unsigned int *, int);
int /*<<< orphan*/ print(unsigned int *, int);
int /*<<< orphan*/ printf(char *);
int main(void) {
  unsigned m[100], saveM[100];
  unsigned loopInd;
  printf("start -- \n");
  for (loopInd = 1; loopInd <= 100; loopInd++) {
    init(m, 100);
    memcpy(saveM, m, sizeof(m));
    printf("Масивът преди сортирането:\n");
    print(m, 100);
    countSort(m, 100);
    printf("Масивът след сортирането:\n");
    print(m, 100);
    check(m, saveM, 100);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x340,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe87(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x334(%rbp)
cmpl   $0x64,-0x334(%rbp)
ja     1235 <main+0xd5>
lea    -0x1a0(%rbp),%rdi
mov    $0x64,%esi
call   1070 <init@plt>
lea    -0x330(%rbp),%rdi
lea    -0x1a0(%rbp),%rsi
mov    $0x190,%edx
call   1060 <memcpy@plt>
lea    0xe46(%rip),%rdi
call   1040 <printf@plt>
lea    -0x1a0(%rbp),%rdi
mov    $0x64,%esi
call   1050 <print@plt>
lea    -0x1a0(%rbp),%rdi
mov    $0x64,%esi
call   1030 <countSort@plt>
lea    0xe4b(%rip),%rdi
call   1040 <printf@plt>
lea    -0x1a0(%rbp),%rdi
mov    $0x64,%esi
call   1050 <print@plt>
lea    -0x1a0(%rbp),%rdi
lea    -0x330(%rbp),%rsi
mov    $0x64,%edx
call   1080 <check@plt>
mov    -0x334(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x334(%rbp)
jmp    1188 <main+0x28>
xor    %eax,%eax
add    $0x340,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x320,%rsp
lea    0xe8a(%rip),%rdi
call   1040 <puts@plt>
mov    $0x64,%ebp
lea    0x190(%rsp),%rbx
mov    %rsp,%r14
lea    0xe78(%rip),%r15
lea    0xea3(%rip),%r12
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    $0x64,%esi
call   1070 <init@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    $0x190,%edx
call   1060 <memcpy@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
call   1050 <print@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
call   1030 <countSort@plt>
mov    %r12,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    $0x64,%esi
call   1050 <print@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x64,%edx
call   1080 <check@plt>
add    $0xffffffff,%ebp
jne    11a0 <main+0x40>
xor    %eax,%eax
add    $0x320,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"start -- \0A\00"
@.str.1 = [51 x i8] c"\D0\9C\D0\B0\D1\81\D0\B8\D0\B2\D1\8A\D1\82 \D0\BF\D1\80\D0\B5\D0\B4\D0\B8 \D1\81\D0\BE\D1\80\D1\82\D0\B8\D1\80\D0\B0\D0\BD\D0\B5\D1\82\D0\BE:\0A\00"
@.str.2 = [49 x i8] c"\D0\9C\D0\B0\D1\81\D0\B8\D0\B2\D1\8A\D1\82 \D1\81\D0\BB\D0\B5\D0\B4 \D1\81\D0\BE\D1\80\D1\82\D0\B8\D1\80\D0\B0\D0\BD\D0\B5\D1\82\D0\BE:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i32]
%3 = alloca [100 x i32]
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %4
br label %6
6: ; preds = %26, %0
%7 = load i32, i32* %4
%8 = icmp ule i32 %7, 100
br i1 %8, label %9, label %29
9: ; preds = %6
%10 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%11 = call i32 @init(i32* %10, i32 100)
%12 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 0
%13 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%14 = call i32 @memcpy(i32* %12, i32* %13, i32 400)
%15 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
%16 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%17 = call i32 @print(i32* %16, i32 100)
%18 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%19 = call i32 @countSort(i32* %18, i32 100)
%20 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0))
%21 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%22 = call i32 @print(i32* %21, i32 100)
%23 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%24 = getelementptr inbounds [100 x i32], [100 x i32]* %3, i64 0, i64 0
%25 = call i32 @check(i32* %23, i32* %24, i32 100)
br label %26
26: ; preds = %9
%27 = load i32, i32* %4
%28 = add i32 %27, 1
store i32 %28, i32* %4
br label %6
29: ; preds = %6
ret i32 0
}

LLVM IR (-O2):
@str = [10 x i8] c"start -- \00"
@str.3 = [50 x i8] c"\D0\9C\D0\B0\D1\81\D0\B8\D0\B2\D1\8A\D1\82 \D0\BF\D1\80\D0\B5\D0\B4\D0\B8 \D1\81\D0\BE\D1\80\D1\82\D0\B8\D1\80\D0\B0\D0\BD\D0\B5\D1\82\D0\BE:\00"
@str.4 = [48 x i8] c"\D0\9C\D0\B0\D1\81\D0\B8\D0\B2\D1\8A\D1\82 \D1\81\D0\BB\D0\B5\D0\B4 \D1\81\D0\BE\D1\80\D1\82\D0\B8\D1\80\D0\B0\D0\BD\D0\B5\D1\82\D0\BE:\00"
define i32 @main() {
%1 = alloca [100 x i32]
%2 = alloca [100 x i32]
%3 = bitcast [100 x i32]* %1 to i8*
%4 = bitcast [100 x i32]* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
%6 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%7 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
br label %8
8: ; preds = %0, %8
%9 = phi i32 [ 1, %0 ], [ %18, %8 ]
%10 = call i32 @init(i32* %6, i32 100)
%11 = call i32 @memcpy(i32* %7, i32* %6, i32 400)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.3, i64 0, i64 0))
%13 = call i32 @print(i32* %6, i32 100)
%14 = call i32 @countSort(i32* %6, i32 100)
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.4, i64 0, i64 0))
%16 = call i32 @print(i32* %6, i32 100)
%17 = call i32 @check(i32* %6, i32* %7, i32 100)
%18 = add nuw nsw i32 %9, 1
%19 = icmp eq i32 %18, 101
br i1 %19, label %20, label %8
20: ; preds = %8
ret i32 0
}