// File: /workspace/github_c_makefile_star2_O1/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 0x712c
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 0x6f35
movss 0x40e7(%rip), %xmm3     # 0xb004
xorps %xmm0, %xmm0
xorps %xmm1, %xmm1
xorps %xmm2, %xmm2
callq 0x35f0
movl $0x4000, %edi           # imm = 0x4000
callq 0x30b0
cmpl $0x0, 0x54(%rbx)
je 0x6f83
movl $0x1701, %edi           # imm = 0x1701
callq 0x3540
callq 0x34c0
xorps %xmm1, %xmm1
cvtsi2sd %r14d, %xmm1
xorps %xmm2, %xmm2
cvtsi2sd %ebp, %xmm2
movsd 0x5a7f(%rip), %xmm4     # 0xc9e0
movsd 0x5a7f(%rip), %xmm5     # 0xc9e8
xorps %xmm0, %xmm0
xorps %xmm3, %xmm3
callq 0x3770
movl $0xde1, %edi            # imm = 0xDE1
callq 0x3330
jmp 0x7033
xorps %xmm0, %xmm0
cvtsi2ss %r14d, %xmm0
movss 0x4079(%rip), %xmm1     # 0xb00c
divss %xmm0, %xmm1
xorps %xmm0, %xmm0
cvtsi2ss %ebp, %xmm0
movq %rsp, %r15
movss %xmm1, (%r15)
movss 0x4062(%rip), %xmm1     # 0xb010
divss %xmm0, %xmm1
xorps %xmm0, %xmm0
movups %xmm0, 0x4(%r15)
movss %xmm1, 0x14(%r15)
movups %xmm0, 0x18(%r15)
movaps 0x5a04(%rip), %xmm0     # 0xc9d0
movups %xmm0, 0x28(%r15)
movabsq $0x3f80000000000000, %rax # imm = 0x3F80000000000000
movq %rax, 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 0x7054
movl $0xbe2, %edi            # imm = 0xBE2
callq 0x3330
movl $0x302, %edi            # imm = 0x302
movl $0x303, %esi            # imm = 0x303
callq 0x32b0
jmp 0x705e
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 0x754a
addq $0x10, %rsp
movss 0x90(%rbx), %xmm0
xorpd %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jbe 0x710e
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 0x754a
addq $0x10, %rsp
leaq 0x5a7d(%rip), %rdi      # 0xcb92
callq 0x72cd
movl $0x0, 0x58(%rbx)
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x58cd(%rip), %rdi      # 0xca00
leaq 0x58d2(%rip), %rsi      # 0xca0c
leaq 0x58d6(%rip), %rcx      # 0xca17
movl $0x741, %edx            # imm = 0x741
callq 0x3260