#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 */
float snoise3(float, float, float);
int v_snoiseP(void *initdata, int argc, void **argv) {
  float *result = (float *)argv[0];
  float *P = (float *)argv[1];
  result[0] = (1.0f + snoise3(P[0], P[1], P[2])) * 0.5f;
  result[1] = (1.0f + snoise3(P[0] + 19.34, P[1] + 7.66, P[2] + 3.23)) * 0.5f;
  result[2] = (1.0f + snoise3(P[0] + 5.47, P[1] + 17.85, P[2] + 11.04)) * 0.5f;
  return 0;
}


x86 assembly (clang, -O0):
<v_snoiseP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%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
mov    -0x28(%rbp),%rax
movss  0x4(%rax),%xmm1
mov    -0x28(%rbp),%rax
movss  0x8(%rax),%xmm2
call   1030 <snoise3@plt>
movaps %xmm0,%xmm1
movss  0xea0(%rip),%xmm0
addss  %xmm1,%xmm0
movss  0xe90(%rip),%xmm1
mulss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xea0(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x28(%rbp),%rax
movss  0x4(%rax),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xe7b(%rip),%xmm2
addsd  %xmm2,%xmm1
cvtsd2ss %xmm1,%xmm1
mov    -0x28(%rbp),%rax
movss  0x8(%rax),%xmm2
cvtss2sd %xmm2,%xmm2
movsd  0xe56(%rip),%xmm3
addsd  %xmm3,%xmm2
cvtsd2ss %xmm2,%xmm2
call   1030 <snoise3@plt>
movaps %xmm0,%xmm1
movss  0xe22(%rip),%xmm0
addss  %xmm1,%xmm0
movss  0xe12(%rip),%xmm1
mulss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x28(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe09(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x28(%rbp),%rax
movss  0x4(%rax),%xmm1
cvtss2sd %xmm1,%xmm1
movsd  0xde4(%rip),%xmm2
addsd  %xmm2,%xmm1
cvtsd2ss %xmm1,%xmm1
mov    -0x28(%rbp),%rax
movss  0x8(%rax),%xmm2
cvtss2sd %xmm2,%xmm2
movsd  0xdbf(%rip),%xmm3
addsd  %xmm3,%xmm2
cvtsd2ss %xmm2,%xmm2
call   1030 <snoise3@plt>
movaps %xmm0,%xmm1
movss  0xda3(%rip),%xmm0
addss  %xmm1,%xmm0
movss  0xd93(%rip),%xmm1
mulss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,0x8(%rax)
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<v_snoiseP>:
push   %r14
push   %rbx
push   %rax
mov    (%rdx),%r14
mov    0x8(%rdx),%rbx
movss  (%rbx),%xmm0
movss  0x4(%rbx),%xmm1
movss  0x8(%rbx),%xmm2
call   1030 <snoise3@plt>
addss  0xeca(%rip),%xmm0
mulss  0xec6(%rip),%xmm0
movss  %xmm0,(%r14)
movss  (%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xeb5(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  0x4(%rbx),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  0xea8(%rip),%xmm1
cvtsd2ss %xmm1,%xmm1
movss  0x8(%rbx),%xmm2
cvtss2sd %xmm2,%xmm2
addsd  0xe9b(%rip),%xmm2
cvtsd2ss %xmm2,%xmm2
call   1030 <snoise3@plt>
addss  0xe72(%rip),%xmm0
mulss  0xe6e(%rip),%xmm0
movss  %xmm0,0x4(%r14)
movss  (%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
addsd  0xe74(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  0x4(%rbx),%xmm1
cvtss2sd %xmm1,%xmm1
addsd  0xe67(%rip),%xmm1
cvtsd2ss %xmm1,%xmm1
movss  0x8(%rbx),%xmm2
cvtss2sd %xmm2,%xmm2
addsd  0xe5a(%rip),%xmm2
cvtsd2ss %xmm2,%xmm2
call   1030 <snoise3@plt>
addss  0xe19(%rip),%xmm0
mulss  0xe15(%rip),%xmm0
movss  %xmm0,0x8(%r14)
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @v_snoiseP(i8* %0, i32 %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8**
%7 = alloca float*
%8 = alloca float*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%9 = load i8**, i8*** %6
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = bitcast i8* %11 to float*
store float* %12, float** %7
%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** %8
%17 = load float*, float** %8
%18 = getelementptr inbounds float, float* %17, i64 0
%19 = load float, float* %18
%20 = load float*, float** %8
%21 = getelementptr inbounds float, float* %20, i64 1
%22 = load float, float* %21
%23 = load float*, float** %8
%24 = getelementptr inbounds float, float* %23, i64 2
%25 = load float, float* %24
%26 = call float @snoise3(float %19, float %22, float %25)
%27 = fadd float 1.000000e+00, %26
%28 = fmul float %27, 5.000000e-01
%29 = load float*, float** %7
%30 = getelementptr inbounds float, float* %29, i64 0
store float %28, float* %30
%31 = load float*, float** %8
%32 = getelementptr inbounds float, float* %31, i64 0
%33 = load float, float* %32
%34 = fpext float %33 to double
%35 = fadd double %34, 1.934000e+01
%36 = fptrunc double %35 to float
%37 = load float*, float** %8
%38 = getelementptr inbounds float, float* %37, i64 1
%39 = load float, float* %38
%40 = fpext float %39 to double
%41 = fadd double %40, 7.660000e+00
%42 = fptrunc double %41 to float
%43 = load float*, float** %8
%44 = getelementptr inbounds float, float* %43, i64 2
%45 = load float, float* %44
%46 = fpext float %45 to double
%47 = fadd double %46, 3.230000e+00
%48 = fptrunc double %47 to float
%49 = call float @snoise3(float %36, float %42, float %48)
%50 = fadd float 1.000000e+00, %49
%51 = fmul float %50, 5.000000e-01
%52 = load float*, float** %7
%53 = getelementptr inbounds float, float* %52, i64 1
store float %51, float* %53
%54 = load float*, float** %8
%55 = getelementptr inbounds float, float* %54, i64 0
%56 = load float, float* %55
%57 = fpext float %56 to double
%58 = fadd double %57, 5.470000e+00
%59 = fptrunc double %58 to float
%60 = load float*, float** %8
%61 = getelementptr inbounds float, float* %60, i64 1
%62 = load float, float* %61
%63 = fpext float %62 to double
%64 = fadd double %63, 1.785000e+01
%65 = fptrunc double %64 to float
%66 = load float*, float** %8
%67 = getelementptr inbounds float, float* %66, i64 2
%68 = load float, float* %67
%69 = fpext float %68 to double
%70 = fadd double %69, 1.104000e+01
%71 = fptrunc double %70 to float
%72 = call float @snoise3(float %59, float %65, float %71)
%73 = fadd float 1.000000e+00, %72
%74 = fmul float %73, 5.000000e-01
%75 = load float*, float** %7
%76 = getelementptr inbounds float, float* %75, i64 2
store float %74, float* %76
ret i32 0
}

LLVM IR (-O2):
define i32 @v_snoiseP(i8* nocapture readnone %0, i32 %1, i8** nocapture %2) {
%4 = bitcast i8** %2 to float**
%5 = load float*, float** %4
%6 = getelementptr inbounds i8*, i8** %2, i64 1
%7 = bitcast i8** %6 to float**
%8 = load float*, float** %7
%9 = load float, float* %8
%10 = getelementptr inbounds float, float* %8, i64 1
%11 = load float, float* %10
%12 = getelementptr inbounds float, float* %8, i64 2
%13 = load float, float* %12
%14 = tail call float @snoise3(float %9, float %11, float %13)
%15 = fadd float %14, 1.000000e+00
%16 = fmul float %15, 5.000000e-01
store float %16, float* %5
%17 = load float, float* %8
%18 = fpext float %17 to double
%19 = fadd double %18, 1.934000e+01
%20 = fptrunc double %19 to float
%21 = load float, float* %10
%22 = fpext float %21 to double
%23 = fadd double %22, 7.660000e+00
%24 = fptrunc double %23 to float
%25 = load float, float* %12
%26 = fpext float %25 to double
%27 = fadd double %26, 3.230000e+00
%28 = fptrunc double %27 to float
%29 = tail call float @snoise3(float %20, float %24, float %28)
%30 = fadd float %29, 1.000000e+00
%31 = fmul float %30, 5.000000e-01
%32 = getelementptr inbounds float, float* %5, i64 1
store float %31, float* %32
%33 = load float, float* %8
%34 = fpext float %33 to double
%35 = fadd double %34, 5.470000e+00
%36 = fptrunc double %35 to float
%37 = load float, float* %10
%38 = fpext float %37 to double
%39 = fadd double %38, 1.785000e+01
%40 = fptrunc double %39 to float
%41 = load float, float* %12
%42 = fpext float %41 to double
%43 = fadd double %42, 1.104000e+01
%44 = fptrunc double %43 to float
%45 = tail call float @snoise3(float %36, float %40, float %44)
%46 = fadd float %45, 1.000000e+00
%47 = fmul float %46, 5.000000e-01
%48 = getelementptr inbounds float, float* %5, i64 2
store float %47, float* %48
ret i32 0
}