// File: /workspace/github_c_makefile_star2_O1/kyx0r[P]xkeyboard/xkeyboard.c
// Function: init_display
void init_display(int argc, char **argv)
{
	XColor mycolor;

	if (!getenv("DISPLAY")) {
		fprintf(stderr, "DISPLAY not set.\n");
		exit(1);
	}
	if (!(dpy = XOpenDisplay(getenv("DISPLAY")))) {
		fprintf(stderr, "Unable to open display.\n");
		exit(1);
	}
	XSetErrorHandler(handle_error);
	XFlush(dpy);
#if 0
	/* for acting as a window manager */
	XSelectInput(dpy, DefaultRootWindow(dpy),
		SubstructureRedirectMask);
#endif
	myscreen = DefaultScreen(dpy);
	screenwidth = DisplayWidth(dpy, myscreen);
	screenheight = DisplayHeight(dpy, myscreen);
	root = DefaultRootWindow(dpy);
	mybackground = BlackPixel(dpy, myscreen);
	myforeground = WhitePixel(dpy, myscreen);
	myhint.width = 16;
	myhint.height = 16;
	myhint.x = 0;
	myhint.y = screenheight - 16;
	myhint.flags = PSize | PMinSize | PMaxSize | PPosition;
	myattribs.event_mask = ButtonPressMask | VisibilityChangeMask |
		EnterWindowMask;
	myattribs.background_pixel = mybackground;
	myattribs.override_redirect = True;
	mywindow = XCreateWindow(dpy, DefaultRootWindow(dpy),
		myhint.x, myhint.y, myhint.width, myhint.height, 0,
		attribs.depth, InputOutput, attribs.visual,
		CWEventMask | CWBackPixel | CWOverrideRedirect, &myattribs);
	strcpy(tmpbuf, "xkeyboard");
	myattribs.event_mask = ButtonPressMask | VisibilityChangeMask |
		EnterWindowMask;
	XSetStandardProperties(dpy, mywindow, tmpbuf, tmpbuf, None,
	       argv, argc, &myhint);
	gcvals.foreground = mybackground;
	gcvals.background = myforeground;
	mygc = XCreateGC(dpy, mywindow, GCForeground | GCBackground,
		&gcvals);
	font_struct = XLoadQueryFont(dpy,
		"-*-*-medium-r-*-*-*-100-*-*-*-*-*-*");
	if(!font_struct)
	{
		fprintf(stderr, "Missing fonts.\n");
		exit(1);
	}
	XSetFont(dpy, mygc, font_struct->fid);
	mycolor.red = 0xFFFF;
	mycolor.green = 0xFFFF;
	mycolor.blue = 0;
	mycolor.flags = DoRed | DoGreen | DoBlue;
	XAllocColor(dpy, DefaultColormap(dpy, myscreen), &mycolor);
	gcvals.foreground = mycolor.pixel;
	mygcled = XCreateGC(dpy, mywindow, GCForeground |
		GCBackground, &gcvals);
	XSetFont(dpy, mygcled, font_struct->fid);
	mycolor.green = 0;
	XAllocColor(dpy, DefaultColormap(dpy, myscreen), &mycolor);
	gcvals.foreground = mycolor.pixel;
	mygcred = XCreateGC(dpy, mywindow, GCForeground |
		GCBackground, &gcvals);
	XSetFont(dpy, mygcred, font_struct->fid);

	gcvals.foreground = mybackground;
	XMapRaised(dpy, mywindow);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movl %edi, %ebx
leaq 0x39de(%rip), %rdi      # 0x6014
callq 0x2040
testq %rax, %rax
je 0x294f
movq %rax, %rdi
callq 0x2180
movq %rax, 0x161a5(%rip)     # 0x187f8
testq %rax, %rax
je 0x2954
leaq -0x263(%rip), %rdi      # 0x2400
callq 0x21e0
movq 0x16189(%rip), %rdi     # 0x187f8
callq 0x22f0
movq 0x1617d(%rip), %rdi     # 0x187f8
movslq 0xe0(%rdi), %rdx
movl %edx, 0x16178(%rip)     # 0x18800
movq 0xe8(%rdi), %rsi
shlq $0x7, %rdx
movl 0x18(%rsi,%rdx), %eax
movl %eax, 0x16167(%rip)     # 0x18804
movl 0x1c(%rsi,%rdx), %ecx
movl %ecx, 0x16161(%rip)     # 0x18808
movq 0x10(%rsi,%rdx), %rax
movq %rax, 0x1615d(%rip)     # 0x18810
movq 0x60(%rsi,%rdx), %r8
movq %r8, 0x16159(%rip)      # 0x18818
movq 0x58(%rsi,%rdx), %rax
movq %rax, 0x16155(%rip)     # 0x18820
movabsq $0x1000000010, %rax     # imm = 0x1000000010
movq %rax, 0x1615c(%rip)     # 0x18838
leaq 0x16145(%rip), %r15     # 0x18828
xorl %eax, %eax
movl %eax, 0x16145(%rip)     # 0x18830
addl $-0x10, %ecx
movl %ecx, 0x16140(%rip)     # 0x18834
movq $0x3c, 0x16129(%rip) # 0x18828
movl $0x10014, %r12d         # imm = 0x10014
movq %r12, 0x161b4(%rip)     # 0x188c0
leaq 0x16165(%rip), %r10     # 0x18878
movq %r8, 0x16166(%rip)      # 0x18880
movl $0x1, %r11d
movl %r11d, 0x161a9(%rip)    # 0x188d0
movq 0x10(%rsi,%rdx), %rsi
movl 0x161c9(%rip), %r13d    # 0x188fc
xorl %edx, %edx
movl $0x10, %r8d
movl $0x10, %r9d
pushq %r10
pushq $0xa02                  # imm = 0xA02
pushq 0x161b2(%rip)           # 0x18900
pushq %r11
pushq %r13
pushq %rax
callq 0x2230
addq $0x30, %rsp
movq %rax, 0x1620d(%rip)     # 0x18970
movabsq $0x72616f6279656b78, %rcx # imm = 0x72616F6279656B78
movq %rcx, 0x1620c(%rip)     # 0x18980
movw $0x64, 0x1620b(%rip)    # 0x18988
leaq 0x161fc(%rip), %rcx     # 0x18980
movq %r12, 0x16135(%rip)     # 0x188c0
movq 0x16066(%rip), %rdi     # 0x187f8
movq %rax, %rsi
movq %rcx, %rdx
xorl %r8d, %r8d
movq %r14, %r9
pushq %r15
pushq %rbx
callq 0x2070
addq $0x10, %rsp
movq 0x16067(%rip), %rax     # 0x18818
movq %rax, 0x161e8(%rip)     # 0x189a0
leaq 0x161d1(%rip), %rcx     # 0x18990
movq 0x1605a(%rip), %rax     # 0x18820
movq %rax, 0x161db(%rip)     # 0x189a8
movq 0x16024(%rip), %rdi     # 0x187f8
movq 0x16195(%rip), %rsi     # 0x18970
movl $0xc, %edx
callq 0x2280
movq %rax, 0x16224(%rip)     # 0x18a10
movq 0x16005(%rip), %rdi     # 0x187f8
leaq 0x3857(%rip), %rsi      # 0x6051
callq 0x2140
movq %rax, 0x16212(%rip)     # 0x18a18
testq %rax, %rax
je 0x2959
movq 0x15fe2(%rip), %rdi     # 0x187f8
movq 0x161f3(%rip), %rsi     # 0x18a10
movq 0x8(%rax), %rdx
callq 0x2120
leaq 0x8(%rsp), %rbx
movl $0xffffffff, 0x8(%rbx)  # imm = 0xFFFFFFFF
xorl %ebp, %ebp
movw %bp, 0xc(%rbx)
movb $0x7, 0xe(%rbx)
movq 0x15fb5(%rip), %rdi     # 0x187f8
movq 0xe8(%rdi), %rax
movslq 0x15faf(%rip), %rcx     # 0x18800
shlq $0x7, %rcx
movq 0x50(%rax,%rcx), %rsi
movq %rbx, %rdx
callq 0x2080
movq (%rbx), %rax
movq %rax, 0x16134(%rip)     # 0x189a0
leaq 0x1611d(%rip), %r14     # 0x18990
movq 0x15f7e(%rip), %rdi     # 0x187f8
movq 0x160ef(%rip), %rsi     # 0x18970
movl $0xc, %edx
movq %r14, %rcx
callq 0x2280
movq %rax, 0x1618b(%rip)     # 0x18a20
movq 0x15f5c(%rip), %rdi     # 0x187f8
movq 0x16175(%rip), %rcx     # 0x18a18
movq 0x8(%rcx), %rdx
movq %rax, %rsi
callq 0x2120
movw %bp, 0xa(%rbx)
movq 0x15f3e(%rip), %rdi     # 0x187f8
movq 0xe8(%rdi), %rax
movslq 0x15f38(%rip), %rcx     # 0x18800
shlq $0x7, %rcx
movq 0x50(%rax,%rcx), %rsi
movq %rbx, %rdx
callq 0x2080
movq (%rbx), %rax
movq %rax, 0x160bd(%rip)     # 0x189a0
movq 0x15f0e(%rip), %rdi     # 0x187f8
movq 0x1607f(%rip), %rsi     # 0x18970
movl $0xc, %edx
movq %r14, %rcx
callq 0x2280
movq %rax, 0x16123(%rip)     # 0x18a28
movq 0x15eec(%rip), %rdi     # 0x187f8
movq 0x16105(%rip), %rcx     # 0x18a18
movq 0x8(%rcx), %rdx
movq %rax, %rsi
callq 0x2120
movq 0x15ef2(%rip), %rax     # 0x18818
movq %rax, 0x16073(%rip)     # 0x189a0
movq 0x15ec4(%rip), %rdi     # 0x187f8
movq 0x16035(%rip), %rsi     # 0x18970
callq 0x2210
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x249b
callq 0x2476
callq 0x2451