#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 */
double g0(double, double *);
double pow(double, double);
double sumex(double);
double sg0(double ex, double *p, double *ap) {
  return (g0(ap[1], p) +
          (g0(ap[2], p) * ex + g0(ap[3], p) * ex * ex +
           g0(ap[4], p) * pow(ex, 3.0) +
           (g0(ap[5], p) * pow(ex, 4.0) + g0(ap[6], p) * pow(ex, 12.0)) *
               (1.0 - pow(ex, 8.0)) / (1.0 - ex))) /
         sumex(ex);
}


x86 assembly (clang, -O0):
<sg0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rdi
call   1030 <g0@plt>
movsd  %xmm0,-0x28(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rdi
call   1030 <g0@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x10(%rbp),%rdi
call   1030 <g0@plt>
movsd  -0x70(%rbp),%xmm2
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm1
mulsd  -0x8(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x10(%rbp),%rdi
call   1030 <g0@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe49(%rip),%xmm1
call   1040 <pow@plt>
movsd  -0x60(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x28(%rax),%xmm0
mov    -0x10(%rbp),%rdi
call   1030 <g0@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xdfe(%rip),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,-0x48(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x30(%rax),%xmm0
mov    -0x10(%rbp),%rdi
call   1030 <g0@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xdc8(%rip),%xmm1
call   1040 <pow@plt>
movsd  -0x50(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xd8b(%rip),%xmm1
call   1040 <pow@plt>
movsd  -0x38(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
movaps %xmm0,%xmm4
movsd  -0x28(%rbp),%xmm0
movsd  0xd64(%rip),%xmm3
subsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm2
movsd  0xd54(%rip),%xmm3
subsd  -0x8(%rbp),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <sumex@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sg0>:
push   %r14
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rsi),%xmm0
call   1030 <g0@plt>
movsd  %xmm0,0x20(%rsp)
movsd  0x10(%rbx),%xmm0
mov    %r14,%rdi
call   1030 <g0@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x18(%rbx),%xmm0
mov    %r14,%rdi
call   1030 <g0@plt>
movsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
movsd  0x18(%rsp),%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm2,%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x20(%rbx),%xmm0
mov    %r14,%rdi
call   1030 <g0@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0xe50(%rip),%xmm1
movsd  0x8(%rsp),%xmm0
call   1040 <pow@plt>
mulsd  0x10(%rsp),%xmm0
addsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0x28(%rbx),%xmm0
mov    %r14,%rdi
call   1030 <g0@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0xe20(%rip),%xmm1
movsd  0x8(%rsp),%xmm0
call   1040 <pow@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0x30(%rbx),%xmm0
mov    %r14,%rdi
call   1030 <g0@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0xdfc(%rip),%xmm1
movsd  0x8(%rsp),%xmm0
call   1040 <pow@plt>
mulsd  0x28(%rsp),%xmm0
movsd  0x30(%rsp),%xmm1
mulsd  0x10(%rsp),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0xdd5(%rip),%xmm1
movsd  0x8(%rsp),%xmm0
call   1040 <pow@plt>
movsd  0xdca(%rip),%xmm1
movapd %xmm1,%xmm2
subsd  %xmm0,%xmm2
mulsd  0x10(%rsp),%xmm2
movsd  0x8(%rsp),%xmm0
subsd  %xmm0,%xmm1
divsd  %xmm1,%xmm2
addsd  0x18(%rsp),%xmm2
addsd  0x20(%rsp),%xmm2
movsd  %xmm2,0x20(%rsp)
call   1050 <sumex@plt>
movsd  0x20(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double @sg0(double %0, double* %1, double* %2) {
%4 = alloca double
%5 = alloca double*
%6 = alloca double*
store double %0, double* %4
store double* %1, double** %5
store double* %2, double** %6
%7 = load double*, double** %6
%8 = getelementptr inbounds double, double* %7, i64 1
%9 = load double, double* %8
%10 = load double*, double** %5
%11 = call double @g0(double %9, double* %10)
%12 = load double*, double** %6
%13 = getelementptr inbounds double, double* %12, i64 2
%14 = load double, double* %13
%15 = load double*, double** %5
%16 = call double @g0(double %14, double* %15)
%17 = load double, double* %4
%18 = load double*, double** %6
%19 = getelementptr inbounds double, double* %18, i64 3
%20 = load double, double* %19
%21 = load double*, double** %5
%22 = call double @g0(double %20, double* %21)
%23 = load double, double* %4
%24 = fmul double %22, %23
%25 = load double, double* %4
%26 = fmul double %24, %25
%27 = call double @llvm.fmuladd.f64(double %16, double %17, double %26)
%28 = load double*, double** %6
%29 = getelementptr inbounds double, double* %28, i64 4
%30 = load double, double* %29
%31 = load double*, double** %5
%32 = call double @g0(double %30, double* %31)
%33 = load double, double* %4
%34 = call double @pow(double %33, double 3.000000e+00)
%35 = call double @llvm.fmuladd.f64(double %32, double %34, double %27)
%36 = load double*, double** %6
%37 = getelementptr inbounds double, double* %36, i64 5
%38 = load double, double* %37
%39 = load double*, double** %5
%40 = call double @g0(double %38, double* %39)
%41 = load double, double* %4
%42 = call double @pow(double %41, double 4.000000e+00)
%43 = load double*, double** %6
%44 = getelementptr inbounds double, double* %43, i64 6
%45 = load double, double* %44
%46 = load double*, double** %5
%47 = call double @g0(double %45, double* %46)
%48 = load double, double* %4
%49 = call double @pow(double %48, double 1.200000e+01)
%50 = fmul double %47, %49
%51 = call double @llvm.fmuladd.f64(double %40, double %42, double %50)
%52 = load double, double* %4
%53 = call double @pow(double %52, double 8.000000e+00)
%54 = fsub double 1.000000e+00, %53
%55 = fmul double %51, %54
%56 = load double, double* %4
%57 = fsub double 1.000000e+00, %56
%58 = fdiv double %55, %57
%59 = fadd double %35, %58
%60 = fadd double %11, %59
%61 = load double, double* %4
%62 = call double @sumex(double %61)
%63 = fdiv double %60, %62
ret double %63
}

LLVM IR (-O2):
define double @sg0(double %0, double* %1, double* nocapture %2) {
%4 = getelementptr inbounds double, double* %2, i64 1
%5 = load double, double* %4
%6 = tail call double @g0(double %5, double* %1)
%7 = getelementptr inbounds double, double* %2, i64 2
%8 = load double, double* %7
%9 = tail call double @g0(double %8, double* %1)
%10 = getelementptr inbounds double, double* %2, i64 3
%11 = load double, double* %10
%12 = tail call double @g0(double %11, double* %1)
%13 = fmul double %12, %0
%14 = fmul double %13, %0
%15 = tail call double @llvm.fmuladd.f64(double %9, double %0, double %14)
%16 = getelementptr inbounds double, double* %2, i64 4
%17 = load double, double* %16
%18 = tail call double @g0(double %17, double* %1)
%19 = tail call double @pow(double %0, double 3.000000e+00)
%20 = tail call double @llvm.fmuladd.f64(double %18, double %19, double %15)
%21 = getelementptr inbounds double, double* %2, i64 5
%22 = load double, double* %21
%23 = tail call double @g0(double %22, double* %1)
%24 = tail call double @pow(double %0, double 4.000000e+00)
%25 = getelementptr inbounds double, double* %2, i64 6
%26 = load double, double* %25
%27 = tail call double @g0(double %26, double* %1)
%28 = tail call double @pow(double %0, double 1.200000e+01)
%29 = fmul double %27, %28
%30 = tail call double @llvm.fmuladd.f64(double %23, double %24, double %29)
%31 = tail call double @pow(double %0, double 8.000000e+00)
%32 = fsub double 1.000000e+00, %31
%33 = fmul double %30, %32
%34 = fsub double 1.000000e+00, %0
%35 = fdiv double %33, %34
%36 = fadd double %20, %35
%37 = fadd double %6, %36
%38 = tail call double @sumex(double %0)
%39 = fdiv double %37, %38
ret double %39
}