// File: /workspace/github_c_makefile_star2_O0/nkanaev[P]tipsy/src/tigr.c
// Function: initX11Stuff
static void initX11Stuff() {
    static int done = 0;
    if (!done) {
        dpy = XOpenDisplay(NULL);
        if (dpy == NULL) {
            tigrError(0, "Cannot connect to X server");
        }

        root = DefaultRootWindow(dpy);

        static int attribList[] = { GLX_RENDER_TYPE,
                                    GLX_RGBA_BIT,
                                    GLX_DRAWABLE_TYPE,
                                    GLX_WINDOW_BIT,
                                    GLX_DOUBLEBUFFER,
                                    1,
                                    GLX_RED_SIZE,
                                    1,
                                    GLX_GREEN_SIZE,
                                    1,
                                    GLX_BLUE_SIZE,
                                    1,
                                    None };

        int fbcCount = 0;
        GLXFBConfig* fbc = glXChooseFBConfig(dpy, DefaultScreen(dpy), attribList, &fbcCount);
        if (!fbc) {
            tigrError(0, "Failed to choose FB config");
        }
        fbConfig = fbc[0];

        vi = glXGetVisualFromFBConfig(dpy, fbConfig);
        if (vi == NULL) {
            tigrError(0, "No appropriate visual found");
        }

        GLXContext tmpCtx = glXCreateContext(dpy, vi, 0, GL_TRUE);
        glXCreateContextAttribsARB =
            (PFNGLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddressARB((const GLubyte*)"glXCreateContextAttribsARB");
        glXDestroyContext(dpy, tmpCtx);
        if (!glXCreateContextAttribsARB) {
            tigrError(0, "Failed to get glXCreateContextAttribsARB");
        }

        inputMethod = XOpenIM(dpy, NULL, NULL, NULL);
        if (inputMethod == NULL) {
            tigrError(0, "Failed to create input method");
        }

        wmDeleteMessage = XInternAtom(dpy, "WM_DELETE_WINDOW", False);

        done = 1;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
cmpl $0x0, 0xa2b9(%rip)      # 0x14828
jne 0xa719
xorl %eax, %eax
movl %eax, %edi
callq 0x3570
movq %rax, 0xa26b(%rip)      # 0x147f0
cmpq $0x0, 0xa263(%rip)      # 0x147f0
jne 0xa5a1
xorl %eax, %eax
movl %eax, %edi
leaq 0x60b0(%rip), %rsi      # 0x1064a
movb $0x0, %al
callq 0x8a60
movq 0xa248(%rip), %rax      # 0x147f0
movq 0xe8(%rax), %rax
movq 0xa23a(%rip), %rcx      # 0x147f0
movslq 0xe0(%rcx), %rcx
shlq $0x7, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rax
movq %rax, 0xa229(%rip)      # 0x147f8
movl $0x0, -0x4(%rbp)
movq 0xa213(%rip), %rdi      # 0x147f0
movq 0xa20c(%rip), %rax      # 0x147f0
movl 0xe0(%rax), %esi
leaq 0xa18f(%rip), %rdx      # 0x14780
leaq -0x4(%rbp), %rcx
callq 0x3560
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xa617
xorl %eax, %eax
movl %eax, %edi
leaq 0x6055(%rip), %rsi      # 0x10665
movb $0x0, %al
callq 0x8a60
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, 0xa1f3(%rip)      # 0x14818
movq 0xa1c4(%rip), %rdi      # 0x147f0
movq 0xa1e5(%rip), %rsi      # 0x14818
callq 0x35a0
movq %rax, 0xa1c1(%rip)      # 0x14800
cmpq $0x0, 0xa1b9(%rip)      # 0x14800
jne 0xa65b
xorl %eax, %eax
movl %eax, %edi
leaq 0x602c(%rip), %rsi      # 0x10680
movb $0x0, %al
callq 0x8a60
movq 0xa18e(%rip), %rdi      # 0x147f0
movq 0xa197(%rip), %rsi      # 0x14800
xorl %eax, %eax
movl %eax, %edx
movl $0x1, %ecx
callq 0x3440
movq %rax, -0x18(%rbp)
leaq 0x6028(%rip), %rdi      # 0x106aa
callq 0x3360
movq %rax, 0xa15a(%rip)      # 0x147e8
movq 0xa15b(%rip), %rdi      # 0x147f0
movq -0x18(%rbp), %rsi
callq 0x3250
cmpq $0x0, 0xa142(%rip)      # 0x147e8
jne 0xa6ba
xorl %eax, %eax
movl %eax, %edi
leaq 0x5fe9(%rip), %rsi      # 0x1069c
movb $0x0, %al
callq 0x8a60
movq 0xa12f(%rip), %rdi      # 0x147f0
xorl %eax, %eax
movl %eax, %ecx
movq %rcx, %rsi
movq %rcx, %rdx
callq 0x36d0
movq %rax, 0xa131(%rip)      # 0x14808
cmpq $0x0, 0xa129(%rip)      # 0x14808
jne 0xa6f3
xorl %eax, %eax
movl %eax, %edi
leaq 0x5fd9(%rip), %rsi      # 0x106c5
movb $0x0, %al
callq 0x8a60
movq 0xa0f6(%rip), %rdi      # 0x147f0
leaq 0x5fe2(%rip), %rsi      # 0x106e3
xorl %edx, %edx
callq 0x32a0
movq %rax, 0xa101(%rip)      # 0x14810
movl $0x1, 0xa10f(%rip)      # 0x14828
addq $0x20, %rsp
popq %rbp
retq
nop