#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 jac_jacobi(double, int, double, double);
double jac_djacobi(double x, int n, double a, double b) {
  if (n == 0) {
    return 0.0;
  } else if (n == 1) {
    return 0.5 * (a + b + 2.0);
  } else {
    return 0.5 * (a + b + n + 1.0) * jac_jacobi(x, n - 1, a + 1.0, b + 1.0);
  }
}


x86 assembly (clang, -O0):
<jac_djacobi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  %xmm2,-0x28(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1141 <jac_djacobi+0x31>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11e2 <jac_djacobi+0xd2>
cmpl   $0x1,-0x14(%rbp)
jne    1177 <jac_djacobi+0x67>
movsd  -0x20(%rbp),%xmm1
addsd  -0x28(%rbp),%xmm1
movsd  0xeb3(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe9f(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11e2 <jac_djacobi+0xd2>
movsd  -0x20(%rbp),%xmm1
addsd  -0x28(%rbp),%xmm1
cvtsi2sdl -0x14(%rbp),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe6e(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xe6a(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x14(%rbp),%edi
sub    $0x1,%edi
movsd  0xe46(%rip),%xmm1
addsd  -0x20(%rbp),%xmm1
movsd  0xe39(%rip),%xmm2
addsd  -0x28(%rbp),%xmm2
call   1030 <jac_jacobi@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jac_djacobi>:
push   %rax
test   %edi,%edi
je     1130 <jac_djacobi+0x20>
cmp    $0x1,%edi
jne    1136 <jac_djacobi+0x26>
addsd  %xmm2,%xmm1
addsd  0xeda(%rip),%xmm1
mulsd  0xeda(%rip),%xmm1
jmp    1178 <jac_djacobi+0x68>
xorpd  %xmm1,%xmm1
jmp    1178 <jac_djacobi+0x68>
movapd %xmm1,%xmm3
addsd  %xmm2,%xmm3
cvtsi2sd %edi,%xmm4
addsd  %xmm3,%xmm4
movsd  0xec2(%rip),%xmm3
addsd  %xmm3,%xmm4
mulsd  0xeae(%rip),%xmm4
movsd  %xmm4,(%rsp)
add    $0xffffffff,%edi
addsd  %xmm3,%xmm1
addsd  %xmm3,%xmm2
call   1030 <jac_jacobi@plt>
movapd %xmm0,%xmm1
mulsd  (%rsp),%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @jac_djacobi(double %0, i32 %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%8 = alloca double
%9 = alloca double
store double %0, double* %6
store i32 %1, i32* %7
store double %2, double* %8
store double %3, double* %9
%10 = load i32, i32* %7
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %4
store double 0.000000e+00, double* %5
br label %40
13: ; preds = %4
%14 = load i32, i32* %7
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %22
16: ; preds = %13
%17 = load double, double* %8
%18 = load double, double* %9
%19 = fadd double %17, %18
%20 = fadd double %19, 2.000000e+00
%21 = fmul double 5.000000e-01, %20
store double %21, double* %5
br label %40
22: ; preds = %13
%23 = load double, double* %8
%24 = load double, double* %9
%25 = fadd double %23, %24
%26 = load i32, i32* %7
%27 = sitofp i32 %26 to double
%28 = fadd double %25, %27
%29 = fadd double %28, 1.000000e+00
%30 = fmul double 5.000000e-01, %29
%31 = load double, double* %6
%32 = load i32, i32* %7
%33 = sub nsw i32 %32, 1
%34 = load double, double* %8
%35 = fadd double %34, 1.000000e+00
%36 = load double, double* %9
%37 = fadd double %36, 1.000000e+00
%38 = call double @jac_jacobi(double %31, i32 %33, double %35, double %37)
%39 = fmul double %30, %38
store double %39, double* %5
br label %40
40: ; preds = %22, %16, %12
%41 = load double, double* %5
ret double %41
}

LLVM IR (-O2):
define double @jac_djacobi(double %0, i32 %1, double %2, double %3) {
switch i32 %1, label %9 [
i32 0, label %20
i32 1, label %5
]
5: ; preds = %4
%6 = fadd double %2, %3
%7 = fadd double %6, 2.000000e+00
%8 = fmul double %7, 5.000000e-01
br label %20
9: ; preds = %4
%10 = fadd double %2, %3
%11 = sitofp i32 %1 to double
%12 = fadd double %10, %11
%13 = fadd double %12, 1.000000e+00
%14 = fmul double %13, 5.000000e-01
%15 = add nsw i32 %1, -1
%16 = fadd double %2, 1.000000e+00
%17 = fadd double %3, 1.000000e+00
%18 = tail call double @jac_jacobi(double %0, i32 %15, double %16, double %17)
%19 = fmul double %14, %18
br label %20
20: ; preds = %4, %9, %5
%21 = phi double [ %8, %5 ], [ %19, %9 ], [ 0.000000e+00, %4 ]
ret double %21
}