// File: /workspace/github_c_makefile_star2_O2/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 %rbx
subq $0x48, %rsp
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x2b12(%rip), %rdi      # 0x5014
callq 0x2040
testq %rax, %rax
je 0x281b
movq %rax, %rdi
callq 0x2180
movq %rax, 0x152d9(%rip)     # 0x177f8
testq %rax, %rax
je 0x2830
leaq 0x33a(%rip), %rdi       # 0x2869
callq 0x21e0
movq 0x152bd(%rip), %rdi     # 0x177f8
callq 0x22f0
movq 0x152b1(%rip), %rdi     # 0x177f8
movslq 0xe0(%rdi), %rax
movl %eax, 0x152ac(%rip)     # 0x17800
movq 0xe8(%rdi), %rdx
shlq $0x7, %rax
movl 0x18(%rdx,%rax), %ecx
movl %ecx, 0x1529b(%rip)     # 0x17804
movl 0x1c(%rdx,%rax), %ecx
movl %ecx, 0x15295(%rip)     # 0x17808
movq 0x10(%rdx,%rax), %rsi
movq %rsi, 0x15291(%rip)     # 0x17810
movq 0x60(%rdx,%rax), %rsi
movq %rsi, 0x1528d(%rip)     # 0x17818
movq 0x58(%rdx,%rax), %r8
movq %r8, 0x15289(%rip)      # 0x17820
movabsq $0x1000000010, %r8      # imm = 0x1000000010
movq %r8, 0x15290(%rip)      # 0x17838
leaq 0x15279(%rip), %r14     # 0x17828
andl $0x0, 0x1527a(%rip)     # 0x17830
addl $-0x10, %ecx
movl %ecx, 0x15275(%rip)     # 0x17834
movq $0x3c, 0x1525e(%rip) # 0x17828
movl $0x10014, %r15d         # imm = 0x10014
movq %r15, 0x152e9(%rip)     # 0x178c0
leaq 0x1529a(%rip), %r8      # 0x17878
movq %rsi, 0x1529b(%rip)     # 0x17880
pushq $0x1
popq %r9
movl %r9d, 0x152e0(%rip)     # 0x178d0
movq 0x10(%rdx,%rax), %rsi
movl 0x15301(%rip), %eax     # 0x178fc
movq 0x152fe(%rip), %rdx     # 0x17900
movq %r8, 0x28(%rsp)
movq %rdx, 0x18(%rsp)
movl %r9d, 0x10(%rsp)
movl %eax, 0x8(%rsp)
andl $0x0, (%rsp)
movq $0xa02, 0x20(%rsp)      # imm = 0xA02
pushq $0x10
popq %r8
xorl %edx, %edx
movl %r8d, %r9d
callq 0x2230
movq %rax, 0x15339(%rip)     # 0x17970
movabsq $0x72616f6279656b78, %rcx # imm = 0x72616F6279656B78
movq %rcx, 0x15338(%rip)     # 0x17980
movw $0x64, 0x15337(%rip)    # 0x17988
leaq 0x15328(%rip), %rcx     # 0x17980
movq %r15, 0x15261(%rip)     # 0x178c0
movq 0x15192(%rip), %rdi     # 0x177f8
movq %r14, 0x8(%rsp)
movl %ebp, (%rsp)
movq %rax, %rsi
movq %rcx, %rdx
xorl %r8d, %r8d
movq %rbx, %r9
callq 0x2070
movq 0x15192(%rip), %rax     # 0x17818
movq %rax, 0x15313(%rip)     # 0x179a0
leaq 0x152fc(%rip), %rcx     # 0x17990
movq 0x15185(%rip), %rax     # 0x17820
movq %rax, 0x15306(%rip)     # 0x179a8
movq 0x1514f(%rip), %rdi     # 0x177f8
movq 0x152c0(%rip), %rsi     # 0x17970
pushq $0xc
popq %rdx
callq 0x2280
movq %rax, 0x15351(%rip)     # 0x17a10
movq 0x15132(%rip), %rdi     # 0x177f8
leaq 0x2984(%rip), %rsi      # 0x5051
callq 0x2140
movq %rax, 0x1533f(%rip)     # 0x17a18
testq %rax, %rax
je 0x2845
movq 0x1510f(%rip), %rdi     # 0x177f8
movq 0x15320(%rip), %rsi     # 0x17a10
movq 0x8(%rax), %rdx
callq 0x2120
leaq 0x38(%rsp), %rbx
orl $-0x1, 0x8(%rbx)
andw $0x0, 0xc(%rbx)
movb $0x7, 0xe(%rbx)
movq 0x150e6(%rip), %rdi     # 0x177f8
movq 0xe8(%rdi), %rax
movslq 0x150e0(%rip), %rcx     # 0x17800
shlq $0x7, %rcx
movq 0x50(%rax,%rcx), %rsi
movq %rbx, %rdx
callq 0x2080
movq (%rbx), %rax
movq %rax, 0x15265(%rip)     # 0x179a0
leaq 0x1524e(%rip), %r14     # 0x17990
movq 0x150af(%rip), %rdi     # 0x177f8
movq 0x15220(%rip), %rsi     # 0x17970
pushq $0xc
popq %r15
movq %r15, %rdx
movq %r14, %rcx
callq 0x2280
movq %rax, 0x152ba(%rip)     # 0x17a20
movq 0x1508b(%rip), %rdi     # 0x177f8
movq 0x152a4(%rip), %rcx     # 0x17a18
movq 0x8(%rcx), %rdx
movq %rax, %rsi
callq 0x2120
andw $0x0, 0xa(%rbx)
movq 0x1506c(%rip), %rdi     # 0x177f8
movq 0xe8(%rdi), %rax
movslq 0x15066(%rip), %rcx     # 0x17800
shlq $0x7, %rcx
movq 0x50(%rax,%rcx), %rsi
movq %rbx, %rdx
callq 0x2080
movq (%rbx), %rax
movq %rax, 0x151eb(%rip)     # 0x179a0
movq 0x1503c(%rip), %rdi     # 0x177f8
movq 0x151ad(%rip), %rsi     # 0x17970
movq %r15, %rdx
movq %r14, %rcx
callq 0x2280
movq %rax, 0x15253(%rip)     # 0x17a28
movq 0x1501c(%rip), %rdi     # 0x177f8
movq 0x15235(%rip), %rcx     # 0x17a18
movq 0x8(%rcx), %rdx
movq %rax, %rsi
callq 0x2120
movq 0x15022(%rip), %rax     # 0x17818
movq %rax, 0x151a3(%rip)     # 0x179a0
movq 0x14ff4(%rip), %rdi     # 0x177f8
movq 0x15165(%rip), %rsi     # 0x17970
callq 0x2210
addq $0x48, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x47d6(%rip), %rax      # 0x6ff8
movq (%rax), %rcx
leaq 0x27f0(%rip), %rdi      # 0x501c
pushq $0x11
jmp 0x2858
movq 0x47c1(%rip), %rax      # 0x6ff8
movq (%rax), %rcx
leaq 0x27ed(%rip), %rdi      # 0x502e
pushq $0x18
jmp 0x2858
movq 0x47ac(%rip), %rax      # 0x6ff8
movq (%rax), %rcx
leaq 0x281f(%rip), %rdi      # 0x5075
pushq $0xf
popq %rsi
pushq $0x1
popq %rdx
callq 0x2360
pushq $0x1
popq %rdi
callq 0x2350