#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 LinearAD_SteadyState(int *, double *, int, double, double *, double *);
double df(double, double, double, int, int);
double f(double, double, double, int, int);
double fabs(double);
double log(double);
int /*<<< orphan*/ printf(char *, ...);
double sqrt(double);
double tanh(double);
double uOfX_df(double, double);
double uOfX_f(double, double, double, double, double, double);
int NonlinearAD_SteadyState(int *iwork, double *rwork, int nPoints, double t,
                            double *X, double *u) {
  int i, iret = 0;
  int q = iwork[0], r = iwork[1];
  double b = rwork[0], a = rwork[1];
  double x, lu, f0, ff, fC;
  double C, rtmC = 0.0, Ctmp, dC, nlC = 0.0, nlD = 0.0;
  if (q == 2 && r == 1) {
    if (b != 0.0) {
      printf("Solving for sqrt(-C) for q=2, r=1\n");
      rtmC = sqrt(1.5);
      while (fabs(f(rtmC, b, a, q, r)) > 1.0E-8) {
        rtmC -= (f(rtmC, b, a, q, r) / df(rtmC, b, a, q, r));
      }
      printf("sqrt(-C)= %lf \n", rtmC);
    }
  } else if (q == 1 && r == 2) {
    printf("\nSolving for C in q=1,r=2\n");
    C = 1.0 + 1.0E-10;
    f0 = f(C, b, a, q, r);
    printf("f0 = %lf\n", f0);
    while (fabs(f(C, b, a, q, r)) > (1.0E-7 * fabs(f0) + 1.0E-7)) {
      dC = -f(C, b, a, q, r) / df(C, b, a, q, r);
      printf("dc = %lf\n", dC);
      Ctmp = C + dC;
      while ((fabs(ff = f(Ctmp, b, a, q, r)) >
              0.99 * fabs(fC = f(C, b, a, q, r))) ||
             (Ctmp <= 1.0)) {
        printf("f(%lf) = %lf\n", Ctmp, ff);
        printf("f(%lf) = %lf\n", C, fC);
        printf("ls\n");
        dC *= 0.9;
        Ctmp = C + dC;
      }
      printf("out\n");
      printf("%lf \n", Ctmp);
      printf(" f(%lf) = %lf\n", Ctmp, f(Ctmp, b, a, q, r));
      printf("df(%lf) = %lf\n", Ctmp, df(Ctmp, b, a, q, r));
      C = Ctmp;
    }
    printf("C = %lf\n", C);
    nlC = C;
    nlD = 0.5 * (2.0 * C * log(C * (C - 1)) - 4.0 * C + 2.0 - b / a);
    printf("D = %lf\n", nlD);
  } else {
    printf("q,r not implemented\n");
    return 0;
  }
  if (q == 1 && r == 2) {
    iret = LinearAD_SteadyState(iwork, rwork, nPoints, t, X, u);
  }
  for (i = 0; i < nPoints; i++) {
    x = X[i * 3 + 0];
    if (q == 2 && r == 1) {
      if (b != 0.0) {
        u[i] = rtmC * tanh((-b * rtmC / a) * (x - 1.0));
      } else {
        u[i] = 1.0 - x;
      }
    } else if (q == 1 && r == 2) {
      lu = u[i];
      f0 = uOfX_f(a, b, nlC, nlD, x, lu);
      while (fabs(uOfX_f(a, b, nlC, nlD, x, lu)) >
             (1.0E-6 * fabs(f0) + 1.0E-6)) {
        lu -= uOfX_f(a, b, nlC, nlD, x, lu) / uOfX_df(nlC, lu);
      }
      u[i] = lu;
    } else {
      printf("q,r not implemented");
    }
  }
  return iret;
}


x86 assembly (clang, -O0):
<NonlinearAD_SteadyState>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movsd  %xmm0,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %r8,-0x38(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
cmpl   $0x2,-0x44(%rbp)
jne    1319 <NonlinearAD_SteadyState+0x189>
cmpl   $0x1,-0x48(%rbp)
jne    1319 <NonlinearAD_SteadyState+0x189>
movsd  -0x50(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    123a <NonlinearAD_SteadyState+0xaa>
jp     123a <NonlinearAD_SteadyState+0xaa>
jmp    1314 <NonlinearAD_SteadyState+0x184>
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movsd  0xdf0(%rip),%xmm0
call   10a0 <sqrt@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0x50(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
mov    -0x44(%rbp),%edi
mov    -0x48(%rbp),%esi
call   1050 <f@plt>
movaps 0xddf(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xdbb(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12fe <NonlinearAD_SteadyState+0x16e>
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0x50(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
mov    -0x44(%rbp),%edi
mov    -0x48(%rbp),%esi
call   1050 <f@plt>
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0x50(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
mov    -0x44(%rbp),%edi
mov    -0x48(%rbp),%esi
call   10b0 <df@plt>
movsd  -0xb8(%rbp),%xmm1
ff
divsd  %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
jmp    125d <NonlinearAD_SteadyState+0xcd>
movsd  -0x90(%rbp),%xmm0
ff
lea    0xd86(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
jmp    176a <NonlinearAD_SteadyState+0x5da>
cmpl   $0x1,-0x44(%rbp)
jne    174b <NonlinearAD_SteadyState+0x5bb>
cmpl   $0x2,-0x48(%rbp)
jne    174b <NonlinearAD_SteadyState+0x5bb>
lea    0xd6f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movsd  0xcbd(%rip),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x50(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
mov    -0x44(%rbp),%edi
mov    -0x48(%rbp),%esi
call   1050 <f@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
lea    0xd45(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x50(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
mov    -0x44(%rbp),%edi
mov    -0x48(%rbp),%esi
call   1050 <f@plt>
movaps 0xcbc(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  -0x70(%rbp),%xmm1
movaps 0xcac(%rip),%xmm2
pand   %xmm2,%xmm1
movsd  0xc48(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    1665 <NonlinearAD_SteadyState+0x4d5>
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x50(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
mov    -0x44(%rbp),%edi
mov    -0x48(%rbp),%esi
call   1050 <f@plt>
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x50(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
mov    -0x44(%rbp),%edi
mov    -0x48(%rbp),%esi
call   10b0 <df@plt>
movaps %xmm0,%xmm1
movsd  -0xc0(%rbp),%xmm0
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
lea    0xc77(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  -0x88(%rbp),%xmm0
ff
addsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
movsd  -0x50(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
mov    -0x44(%rbp),%edi
mov    -0x48(%rbp),%esi
call   1050 <f@plt>
movsd  %xmm0,-0x78(%rbp)
movaps 0xbc7(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x50(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
mov    -0x44(%rbp),%edi
mov    -0x48(%rbp),%esi
call   1050 <f@plt>
movaps %xmm0,%xmm2
movsd  -0xd0(%rbp),%xmm0
ff
movsd  %xmm2,-0x80(%rbp)
movaps 0xb87(%rip),%xmm1
pand   %xmm1,%xmm2
movsd  0xb4b(%rip),%xmm1
mulsd  %xmm2,%xmm1
mov    $0x1,%al
ucomisd %xmm1,%xmm0
mov    %al,-0xc1(%rbp)
ja     1514 <NonlinearAD_SteadyState+0x384>
movsd  0xb25(%rip),%xmm0
ucomisd -0x98(%rbp),%xmm0
ff
setae  %al
mov    %al,-0xc1(%rbp)
mov    -0xc1(%rbp),%al
test   $0x1,%al
jne    1527 <NonlinearAD_SteadyState+0x397>
jmp    15a0 <NonlinearAD_SteadyState+0x410>
movsd  -0x98(%rbp),%xmm0
ff
movsd  -0x78(%rbp),%xmm1
lea    0xba1(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x80(%rbp),%xmm1
lea    0xb86(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
lea    0xb6e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movsd  0xac5(%rip),%xmm0
mulsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
addsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
jmp    1470 <NonlinearAD_SteadyState+0x2e0>
lea    0xb2f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movsd  -0x98(%rbp),%xmm0
ff
lea    0xae0(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
movsd  -0x50(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
mov    -0x44(%rbp),%edi
mov    -0x48(%rbp),%esi
call   1050 <f@plt>
movaps %xmm0,%xmm1
movsd  -0xe0(%rbp),%xmm0
ff
lea    0xad8(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
movsd  -0x50(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
mov    -0x44(%rbp),%edi
mov    -0x48(%rbp),%esi
call   10b0 <df@plt>
movaps %xmm0,%xmm1
movsd  -0xd8(%rbp),%xmm0
ff
lea    0xaa1(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
jmp    1380 <NonlinearAD_SteadyState+0x1f0>
movsd  -0x88(%rbp),%xmm0
ff
lea    0xa85(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  0x985(%rip),%xmm0
mulsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0xe8(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x88(%rbp),%xmm1
ff
movsd  0x96d(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
call   1090 <log@plt>
movsd  -0xe8(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  0x945(%rip),%xmm0
mulsd  -0x88(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0x90e(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
divsd  -0x58(%rbp),%xmm0
subsd  %xmm0,%xmm1
movsd  0x8ec(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
lea    0x9c3(%rip),%rdi
mov    $0x1,%al
call   1060 <printf@plt>
jmp    1765 <NonlinearAD_SteadyState+0x5d5>
lea    0x9b9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    19e4 <NonlinearAD_SteadyState+0x854>
jmp    176a <NonlinearAD_SteadyState+0x5da>
cmpl   $0x1,-0x44(%rbp)
jne    179e <NonlinearAD_SteadyState+0x60e>
cmpl   $0x2,-0x48(%rbp)
jne    179e <NonlinearAD_SteadyState+0x60e>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
movsd  -0x28(%rbp),%xmm0
mov    -0x30(%rbp),%rcx
mov    -0x38(%rbp),%r8
call   1080 <LinearAD_SteadyState@plt>
mov    %eax,-0x40(%rbp)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    19de <NonlinearAD_SteadyState+0x84e>
mov    -0x30(%rbp),%rax
imul   $0x3,-0x3c(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
cmpl   $0x2,-0x44(%rbp)
jne    188d <NonlinearAD_SteadyState+0x6fd>
cmpl   $0x1,-0x48(%rbp)
jne    188d <NonlinearAD_SteadyState+0x6fd>
movsd  -0x50(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    17fa <NonlinearAD_SteadyState+0x66a>
jp     17fa <NonlinearAD_SteadyState+0x66a>
jmp    186e <NonlinearAD_SteadyState+0x6de>
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0xf0(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x90(%rbp),%xmm0
ff
divsd  -0x58(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
movsd  0x7e8(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
call   1040 <tanh@plt>
movaps %xmm0,%xmm1
movsd  -0xf0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    1888 <NonlinearAD_SteadyState+0x6f8>
movsd  0x7b2(%rip),%xmm0
subsd  -0x60(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    19cb <NonlinearAD_SteadyState+0x83b>
cmpl   $0x1,-0x44(%rbp)
jne    19b8 <NonlinearAD_SteadyState+0x828>
cmpl   $0x2,-0x48(%rbp)
jne    19b8 <NonlinearAD_SteadyState+0x828>
mov    -0x38(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
movsd  -0xa8(%rbp),%xmm2
ff
movsd  -0xb0(%rbp),%xmm3
ff
movsd  -0x60(%rbp),%xmm4
movsd  -0x68(%rbp),%xmm5
call   1070 <uOfX_f@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
movsd  -0xa8(%rbp),%xmm2
ff
movsd  -0xb0(%rbp),%xmm3
ff
movsd  -0x60(%rbp),%xmm4
movsd  -0x68(%rbp),%xmm5
call   1070 <uOfX_f@plt>
movaps 0x74f(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  -0x70(%rbp),%xmm1
movaps 0x73f(%rip),%xmm2
pand   %xmm2,%xmm1
movsd  0x723(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jbe    19a1 <NonlinearAD_SteadyState+0x811>
movsd  -0x58(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
movsd  -0xa8(%rbp),%xmm2
ff
movsd  -0xb0(%rbp),%xmm3
ff
movsd  -0x60(%rbp),%xmm4
movsd  -0x68(%rbp),%xmm5
call   1070 <uOfX_f@plt>
movsd  %xmm0,-0xf8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
movsd  -0x68(%rbp),%xmm1
call   1030 <uOfX_df@plt>
movsd  -0xf8(%rbp),%xmm1
ff
divsd  %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    18e1 <NonlinearAD_SteadyState+0x751>
movsd  -0x68(%rbp),%xmm0
mov    -0x38(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    19c6 <NonlinearAD_SteadyState+0x836>
lea    0x761(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    19cb <NonlinearAD_SteadyState+0x83b>
jmp    19d0 <NonlinearAD_SteadyState+0x840>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    17a5 <NonlinearAD_SteadyState+0x615>
mov    -0x40(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<NonlinearAD_SteadyState>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
mov    %r8,%r14
mov    %rcx,%rbx
mov    %edx,%r15d
mov    %rsi,%r12
mov    (%rdi),%esi
mov    0x4(%rdi),%edx
movsd  (%r12),%xmm2
movsd  0x8(%r12),%xmm4
mov    %esi,%eax
xor    $0x2,%eax
mov    %edx,%ecx
xor    $0x1,%ecx
or     %eax,%ecx
sete   %r13b
movapd %xmm2,0x20(%rsp)
movsd  %xmm4,(%rsp)
jne    132a <NonlinearAD_SteadyState+0x19a>
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm2
jne    11f0 <NonlinearAD_SteadyState+0x60>
jnp    1779 <NonlinearAD_SteadyState+0x5e9>
mov    %esi,%ebp
mov    %edx,0xa0(%rsp)
mov    %rdi,0x58(%rsp)
movsd  %xmm0,0x60(%rsp)
lea    0xf0e(%rip),%rdi
call   1040 <puts@plt>
movsd  0xe30(%rip),%xmm0
movaps 0x20(%rsp),%xmm1
movsd  (%rsp),%xmm2
mov    $0x2,%edi
mov    $0x1,%esi
call   1060 <f@plt>
movsd  0xe0f(%rip),%xmm1
andpd  0xe2f(%rip),%xmm0
ucomisd 0xe07(%rip),%xmm0
jbe    12fd <NonlinearAD_SteadyState+0x16d>
movsd  0xdf1(%rip),%xmm1
nopw   0x0(%rax,%rax,1)
movsd  %xmm1,0x38(%rsp)
movapd %xmm1,%xmm0
movaps 0x20(%rsp),%xmm1
movsd  (%rsp),%xmm2
mov    $0x2,%edi
mov    $0x1,%esi
call   1060 <f@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x38(%rsp),%xmm0
movaps 0x20(%rsp),%xmm1
movsd  (%rsp),%xmm2
mov    $0x2,%edi
mov    $0x1,%esi
call   10b0 <df@plt>
movsd  0x10(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  0x38(%rsp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x38(%rsp)
movsd  0x38(%rsp),%xmm0
movaps 0x20(%rsp),%xmm1
movsd  (%rsp),%xmm2
mov    $0x2,%edi
mov    $0x1,%esi
call   1060 <f@plt>
movsd  0x38(%rsp),%xmm1
andpd  0xd81(%rip),%xmm0
ucomisd 0xd59(%rip),%xmm0
ja     1260 <NonlinearAD_SteadyState+0xd0>
lea    0xd8c(%rip),%rdi
movsd  %xmm1,0x38(%rsp)
movapd %xmm1,%xmm0
mov    $0x1,%al
call   1070 <printf@plt>
xorpd  %xmm1,%xmm1
xorpd  %xmm2,%xmm2
movsd  0x60(%rsp),%xmm0
mov    %ebp,%eax
jmp    1717 <NonlinearAD_SteadyState+0x587>
cmp    $0x1,%esi
jne    1766 <NonlinearAD_SteadyState+0x5d6>
cmp    $0x2,%edx
jne    1766 <NonlinearAD_SteadyState+0x5d6>
mov    %esi,0x78(%rsp)
mov    %edx,0xa0(%rsp)
mov    %rdi,0x58(%rsp)
mov    %r12,0xb0(%rsp)
movsd  %xmm0,0x60(%rsp)
mov    %r15d,0x7c(%rsp)
lea    0xd92(%rip),%rdi
call   1040 <puts@plt>
movsd  0xc8d(%rip),%xmm0
movaps 0x20(%rsp),%xmm1
movsd  (%rsp),%xmm2
mov    $0x1,%edi
mov    $0x2,%esi
call   1060 <f@plt>
movaps %xmm0,0x80(%rsp)
lea    0xd05(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
movsd  0xc56(%rip),%xmm0
movaps 0x20(%rsp),%xmm1
movsd  (%rsp),%xmm2
mov    $0x1,%edi
mov    $0x2,%esi
call   1060 <f@plt>
movsd  0xc35(%rip),%xmm2
movapd 0xc9d(%rip),%xmm1
andpd  %xmm1,%xmm0
movapd 0x80(%rsp),%xmm3
andpd  %xmm1,%xmm3
movsd  0xc1c(%rip),%xmm1
mulsd  %xmm1,%xmm3
addsd  %xmm1,%xmm3
movapd %xmm3,0x80(%rsp)
ucomisd %xmm3,%xmm0
jbe    165e <NonlinearAD_SteadyState+0x4ce>
movsd  0xbf1(%rip),%xmm0
lea    0xc9f(%rip),%r15
lea    0xcf9(%rip),%r12
lea    0xc9f(%rip),%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
movaps 0x20(%rsp),%xmm1
movsd  (%rsp),%xmm2
mov    $0x1,%edi
mov    $0x2,%esi
call   1060 <f@plt>
xorps  0xc24(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movsd  0x8(%rsp),%xmm0
movaps 0x20(%rsp),%xmm1
movsd  (%rsp),%xmm2
mov    $0x1,%edi
mov    $0x2,%esi
call   10b0 <df@plt>
movapd 0x40(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,0x40(%rsp)
lea    0xc13(%rip),%rdi
movapd %xmm1,%xmm0
mov    $0x1,%al
call   1070 <printf@plt>
movapd 0x40(%rsp),%xmm1
movsd  0x8(%rsp),%xmm0
jmp    14f9 <NonlinearAD_SteadyState+0x369>
mov    %r15,%rdi
movapd %xmm2,%xmm0
movapd %xmm4,%xmm1
mov    $0x2,%al
movapd %xmm5,0x10(%rsp)
call   1070 <printf@plt>
mov    %r15,%rdi
movsd  0x8(%rsp),%xmm0
movaps 0x10(%rsp),%xmm1
mov    $0x2,%al
call   1070 <printf@plt>
mov    %r12,%rdi
call   1040 <puts@plt>
movsd  0x8(%rsp),%xmm0
movapd 0x40(%rsp),%xmm1
mulsd  0xb47(%rip),%xmm1
movapd %xmm1,0x40(%rsp)
addsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
movaps 0x20(%rsp),%xmm1
movsd  (%rsp),%xmm2
mov    $0x1,%edi
mov    $0x2,%esi
call   1060 <f@plt>
movapd %xmm0,0x90(%rsp)
movsd  0x8(%rsp),%xmm0
movaps 0x20(%rsp),%xmm1
movsd  (%rsp),%xmm2
mov    $0x1,%edi
mov    $0x2,%esi
call   1060 <f@plt>
movapd 0x90(%rsp),%xmm4
movsd  0x10(%rsp),%xmm2
movapd %xmm0,%xmm5
movapd 0xb0b(%rip),%xmm3
andpd  %xmm3,%xmm0
mulsd  0xa9f(%rip),%xmm0
movsd  0xa9f(%rip),%xmm1
ucomisd %xmm2,%xmm1
jae    14b0 <NonlinearAD_SteadyState+0x320>
movapd %xmm4,%xmm1
andpd  %xmm3,%xmm1
ucomisd %xmm0,%xmm1
ja     14b0 <NonlinearAD_SteadyState+0x320>
lea    0xb76(%rip),%rdi
call   1040 <puts@plt>
lea    0xaf2(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x1,%al
call   1070 <printf@plt>
movsd  0x10(%rsp),%xmm0
movaps 0x20(%rsp),%xmm1
movsd  (%rsp),%xmm2
mov    $0x1,%edi
mov    $0x2,%esi
call   1060 <f@plt>
movaps %xmm0,%xmm1
lea    0xad6(%rip),%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x2,%al
call   1070 <printf@plt>
movsd  0x10(%rsp),%xmm0
movaps 0x20(%rsp),%xmm1
movsd  (%rsp),%xmm2
mov    $0x1,%edi
mov    $0x2,%esi
call   10b0 <df@plt>
movaps %xmm0,%xmm1
mov    %rbp,%rdi
movsd  0x10(%rsp),%xmm0
mov    $0x2,%al
call   1070 <printf@plt>
movsd  0x10(%rsp),%xmm0
movapd 0x20(%rsp),%xmm1
movsd  (%rsp),%xmm2
mov    $0x1,%edi
mov    $0x2,%esi
call   1060 <f@plt>
movsd  0x10(%rsp),%xmm2
andpd  0xa25(%rip),%xmm0
ucomisd 0x80(%rsp),%xmm0
movapd %xmm2,%xmm0
ja     1430 <NonlinearAD_SteadyState+0x2a0>
movsd  %xmm2,0x10(%rsp)
lea    0xa67(%rip),%rdi
movapd %xmm2,%xmm0
mov    $0x1,%al
call   1070 <printf@plt>
movsd  0x10(%rsp),%xmm0
addsd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x992(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
call   10a0 <log@plt>
movsd  0x981(%rip),%xmm1
mulsd  0x10(%rsp),%xmm1
mulsd  0x8(%rsp),%xmm0
addsd  %xmm1,%xmm0
addsd  0x971(%rip),%xmm0
movapd 0x20(%rsp),%xmm1
divsd  (%rsp),%xmm1
subsd  %xmm1,%xmm0
mulsd  0x962(%rip),%xmm0
movsd  %xmm0,0x40(%rsp)
lea    0x9f8(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
movsd  0x40(%rsp),%xmm2
movsd  0x10(%rsp),%xmm1
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x38(%rsp)
mov    0x7c(%rsp),%r15d
movsd  0x60(%rsp),%xmm0
mov    0xb0(%rsp),%r12
mov    0x78(%rsp),%eax
xor    %ebp,%ebp
cmp    $0x1,%eax
movsd  %xmm1,0x10(%rsp)
movsd  %xmm2,0x40(%rsp)
jne    174f <NonlinearAD_SteadyState+0x5bf>
cmpl   $0x2,0xa0(%rsp)
02
jne    174f <NonlinearAD_SteadyState+0x5bf>
mov    0x58(%rsp),%rdi
mov    %r12,%rsi
mov    %r15d,%edx
mov    %rbx,%rcx
mov    %r14,%r8
call   1090 <LinearAD_SteadyState@plt>
mov    $0x1,%bpl
jmp    1751 <NonlinearAD_SteadyState+0x5c1>
xor    %eax,%eax
movapd 0x20(%rsp),%xmm2
movsd  (%rsp),%xmm4
test   %r15d,%r15d
jg     17a4 <NonlinearAD_SteadyState+0x614>
jmp    19c6 <NonlinearAD_SteadyState+0x836>
lea    0x977(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
jmp    19c6 <NonlinearAD_SteadyState+0x836>
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x40(%rsp)
xor    %ebp,%ebp
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x38(%rsp)
xor    %eax,%eax
test   %r15d,%r15d
jle    19c6 <NonlinearAD_SteadyState+0x836>
mov    %eax,0x58(%rsp)
movapd 0x8d0(%rip),%xmm0
xorpd  %xmm2,%xmm0
mulsd  0x38(%rsp),%xmm0
divsd  %xmm4,%xmm0
movapd %xmm0,0xa0(%rsp)
mov    %r15d,%r15d
xor    %r12d,%r12d
jmp    17f6 <NonlinearAD_SteadyState+0x666>
nop
lea    0x90d(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
movsd  (%rsp),%xmm4
add    $0x1,%r12
cmp    %r15,%r12
movapd 0x20(%rsp),%xmm2
je     19c2 <NonlinearAD_SteadyState+0x832>
lea    (%r12,%r12,2),%rax
movsd  (%rbx,%rax,8),%xmm6
test   %r13b,%r13b
je     1850 <NonlinearAD_SteadyState+0x6c0>
ucomisd 0x854(%rip),%xmm2
jne    1814 <NonlinearAD_SteadyState+0x684>
jnp    19ab <NonlinearAD_SteadyState+0x81b>
addsd  0x804(%rip),%xmm6
mulsd  0xa0(%rsp),%xmm6
movapd %xmm6,%xmm0
call   1050 <tanh@plt>
movsd  (%rsp),%xmm4
mulsd  0x38(%rsp),%xmm0
movsd  %xmm0,(%r14,%r12,8)
jmp    17e3 <NonlinearAD_SteadyState+0x653>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
test   %bpl,%bpl
je     17d0 <NonlinearAD_SteadyState+0x640>
movsd  (%r14,%r12,8),%xmm5
movsd  %xmm5,0x8(%rsp)
movapd %xmm4,%xmm0
movaps 0x20(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
movsd  %xmm6,0x90(%rsp)
movsd  0x40(%rsp),%xmm3
movapd %xmm6,%xmm4
call   1080 <uOfX_f@plt>
movapd %xmm0,0x60(%rsp)
movsd  (%rsp),%xmm0
movaps 0x20(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
movsd  0x40(%rsp),%xmm3
movsd  0x90(%rsp),%xmm4
movsd  0x8(%rsp),%xmm5
call   1080 <uOfX_f@plt>
movapd 0x7ac(%rip),%xmm1
andpd  %xmm1,%xmm0
movapd 0x60(%rsp),%xmm2
andpd  %xmm1,%xmm2
movsd  0x77e(%rip),%xmm1
mulsd  %xmm1,%xmm2
addsd  %xmm1,%xmm2
ucomisd %xmm2,%xmm0
jbe    199a <NonlinearAD_SteadyState+0x80a>
movapd %xmm2,%xmm0
movapd %xmm2,0x60(%rsp)
cs nopw 0x0(%rax,%rax,1)
movsd  (%rsp),%xmm0
movaps 0x20(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
movsd  0x40(%rsp),%xmm3
movsd  0x90(%rsp),%xmm4
movsd  0x8(%rsp),%xmm5
call   1080 <uOfX_f@plt>
movsd  %xmm0,0x80(%rsp)
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1030 <uOfX_df@plt>
movsd  0x80(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm5
subsd  %xmm1,%xmm5
movsd  (%rsp),%xmm0
movapd 0x20(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
movsd  0x40(%rsp),%xmm3
movsd  0x90(%rsp),%xmm4
movsd  %xmm5,0x8(%rsp)
call   1080 <uOfX_f@plt>
andpd  0x6e2(%rip),%xmm0
ucomisd 0x60(%rsp),%xmm0
ja     1900 <NonlinearAD_SteadyState+0x770>
movsd  0x8(%rsp),%xmm0
movsd  %xmm0,(%r14,%r12,8)
jmp    17de <NonlinearAD_SteadyState+0x64e>
movsd  0x665(%rip),%xmm0
subsd  %xmm6,%xmm0
movsd  %xmm0,(%r14,%r12,8)
jmp    17e3 <NonlinearAD_SteadyState+0x653>
mov    0x58(%rsp),%eax
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [35 x i8] c"Solving for sqrt(-C) for q=2, r=1\0A\00"
@.str.1 = [16 x i8] c"sqrt(-C)= %lf \0A\00"
@.str.2 = [27 x i8] c"\0ASolving for C in q=1,r=2\0A\00"
@.str.3 = [10 x i8] c"f0 = %lf\0A\00"
@.str.4 = [10 x i8] c"dc = %lf\0A\00"
@.str.5 = [14 x i8] c"f(%lf) = %lf\0A\00"
@.str.6 = [4 x i8] c"ls\0A\00"
@.str.7 = [5 x i8] c"out\0A\00"
@.str.8 = [6 x i8] c"%lf \0A\00"
@.str.9 = [15 x i8] c" f(%lf) = %lf\0A\00"
@.str.10 = [15 x i8] c"df(%lf) = %lf\0A\00"
@.str.11 = [9 x i8] c"C = %lf\0A\00"
@.str.12 = [9 x i8] c"D = %lf\0A\00"
@.str.13 = [21 x i8] c"q,r not implemented\0A\00"
@.str.14 = [20 x i8] c"q,r not implemented\00"
define i32 @NonlinearAD_SteadyState(i32* %0, double* %1, i32 %2, double %3, double* %4, double* %5) {
%7 = alloca i32
%8 = alloca i32*
%9 = alloca double*
%10 = alloca i32
%11 = alloca double
%12 = alloca double*
%13 = alloca double*
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%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
%27 = alloca double
%28 = alloca double
%29 = alloca double
%30 = alloca double
store i32* %0, i32** %8
store double* %1, double** %9
store i32 %2, i32* %10
store double %3, double* %11
store double* %4, double** %12
store double* %5, double** %13
store i32 0, i32* %15
%31 = load i32*, i32** %8
%32 = getelementptr inbounds i32, i32* %31, i64 0
%33 = load i32, i32* %32
store i32 %33, i32* %16
%34 = load i32*, i32** %8
%35 = getelementptr inbounds i32, i32* %34, i64 1
%36 = load i32, i32* %35
store i32 %36, i32* %17
%37 = load double*, double** %9
%38 = getelementptr inbounds double, double* %37, i64 0
%39 = load double, double* %38
store double %39, double* %18
%40 = load double*, double** %9
%41 = getelementptr inbounds double, double* %40, i64 1
%42 = load double, double* %41
store double %42, double* %19
store double 0.000000e+00, double* %26
store double 0.000000e+00, double* %29
store double 0.000000e+00, double* %30
%43 = load i32, i32* %16
%44 = icmp eq i32 %43, 2
br i1 %44, label %45, label %83
45: ; preds = %6
%46 = load i32, i32* %17
%47 = icmp eq i32 %46, 1
br i1 %47, label %48, label %83
48: ; preds = %45
%49 = load double, double* %18
%50 = fcmp une double %49, 0.000000e+00
br i1 %50, label %51, label %82
51: ; preds = %48
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%53 = call double @sqrt(double 1.500000e+00)
store double %53, double* %26
br label %54
54: ; preds = %63, %51
%55 = load double, double* %26
%56 = load double, double* %18
%57 = load double, double* %19
%58 = load i32, i32* %16
%59 = load i32, i32* %17
%60 = call double @f(double %55, double %56, double %57, i32 %58, i32 %59)
%61 = call double @llvm.fabs.f64(double %60)
%62 = fcmp ogt double %61, 1.000000e-08
br i1 %62, label %63, label %79
63: ; preds = %54
%64 = load double, double* %26
%65 = load double, double* %18
%66 = load double, double* %19
%67 = load i32, i32* %16
%68 = load i32, i32* %17
%69 = call double @f(double %64, double %65, double %66, i32 %67, i32 %68)
%70 = load double, double* %26
%71 = load double, double* %18
%72 = load double, double* %19
%73 = load i32, i32* %16
%74 = load i32, i32* %17
%75 = call double @df(double %70, double %71, double %72, i32 %73, i32 %74)
%76 = fdiv double %69, %75
%77 = load double, double* %26
%78 = fsub double %77, %76
store double %78, double* %26
br label %54
79: ; preds = %54
%80 = load double, double* %26
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double %80)
br label %82
82: ; preds = %79, %48
br label %213
83: ; preds = %45, %6
%84 = load i32, i32* %16
%85 = icmp eq i32 %84, 1
br i1 %85, label %86, label %210
86: ; preds = %83
%87 = load i32, i32* %17
%88 = icmp eq i32 %87, 2
br i1 %88, label %89, label %210
89: ; preds = %86
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
store double 0x3FF000000006DF38, double* %25
%91 = load double, double* %25
%92 = load double, double* %18
%93 = load double, double* %19
%94 = load i32, i32* %16
%95 = load i32, i32* %17
%96 = call double @f(double %91, double %92, double %93, i32 %94, i32 %95)
store double %96, double* %22
%97 = load double, double* %22
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), double %97)
br label %99
99: ; preds = %166, %89
%100 = load double, double* %25
%101 = load double, double* %18
%102 = load double, double* %19
%103 = load i32, i32* %16
%104 = load i32, i32* %17
%105 = call double @f(double %100, double %101, double %102, i32 %103, i32 %104)
%106 = call double @llvm.fabs.f64(double %105)
%107 = load double, double* %22
%108 = call double @llvm.fabs.f64(double %107)
%109 = call double @llvm.fmuladd.f64(double 0x3E7AD7F29ABCAF48, double %108, double 0x3E7AD7F29ABCAF48)
%110 = fcmp ogt double %106, %109
br i1 %110, label %111, label %187
111: ; preds = %99
%112 = load double, double* %25
%113 = load double, double* %18
%114 = load double, double* %19
%115 = load i32, i32* %16
%116 = load i32, i32* %17
%117 = call double @f(double %112, double %113, double %114, i32 %115, i32 %116)
%118 = fneg double %117
%119 = load double, double* %25
%120 = load double, double* %18
%121 = load double, double* %19
%122 = load i32, i32* %16
%123 = load i32, i32* %17
%124 = call double @df(double %119, double %120, double %121, i32 %122, i32 %123)
%125 = fdiv double %118, %124
store double %125, double* %28
%126 = load double, double* %28
%127 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), double %126)
%128 = load double, double* %25
%129 = load double, double* %28
%130 = fadd double %128, %129
store double %130, double* %27
br label %131
131: ; preds = %153, %111
%132 = load double, double* %27
%133 = load double, double* %18
%134 = load double, double* %19
%135 = load i32, i32* %16
%136 = load i32, i32* %17
%137 = call double @f(double %132, double %133, double %134, i32 %135, i32 %136)
store double %137, double* %23
%138 = call double @llvm.fabs.f64(double %137)
%139 = load double, double* %25
%140 = load double, double* %18
%141 = load double, double* %19
%142 = load i32, i32* %16
%143 = load i32, i32* %17
%144 = call double @f(double %139, double %140, double %141, i32 %142, i32 %143)
store double %144, double* %24
%145 = call double @llvm.fabs.f64(double %144)
%146 = fmul double 0x3FEFAE147AE147AE, %145
%147 = fcmp ogt double %138, %146
br i1 %147, label %151, label %148
148: ; preds = %131
%149 = load double, double* %27
%150 = fcmp ole double %149, 1.000000e+00
br label %151
151: ; preds = %148, %131
%152 = phi i1 [ true, %131 ], [ %150, %148 ]
br i1 %152, label %153, label %166
153: ; preds = %151
%154 = load double, double* %27
%155 = load double, double* %23
%156 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), double %154, double %155)
%157 = load double, double* %25
%158 = load double, double* %24
%159 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), double %157, double %158)
%160 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%161 = load double, double* %28
%162 = fmul double %161, 9.000000e-01
store double %162, double* %28
%163 = load double, double* %25
%164 = load double, double* %28
%165 = fadd double %163, %164
store double %165, double* %27
br label %131
166: ; preds = %151
%167 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%168 = load double, double* %27
%169 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), double %168)
%170 = load double, double* %27
%171 = load double, double* %27
%172 = load double, double* %18
%173 = load double, double* %19
%174 = load i32, i32* %16
%175 = load i32, i32* %17
%176 = call double @f(double %171, double %172, double %173, i32 %174, i32 %175)
%177 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), double %170, double %176)
%178 = load double, double* %27
%179 = load double, double* %27
%180 = load double, double* %18
%181 = load double, double* %19
%182 = load i32, i32* %16
%183 = load i32, i32* %17
%184 = call double @df(double %179, double %180, double %181, i32 %182, i32 %183)
%185 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), double %178, double %184)
%186 = load double, double* %27
store double %186, double* %25
br label %99
187: ; preds = %99
%188 = load double, double* %25
%189 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), double %188)
%190 = load double, double* %25
store double %190, double* %29
%191 = load double, double* %25
%192 = fmul double 2.000000e+00, %191
%193 = load double, double* %25
%194 = load double, double* %25
%195 = fsub double %194, 1.000000e+00
%196 = fmul double %193, %195
%197 = call double @log(double %196)
%198 = load double, double* %25
%199 = fmul double 4.000000e+00, %198
%200 = fneg double %199
%201 = call double @llvm.fmuladd.f64(double %192, double %197, double %200)
%202 = fadd double %201, 2.000000e+00
%203 = load double, double* %18
%204 = load double, double* %19
%205 = fdiv double %203, %204
%206 = fsub double %202, %205
%207 = fmul double 5.000000e-01, %206
store double %207, double* %30
%208 = load double, double* %30
%209 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0), double %208)
br label %212
210: ; preds = %86, %83
%211 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0))
store i32 0, i32* %7
br label %334
212: ; preds = %187
br label %213
213: ; preds = %212, %82
%214 = load i32, i32* %16
%215 = icmp eq i32 %214, 1
br i1 %215, label %216, label %227
216: ; preds = %213
%217 = load i32, i32* %17
%218 = icmp eq i32 %217, 2
br i1 %218, label %219, label %227
219: ; preds = %216
%220 = load i32*, i32** %8
%221 = load double*, double** %9
%222 = load i32, i32* %10
%223 = load double, double* %11
%224 = load double*, double** %12
%225 = load double*, double** %13
%226 = call i32 @LinearAD_SteadyState(i32* %220, double* %221, i32 %222, double %223, double* %224, double* %225)
store i32 %226, i32* %15
br label %227
227: ; preds = %219, %216, %213
store i32 0, i32* %14
br label %228
228: ; preds = %329, %227
%229 = load i32, i32* %14
%230 = load i32, i32* %10
%231 = icmp slt i32 %229, %230
br i1 %231, label %232, label %332
232: ; preds = %228
%233 = load double*, double** %12
%234 = load i32, i32* %14
%235 = mul nsw i32 %234, 3
%236 = add nsw i32 %235, 0
%237 = sext i32 %236 to i64
%238 = getelementptr inbounds double, double* %233, i64 %237
%239 = load double, double* %238
store double %239, double* %20
%240 = load i32, i32* %16
%241 = icmp eq i32 %240, 2
br i1 %241, label %242, label %273
242: ; preds = %232
%243 = load i32, i32* %17
%244 = icmp eq i32 %243, 1
br i1 %244, label %245, label %273
245: ; preds = %242
%246 = load double, double* %18
%247 = fcmp une double %246, 0.000000e+00
br i1 %247, label %248, label %265
248: ; preds = %245
%249 = load double, double* %26
%250 = load double, double* %18
%251 = fneg double %250
%252 = load double, double* %26
%253 = fmul double %251, %252
%254 = load double, double* %19
%255 = fdiv double %253, %254
%256 = load double, double* %20
%257 = fsub double %256, 1.000000e+00
%258 = fmul double %255, %257
%259 = call double @tanh(double %258)
%260 = fmul double %249, %259
%261 = load double*, double** %13
%262 = load i32, i32* %14
%263 = sext i32 %262 to i64
%264 = getelementptr inbounds double, double* %261, i64 %263
store double %260, double* %264
br label %272
265: ; preds = %245
%266 = load double, double* %20
%267 = fsub double 1.000000e+00, %266
%268 = load double*, double** %13
%269 = load i32, i32* %14
%270 = sext i32 %269 to i64
%271 = getelementptr inbounds double, double* %268, i64 %270
store double %267, double* %271
br label %272
272: ; preds = %265, %248
br label %328
273: ; preds = %242, %232
%274 = load i32, i32* %16
%275 = icmp eq i32 %274, 1
br i1 %275, label %276, label %325
276: ; preds = %273
%277 = load i32, i32* %17
%278 = icmp eq i32 %277, 2
br i1 %278, label %279, label %325
279: ; preds = %276
%280 = load double*, double** %13
%281 = load i32, i32* %14
%282 = sext i32 %281 to i64
%283 = getelementptr inbounds double, double* %280, i64 %282
%284 = load double, double* %283
store double %284, double* %21
%285 = load double, double* %19
%286 = load double, double* %18
%287 = load double, double* %29
%288 = load double, double* %30
%289 = load double, double* %20
%290 = load double, double* %21
%291 = call double @uOfX_f(double %285, double %286, double %287, double %288, double %289, double %290)
store double %291, double* %22
br label %292
292: ; preds = %305, %279
%293 = load double, double* %19
%294 = load double, double* %18
%295 = load double, double* %29
%296 = load double, double* %30
%297 = load double, double* %20
%298 = load double, double* %21
%299 = call double @uOfX_f(double %293, double %294, double %295, double %296, double %297, double %298)
%300 = call double @llvm.fabs.f64(double %299)
%301 = load double, double* %22
%302 = call double @llvm.fabs.f64(double %301)
%303 = call double @llvm.fmuladd.f64(double 0x3EB0C6F7A0B5ED8D, double %302, double 0x3EB0C6F7A0B5ED8D)
%304 = fcmp ogt double %300, %303
br i1 %304, label %305, label %319
305: ; preds = %292
%306 = load double, double* %19
%307 = load double, double* %18
%308 = load double, double* %29
%309 = load double, double* %30
%310 = load double, double* %20
%311 = load double, double* %21
%312 = call double @uOfX_f(double %306, double %307, double %308, double %309, double %310, double %311)
%313 = load double, double* %29
%314 = load double, double* %21
%315 = call double @uOfX_df(double %313, double %314)
%316 = fdiv double %312, %315
%317 = load double, double* %21
%318 = fsub double %317, %316
store double %318, double* %21
br label %292
319: ; preds = %292
%320 = load double, double* %21
%321 = load double*, double** %13
%322 = load i32, i32* %14
%323 = sext i32 %322 to i64
%324 = getelementptr inbounds double, double* %321, i64 %323
store double %320, double* %324
br label %327
325: ; preds = %276, %273
%326 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0))
br label %327
327: ; preds = %325, %319
br label %328
328: ; preds = %327, %272
br label %329
329: ; preds = %328
%330 = load i32, i32* %14
%331 = add nsw i32 %330, 1
store i32 %331, i32* %14
br label %228
332: ; preds = %228
%333 = load i32, i32* %15
store i32 %333, i32* %7
br label %334
334: ; preds = %332, %210
%335 = load i32, i32* %7
ret i32 %335
}

LLVM IR (-O2):
@.str.1 = [16 x i8] c"sqrt(-C)= %lf \0A\00"
@.str.3 = [10 x i8] c"f0 = %lf\0A\00"
@.str.4 = [10 x i8] c"dc = %lf\0A\00"
@.str.5 = [14 x i8] c"f(%lf) = %lf\0A\00"
@.str.8 = [6 x i8] c"%lf \0A\00"
@.str.9 = [15 x i8] c" f(%lf) = %lf\0A\00"
@.str.10 = [15 x i8] c"df(%lf) = %lf\0A\00"
@.str.11 = [9 x i8] c"C = %lf\0A\00"
@.str.12 = [9 x i8] c"D = %lf\0A\00"
@str = [20 x i8] c"q,r not implemented\00"
@str.15 = [26 x i8] c"\0ASolving for C in q=1,r=2\00"
@str.16 = [4 x i8] c"out\00"
@str.17 = [3 x i8] c"ls\00"
@str.18 = [34 x i8] c"Solving for sqrt(-C) for q=2, r=1\00"
define i32 @NonlinearAD_SteadyState(i32* %0, double* %1, i32 %2, double %3, double* %4, double* %5) {
%7 = load i32, i32* %0
%8 = getelementptr inbounds i32, i32* %0, i64 1
%9 = load i32, i32* %8
%10 = load double, double* %1
%11 = getelementptr inbounds double, double* %1, i64 1
%12 = load double, double* %11
%13 = icmp eq i32 %7, 2
%14 = icmp eq i32 %9, 1
%15 = select i1 %13, i1 %14, i1 false
br i1 %15, label %16, label %35
16: ; preds = %6
%17 = fcmp une double %10, 0.000000e+00
br i1 %17, label %18, label %106
18: ; preds = %16
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.18, i64 0, i64 0))
%20 = tail call double @f(double 0x3FF3988E1409212E, double %10, double %12, i32 2, i32 1)
%21 = tail call double @llvm.fabs.f64(double %20)
%22 = fcmp ogt double %21, 1.000000e-08
br i1 %22, label %23, label %32
23: ; preds = %18, %23
%24 = phi double [ %28, %23 ], [ 0x3FF3988E1409212E, %18 ]
%25 = tail call double @f(double %24, double %10, double %12, i32 2, i32 1)
%26 = tail call double @df(double %24, double %10, double %12, i32 2, i32 1)
%27 = fdiv double %25, %26
%28 = fsub double %24, %27
%29 = tail call double @f(double %28, double %10, double %12, i32 2, i32 1)
%30 = tail call double @llvm.fabs.f64(double %29)
%31 = fcmp ogt double %30, 1.000000e-08
br i1 %31, label %23, label %32
32: ; preds = %23, %18
%33 = phi double [ 0x3FF3988E1409212E, %18 ], [ %28, %23 ]
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), double %33)
br label %97
35: ; preds = %6
%36 = icmp eq i32 %7, 1
%37 = icmp eq i32 %9, 2
%38 = select i1 %36, i1 %37, i1 false
br i1 %38, label %39, label %95
39: ; preds = %35
%40 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.15, i64 0, i64 0))
%41 = tail call double @f(double 0x3FF000000006DF38, double %10, double %12, i32 1, i32 2)
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), double %41)
%43 = tail call double @f(double 0x3FF000000006DF38, double %10, double %12, i32 1, i32 2)
%44 = tail call double @llvm.fabs.f64(double %43)
%45 = tail call double @llvm.fabs.f64(double %41)
%46 = tail call double @llvm.fmuladd.f64(double %45, double 0x3E7AD7F29ABCAF48, double 0x3E7AD7F29ABCAF48)
%47 = fcmp ogt double %44, %46
br i1 %47, label %48, label %81
48: ; preds = %39, %71
%49 = phi double [ %57, %71 ], [ 0x3FF000000006DF38, %39 ]
%50 = tail call double @f(double %49, double %10, double %12, i32 1, i32 2)
%51 = fneg double %50
%52 = tail call double @df(double %49, double %10, double %12, i32 1, i32 2)
%53 = fdiv double %51, %52
%54 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), double %53)
br label %55
55: ; preds = %66, %48
%56 = phi double [ %53, %48 ], [ %70, %66 ]
%57 = fadd double %49, %56
%58 = tail call double @f(double %57, double %10, double %12, i32 1, i32 2)
%59 = tail call double @llvm.fabs.f64(double %58)
%60 = tail call double @f(double %49, double %10, double %12, i32 1, i32 2)
%61 = tail call double @llvm.fabs.f64(double %60)
%62 = fmul double %61, 0x3FEFAE147AE147AE
%63 = fcmp ogt double %59, %62
%64 = fcmp ole double %57, 1.000000e+00
%65 = or i1 %64, %63
br i1 %65, label %66, label %71
66: ; preds = %55
%67 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), double %57, double %58)
%68 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0), double %49, double %60)
%69 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str.17, i64 0, i64 0))
%70 = fmul double %56, 9.000000e-01
br label %55
71: ; preds = %55
%72 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str.16, i64 0, i64 0))
%73 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), double %57)
%74 = tail call double @f(double %57, double %10, double %12, i32 1, i32 2)
%75 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0), double %57, double %74)
%76 = tail call double @df(double %57, double %10, double %12, i32 1, i32 2)
%77 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.10, i64 0, i64 0), double %57, double %76)
%78 = tail call double @f(double %57, double %10, double %12, i32 1, i32 2)
%79 = tail call double @llvm.fabs.f64(double %78)
%80 = fcmp ogt double %79, %46
br i1 %80, label %48, label %81
81: ; preds = %71, %39
%82 = phi double [ 0x3FF000000006DF38, %39 ], [ %57, %71 ]
%83 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), double %82)
%84 = fmul double %82, 2.000000e+00
%85 = fadd double %82, -1.000000e+00
%86 = fmul double %82, %85
%87 = tail call double @log(double %86)
%88 = fmul double %82, -4.000000e+00
%89 = tail call double @llvm.fmuladd.f64(double %84, double %87, double %88)
%90 = fadd double %89, 2.000000e+00
%91 = fdiv double %10, %12
%92 = fsub double %90, %91
%93 = fmul double %92, 5.000000e-01
%94 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0), double %93)
br label %97
95: ; preds = %35
%96 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %160
97: ; preds = %32, %81
%98 = phi double [ %33, %32 ], [ 0.000000e+00, %81 ]
%99 = phi double [ 0.000000e+00, %32 ], [ %82, %81 ]
%100 = phi double [ 0.000000e+00, %32 ], [ %93, %81 ]
%101 = icmp eq i32 %7, 1
%102 = icmp eq i32 %9, 2
%103 = select i1 %101, i1 %102, i1 false
br i1 %103, label %104, label %106
104: ; preds = %97
%105 = tail call i32 @LinearAD_SteadyState(i32* %0, double* %1, i32 %2, double %3, double* %4, double* %5)
br label %106
106: ; preds = %16, %104, %97
%107 = phi i1 [ true, %104 ], [ false, %97 ], [ false, %16 ]
%108 = phi double [ %100, %104 ], [ %100, %97 ], [ 0.000000e+00, %16 ]
%109 = phi double [ %99, %104 ], [ %99, %97 ], [ 0.000000e+00, %16 ]
%110 = phi double [ %98, %104 ], [ %98, %97 ], [ 0.000000e+00, %16 ]
%111 = phi i32 [ %105, %104 ], [ 0, %97 ], [ 0, %16 ]
%112 = icmp sgt i32 %2, 0
br i1 %112, label %113, label %160
113: ; preds = %106
%114 = fcmp une double %10, 0.000000e+00
%115 = fneg double %10
%116 = fmul double %110, %115
%117 = fdiv double %116, %12
%118 = zext i32 %2 to i64
br label %119
119: ; preds = %113, %157
%120 = phi i64 [ 0, %113 ], [ %158, %157 ]
%121 = mul nuw nsw i64 %120, 3
%122 = getelementptr inbounds double, double* %4, i64 %121
%123 = load double, double* %122
br i1 %15, label %124, label %134
124: ; preds = %119
br i1 %114, label %125, label %131
125: ; preds = %124
%126 = fadd double %123, -1.000000e+00
%127 = fmul double %117, %126
%128 = tail call double @tanh(double %127)
%129 = fmul double %110, %128
%130 = getelementptr inbounds double, double* %5, i64 %120
store double %129, double* %130
br label %157
131: ; preds = %124
%132 = fsub double 1.000000e+00, %123
%133 = getelementptr inbounds double, double* %5, i64 %120
store double %132, double* %133
br label %157
134: ; preds = %119
br i1 %107, label %135, label %155
135: ; preds = %134
%136 = getelementptr inbounds double, double* %5, i64 %120
%137 = load double, double* %136
%138 = tail call double @uOfX_f(double %12, double %10, double %109, double %108, double %123, double %137)
%139 = tail call double @uOfX_f(double %12, double %10, double %109, double %108, double %123, double %137)
%140 = tail call double @llvm.fabs.f64(double %139)
%141 = tail call double @llvm.fabs.f64(double %138)
%142 = tail call double @llvm.fmuladd.f64(double %141, double 0x3EB0C6F7A0B5ED8D, double 0x3EB0C6F7A0B5ED8D)
%143 = fcmp ogt double %140, %142
br i1 %143, label %144, label %153
144: ; preds = %135, %144
%145 = phi double [ %149, %144 ], [ %137, %135 ]
%146 = tail call double @uOfX_f(double %12, double %10, double %109, double %108, double %123, double %145)
%147 = tail call double @uOfX_df(double %109, double %145)
%148 = fdiv double %146, %147
%149 = fsub double %145, %148
%150 = tail call double @uOfX_f(double %12, double %10, double %109, double %108, double %123, double %149)
%151 = tail call double @llvm.fabs.f64(double %150)
%152 = fcmp ogt double %151, %142
br i1 %152, label %144, label %153
153: ; preds = %144, %135
%154 = phi double [ %137, %135 ], [ %149, %144 ]
store double %154, double* %136
br label %157
155: ; preds = %134
%156 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
br label %157
157: ; preds = %131, %125, %155, %153
%158 = add nuw nsw i64 %120, 1
%159 = icmp eq i64 %158, %118
br i1 %159, label %160, label %119
160: ; preds = %157, %106, %95
%161 = phi i32 [ 0, %95 ], [ %111, %106 ], [ %111, %157 ]
ret i32 %161
}