#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 */
struct pmm_benchmark {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ div_bench(struct pmm_benchmark *, double,
                             struct pmm_benchmark *);
scalar_t__ sum_bench_list(struct pmm_benchmark *, struct pmm_benchmark *,
                          struct pmm_benchmark *);
int /*<<< orphan*/ zero_benchmark(struct pmm_benchmark *);
void avg_bench_list(struct pmm_benchmark *start, struct pmm_benchmark *end,
                    struct pmm_benchmark *avg_b) {
  double divisor = 0.0;
  zero_benchmark(avg_b);
  divisor = (double)sum_bench_list(start, end, avg_b);
  div_bench(avg_b, divisor, avg_b);
  return;
}


x86 assembly (clang, -O0):
<avg_bench_list>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <zero_benchmark@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <sum_bench_list@plt>
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rsi
call   1030 <div_bench@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<avg_bench_list>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rdx,%rdi
call   1040 <zero_benchmark@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1050 <sum_bench_list@plt>
cvtsi2sd %rax,%xmm0
mov    %rbx,%rdi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <div_bench@plt>

LLVM IR (-O0):
%struct.pmm_benchmark = type { i32 }
define void @avg_bench_list(%struct.pmm_benchmark* %0, %struct.pmm_benchmark* %1, %struct.pmm_benchmark* %2) {
%4 = alloca %struct.pmm_benchmark*
%5 = alloca %struct.pmm_benchmark*
%6 = alloca %struct.pmm_benchmark*
%7 = alloca double
store %struct.pmm_benchmark* %0, %struct.pmm_benchmark** %4
store %struct.pmm_benchmark* %1, %struct.pmm_benchmark** %5
store %struct.pmm_benchmark* %2, %struct.pmm_benchmark** %6
store double 0.000000e+00, double* %7
%8 = load %struct.pmm_benchmark*, %struct.pmm_benchmark** %6
%9 = call i32 @zero_benchmark(%struct.pmm_benchmark* %8)
%10 = load %struct.pmm_benchmark*, %struct.pmm_benchmark** %4
%11 = load %struct.pmm_benchmark*, %struct.pmm_benchmark** %5
%12 = load %struct.pmm_benchmark*, %struct.pmm_benchmark** %6
%13 = call i64 @sum_bench_list(%struct.pmm_benchmark* %10, %struct.pmm_benchmark* %11, %struct.pmm_benchmark* %12)
%14 = sitofp i64 %13 to double
store double %14, double* %7
%15 = load %struct.pmm_benchmark*, %struct.pmm_benchmark** %6
%16 = load double, double* %7
%17 = load %struct.pmm_benchmark*, %struct.pmm_benchmark** %6
%18 = call i32 @div_bench(%struct.pmm_benchmark* %15, double %16, %struct.pmm_benchmark* %17)
ret void
}

LLVM IR (-O2):
%struct.pmm_benchmark = type { i32 }
define void @avg_bench_list(%struct.pmm_benchmark* %0, %struct.pmm_benchmark* %1, %struct.pmm_benchmark* %2) {
%4 = tail call i32 @zero_benchmark(%struct.pmm_benchmark* %2)
%5 = tail call i64 @sum_bench_list(%struct.pmm_benchmark* %0, %struct.pmm_benchmark* %1, %struct.pmm_benchmark* %2)
%6 = sitofp i64 %5 to double
%7 = tail call i32 @div_bench(%struct.pmm_benchmark* %2, double %6, %struct.pmm_benchmark* %2)
ret void
}