// File: /workspace/github_c_makefile_star2_O0/AlexCharlton[P]Hyperscene/src/lighting.c
// Function: hpsLightingPreRender
void hpsLightingPreRender(void *data){
    SceneLighting *sLighting = (SceneLighting *) data;
    hpsCurrentAmbientLight[0] = sLighting->ambient.r;
    hpsCurrentAmbientLight[1] = sLighting->ambient.g;
    hpsCurrentAmbientLight[2] = sLighting->ambient.b;

    currentLights = lightQueue.size;
    currentLights = (currentLights > hpsMaxLights) ? hpsMaxLights : currentLights;
    int i;
    for (i = 0; i < currentLights; i++){
        HPSnode *node = (HPSnode *) lightQueue.data[i];
        Light *l = (Light *) hpsNodeData(node);
        float *bs = hpsNodeBoundingSphere(node);
        hpsCurrentLightIntensities[i] = l->intensity;
        hpsCurrentLightPositions[i*3]   = bs[0];
        hpsCurrentLightPositions[i*3+1] = bs[1];
        hpsCurrentLightPositions[i*3+2] = bs[2];
        hpsCurrentLightColors[i*3]   = l->color.r;
        hpsCurrentLightColors[i*3+1] = l->color.g;
        hpsCurrentLightColors[i*3+2] = l->color.b;
        hpsCurrentLightDirections[i*3]   = l->worldDirection.x;
        hpsCurrentLightDirections[i*3+1] = l->worldDirection.y;
        hpsCurrentLightDirections[i*3+2] = l->worldDirection.z;
        hpsCurrentLightDirections[i*3+3] = l->spotAngle;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movss (%rax), %xmm0
movq 0x487d(%rip), %rax      # 0x12f90
movq (%rax), %rax
movss %xmm0, (%rax)
movq -0x10(%rbp), %rax
movss 0x4(%rax), %xmm0
movq 0x4866(%rip), %rax      # 0x12f90
movq (%rax), %rax
movss %xmm0, 0x4(%rax)
movq -0x10(%rbp), %rax
movss 0x8(%rax), %xmm0
movq 0x484e(%rip), %rax      # 0x12f90
movq (%rax), %rax
movss %xmm0, 0x8(%rax)
movq 0x4f37(%rip), %rax      # 0x13688
movl %eax, %ecx
movq 0x4846(%rip), %rax      # 0x12fa0
movl %ecx, (%rax)
movq 0x483d(%rip), %rax      # 0x12fa0
movl (%rax), %eax
movq 0x482c(%rip), %rcx      # 0x12f98
cmpl (%rcx), %eax
jbe 0xe77e
movq 0x4821(%rip), %rax      # 0x12f98
movl (%rax), %eax
movl %eax, -0x34(%rbp)
jmp 0xe78a
movq 0x481b(%rip), %rax      # 0x12fa0
movl (%rax), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %ecx
movq 0x480c(%rip), %rax      # 0x12fa0
movl %ecx, (%rax)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq 0x47f9(%rip), %rcx      # 0x12fa0
cmpl (%rcx), %eax
jae 0xe94f
movq 0x4eca(%rip), %rax      # 0x13680
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rdi
callq 0x44a0
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rdi
callq 0x41d0
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movss 0x28(%rax), %xmm0
movq 0x47d4(%rip), %rax      # 0x12fc0
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
movss %xmm0, (%rax,%rcx,4)
movq -0x30(%rbp), %rax
movss (%rax), %xmm0
movq 0x4761(%rip), %rax      # 0x12f68
movq (%rax), %rax
imull $0x3, -0x14(%rbp), %ecx
movslq %ecx, %rcx
movss %xmm0, (%rax,%rcx,4)
movq -0x30(%rbp), %rax
movss 0x4(%rax), %xmm0
movq 0x4742(%rip), %rax      # 0x12f68
movq (%rax), %rax
imull $0x3, -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movss %xmm0, (%rax,%rcx,4)
movq -0x30(%rbp), %rax
movss 0x8(%rax), %xmm0
movq 0x4720(%rip), %rax      # 0x12f68
movq (%rax), %rax
imull $0x3, -0x14(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movss %xmm0, (%rax,%rcx,4)
movq -0x28(%rbp), %rax
movss (%rax), %xmm0
movq 0x475f(%rip), %rax      # 0x12fc8
movq (%rax), %rax
imull $0x3, -0x14(%rbp), %ecx
movslq %ecx, %rcx
movss %xmm0, (%rax,%rcx,4)
movq -0x28(%rbp), %rax
movss 0x4(%rax), %xmm0
movq 0x4740(%rip), %rax      # 0x12fc8
movq (%rax), %rax
imull $0x3, -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movss %xmm0, (%rax,%rcx,4)
movq -0x28(%rbp), %rax
movss 0x8(%rax), %xmm0
movq 0x471e(%rip), %rax      # 0x12fc8
movq (%rax), %rax
imull $0x3, -0x14(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movss %xmm0, (%rax,%rcx,4)
movq -0x28(%rbp), %rax
movss 0x18(%rax), %xmm0
movq 0x46ac(%rip), %rax      # 0x12f78
movq (%rax), %rax
imull $0x3, -0x14(%rbp), %ecx
movslq %ecx, %rcx
movss %xmm0, (%rax,%rcx,4)
movq -0x28(%rbp), %rax
movss 0x1c(%rax), %xmm0
movq 0x468d(%rip), %rax      # 0x12f78
movq (%rax), %rax
imull $0x3, -0x14(%rbp), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movss %xmm0, (%rax,%rcx,4)
movq -0x28(%rbp), %rax
movss 0x20(%rax), %xmm0
movq 0x466b(%rip), %rax      # 0x12f78
movq (%rax), %rax
imull $0x3, -0x14(%rbp), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movss %xmm0, (%rax,%rcx,4)
movq -0x28(%rbp), %rax
movss 0x24(%rax), %xmm0
movq 0x4649(%rip), %rax      # 0x12f78
movq (%rax), %rax
imull $0x3, -0x14(%rbp), %ecx
addl $0x3, %ecx
movslq %ecx, %rcx
movss %xmm0, (%rax,%rcx,4)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xe79d
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)