int main(void) {
  double w = 37.5;
  double x = 22.5;
  double y = 1.7;
  double z = 10.2;
  printf("%s%.1f\n%s%.1f\n%s%.1f\n%s%.1f\n\n", "w = ", w, "x = ", x, "y = ", y,
         "z = ", z);
  printf("%s%.3f\n%s%.3f\n%s%.3f\n", "The average of w and x is ",
         average(2, w, x), "The average of w, x, and y is ",
         average(3, w, x, y), "The average of w, x, y, and z is ",
         average(4, w, x, y, z));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xee1(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xecc(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xeb7(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xea2(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
lea    0xea2(%rip),%rdi
lea    0xeb9(%rip),%rsi
lea    0xeb7(%rip),%rdx
lea    0xeb5(%rip),%rcx
lea    0xeb3(%rip),%r8
mov    $0x4,%al
call   1030 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mov    $0x2,%edi
mov    $0x2,%al
call   1040 <average@plt>
mov    %eax,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
mov    $0x3,%edi
mov    $0x3,%al
call   1040 <average@plt>
mov    %eax,-0x2c(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
mov    $0x4,%edi
mov    $0x4,%al
call   1040 <average@plt>
mov    -0x30(%rbp),%edx
mov    -0x2c(%rbp),%r8d
lea    0xe4c(%rip),%rdi
lea    0xe5b(%rip),%rsi
lea    0xe6f(%rip),%rcx
lea    0xe87(%rip),%r9
mov    %eax,(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xef6(%rip),%rdi
lea    0xf0d(%rip),%rsi
lea    0xf0b(%rip),%rdx
lea    0xf09(%rip),%rcx
lea    0xf07(%rip),%r8
movsd  0xeb2(%rip),%xmm0
movsd  0xeb2(%rip),%xmm1
movsd  0xeb2(%rip),%xmm2
movsd  0xeb2(%rip),%xmm3
mov    $0x4,%al
call   1030 <printf@plt>
mov    $0x2,%edi
movsd  0xe86(%rip),%xmm0
movsd  0xe86(%rip),%xmm1
mov    $0x2,%al
call   1040 <average@plt>
mov    %eax,%ebx
mov    $0x3,%edi
movsd  0xe68(%rip),%xmm0
movsd  0xe68(%rip),%xmm1
movsd  0xe68(%rip),%xmm2
mov    $0x3,%al
call   1040 <average@plt>
mov    %eax,%ebp
mov    $0x4,%edi
movsd  0xe42(%rip),%xmm0
movsd  0xe42(%rip),%xmm1
movsd  0xe42(%rip),%xmm2
movsd  0xe42(%rip),%xmm3
mov    $0x4,%al
call   1040 <average@plt>
mov    %eax,(%rsp)
lea    0xe6b(%rip),%rdi
lea    0xe7a(%rip),%rsi
lea    0xe8e(%rip),%rcx
lea    0xea6(%rip),%r9
mov    %ebx,%edx
mov    %ebp,%r8d
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"%s%.1f\0A%s%.1f\0A%s%.1f\0A%s%.1f\0A\0A\00"
@.str.1 = [5 x i8] c"w = \00"
@.str.2 = [5 x i8] c"x = \00"
@.str.3 = [5 x i8] c"y = \00"
@.str.4 = [5 x i8] c"z = \00"
@.str.5 = [22 x i8] c"%s%.3f\0A%s%.3f\0A%s%.3f\0A\00"
@.str.6 = [27 x i8] c"The average of w and x is \00"
@.str.7 = [31 x i8] c"The average of w, x, and y is \00"
@.str.8 = [34 x i8] c"The average of w, x, y, and z is \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
store double 3.750000e+01, double* %2
store double 2.250000e+01, double* %3
store double 1.700000e+00, double* %4
store double 1.020000e+01, double* %5
%6 = load double, double* %2
%7 = load double, double* %3
%8 = load double, double* %4
%9 = load double, double* %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), double %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), double %9)
%11 = load double, double* %2
%12 = load double, double* %3
%13 = call i32 (i32, double, double, ...) bitcast (i32 (...)* @average to i32 (i32, double, double, ...)*)(i32 2, double %11, double %12)
%14 = load double, double* %2
%15 = load double, double* %3
%16 = load double, double* %4
%17 = call i32 (i32, double, double, double, ...) bitcast (i32 (...)* @average to i32 (i32, double, double, double, ...)*)(i32 3, double %14, double %15, double %16)
%18 = load double, double* %2
%19 = load double, double* %3
%20 = load double, double* %4
%21 = load double, double* %5
%22 = call i32 (i32, double, double, double, double, ...) bitcast (i32 (...)* @average to i32 (i32, double, double, double, double, ...)*)(i32 4, double %18, double %19, double %20, double %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i32 %13, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i32 %17, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), i32 %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"%s%.1f\0A%s%.1f\0A%s%.1f\0A%s%.1f\0A\0A\00"
@.str.1 = [5 x i8] c"w = \00"
@.str.2 = [5 x i8] c"x = \00"
@.str.3 = [5 x i8] c"y = \00"
@.str.4 = [5 x i8] c"z = \00"
@.str.5 = [22 x i8] c"%s%.3f\0A%s%.3f\0A%s%.3f\0A\00"
@.str.6 = [27 x i8] c"The average of w and x is \00"
@.str.7 = [31 x i8] c"The average of w, x, and y is \00"
@.str.8 = [34 x i8] c"The average of w, x, y, and z is \00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double 3.750000e+01, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), double 2.250000e+01, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), double 1.700000e+00, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), double 1.020000e+01)
%2 = tail call i32 (i32, double, double, ...) bitcast (i32 (...)* @average to i32 (i32, double, double, ...)*)(i32 2, double 3.750000e+01, double 2.250000e+01)
%3 = tail call i32 (i32, double, double, double, ...) bitcast (i32 (...)* @average to i32 (i32, double, double, double, ...)*)(i32 3, double 3.750000e+01, double 2.250000e+01, double 1.700000e+00)
%4 = tail call i32 (i32, double, double, double, double, ...) bitcast (i32 (...)* @average to i32 (i32, double, double, double, double, ...)*)(i32 4, double 3.750000e+01, double 2.250000e+01, double 1.700000e+00, double 1.020000e+01)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i32 %2, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), i32 %3, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), i32 %4)
ret i32 0
}