#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*/ mean(unsigned int *);
int /*<<< orphan*/ median(unsigned int *);
int /*<<< orphan*/ mode(unsigned int *, unsigned int *);
void fig06_16() {
  unsigned int frequncy[10] = {0};
  unsigned int response[99] = {
      6, 7, 8, 9, 8, 7, 8, 9, 8, 9, 7, 8, 9, 5, 9, 8, 7, 8, 7, 8, 6, 7, 8, 9, 3,
      9, 8, 7, 8, 7, 7, 8, 9, 8, 9, 8, 9, 7, 8, 9, 6, 7, 8, 7, 8, 7, 9, 8, 9, 2,
      7, 8, 9, 8, 9, 8, 9, 7, 5, 3, 5, 6, 7, 2, 5, 3, 9, 4, 6, 4, 7, 8, 9, 6, 8,
      7, 8, 9, 7, 8, 7, 4, 4, 2, 5, 3, 8, 7, 5, 6, 4, 5, 6, 1, 6, 5, 7, 8, 7};
  mean(response);
  median(response);
  mode(frequncy, response);
}


x86 assembly (clang, -O0):
<fig06_16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1c0,%rsp
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1040 <memset@plt>
lea    -0x1c0(%rbp),%rdi
lea    0xe87(%rip),%rsi
mov    $0x18c,%edx
call   1050 <memcpy@plt>
lea    -0x1c0(%rbp),%rdi
call   1070 <mean@plt>
lea    -0x1c0(%rbp),%rdi
call   1030 <median@plt>
lea    -0x30(%rbp),%rdi
lea    -0x1c0(%rbp),%rsi
call   1060 <mode@plt>
add    $0x1c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fig06_16>:
push   %rbx
sub    $0x1c0,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
movq   $0x0,0x20(%rsp)
lea    0xe9c(%rip),%rsi
lea    0x30(%rsp),%rbx
mov    $0x18c,%edx
mov    %rbx,%rdi
call   1040 <memcpy@plt>
mov    %rbx,%rdi
call   1060 <mean@plt>
mov    %rbx,%rdi
call   1030 <median@plt>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1050 <mode@plt>
add    $0x1c0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.fig06_16.response = [99 x i32] [i32 6, i32 7, i32 8, i32 9, i32 8, i32 7, i32 8, i32 9, i32 8, i32 9, i32 7, i32 8, i32 9, i32 5, i32 9, i32 8, i32 7, i32 8, i32 7, i32 8, i32 6, i32 7, i32 8, i32 9, i32 3, i32 9, i32 8, i32 7, i32 8, i32 7, i32 7, i32 8, i32 9, i32 8, i32 9, i32 8, i32 9, i32 7, i32 8, i32 9, i32 6, i32 7, i32 8, i32 7, i32 8, i32 7, i32 9, i32 8, i32 9, i32 2, i32 7, i32 8, i32 9, i32 8, i32 9, i32 8, i32 9, i32 7, i32 5, i32 3, i32 5, i32 6, i32 7, i32 2, i32 5, i32 3, i32 9, i32 4, i32 6, i32 4, i32 7, i32 8, i32 9, i32 6, i32 8, i32 7, i32 8, i32 9, i32 7, i32 8, i32 7, i32 4, i32 4, i32 2, i32 5, i32 3, i32 8, i32 7, i32 5, i32 6, i32 4, i32 5, i32 6, i32 1, i32 6, i32 5, i32 7, i32 8, i32 7]
define void @fig06_16() {
%1 = alloca [10 x i32]
%2 = alloca [99 x i32]
%3 = bitcast [10 x i32]* %1 to i8*
%4 = bitcast [99 x i32]* %2 to i8*
%5 = getelementptr inbounds [99 x i32], [99 x i32]* %2, i64 0, i64 0
%6 = call i32 @mean(i32* %5)
%7 = getelementptr inbounds [99 x i32], [99 x i32]* %2, i64 0, i64 0
%8 = call i32 @median(i32* %7)
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%10 = getelementptr inbounds [99 x i32], [99 x i32]* %2, i64 0, i64 0
%11 = call i32 @mode(i32* %9, i32* %10)
ret void
}

LLVM IR (-O2):
@__const.fig06_16.response = [99 x i32] [i32 6, i32 7, i32 8, i32 9, i32 8, i32 7, i32 8, i32 9, i32 8, i32 9, i32 7, i32 8, i32 9, i32 5, i32 9, i32 8, i32 7, i32 8, i32 7, i32 8, i32 6, i32 7, i32 8, i32 9, i32 3, i32 9, i32 8, i32 7, i32 8, i32 7, i32 7, i32 8, i32 9, i32 8, i32 9, i32 8, i32 9, i32 7, i32 8, i32 9, i32 6, i32 7, i32 8, i32 7, i32 8, i32 7, i32 9, i32 8, i32 9, i32 2, i32 7, i32 8, i32 9, i32 8, i32 9, i32 8, i32 9, i32 7, i32 5, i32 3, i32 5, i32 6, i32 7, i32 2, i32 5, i32 3, i32 9, i32 4, i32 6, i32 4, i32 7, i32 8, i32 9, i32 6, i32 8, i32 7, i32 8, i32 9, i32 7, i32 8, i32 7, i32 4, i32 4, i32 2, i32 5, i32 3, i32 8, i32 7, i32 5, i32 6, i32 4, i32 5, i32 6, i32 1, i32 6, i32 5, i32 7, i32 8, i32 7]
define void @fig06_16() {
%1 = alloca [10 x i32]
%2 = alloca [99 x i32]
%3 = bitcast [10 x i32]* %1 to i8*
%4 = bitcast [99 x i32]* %2 to i8*
%5 = getelementptr inbounds [99 x i32], [99 x i32]* %2, i64 0, i64 0
%6 = call i32 @mean(i32* %5)
%7 = call i32 @median(i32* %5)
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%9 = call i32 @mode(i32* %8, i32* %5)
ret void
}