// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r9d, %ebp
movl %r8d, %r14d
movq %rcx, %r13
movl %edx, %r15d
movq %rsi, %r12
movq %rdi, %rbx
movq %rdi, 0x20(%rdi)
cvtsi2ssl 0x8(%rdi), %xmm0
movss %xmm0, 0x28(%rdi)
leaq 0x1f1(%rip), %rax       # 0x1f6a4
movq %rax, 0x30(%rdi)
movq %rsi, 0x1e162(%rip)     # 0x3d620
movq %rcx, 0x1e163(%rip)     # 0x3d628
leaq 0xe0a3(%rip), %rsi      # 0x2d56f
movl $0x6, %edi
callq 0x3530
testq %rax, %rax
je 0x1f68f
callq 0x31d0
testl %eax, %eax
je 0x1f68f
leaq 0xdb5e(%rip), %rdi      # 0x2d051
callq 0x34c0
testq %rax, %rax
je 0x1f68f
leaq 0xdb52(%rip), %rsi      # 0x2d05a
movq %r12, %rdi
xorl %edx, %edx
callq 0x3490
movq %rax, 0x1a0d7(%rip)     # 0x395f0
leaq 0xdb44(%rip), %rsi      # 0x2d064
movq %r12, %rdi
xorl %edx, %edx
callq 0x3490
movq %rax, 0x1a0c7(%rip)     # 0x395f8
leaq 0xf414(%rip), %rsi      # 0x2e94c
movq %r12, %rdi
xorl %edx, %edx
callq 0x3490
movq %rax, 0x1a0b7(%rip)     # 0x39600
leaq 0xdb1c(%rip), %rsi      # 0x2d06c
movq %r12, %rdi
xorl %edx, %edx
callq 0x3490
movq %rax, 0x1a0a7(%rip)     # 0x39608
leaq 0x10(%rsp), %rdx
movb $0x0, (%rdx)
movq %r12, %rdi
movq %r13, %rsi
movl $0x1, %ecx
movl $0x1, %r8d
callq 0x3360
testq %rax, %rax
je 0x1f68f
movq %rax, %r13
addq $0x20, %rbx
movl $0x0, (%rsp)
leaq 0x1e09b(%rip), %rcx     # 0x3d638
movq %r12, %rdi
movq %rax, %rsi
movq %rax, %rdx
movq %rcx, %r8
xorl %r9d, %r9d
callq 0x32c0
movq %rax, 0x1e060(%rip)     # 0x3d618
movq %r12, %rdi
movq %r13, %rsi
callq 0x3510
movl $0x1, %edi
movl $0x30, %esi
callq 0x3470
movq %rax, %r12
movl %r14d, 0x28(%rax)
movl %ebp, 0x2c(%rax)
movq 0x1e03d(%rip), %rdi     # 0x3d620
movq %rdi, 0x8(%rax)
movl %r15d, 0x10(%rax)
movq 0x1e036(%rip), %rsi     # 0x3d628
movq %rsi, 0x18(%rax)
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x3380
movq %rax, (%r12)
movq 0x1e016(%rip), %rdi     # 0x3d620
movq %rax, %rsi
movl $0x1, %edx
xorl %ecx, %ecx
movl $0x1, %r8d
xorl %r9d, %r9d
callq 0x3320
movq 0x1dff7(%rip), %rdi     # 0x3d620
movq 0x1dff8(%rip), %rsi     # 0x3d628
movq 0xe8(%rdi), %rax
movslq %r15d, %rcx
shlq $0x7, %rcx
movl 0x38(%rax,%rcx), %r8d
movl %r14d, %edx
movl %ebp, %ecx
callq 0x3550
movq %rax, 0x20(%r12)
movq %r12, 0x1dfb7(%rip)     # 0x3d610
leaq 0x10(%rsp), %rsi
movq $0x0, (%rsi)
leaq -0x1a43f(%rip), %rax    # 0x522d
movq %rax, 0x8(%rsi)
leaq -0x1a442(%rip), %rax    # 0x5235
movq %rax, 0x10(%rsi)
leaq 0x19f8e(%rip), %r14     # 0x39610
movq %r14, %rdi
movq %rbx, %rdx
callq 0xa561
jmp 0x1f692
xorl %r14d, %r14d
movq %r14, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq