// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
subq $0x70, %rsp
cmpq $0x0, 0x20(%rdi)
je 0x6646
movq %rdi, %rbx
leaq 0x38(%rdi), %r14
leaq 0x61c4(%rip), %rsi      # 0xc6a0
leaq 0x10(%rsp), %rdi
movl $0xc, %ecx
rep  movsq (%rsi), %es:(%rdi)
cmpl $0x0, 0x54(%rbx)
jne 0x65a1
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 0x4e7c(%rip), %rsi      # 0xb410
movq %r14, %rdi
movl $0x16f, %edx            # imm = 0x16F
callq 0x739b
cmpl $0x0, 0x54(%rbx)
je 0x65b1
movl $0xde1, %edi            # imm = 0xDE1
callq 0x3330
movl $0x2, %edi
movq %r14, %rsi
callq 0x3580
xorl %r14d, %r14d
movl 0x38(%rbx,%r14,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
incq %r14
cmpq $0x1, %r14
je 0x65c1
leaq 0x6500(%rip), %rdi      # 0xcb37
callq 0x72cd
addq $0x70, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x63b3(%rip), %rdi      # 0xca00
leaq 0x63b8(%rip), %rsi      # 0xca0c
leaq 0x63bc(%rip), %rcx      # 0xca17
movl $0x741, %edx            # imm = 0x741
callq 0x3260