#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 */
scalar_t__ cos(double);
scalar_t__ exp(double);
scalar_t__ log(double);
scalar_t__ pow(double, double);
scalar_t__ sin(double);
scalar_t__ sqrt(double);
scalar_t__ tan(double);
double HardSum(double d) {
  double sum = 0.0;
  sum += pow(d, 3.0);
  sum += pow(d, 2.0);
  sum += sqrt(d);
  sum += sin(d);
  sum += cos(d);
  sum += tan(d);
  sum += exp(d);
  sum += log(d);
  return sum;
}


x86 assembly (clang, -O0):
<HardSum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe76(%rip),%xmm1
call   1080 <pow@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe4d(%rip),%xmm1
call   1080 <pow@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1090 <sqrt@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1060 <cos@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <tan@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <exp@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1070 <log@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<HardSum>:
sub    $0x18,%rsp
movsd  %xmm0,0x10(%rsp)
movsd  0xe7e(%rip),%xmm1
call   1080 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0xe6b(%rip),%xmm1
movsd  0x10(%rsp),%xmm0
call   1080 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1090 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <sin@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1060 <cos@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1050 <tan@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <exp@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
call   1070 <log@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @HardSum(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
store double 0.000000e+00, double* %3
%4 = load double, double* %2
%5 = call i64 @pow(double %4, double 3.000000e+00)
%6 = sitofp i64 %5 to double
%7 = load double, double* %3
%8 = fadd double %7, %6
store double %8, double* %3
%9 = load double, double* %2
%10 = call i64 @pow(double %9, double 2.000000e+00)
%11 = sitofp i64 %10 to double
%12 = load double, double* %3
%13 = fadd double %12, %11
store double %13, double* %3
%14 = load double, double* %2
%15 = call i64 @sqrt(double %14)
%16 = sitofp i64 %15 to double
%17 = load double, double* %3
%18 = fadd double %17, %16
store double %18, double* %3
%19 = load double, double* %2
%20 = call i64 @sin(double %19)
%21 = sitofp i64 %20 to double
%22 = load double, double* %3
%23 = fadd double %22, %21
store double %23, double* %3
%24 = load double, double* %2
%25 = call i64 @cos(double %24)
%26 = sitofp i64 %25 to double
%27 = load double, double* %3
%28 = fadd double %27, %26
store double %28, double* %3
%29 = load double, double* %2
%30 = call i64 @tan(double %29)
%31 = sitofp i64 %30 to double
%32 = load double, double* %3
%33 = fadd double %32, %31
store double %33, double* %3
%34 = load double, double* %2
%35 = call i64 @exp(double %34)
%36 = sitofp i64 %35 to double
%37 = load double, double* %3
%38 = fadd double %37, %36
store double %38, double* %3
%39 = load double, double* %2
%40 = call i64 @log(double %39)
%41 = sitofp i64 %40 to double
%42 = load double, double* %3
%43 = fadd double %42, %41
store double %43, double* %3
%44 = load double, double* %3
ret double %44
}

LLVM IR (-O2):
define double @HardSum(double %0) {
%2 = tail call i64 @pow(double %0, double 3.000000e+00)
%3 = sitofp i64 %2 to double
%4 = tail call i64 @pow(double %0, double 2.000000e+00)
%5 = sitofp i64 %4 to double
%6 = fadd double %3, %5
%7 = tail call i64 @sqrt(double %0)
%8 = sitofp i64 %7 to double
%9 = fadd double %6, %8
%10 = tail call i64 @sin(double %0)
%11 = sitofp i64 %10 to double
%12 = fadd double %9, %11
%13 = tail call i64 @cos(double %0)
%14 = sitofp i64 %13 to double
%15 = fadd double %12, %14
%16 = tail call i64 @tan(double %0)
%17 = sitofp i64 %16 to double
%18 = fadd double %15, %17
%19 = tail call i64 @exp(double %0)
%20 = sitofp i64 %19 to double
%21 = fadd double %18, %20
%22 = tail call i64 @log(double %0)
%23 = sitofp i64 %22 to double
%24 = fadd double %21, %23
ret double %24
}