#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 */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ radialDiffRecurrence(double, double *, double *, int);
int /*<<< orphan*/ sphNeumann(double, double *, int);
void sphNeumannDiff(double x, double *y, int n) {
  double *y1;
  if (n < 0)
    return;
  if ((y1 = (double *)calloc(n + 2, sizeof(double))) == 0)
    return;
  sphNeumann(x, y, n + 1);
  radialDiffRecurrence(x, y1, y, n);
  free(y1);
}


x86 assembly (clang, -O0):
<sphNeumannDiff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1163 <sphNeumannDiff+0x23>
jmp    11b8 <sphNeumannDiff+0x78>
mov    -0x14(%rbp),%edi
add    $0x2,%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1186 <sphNeumannDiff+0x46>
jmp    11b8 <sphNeumannDiff+0x78>
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
call   1040 <sphNeumann@plt>
movsd  -0x8(%rbp),%xmm0
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1050 <radialDiffRecurrence@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sphNeumannDiff>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movsd  %xmm0,0x8(%rsp)
test   %esi,%esi
js     11a2 <sphNeumannDiff+0x62>
mov    %esi,%ebx
mov    %rdi,%r14
lea    0x2(%rbx),%edi
mov    $0x8,%esi
call   1060 <calloc@plt>
test   %rax,%rax
je     11a2 <sphNeumannDiff+0x62>
mov    %rax,%r15
lea    0x1(%rbx),%esi
movsd  0x8(%rsp),%xmm0
mov    %r14,%rdi
call   1040 <sphNeumann@plt>
movsd  0x8(%rsp),%xmm0
mov    %r15,%rdi
mov    %r14,%rsi
mov    %ebx,%edx
call   1050 <radialDiffRecurrence@plt>
mov    %r15,%rdi
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @sphNeumannDiff(double %0, double* %1, i32 %2) {
%4 = alloca double
%5 = alloca double*
%6 = alloca i32
%7 = alloca double*
store double %0, double* %4
store double* %1, double** %5
store i32 %2, i32* %6
%8 = load i32, i32* %6
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %3
br label %31
11: ; preds = %3
%12 = load i32, i32* %6
%13 = add nsw i32 %12, 2
%14 = call i64 @calloc(i32 %13, i32 8)
%15 = inttoptr i64 %14 to double*
store double* %15, double** %7
%16 = icmp eq double* %15, null
br i1 %16, label %17, label %18
17: ; preds = %11
br label %31
18: ; preds = %11
%19 = load double, double* %4
%20 = load double*, double** %5
%21 = load i32, i32* %6
%22 = add nsw i32 %21, 1
%23 = call i32 @sphNeumann(double %19, double* %20, i32 %22)
%24 = load double, double* %4
%25 = load double*, double** %7
%26 = load double*, double** %5
%27 = load i32, i32* %6
%28 = call i32 @radialDiffRecurrence(double %24, double* %25, double* %26, i32 %27)
%29 = load double*, double** %7
%30 = call i32 @free(double* %29)
br label %31
31: ; preds = %18, %17, %10
ret void
}

LLVM IR (-O2):
define void @sphNeumannDiff(double %0, double* %1, i32 %2) {
%4 = icmp slt i32 %2, 0
br i1 %4, label %15, label %5
5: ; preds = %3
%6 = add nuw nsw i32 %2, 2
%7 = tail call i64 @calloc(i32 %6, i32 8)
%8 = inttoptr i64 %7 to double*
%9 = icmp eq i64 %7, 0
br i1 %9, label %15, label %10
10: ; preds = %5
%11 = add nuw nsw i32 %2, 1
%12 = tail call i32 @sphNeumann(double %0, double* %1, i32 %11)
%13 = tail call i32 @radialDiffRecurrence(double %0, double* %8, double* %1, i32 %2)
%14 = tail call i32 @free(double* %8)
br label %15
15: ; preds = %5, %3, %10
ret void
}