#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 dendroid_base_octave(float, float, int);
int dnnoise_2d(float, float, int, float (*)(float, float, int), int);
float fractal_dendroid_noise(float x, float y) {
  float base = dendroid_base_octave(x, y, 187);
  float add = -1 + 2 * dnnoise_2d(x, y, 171, &dendroid_base_octave, 187);
  return (base + 0.5 * add) / 1.5;
}


x86 assembly (clang, -O0):
<fractal_dendroid_noise>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
mov    $0xbb,%edi
call   1040 <dendroid_base_octave@plt>
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
mov    $0xab,%edi
mov    0x2e8f(%rip),%rsi
mov    $0xbb,%edx
call   1030 <dnnoise_2d@plt>
shl    $0x1,%eax
add    $0xffffffff,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe82(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe6a(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fractal_dendroid_noise>:
sub    $0x18,%rsp
movss  %xmm1,0x10(%rsp)
movss  %xmm0,0xc(%rsp)
mov    $0xbb,%edi
call   1040 <dendroid_base_octave@plt>
movss  %xmm0,0x14(%rsp)
mov    0x2ea9(%rip),%rsi
movss  0xc(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
mov    $0xab,%edi
mov    $0xbb,%edx
call   1030 <dnnoise_2d@plt>
add    %eax,%eax
add    $0xffffffff,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  0x14(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
cvtss2sd %xmm0,%xmm0
mulsd  0xe8c(%rip),%xmm0
addsd  %xmm1,%xmm0
divsd  0xe88(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @fractal_dendroid_noise(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %3
store float %1, float* %4
%7 = load float, float* %3
%8 = load float, float* %4
%9 = call float @dendroid_base_octave(float %7, float %8, i32 187)
store float %9, float* %5
%10 = load float, float* %3
%11 = load float, float* %4
%12 = call i32 @dnnoise_2d(float %10, float %11, i32 171, float (float, float, i32)* @dendroid_base_octave, i32 187)
%13 = mul nsw i32 2, %12
%14 = add nsw i32 -1, %13
%15 = sitofp i32 %14 to float
store float %15, float* %6
%16 = load float, float* %5
%17 = fpext float %16 to double
%18 = load float, float* %6
%19 = fpext float %18 to double
%20 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %19, double %17)
%21 = fdiv double %20, 1.500000e+00
%22 = fptrunc double %21 to float
ret float %22
}

LLVM IR (-O2):
define float @fractal_dendroid_noise(float %0, float %1) {
%3 = tail call float @dendroid_base_octave(float %0, float %1, i32 187)
%4 = tail call i32 @dnnoise_2d(float %0, float %1, i32 171, float (float, float, i32)* @dendroid_base_octave, i32 187)
%5 = shl nsw i32 %4, 1
%6 = add nsw i32 %5, -1
%7 = sitofp i32 %6 to float
%8 = fpext float %3 to double
%9 = fpext float %7 to double
%10 = tail call double @llvm.fmuladd.f64(double %9, double 5.000000e-01, double %8)
%11 = fdiv double %10, 1.500000e+00
%12 = fptrunc double %11 to float
ret float %12
}