#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*/ foo(int /*<<< orphan*/, double, double *, double *, int,
                       int);
int __attribute__((no, noclone, hot)) bar(int order, double q, double c[]) {
  int ni, nn, i, e;
  double g2, x2, de, s, ratio, ff;
  nn = 0;
  e = order & 1;
  s = 0;
  ratio = 0;
  x2 = 0;
  g2 = 0;
  if (q == 0.0)
    return 0;
  if (order < 5) {
    ratio = 1.0 / q;
    nn = order;
  }
  ni = -nn;
  while (1) {
    de = ratio - g2 - x2;
    foo(0, q, &ff, &g2, e, ni);
    if ((int)de == 0)
      break;
  }
  s += 2 * nn * c[nn];
  for (i = 0; i < 1; i++) {
    c[0] = nn;
    for (; i < 10; i++)
      c[i] = 0.0;
    c[0] /= s;
  }
  return 0;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x8(%rbp),%eax
and    $0x1,%eax
mov    %eax,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1178 <bar+0x68>
jp     1178 <bar+0x68>
movl   $0x0,-0x4(%rbp)
jmp    1282 <bar+0x172>
cmpl   $0x5,-0x8(%rbp)
jge    119a <bar+0x8a>
movsd  0xe76(%rip),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
xor    %eax,%eax
sub    -0x20(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movsd  -0x50(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x28(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
xor    %edi,%edi
lea    -0x58(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1030 <foo@plt>
cvttsd2si -0x40(%rbp),%eax
cmp    $0x0,%eax
jne    11e4 <bar+0xd4>
jmp    11e9 <bar+0xd9>
jmp    11a2 <bar+0x92>
mov    -0x20(%rbp),%eax
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x1,-0x24(%rbp)
jge    127b <bar+0x16b>
cvtsi2sdl -0x20(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
cmpl   $0xa,-0x24(%rbp)
jge    1258 <bar+0x148>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1230 <bar+0x120>
movsd  -0x48(%rbp),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1219 <bar+0x109>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movq   $0x0,0x8(%rsp)
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1077 <bar+0x27>
jnp    1167 <bar+0x117>
mov    %rsi,%r14
mov    %edi,%r15d
mov    %edi,%ebp
and    $0x1,%ebp
xor    %eax,%eax
cmp    $0x5,%edi
cmovge %eax,%r15d
jl     1093 <bar+0x43>
xorpd  %xmm1,%xmm1
jmp    109f <bar+0x4f>
movsd  0xf65(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
mov    %r15d,%ebx
neg    %ebx
lea    0x20(%rsp),%rsi
lea    0x8(%rsp),%rdx
xor    %edi,%edi
movsd  %xmm0,0x10(%rsp)
mov    %ebp,%ecx
mov    %ebx,%r8d
call   1030 <foo@plt>
movsd  (%rsp),%xmm0
cvttsd2si %xmm0,%eax
test   %eax,%eax
je     1123 <bar+0xd3>
lea    0x20(%rsp),%r12
lea    0x8(%rsp),%r13
movsd  %xmm0,(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
subsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x18(%rsp)
xor    %edi,%edi
movsd  0x10(%rsp),%xmm0
mov    %r12,%rsi
mov    %r13,%rdx
mov    %ebp,%ecx
mov    %ebx,%r8d
call   1030 <foo@plt>
movsd  (%rsp),%xmm0
cvttsd2si 0x18(%rsp),%eax
test   %eax,%eax
jne    10f0 <bar+0xa0>
lea    (%r15,%r15,1),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movslq %r15d,%rax
mulsd  (%r14,%rax,8),%xmm0
xorpd  %xmm1,%xmm1
addsd  %xmm1,%xmm0
xorps  %xmm2,%xmm2
movups %xmm2,0x38(%r14)
movups %xmm2,0x28(%r14)
movups %xmm2,0x18(%r14)
movups %xmm2,0x8(%r14)
movq   $0x0,0x48(%r14)
divsd  %xmm0,%xmm1
movsd  %xmm1,(%r14)
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
nopl   0x0(%rax,%rax,1)

LLVM IR (-O0):
define i32 @bar(i32 %0, double %1, double* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
%7 = alloca double*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
store i32 %0, i32* %5
store double %1, double* %6
store double* %2, double** %7
store i32 0, i32* %9
%18 = load i32, i32* %5
%19 = and i32 %18, 1
store i32 %19, i32* %11
store double 0.000000e+00, double* %15
store double 0.000000e+00, double* %16
store double 0.000000e+00, double* %13
store double 0.000000e+00, double* %12
%20 = load double, double* %6
%21 = fcmp oeq double %20, 0.000000e+00
br i1 %21, label %22, label %23
22: ; preds = %3
store i32 0, i32* %4
br label %88
23: ; preds = %3
%24 = load i32, i32* %5
%25 = icmp slt i32 %24, 5
br i1 %25, label %26, label %30
26: ; preds = %23
%27 = load double, double* %6
%28 = fdiv double 1.000000e+00, %27
store double %28, double* %16
%29 = load i32, i32* %5
store i32 %29, i32* %9
br label %30
30: ; preds = %26, %23
%31 = load i32, i32* %9
%32 = sub nsw i32 0, %31
store i32 %32, i32* %8
br label %33
33: ; preds = %30, %47
%34 = load double, double* %16
%35 = load double, double* %12
%36 = fsub double %34, %35
%37 = load double, double* %13
%38 = fsub double %36, %37
store double %38, double* %14
%39 = load double, double* %6
%40 = load i32, i32* %11
%41 = load i32, i32* %8
%42 = call i32 @foo(i32 0, double %39, double* %17, double* %12, i32 %40, i32 %41)
%43 = load double, double* %14
%44 = fptosi double %43 to i32
%45 = icmp eq i32 %44, 0
br i1 %45, label %46, label %47
46: ; preds = %33
br label %48
47: ; preds = %33
br label %33
48: ; preds = %46
%49 = load i32, i32* %9
%50 = mul nsw i32 2, %49
%51 = sitofp i32 %50 to double
%52 = load double*, double** %7
%53 = load i32, i32* %9
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds double, double* %52, i64 %54
%56 = load double, double* %55
%57 = load double, double* %15
%58 = call double @llvm.fmuladd.f64(double %51, double %56, double %57)
store double %58, double* %15
store i32 0, i32* %10
br label %59
59: ; preds = %84, %48
%60 = load i32, i32* %10
%61 = icmp slt i32 %60, 1
br i1 %61, label %62, label %87
62: ; preds = %59
%63 = load i32, i32* %9
%64 = sitofp i32 %63 to double
%65 = load double*, double** %7
%66 = getelementptr inbounds double, double* %65, i64 0
store double %64, double* %66
br label %67
67: ; preds = %75, %62
%68 = load i32, i32* %10
%69 = icmp slt i32 %68, 10
br i1 %69, label %70, label %78
70: ; preds = %67
%71 = load double*, double** %7
%72 = load i32, i32* %10
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds double, double* %71, i64 %73
store double 0.000000e+00, double* %74
br label %75
75: ; preds = %70
%76 = load i32, i32* %10
%77 = add nsw i32 %76, 1
store i32 %77, i32* %10
br label %67
78: ; preds = %67
%79 = load double, double* %15
%80 = load double*, double** %7
%81 = getelementptr inbounds double, double* %80, i64 0
%82 = load double, double* %81
%83 = fdiv double %82, %79
store double %83, double* %81
br label %84
84: ; preds = %78
%85 = load i32, i32* %10
%86 = add nsw i32 %85, 1
store i32 %86, i32* %10
br label %59
87: ; preds = %59
store i32 0, i32* %4
br label %88
88: ; preds = %87, %22
%89 = load i32, i32* %4
ret i32 %89
}

LLVM IR (-O2):
define i32 @bar(i32 %0, double %1, double* nocapture %2) {
%4 = alloca double
%5 = alloca double
%6 = bitcast double* %4 to i8*
%7 = bitcast double* %5 to i8*
%8 = and i32 %0, 1
store double 0.000000e+00, double* %4
%9 = fcmp oeq double %1, 0.000000e+00
br i1 %9, label %35, label %10
10: ; preds = %3
%11 = icmp slt i32 %0, 5
%12 = fdiv double 1.000000e+00, %1
%13 = select i1 %11, i32 %0, i32 0
%14 = select i1 %11, double %12, double 0.000000e+00
%15 = sub nsw i32 0, %13
%16 = call i32 @foo(i32 0, double %1, double* %5, double* %4, i32 %8, i32 %15)
%17 = fptosi double %14 to i32
%18 = icmp eq i32 %17, 0
br i1 %18, label %25, label %19
19: ; preds = %10, %19
%20 = load double, double* %4
%21 = fsub double %14, %20
%22 = call i32 @foo(i32 0, double %1, double* %5, double* %4, i32 %8, i32 %15)
%23 = fptosi double %21 to i32
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %19
25: ; preds = %19, %10
%26 = shl nsw i32 %13, 1
%27 = sitofp i32 %26 to double
%28 = sext i32 %13 to i64
%29 = getelementptr inbounds double, double* %2, i64 %28
%30 = load double, double* %29
%31 = call double @llvm.fmuladd.f64(double %27, double %30, double 0.000000e+00)
%32 = getelementptr inbounds double, double* %2, i64 1
%33 = bitcast double* %32 to i8*
%34 = fdiv double 0.000000e+00, %31
store double %34, double* %2
br label %35
35: ; preds = %25, %3
ret i32 0
}