// File: /workspace/github_c_makefile_star2_O0/AlexCharlton[P]Hyperscene/src/camera.c
// Function: renderQueues
static void renderQueues(HPScamera *camera){
#ifdef DEBUG
    int nonAlpha = renderQueue.size;
    int alpha = alphaQueue.size;
    if ((alpha != alphaObjects) || (nonAlpha != nonAlphaObjects)){
        printf("Rendering %d non-alpha objects, %d alpha objects\n", nonAlpha, alpha);
        nonAlphaObjects = nonAlpha;
        alphaObjects = alpha;
    }
#endif 
    int i, j, count;
    struct pipeline *p = NULL;
    qsort(renderQueue.data, renderQueue.size, sizeof(void *), &programSort);
    HPSnode **nodes = (HPSnode **) renderQueue.data;
    for (i = 0; i < renderQueue.size;){
        HPSnode *n = *nodes;
        p = n->pipeline;
        p->preRender(n->data);
#ifdef NO_REVERSE_PAINTER
        renderNode(n, camera);
        for (count = 1; count < (renderQueue.size - i);){
            HPSnode *m = *(++nodes);
            if (m->pipeline == p){
                renderNode(m, camera);
                count++;
            } else break;
        }
#else
        HPSnode **m = nodes + 1;
        for (count = 1; count < (renderQueue.size - i);){
            if ((*m)->pipeline == p){
                m++;
                count++;
            } else {
                break;
            }
        }
        qsort(nodes, count, sizeof(void *), renderSort);

        for (j = 0; j < count; j++){
            renderNode(*nodes, camera);
            nodes++;
        }
#endif
        p->postRender();
        i += count;
    }
    qsort(alphaQueue.data, alphaQueue.size, sizeof(void *), alphaSort);
    nodes = (HPSnode **) &alphaQueue.data[0];
    for (i = 0; i < alphaQueue.size;){
        HPSnode *n = *nodes;
        p = n->pipeline;
        p->preRender(n->data);
        renderNode(n, camera);
        for (count = 1; count < (alphaQueue.size - i);){
            HPSnode *m = *(++nodes);
            if (m->pipeline == p){
                renderNode(m, camera);
                count++;
            } else break;
        }
        p->postRender();
        i += count;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq $0x0, -0x20(%rbp)
movq 0x76a5(%rip), %rdi      # 0x135f0
movq 0x76a6(%rip), %rsi      # 0x135f8
movl $0x8, %edx
leaq 0x1642(%rip), %rcx      # 0xd5a0
callq 0x40a0
movq 0x7686(%rip), %rax      # 0x135f0
movq %rax, -0x28(%rbp)
movl $0x0, -0xc(%rbp)
movslq -0xc(%rbp), %rax
cmpq 0x7678(%rip), %rax      # 0x135f8
jae 0xc06e
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq 0x70(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x30(%rbp), %rcx
movq 0x88(%rcx), %rdi
callq *%rax
movq -0x28(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x38(%rbp)
movl $0x1, -0x14(%rbp)
movslq -0x14(%rbp), %rax
movq 0x7628(%rip), %rcx      # 0x135f8
movslq -0xc(%rbp), %rdx
subq %rdx, %rcx
cmpq %rcx, %rax
jae 0xc008
movq -0x38(%rbp), %rax
movq (%rax), %rax
movq 0x70(%rax), %rax
cmpq -0x20(%rbp), %rax
jne 0xc004
movq -0x38(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x38(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xc006
jmp 0xc008
jmp 0xbfc5
movq -0x28(%rbp), %rdi
movslq -0x14(%rbp), %rsi
movl $0x8, %edx
leaq 0x15e4(%rip), %rcx      # 0xd600
callq 0x40a0
movl $0x0, -0x10(%rbp)
movl -0x10(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0xc057
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x8(%rbp), %rsi
callq 0xd650
movq -0x28(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x28(%rbp)
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0xc028
movq -0x20(%rbp), %rcx
movb $0x0, %al
callq *0x18(%rcx)
movl -0x14(%rbp), %eax
addl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
jmp 0xbf75
movq 0x759b(%rip), %rdi      # 0x13610
movq 0x759c(%rip), %rsi      # 0x13618
movl $0x8, %edx
leaq 0x1638(%rip), %rcx      # 0xd6c0
callq 0x40a0
movq 0x757c(%rip), %rax      # 0x13610
movq %rax, -0x28(%rbp)
movl $0x0, -0xc(%rbp)
movslq -0xc(%rbp), %rax
cmpq 0x756e(%rip), %rax      # 0x13618
jae 0xc15f
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq 0x70(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x40(%rbp), %rcx
movq 0x88(%rcx), %rdi
callq *%rax
movq -0x40(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0xd650
movl $0x1, -0x14(%rbp)
movslq -0x14(%rbp), %rax
movq 0x751d(%rip), %rcx      # 0x13618
movslq -0xc(%rbp), %rdx
subq %rdx, %rcx
cmpq %rcx, %rax
jae 0xc148
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x8, %rcx
movq %rcx, -0x28(%rbp)
movq 0x8(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq 0x70(%rax), %rax
cmpq -0x20(%rbp), %rax
jne 0xc144
movq -0x48(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0xd650
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0xc146
jmp 0xc148
jmp 0xc0f0
movq -0x20(%rbp), %rcx
movb $0x0, %al
callq *0x18(%rcx)
movl -0x14(%rbp), %eax
addl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
jmp 0xc09f
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)