// File: /workspace/github_c_makefile_star2_O0/baskerville[P]sxhkd/src/parse.c
// Function: process_hotkey
void process_hotkey(char *hotkey_string, char *command_string)
{
	char hotkey[2 * MAXLEN] = {0};
	char command[2 * MAXLEN] = {0};
	char last_hotkey[2 * MAXLEN] = {0};
	unsigned char num_same = 0;
	chunk_t *hk_chunks = extract_chunks(hotkey_string);
	chunk_t *cm_chunks = extract_chunks(command_string);

#define CHECKCHUNK(s, c) \
	if (c->next == NULL && !c->sequence) { \
		snprintf(s, sizeof(s), "%s", c->text); \
		destroy_chunks(c); \
		c = NULL; \
	}
	CHECKCHUNK(hotkey, hk_chunks)
	CHECKCHUNK(command, cm_chunks)
#undef CHECKCHUNK

	render_next(hk_chunks, hotkey);
	render_next(cm_chunks, command);

	while ((hk_chunks == NULL || hotkey[0] != '\0') && (cm_chunks == NULL || command[0] != '\0')) {

		PRINTF("%s: %s\n", hotkey, command);
		chain_t *chain = make_chain();
		if (parse_chain(hotkey, chain)) {
			hotkey_t *hk = make_hotkey(chain, command);
			for (hotkey_t* i = hotkeys_head; i; i = i->next) {
				if (chains_interfere(i->chain, hk->chain)) {
					warn("Hotkey interference found and may not be matched: '%s' (from '%s').\n", hotkey, hotkey_string);
				}
			}
			add_hotkey(hk);
			if (strcmp(hotkey, last_hotkey) == 0)
				num_same++;
		} else {
			destroy_chain(chain);
		}

		if (hk_chunks == NULL && cm_chunks == NULL)
			break;

		snprintf(last_hotkey, sizeof(last_hotkey), "%s", hotkey);

		render_next(hk_chunks, hotkey);
		render_next(cm_chunks, command);
	}

	if (num_same > 0) {
		int period = num_same + 1;
		int delay = num_same;
		for (hotkey_t *hk = hotkeys_tail; hk != NULL && delay >= 0; hk = hk->prev, delay--)
			hk->cycle = make_cycle(delay, period);
	}

	if (hk_chunks != NULL)
		destroy_chunks(hk_chunks);
	if (cm_chunks != NULL)
		destroy_chunks(cm_chunks);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x660, %rsp            # imm = 0x660
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x210(%rbp), %rdi
xorl %esi, %esi
movl $0x200, %edx            # imm = 0x200
callq 0xe190
leaq -0x410(%rbp), %rdi
xorl %esi, %esi
movl $0x200, %edx            # imm = 0x200
callq 0xe190
leaq -0x610(%rbp), %rdi
xorl %esi, %esi
movl $0x200, %edx            # imm = 0x200
callq 0xe190
movb $0x0, -0x611(%rbp)
movq -0x8(%rbp), %rdi
callq 0x102d0
movq %rax, -0x620(%rbp)
movq -0x10(%rbp), %rdi
callq 0x102d0
movq %rax, -0x628(%rbp)
movq -0x620(%rbp), %rax
cmpq $0x0, 0x410(%rax)
jne 0xfd1c
movq -0x620(%rbp), %rax
testb $0x1, 0x408(%rax)
jne 0xfd1c
leaq -0x210(%rbp), %rdi
movq -0x620(%rbp), %rcx
movl $0x200, %esi            # imm = 0x200
leaq 0x347b(%rip), %rdx      # 0x13179
movb $0x0, %al
callq 0xe170
movq -0x620(%rbp), %rdi
callq 0x104e0
movq $0x0, -0x620(%rbp)
movq -0x628(%rbp), %rax
cmpq $0x0, 0x410(%rax)
jne 0xfd75
movq -0x628(%rbp), %rax
testb $0x1, 0x408(%rax)
jne 0xfd75
leaq -0x410(%rbp), %rdi
movq -0x628(%rbp), %rcx
movl $0x200, %esi            # imm = 0x200
leaq 0x3422(%rip), %rdx      # 0x13179
movb $0x0, %al
callq 0xe170
movq -0x628(%rbp), %rdi
callq 0x104e0
movq $0x0, -0x628(%rbp)
movq -0x620(%rbp), %rdi
leaq -0x210(%rbp), %rsi
callq 0x10530
movq -0x628(%rbp), %rdi
leaq -0x410(%rbp), %rsi
callq 0x10530
cmpq $0x0, -0x620(%rbp)
je 0xfdb9
movsbl -0x210(%rbp), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x651(%rbp)
je 0xfdea
movb $0x1, %al
cmpq $0x0, -0x628(%rbp)
movb %al, -0x652(%rbp)
je 0xfdde
movsbl -0x410(%rbp), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x652(%rbp)
movb -0x652(%rbp), %al
movb %al, -0x651(%rbp)
movb -0x651(%rbp), %al
testb $0x1, %al
jne 0xfdf9
jmp 0xff49
callq 0x12050
movq %rax, -0x630(%rbp)
leaq -0x210(%rbp), %rdi
movq -0x630(%rbp), %rsi
callq 0x10810
testb $0x1, %al
jne 0xfe21
jmp 0xfedb
movq -0x630(%rbp), %rdi
leaq -0x410(%rbp), %rsi
callq 0x120e0
movq %rax, -0x638(%rbp)
leaq 0x1367e(%rip), %rax     # 0x234c0
movq (%rax), %rax
movq %rax, -0x640(%rbp)
cmpq $0x0, -0x640(%rbp)
je 0xfea7
movq -0x640(%rbp), %rax
movq (%rax), %rdi
movq -0x638(%rbp), %rax
movq (%rax), %rsi
callq 0x11b90
testb $0x1, %al
jne 0xfe75
jmp 0xfe8e
leaq -0x210(%rbp), %rsi
movq -0x8(%rbp), %rdx
leaq 0x9458(%rip), %rdi      # 0x192df
movb $0x0, %al
callq 0xf640
jmp 0xfe90
movq -0x640(%rbp), %rax
movq 0x218(%rax), %rax
movq %rax, -0x640(%rbp)
jmp 0xfe4c
movq -0x638(%rbp), %rdi
callq 0x121a0
leaq -0x210(%rbp), %rdi
leaq -0x610(%rbp), %rsi
callq 0xe220
cmpl $0x0, %eax
jne 0xfed9
movb -0x611(%rbp), %al
addb $0x1, %al
movb %al, -0x611(%rbp)
jmp 0xfee7
movq -0x630(%rbp), %rdi
callq 0x12210
cmpq $0x0, -0x620(%rbp)
jne 0xfefd
cmpq $0x0, -0x628(%rbp)
jne 0xfefd
jmp 0xff49
leaq -0x610(%rbp), %rdi
leaq -0x210(%rbp), %rcx
movl $0x200, %esi            # imm = 0x200
leaq 0x3262(%rip), %rdx      # 0x13179
movb $0x0, %al
callq 0xe170
movq -0x620(%rbp), %rdi
leaq -0x210(%rbp), %rsi
callq 0x10530
movq -0x628(%rbp), %rdi
leaq -0x410(%rbp), %rsi
callq 0x10530
jmp 0xfd9b
movzbl -0x611(%rbp), %eax
cmpl $0x0, %eax
jle 0xffff
movzbl -0x611(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x644(%rbp)
movzbl -0x611(%rbp), %eax
movl %eax, -0x648(%rbp)
leaq 0x1353b(%rip), %rax     # 0x234b8
movq (%rax), %rax
movq %rax, -0x650(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x650(%rbp)
movb %al, -0x653(%rbp)
je 0xffa9
cmpl $0x0, -0x648(%rbp)
setge %al
movb %al, -0x653(%rbp)
movb -0x653(%rbp), %al
testb $0x1, %al
jne 0xffb5
jmp 0xfffd
movl -0x648(%rbp), %edi
movl -0x644(%rbp), %esi
callq 0x120a0
movq %rax, %rcx
movq -0x650(%rbp), %rax
movq %rcx, 0x210(%rax)
movq -0x650(%rbp), %rax
movq 0x220(%rax), %rax
movq %rax, -0x650(%rbp)
movl -0x648(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x648(%rbp)
jmp 0xff87
jmp 0xffff
cmpq $0x0, -0x620(%rbp)
je 0x10015
movq -0x620(%rbp), %rdi
callq 0x104e0
cmpq $0x0, -0x628(%rbp)
je 0x1002b
movq -0x628(%rbp), %rdi
callq 0x104e0
addq $0x660, %rsp            # imm = 0x660
popq %rbp
retq
nopw %cs:(%rax,%rax)