#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 worleyP_F(void *initdata, int argc, void **argv) {
  float *P = (float *)argv[1];
  float *f1 = (float *)argv[2];
  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);
  *f1 = (float)F[0];
  return 0;
}


x86 assembly (clang, -O0):
<worleyP_F>:
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    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x20(%rbp),%rax
movss  0x4(%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x20(%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    -0x28(%rbp),%rax
movss  %xmm0,(%rax)
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<worleyP_F>:
push   %rbx
sub    $0x70,%rsp
mov    0x8(%rdx),%rax
mov    0x10(%rdx),%rbx
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 @worleyP_F(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 1
%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 2
%19 = load i8*, i8** %18
%20 = bitcast i8* %19 to float*
store float* %20, float** %8
%21 = load float*, float** %7
%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** %7
%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** %7
%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** %8
store float %44, float* %45
ret i32 0
}

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