// File: /workspace/github_c_makefile_star2_O0/0x0203[P]schack_poc/./nuklear_xlib.h
// Function: nk_xlib_init
NK_API struct nk_context*
nk_xlib_init(XFont *xfont, Display *dpy, int screen, Window root,
    unsigned int w, unsigned int h)
{
    struct nk_user_font *font = &xfont->handle;
    font->userdata = nk_handle_ptr(xfont);
    font->height = (float)xfont->height;
    font->width = nk_xfont_get_text_width;
    xlib.dpy = dpy;
    xlib.root = root;

    if (!setlocale(LC_ALL,"")) return 0;
    if (!XSupportsLocale()) return 0;
    if (!XSetLocaleModifiers("@im=none")) return 0;

    xlib.xa_clipboard = XInternAtom(dpy, "CLIPBOARD", False);
    xlib.xa_targets = XInternAtom(dpy, "TARGETS", False);
    xlib.xa_text = XInternAtom(dpy, "TEXT", False);
    xlib.xa_utf8_string = XInternAtom(dpy, "UTF8_STRING", False);

    /* create invisible cursor */
    {static XColor dummy; char data[1] = {0};
    Pixmap blank = XCreateBitmapFromData(dpy, root, data, 1, 1);
    if (blank == None) return 0;
    xlib.cursor = XCreatePixmapCursor(dpy, blank, blank, &dummy, &dummy, 0, 0);
    XFreePixmap(dpy, blank);}

    xlib.surf = nk_xsurf_create(screen, w, h);
    nk_init_default(&xlib.ctx, font);
    return &xlib.ctx;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movl %r8d, -0x2c(%rbp)
movl %r9d, -0x30(%rbp)
movq -0x10(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
callq 0x10030
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq %rcx, -0x40(%rbp)
movq -0x40(%rbp), %rcx
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
cvtsi2ssl 0x8(%rax), %xmm0
movq -0x38(%rbp), %rax
movss %xmm0, 0x8(%rax)
movq -0x38(%rbp), %rax
leaq 0x195(%rip), %rcx       # 0x30340
movq %rcx, 0x10(%rax)
movq -0x18(%rbp), %rax
movq %rax, 0x28556(%rip)     # 0x58710
movq -0x28(%rbp), %rax
movq %rax, 0x28553(%rip)     # 0x58718
movl $0x6, %edi
leaq 0x17e9a(%rip), %rsi     # 0x4806b
callq 0x3520
cmpq $0x0, %rax
jne 0x301e9
movq $0x0, -0x8(%rbp)
jmp 0x30333
callq 0x31c0
cmpl $0x0, %eax
jne 0x30200
movq $0x0, -0x8(%rbp)
jmp 0x30333
leaq 0x1791c(%rip), %rdi     # 0x47b23
callq 0x34b0
cmpq $0x0, %rax
jne 0x3021f
movq $0x0, -0x8(%rbp)
jmp 0x30333
movq -0x18(%rbp), %rdi
leaq 0x17902(%rip), %rsi     # 0x47b2c
xorl %edx, %edx
callq 0x3480
movq %rax, 0x244a8(%rip)     # 0x546e0
movq -0x18(%rbp), %rdi
leaq 0x178f3(%rip), %rsi     # 0x47b36
xorl %edx, %edx
callq 0x3480
movq %rax, 0x24497(%rip)     # 0x546e8
movq -0x18(%rbp), %rdi
leaq 0x19214(%rip), %rsi     # 0x49470
xorl %edx, %edx
callq 0x3480
movq %rax, 0x24486(%rip)     # 0x546f0
movq -0x18(%rbp), %rdi
leaq 0x178c9(%rip), %rsi     # 0x47b3e
xorl %edx, %edx
callq 0x3480
movq %rax, 0x24475(%rip)     # 0x546f8
leaq -0x41(%rbp), %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x3070
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rsi
leaq -0x41(%rbp), %rdx
movl $0x1, %r8d
movl %r8d, %ecx
callq 0x3350
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
jne 0x302c2
movq $0x0, -0x8(%rbp)
jmp 0x30333
movq -0x18(%rbp), %rdi
movq -0x50(%rbp), %rsi
movq -0x50(%rbp), %rdx
leaq 0x28453(%rip), %r8      # 0x58728
xorl %r9d, %r9d
movq %r8, %rcx
movl $0x0, (%rsp)
callq 0x32b0
movq %rax, 0x2841a(%rip)     # 0x58708
movq -0x18(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x3500
movl -0x1c(%rbp), %edi
movl -0x2c(%rbp), %esi
movl -0x30(%rbp), %edx
callq 0x303e0
movq %rax, 0x283f0(%rip)     # 0x58700
movq -0x38(%rbp), %rsi
leaq 0x243ad(%rip), %rdi     # 0x546c8
addq $0x38, %rdi
callq 0x10fc0
leaq 0x2439d(%rip), %rax     # 0x546c8
addq $0x38, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopl (%rax)