// File: /workspace/github_c_makefile_star2_O1/baskerville[P]bspwm/src/restore.c
// Function: restore_client
client_t *restore_client(jsmntok_t **t, char *json)
{
	if ((*t)->type == JSMN_PRIMITIVE) {
		(*t)++;
		return NULL;
	} else {
		int s = (*t)->size;
		(*t)++;
		client_t *c = make_client();

		for (int i = 0; i < s; i++) {
			if (keyeq("className", *t, json)) {
				(*t)++;
				snprintf(c->class_name, (*t)->end - (*t)->start + 1, "%s", json + (*t)->start);
			} else if (keyeq("instanceName", *t, json)) {
				(*t)++;
				snprintf(c->instance_name, (*t)->end - (*t)->start + 1, "%s", json + (*t)->start);
			RESTORE_ANY(state, &c->state, parse_client_state)
			RESTORE_ANY(lastState, &c->last_state, parse_client_state)
			RESTORE_ANY(layer, &c->layer, parse_stack_layer)
			RESTORE_ANY(lastLayer, &c->last_layer, parse_stack_layer)
			RESTORE_UINT(borderWidth, &c->border_width)
			RESTORE_BOOL(urgent, &c->urgent)
			RESTORE_BOOL(shown, &c->shown)
			} else if (keyeq("tiledRectangle", *t, json)) {
				(*t)++;
				restore_rectangle(&c->tiled_rectangle, t, json);
				continue;
			} else if (keyeq("floatingRectangle", *t, json)) {
				(*t)++;
				restore_rectangle(&c->floating_rectangle, t, json);
				continue;
			} else {
				warn("Restore client: unknown key: '%.*s'.\n", (*t)->end - (*t)->start, json + (*t)->start);
				(*t)++;
			}

			(*t)++;
		}

		return c;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
movq (%rdi), %rax
cmpl $0x4, (%rax)
jne 0x1c740
addq $0x10, %rax
movq %rax, (%rbx)
xorl %r15d, %r15d
jmp 0x1caca
movq %rsi, %r14
movl 0xc(%rax), %ebp
addq $0x10, %rax
movq %rax, (%rbx)
callq 0xa7fd
movq %rax, %r15
testl %ebp, %ebp
jle 0x1caca
leaq 0x318(%r15), %rax
movq %rax, 0x8(%rsp)
leaq 0x320(%r15), %rax
movq %rax, 0x10(%rsp)
leaq 0x305(%r15), %rax
movq %rax, 0x18(%rsp)
leaq 0x304(%r15), %rax
movq %rax, 0x20(%rsp)
leaq 0x300(%r15), %rax
movq %rax, 0x28(%rsp)
leaq 0x314(%r15), %rax
movq %rax, 0x30(%rsp)
leaq 0x310(%r15), %rax
movq %rax, 0x38(%rsp)
leaq 0x30c(%r15), %rax
movq %rax, 0x40(%rsp)
leaq 0x308(%r15), %rax
movq %rax, 0x48(%rsp)
movq %r15, %rax
addq $0x100, %rax            # imm = 0x100
movq %rax, 0x50(%rsp)
leaq 0x4cfc(%rip), %r13      # 0x214da
movq (%rbx), %r12
movq %r13, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0x1b678
testb %al, %al
je 0x1c814
leaq 0x10(%r12), %rax
movq %rax, (%rbx)
movl 0x18(%r12), %eax
movslq 0x14(%r12), %rcx
subl %ecx, %eax
incl %eax
movslq %eax, %rsi
addq %r14, %rcx
movq %r15, %rdi
jmp 0x1c84b
leaq 0x4cc9(%rip), %rdi      # 0x214e4
movq %r12, %rsi
movq %r14, %rdx
callq 0x1b678
testb %al, %al
je 0x1c85e
leaq 0x10(%r12), %rax
movq %rax, (%rbx)
movl 0x18(%r12), %eax
movslq 0x14(%r12), %rcx
subl %ecx, %eax
incl %eax
movslq %eax, %rsi
addq %r14, %rcx
movq 0x50(%rsp), %rdi
leaq 0x27f5(%rip), %rdx      # 0x1f047
xorl %eax, %eax
callq 0x4110
jmp 0x1c8eb
leaq 0x3537(%rip), %rdi      # 0x1fd9c
movq %r12, %rsi
movq %r14, %rdx
callq 0x1b678
testb %al, %al
je 0x1c89f
leaq 0x10(%r12), %rax
movq %rax, (%rbx)
movslq 0x14(%r12), %rax
leaq (%r14,%rax), %rdi
movslq 0x18(%r12), %rsi
subq %rax, %rsi
callq 0x5e6e
movq %rax, %r12
movq %rax, %rdi
movq 0x48(%rsp), %rsi
jmp 0x1c8de
leaq 0x4c4b(%rip), %rdi      # 0x214f1
movq %r12, %rsi
movq %r14, %rdx
callq 0x1b678
testb %al, %al
je 0x1c8fc
leaq 0x10(%r12), %rax
movq %rax, (%rbx)
movslq 0x14(%r12), %rax
leaq (%r14,%rax), %rdi
movslq 0x18(%r12), %rsi
subq %rax, %rsi
callq 0x5e6e
movq %rax, %r12
movq %rax, %rdi
movq 0x40(%rsp), %rsi
callq 0x16b03
movq %r12, %rdi
callq 0x4460
addq $0x10, (%rbx)
decl %ebp
jne 0x1c7de
jmp 0x1caca
leaq 0x346c(%rip), %rdi      # 0x1fd6f
movq %r12, %rsi
movq %r14, %rdx
callq 0x1b678
testb %al, %al
je 0x1c93d
leaq 0x10(%r12), %rax
movq %rax, (%rbx)
movslq 0x14(%r12), %rax
leaq (%r14,%rax), %rdi
movslq 0x18(%r12), %rsi
subq %rax, %rsi
callq 0x5e6e
movq %rax, %r12
movq %rax, %rdi
movq 0x38(%rsp), %rsi
jmp 0x1c97c
leaq 0x4bb7(%rip), %rdi      # 0x214fb
movq %r12, %rsi
movq %r14, %rdx
callq 0x1b678
testb %al, %al
je 0x1c986
leaq 0x10(%r12), %rax
movq %rax, (%rbx)
movslq 0x14(%r12), %rax
leaq (%r14,%rax), %rdi
movslq 0x18(%r12), %rsi
subq %rax, %rsi
callq 0x5e6e
movq %rax, %r12
movq %rax, %rdi
movq 0x30(%rsp), %rsi
callq 0x16b80
jmp 0x1c8e3
leaq 0x4a51(%rip), %rdi      # 0x213de
movq %r12, %rsi
movq %r14, %rdx
callq 0x1b678
testb %al, %al
je 0x1c9c4
leaq 0x10(%r12), %rax
movq %rax, (%rbx)
movslq 0x14(%r12), %rdi
addq %r14, %rdi
leaq 0x3c68(%rip), %rsi      # 0x2061b
movq 0x28(%rsp), %rdx
xorl %eax, %eax
callq 0x41c0
jmp 0x1c8eb
leaq 0x42c7(%rip), %rdi      # 0x20c92
movq %r12, %rsi
movq %r14, %rdx
callq 0x1b678
testb %al, %al
je 0x1ca05
leaq 0x10(%r12), %rax
movq %rax, (%rbx)
movslq 0x14(%r12), %rax
leaq (%r14,%rax), %rdi
movslq 0x18(%r12), %rsi
subq %rax, %rsi
callq 0x5e6e
movq %rax, %r12
movq %rax, %rdi
movq 0x20(%rsp), %rsi
jmp 0x1ca44
leaq 0x4af9(%rip), %rdi      # 0x21505
movq %r12, %rsi
movq %r14, %rdx
callq 0x1b678
testb %al, %al
je 0x1ca4e
leaq 0x10(%r12), %rax
movq %rax, (%rbx)
movslq 0x14(%r12), %rax
leaq (%r14,%rax), %rdi
movslq 0x18(%r12), %rsi
subq %rax, %rsi
callq 0x5e6e
movq %rax, %r12
movq %rax, %rdi
movq 0x18(%rsp), %rsi
callq 0x169bc
jmp 0x1c8e3
leaq 0x4ab6(%rip), %rdi      # 0x2150b
movq %r12, %rsi
movq %r14, %rdx
callq 0x1b678
testb %al, %al
je 0x1ca72
addq $0x10, %r12
movq %r12, (%rbx)
movq 0x10(%rsp), %rdi
jmp 0x1ca94
leaq 0x4aa1(%rip), %rdi      # 0x2151a
movq %r12, %rsi
movq %r14, %rdx
callq 0x1b678
testb %al, %al
je 0x1caa4
addq $0x10, %r12
movq %r12, (%rbx)
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1bcf2
jmp 0x1c8ef
movl 0x8(%r12), %esi
movslq 0x4(%r12), %rdx
subl %edx, %esi
addq %r14, %rdx
leaq 0x4a72(%rip), %rdi      # 0x2152c
xorl %eax, %eax
callq 0x4b50
addq $0x10, (%rbx)
jmp 0x1c8eb
movq %r15, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq