// File: /workspace/github_c_makefile_star2_O0/kek[P]evilwm/main.c
// Function: setup_display
static void setup_display(void) {
	XGCValues gv;
	XSetWindowAttributes attr;
	XColor dummy;
	XModifierKeymap *modmap;
	/* used in scanning windows (XQueryTree) */
	unsigned int i, j, nwins;
	Window dw1, dw2, *wins;
	XWindowAttributes winattr;

	LOG_ENTER("setup_display()");

	dpy = XOpenDisplay(opt_display);
	if (!dpy) {
		LOG_ERROR("can't open display %s\n", opt_display);
		exit(1);
	}
	XSetErrorHandler(handle_xerror);
	/* XSynchronize(dpy, True); */

	/* Standard & EWMH atoms */
	ewmh_init();

	font = XLoadQueryFont(dpy, opt_font);
	if (!font) font = XLoadQueryFont(dpy, DEF_FONT);
	if (!font) {
		LOG_ERROR("couldn't find a font to use: try starting with -fn fontname\n");
		exit(1);
	}

	move_curs = XCreateFontCursor(dpy, XC_fleur);
	resize_curs = XCreateFontCursor(dpy, XC_plus);

	/* find out which modifier is NumLock - we'll use this when grabbing
	 * every combination of modifiers we can think of */
	modmap = XGetModifierMapping(dpy);
	for (i = 0; i < 8; i++) {
		for (j = 0; j < (unsigned int)modmap->max_keypermod; j++) {
			if (modmap->modifiermap[i*modmap->max_keypermod+j] == XKeysymToKeycode(dpy, XK_Num_Lock)) {
				numlockmask = (1<<i);
				LOG_DEBUG("XK_Num_Lock is (1<<0x%02x)\n", i);
			}
		}
	}
	XFreeModifiermap(modmap);

	/* set up GC parameters - same for each screen */
	gv.function = GXinvert;
	gv.subwindow_mode = IncludeInferiors;
	gv.line_width = 1;  /* opt_bw */
	gv.font = font->fid;

	/* set up root window attributes - same for each screen */
	attr.event_mask = ChildMask | EnterWindowMask | ColormapChangeMask;

	/* SHAPE extension? */
#ifdef SHAPE
	{
		int e_dummy;
		have_shape = XShapeQueryExtension(dpy, &shape_event, &e_dummy);
	}
#endif
	/* Xrandr extension? */
#ifdef RANDR
	{
		int e_dummy;
		have_randr = XRRQueryExtension(dpy, &randr_event_base, &e_dummy);
		if (!have_randr) {
			LOG_DEBUG("XRandR is not supported on this display.\n");
		}
	}
#endif

	/* now set up each screen in turn */
	num_screens = ScreenCount(dpy);
	if (num_screens < 0) {
		LOG_ERROR("Can't count screens\n");
		exit(1);
	}
	screens = xmalloc(num_screens * sizeof(ScreenInfo));
	for (i = 0; i < (unsigned int)num_screens; i++) {
		char *ds, *colon, *dot;
		ds = DisplayString(dpy);
		/* set up DISPLAY environment variable to use */
		colon = strrchr(ds, ':');
		screens[i].display = xmalloc(14 + strlen(ds));
		strcpy(screens[i].display, "DISPLAY=");
		strcat(screens[i].display, ds);
		if (colon && num_screens > 1) {
			colon = strrchr(screens[i].display, ':');
			dot = strchr(colon, '.');
			if (!dot)
				dot = colon + strlen(colon);
			snprintf(dot, 5, ".%d", i);
		}

		screens[i].screen = i;
		screens[i].root = RootWindow(dpy, i);
#ifdef RANDR
		if (have_randr) {
			XRRSelectInput(dpy, screens[i].root, RRScreenChangeNotifyMask);
		}
#endif
#ifdef VWM
		screens[i].vdesk = KEY_TO_VDESK(XK_1);
#endif

		XAllocNamedColor(dpy, DefaultColormap(dpy, i), opt_fg, &screens[i].fg, &dummy);
		XAllocNamedColor(dpy, DefaultColormap(dpy, i), opt_bg, &screens[i].bg, &dummy);
#ifdef VWM
		XAllocNamedColor(dpy, DefaultColormap(dpy, i), opt_fc, &screens[i].fc, &dummy);
#endif

		screens[i].invert_gc = XCreateGC(dpy, screens[i].root, GCFunction | GCSubwindowMode | GCLineWidth | GCFont, &gv);

		XChangeWindowAttributes(dpy, screens[i].root, CWEventMask, &attr);
		grab_keys_for_screen(&screens[i]);
		screens[i].docks_visible = 1;

		/* scan all the windows on this screen */
		LOG_XENTER("XQueryTree(screen=%d)", i);
		XQueryTree(dpy, screens[i].root, &dw1, &dw2, &wins, &nwins);
		LOG_XDEBUG("%d windows\n", nwins);
		LOG_XLEAVE();
		for (j = 0; j < nwins; j++) {
			XGetWindowAttributes(dpy, wins[j], &winattr);
			if (!winattr.override_redirect && winattr.map_state == IsViewable)
				make_new_client(wins[j], &screens[i]);
		}
		XFree(wins);
		ewmh_init_screen(&screens[i]);
	}
	ewmh_set_net_active_window(NULL);
	LOG_LEAVE();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1f0, %rsp            # imm = 0x1F0
movq 0x81f6(%rip), %rdi      # 0xf608
callq 0x3340
movq %rax, 0x8562(%rip)      # 0xf980
cmpq $0x0, 0x855a(%rip)      # 0xf980
jne 0x7451
movq 0x7bc9(%rip), %rax      # 0xeff8
movq (%rax), %rdi
movq 0x81cf(%rip), %rdx      # 0xf608
leaq 0x526b(%rip), %rsi      # 0xc6ab
movb $0x0, %al
callq 0x3350
movl $0x1, %edi
callq 0x3680
leaq 0x9f8(%rip), %rdi       # 0x7e50
callq 0x3430
callq 0x59a0
movq 0x8517(%rip), %rdi      # 0xf980
movq 0x8190(%rip), %rsi      # 0xf600
callq 0x32b0
movq %rax, 0x850c(%rip)      # 0xf988
cmpq $0x0, 0x8504(%rip)      # 0xf988
jne 0x74a0
movq 0x84f3(%rip), %rdi      # 0xf980
leaq 0x5086(%rip), %rsi      # 0xc51a
callq 0x32b0
movq %rax, 0x84e8(%rip)      # 0xf988
cmpq $0x0, 0x84e0(%rip)      # 0xf988
jne 0x74cc
movq 0x7b47(%rip), %rax      # 0xeff8
movq (%rax), %rdi
leaq 0x5207(%rip), %rsi      # 0xc6c2
movb $0x0, %al
callq 0x3350
movl $0x1, %edi
callq 0x3680
movq 0x84ad(%rip), %rdi      # 0xf980
movl $0x34, %esi
callq 0x3140
movq %rax, 0x84bc(%rip)      # 0xf9a0
movq 0x8495(%rip), %rdi      # 0xf980
movl $0x5a, %esi
callq 0x3140
movq %rax, 0x84ac(%rip)      # 0xf9a8
movq 0x847d(%rip), %rdi      # 0xf980
callq 0x3390
movq %rax, -0x108(%rbp)
movl $0x0, -0x10c(%rbp)
cmpl $0x8, -0x10c(%rbp)
jae 0x75cd
movl $0x0, -0x110(%rbp)
movl -0x110(%rbp), %eax
movq -0x108(%rbp), %rcx
cmpl (%rcx), %eax
jae 0x75b7
movq -0x108(%rbp), %rax
movq 0x8(%rax), %rax
movl -0x10c(%rbp), %ecx
movq -0x108(%rbp), %rdx
imull (%rdx), %ecx
addl -0x110(%rbp), %ecx
movl %ecx, %ecx
movzbl (%rax,%rcx), %eax
movl %eax, -0x1dc(%rbp)
movq 0x840b(%rip), %rdi      # 0xf980
movl $0xff7f, %esi           # imm = 0xFF7F
callq 0x33c0
movb %al, %cl
movl -0x1dc(%rbp), %eax
movzbl %cl, %ecx
cmpl %ecx, %eax
jne 0x75a1
movl -0x10c(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
movl %eax, 0x837f(%rip)      # 0xf920
jmp 0x75a3
movl -0x110(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x110(%rbp)
jmp 0x7530
jmp 0x75b9
movl -0x10c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10c(%rbp)
jmp 0x7519
movq -0x108(%rbp), %rdi
callq 0x3080
movl $0xa, -0x80(%rbp)
movl $0x1, -0x20(%rbp)
movl $0x1, -0x60(%rbp)
movq 0x8393(%rip), %rax      # 0xf988
movq 0x8(%rax), %rax
movq %rax, -0x28(%rbp)
movq $0x980010, -0xa8(%rbp) # imm = 0x980010
movq 0x8371(%rip), %rdi      # 0xf980
leaq 0x839e(%rip), %rsi      # 0xf9b4
leaq -0x1bc(%rbp), %rdx
callq 0x3550
movl %eax, 0x8388(%rip)      # 0xf9b0
movq 0x8351(%rip), %rdi      # 0xf980
leaq 0x8386(%rip), %rsi      # 0xf9bc
leaq -0x1c0(%rbp), %rdx
callq 0x3110
movl %eax, 0x8370(%rip)      # 0xf9b8
cmpl $0x0, 0x8369(%rip)      # 0xf9b8
jne 0x7653
jmp 0x7653
movq 0x8326(%rip), %rax      # 0xf980
movl 0xe4(%rax), %eax
movl %eax, 0x832a(%rip)      # 0xf990
cmpl $0x0, 0x8323(%rip)      # 0xf990
jge 0x7691
movq 0x7982(%rip), %rax      # 0xeff8
movq (%rax), %rdi
leaq 0x507f(%rip), %rsi      # 0xc6ff
movb $0x0, %al
callq 0x3350
movl $0x1, %edi
callq 0x3680
movslq 0x82f8(%rip), %rax      # 0xf990
imulq $0x70, %rax, %rdi
callq 0x72d0
movq %rax, 0x82f0(%rip)      # 0xf998
movl $0x0, -0x10c(%rbp)
movl -0x10c(%rbp), %eax
cmpl 0x82d2(%rip), %eax      # 0xf990
jae 0x7b66
movq 0x82b5(%rip), %rax      # 0xf980
movq 0xd8(%rax), %rax
movq %rax, -0x1c8(%rbp)
movq -0x1c8(%rbp), %rdi
movl $0x3a, %esi
callq 0x3270
movq %rax, -0x1d0(%rbp)
movq -0x1c8(%rbp), %rdi
callq 0x31e0
movq %rax, %rdi
addq $0xe, %rdi
callq 0x72d0
movq %rax, %rcx
movq 0x8285(%rip), %rax      # 0xf998
movl -0x10c(%rbp), %edx
imulq $0x70, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x60(%rax)
movq 0x826d(%rip), %rax      # 0xf998
movl -0x10c(%rbp), %ecx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq 0x60(%rax), %rdi
leaq 0x4fd1(%rip), %rsi      # 0xc714
callq 0x3100
movq 0x8249(%rip), %rax      # 0xf998
movl -0x10c(%rbp), %ecx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq 0x60(%rax), %rdi
movq -0x1c8(%rbp), %rsi
callq 0x3660
cmpq $0x0, -0x1d0(%rbp)
je 0x7820
cmpl $0x1, 0x820f(%rip)      # 0xf990
jle 0x7820
movq 0x820a(%rip), %rax      # 0xf998
movl -0x10c(%rbp), %ecx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq 0x60(%rax), %rdi
movl $0x3a, %esi
callq 0x3270
movq %rax, -0x1d0(%rbp)
movq -0x1d0(%rbp), %rdi
movl $0x2e, %esi
callq 0x3200
movq %rax, -0x1d8(%rbp)
cmpq $0x0, -0x1d8(%rbp)
jne 0x7800
movq -0x1d0(%rbp), %rax
movq %rax, -0x1e8(%rbp)
movq -0x1d0(%rbp), %rdi
callq 0x31e0
movq %rax, %rcx
movq -0x1e8(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x1d8(%rbp)
movq -0x1d8(%rbp), %rdi
movl -0x10c(%rbp), %ecx
movl $0x5, %esi
leaq 0x4f04(%rip), %rdx      # 0xc71d
movb $0x0, %al
callq 0x3250
movl -0x10c(%rbp), %ecx
movq 0x816b(%rip), %rax      # 0xf998
movl -0x10c(%rbp), %edx
imulq $0x70, %rdx, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movq 0x813d(%rip), %rax      # 0xf980
movq 0xe8(%rax), %rax
movl -0x10c(%rbp), %ecx
shlq $0x7, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rcx
movq 0x8136(%rip), %rax      # 0xf998
movl -0x10c(%rbp), %edx
imulq $0x70, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x8(%rax)
cmpl $0x0, 0x813e(%rip)      # 0xf9b8
je 0x78a5
movq 0x80fd(%rip), %rdi      # 0xf980
movq 0x810e(%rip), %rax      # 0xf998
movl -0x10c(%rbp), %ecx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
movl $0x1, %edx
callq 0x3690
movq 0x80ec(%rip), %rax      # 0xf998
movl -0x10c(%rbp), %ecx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0x40(%rax)
movq 0x80b9(%rip), %rdi      # 0xf980
movq 0x80b2(%rip), %rax      # 0xf980
movq 0xe8(%rax), %rax
movl -0x10c(%rbp), %ecx
shlq $0x7, %rcx
addq %rcx, %rax
movq 0x50(%rax), %rsi
movq 0x7d23(%rip), %rdx      # 0xf610
movq 0x80a4(%rip), %rcx      # 0xf998
movl -0x10c(%rbp), %eax
imulq $0x70, %rax, %rax
addq %rax, %rcx
addq $0x20, %rcx
leaq -0x100(%rbp), %r8
callq 0x3510
movq 0x8068(%rip), %rdi      # 0xf980
movq 0x8061(%rip), %rax      # 0xf980
movq 0xe8(%rax), %rax
movl -0x10c(%rbp), %ecx
shlq $0x7, %rcx
addq %rcx, %rax
movq 0x50(%rax), %rsi
movq 0x7cda(%rip), %rdx      # 0xf618
movq 0x8053(%rip), %rcx      # 0xf998
movl -0x10c(%rbp), %eax
imulq $0x70, %rax, %rax
addq %rax, %rcx
addq $0x30, %rcx
leaq -0x100(%rbp), %r8
callq 0x3510
movq 0x8017(%rip), %rdi      # 0xf980
movq 0x8010(%rip), %rax      # 0xf980
movq 0xe8(%rax), %rax
movl -0x10c(%rbp), %ecx
shlq $0x7, %rcx
addq %rcx, %rax
movq 0x50(%rax), %rsi
movq 0x7c91(%rip), %rdx      # 0xf620
movq 0x8002(%rip), %rcx      # 0xf998
movl -0x10c(%rbp), %eax
imulq $0x70, %rax, %rax
addq %rax, %rcx
addq $0x48, %rcx
leaq -0x100(%rbp), %r8
callq 0x3510
movq 0x7fc6(%rip), %rdi      # 0xf980
movq 0x7fd7(%rip), %rax      # 0xf998
movl -0x10c(%rbp), %ecx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
movl $0xc011, %edx           # imm = 0xC011
leaq -0x80(%rbp), %rcx
callq 0x3540
movq %rax, %rcx
movq 0x7fae(%rip), %rax      # 0xf998
movl -0x10c(%rbp), %edx
imulq $0x70, %rdx, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
movq 0x7f7e(%rip), %rdi      # 0xf980
movq 0x7f8f(%rip), %rax      # 0xf998
movl -0x10c(%rbp), %ecx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
movl $0x800, %edx            # imm = 0x800
leaq -0xf0(%rbp), %rcx
callq 0x32a0
movq 0x7f66(%rip), %rdi      # 0xf998
movl -0x10c(%rbp), %eax
imulq $0x70, %rax, %rax
addq %rax, %rdi
callq 0xa710
movq 0x7f4d(%rip), %rax      # 0xf998
movl -0x10c(%rbp), %ecx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movl $0x1, 0x68(%rax)
movq 0x7f1a(%rip), %rdi      # 0xf980
movq 0x7f2b(%rip), %rax      # 0xf998
movl -0x10c(%rbp), %ecx
imulq $0x70, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
leaq -0x120(%rbp), %rdx
leaq -0x128(%rbp), %rcx
leaq -0x130(%rbp), %r8
leaq -0x114(%rbp), %r9
callq 0x31d0
movl $0x0, -0x110(%rbp)
movl -0x110(%rbp), %eax
cmpl -0x114(%rbp), %eax
jae 0x7b2d
movq 0x7ec2(%rip), %rdi      # 0xf980
movq -0x130(%rbp), %rax
movl -0x110(%rbp), %ecx
movq (%rax,%rcx,8), %rsi
leaq -0x1b8(%rbp), %rdx
callq 0x35d0
cmpl $0x0, -0x140(%rbp)
jne 0x7b17
cmpl $0x2, -0x15c(%rbp)
jne 0x7b17
movq -0x130(%rbp), %rax
movl -0x110(%rbp), %ecx
movq (%rax,%rcx,8), %rdi
movq 0x7e93(%rip), %rsi      # 0xf998
movl -0x10c(%rbp), %eax
imulq $0x70, %rax, %rax
addq %rax, %rsi
callq 0x7fe0
jmp 0x7b19
movl -0x110(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x110(%rbp)
jmp 0x7aa9
movq -0x130(%rbp), %rdi
callq 0x3220
movq 0x7e58(%rip), %rdi      # 0xf998
movl -0x10c(%rbp), %eax
imulq $0x70, %rax, %rax
addq %rax, %rdi
callq 0x5ea0
movl -0x10c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10c(%rbp)
jmp 0x76b2
xorl %eax, %eax
movl %eax, %edi
callq 0x6900
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbp
retq
nopl (%rax,%rax)