// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %rbx
subq $0x48, %rsp
cmpq $0x0, 0x20(%rdi)
je 0x7257
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %rbx
xorl %edi, %edi
xorl %esi, %esi
movl %r14d, %edx
movl %ebp, %ecx
callq 0x30d0
cmpl $0x0, 0x58(%rbx)
jne 0x7060
movss 0x4078(%rip), %xmm3     # 0xb0c0
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
callq 0x35f0
movl $0x4000, %edi           # imm = 0x4000
callq 0x30b0
cmpl $0x0, 0x54(%rbx)
je 0x70ae
movl $0x1701, %edi           # imm = 0x1701
callq 0x3540
callq 0x34c0
xorps %xmm1, %xmm1
cvtsi2sd %r14d, %xmm1
xorps %xmm2, %xmm2
cvtsi2sd %ebp, %xmm2
movsd 0x599c(%rip), %xmm4     # 0xca28
movsd 0x599c(%rip), %xmm5     # 0xca30
xorps %xmm0, %xmm0
xorps %xmm3, %xmm3
callq 0x3760
movl $0xde1, %edi            # imm = 0xDE1
callq 0x3330
jmp 0x715e
xorps %xmm0, %xmm0
cvtsi2ss %r14d, %xmm0
movss 0x400a(%rip), %xmm1     # 0xb0c8
divss %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsi2ss %ebp, %xmm0
movq %rsp, %r15
movss %xmm1, (%r15)
movss 0x3ff3(%rip), %xmm1     # 0xb0cc
divss %xmm0, %xmm1
xorps %xmm0, %xmm0
movups %xmm0, 0x4(%r15)
movss %xmm1, 0x14(%r15)
movups %xmm0, 0x18(%r15)
movaps 0x3fa9(%rip), %xmm0     # 0xb0a0
movups %xmm0, 0x28(%r15)
movsd 0x3fac(%rip), %xmm0     # 0xb0b0
movsd %xmm0, 0x38(%r15)
movl $0x84c0, %edi           # imm = 0x84C0
callq 0x31f0
movl 0x40(%rbx), %edi
callq 0x3690
movl 0x44(%rbx), %edi
callq 0x34e0
movl 0x48(%rbx), %edi
movl $0x1, %esi
xorl %edx, %edx
movq %r15, %rcx
callq 0x35e0
movl 0x50(%rbx), %edi
movss 0x94(%rbx), %xmm0
movss 0x98(%rbx), %xmm1
movss 0x9c(%rbx), %xmm2
movss 0xa0(%rbx), %xmm3
callq 0x3200
cmpl $0x0, 0x58(%rbx)
je 0x717f
movl $0xbe2, %edi            # imm = 0xBE2
callq 0x3330
movl $0x302, %edi            # imm = 0x302
movl $0x303, %esi            # imm = 0x303
callq 0x32b0
jmp 0x7189
movl $0xbe2, %edi            # imm = 0xBE2
callq 0x30c0
movl 0x54(%rbx), %edi
movl 0x38(%rbx), %edx
movl 0x4c(%rbx), %esi
movl 0xac(%rbx), %r8d
movl 0xb0(%rbx), %r9d
movl 0xb4(%rbx), %eax
movl 0xb8(%rbx), %r10d
movq %rbx, %rcx
pushq %r10
pushq %rax
callq 0x7682
addq $0x10, %rsp
movss 0x90(%rbx), %xmm0
xorpd %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x7239
movl $0xbe2, %edi            # imm = 0xBE2
callq 0x3330
movl $0x302, %edi            # imm = 0x302
movl $0x303, %esi            # imm = 0x303
callq 0x32b0
movl 0x54(%rbx), %edi
movq 0x80(%rbx), %rcx
xorps %xmm0, %xmm0
cvtsi2ss %r14d, %xmm0
xorps %xmm1, %xmm1
cvtsi2ssl (%rcx), %xmm1
movss 0x90(%rbx), %xmm2
mulss %xmm2, %xmm1
subss %xmm1, %xmm0
cvttss2si %xmm0, %r8d
movl 0x3c(%rbx), %edx
xorps %xmm0, %xmm0
cvtsi2ssl 0x4(%rcx), %xmm0
movl 0x4c(%rbx), %esi
mulss %xmm2, %xmm0
cvttss2si %xmm0, %eax
xorl %r9d, %r9d
pushq %rax
pushq %r14
callq 0x7682
addq $0x10, %rsp
leaq 0x599a(%rip), %rdi      # 0xcbda
callq 0x7405
movl $0x0, 0x58(%rbx)
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x57ea(%rip), %rdi      # 0xca48
leaq 0x57ef(%rip), %rsi      # 0xca54
leaq 0x57f3(%rip), %rcx      # 0xca5f
movl $0x741, %edx            # imm = 0x741
callq 0x3260