user: Converte this assembly snippet into its equivalent C code:

```asm
<schreibe_statistik_sammelbilderproblem>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0xb8,%rsp
  mov    %edi,-0xb4(%rbp)
  mov    %esi,-0xb8(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  mov    %rsp,%rax
  mov    %rax,%rbx
  mov    -0xb8(%rbp),%edx
  movslq %edx,%rax
  sub    $0x1,%rax
  mov    %rax,-0xa0(%rbp)
  movslq %edx,%rax
  mov    %rax,%r10
  mov    $0x0,%r11d
  movslq %edx,%rax
  mov    %rax,%r8
  mov    $0x0,%r9d
  movslq %edx,%rax
  lea    0x0(,%rax,4),%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%esi
  mov    $0x0,%edx
  div    %rsi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L112:
  cmp    %rdx,%rsp
  je     L6
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L112
L6:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L89
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L89:
  mov    %rsp,%rax
  add    $0x3,%rax
  shr    $0x2,%rax
  shl    $0x2,%rax
  mov    %rax,-0x98(%rbp)
  mov    -0xb8(%rbp),%ecx
  mov    -0x98(%rbp),%rax
  mov    $0x0,%edx
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <initialisiere_int_array@plt>
  mov    $0x0,%eax
  call   <initialisiere_zufallszahlengenerator@plt>
  mov    -0xb4(%rbp),%edx
  mov    -0x98(%rbp),%rcx
  mov    -0xb8(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <simulier_einkaeufe@plt>
  mov    -0xb4(%rbp),%eax
  mov    %eax,%edi
  call   <durchschnittlich_benoetigten_kaeufe@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x90(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x88(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x80(%rbp)
  mov    -0xb8(%rbp),%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x78(%rbp)
  movslq %eax,%rdx
  mov    %rdx,-0xd0(%rbp)
  movq   $0x0,-0xc8(%rbp)
  movslq %eax,%rdx
  mov    %rdx,-0xe0(%rbp)
  movq   $0x0,-0xd8(%rbp)
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%edi
  mov    $0x0,%edx
  div    %rdi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L38:
  cmp    %rdx,%rsp
  je     L55
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L38
L55:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L60
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L60:
  mov    %rsp,%rax
  add    $0x7,%rax
  shr    $0x3,%rax
  shl    $0x3,%rax
  mov    %rax,-0x70(%rbp)
  sub    $0x8,%rsp
  lea    D136(%rip),%rax
  push   %rax
  lea    D235(%rip),%r9
  lea    D48(%rip),%r8
  lea    D89(%rip),%rax
  mov    %rax,%rcx
  lea    D216(%rip),%rax
  mov    %rax,%rdx
  lea    D187(%rip),%rax
  mov    %rax,%rsi
  lea    D110(%rip),%rax
  mov    %rax,%rdi
  mov    $0x0,%eax
  call   <printf@plt>
  add    $0x10,%rsp
  movl   $0x0,-0xb0(%rbp)
  jmp    L124
L84:
  mov    -0x98(%rbp),%rax
  mov    -0xb0(%rbp),%edx
  movslq %edx,%rdx
  mov    (%rax,%rdx,4),%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  subsd  -0x90(%rbp),%xmm0
  movq   D114(%rip),%xmm1
  andpd  %xmm1,%xmm0
  movsd  %xmm0,-0x88(%rbp)
  mov    -0xb0(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    -0x98(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <durchschnitt_int_array@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x80(%rbp)
  movsd  -0x90(%rbp),%xmm0
  subsd  -0x80(%rbp),%xmm0
  movq   D114(%rip),%xmm1
  andpd  %xmm1,%xmm0
  mov    -0x70(%rbp),%rax
  mov    -0xb0(%rbp),%edx
  movslq %edx,%rdx
  movsd  %xmm0,(%rax,%rdx,8)
  mov    -0x70(%rbp),%rax
  mov    -0xb0(%rbp),%edx
  movslq %edx,%rdx
  movsd  (%rax,%rdx,8),%xmm2
  mov    -0x98(%rbp),%rax
  mov    -0xb0(%rbp),%edx
  movslq %edx,%rdx
  mov    (%rax,%rdx,4),%eax
  mov    -0xb0(%rbp),%edx
  lea    0x1(%rdx),%ecx
  movsd  -0x80(%rbp),%xmm1
  movsd  -0x90(%rbp),%xmm0
  mov    -0x88(%rbp),%rdx
  movapd %xmm2,%xmm3
  movapd %xmm1,%xmm2
  movapd %xmm0,%xmm1
  movq   %rdx,%xmm0
  mov    %eax,%edx
  mov    %ecx,%esi
  lea    D20(%rip),%rax
  mov    %rax,%rdi
  mov    $0x4,%eax
  call   <printf@plt>
  addl   $0x1,-0xb0(%rbp)
L124:
  mov    -0xb0(%rbp),%eax
  cmp    -0xb8(%rbp),%eax
  jl     L84
  lea    D226(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    -0xb8(%rbp),%edx
  mov    -0x98(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <median_int_array@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x68(%rbp)
  mov    -0xb8(%rbp),%edx
  mov    -0x70(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <median_double_array@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x60(%rbp)
  mov    -0xb8(%rbp),%edx
  mov    -0x70(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <liefere_min_double_array@plt>
  mov    %rax,-0x58(%rbp)
  mov    -0xb8(%rbp),%edx
  mov    -0x70(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <liefere_max_double_array@plt>
  mov    %rax,-0x50(%rbp)
  mov    -0x68(%rbp),%rax
  movq   %rax,%xmm0
  lea    D117(%rip),%rax
  mov    %rax,%rsi
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  mov    $0x1,%eax
  call   <printf@plt>
  mov    -0x60(%rbp),%rax
  movq   %rax,%xmm0
  lea    D19(%rip),%rax
  mov    %rax,%rsi
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  mov    $0x1,%eax
  call   <printf@plt>
  mov    -0x50(%rbp),%rax
  mov    (%rax),%rax
  movq   %rax,%xmm0
  lea    D182(%rip),%rax
  mov    %rax,%rsi
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  mov    $0x1,%eax
  call   <printf@plt>
  mov    -0x58(%rbp),%rax
  mov    (%rax),%rax
  movq   %rax,%xmm0
  lea    D62(%rip),%rax
  mov    %rax,%rsi
  lea    D13(%rip),%rax
  mov    %rax,%rdi
  mov    $0x1,%eax
  call   <printf@plt>
  mov    -0xb8(%rbp),%eax
  movslq %eax,%rdx
  sub    $0x1,%rdx
  mov    %rdx,-0x48(%rbp)
  movslq %eax,%rdx
  mov    %rdx,%r14
  mov    $0x0,%r15d
  movslq %eax,%rdx
  mov    %rdx,%r12
  mov    $0x0,%r13d
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    $0x10,%eax
  sub    $0x1,%rax
  add    %rdx,%rax
  mov    $0x10,%esi
  mov    $0x0,%edx
  div    %rsi
  imul   $0x10,%rax,%rax
  mov    %rax,%rcx
  and    $0xfffffffffffff000,%rcx
  mov    %rsp,%rdx
  sub    %rcx,%rdx
L45:
  cmp    %rdx,%rsp
  je     L96
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L45
L96:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L74
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L74:
  mov    %rsp,%rax
  add    $0x3,%rax
  shr    $0x2,%rax
  shl    $0x2,%rax
  mov    %rax,-0x40(%rbp)
  movl   $0x0,-0xac(%rbp)
  mov    -0xb8(%rbp),%ecx
  mov    -0x40(%rbp),%rax
  mov    $0x0,%edx
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <initialisiere_int_array@plt>
  movsd  D116(%rip),%xmm0
  movsd  %xmm0,-0xa8(%rbp)
  jmp    L2
L22:
  mov    -0xa8(%rbp),%rsi
  mov    -0x40(%rbp),%rdx
  mov    -0xb8(%rbp),%ecx
  mov    -0x70(%rbp),%rax
  movq   %rsi,%xmm0
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <indizes_kleiner_als_double_array@plt>
  mov    %eax,-0xac(%rbp)
  mov    -0xa8(%rbp),%rax
  movq   %rax,%xmm0
  lea    D197(%rip),%rax
  mov    %rax,%rsi
  lea    D164(%rip),%rax
  mov    %rax,%rdi
  mov    $0x1,%eax
  call   <printf@plt>
  mov    $0x5b,%edi
  call   <putchar@plt>
  mov    -0xac(%rbp),%esi
  mov    -0x40(%rbp),%rax
  mov    $0x0,%r8d
  lea    D14(%rip),%rdx
  mov    %rdx,%rcx
  mov    $0x0,%edx
  mov    %rax,%rdi
  call   <schreibe_int_array@plt>
  mov    $0x5d,%edi
  call   <putchar@plt>
  movsd  -0xa8(%rbp),%xmm0
  movsd  D224(%rip),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0xa8(%rbp)
L2:
  movsd  -0xa8(%rbp),%xmm0
  comisd D223(%rip),%xmm0
  ja     L22
  mov    $0xa,%edi
  call   <putchar@plt>
  mov    %rbx,%rsp
  nop
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  je     L81
  call   <__stack_chk_fail@plt>
L81:
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D136
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D235
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D48
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D89
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D216
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D187
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D110
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D114
type_infered: qword
name: extract_symbolic_data
arguments: data_tag: D20
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D226
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D117
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D13
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D19
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D182
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D62
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D116
type_infered: f64
name: extract_symbolic_data
arguments: data_tag: D197
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D164
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D14
type_infered: string
name: extract_symbolic_data
arguments: data_tag: D224
type_infered: f64
name: extract_symbolic_data
arguments: data_tag: D223
type_infered: f64

tool: D136: AM

tool: D235: M

tool: D48: E

tool: D89: AE

tool: D216: KK

tool: D187: KNR

tool: D110: 
%5s %5s %15s %15s %15s %15s


tool: D114: 9223372036854775807

tool: D20: 
%7d %5d %15lf %15lf %15lf %15lf

tool: D226: 


tool: D117: Median der Anzahl Kaeufe: 

tool: D13: %-25s %10lf


tool: D19: Median der Werte AM: 

tool: D182: groesster der Werte AM: 

tool: D62: kleinster der Werte AM: 

tool: D116: 1

tool: D197: Indizes der Werte AM < 

tool: D164: 
%-s %4.1lf :	

tool: D14: , 

tool: D224: 0.2

tool: D223: 0.6

assistant: ```c
void schreibe_statistik_sammelbilderproblem(int sammelbilder, int kunden) {
  int anzahl_kaeufe_pro_kunde[kunden];
  initialisiere_int_array(anzahl_kaeufe_pro_kunde, kunden, 0);
  initialisiere_zufallszahlengenerator();
  simulier_einkaeufe(kunden, anzahl_kaeufe_pro_kunde, sammelbilder);
  double durchschnitt_versuche = durchschnitt_versuche = durchschnittlich_benoetigten_kaeufe(sammelbilder);
  double abweichung_versuche = 0.0;
  double durchschnitt_kaeufe = 0.0;
  double abweichung_kaeufe[kunden];
  printf("\n%5s %5s %15s %15s %15s %15s\n", "KNR", "KK", "AE", "E", "M", "AM");
  for (int i = 0; i < kunden; i++) {
    abweichung_versuche = fabs((double)anzahl_kaeufe_pro_kunde[i] - durchschnitt_versuche);
    durchschnitt_kaeufe = durchschnitt_int_array(anzahl_kaeufe_pro_kunde, i + 1);
    abweichung_kaeufe[i] = fabs(durchschnitt_versuche - durchschnitt_kaeufe);
    printf("\n%7d %5d %15lf %15lf %15lf %15lf", i + 1, anzahl_kaeufe_pro_kunde[i], abweichung_versuche, durchschnitt_versuche, durchschnitt_kaeufe, abweichung_kaeufe[i]);
  }
  printf("\n\n");
  double median_kaeufe = median_int_array(anzahl_kaeufe_pro_kunde, kunden);
  double median_am = median_double_array(abweichung_kaeufe, kunden);
  double *min = liefere_min_double_array(abweichung_kaeufe, kunden);
  double *max = liefere_max_double_array(abweichung_kaeufe, kunden);
  printf("%-25s %10lf\n", "Median der Anzahl Kaeufe: ", median_kaeufe);
  printf("%-25s %10lf\n", "Median der Werte AM: ", median_am);
  printf("%-25s %10lf\n", "groesster der Werte AM: ", *max);
  printf("%-25s %10lf\n", "kleinster der Werte AM: ", *min);
  int indizes_array[kunden];
  int anzahl_indizes = 0;
  initialisiere_int_array(indizes_array, kunden, 0);
  for (double i = 1.0; i > 0.6; i = i - 0.2) {
    anzahl_indizes = indizes_kleiner_als_double_array(abweichung_kaeufe, kunden, indizes_array, i);
    printf("\n%-s %4.1lf :\t", "Indizes der Werte AM < ", i);
    putchar('[');
    schreibe_int_array(indizes_array, anzahl_indizes, 0, ", ", 0);
    putchar(']');
  }
  putchar('\n');
}
```