#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 exp(double);
int LinearAD_SteadyState(int *iwork, double *rwork, int nPoints, double t,
                         double *X, double *u) {
  int i;
  double b = rwork[0], a = rwork[1];
  double x, D = 0.0, C;
  if (b != 0.0) {
    D = (1.0 / (exp(b / a) - 1.0));
  }
  C = (-D) * exp(b / a);
  for (i = 0; i < nPoints; i++) {
    x = X[i * 3 + 0];
    if (D != 0.0) {
      u[i] = (-D) * exp(b * x / a) - C;
    } else {
      u[i] = 1.0 - x;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<LinearAD_SteadyState>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x48(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1170 <LinearAD_SteadyState+0x60>
jp     1170 <LinearAD_SteadyState+0x60>
jmp    119f <LinearAD_SteadyState+0x8f>
movsd  -0x40(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xe76(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xe6a(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x40(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    12c8 <LinearAD_SteadyState+0x1b8>
mov    -0x28(%rbp),%rax
imul   $0x3,-0x34(%rbp),%ecx
add    $0x0,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x58(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1228 <LinearAD_SteadyState+0x118>
jp     1228 <LinearAD_SteadyState+0x118>
jmp    129b <LinearAD_SteadyState+0x18b>
movsd  -0x58(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x50(%rbp),%xmm0
divsd  -0x48(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm2
movsd  -0x70(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    12b5 <LinearAD_SteadyState+0x1a5>
movsd  0xd5d(%rip),%xmm0
subsd  -0x50(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    12ba <LinearAD_SteadyState+0x1aa>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    11e7 <LinearAD_SteadyState+0xd7>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LinearAD_SteadyState>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x48,%rsp
mov    %r8,%r14
mov    %rcx,%rbx
mov    %edx,%ebp
movsd  (%rsi),%xmm0
movsd  0x8(%rsi),%xmm1
xorpd  %xmm3,%xmm3
xorps  %xmm2,%xmm2
movaps %xmm2,0x10(%rsp)
ucomisd %xmm3,%xmm0
movsd  %xmm0,0x28(%rsp)
movsd  %xmm1,0x20(%rsp)
divsd  %xmm1,%xmm0
jne    114f <LinearAD_SteadyState+0x3f>
jnp    1180 <LinearAD_SteadyState+0x70>
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <exp@plt>
addsd  0xe98(%rip),%xmm0
movsd  0xe98(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
movapd %xmm1,0x10(%rsp)
call   1030 <exp@plt>
movsd  %xmm0,0x8(%rsp)
test   %ebp,%ebp
jle    1228 <LinearAD_SteadyState+0x118>
movapd 0xe85(%rip),%xmm1
movapd 0x10(%rsp),%xmm0
xorpd  %xmm0,%xmm1
movapd %xmm1,0x30(%rsp)
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
mov    %ebp,%r15d
xor    %ebp,%ebp
jmp    11ef <LinearAD_SteadyState+0xdf>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  0xe30(%rip),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%r14,%rbp,8)
add    $0x1,%rbp
add    $0x18,%rbx
cmp    %rbp,%r15
je     1228 <LinearAD_SteadyState+0x118>
movapd 0x10(%rsp),%xmm0
ucomisd 0xe13(%rip),%xmm0
movsd  (%rbx),%xmm0
jne    1205 <LinearAD_SteadyState+0xf5>
jnp    11d0 <LinearAD_SteadyState+0xc0>
mulsd  0x28(%rsp),%xmm0
divsd  0x20(%rsp),%xmm0
call   1030 <exp@plt>
movapd %xmm0,%xmm1
mulsd  0x30(%rsp),%xmm1
addsd  0x8(%rsp),%xmm1
jmp    11dc <LinearAD_SteadyState+0xcc>
xor    %eax,%eax
add    $0x48,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @LinearAD_SteadyState(i32* nocapture readnone %0, double* nocapture %1, i32 %2, double %3, double* nocapture %4, double* nocapture writeonly %5) {
%7 = load double, double* %1
%8 = getelementptr inbounds double, double* %1, i64 1
%9 = load double, double* %8
%10 = fcmp une double %7, 0.000000e+00
%11 = fdiv double %7, %9
br i1 %10, label %12, label %16
12: ; preds = %6
%13 = tail call double @exp(double %11)
%14 = fadd double %13, -1.000000e+00
%15 = fdiv double 1.000000e+00, %14
br label %16
16: ; preds = %6, %12
%17 = phi double [ %15, %12 ], [ 0.000000e+00, %6 ]
%18 = fneg double %17
%19 = tail call double @exp(double %11)
%20 = icmp sgt i32 %2, 0
br i1 %20, label %21, label %42
21: ; preds = %16
%22 = fcmp une double %17, 0.000000e+00
%23 = fmul double %17, %19
%24 = zext i32 %2 to i64
br label %25
25: ; preds = %21, %37
%26 = phi i64 [ 0, %21 ], [ %40, %37 ]
%27 = mul nuw nsw i64 %26, 3
%28 = getelementptr inbounds double, double* %4, i64 %27
%29 = load double, double* %28
br i1 %22, label %30, label %35
30: ; preds = %25
%31 = fmul double %7, %29
%32 = fdiv double %31, %9
%33 = tail call double @exp(double %32)
%34 = tail call double @llvm.fmuladd.f64(double %18, double %33, double %23)
br label %37
35: ; preds = %25
%36 = fsub double 1.000000e+00, %29
br label %37
37: ; preds = %30, %35
%38 = phi double [ %34, %30 ], [ %36, %35 ]
%39 = getelementptr inbounds double, double* %5, i64 %26
store double %38, double* %39
%40 = add nuw nsw i64 %26, 1
%41 = icmp eq i64 %40, %24
br i1 %41, label %42, label %25
42: ; preds = %37, %16
ret i32 0
}