// File: /workspace/github_c_makefile_star2_O3/Ziddykins[P]Dawn/src/util.c
// Function: noise
float noise(float x, float y, float z) {
    int X = (int) (floor(x)) & 255,                  // FIND UNIT CUBE THAT
            Y = (int) (floor(y)) & 255,                  // CONTAINS POINT.
            Z = (int) (floor(z)) & 255;
    x -= floor(x);                                // FIND RELATIVE X,Y,Z
    y -= floor(y);                                // OF POINT IN CUBE.
    z -= floor(z);
    float u = fade(x),                                // COMPUTE FADE CURVES
            v = fade(y),                                // FOR EACH OF X,Y,Z.
            w = fade(z);
    int A = p_noise_arr[X] + Y;
    int AA = p_noise_arr[A] + Z;
    int AB = p_noise_arr[A + 1] + Z; // HASH COORDINATES OF
    int B = p_noise_arr[X + 1] + Y;
    int BA = p_noise_arr[B] + Z;
    int BB = p_noise_arr[B + 1] + Z; // THE 8 CUBE CORNERS,

    return lerp(w, lerp(v, lerp(u, grad(p_noise_arr[AA], x, y, z),  // AND ADD
                                grad(p_noise_arr[BA], x - 1, y, z)), // BLENDED
                        lerp(u, grad(p_noise_arr[AB], x, y - 1, z),  // RESULTS
                             grad(p_noise_arr[BB], x - 1, y - 1, z))),// FROM  8
                lerp(v, lerp(u, grad(p_noise_arr[AA + 1], x, y, z - 1),  // CORNERS
                             grad(p_noise_arr[BA + 1], x - 1, y, z - 1)), // OF CUBE
                     lerp(u, grad(p_noise_arr[AB + 1], x, y - 1, z - 1),
                          grad(p_noise_arr[BB + 1], x - 1, y - 1, z - 1))));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movss %xmm2, 0x8(%rsp)
movss %xmm1, 0x20(%rsp)
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x40(%rsp)
callq 0x23f0
movsd %xmm0, 0x30(%rsp)
cvttsd2si %xmm0, %ebx
movl $0xff, %ebp
andl %ebp, %ebx
xorps %xmm0, %xmm0
cvtss2sd 0x20(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
callq 0x23f0
movsd %xmm0, 0x10(%rsp)
cvttsd2si %xmm0, %r14d
andl %ebp, %r14d
xorps %xmm0, %xmm0
cvtss2sd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
callq 0x23f0
cvttsd2si %xmm0, %edx
movsd 0x40(%rsp), %xmm1
subsd 0x30(%rsp), %xmm1
cvtsd2ss %xmm1, %xmm7
movsd 0x20(%rsp), %xmm1
subsd 0x10(%rsp), %xmm1
cvtsd2ss %xmm1, %xmm10
movsd 0x8(%rsp), %xmm1
subsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm6
andl %ebp, %edx
movq 0x11784(%rip), %r9      # 0x21ab8
movslq (%r9,%rbx,4), %rax
addq %r14, %rax
movslq (%r9,%rax,4), %r10
addq %rdx, %r10
movslq 0x4(%r9,%rax,4), %r11
movslq 0x4(%r9,%rbx,4), %rcx
addq %r14, %rcx
movslq (%r9,%rcx,4), %r12
addq %rdx, %r12
movl (%r9,%r10,4), %edi
movl %edi, %eax
andl $0xf, %eax
movaps %xmm10, %xmm0
cmpl $0x4, %eax
jb 0x10378
movl %edi, %esi
andl $0xd, %esi
movaps %xmm7, %xmm0
cmpl $0xc, %esi
je 0x10378
movaps %xmm6, %xmm0
movaps %xmm0, 0x50(%rsp)
movslq 0x4(%r9,%rcx,4), %r14
addq %rdx, %r11
movl (%r9,%r12,4), %r8d
movss 0x885f(%rip), %xmm2     # 0x18bf0
addss %xmm7, %xmm2
movl %r8d, %esi
andl $0xf, %esi
movaps %xmm10, %xmm0
cmpl $0x4, %esi
jb 0x103b5
movl %r8d, %ecx
andl $0xd, %ecx
movaps %xmm2, %xmm0
cmpl $0xc, %ecx
je 0x103b5
movaps %xmm6, %xmm0
addq %rdx, %r14
movl (%r9,%r11,4), %r15d
movss 0x882c(%rip), %xmm4     # 0x18bf0
addss %xmm10, %xmm4
movl %r15d, %ebp
andl $0xf, %ebp
movaps %xmm4, %xmm5
cmpl $0x4, %ebp
jb 0x103e8
movl %r15d, %ecx
andl $0xd, %ecx
movaps %xmm7, %xmm5
cmpl $0xc, %ecx
je 0x103e8
movaps %xmm6, %xmm5
movl (%r9,%r14,4), %ebx
movl %ebx, %edx
andl $0xf, %edx
movaps %xmm4, %xmm3
cmpl $0x4, %edx
jb 0x10409
movl %ebx, %ecx
andl $0xd, %ecx
movaps %xmm2, %xmm3
cmpl $0xc, %ecx
je 0x10409
movaps %xmm6, %xmm3
movl %ebx, 0x60(%rsp)
movl 0x4(%r9,%r10,4), %ebx
movss 0x87d6(%rip), %xmm1     # 0x18bf0
addss %xmm6, %xmm1
movl %ebx, %r10d
andl $0xf, %r10d
movaps %xmm10, %xmm13
cmpl $0x4, %r10d
jb 0x10441
movl %ebx, %ecx
andl $0xd, %ecx
movaps %xmm7, %xmm13
cmpl $0xc, %ecx
je 0x10441
movaps %xmm1, %xmm13
movl 0x4(%r9,%r12,4), %r13d
movl %r13d, %r12d
andl $0xf, %r12d
movaps %xmm10, %xmm8
cmpl $0x4, %r12d
jb 0x1046a
movl %r13d, %ecx
andl $0xd, %ecx
movaps %xmm2, %xmm8
cmpl $0xc, %ecx
je 0x1046a
movaps %xmm1, %xmm8
movl %edi, 0x10(%rsp)
movl 0x4(%r9,%r11,4), %edi
movl %edi, %ecx
andl $0xf, %ecx
movaps %xmm4, %xmm11
cmpl $0x4, %ecx
jb 0x10496
movl %edi, %r11d
andl $0xd, %r11d
movaps %xmm7, %xmm11
cmpl $0xc, %r11d
je 0x10496
movaps %xmm1, %xmm11
movss %xmm6, 0x8(%rsp)
movl 0x4(%r9,%r14,4), %r11d
movl %r11d, %r9d
andl $0xf, %r9d
movaps %xmm4, 0x40(%rsp)
cmpl $0x4, %r9d
jb 0x104c6
movl %r11d, %r14d
andl $0xd, %r14d
movaps %xmm2, %xmm4
cmpl $0xc, %r14d
je 0x104c6
movaps %xmm1, %xmm4
movd %r15d, %xmm1
movd %edi, %xmm15
movaps %xmm2, 0x90(%rsp)
movd %ebp, %xmm2
unpcklps %xmm3, %xmm4            # xmm4 = xmm4[0],xmm3[0],xmm4[1],xmm3[1]
movaps %xmm4, 0x20(%rsp)
movd %ecx, %xmm6
punpckldq %xmm1, %xmm15   # xmm15 = xmm15[0],xmm1[0],xmm15[1],xmm1[1]
punpckldq %xmm2, %xmm6    # xmm6 = xmm6[0],xmm2[0],xmm6[1],xmm2[1]
movdqa 0x86d7(%rip), %xmm1     # 0x18bd0
movdqa %xmm1, %xmm9
movdqa %xmm1, %xmm2
pcmpgtd %xmm6, %xmm9
unpcklps %xmm5, %xmm11           # xmm11 = xmm11[0],xmm5[0],xmm11[1],xmm5[1]
movaps %xmm11, 0x70(%rsp)
movaps %xmm7, %xmm1
mulss %xmm7, %xmm1
mulss %xmm7, %xmm1
movss 0x86d0(%rip), %xmm4     # 0x18bf4
movaps %xmm7, 0x30(%rsp)
movaps %xmm7, %xmm12
mulss %xmm4, %xmm12
movss 0x86bd(%rip), %xmm14    # 0x18bf8
addss %xmm14, %xmm12
mulss %xmm7, %xmm12
movss 0x71c7(%rip), %xmm3     # 0x17714
addss %xmm3, %xmm12
mulss %xmm1, %xmm12
movd %r8d, %xmm5
movd %r13d, %xmm1
punpckldq %xmm5, %xmm1    # xmm1 = xmm1[0],xmm5[0],xmm1[1],xmm5[1]
movd %esi, %xmm5
movd %r12d, %xmm6
punpckldq %xmm5, %xmm6    # xmm6 = xmm6[0],xmm5[0],xmm6[1],xmm5[1]
movdqa %xmm2, %xmm7
pcmpgtd %xmm6, %xmm7
unpcklps %xmm0, %xmm8            # xmm8 = xmm8[0],xmm0[0],xmm8[1],xmm0[1]
movaps %xmm8, 0x80(%rsp)
movd 0x10(%rsp), %xmm6
movd %ebx, %xmm5
punpckldq %xmm6, %xmm5    # xmm5 = xmm5[0],xmm6[0],xmm5[1],xmm6[1]
movd %eax, %xmm6
movd %r10d, %xmm8
punpckldq %xmm6, %xmm8    # xmm8 = xmm8[0],xmm6[0],xmm8[1],xmm6[1]
movdqa %xmm2, %xmm11
pcmpgtd %xmm8, %xmm11
unpcklps 0x50(%rsp), %xmm13      # xmm13 = xmm13[0],mem[0],xmm13[1],mem[1]
movaps %xmm13, 0x50(%rsp)
movaps %xmm10, %xmm6
mulss %xmm10, %xmm6
mulss %xmm10, %xmm6
movaps %xmm10, %xmm0
mulss %xmm4, %xmm0
addss %xmm14, %xmm0
mulss %xmm10, %xmm0
addss %xmm3, %xmm0
mulss %xmm6, %xmm0
movd 0x60(%rsp), %xmm6
movd %r11d, %xmm14
punpckldq %xmm6, %xmm14   # xmm14 = xmm14[0],xmm6[0],xmm14[1],xmm6[1]
movd %edx, %xmm6
movd %r9d, %xmm8
punpckldq %xmm6, %xmm8    # xmm8 = xmm8[0],xmm6[0],xmm8[1],xmm6[1]
pcmpgtd %xmm8, %xmm2
movdqa %xmm2, 0x10(%rsp)
movdqa 0x85ae(%rip), %xmm6     # 0x18bc0
movdqa %xmm15, %xmm8
pand %xmm6, %xmm8
movdqa 0x85bc(%rip), %xmm2     # 0x18be0
pand %xmm2, %xmm15
movdqa %xmm1, %xmm13
pand %xmm6, %xmm13
pand %xmm2, %xmm1
movaps %xmm10, 0x60(%rsp)
movdqa %xmm5, %xmm10
pand %xmm6, %xmm10
pand %xmm2, %xmm5
pand %xmm14, %xmm6
pand %xmm2, %xmm14
movss 0x8(%rsp), %xmm3
mulss %xmm3, %xmm4
addss 0x8591(%rip), %xmm4     # 0x18bf8
movaps %xmm3, %xmm2
mulss %xmm3, %xmm2
mulss %xmm3, %xmm2
mulss %xmm3, %xmm4
addss 0x7096(%rip), %xmm4     # 0x17714
mulss %xmm2, %xmm4
movss %xmm4, 0x8(%rsp)
movaps 0x30(%rsp), %xmm2
shufps $0x0, %xmm2, %xmm2      # xmm2 = xmm2[0,0,0,0]
movaps %xmm2, 0x30(%rsp)
movaps 0x40(%rsp), %xmm4
shufps $0x0, %xmm4, %xmm4      # xmm4 = xmm4[0,0,0,0]
movaps %xmm4, 0x40(%rsp)
andps %xmm9, %xmm2
andnps %xmm4, %xmm9
orps %xmm2, %xmm9
xorps %xmm2, %xmm2
pcmpeqd %xmm2, %xmm8
movaps 0xbf1(%rip), %xmm2      # 0x112b0
movaps %xmm9, %xmm3
xorps %xmm2, %xmm3
andps %xmm8, %xmm9
andnps %xmm3, %xmm8
orps %xmm9, %xmm8
movaps 0x70(%rsp), %xmm4
movaps %xmm4, %xmm3
xorps %xmm2, %xmm3
xorps %xmm9, %xmm9
pcmpeqd %xmm9, %xmm15
andps %xmm15, %xmm4
andnps %xmm3, %xmm15
orps %xmm4, %xmm15
addps %xmm8, %xmm15
movaps 0x90(%rsp), %xmm4
shufps $0x0, %xmm4, %xmm4      # xmm4 = xmm4[0,0,0,0]
movaps 0x60(%rsp), %xmm8
shufps $0x0, %xmm8, %xmm8      # xmm8 = xmm8[0,0,0,0]
movaps %xmm4, %xmm3
andps %xmm7, %xmm3
andnps %xmm8, %xmm7
orps %xmm3, %xmm7
pcmpeqd %xmm9, %xmm13
movaps %xmm7, %xmm3
xorps %xmm2, %xmm3
andps %xmm13, %xmm7
andnps %xmm3, %xmm13
orps %xmm7, %xmm13
movaps 0x80(%rsp), %xmm7
movaps %xmm7, %xmm3
xorps %xmm2, %xmm3
pcmpeqd %xmm9, %xmm1
andps %xmm1, %xmm7
andnps %xmm3, %xmm1
orps %xmm7, %xmm1
addps %xmm13, %xmm1
movdqa 0x30(%rsp), %xmm3
pand %xmm11, %xmm3
pandn %xmm8, %xmm11
por %xmm3, %xmm11
pxor %xmm8, %xmm8
pcmpeqd %xmm8, %xmm10
movdqa %xmm11, %xmm3
pxor %xmm2, %xmm3
pand %xmm10, %xmm11
pandn %xmm3, %xmm10
por %xmm11, %xmm10
movdqa 0x50(%rsp), %xmm7
movdqa %xmm7, %xmm3
pxor %xmm2, %xmm3
pcmpeqd %xmm8, %xmm5
pand %xmm5, %xmm7
pandn %xmm3, %xmm5
por %xmm7, %xmm5
addps %xmm10, %xmm5
subps %xmm5, %xmm1
shufps $0x0, %xmm12, %xmm12    # xmm12 = xmm12[0,0,0,0]
mulps %xmm12, %xmm1
addps %xmm5, %xmm1
movaps 0x10(%rsp), %xmm5
andps %xmm5, %xmm4
andnps 0x40(%rsp), %xmm5
orps %xmm4, %xmm5
movdqa 0x20(%rsp), %xmm4
movdqa %xmm4, %xmm3
pxor %xmm2, %xmm3
pcmpeqd %xmm8, %xmm6
xorps %xmm5, %xmm2
andps %xmm6, %xmm5
andnps %xmm2, %xmm6
orps %xmm5, %xmm6
pcmpeqd %xmm8, %xmm14
pand %xmm14, %xmm4
pandn %xmm3, %xmm14
por %xmm4, %xmm14
addps %xmm6, %xmm14
subps %xmm15, %xmm14
mulps %xmm12, %xmm14
addps %xmm15, %xmm14
subps %xmm1, %xmm14
shufps $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
mulps %xmm14, %xmm0
addps %xmm1, %xmm0
movaps %xmm0, %xmm1
shufps $0x55, %xmm0, %xmm1     # xmm1 = xmm1[1,1],xmm0[1,1]
subss %xmm1, %xmm0
mulss 0x8(%rsp), %xmm0
addss %xmm1, %xmm0
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq