// File: /workspace/github_c_makefile_star2_O0/FredTheDino[P]Fog/src/engine/renderer/opengl_renderer.cpp
// Function: Renderer::Impl::blit()
void blit() {
    glBindBuffer(GL_UNIFORM_BUFFER, ubo_global);
    glBufferSubData(GL_UNIFORM_BUFFER, 0, ubo_global_size, &_fog_global_window_state);
    glBindBuffer(GL_UNIFORM_BUFFER, 0);

    for (u32 cam = 0; cam < OPENGL_NUM_CAMERAS; cam++) {
        glBindFramebuffer(GL_FRAMEBUFFER, screen_fbos[cam]);
        glClearColor(0.1f, 0.2f, 0.3f, 1.0f);
        clear();
        u32 bit = (cam == 0) ? 1 : (1 << cam);
        if (!(_fog_active_cameras & bit)) continue;

        master_shader_program.bind();
        glUniform1ui(master_shader_current_cam_loc, cam);
        for (u32 layer = 0; layer < OPENGL_NUM_LAYERS; layer++)
            sprite_render_queues[layer].draw();

        font_shader_program.bind();
        // TODO(ed): Some way to do camera specific text or rendering
        // would probably be good.
        glUniform1ui(master_shader_current_cam_loc, cam);
        font_render_queue.draw();
    }

    glBindFramebuffer(GL_FRAMEBUFFER, 0);
    glClearColor(0.1f, 0.3f, 0.2f, 1.0f);
    clear();
    render_post_processing();
    // TODO(ed): This is where screen space reflections can be rendered.
    // TODO(ed): Passing values is kinda tricky right now, might need some
    // way to pass uniforms to the shader...

    SDL_GL_SwapWindow(window);

    font_render_queue.clear();
    for (u32 layer = 0; layer < OPENGL_NUM_LAYERS; layer++)
        sprite_render_queues[layer].clear();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
leaq 0x51631(%rip), %rax     # 0x7eab0
movq (%rax), %rax
movl 0x57e44(%rip), %esi     # 0x852cc
movl $0x8a11, %edi           # imm = 0x8A11
callq *%rax
movl $0x8a11, %edi           # imm = 0x8A11
xorl %eax, %eax
movl %eax, %esi
movl $0x50, %edx
leaq 0x57dd8(%rip), %rcx     # 0x8527c
leaq 0x51685(%rip), %rax     # 0x7eb30
callq *(%rax)
movl $0x8a11, %edi           # imm = 0x8A11
xorl %esi, %esi
leaq 0x515f5(%rip), %rax     # 0x7eab0
callq *(%rax)
movl $0x0, -0x4(%rbp)
cmpl $0x2, -0x4(%rbp)
jae 0x2d5e5
leaq 0x515fb(%rip), %rax     # 0x7ead0
movq (%rax), %rax
movl -0x4(%rbp), %ecx
movl %ecx, %edx
leaq 0x57d50(%rip), %rcx     # 0x85234
movl (%rcx,%rdx,4), %esi
movl $0x8d40, %edi           # imm = 0x8D40
callq *%rax
movss 0x17d1e(%rip), %xmm0    # 0x45214
movss 0x17b0e(%rip), %xmm1    # 0x4500c
movss 0x17d1a(%rip), %xmm2    # 0x45220
movss 0x17afa(%rip), %xmm3    # 0x45008
leaq 0x51673(%rip), %rax     # 0x7eb88
callq *(%rax)
callq 0x2d450
cmpl $0x0, -0x4(%rbp)
jne 0x2d52c
movl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2d539
movl -0x4(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x8(%rbp)
leaq 0x3d402(%rip), %rax     # 0x6a948
movl (%rax), %eax
andl -0x8(%rbp), %eax
cmpl $0x0, %eax
jne 0x2d555
jmp 0x2d5d7
leaq 0x57a9c(%rip), %rdi     # 0x84ff8
callq 0x41a10
leaq 0x52590(%rip), %rax     # 0x7faf8
movq (%rax), %rax
leaq 0x57a8a(%rip), %rcx     # 0x84ffc
movl (%rcx), %edi
movl -0x4(%rbp), %esi
callq *%rax
movl $0x0, -0xc(%rbp)
cmpl $0x10, -0xc(%rbp)
jae 0x2d5a7
movl -0xc(%rbp), %eax
leaq 0x57a80(%rip), %rdi     # 0x85010
shlq $0x5, %rax
addq %rax, %rdi
callq 0x41e90
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x2d580
leaq 0x57a52(%rip), %rdi     # 0x85000
callq 0x41a10
leaq 0x5253e(%rip), %rax     # 0x7faf8
movq (%rax), %rax
leaq 0x57a38(%rip), %rcx     # 0x84ffc
movl (%rcx), %edi
movl -0x4(%rbp), %esi
callq *%rax
leaq 0x57c3e(%rip), %rdi     # 0x85210
callq 0x41f60
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x2d4c4
movl $0x8d40, %edi           # imm = 0x8D40
xorl %esi, %esi
leaq 0x514dd(%rip), %rax     # 0x7ead0
callq *(%rax)
movss 0x17c17(%rip), %xmm0    # 0x45214
movss 0x17c1b(%rip), %xmm1    # 0x45220
movss 0x179ff(%rip), %xmm2    # 0x4500c
movss 0x179f3(%rip), %xmm3    # 0x45008
leaq 0x5156c(%rip), %rax     # 0x7eb88
callq *(%rax)
callq 0x2d450
callq 0x2bc60
leaq 0x57c31(%rip), %rax     # 0x85260
movq (%rax), %rdi
callq 0x21f0
leaq 0x57bd2(%rip), %rdi     # 0x85210
callq 0x42030
movl $0x0, -0x10(%rbp)
cmpl $0x10, -0x10(%rbp)
jae 0x2d671
movl -0x10(%rbp), %eax
leaq 0x579b6(%rip), %rdi     # 0x85010
shlq $0x5, %rax
addq %rax, %rdi
callq 0x42080
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x2d64a
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)