#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 abs(int);
int /*<<< orphan*/ haeufigkeitsverteilung_2dim_char_array(int, int, char **,
                                                          int *);
int *liefere_max_int_array(int *, char);
int *liefere_min_int_array(int *, char);
int /*<<< orphan*/ printf(char *, ...);
void statistik_haeufigkeitsverteilung(int anzahl_lottoziehungen,
                                      int anzahl_lottozahlen,
                                      char **lottoziehungen,
                                      int *haeufigkeitsverteilung, char max) {
  haeufigkeitsverteilung_2dim_char_array(anzahl_lottoziehungen,
                                         anzahl_lottozahlen, lottoziehungen,
                                         haeufigkeitsverteilung);
  int *min_zahl = liefere_min_int_array(haeufigkeitsverteilung, max);
  int min_haeufigkeit = 0;
  int *max_zahl = liefere_max_int_array(haeufigkeitsverteilung, max);
  int max_haeufigkeit = 0;
  int diffirenz_haeufigkeit = abs((*min_zahl) - (*max_zahl));
  printf("\n%-5s   %5s\n", "Zahl", "Haeufigkeitsverteilung");
  for (int i = 0; i < max; i++) {
    printf("\n%-5d : %5d", i + 1, haeufigkeitsverteilung[i]);
    if (haeufigkeitsverteilung[i] == *min_zahl) {
      min_haeufigkeit = i + 1;
    }
    if (haeufigkeitsverteilung[i] == *max_zahl) {
      max_haeufigkeit = i + 1;
    }
  }
  printf("\n\n");
  printf("Die Zahl %d kommt am wenigsten und die Zahl %d am häufigsten vor.\n"
         "Die Differenz der beiden Haeufigkeiten beträgt %d.\n",
         min_haeufigkeit, max_haeufigkeit, diffirenz_haeufigkeit);
}


x86 assembly (clang, -O0):
<statistik_haeufigkeitsverteilung>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %r8b,%al
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %al,-0x19(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
call   1070 <haeufigkeitsverteilung_2dim_char_array@plt>
mov    -0x18(%rbp),%rdi
movsbl -0x19(%rbp),%esi
call   1060 <liefere_min_int_array@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x18(%rbp),%rdi
movsbl -0x19(%rbp),%esi
call   1050 <liefere_max_int_array@plt>
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%edi
mov    -0x38(%rbp),%rax
sub    (%rax),%edi
call   1030 <abs@plt>
mov    %eax,-0x40(%rbp)
lea    0xe36(%rip),%rdi
lea    0xe3c(%rip),%rsi
lea    0xe3a(%rip),%rdx
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
movsbl -0x19(%rbp),%ecx
cmp    %ecx,%eax
jge    1267 <statistik_haeufigkeitsverteilung+0x117>
mov    -0x44(%rbp),%esi
add    $0x1,%esi
mov    -0x18(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jne    1234 <statistik_haeufigkeitsverteilung+0xe4>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x44(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x38(%rbp),%rcx
cmp    (%rcx),%eax
jne    1254 <statistik_haeufigkeitsverteilung+0x104>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1259 <statistik_haeufigkeitsverteilung+0x109>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11e6 <statistik_haeufigkeitsverteilung+0x96>
lea    0xdc7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x2c(%rbp),%esi
mov    -0x3c(%rbp),%edx
mov    -0x40(%rbp),%ecx
lea    0xdb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<statistik_haeufigkeitsverteilung>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8d,%r13d
mov    %rcx,%r12
call   1070 <haeufigkeitsverteilung_2dim_char_array@plt>
mov    %r12,%rdi
mov    %r13d,%esi
call   1060 <liefere_min_int_array@plt>
mov    %rax,%rbx
mov    %r12,%rdi
mov    %r13d,%esi
call   1050 <liefere_max_int_array@plt>
mov    %rax,%rcx
mov    %rbx,0x10(%rsp)
mov    (%rbx),%eax
mov    %eax,0x4(%rsp)
mov    %rcx,0x8(%rsp)
mov    (%rcx),%eax
mov    %eax,(%rsp)
lea    0xe5f(%rip),%rdi
lea    0xe65(%rip),%rsi
lea    0xe63(%rip),%rdx
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x0,%ebx
test   %r13b,%r13b
jle    120b <statistik_haeufigkeitsverteilung+0xbb>
movzbl %r13b,%r14d
xor    %r15d,%r15d
xor    %ebx,%ebx
xor    %ebp,%ebp
nopl   (%rax)
lea    0x1(%r15),%r13
mov    (%r12,%r15,4),%edx
lea    0xe4a(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%r12,%r15,4),%eax
mov    0x10(%rsp),%rcx
cmp    (%rcx),%eax
cmove  %r13d,%ebx
mov    0x8(%rsp),%rcx
cmp    (%rcx),%eax
cmove  %r13d,%ebp
mov    %r13,%r15
cmp    %r13,%r14
jne    11d0 <statistik_haeufigkeitsverteilung+0x80>
mov    0x4(%rsp),%eax
sub    (%rsp),%eax
mov    %eax,%r14d
neg    %r14d
cmovs  %eax,%r14d
lea    0xe88(%rip),%rdi
call   1030 <puts@plt>
lea    0xe06(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"\0A%-5s %5s\0A\00"
@.str.1 = [5 x i8] c"Zahl\00"
@.str.2 = [23 x i8] c"Haeufigkeitsverteilung\00"
@.str.3 = [12 x i8] c"\0A%-5d : %5d\00"
@.str.4 = [3 x i8] c"\0A\0A\00"
@.str.5 = [120 x i8] c"Die Zahl %d kommt am wenigsten und die Zahl %d am h\C3\A4ufigsten vor.\0ADie Differenz der beiden Haeufigkeiten betr\C3\A4gt %d.\0A\00"
define void @statistik_haeufigkeitsverteilung(i32 %0, i32 %1, i8** %2, i32* %3, i8 signext %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8**
%9 = alloca i32*
%10 = alloca i8
%11 = alloca i32*
%12 = alloca i32
%13 = alloca i32*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i8** %2, i8*** %8
store i32* %3, i32** %9
store i8 %4, i8* %10
%17 = load i32, i32* %6
%18 = load i32, i32* %7
%19 = load i8**, i8*** %8
%20 = load i32*, i32** %9
%21 = call i32 @haeufigkeitsverteilung_2dim_char_array(i32 %17, i32 %18, i8** %19, i32* %20)
%22 = load i32*, i32** %9
%23 = load i8, i8* %10
%24 = call i32* @liefere_min_int_array(i32* %22, i8 signext %23)
store i32* %24, i32** %11
store i32 0, i32* %12
%25 = load i32*, i32** %9
%26 = load i8, i8* %10
%27 = call i32* @liefere_max_int_array(i32* %25, i8 signext %26)
store i32* %27, i32** %13
store i32 0, i32* %14
%28 = load i32*, i32** %11
%29 = load i32, i32* %28
%30 = load i32*, i32** %13
%31 = load i32, i32* %30
%32 = sub nsw i32 %29, %31
%33 = call i32 @abs(i32 %32)
store i32 %33, i32* %15
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %16
br label %35
35: ; preds = %73, %5
%36 = load i32, i32* %16
%37 = load i8, i8* %10
%38 = sext i8 %37 to i32
%39 = icmp slt i32 %36, %38
br i1 %39, label %40, label %76
40: ; preds = %35
%41 = load i32, i32* %16
%42 = add nsw i32 %41, 1
%43 = load i32*, i32** %9
%44 = load i32, i32* %16
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i32, i32* %43, i64 %45
%47 = load i32, i32* %46
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %42, i32 %47)
%49 = load i32*, i32** %9
%50 = load i32, i32* %16
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i32, i32* %49, i64 %51
%53 = load i32, i32* %52
%54 = load i32*, i32** %11
%55 = load i32, i32* %54
%56 = icmp eq i32 %53, %55
br i1 %56, label %57, label %60
57: ; preds = %40
%58 = load i32, i32* %16
%59 = add nsw i32 %58, 1
store i32 %59, i32* %12
br label %60
60: ; preds = %57, %40
%61 = load i32*, i32** %9
%62 = load i32, i32* %16
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i32, i32* %61, i64 %63
%65 = load i32, i32* %64
%66 = load i32*, i32** %13
%67 = load i32, i32* %66
%68 = icmp eq i32 %65, %67
br i1 %68, label %69, label %72
69: ; preds = %60
%70 = load i32, i32* %16
%71 = add nsw i32 %70, 1
store i32 %71, i32* %14
br label %72
72: ; preds = %69, %60
br label %73
73: ; preds = %72
%74 = load i32, i32* %16
%75 = add nsw i32 %74, 1
store i32 %75, i32* %16
br label %35
76: ; preds = %35
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%78 = load i32, i32* %12
%79 = load i32, i32* %14
%80 = load i32, i32* %15
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([120 x i8], [120 x i8]* @.str.5, i64 0, i64 0), i32 %78, i32 %79, i32 %80)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"\0A%-5s %5s\0A\00"
@.str.1 = [5 x i8] c"Zahl\00"
@.str.2 = [23 x i8] c"Haeufigkeitsverteilung\00"
@.str.3 = [12 x i8] c"\0A%-5d : %5d\00"
@.str.5 = [120 x i8] c"Die Zahl %d kommt am wenigsten und die Zahl %d am h\C3\A4ufigsten vor.\0ADie Differenz der beiden Haeufigkeiten betr\C3\A4gt %d.\0A\00"
@str = [2 x i8] c"\0A\00"
define void @statistik_haeufigkeitsverteilung(i32 %0, i32 %1, i8** %2, i32* %3, i8 signext %4) {
%6 = tail call i32 @haeufigkeitsverteilung_2dim_char_array(i32 %0, i32 %1, i8** %2, i32* %3)
%7 = tail call i32* @liefere_min_int_array(i32* %3, i8 signext %4)
%8 = tail call i32* @liefere_max_int_array(i32* %3, i8 signext %4)
%9 = load i32, i32* %7
%10 = load i32, i32* %8
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp sgt i8 %4, 0
br i1 %12, label %13, label %15
13: ; preds = %5
%14 = zext i8 %4 to i64
br label %22
15: ; preds = %22, %5
%16 = phi i32 [ 0, %5 ], [ %37, %22 ]
%17 = phi i32 [ 0, %5 ], [ %34, %22 ]
%18 = sub nsw i32 %9, %10
%19 = tail call i32 @llvm.abs.i32(i32 %18, i1 true)
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([120 x i8], [120 x i8]* @.str.5, i64 0, i64 0), i32 %17, i32 %16, i32 %19)
ret void
22: ; preds = %13, %22
%23 = phi i64 [ 0, %13 ], [ %26, %22 ]
%24 = phi i32 [ 0, %13 ], [ %34, %22 ]
%25 = phi i32 [ 0, %13 ], [ %37, %22 ]
%26 = add nuw nsw i64 %23, 1
%27 = getelementptr inbounds i32, i32* %3, i64 %23
%28 = load i32, i32* %27
%29 = trunc i64 %26 to i32
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32 %29, i32 %28)
%31 = load i32, i32* %27
%32 = load i32, i32* %7
%33 = icmp eq i32 %31, %32
%34 = select i1 %33, i32 %29, i32 %24
%35 = load i32, i32* %8
%36 = icmp eq i32 %31, %35
%37 = select i1 %36, i32 %29, i32 %25
%38 = icmp eq i64 %26, %14
br i1 %38, label %15, label %22
}