#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 */
struct kdtree {
  int dummy;
};
struct kdres {
  int dummy;
};

/* Variables and functions */
struct kdres *kd_nearest_range(struct kdtree *, double *, double);
struct kdres *kd_nearest_range3(struct kdtree *tree, double x, double y,
                                double z, double range) {
  double pos[3];
  pos[0] = x;
  pos[1] = y;
  pos[2] = z;
  return kd_nearest_range(tree, pos, range);
}


x86 assembly (clang, -O0):
<kd_nearest_range3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x40(%rbp),%rsi
movsd  -0x28(%rbp),%xmm0
call   1030 <kd_nearest_range@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kd_nearest_range3>:
sub    $0x18,%rsp
movsd  %xmm0,(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm2,0x10(%rsp)
mov    %rsp,%rsi
movaps %xmm3,%xmm0
call   1030 <kd_nearest_range@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.kdres = type { i32 }
%struct.kdtree = type { i32 }
define %struct.kdres* @kd_nearest_range3(%struct.kdtree* %0, double %1, double %2, double %3, double %4) {
%6 = alloca %struct.kdtree*
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca [3 x double]
store %struct.kdtree* %0, %struct.kdtree** %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
store double %4, double* %10
%12 = load double, double* %7
%13 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
store double %12, double* %13
%14 = load double, double* %8
%15 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 1
store double %14, double* %15
%16 = load double, double* %9
%17 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 2
store double %16, double* %17
%18 = load %struct.kdtree*, %struct.kdtree** %6
%19 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
%20 = load double, double* %10
%21 = call %struct.kdres* @kd_nearest_range(%struct.kdtree* %18, double* %19, double %20)
ret %struct.kdres* %21
}

LLVM IR (-O2):
%struct.kdres = type { i32 }
%struct.kdtree = type { i32 }
define %struct.kdres* @kd_nearest_range3(%struct.kdtree* %0, double %1, double %2, double %3, double %4) {
%6 = alloca [3 x double]
%7 = bitcast [3 x double]* %6 to i8*
%8 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 0
store double %1, double* %8
%9 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 1
store double %2, double* %9
%10 = getelementptr inbounds [3 x double], [3 x double]* %6, i64 0, i64 2
store double %3, double* %10
%11 = call %struct.kdres* @kd_nearest_range(%struct.kdtree* %0, double* %8, double %4)
ret %struct.kdres* %11
}