// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0x6e60
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x18(%rbp)
leaq -0x80(%rbp), %rdi
leaq 0x8b2d(%rip), %rsi      # 0x102b0
movl $0x60, %edx
callq 0x32d0
movq -0x18(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
jne 0x7851
movq -0x18(%rbp), %rsi
addq $0x8, %rsi
movl $0x1, %edi
callq 0x33e0
movl $0x1, %edi
leaq -0x1c(%rbp), %rsi
callq 0x3170
movl -0x1c(%rbp), %esi
movl $0x8892, %edi           # imm = 0x8892
callq 0x3070
leaq -0x80(%rbp), %rdx
movl $0x8892, %edi           # imm = 0x8892
movl $0x60, %esi
movl $0x88e4, %ecx           # imm = 0x88E4
callq 0x3470
movq -0x18(%rbp), %rax
movl 0x8(%rax), %edi
callq 0x3690
xorl %edi, %edi
callq 0x3090
movl $0x1, %edi
callq 0x3090
xorl %ecx, %ecx
movl $0x2, %esi
movl $0x1406, %edx           # imm = 0x1406
movl $0x10, %r8d
xorl %eax, %eax
movl %eax, %r9d
movl %ecx, %edi
callq 0x3700
movl $0x1, %edi
movl $0x2, %esi
movl $0x1406, %edx           # imm = 0x1406
xorl %ecx, %ecx
movl $0x10, %r8d
xorl %eax, %eax
movl %eax, %r9d
callq 0x3700
movq -0x18(%rbp), %rdi
leaq 0x79d9(%rip), %rsi      # 0xf220
movl $0x16f, %edx            # imm = 0x16F
callq 0x8d90
movq -0x18(%rbp), %rax
cmpl $0x0, 0x1c(%rax)
je 0x7865
movl $0xde1, %edi            # imm = 0xDE1
callq 0x3330
movq -0x18(%rbp), %rsi
movl $0x2, %edi
callq 0x3580
movl $0x0, -0x84(%rbp)
cmpl $0x2, -0x84(%rbp)
jge 0x791d
movq -0x18(%rbp), %rax
movslq -0x84(%rbp), %rcx
movl (%rax,%rcx,4), %esi
movl $0xde1, %edi            # imm = 0xDE1
callq 0x3460
movq -0x18(%rbp), %rax
movl 0x1c(%rax), %ecx
movl $0x2601, %edx           # imm = 0x2601
movl $0x2600, %eax           # imm = 0x2600
cmpl $0x0, %ecx
cmovnel %eax, %edx
movl $0xde1, %edi            # imm = 0xDE1
movl $0x2801, %esi           # imm = 0x2801
callq 0x3530
movq -0x18(%rbp), %rax
movl 0x1c(%rax), %ecx
movl $0x2601, %edx           # imm = 0x2601
movl $0x2600, %eax           # imm = 0x2600
cmpl $0x0, %ecx
cmovnel %eax, %edx
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 -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x787d
leaq 0x8ca3(%rip), %rdi      # 0x105c7
callq 0x8c90
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)