#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*/ initialisiere_int_array(int *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ simulier_haeufigkeit_sammelbilder(int *, int, int);
void schreibe_statistik_der_treffer(int sammelbilder, int kunden) {
  int haeufigkeit[sammelbilder];
  initialisiere_int_array(haeufigkeit, sammelbilder, 0);
  simulier_haeufigkeit_sammelbilder(haeufigkeit, kunden, sammelbilder);
  printf("\n%-5s   %5s\n", "AVS", "H");
  for (int i = 0; i < sammelbilder; i++) {
    printf("\n%-5d : %5d", i + 1, haeufigkeit[i]);
  }
  printf("\n\n");
}


x86 assembly (clang, -O0):
<schreibe_statistik_der_treffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x28(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%esi
xor    %edx,%edx
call   1040 <initialisiere_int_array@plt>
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%esi
mov    -0x4(%rbp),%edx
call   1030 <simulier_haeufigkeit_sammelbilder@plt>
lea    0xe7b(%rip),%rdi
lea    0xe81(%rip),%rsi
lea    0xe7e(%rip),%rdx
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11da <schreibe_statistik_der_treffer+0xaa>
mov    -0x28(%rbp),%rax
mov    -0x1c(%rbp),%esi
add    $0x1,%esi
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a1 <schreibe_statistik_der_treffer+0x71>
lea    0xe3e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<schreibe_statistik_der_treffer>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%ebx
mov    %edi,%r14d
mov    %edi,%r12d
mov    %rsp,%r15
lea    0xf(,%r12,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    %r15,%rdi
mov    %r14d,%esi
xor    %edx,%edx
call   1050 <initialisiere_int_array@plt>
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r14d,%edx
call   1040 <simulier_haeufigkeit_sammelbilder@plt>
lea    0xe77(%rip),%rdi
lea    0xe7d(%rip),%rsi
lea    0xe7a(%rip),%rdx
xor    %eax,%eax
call   1060 <printf@plt>
test   %r14d,%r14d
jle    11c9 <schreibe_statistik_der_treffer+0x89>
lea    0xe69(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    (%r15,%rbx,4),%edx
add    $0x1,%rbx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
cmp    %rbx,%r12
jne    11b0 <schreibe_statistik_der_treffer+0x70>
lea    0xe3b(%rip),%rdi
call   1030 <puts@plt>
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [13 x i8] c"\0A%-5s %5s\0A\00"
@.str.1 = [4 x i8] c"AVS\00"
@.str.2 = [2 x i8] c"H\00"
@.str.3 = [12 x i8] c"\0A%-5d : %5d\00"
@.str.4 = [3 x i8] c"\0A\0A\00"
define void @schreibe_statistik_der_treffer(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%8 = load i32, i32* %3
%9 = zext i32 %8 to i64
%10 = call i8* @llvm.stacksave()
store i8* %10, i8** %5
%11 = alloca i32, i64 %9
store i64 %9, i64* %6
%12 = load i32, i32* %3
%13 = call i32 @initialisiere_int_array(i32* %11, i32 %12, i32 0)
%14 = load i32, i32* %4
%15 = load i32, i32* %3
%16 = call i32 @simulier_haeufigkeit_sammelbilder(i32* %11, i32 %14, i32 %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %7
br label %18
18: ; preds = %30, %2
%19 = load i32, i32* %7
%20 = load i32, i32* %3
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %33
22: ; preds = %18
%23 = load i32, i32* %7
%24 = add nsw i32 %23, 1
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %11, i64 %26
%28 = load i32, i32* %27
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %24, i32 %28)
br label %30
30: ; preds = %22
%31 = load i32, i32* %7
%32 = add nsw i32 %31, 1
store i32 %32, i32* %7
br label %18
33: ; preds = %18
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%35 = load i8*, i8** %5
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"\0A%-5s %5s\0A\00"
@.str.1 = [4 x i8] c"AVS\00"
@.str.2 = [2 x i8] c"H\00"
@.str.3 = [12 x i8] c"\0A%-5d : %5d\00"
@str = [2 x i8] c"\0A\00"
define void @schreibe_statistik_der_treffer(i32 %0, i32 %1) {
%3 = zext i32 %0 to i64
%4 = alloca i32, i64 %3
%5 = call i32 @initialisiere_int_array(i32* %4, i32 %0, i32 0)
%6 = call i32 @simulier_haeufigkeit_sammelbilder(i32* %4, i32 %1, i32 %0)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%8 = icmp sgt i32 %0, 0
br i1 %8, label %11, label %9
9: ; preds = %11, %2
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret void
11: ; preds = %2, %11
%12 = phi i64 [ %13, %11 ], [ 0, %2 ]
%13 = add nuw nsw i64 %12, 1
%14 = getelementptr inbounds i32, i32* %4, i64 %12
%15 = load i32, i32* %14
%16 = trunc i64 %13 to i32
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %16, i32 %15)
%18 = icmp eq i64 %13, %3
br i1 %18, label %9, label %11
}