// File: /workspace/github_c_makefile_star2_O0/tudurom[P]windowchef/wm.c
// Function: get_outputs
static void
get_outputs(xcb_randr_output_t *outputs, int len, xcb_timestamp_t timestamp)
{
	int name_len;
	char *name;
	xcb_randr_get_crtc_info_cookie_t info_c;
	xcb_randr_get_crtc_info_reply_t *crtc;
	xcb_randr_get_output_info_reply_t *output;
	struct monitor *mon, *clonemon;
	struct list_item *item;
	xcb_randr_get_output_info_cookie_t out_cookie[len];

	for (int i = 0; i < len; i++)
		out_cookie[i] = xcb_randr_get_output_info(conn, outputs[i],
				timestamp);

	for (int i = 0; i < len; i++) {
		output = xcb_randr_get_output_info_reply(conn, out_cookie[i], NULL);
		if (output == NULL)
			continue;

		name_len = xcb_randr_get_output_info_name_length(output);
		if (16 < name_len)
			name_len = 16;

		/* +1 for the null character */
		name = malloc(name_len + 1);
		/* make sure the name is at most name_len + 1 length
		 * or we may run into problems. */
		snprintf(name, name_len + 1, "%.*s", name_len,
				xcb_randr_get_output_info_name(output));

		if (output->crtc != XCB_NONE) {
			info_c = xcb_randr_get_crtc_info(conn, output->crtc,
					timestamp);
			crtc = xcb_randr_get_crtc_info_reply(conn, info_c, NULL);

			if (crtc == NULL)
				return;

			clonemon = find_clones(outputs[i], crtc->x, crtc->y);
			if (clonemon != NULL)
				continue;

			mon = find_monitor(outputs[i]);
			if (mon == NULL) {
				add_monitor(outputs[i], name, crtc->x, crtc->y,
						crtc->width, crtc->height);
			} else {
				mon->x = crtc->x;
				mon->y = crtc->y;
				mon->width = crtc->width;
				mon->height = crtc->height;

				arrange_by_monitor(mon);
			}

			free(crtc);
		} else {
			/* Check if the monitor was used before
			 * becoming disabled. */
			mon = find_monitor(outputs[i]);
			if (mon) {
				struct client *client;
				for (item = win_list; item != NULL; item = item->next) {
					/* Move window from this monitor to
					 * either the next one or the first one. */
					client = item->data;

					if (client->monitor == mon) {
						if (client->monitor->item->next)
							/* If at end, take from the beginning */
							if (mon_list == NULL)
								client->monitor = NULL;
							else
								client->monitor = mon_list->data;
						else
							client->monitor = client->monitor->item->next->data;
						fit_on_screen(client);
					}
				}

				/* Monitor not active. Delete it. */
				free_monitor(mon);
			}
		}

		if (output != NULL)
			free(output);
		free(name);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl -0xc(%rbp), %eax
movq %rsp, %rcx
movq %rcx, -0x58(%rbp)
leaq 0xf(,%rax,4), %rdx
andq $-0x10, %rdx
movq %rsp, %rcx
subq %rdx, %rcx
movq %rcx, -0x88(%rbp)
movq %rcx, %rsp
movq %rax, -0x60(%rbp)
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x78b7
movslq -0x64(%rbp), %rax
movq %rax, -0x90(%rbp)
movq 0x7b58(%rip), %rdi      # 0xf3d8
movq -0x8(%rbp), %rax
movslq -0x64(%rbp), %rcx
movl (%rax,%rcx,4), %esi
movl -0x10(%rbp), %edx
callq 0x3440
movq -0x90(%rbp), %rcx
movl %eax, %edx
movq -0x88(%rbp), %rax
movl %edx, -0x68(%rbp)
movl -0x68(%rbp), %edx
movl %edx, (%rax,%rcx,4)
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x7866
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x7baf
movq -0x88(%rbp), %rax
movq 0x7b00(%rip), %rdi      # 0xf3d8
movslq -0x6c(%rbp), %rcx
movl (%rax,%rcx,4), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x3220
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x78f8
jmp 0x7ba1
movq -0x38(%rbp), %rdi
callq 0x3320
movl %eax, -0x14(%rbp)
movl $0x10, %eax
cmpl -0x14(%rbp), %eax
jge 0x7915
movl $0x10, -0x14(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rdi
callq 0x31b0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0xa8(%rbp)
movl -0x14(%rbp), %eax
addl $0x1, %eax
cltq
movq %rax, -0xa0(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x94(%rbp)
movq -0x38(%rbp), %rdi
callq 0x33e0
movq -0xa8(%rbp), %rdi
movq -0xa0(%rbp), %rsi
movl -0x94(%rbp), %ecx
movq %rax, %r8
leaq 0x49ae(%rip), %rdx      # 0xc31f
movb $0x0, %al
callq 0x30b0
movq -0x38(%rbp), %rax
movl 0xc(%rax), %eax
cmpq $0x0, %rax
je 0x7ab9
movq 0x7a48(%rip), %rdi      # 0xf3d8
movq -0x38(%rbp), %rax
movl 0xc(%rax), %esi
movl -0x10(%rbp), %edx
callq 0x32a0
movl %eax, -0x70(%rbp)
movl -0x70(%rbp), %eax
movl %eax, -0x24(%rbp)
movq 0x7a29(%rip), %rdi      # 0xf3d8
movl -0x24(%rbp), %esi
xorl %eax, %eax
movl %eax, %edx
callq 0x33a0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x79d2
movl $0x1, -0x74(%rbp)
jmp 0x7bb6
movq -0x8(%rbp), %rax
movslq -0x6c(%rbp), %rcx
movl (%rax,%rcx,4), %edi
movq -0x30(%rbp), %rax
movw 0xc(%rax), %cx
movq -0x30(%rbp), %rax
movswl %cx, %esi
movswl 0xe(%rax), %edx
callq 0x7bd0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x7a05
jmp 0x7ba1
movq -0x8(%rbp), %rax
movslq -0x6c(%rbp), %rcx
movl (%rax,%rcx,4), %edi
callq 0x7c80
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x7a62
movq -0x8(%rbp), %rax
movslq -0x6c(%rbp), %rcx
movl (%rax,%rcx,4), %edi
movq -0x20(%rbp), %rsi
movq -0x30(%rbp), %rax
movw 0xc(%rax), %dx
movq -0x30(%rbp), %rax
movw 0xe(%rax), %cx
movq -0x30(%rbp), %rax
movw 0x10(%rax), %r8w
movq -0x30(%rbp), %rax
movswl %dx, %edx
movswl %cx, %ecx
movzwl %r8w, %r8d
movzwl 0x12(%rax), %r9d
callq 0x7cf0
jmp 0x7aab
movq -0x30(%rbp), %rax
movw 0xc(%rax), %cx
movq -0x40(%rbp), %rax
movw %cx, 0x10(%rax)
movq -0x30(%rbp), %rax
movw 0xe(%rax), %cx
movq -0x40(%rbp), %rax
movw %cx, 0x12(%rax)
movq -0x30(%rbp), %rax
movw 0x10(%rax), %cx
movq -0x40(%rbp), %rax
movw %cx, 0x14(%rax)
movq -0x30(%rbp), %rax
movw 0x12(%rax), %cx
movq -0x40(%rbp), %rax
movw %cx, 0x16(%rax)
movq -0x40(%rbp), %rdi
callq 0x7e00
movq -0x30(%rbp), %rdi
callq 0x32d0
jmp 0x7b88
movq -0x8(%rbp), %rax
movslq -0x6c(%rbp), %rcx
movl (%rax,%rcx,4), %edi
callq 0x7c80
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x7b86
movq 0x7909(%rip), %rax      # 0xf3e8
movq %rax, -0x50(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x7b7d
movq -0x50(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
movq 0x40(%rax), %rax
cmpq -0x40(%rbp), %rax
jne 0x7b6a
movq -0x80(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x18(%rax), %rax
cmpq $0x0, 0x10(%rax)
je 0x7b46
cmpq $0x0, 0x7d0e(%rip)      # 0xf830
jne 0x7b32
movq -0x80(%rbp), %rax
movq $0x0, 0x40(%rax)
jmp 0x7b44
movq 0x7cf7(%rip), %rax      # 0xf830
movq (%rax), %rcx
movq -0x80(%rbp), %rax
movq %rcx, 0x40(%rax)
jmp 0x7b61
movq -0x80(%rbp), %rax
movq 0x40(%rax), %rax
movq 0x18(%rax), %rax
movq 0x10(%rax), %rax
movq (%rax), %rcx
movq -0x80(%rbp), %rax
movq %rcx, 0x40(%rax)
movq -0x80(%rbp), %rdi
callq 0x5060
jmp 0x7b6c
movq -0x50(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x50(%rbp)
jmp 0x7ae3
movq -0x40(%rbp), %rdi
callq 0x7e60
jmp 0x7b88
cmpq $0x0, -0x38(%rbp)
je 0x7b98
movq -0x38(%rbp), %rdi
callq 0x32d0
movq -0x20(%rbp), %rdi
callq 0x32d0
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x78be
movl $0x0, -0x74(%rbp)
movq -0x58(%rbp), %rax
movq %rax, %rsp
movq %rbp, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)