#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*/ printf(char *, double);
double total(int, ...);
int main(void) {
  printf("The sum is %f.\n", total(4, 3.1, 1.0, 0.6, 2.6));
  printf("The sum is %f.\n", 3.1 + 1.0 + 0.6 + 2.6);
  printf("The sum is %f.\n", total(1, 3.1));
  printf("The sum is %f.\n", total(0));
  printf("The sum is %f.\n", total(2, 3.1, 1.0, 0.6));
  printf("The sum is %f.\n", total(4, 3.1, 1.0, 0.6));
  printf("The sum is %f.\n", total(4, 3.1, 1, 0.6, 2.6));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
movsd  0xec4(%rip),%xmm0
movsd  0xed4(%rip),%xmm1
movsd  0xebc(%rip),%xmm2
movsd  0xebc(%rip),%xmm3
mov    $0x4,%al
call   1040 <total@plt>
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
movsd  0xeaa(%rip),%xmm0
call   1030 <printf@plt>
mov    $0x1,%edi
movsd  0xe78(%rip),%xmm0
mov    $0x1,%al
call   1040 <total@plt>
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
mov    $0x0,%al
call   1040 <total@plt>
lea    0xe7d(%rip),%rdi
call   1030 <printf@plt>
mov    $0x2,%edi
movsd  0xe43(%rip),%xmm0
movsd  0xe53(%rip),%xmm1
movsd  0xe3b(%rip),%xmm2
mov    $0x3,%al
call   1040 <total@plt>
lea    0xe4d(%rip),%rdi
call   1030 <printf@plt>
mov    $0x4,%edi
movsd  0xe13(%rip),%xmm0
movsd  0xe23(%rip),%xmm1
movsd  0xe0b(%rip),%xmm2
mov    $0x3,%al
call   1040 <total@plt>
lea    0xe1d(%rip),%rdi
call   1030 <printf@plt>
mov    $0x4,%edi
movsd  0xde3(%rip),%xmm0
mov    $0x1,%esi
movsd  0xdde(%rip),%xmm1
movsd  0xdde(%rip),%xmm2
mov    $0x3,%al
call   1040 <total@plt>
lea    0xde8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
movsd  0xed7(%rip),%xmm0
movsd  0xed7(%rip),%xmm1
movsd  0xed7(%rip),%xmm2
movsd  0xed7(%rip),%xmm3
mov    $0x4,%edi
mov    $0x4,%al
call   1040 <total@plt>
lea    0xed4(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xebc(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
movsd  0xe87(%rip),%xmm0
mov    $0x1,%al
call   1040 <total@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %edi,%edi
xor    %eax,%eax
call   1040 <total@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    $0x2,%edi
movsd  0xe5a(%rip),%xmm0
movsd  0xe5a(%rip),%xmm1
movsd  0xe5a(%rip),%xmm2
mov    $0x3,%al
call   1040 <total@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    $0x4,%edi
movsd  0xe2e(%rip),%xmm0
movsd  0xe2e(%rip),%xmm1
movsd  0xe2e(%rip),%xmm2
mov    $0x3,%al
call   1040 <total@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    $0x4,%edi
movsd  0xe02(%rip),%xmm0
mov    $0x1,%esi
movsd  0xe05(%rip),%xmm1
movsd  0xe05(%rip),%xmm2
mov    $0x3,%al
call   1040 <total@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"The sum is %f.\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call double (i32, ...) @total(i32 4, double 3.100000e+00, double 1.000000e+00, double 6.000000e-01, double 2.600000e+00)
%3 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double 0x401D333333333332)
%5 = call double (i32, ...) @total(i32 1, double 3.100000e+00)
%6 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %5)
%7 = call double (i32, ...) @total(i32 0)
%8 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %7)
%9 = call double (i32, ...) @total(i32 2, double 3.100000e+00, double 1.000000e+00, double 6.000000e-01)
%10 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %9)
%11 = call double (i32, ...) @total(i32 4, double 3.100000e+00, double 1.000000e+00, double 6.000000e-01)
%12 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %11)
%13 = call double (i32, ...) @total(i32 4, double 3.100000e+00, i32 1, double 6.000000e-01, double 2.600000e+00)
%14 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"The sum is %f.\0A\00"
define i32 @main() {
%1 = tail call double (i32, ...) @total(i32 4, double 3.100000e+00, double 1.000000e+00, double 6.000000e-01, double 2.600000e+00)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %1)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double 0x401D333333333332)
%4 = tail call double (i32, ...) @total(i32 1, double 3.100000e+00)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %4)
%6 = tail call double (i32, ...) @total(i32 0)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %6)
%8 = tail call double (i32, ...) @total(i32 2, double 3.100000e+00, double 1.000000e+00, double 6.000000e-01)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %8)
%10 = tail call double (i32, ...) @total(i32 4, double 3.100000e+00, double 1.000000e+00, double 6.000000e-01)
%11 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %10)
%12 = tail call double (i32, ...) @total(i32 4, double 3.100000e+00, i32 1, double 6.000000e-01, double 2.600000e+00)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %12)
ret i32 0
}