// File: /workspace/github_c_makefile_star2_O2/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 %r13
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
movl %esi, %ebp
movq %rdi, %rbx
movl %esi, (%rdi)
movq 0x8af9(%rip), %r14      # 0xb988
movq 0xe8(%r14), %rax
movslq %esi, %r13
shlq $0x7, %r13
movq 0x10(%rax,%r13), %rcx
movq %rcx, 0x8(%rdi)
movq 0x50(%rax,%r13), %rcx
movq %rcx, 0x18(%rdi)
movl 0x6c(%rax,%r13), %eax
movl %eax, 0x48(%rdi)
movq 0xd8(%r14), %r15
pushq $0x3a
popq %rsi
movq %r15, %rdi
callq 0x21b0
leaq 0x78(%rbx), %rdi
testq %rax, %rax
je 0x2f3c
cmpl $0x2, 0x8b3f(%rip)      # 0xba18
jl 0x2f3c
movq %rax, %r12
movabsq $0x3d59414c50534944, %rax # imm = 0x3D59414C50534944
movq %rax, (%rdi)
movb $0x0, 0x8(%rdi)
movq %r15, %rsi
callq 0x2510
subq %r15, %r12
leaq (%rbx,%r12), %r14
addq $0x80, %r14
pushq $0x2e
popq %rsi
movq %r14, %rdi
callq 0x2160
testq %rax, %rax
jne 0x2f20
movq %r14, %rdi
callq 0x2140
addq %r14, %rax
leaq 0x4441(%rip), %rsi      # 0x7368
movq %rax, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x2520
movq 0x8a4e(%rip), %r14      # 0xb988
jmp 0x2f3f
movb $0x0, (%rdi)
movq 0xe8(%r14), %rax
movq 0x60(%rax,%r13), %rcx
movq %rcx, 0x28(%rbx)
movq 0x58(%rax,%r13), %rax
movq %rax, 0x30(%rbx)
movq %rcx, 0x38(%rbx)
movq %rax, 0x40(%rbx)
xorq %rax, %rcx
movq %rcx, 0x28(%rsp)
movq %rax, 0x30(%rsp)
movl $0x6, 0x18(%rsp)
andl $0x0, 0x38(%rsp)
movl $0x1, 0x78(%rsp)
movq 0x89d7(%rip), %rax      # 0xb960
testq %rax, %rax
je 0x2f9e
movq 0x8(%rax), %rax
movq %rax, 0x70(%rsp)
movl $0xc01d, %edx           # imm = 0xC01D
jmp 0x2fa3
movl $0x801d, %edx           # imm = 0x801D
movq 0x8(%rbx), %rsi
leaq 0x18(%rsp), %rcx
movq %r14, %rdi
callq 0x2420
movq %rax, 0x20(%rbx)
movq %rbx, %rdi
callq 0x652e
movq 0x68(%rbx), %rax
leaq 0x98(%rsp), %rcx
movq %rax, 0x68(%rcx)
movq $0xd8000c, 0x48(%rcx)   # imm = 0xD8000C
movq 0x89a9(%rip), %rdi      # 0xb988
movq 0x8(%rbx), %rsi
movl $0x4800, %edx           # imm = 0x4800
callq 0x21e0
movq 0x8994(%rip), %rdi      # 0xb988
xorl %esi, %esi
callq 0x23b0
movq 0x8986(%rip), %rdi      # 0xb988
movq 0x8(%rbx), %rsi
movups 0x28(%rbx), %xmm0
movups %xmm0, 0x8(%rsp)
movl $0x1, (%rsp)
pushq $0x1
popq %r8
xorl %edx, %edx
xorl %ecx, %ecx
movl %r8d, %r9d
callq 0x2450
movq %rax, 0x10(%rbx)
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq