#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*/ fabs(double);
int /*<<< orphan*/ params_exactN(double *, double *, double *, double *,
                                 double *, double *, double *, double *);
double pow(int /*<<< orphan*/, double);
int exactN(double x, double *H, double *hx, double *u, double *M, double *B,
           double *beta) {
  double H0, L0, xc, a, Hela, k, Hc, Tc;
  double q, hxx, ux;
  params_exactN(&H0, &L0, &xc, &a, &Hela, &k, &Hc, &Tc);
  if (x < 0.0) {
    return 1;
  }
  if (x > L0) {
    return 2;
  }
  q = (1.0 / 3.0) - 1.0;
  hxx = -2.0 * H0 / (L0 * L0);
  ux = -hxx / k;
  *H = H0 * (1.0 - (x / L0) * (x / L0));
  *hx = hxx * x;
  *u = -(*hx) / k;
  *M = a * ((*H) - Hela);
  *B = Tc / (2.0 * (*H) * pow(fabs(ux), q) * ux);
  *beta = k * 910.0 * 9.81 * (*H);
  return 0;
}


x86 assembly (clang, -O0):
<exactN>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movsd  %xmm0,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %r8,-0x38(%rbp)
mov    %r9,-0x40(%rbp)
lea    -0x48(%rbp),%rdi
lea    -0x50(%rbp),%rsi
lea    -0x58(%rbp),%rdx
lea    -0x60(%rbp),%rcx
lea    -0x68(%rbp),%r8
lea    -0x70(%rbp),%r9
lea    -0x78(%rbp),%r10
lea    -0x80(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1040 <params_exactN@plt>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11a0 <exactN+0x70>
movl   $0x1,-0x4(%rbp)
jmp    1362 <exactN+0x232>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x50(%rbp),%xmm0
jbe    11bc <exactN+0x8c>
movl   $0x2,-0x4(%rbp)
jmp    1362 <exactN+0x232>
movsd  0xe64(%rip),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0xe4c(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
mulsd  -0x50(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
divsd  -0x50(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm2
divsd  -0x50(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xdc1(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x90(%rbp),%xmm0
ff
mulsd  -0x10(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
divsd  -0x70(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x60(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
subsd  -0x68(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
mov    -0x18(%rbp),%rax
movsd  0xd31(%rip),%xmm0
mulsd  (%rax),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
call   1030 <fabs@plt>
mov    %eax,%edi
movsd  -0x88(%rbp),%xmm0
ff
call   1050 <pow@plt>
movsd  -0xa8(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xa0(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
mulsd  -0x98(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xcce(%rip),%xmm0
mulsd  -0x70(%rbp),%xmm0
movsd  0xcb9(%rip),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
mulsd  (%rax),%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exactN>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %r9,0x20(%rsp)
mov    %r8,%r15
mov    %rcx,%r12
mov    %rdx,%r13
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  %xmm0,0x8(%rsp)
lea    0x28(%rsp),%rax
lea    0x68(%rsp),%rbp
lea    0x48(%rsp),%rdi
lea    0x40(%rsp),%rsi
lea    0x70(%rsp),%rdx
lea    0x38(%rsp),%rcx
lea    0x30(%rsp),%r8
lea    0x10(%rsp),%r9
push   %rax
push   %rbp
call   1040 <params_exactN@plt>
movsd  0x18(%rsp),%xmm6
add    $0x10,%rsp
mov    $0x1,%eax
xorpd  %xmm0,%xmm0
ucomisd %xmm6,%xmm0
ja     12b2 <exactN+0x182>
movsd  0x40(%rsp),%xmm0
mov    $0x2,%eax
ucomisd %xmm0,%xmm6
ja     12b2 <exactN+0x182>
movsd  0x48(%rsp),%xmm1
movsd  0xe39(%rip),%xmm2
mulsd  %xmm1,%xmm2
movapd %xmm6,%xmm3
divsd  %xmm0,%xmm3
mulsd  %xmm0,%xmm0
divsd  %xmm0,%xmm2
movapd 0xe4d(%rip),%xmm7
movapd %xmm2,%xmm5
xorpd  %xmm7,%xmm5
movsd  0x10(%rsp),%xmm4
divsd  %xmm4,%xmm5
movapd %xmm5,%xmm0
movapd %xmm5,0x50(%rsp)
mulsd  %xmm3,%xmm3
movsd  0xdfd(%rip),%xmm5
subsd  %xmm3,%xmm5
mulsd  %xmm1,%xmm5
movsd  %xmm5,(%rbx)
mulsd  %xmm6,%xmm2
movsd  %xmm2,(%r14)
xorpd  %xmm7,%xmm2
divsd  %xmm4,%xmm2
movsd  %xmm2,0x0(%r13)
movsd  (%rbx),%xmm1
subsd  0x30(%rsp),%xmm1
mulsd  0x38(%rsp),%xmm1
movsd  %xmm1,(%r12)
movsd  0x28(%rsp),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  (%rbx),%xmm1
addsd  %xmm1,%xmm1
movsd  %xmm1,0x18(%rsp)
call   1030 <fabs@plt>
movsd  0xda5(%rip),%xmm0
mov    %eax,%edi
call   1050 <pow@plt>
mulsd  0x18(%rsp),%xmm0
mulsd  0x50(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,(%r15)
movsd  0x10(%rsp),%xmm0
mulsd  0xd7d(%rip),%xmm0
mulsd  0xd7d(%rip),%xmm0
mulsd  (%rbx),%xmm0
mov    0x20(%rsp),%rax
movsd  %xmm0,(%rax)
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @exactN(double %0, double* %1, double* %2, double* %3, double* %4, double* %5, double* %6) {
%8 = alloca i32
%9 = alloca double
%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 double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
store double %0, double* %9
store double* %1, double** %10
store double* %2, double** %11
store double* %3, double** %12
store double* %4, double** %13
store double* %5, double** %14
store double* %6, double** %15
%27 = call i32 @params_exactN(double* %16, double* %17, double* %18, double* %19, double* %20, double* %21, double* %22, double* %23)
%28 = load double, double* %9
%29 = fcmp olt double %28, 0.000000e+00
br i1 %29, label %30, label %31
30: ; preds = %7
store i32 1, i32* %8
br label %95
31: ; preds = %7
%32 = load double, double* %9
%33 = load double, double* %17
%34 = fcmp ogt double %32, %33
br i1 %34, label %35, label %36
35: ; preds = %31
store i32 2, i32* %8
br label %95
36: ; preds = %31
store double 0xBFE5555555555556, double* %24
%37 = load double, double* %16
%38 = fmul double -2.000000e+00, %37
%39 = load double, double* %17
%40 = load double, double* %17
%41 = fmul double %39, %40
%42 = fdiv double %38, %41
store double %42, double* %25
%43 = load double, double* %25
%44 = fneg double %43
%45 = load double, double* %21
%46 = fdiv double %44, %45
store double %46, double* %26
%47 = load double, double* %16
%48 = load double, double* %9
%49 = load double, double* %17
%50 = fdiv double %48, %49
%51 = load double, double* %9
%52 = load double, double* %17
%53 = fdiv double %51, %52
%54 = fneg double %50
%55 = call double @llvm.fmuladd.f64(double %54, double %53, double 1.000000e+00)
%56 = fmul double %47, %55
%57 = load double*, double** %10
store double %56, double* %57
%58 = load double, double* %25
%59 = load double, double* %9
%60 = fmul double %58, %59
%61 = load double*, double** %11
store double %60, double* %61
%62 = load double*, double** %11
%63 = load double, double* %62
%64 = fneg double %63
%65 = load double, double* %21
%66 = fdiv double %64, %65
%67 = load double*, double** %12
store double %66, double* %67
%68 = load double, double* %19
%69 = load double*, double** %10
%70 = load double, double* %69
%71 = load double, double* %20
%72 = fsub double %70, %71
%73 = fmul double %68, %72
%74 = load double*, double** %13
store double %73, double* %74
%75 = load double, double* %23
%76 = load double*, double** %10
%77 = load double, double* %76
%78 = fmul double 2.000000e+00, %77
%79 = load double, double* %26
%80 = call i32 @fabs(double %79)
%81 = load double, double* %24
%82 = call double @pow(i32 %80, double %81)
%83 = fmul double %78, %82
%84 = load double, double* %26
%85 = fmul double %83, %84
%86 = fdiv double %75, %85
%87 = load double*, double** %14
store double %86, double* %87
%88 = load double, double* %21
%89 = fmul double %88, 9.100000e+02
%90 = fmul double %89, 9.810000e+00
%91 = load double*, double** %10
%92 = load double, double* %91
%93 = fmul double %90, %92
%94 = load double*, double** %15
store double %93, double* %94
store i32 0, i32* %8
br label %95
95: ; preds = %36, %35, %30
%96 = load i32, i32* %8
ret i32 %96
}

LLVM IR (-O2):
define i32 @exactN(double %0, double* nocapture %1, double* nocapture writeonly %2, double* nocapture writeonly %3, double* nocapture writeonly %4, double* nocapture writeonly %5, double* nocapture writeonly %6) {
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = bitcast double* %8 to i8*
%17 = bitcast double* %9 to i8*
%18 = bitcast double* %10 to i8*
%19 = bitcast double* %11 to i8*
%20 = bitcast double* %12 to i8*
%21 = bitcast double* %13 to i8*
%22 = bitcast double* %14 to i8*
%23 = bitcast double* %15 to i8*
%24 = call i32 @params_exactN(double* %8, double* %9, double* %10, double* %11, double* %12, double* %13, double* %14, double* %15)
%25 = fcmp olt double %0, 0.000000e+00
br i1 %25, label %62, label %26
26: ; preds = %7
%27 = load double, double* %9
%28 = fcmp olt double %27, %0
br i1 %28, label %62, label %29
29: ; preds = %26
%30 = load double, double* %8
%31 = fmul double %30, -2.000000e+00
%32 = fmul double %27, %27
%33 = fdiv double %31, %32
%34 = fneg double %33
%35 = load double, double* %13
%36 = fdiv double %34, %35
%37 = fdiv double %0, %27
%38 = fneg double %37
%39 = call double @llvm.fmuladd.f64(double %38, double %37, double 1.000000e+00)
%40 = fmul double %39, %30
store double %40, double* %1
%41 = fmul double %33, %0
store double %41, double* %2
%42 = fneg double %41
%43 = fdiv double %42, %35
store double %43, double* %3
%44 = load double, double* %11
%45 = load double, double* %1
%46 = load double, double* %12
%47 = fsub double %45, %46
%48 = fmul double %44, %47
store double %48, double* %4
%49 = load double, double* %15
%50 = load double, double* %1
%51 = fmul double %50, 2.000000e+00
%52 = call i32 @fabs(double %36)
%53 = call double @pow(i32 %52, double 0xBFE5555555555556)
%54 = fmul double %51, %53
%55 = fmul double %36, %54
%56 = fdiv double %49, %55
store double %56, double* %5
%57 = load double, double* %13
%58 = fmul double %57, 9.100000e+02
%59 = fmul double %58, 9.810000e+00
%60 = load double, double* %1
%61 = fmul double %60, %59
store double %61, double* %6
br label %62
62: ; preds = %26, %7, %29
%63 = phi i32 [ 0, %29 ], [ 1, %7 ], [ 2, %26 ]
ret i32 %63
}