// File: /workspace/github_c_makefile_star2_O0/nkanaev[P]tipsy/src/tigr.c
// Function: tigrGAPIPresent
void tigrGAPIPresent(Tigr* bmp, int w, int h) {
    TigrInternal* win = tigrInternal(bmp);
    GLStuff* gl = &win->gl;

    glViewport(0, 0, w, h);
    if (!gl->gl_user_opengl_rendering) {
        glClearColor(0, 0, 0, 1);
        glClear(GL_COLOR_BUFFER_BIT);
    }

    if (!gl->gl_legacy) {
        float projection[16] = { 2.0f / w, 0.0f, 0.0f, 0.0f, 0.0f,  -2.0f / h, 0.0f, 0.0f,
                                 0.0f,     0.0f, 1.0f, 0.0f, -1.0f, 1.0f,      0.0f, 1.0f };

        glActiveTexture(GL_TEXTURE0);
        glBindVertexArray(gl->vao);
        glUseProgram(gl->program);
        glUniformMatrix4fv(gl->uniform_projection, 1, GL_FALSE, projection);
        glUniform4f(gl->uniform_parameters, win->p1, win->p2, win->p3, win->p4);
    } else {
#if !(__APPLE__ || __ANDROID__)
        glMatrixMode(GL_PROJECTION);
        glLoadIdentity();
        glOrtho(0, w, h, 0, -1.0f, 1.0f);
        glEnable(GL_TEXTURE_2D);
#else
        assert(0);
#endif
    }

    if (gl->gl_user_opengl_rendering) {
        glEnable(GL_BLEND);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    } else {
        glDisable(GL_BLEND);
    }
    tigrGAPIDraw(gl->gl_legacy, gl->uniform_model, gl->tex[0], bmp, win->pos[0], win->pos[1], win->pos[2], win->pos[3]);

    if (win->widgetsScale > 0) {
        glEnable(GL_BLEND);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
        tigrGAPIDraw(gl->gl_legacy, gl->uniform_model, gl->tex[1], win->widgets,
                     (int)(w - win->widgets->w * win->widgetsScale), 0, w, (int)(win->widgets->h * win->widgetsScale));
    }

    tigrCheckGLError("present");

    gl->gl_user_opengl_rendering = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x6e60
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x20(%rbp)
movl -0xc(%rbp), %edx
movl -0x10(%rbp), %ecx
xorl %esi, %esi
movl %esi, %edi
callq 0x30d0
movq -0x20(%rbp), %rax
cmpl $0x0, 0x20(%rax)
jne 0x8414
xorps %xmm2, %xmm2
movss 0x6c05(%rip), %xmm3     # 0xf004
movaps %xmm2, %xmm0
movaps %xmm2, %xmm1
callq 0x3600
movl $0x4000, %edi           # imm = 0x4000
callq 0x30b0
movq -0x20(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
jne 0x853d
cvtsi2ssl -0xc(%rbp), %xmm1
movss 0x6be5(%rip), %xmm0     # 0xf014
divss %xmm1, %xmm0
movss %xmm0, -0x60(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x5c(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x58(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x54(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x50(%rbp)
cvtsi2ssl -0x10(%rbp), %xmm1
movss 0x6bab(%rip), %xmm0     # 0xf010
divss %xmm1, %xmm0
movss %xmm0, -0x4c(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x48(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x44(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x40(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x3c(%rbp)
movss 0x6b6e(%rip), %xmm0     # 0xf004
movss %xmm0, -0x38(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x34(%rbp)
movss 0x6b61(%rip), %xmm0     # 0xf00c
movss %xmm0, -0x30(%rbp)
movss 0x6b4c(%rip), %xmm0     # 0xf004
movss %xmm0, -0x2c(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x28(%rbp)
movss 0x6b37(%rip), %xmm0     # 0xf004
movss %xmm0, -0x24(%rbp)
movl $0x84c0, %edi           # imm = 0x84C0
callq 0x31f0
movq -0x20(%rbp), %rax
movl 0x8(%rax), %edi
callq 0x3690
movq -0x20(%rbp), %rax
movl 0xc(%rax), %edi
callq 0x34e0
movq -0x20(%rbp), %rax
movl 0x10(%rax), %edi
leaq -0x60(%rbp), %rcx
movl $0x1, %esi
xorl %edx, %edx
callq 0x35f0
movq -0x20(%rbp), %rax
movl 0x18(%rax), %edi
movq -0x18(%rbp), %rax
movss 0x64(%rax), %xmm0
movq -0x18(%rbp), %rax
movss 0x68(%rax), %xmm1
movq -0x18(%rbp), %rax
movss 0x6c(%rax), %xmm2
movq -0x18(%rbp), %rax
movss 0x70(%rax), %xmm3
callq 0x3200
jmp 0x857b
movl $0x1701, %edi           # imm = 0x1701
callq 0x3540
callq 0x34c0
cvtsi2sdl -0xc(%rbp), %xmm1
cvtsi2sdl -0x10(%rbp), %xmm2
xorps %xmm3, %xmm3
movsd 0x7eef(%rip), %xmm4     # 0x10450
movsd 0x7eef(%rip), %xmm5     # 0x10458
movaps %xmm3, %xmm0
callq 0x3770
movl $0xde1, %edi            # imm = 0xDE1
callq 0x3330
movq -0x20(%rbp), %rax
cmpl $0x0, 0x20(%rax)
je 0x85a0
movl $0xbe2, %edi            # imm = 0xBE2
callq 0x3330
movl $0x302, %edi            # imm = 0x302
movl $0x303, %esi            # imm = 0x303
callq 0x32b0
jmp 0x85aa
movl $0xbe2, %edi            # imm = 0xBE2
callq 0x30c0
movq -0x20(%rbp), %rax
movl 0x1c(%rax), %edi
movq -0x20(%rbp), %rax
movl 0x14(%rax), %esi
movq -0x20(%rbp), %rax
movl (%rax), %edx
movq -0x8(%rbp), %rcx
movq -0x18(%rbp), %rax
movl 0x7c(%rax), %r8d
movq -0x18(%rbp), %rax
movl 0x80(%rax), %r9d
movq -0x18(%rbp), %rax
movl 0x84(%rax), %r10d
movq -0x18(%rbp), %rax
movl 0x88(%rax), %eax
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
callq 0x8fb0
movq -0x18(%rbp), %rax
movss 0x60(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x86a4
movl $0xbe2, %edi            # imm = 0xBE2
callq 0x3330
movl $0x302, %edi            # imm = 0x302
movl $0x303, %esi            # imm = 0x303
callq 0x32b0
movq -0x20(%rbp), %rax
movl 0x1c(%rax), %edi
movq -0x20(%rbp), %rax
movl 0x14(%rax), %esi
movq -0x20(%rbp), %rax
movl 0x4(%rax), %edx
movq -0x18(%rbp), %rax
movq 0x50(%rax), %rcx
cvtsi2ssl -0xc(%rbp), %xmm1
movq -0x18(%rbp), %rax
movq 0x50(%rax), %rax
cvtsi2ssl (%rax), %xmm0
movq -0x18(%rbp), %rax
movss 0x60(%rax), %xmm2
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
cvttss2si %xmm0, %r8d
movl -0xc(%rbp), %r10d
movq -0x18(%rbp), %rax
movq 0x50(%rax), %rax
cvtsi2ssl 0x4(%rax), %xmm0
movq -0x18(%rbp), %rax
mulss 0x60(%rax), %xmm0
cvttss2si %xmm0, %eax
xorl %r9d, %r9d
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
callq 0x8fb0
leaq 0x7f77(%rip), %rdi      # 0x10622
callq 0x8c90
movq -0x20(%rbp), %rax
movl $0x0, 0x20(%rax)
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)