// File: /workspace/github_c_makefile_star2_O1/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 $0x98, %rsp
movss %xmm2, 0x10(%rsp)
movss %xmm1, 0x8(%rsp)
cvtss2sd %xmm0, %xmm0
movsd %xmm0, 0x30(%rsp)
callq 0x23f0
movsd %xmm0, 0x20(%rsp)
cvttsd2si %xmm0, %ebx
movl $0xff, %ebp
andl %ebp, %ebx
xorps %xmm0, %xmm0
cvtss2sd 0x8(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
callq 0x23f0
movsd %xmm0, 0x18(%rsp)
cvttsd2si %xmm0, %r15d
andl %ebp, %r15d
xorps %xmm0, %xmm0
cvtss2sd 0x10(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
callq 0x23f0
cvttsd2si %xmm0, %r9d
movsd 0x30(%rsp), %xmm1
subsd 0x20(%rsp), %xmm1
cvtsd2ss %xmm1, %xmm12
movsd 0x8(%rsp), %xmm1
subsd 0x18(%rsp), %xmm1
cvtsd2ss %xmm1, %xmm6
movsd 0x10(%rsp), %xmm1
subsd %xmm0, %xmm1
cvtsd2ss %xmm1, %xmm4
andl %ebp, %r9d
movq 0x11a59(%rip), %rsi     # 0x21ab8
movslq (%rsi,%rbx,4), %rax
addq %r15, %rax
movslq (%rsi,%rax,4), %r14
addq %r9, %r14
movslq 0x4(%rsi,%rax,4), %r8
movslq 0x4(%rsi,%rbx,4), %rax
addq %r15, %rax
movslq (%rsi,%rax,4), %r12
addq %r9, %r12
movl (%rsi,%r14,4), %edi
movl %edi, %ecx
andl $0xf, %ecx
movaps %xmm6, %xmm0
movl %ecx, 0x18(%rsp)
cmpl $0x4, %ecx
jb 0x100a7
movl %edi, %edx
andl $0xd, %edx
movaps %xmm12, %xmm0
cmpl $0xc, %edx
je 0x100a7
movaps %xmm4, %xmm0
movl %edi, 0x8(%rsp)
movslq 0x4(%rsi,%rax,4), %r15
addq %r9, %r8
movl (%rsi,%r12,4), %ecx
movss 0x8a80(%rip), %xmm11    # 0x18b40
addss %xmm12, %xmm11
movl %ecx, %edi
andl $0xf, %edi
movaps %xmm6, %xmm1
cmpl $0x4, %edi
jb 0x100e3
movl %ecx, %eax
andl $0xd, %eax
movaps %xmm11, %xmm1
cmpl $0xc, %eax
je 0x100e3
movaps %xmm4, %xmm1
addq %r9, %r15
movl (%rsi,%r8,4), %r9d
movss 0x8a4d(%rip), %xmm15    # 0x18b40
addss %xmm6, %xmm15
movl %r9d, %r10d
andl $0xf, %r10d
movaps %xmm15, %xmm2
cmpl $0x4, %r10d
jb 0x1011b
movl %r9d, %eax
andl $0xd, %eax
movaps %xmm12, %xmm2
cmpl $0xc, %eax
je 0x1011b
movaps %xmm4, %xmm2
movl (%rsi,%r15,4), %r11d
movl %r11d, %ebx
andl $0xf, %ebx
movaps %xmm15, %xmm10
cmpl $0x4, %ebx
jb 0x10141
movl %r11d, %eax
andl $0xd, %eax
movaps %xmm11, %xmm10
cmpl $0xc, %eax
je 0x10141
movaps %xmm4, %xmm10
movaps %xmm2, 0x20(%rsp)
movl 0x4(%rsi,%r14,4), %ebp
movss 0x89ed(%rip), %xmm2     # 0x18b40
addss %xmm4, %xmm2
movl %ebp, %r14d
andl $0xf, %r14d
movaps %xmm6, %xmm7
cmpl $0x4, %r14d
jb 0x10178
movl %ebp, %eax
andl $0xd, %eax
movaps %xmm12, %xmm7
cmpl $0xc, %eax
je 0x10178
movaps %xmm2, %xmm7
movl 0x4(%rsi,%r12,4), %r12d
movl %r12d, %r13d
andl $0xf, %r13d
movaps %xmm6, %xmm14
cmpl $0x4, %r13d
jb 0x101a1
movl %r12d, %eax
andl $0xd, %eax
movaps %xmm11, %xmm14
cmpl $0xc, %eax
je 0x101a1
movaps %xmm2, %xmm14
movl 0x4(%rsi,%r8,4), %edx
movl %edx, %eax
andl $0xf, %eax
movaps %xmm15, %xmm3
cmpl $0x4, %eax
jb 0x101c8
movl %edx, %r8d
andl $0xd, %r8d
movaps %xmm12, %xmm3
cmpl $0xc, %r8d
je 0x101c8
movaps %xmm2, %xmm3
movl 0x4(%rsi,%r15,4), %esi
movl %esi, %r8d
andl $0xf, %r8d
movaps %xmm15, %xmm5
cmpl $0x4, %r8d
jb 0x101f2
movl %esi, %r15d
andl $0xd, %r15d
movaps %xmm11, %xmm5
cmpl $0xc, %r15d
je 0x101f2
movaps %xmm2, %xmm5
movaps %xmm12, %xmm9
cmpl $0x8, %eax
jb 0x101ff
movaps %xmm15, %xmm9
movaps 0x8929(%rip), %xmm8     # 0x18b30
testb $0x1, %dl
je 0x10210
xorps %xmm8, %xmm9
testb $0x2, %dl
je 0x10219
xorps %xmm8, %xmm3
movaps %xmm11, %xmm13
cmpl $0x8, %r13d
jb 0x10227
movaps %xmm6, %xmm13
testb $0x1, %r12b
je 0x10231
xorps %xmm8, %xmm13
testb $0x2, %r12b
movaps %xmm1, 0x30(%rsp)
je 0x10240
xorps %xmm8, %xmm14
movaps %xmm12, %xmm1
cmpl $0x8, %r14d
jb 0x1024d
movaps %xmm6, %xmm1
testb $0x1, %bpl
je 0x10257
xorps %xmm8, %xmm1
testb $0x2, %bpl
je 0x10261
xorps %xmm8, %xmm7
movaps %xmm11, %xmm2
cmpl $0x8, %ebx
jb 0x1026e
movaps %xmm15, %xmm2
testb $0x1, %r11b
je 0x10278
xorps %xmm8, %xmm2
testb $0x2, %r11b
movaps %xmm9, 0x50(%rsp)
je 0x10288
xorps %xmm8, %xmm10
movaps %xmm7, 0x70(%rsp)
movaps %xmm12, %xmm9
cmpl $0x8, %r10d
jb 0x1029b
movaps %xmm15, %xmm9
movaps %xmm14, 0x40(%rsp)
movss 0x889b(%rip), %xmm7     # 0x18b44
testb $0x1, %r9b
je 0x102b9
movaps %xmm8, %xmm14
xorps %xmm8, %xmm9
jmp 0x102bd
movaps %xmm8, %xmm14
movaps %xmm12, %xmm8
mulss %xmm7, %xmm8
testb $0x2, %r9b
movaps %xmm5, 0x60(%rsp)
je 0x102df
movaps 0x20(%rsp), %xmm5
xorps %xmm14, %xmm5
movaps %xmm5, 0x20(%rsp)
movaps %xmm3, 0x80(%rsp)
addss 0x8858(%rip), %xmm8     # 0x18b48
movaps %xmm11, %xmm5
cmpl $0x8, %edi
jb 0x102fc
movaps %xmm6, %xmm5
movaps %xmm12, %xmm3
mulss %xmm12, %xmm3
mulss %xmm12, %xmm8
testb $0x1, %cl
movl 0x8(%rsp), %eax
movss %xmm4, 0x10(%rsp)
je 0x1031d
xorps %xmm14, %xmm5
movaps %xmm6, %xmm4
mulss %xmm7, %xmm4
mulss %xmm12, %xmm3
addss 0x7382(%rip), %xmm8     # 0x176b4
addss %xmm10, %xmm2
addss 0x20(%rsp), %xmm9
testb $0x2, %cl
je 0x10353
movaps 0x30(%rsp), %xmm10
xorps %xmm14, %xmm10
movaps %xmm10, 0x30(%rsp)
addss 0x87ed(%rip), %xmm4     # 0x18b48
mulss %xmm8, %xmm3
subss %xmm9, %xmm2
cmpl $0x8, 0x18(%rsp)
jb 0x10370
movaps %xmm6, %xmm12
movaps %xmm6, %xmm10
mulss %xmm6, %xmm10
mulss %xmm6, %xmm4
mulss %xmm3, %xmm2
testb $0x1, %al
movaps %xmm14, %xmm8
je 0x1038d
xorps %xmm8, %xmm12
movaps 0x40(%rsp), %xmm14
addss %xmm14, %xmm13
addss 0x70(%rsp), %xmm1
mulss %xmm6, %xmm10
addss 0x7309(%rip), %xmm4     # 0x176b4
addss %xmm9, %xmm2
addss 0x30(%rsp), %xmm5
testb $0x2, %al
je 0x103be
xorps %xmm8, %xmm0
movaps 0x50(%rsp), %xmm6
addss %xmm0, %xmm12
subss %xmm1, %xmm13
mulss %xmm4, %xmm10
subss %xmm12, %xmm5
mulss %xmm3, %xmm5
addss %xmm12, %xmm5
subss %xmm5, %xmm2
movss 0x10(%rsp), %xmm4
movaps %xmm4, %xmm0
mulss %xmm4, %xmm0
mulss %xmm4, %xmm7
addss 0x874b(%rip), %xmm7     # 0x18b48
mulss %xmm4, %xmm7
cmpl $0x8, %r8d
jb 0x1040b
movaps %xmm15, %xmm11
mulss %xmm3, %xmm13
mulss %xmm10, %xmm2
mulss %xmm4, %xmm0
addss 0x7293(%rip), %xmm7     # 0x176b4
testb $0x1, %sil
je 0x1042b
xorps %xmm8, %xmm11
addss 0x80(%rsp), %xmm6
addss %xmm1, %xmm13
addss %xmm5, %xmm2
mulss %xmm7, %xmm0
testb $0x2, %sil
je 0x10452
movaps 0x60(%rsp), %xmm1
xorps %xmm8, %xmm1
jmp 0x10457
movaps 0x60(%rsp), %xmm1
addss %xmm1, %xmm11
subss %xmm6, %xmm11
mulss %xmm11, %xmm3
addss %xmm6, %xmm3
subss %xmm13, %xmm3
mulss %xmm3, %xmm10
addss %xmm13, %xmm10
subss %xmm2, %xmm10
mulss %xmm10, %xmm0
addss %xmm2, %xmm0
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq