// File: /workspace/github_c_makefile_star2_O3/nkanaev[P]tipsy/src/tigr.c
// Function: tigrGAPICreate
void tigrGAPICreate(Tigr* bmp) {
    TigrInternal* win = tigrInternal(bmp);
    GLStuff* gl = &win->gl;
    GLuint VBO;
    GLfloat vertices[] = { // pos      uv
                           0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f,
                           0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f
    };

#ifdef _WIN32
    if (tigrGL11Init(bmp))
        return;
    tigrGL33Init(bmp);
#endif

    if (!gl->gl_legacy) {
        // create vao
        glGenVertexArrays(1, &gl->vao);
        glGenBuffers(1, &VBO);
        glBindBuffer(GL_ARRAY_BUFFER, VBO);
        glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
        glBindVertexArray(gl->vao);
        glEnableVertexAttribArray(0);
        glEnableVertexAttribArray(1);
        glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(GLfloat), NULL);
        glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(GLfloat), NULL);

        // create program
        tigrCreateShaderProgram(gl, tigr_default_fx_gl_fs, tigr_default_fx_gl_fs_size);
    }

    // create textures
    if (gl->gl_legacy) {
        glEnable(GL_TEXTURE_2D);
    }
    glGenTextures(2, gl->tex);
    for (int i = 0; i < 2; ++i) {
        glBindTexture(GL_TEXTURE_2D, gl->tex[i]);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl->gl_legacy ? GL_NEAREST : GL_LINEAR);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl->gl_legacy ? GL_NEAREST : GL_LINEAR);
        glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
        glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
    }

    tigrCheckGLError("initialization");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x78, %rsp
cmpq $0x0, 0x20(%rdi)
je 0x674c
movq %rdi, %rbx
leaq 0x38(%rdi), %r14
leaq 0x6177(%rip), %rsi      # 0xc750
leaq 0x10(%rsp), %rdi
movl $0xc, %ecx
rep  movsq (%rsi), %es:(%rdi)
cmpl $0x0, 0x54(%rbx)
jne 0x66a4
leaq 0x40(%rbx), %rsi
movl $0x1, %edi
callq 0x33e0
leaq 0xc(%rsp), %r15
movl $0x1, %edi
movq %r15, %rsi
callq 0x3170
movl (%r15), %esi
movl $0x8892, %edi           # imm = 0x8892
callq 0x3070
leaq 0x10(%rsp), %rdx
movl $0x60, %esi
movl $0x8892, %edi           # imm = 0x8892
movl $0x88e4, %ecx           # imm = 0x88E4
callq 0x3470
movl 0x40(%rbx), %edi
callq 0x3690
xorl %edi, %edi
callq 0x3090
movl $0x1, %edi
callq 0x3090
xorl %edi, %edi
movl $0x2, %esi
movl $0x1406, %edx           # imm = 0x1406
xorl %ecx, %ecx
movl $0x10, %r8d
xorl %r9d, %r9d
callq 0x3700
movl $0x1, %edi
movl $0x2, %esi
movl $0x1406, %edx           # imm = 0x1406
xorl %ecx, %ecx
movl $0x10, %r8d
xorl %r9d, %r9d
callq 0x3700
leaq 0x4e2f(%rip), %rsi      # 0xb4c0
movq %r14, %rdi
movl $0x16f, %edx            # imm = 0x16F
callq 0x74d3
cmpl $0x0, 0x54(%rbx)
je 0x66ae
movl $0xde1, %edi            # imm = 0xDE1
callq 0x3330
movl $0x2, %edi
movq %r14, %rsi
callq 0x3580
movb $0x1, %bpl
xorl %eax, %eax
movl 0x38(%rbx,%rax,4), %esi
movl $0xde1, %edi            # imm = 0xDE1
callq 0x3460
cmpl $0x1, 0x54(%rbx)
movl $0x0, %edx
adcl $0x2600, %edx           # imm = 0x2600
movl $0xde1, %edi            # imm = 0xDE1
movl $0x2801, %esi           # imm = 0x2801
callq 0x3530
cmpl $0x1, 0x54(%rbx)
movl $0x0, %edx
adcl $0x2600, %edx           # imm = 0x2600
movl $0xde1, %edi            # imm = 0xDE1
movl $0x2800, %esi           # imm = 0x2800
callq 0x3530
movl $0xcf2, %edi            # imm = 0xCF2
xorl %esi, %esi
callq 0x3190
movl $0xcf5, %edi            # imm = 0xCF5
movl $0x1, %esi
callq 0x3190
movl $0x1, %eax
testb $0x1, %bpl
movl $0x0, %ebp
jne 0x66c0
leaq 0x6443(%rip), %rdi      # 0xcb7f
callq 0x7405
addq $0x78, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x62f5(%rip), %rdi      # 0xca48
leaq 0x62fa(%rip), %rsi      # 0xca54
leaq 0x62fe(%rip), %rcx      # 0xca5f
movl $0x741, %edx            # imm = 0x741
callq 0x3260