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


x86 assembly (clang, -O0):
<f_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)
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_snoiseP>:
push   %rbx
mov    (%rdx),%rbx
mov    0x8(%rdx),%rax
movss  (%rax),%xmm0
movss  0x4(%rax),%xmm1
movss  0x8(%rax),%xmm2
call   1030 <snoise3@plt>
addss  0xecd(%rip),%xmm0
mulss  0xec9(%rip),%xmm0
movss  %xmm0,(%rbx)
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @f_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
store float %28, float* %29
ret i32 0
}

LLVM IR (-O2):
define i32 @f_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
ret i32 0
}