// File: /workspace/github_c_makefile_star2_O0/baskerville[P]bspwm/src/restore.c
// Function: restore_monitor
monitor_t *restore_monitor(jsmntok_t **t, char *json)
{
	int num = (*t)->size;
	(*t)++;
	monitor_t *m = make_monitor(NULL, NULL, UINT32_MAX);
	uint32_t focused_desktop_id = 0;

	for (int i = 0; i < num; i++) {
		if (keyeq("name", *t, json)) {
			(*t)++;
			snprintf(m->name, (*t)->end - (*t)->start + 1, "%s", json + (*t)->start);
		RESTORE_UINT(id, &m->id)
		RESTORE_UINT(randrId, &m->randr_id)
		RESTORE_BOOL(wired, &m->wired)
		RESTORE_UINT(stickyCount, &m->sticky_count)
		RESTORE_INT(windowGap, &m->window_gap)
		RESTORE_UINT(borderWidth, &m->border_width)
		RESTORE_UINT(focusedDesktopId, &focused_desktop_id)
		} else if (keyeq("padding", *t, json)) {
			(*t)++;
			restore_padding(&m->padding, t, json);
			continue;
		} else if (keyeq("rectangle", *t, json)) {
			(*t)++;
			restore_rectangle(&m->rectangle, t, json);
			update_root(m, &m->rectangle);
			continue;
		} else if (keyeq("desktops", *t, json)) {
			(*t)++;
			int s = (*t)->size;
			(*t)++;
			for (int j = 0; j < s; j++) {
				desktop_t *d = restore_desktop(t, json);
				add_desktop(m, d);
			}
			continue;
		} else {
			warn("Restore monitor: unknown key: '%.*s'.\n", (*t)->end - (*t)->start, json + (*t)->start);
			(*t)++;
		}
		(*t)++;
	}

	if (focused_desktop_id != 0) {
		for (desktop_t *d = m->desk_head; d != NULL; d = d->next) {
			if (d->id == focused_desktop_id) {
				m->desk = d;
				break;
			}
		}
	}

	return m;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0xc(%rax), %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rcx
addq $0x10, %rcx
movq %rcx, (%rax)
xorl %eax, %eax
movl %eax, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %rsi, %rdi
callq 0x7ec0
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x2787d
movq -0x8(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rdx
leaq 0x6dda(%rip), %rdi      # 0x2e1e6
callq 0x27330
testb $0x1, %al
jne 0x27417
jmp 0x27468
movq -0x8(%rbp), %rax
movq (%rax), %rcx
addq $0x10, %rcx
movq %rcx, (%rax)
movq -0x20(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0x8(%rax), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
subl 0x4(%rcx), %eax
addl $0x1, %eax
movslq %eax, %rsi
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq 0x4(%rax), %rax
addq %rax, %rcx
leaq 0x5c94(%rip), %rdx      # 0x2d0f0
movb $0x0, %al
callq 0x4120
jmp 0x27861
movq -0x8(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rdx
leaq 0x80ab(%rip), %rdi      # 0x2f525
callq 0x27330
testb $0x1, %al
jne 0x27485
jmp 0x274c0
movq -0x8(%rbp), %rax
movq (%rax), %rcx
addq $0x10, %rcx
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq 0x4(%rax), %rax
addq %rax, %rdi
movq -0x20(%rbp), %rdx
addq $0x20, %rdx
leaq 0x72f7(%rip), %rsi      # 0x2e7ab
movb $0x0, %al
callq 0x41c0
jmp 0x2785f
movq -0x8(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rdx
leaq 0x8056(%rip), %rdi      # 0x2f528
callq 0x27330
testb $0x1, %al
jne 0x274dd
jmp 0x27518
movq -0x8(%rbp), %rax
movq (%rax), %rcx
addq $0x10, %rcx
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq 0x4(%rax), %rax
addq %rax, %rdi
movq -0x20(%rbp), %rdx
addq $0x24, %rdx
leaq 0x729f(%rip), %rsi      # 0x2e7ab
movb $0x0, %al
callq 0x41c0
jmp 0x2785d
movq -0x8(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rdx
leaq 0x8006(%rip), %rdi      # 0x2f530
callq 0x27330
testb $0x1, %al
jne 0x27535
jmp 0x27594
movq -0x8(%rbp), %rax
movq (%rax), %rcx
addq $0x10, %rcx
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq 0x4(%rax), %rax
addq %rax, %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0x8(%rax), %eax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
subl 0x4(%rcx), %eax
movslq %eax, %rsi
callq 0x6750
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movq -0x20(%rbp), %rsi
addq $0x2c, %rsi
callq 0x208b0
movq -0x30(%rbp), %rdi
callq 0x4450
jmp 0x2785b
movq -0x8(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rdx
leaq 0x7f90(%rip), %rdi      # 0x2f536
callq 0x27330
testb $0x1, %al
jne 0x275b1
jmp 0x275ec
movq -0x8(%rbp), %rax
movq (%rax), %rcx
addq $0x10, %rcx
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq 0x4(%rax), %rax
addq %rax, %rdi
movq -0x20(%rbp), %rdx
addq $0x40, %rdx
leaq 0x71cb(%rip), %rsi      # 0x2e7ab
movb $0x0, %al
callq 0x41c0
jmp 0x27859
movq -0x8(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rdx
leaq 0x7f44(%rip), %rdi      # 0x2f542
callq 0x27330
testb $0x1, %al
jne 0x27609
jmp 0x27644
movq -0x8(%rbp), %rax
movq (%rax), %rcx
addq $0x10, %rcx
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq 0x4(%rax), %rax
addq %rax, %rdi
movq -0x20(%rbp), %rdx
addq $0x44, %rdx
leaq 0x7ca1(%rip), %rsi      # 0x2f2d9
movb $0x0, %al
callq 0x41c0
jmp 0x27857
movq -0x8(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rdx
leaq 0x7ef6(%rip), %rdi      # 0x2f54c
callq 0x27330
testb $0x1, %al
jne 0x27661
jmp 0x2769c
movq -0x8(%rbp), %rax
movq (%rax), %rcx
addq $0x10, %rcx
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq 0x4(%rax), %rax
addq %rax, %rdi
movq -0x20(%rbp), %rdx
addq $0x48, %rdx
leaq 0x711b(%rip), %rsi      # 0x2e7ab
movb $0x0, %al
callq 0x41c0
jmp 0x27855
movq -0x8(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rdx
leaq 0x7eaa(%rip), %rdi      # 0x2f558
callq 0x27330
testb $0x1, %al
jne 0x276b9
jmp 0x276f0
movq -0x8(%rbp), %rax
movq (%rax), %rcx
addq $0x10, %rcx
movq %rcx, (%rax)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq 0x4(%rax), %rax
addq %rax, %rdi
leaq 0x70cb(%rip), %rsi      # 0x2e7ab
leaq -0x24(%rbp), %rdx
movb $0x0, %al
callq 0x41c0
jmp 0x27853
movq -0x8(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rdx
leaq 0x7159(%rip), %rdi      # 0x2e85b
callq 0x27330
testb $0x1, %al
jne 0x2770d
jmp 0x27735
movq -0x8(%rbp), %rax
movq (%rax), %rcx
addq $0x10, %rcx
movq %rcx, (%rax)
movq -0x20(%rbp), %rdi
addq $0x30, %rdi
movq -0x8(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x27aa0
jmp 0x2786f
movq -0x8(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rdx
leaq 0x6bb5(%rip), %rdi      # 0x2e2fc
callq 0x27330
testb $0x1, %al
jne 0x27752
jmp 0x2778b
movq -0x8(%rbp), %rax
movq (%rax), %rcx
addq $0x10, %rcx
movq %rcx, (%rax)
movq -0x20(%rbp), %rdi
addq $0x4c, %rdi
movq -0x8(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x27c60
movq -0x20(%rbp), %rdi
movq -0x20(%rbp), %rsi
addq $0x4c, %rsi
callq 0x8040
jmp 0x2786f
movq -0x8(%rbp), %rax
movq (%rax), %rsi
movq -0x10(%rbp), %rdx
leaq 0x6bea(%rip), %rdi      # 0x2e387
callq 0x27330
testb $0x1, %al
jne 0x277a8
jmp 0x2780b
movq -0x8(%rbp), %rax
movq (%rax), %rcx
addq $0x10, %rcx
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0xc(%rax), %eax
movl %eax, -0x34(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rcx
addq $0x10, %rcx
movq %rcx, (%rax)
movl $0x0, -0x38(%rbp)
movl -0x38(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x27809
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x27e20
movq %rax, -0x40(%rbp)
movq -0x20(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0xa610
movl -0x38(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x38(%rbp)
jmp 0x277d8
jmp 0x2786f
movq -0x8(%rbp), %rax
movq (%rax), %rax
movl 0x8(%rax), %esi
movq -0x8(%rbp), %rax
movq (%rax), %rax
subl 0x4(%rax), %esi
movq -0x10(%rbp), %rdx
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq 0x4(%rax), %rax
addq %rax, %rdx
leaq 0x7d31(%rip), %rdi      # 0x2f569
movb $0x0, %al
callq 0x6410
movq -0x8(%rbp), %rax
movq (%rax), %rcx
addq $0x10, %rcx
movq %rcx, (%rax)
jmp 0x2784f
jmp 0x27851
jmp 0x27853
jmp 0x27855
jmp 0x27857
jmp 0x27859
jmp 0x2785b
jmp 0x2785d
jmp 0x2785f
jmp 0x27861
movq -0x8(%rbp), %rax
movq (%rax), %rcx
addq $0x10, %rcx
movq %rcx, (%rax)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x273ee
cmpl $0x0, -0x24(%rbp)
je 0x278c2
movq -0x20(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x278c0
movq -0x48(%rbp), %rax
movl 0x20(%rax), %eax
cmpl -0x24(%rbp), %eax
jne 0x278b0
movq -0x48(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x58(%rax)
jmp 0x278c0
jmp 0x278b2
movq -0x48(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x48(%rbp)
jmp 0x2788f
jmp 0x278c2
movq -0x20(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)