#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__ floor(double);
double it_pol_neville_s4(double *, double);
int max(int, int /*<<< orphan*/);
int min(int, int);
double it_pol_neville2D_s4(int n, int m, double **f, double y_1, double x_1) {
  int i;
  static double x_interm[4];
  int indice_x1_inf = (int)floor(x_1) - 1;
  indice_x1_inf = max(indice_x1_inf, 0);
  indice_x1_inf = min(indice_x1_inf, m - 4);
  int indice_y1_inf = (int)floor(y_1) - 1;
  indice_y1_inf = max(indice_y1_inf, 0);
  indice_y1_inf = min(indice_y1_inf, n - 4);
  for (i = 0; i < 4; i++) {
    x_interm[i] = it_pol_neville_s4(&(f[indice_y1_inf + i][indice_x1_inf]),
                                    x_1 - indice_x1_inf);
  }
  return it_pol_neville_s4(x_interm, y_1 - indice_y1_inf);
}


x86 assembly (clang, -O0):
<it_pol_neville2D_s4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1060 <floor@plt>
sub    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%edi
xor    %esi,%esi
call   1050 <max@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%edi
mov    -0x8(%rbp),%esi
sub    $0x4,%esi
call   1040 <min@plt>
mov    %eax,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1060 <floor@plt>
sub    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%edi
xor    %esi,%esi
call   1050 <max@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%edi
mov    -0x4(%rbp),%esi
sub    $0x4,%esi
call   1040 <min@plt>
mov    %eax,-0x2c(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x4,-0x24(%rbp)
jge    1216 <it_pol_neville2D_s4+0xd6>
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    -0x24(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
movslq -0x28(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
movsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x28(%rbp),%xmm1
subsd  %xmm1,%xmm0
call   1030 <it_pol_neville_s4@plt>
movslq -0x24(%rbp),%rcx
lea    0x2e4d(%rip),%rax
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11bf <it_pol_neville2D_s4+0x7f>
movsd  -0x18(%rbp),%xmm0
cvtsi2sdl -0x2c(%rbp),%xmm1
subsd  %xmm1,%xmm0
lea    0x2e25(%rip),%rdi
call   1030 <it_pol_neville_s4@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<it_pol_neville2D_s4>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
mov    %rdx,%r15
mov    %esi,%ebx
mov    %edi,%ebp
movaps %xmm1,%xmm0
call   1060 <floor@plt>
lea    -0x1(%rax),%edi
xor    %esi,%esi
call   1050 <max@plt>
add    $0xfffffffc,%ebx
mov    %eax,%edi
mov    %ebx,%esi
call   1040 <min@plt>
mov    %eax,%ebx
movsd  0x10(%rsp),%xmm0
call   1060 <floor@plt>
lea    -0x1(%rax),%edi
xor    %esi,%esi
call   1050 <max@plt>
add    $0xfffffffc,%ebp
mov    %eax,%edi
mov    %ebp,%esi
call   1040 <min@plt>
movslq %ebx,%rbp
xorps  %xmm1,%xmm1
cvtsi2sd %ebp,%xmm1
movsd  0x8(%rsp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
movslq %eax,%rbx
shl    $0x3,%rbp
mov    (%r15,%rbx,8),%rdi
add    %rbp,%rdi
call   1030 <it_pol_neville_s4@plt>
movsd  %xmm0,0x2e7d(%rip)
lea    0x2e76(%rip),%r14
mov    0x8(%r15,%rbx,8),%rdi
add    %rbp,%rdi
movsd  0x8(%rsp),%xmm0
call   1030 <it_pol_neville_s4@plt>
movsd  %xmm0,0x2e63(%rip)
mov    0x10(%r15,%rbx,8),%rdi
add    %rbp,%rdi
movsd  0x8(%rsp),%xmm0
call   1030 <it_pol_neville_s4@plt>
movsd  %xmm0,0x2e50(%rip)
add    0x18(%r15,%rbx,8),%rbp
mov    %rbp,%rdi
movsd  0x8(%rsp),%xmm0
call   1030 <it_pol_neville_s4@plt>
movsd  %xmm0,0x2e3d(%rip)
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
movsd  0x10(%rsp),%xmm0
subsd  %xmm1,%xmm0
mov    %r14,%rdi
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <it_pol_neville_s4@plt>

LLVM IR (-O0):
@it_pol_neville2D_s4.x_interm = internal global [4 x double] zeroinitializer
define double @it_pol_neville2D_s4(i32 %0, i32 %1, double** %2, double %3, double %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca double**
%9 = alloca double
%10 = alloca double
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store double** %2, double*** %8
store double %3, double* %9
store double %4, double* %10
%14 = load double, double* %10
%15 = call i64 @floor(double %14)
%16 = trunc i64 %15 to i32
%17 = sub nsw i32 %16, 1
store i32 %17, i32* %12
%18 = load i32, i32* %12
%19 = call i32 @max(i32 %18, i32 0)
store i32 %19, i32* %12
%20 = load i32, i32* %12
%21 = load i32, i32* %7
%22 = sub nsw i32 %21, 4
%23 = call i32 @min(i32 %20, i32 %22)
store i32 %23, i32* %12
%24 = load double, double* %9
%25 = call i64 @floor(double %24)
%26 = trunc i64 %25 to i32
%27 = sub nsw i32 %26, 1
store i32 %27, i32* %13
%28 = load i32, i32* %13
%29 = call i32 @max(i32 %28, i32 0)
store i32 %29, i32* %13
%30 = load i32, i32* %13
%31 = load i32, i32* %6
%32 = sub nsw i32 %31, 4
%33 = call i32 @min(i32 %30, i32 %32)
store i32 %33, i32* %13
store i32 0, i32* %11
br label %34
34: ; preds = %56, %5
%35 = load i32, i32* %11
%36 = icmp slt i32 %35, 4
br i1 %36, label %37, label %59
37: ; preds = %34
%38 = load double**, double*** %8
%39 = load i32, i32* %13
%40 = load i32, i32* %11
%41 = add nsw i32 %39, %40
%42 = sext i32 %41 to i64
%43 = getelementptr inbounds double*, double** %38, i64 %42
%44 = load double*, double** %43
%45 = load i32, i32* %12
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds double, double* %44, i64 %46
%48 = load double, double* %10
%49 = load i32, i32* %12
%50 = sitofp i32 %49 to double
%51 = fsub double %48, %50
%52 = call double @it_pol_neville_s4(double* %47, double %51)
%53 = load i32, i32* %11
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [4 x double], [4 x double]* @it_pol_neville2D_s4.x_interm, i64 0, i64 %54
store double %52, double* %55
br label %56
56: ; preds = %37
%57 = load i32, i32* %11
%58 = add nsw i32 %57, 1
store i32 %58, i32* %11
br label %34
59: ; preds = %34
%60 = load double, double* %9
%61 = load i32, i32* %13
%62 = sitofp i32 %61 to double
%63 = fsub double %60, %62
%64 = call double @it_pol_neville_s4(double* getelementptr inbounds ([4 x double], [4 x double]* @it_pol_neville2D_s4.x_interm, i64 0, i64 0), double %63)
ret double %64
}

LLVM IR (-O2):
@it_pol_neville2D_s4.x_interm = internal global [4 x double] zeroinitializer
define double @it_pol_neville2D_s4(i32 %0, i32 %1, double** nocapture %2, double %3, double %4) {
%6 = tail call i64 @floor(double %4)
%7 = trunc i64 %6 to i32
%8 = add nsw i32 %7, -1
%9 = tail call i32 @max(i32 %8, i32 0)
%10 = add nsw i32 %1, -4
%11 = tail call i32 @min(i32 %9, i32 %10)
%12 = tail call i64 @floor(double %3)
%13 = trunc i64 %12 to i32
%14 = add nsw i32 %13, -1
%15 = tail call i32 @max(i32 %14, i32 0)
%16 = add nsw i32 %0, -4
%17 = tail call i32 @min(i32 %15, i32 %16)
%18 = sext i32 %11 to i64
%19 = sitofp i32 %11 to double
%20 = fsub double %4, %19
%21 = sext i32 %17 to i64
%22 = getelementptr inbounds double*, double** %2, i64 %21
%23 = load double*, double** %22
%24 = getelementptr inbounds double, double* %23, i64 %18
%25 = tail call double @it_pol_neville_s4(double* %24, double %20)
store double %25, double* getelementptr inbounds ([4 x double], [4 x double]* @it_pol_neville2D_s4.x_interm, i64 0, i64 0)
%26 = add nsw i64 %21, 1
%27 = getelementptr inbounds double*, double** %2, i64 %26
%28 = load double*, double** %27
%29 = getelementptr inbounds double, double* %28, i64 %18
%30 = tail call double @it_pol_neville_s4(double* %29, double %20)
store double %30, double* getelementptr inbounds ([4 x double], [4 x double]* @it_pol_neville2D_s4.x_interm, i64 0, i64 1)
%31 = add nsw i64 %21, 2
%32 = getelementptr inbounds double*, double** %2, i64 %31
%33 = load double*, double** %32
%34 = getelementptr inbounds double, double* %33, i64 %18
%35 = tail call double @it_pol_neville_s4(double* %34, double %20)
store double %35, double* getelementptr inbounds ([4 x double], [4 x double]* @it_pol_neville2D_s4.x_interm, i64 0, i64 2)
%36 = add nsw i64 %21, 3
%37 = getelementptr inbounds double*, double** %2, i64 %36
%38 = load double*, double** %37
%39 = getelementptr inbounds double, double* %38, i64 %18
%40 = tail call double @it_pol_neville_s4(double* %39, double %20)
store double %40, double* getelementptr inbounds ([4 x double], [4 x double]* @it_pol_neville2D_s4.x_interm, i64 0, i64 3)
%41 = sitofp i32 %17 to double
%42 = fsub double %3, %41
%43 = tail call double @it_pol_neville_s4(double* getelementptr inbounds ([4 x double], [4 x double]* @it_pol_neville2D_s4.x_interm, i64 0, i64 0), double %42)
ret double %43
}