#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 M_PI;
double bondi_newt_solve(double, double, double, double, double, double, double);
double exp(double);
double fabs(double);
double pow(double, double);
int bondi_newt(double Mdot, double GM, double gam, double rho0, double *r,
               double *rho, double *u, double *P, int N) {
  double qs = 0.25 * pow(2 / (5 - 3 * gam), (5 - 3 * gam) / (2 * gam - 2));
  if (qs < 0.25 || fabs(3 * gam - 5) < 1.0e-6)
    qs = 0.25;
  else if (qs > 0.25 * exp(1.5) || fabs(gam - 1.0) < 1.0e-6)
    qs = 0.25 * exp(1.5);
  double a0 = pow(4 * M_PI * qs * GM * GM * rho0 / Mdot, 1.0 / 3.0);
  double K = a0 * a0 * pow(rho0, -gam + 1.0) / gam;
  int i;
  for (i = 0; i < N; i++) {
    double ui = bondi_newt_solve(Mdot, GM, r[i], gam, rho0, a0, K);
    rho[i] = -Mdot / (4 * M_PI * r[i] * r[i] * ui);
    u[i] = ui;
    P[i] = K * pow(rho[i], gam);
  }
  return 0;
}


x86 assembly (clang, -O0):
<bondi_newt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
mov    %rdi,-0x28(%rbp)
mov    %rsi,-0x30(%rbp)
mov    %rdx,-0x38(%rbp)
mov    %rcx,-0x40(%rbp)
mov    %r8d,-0x44(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  0xea0(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe9c(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe98(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xe77(%rip),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe73(%rip),%xmm2
addsd  %xmm2,%xmm1
movsd  -0x18(%rbp),%xmm2
addsd  %xmm2,%xmm2
movsd  0xe4e(%rip),%xmm3
addsd  %xmm3,%xmm2
divsd  %xmm2,%xmm1
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  0xe2e(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xe1d(%rip),%xmm0
ucomisd -0x50(%rbp),%xmm0
ja     1228 <bondi_newt+0xf8>
movsd  -0x18(%rbp),%xmm1
movsd  0xe35(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe31(%rip),%xmm0
addsd  %xmm0,%xmm1
movaps 0xe4e(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe0a(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    123a <bondi_newt+0x10a>
movsd  0xdd0(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    12c3 <bondi_newt+0x193>
movsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xdf4(%rip),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm2
movsd  -0x78(%rbp),%xmm0
movsd  0xd9f(%rip),%xmm1
mulsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
ja     129d <bondi_newt+0x16d>
movsd  -0x18(%rbp),%xmm1
movsd  0xdcc(%rip),%xmm0
subsd  %xmm0,%xmm1
movaps 0xdd9(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xd95(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    12be <bondi_newt+0x18e>
movsd  0xd9b(%rip),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xd4b(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    12c3 <bondi_newt+0x193>
mov    0x2d1e(%rip),%rax
mov    (%rax),%eax
shl    $0x2,%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x50(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  0xd5c(%rip),%xmm1
call   1050 <pow@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
movsd  0xd12(%rip),%xmm2
addsd  %xmm2,%xmm1
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x80(%rbp),%xmm0
mulsd  %xmm1,%xmm0
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    1459 <bondi_newt+0x329>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mov    -0x28(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x18(%rbp),%xmm3
movsd  -0x20(%rbp),%xmm4
movsd  -0x58(%rbp),%xmm5
movsd  -0x60(%rbp),%xmm6
call   1040 <bondi_newt_solve@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    0x2c28(%rip),%rax
mov    (%rax),%eax
shl    $0x2,%eax
cvtsi2sd %eax,%xmm1
mov    -0x28(%rbp),%rax
movslq -0x64(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
mov    -0x28(%rbp),%rax
movslq -0x64(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm1
mulsd  -0x70(%rbp),%xmm1
divsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x70(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x30(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  -0x18(%rbp),%xmm1
call   1050 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    135c <bondi_newt+0x22c>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bondi_newt>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %r8d,%ebp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
movsd  %xmm3,0x8(%rsp)
movapd %xmm2,0x10(%rsp)
movsd  %xmm1,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
movapd %xmm2,%xmm1
unpcklpd %xmm2,%xmm1
mulpd  0xe9c(%rip),%xmm1
addpd  0xea4(%rip),%xmm1
movsd  0xecc(%rip),%xmm0
divsd  %xmm1,%xmm0
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
divsd  %xmm2,%xmm1
call   1040 <pow@plt>
movapd 0x10(%rsp),%xmm2
movsd  0xeb1(%rip),%xmm1
mulsd  %xmm1,%xmm0
ucomisd %xmm0,%xmm1
ja     11fd <bondi_newt+0xdd>
movsd  0xea7(%rip),%xmm3
mulsd  %xmm2,%xmm3
addsd  0xea3(%rip),%xmm3
andpd  0xe63(%rip),%xmm3
movsd  0xe9b(%rip),%xmm2
ucomisd %xmm3,%xmm2
ja     11fd <bondi_newt+0xdd>
ucomisd 0xe95(%rip),%xmm0
ja     11f5 <bondi_newt+0xd5>
movsd  0xe93(%rip),%xmm1
addsd  0x10(%rsp),%xmm1
andpd  0xe35(%rip),%xmm1
ucomisd %xmm1,%xmm2
movapd %xmm0,%xmm1
jbe    11fd <bondi_newt+0xdd>
movsd  0xe6b(%rip),%xmm1
mov    0x2de4(%rip),%rax
mov    (%rax),%eax
shl    $0x2,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0x30(%rsp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mulsd  0x8(%rsp),%xmm0
divsd  0x40(%rsp),%xmm0
movsd  0xe42(%rip),%xmm1
call   1040 <pow@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0xe37(%rip),%xmm1
subsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm0
call   1040 <pow@plt>
movapd 0x40(%rsp),%xmm3
movapd 0x10(%rsp),%xmm1
test   %ebp,%ebp
jle    1337 <bondi_newt+0x217>
movsd  0x28(%rsp),%xmm2
mulsd  %xmm2,%xmm2
mulsd  %xmm0,%xmm2
divsd  %xmm1,%xmm2
movsd  %xmm2,0x38(%rsp)
movapd 0xda2(%rip),%xmm0
xorpd  %xmm3,%xmm0
movapd %xmm0,0x50(%rsp)
mov    %ebp,%ebp
xor    %r13d,%r13d
nopl   (%rax)
movsd  (%rbx,%r13,8),%xmm2
movapd %xmm3,%xmm0
movsd  0x30(%rsp),%xmm1
movaps 0x10(%rsp),%xmm3
movsd  0x8(%rsp),%xmm4
movsd  0x28(%rsp),%xmm5
movsd  0x38(%rsp),%xmm6
call   1030 <bondi_newt_solve@plt>
mov    0x2d15(%rip),%rax
mov    (%rax),%eax
shl    $0x2,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  (%rbx,%r13,8),%xmm2
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm1
movapd 0x50(%rsp),%xmm2
divsd  %xmm1,%xmm2
movsd  %xmm2,(%r12,%r13,8)
movsd  %xmm0,(%r15,%r13,8)
movsd  (%r12,%r13,8),%xmm0
movapd 0x10(%rsp),%xmm1
call   1040 <pow@plt>
movapd 0x40(%rsp),%xmm3
mulsd  0x38(%rsp),%xmm0
movsd  %xmm0,(%r14,%r13,8)
add    $0x1,%r13
cmp    %r13,%rbp
jne    12a0 <bondi_newt+0x180>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@M_PI = global i32 0
define i32 @bondi_newt(double %0, double %1, double %2, double %3, double* %4, double* %5, double* %6, double* %7, i32 %8) {
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double*
%15 = alloca double*
%16 = alloca double*
%17 = alloca double*
%18 = alloca i32
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca i32
%23 = alloca double
store double %0, double* %10
store double %1, double* %11
store double %2, double* %12
store double %3, double* %13
store double* %4, double** %14
store double* %5, double** %15
store double* %6, double** %16
store double* %7, double** %17
store i32 %8, i32* %18
%24 = load double, double* %12
%25 = call double @llvm.fmuladd.f64(double -3.000000e+00, double %24, double 5.000000e+00)
%26 = fdiv double 2.000000e+00, %25
%27 = load double, double* %12
%28 = call double @llvm.fmuladd.f64(double -3.000000e+00, double %27, double 5.000000e+00)
%29 = load double, double* %12
%30 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %29, double -2.000000e+00)
%31 = fdiv double %28, %30
%32 = call double @pow(double %26, double %31)
%33 = fmul double 2.500000e-01, %32
store double %33, double* %19
%34 = load double, double* %19
%35 = fcmp olt double %34, 2.500000e-01
br i1 %35, label %41, label %36
36: ; preds = %9
%37 = load double, double* %12
%38 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %37, double -5.000000e+00)
%39 = call double @llvm.fabs.f64(double %38)
%40 = fcmp olt double %39, 0x3EB0C6F7A0B5ED8D
br i1 %40, label %41, label %42
41: ; preds = %36, %9
store double 2.500000e-01, double* %19
br label %56
42: ; preds = %36
%43 = load double, double* %19
%44 = call double @exp(double 1.500000e+00)
%45 = fmul double 2.500000e-01, %44
%46 = fcmp ogt double %43, %45
br i1 %46, label %52, label %47
47: ; preds = %42
%48 = load double, double* %12
%49 = fsub double %48, 1.000000e+00
%50 = call double @llvm.fabs.f64(double %49)
%51 = fcmp olt double %50, 0x3EB0C6F7A0B5ED8D
br i1 %51, label %52, label %55
52: ; preds = %47, %42
%53 = call double @exp(double 1.500000e+00)
%54 = fmul double 2.500000e-01, %53
store double %54, double* %19
br label %55
55: ; preds = %52, %47
br label %56
56: ; preds = %55, %41
%57 = load i32, i32* @M_PI
%58 = mul nsw i32 4, %57
%59 = sitofp i32 %58 to double
%60 = load double, double* %19
%61 = fmul double %59, %60
%62 = load double, double* %11
%63 = fmul double %61, %62
%64 = load double, double* %11
%65 = fmul double %63, %64
%66 = load double, double* %13
%67 = fmul double %65, %66
%68 = load double, double* %10
%69 = fdiv double %67, %68
%70 = call double @pow(double %69, double 0x3FD5555555555555)
store double %70, double* %20
%71 = load double, double* %20
%72 = load double, double* %20
%73 = fmul double %71, %72
%74 = load double, double* %13
%75 = load double, double* %12
%76 = fneg double %75
%77 = fadd double %76, 1.000000e+00
%78 = call double @pow(double %74, double %77)
%79 = fmul double %73, %78
%80 = load double, double* %12
%81 = fdiv double %79, %80
store double %81, double* %21
store i32 0, i32* %22
br label %82
82: ; preds = %141, %56
%83 = load i32, i32* %22
%84 = load i32, i32* %18
%85 = icmp slt i32 %83, %84
br i1 %85, label %86, label %144
86: ; preds = %82
%87 = load double, double* %10
%88 = load double, double* %11
%89 = load double*, double** %14
%90 = load i32, i32* %22
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds double, double* %89, i64 %91
%93 = load double, double* %92
%94 = load double, double* %12
%95 = load double, double* %13
%96 = load double, double* %20
%97 = load double, double* %21
%98 = call double @bondi_newt_solve(double %87, double %88, double %93, double %94, double %95, double %96, double %97)
store double %98, double* %23
%99 = load double, double* %10
%100 = fneg double %99
%101 = load i32, i32* @M_PI
%102 = mul nsw i32 4, %101
%103 = sitofp i32 %102 to double
%104 = load double*, double** %14
%105 = load i32, i32* %22
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds double, double* %104, i64 %106
%108 = load double, double* %107
%109 = fmul double %103, %108
%110 = load double*, double** %14
%111 = load i32, i32* %22
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds double, double* %110, i64 %112
%114 = load double, double* %113
%115 = fmul double %109, %114
%116 = load double, double* %23
%117 = fmul double %115, %116
%118 = fdiv double %100, %117
%119 = load double*, double** %15
%120 = load i32, i32* %22
%121 = sext i32 %120 to i64
%122 = getelementptr inbounds double, double* %119, i64 %121
store double %118, double* %122
%123 = load double, double* %23
%124 = load double*, double** %16
%125 = load i32, i32* %22
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds double, double* %124, i64 %126
store double %123, double* %127
%128 = load double, double* %21
%129 = load double*, double** %15
%130 = load i32, i32* %22
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds double, double* %129, i64 %131
%133 = load double, double* %132
%134 = load double, double* %12
%135 = call double @pow(double %133, double %134)
%136 = fmul double %128, %135
%137 = load double*, double** %17
%138 = load i32, i32* %22
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds double, double* %137, i64 %139
store double %136, double* %140
br label %141
141: ; preds = %86
%142 = load i32, i32* %22
%143 = add nsw i32 %142, 1
store i32 %143, i32* %22
br label %82
144: ; preds = %82
ret i32 0
}

LLVM IR (-O2):
@M_PI = global i32 0
define i32 @bondi_newt(double %0, double %1, double %2, double %3, double* nocapture %4, double* nocapture %5, double* nocapture writeonly %6, double* nocapture writeonly %7, i32 %8) {
%10 = insertelement <2 x double> poison, double %2, i64 0
%11 = shufflevector <2 x double> %10, <2 x double> poison, <2 x i32> zeroinitializer
%12 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %11, <2 x double> <double -3.000000e+00, double 2.000000e+00>, <2 x double> <double 5.000000e+00, double -2.000000e+00>)
%13 = extractelement <2 x double> %12, i64 0
%14 = fdiv double 2.000000e+00, %13
%15 = extractelement <2 x double> %12, i64 1
%16 = fdiv double %13, %15
%17 = tail call double @pow(double %14, double %16)
%18 = fmul double %17, 2.500000e-01
%19 = fcmp olt double %18, 2.500000e-01
br i1 %19, label %31, label %20
20: ; preds = %9
%21 = tail call double @llvm.fmuladd.f64(double %2, double 3.000000e+00, double -5.000000e+00)
%22 = tail call double @llvm.fabs.f64(double %21)
%23 = fcmp olt double %22, 0x3EB0C6F7A0B5ED8D
br i1 %23, label %31, label %24
24: ; preds = %20
%25 = fcmp ogt double %18, 0x3FF1ED3FE64FC541
br i1 %25, label %30, label %26
26: ; preds = %24
%27 = fadd double %2, -1.000000e+00
%28 = tail call double @llvm.fabs.f64(double %27)
%29 = fcmp olt double %28, 0x3EB0C6F7A0B5ED8D
br i1 %29, label %30, label %31
30: ; preds = %26, %24
br label %31
31: ; preds = %9, %20, %26, %30
%32 = phi double [ 0x3FF1ED3FE64FC541, %30 ], [ %18, %26 ], [ 2.500000e-01, %20 ], [ 2.500000e-01, %9 ]
%33 = load i32, i32* @M_PI
%34 = shl nsw i32 %33, 2
%35 = sitofp i32 %34 to double
%36 = fmul double %32, %35
%37 = fmul double %36, %1
%38 = fmul double %37, %1
%39 = fmul double %38, %3
%40 = fdiv double %39, %0
%41 = tail call double @pow(double %40, double 0x3FD5555555555555)
%42 = fmul double %41, %41
%43 = fsub double 1.000000e+00, %2
%44 = tail call double @pow(double %3, double %43)
%45 = fmul double %42, %44
%46 = fdiv double %45, %2
%47 = icmp sgt i32 %8, 0
br i1 %47, label %48, label %72
48: ; preds = %31
%49 = fneg double %0
%50 = zext i32 %8 to i64
br label %51
51: ; preds = %48, %51
%52 = phi i64 [ 0, %48 ], [ %70, %51 ]
%53 = getelementptr inbounds double, double* %4, i64 %52
%54 = load double, double* %53
%55 = tail call double @bondi_newt_solve(double %0, double %1, double %54, double %2, double %3, double %41, double %46)
%56 = load i32, i32* @M_PI
%57 = shl nsw i32 %56, 2
%58 = sitofp i32 %57 to double
%59 = load double, double* %53
%60 = fmul double %59, %58
%61 = fmul double %59, %60
%62 = fmul double %55, %61
%63 = fdiv double %49, %62
%64 = getelementptr inbounds double, double* %5, i64 %52
store double %63, double* %64
%65 = getelementptr inbounds double, double* %6, i64 %52
store double %55, double* %65
%66 = load double, double* %64
%67 = tail call double @pow(double %66, double %2)
%68 = fmul double %46, %67
%69 = getelementptr inbounds double, double* %7, i64 %52
store double %68, double* %69
%70 = add nuw nsw i64 %52, 1
%71 = icmp eq i64 %70, %50
br i1 %71, label %72, label %51
72: ; preds = %51, %31
ret i32 0
}