#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 */
int /*<<< orphan*/ Worley(double *, int, double *, double **, unsigned long *);
int f_worleyP(void *initdata, int argc, void **argv) {
  float *result = (float *)argv[0];
  float *P = (float *)argv[1];
  double at[3];
  at[0] = (double)P[0];
  at[1] = (double)P[1];
  at[2] = (double)P[2];
  double F[2];
  double delta[2][3];
  unsigned long ID[2];
  Worley(at, 2, F, delta, ID);
  *result = (float)F[0];
  return 0;
}


x86 assembly (clang, -O0):
<f_worleyP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x28(%rbp),%rax
movss  0x4(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x28(%rbp),%rax
movss  0x8(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
lea    -0x40(%rbp),%rdi
lea    -0x50(%rbp),%rdx
lea    -0x80(%rbp),%rcx
lea    -0x90(%rbp),%r8
mov    $0x2,%esi
call   1030 <Worley@plt>
movsd  -0x50(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_worleyP>:
push   %rbx
sub    $0x70,%rsp
mov    (%rdx),%rbx
mov    0x8(%rdx),%rax
cvtps2pd (%rax),%xmm0
movaps %xmm0,0x10(%rsp)
movss  0x8(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,0x20(%rsp)
lea    0x10(%rsp),%rdi
mov    %rsp,%rdx
lea    0x40(%rsp),%rcx
lea    0x30(%rsp),%r8
mov    $0x2,%esi
call   1030 <Worley@plt>
movsd  (%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,(%rbx)
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @f_worleyP(i8* %0, i32 %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8**
%7 = alloca float*
%8 = alloca float*
%9 = alloca [3 x double]
%10 = alloca [2 x double]
%11 = alloca [2 x [3 x double]]
%12 = alloca [2 x i64]
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%13 = load i8**, i8*** %6
%14 = getelementptr inbounds i8*, i8** %13, i64 0
%15 = load i8*, i8** %14
%16 = bitcast i8* %15 to float*
store float* %16, float** %7
%17 = load i8**, i8*** %6
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = bitcast i8* %19 to float*
store float* %20, float** %8
%21 = load float*, float** %8
%22 = getelementptr inbounds float, float* %21, i64 0
%23 = load float, float* %22
%24 = fpext float %23 to double
%25 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
store double %24, double* %25
%26 = load float*, float** %8
%27 = getelementptr inbounds float, float* %26, i64 1
%28 = load float, float* %27
%29 = fpext float %28 to double
%30 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 1
store double %29, double* %30
%31 = load float*, float** %8
%32 = getelementptr inbounds float, float* %31, i64 2
%33 = load float, float* %32
%34 = fpext float %33 to double
%35 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 2
store double %34, double* %35
%36 = getelementptr inbounds [3 x double], [3 x double]* %9, i64 0, i64 0
%37 = getelementptr inbounds [2 x double], [2 x double]* %10, i64 0, i64 0
%38 = getelementptr inbounds [2 x [3 x double]], [2 x [3 x double]]* %11, i64 0, i64 0
%39 = bitcast [3 x double]* %38 to double**
%40 = getelementptr inbounds [2 x i64], [2 x i64]* %12, i64 0, i64 0
%41 = call i32 @Worley(double* %36, i32 2, double* %37, double** %39, i64* %40)
%42 = getelementptr inbounds [2 x double], [2 x double]* %10, i64 0, i64 0
%43 = load double, double* %42
%44 = fptrunc double %43 to float
%45 = load float*, float** %7
store float %44, float* %45
ret i32 0
}

LLVM IR (-O2):
define i32 @f_worleyP(i8* nocapture readnone %0, i32 %1, i8** nocapture %2) {
%4 = alloca [3 x double]
%5 = alloca [2 x double]
%6 = alloca [2 x [3 x double]]
%7 = alloca [2 x i64]
%8 = bitcast i8** %2 to float**
%9 = load float*, float** %8
%10 = getelementptr inbounds i8*, i8** %2, i64 1
%11 = bitcast i8** %10 to float**
%12 = load float*, float** %11
%13 = bitcast [3 x double]* %4 to i8*
%14 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%15 = bitcast float* %12 to <2 x float>*
%16 = load <2 x float>, <2 x float>* %15
%17 = fpext <2 x float> %16 to <2 x double>
%18 = bitcast [3 x double]* %4 to <2 x double>*
store <2 x double> %17, <2 x double>* %18
%19 = getelementptr inbounds float, float* %12, i64 2
%20 = load float, float* %19
%21 = fpext float %20 to double
%22 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 2
store double %21, double* %22
%23 = bitcast [2 x double]* %5 to i8*
%24 = bitcast [2 x [3 x double]]* %6 to i8*
%25 = bitcast [2 x i64]* %7 to i8*
%26 = getelementptr inbounds [2 x double], [2 x double]* %5, i64 0, i64 0
%27 = bitcast [2 x [3 x double]]* %6 to double**
%28 = getelementptr inbounds [2 x i64], [2 x i64]* %7, i64 0, i64 0
%29 = call i32 @Worley(double* %14, i32 2, double* %26, double** %27, i64* %28)
%30 = load double, double* %26
%31 = fptrunc double %30 to float
store float %31, float* %9
ret i32 0
}