// File: /workspace/github_c_makefile_star2_O1/9wm[P]9wm/9wm.c
// Function: initscreen
void
initscreen(ScreenInfo * s, int i)
{
	char *ds, *colon, *dot1;
	unsigned long mask;
	XGCValues gv;
	XSetWindowAttributes attr;

	s->num = i;
	s->root = RootWindow(dpy, i);
	s->def_cmap = DefaultColormap(dpy, i);
	s->min_cmaps = MinCmapsOfScreen(ScreenOfDisplay(dpy, i));

	ds = DisplayString(dpy);
	colon = strrchr(ds, ':');
	if (colon && num_screens > 1) {
		strcpy(s->display, "DISPLAY=");
		strcat(s->display, ds);
		colon = s->display + 8 + (colon - ds);	/* use version in buf */
		dot1 = strchr(colon, '.');	/* first period after colon */
		if (!dot1)
			dot1 = colon + strlen(colon);	/* if not there, append */
		sprintf(dot1, ".%d", i);
	} else
		s->display[0] = '\0';

	s->black = BlackPixel(dpy, i);
	s->white = WhitePixel(dpy, i);
	/*
	 * Setup color for border
	 */
	s->active = s->black;
	s->inactive = s->white;
#ifdef COLOR
	if (activestr != NULL || inactivestr != NULL) {
		Colormap cmap = DefaultColormap(dpy,s->num);
		if (cmap != 0) {
			unsigned long active;
			unsigned long inactive;
			Status sa = getcolor(cmap, &active, activestr);
			Status si = getcolor(cmap, &inactive, inactivestr);
			if (sa != 0)
				s->active = active;
			if (si != 0)
				s->inactive = inactive;
		}
	}
#endif
	gv.foreground = s->black ^ s->white;
	gv.background = s->white;
	gv.function = GXxor;
	gv.line_width = 0;
	gv.subwindow_mode = IncludeInferiors;
	mask = GCForeground | GCBackground | GCFunction | GCLineWidth | GCSubwindowMode;
	if (font != 0) {
		gv.font = font->fid;
		mask |= GCFont;
	}
	s->gc = XCreateGC(dpy, s->root, mask, &gv);

	initcurs(s);

	attr.cursor = s->arrow;
	attr.event_mask = SubstructureRedirectMask
	    | SubstructureNotifyMask | ColormapChangeMask | ButtonPressMask | ButtonReleaseMask | PropertyChangeMask;
	mask = CWCursor | CWEventMask;
	XChangeWindowAttributes(dpy, s->root, mask, &attr);
	XSync(dpy, False);

	s->menuwin = XCreateSimpleWindow(dpy, s->root, 0, 0, 1, 1, 1, s->black, s->white);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x110, %rsp            # imm = 0x110
movl %esi, %ebp
movq %rdi, %rbx
movl %esi, (%rdi)
movq 0x8723(%rip), %rax      # 0xb978
movq 0xe8(%rax), %rcx
movslq %esi, %r12
shlq $0x7, %r12
movq 0x10(%rcx,%r12), %rdx
movq %rdx, 0x8(%rdi)
movq 0x50(%rcx,%r12), %rdx
movq %rdx, 0x18(%rdi)
movl 0x6c(%rcx,%r12), %ecx
movl %ecx, 0x48(%rdi)
movq 0xd8(%rax), %r14
movq %r14, %rdi
movl $0x3a, %esi
callq 0x21b0
leaq 0x78(%rbx), %rdi
testq %rax, %rax
je 0x32ff
cmpl $0x2, 0x8767(%rip)      # 0xba08
jl 0x32ff
movq %rax, %r15
movabsq $0x3d59414c50534944, %rax # imm = 0x3D59414C50534944
movq %rax, (%rdi)
movb $0x0, 0x8(%rdi)
movq %r14, %rsi
callq 0x2500
subq %r14, %r15
leaq (%rbx,%r15), %r14
addq $0x80, %r14
movq %r14, %rdi
movl $0x2e, %esi
callq 0x2160
testq %rax, %rax
jne 0x32ea
movq %r14, %rdi
callq 0x2140
addq %r14, %rax
leaq 0x407a(%rip), %rsi      # 0x736b
movq %rax, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x2510
jmp 0x3302
movb $0x0, (%rdi)
movq 0x866f(%rip), %rdi      # 0xb978
movq 0xe8(%rdi), %rax
movq 0x60(%rax,%r12), %rcx
movq %rcx, 0x28(%rbx)
movq 0x58(%rax,%r12), %rax
movq %rax, 0x30(%rbx)
movq %rcx, 0x38(%rbx)
movq %rax, 0x40(%rbx)
xorq %rax, %rcx
movq %rcx, 0x30(%rsp)
movq %rax, 0x38(%rsp)
movl $0x6, 0x20(%rsp)
movl $0x0, 0x40(%rsp)
movl $0x1, 0x80(%rsp)
movq 0x85f7(%rip), %rax      # 0xb950
testq %rax, %rax
je 0x336e
movq 0x8(%rax), %rax
movq %rax, 0x78(%rsp)
movl $0xc01d, %edx           # imm = 0xC01D
jmp 0x3373
movl $0x801d, %edx           # imm = 0x801D
movq 0x8(%rbx), %rsi
leaq 0x20(%rsp), %rcx
callq 0x2410
movq %rax, 0x20(%rbx)
movq %rbx, %rdi
callq 0x6b3f
movq 0x68(%rbx), %rax
leaq 0xa0(%rsp), %rcx
movq %rax, 0x68(%rcx)
movq $0xd8000c, 0x48(%rcx)   # imm = 0xD8000C
movq 0x85cc(%rip), %rdi      # 0xb978
movq 0x8(%rbx), %rsi
movl $0x4800, %edx           # imm = 0x4800
callq 0x21e0
movq 0x85b7(%rip), %rdi      # 0xb978
xorl %esi, %esi
callq 0x23a0
movq 0x85a9(%rip), %rdi      # 0xb978
movq 0x8(%rbx), %rsi
movups 0x28(%rbx), %xmm0
movups %xmm0, 0x8(%rsp)
movl $0x1, (%rsp)
xorl %edx, %edx
xorl %ecx, %ecx
movl $0x1, %r8d
movl $0x1, %r9d
callq 0x2440
movq %rax, 0x10(%rbx)
addq $0x110, %rsp            # imm = 0x110
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq