// File: /workspace/github_c_makefile_star2_O0/baskerville[P]sxhkd/src/parse.c
// Function: parse_chain
bool parse_chain(char *string, chain_t *chain)
{
	char chord[MAXLEN] = {0};
	char name[MAXLEN] = {0};
	char ignored[MAXLEN] = {0};
	xcb_keysym_t keysym = XCB_NO_SYMBOL;
	xcb_button_t button = XCB_NONE;
	uint16_t modfield = 0;
	uint8_t event_type = XCB_KEY_PRESS;
	bool replay_event = false;
	bool lock_chain = false;
	char *outer_advance;
	char *inner_advance;
	for (outer_advance = get_token(chord, ignored, string, LNK_SEP); chord[0] != '\0'; outer_advance = get_token(chord, ignored, outer_advance, LNK_SEP)) {
		for (inner_advance = get_token(name, NULL, chord, SYM_SEP); name[0] != '\0'; inner_advance = get_token(name, NULL, inner_advance, SYM_SEP)) {
			int offset = 0;
			if (name[offset] == REPLAY_PREFIX) {
				replay_event = true;
				offset++;
			}
			if (name[offset] == RELEASE_PREFIX) {
				event_type = XCB_KEY_RELEASE;
				offset++;
			}
			char *nm = name + offset;
			if (!parse_modifier(nm, &modfield) && !parse_keysym(nm, &keysym) && !parse_button(nm, &button)) {
				warn("Unknown keysym name: '%s'.\n", nm);
				return false;
			}
		}
		if (strstr(ignored, GRP_SEP) != NULL)
			lock_chain = true;
		if (button != XCB_NONE)
			event_type = key_to_button(event_type);
		chord_t *c = make_chord(keysym, button, modfield, event_type, replay_event, lock_chain);
		if (c == NULL) {
			return false;
		}
		add_chord(chain, c);
		if (status_fifo != NULL) {
			snprintf(c->repr, sizeof(c->repr), "%s", chord);
		}
		keysym = XCB_NO_SYMBOL;
		button = XCB_NONE;
		modfield = 0;
		event_type = XCB_KEY_PRESS;
		replay_event = false;
		lock_chain = false;
	}
	return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x360, %rsp            # imm = 0x360
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
leaq -0x120(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0xe190
leaq -0x220(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0xe190
leaq -0x320(%rbp), %rdi
xorl %esi, %esi
movl $0x100, %edx            # imm = 0x100
callq 0xe190
movl $0x0, -0x324(%rbp)
movb $0x0, -0x325(%rbp)
movw $0x0, -0x328(%rbp)
movb $0x2, -0x329(%rbp)
movb $0x0, -0x32a(%rbp)
movb $0x0, -0x32b(%rbp)
leaq -0x120(%rbp), %rdi
leaq -0x320(%rbp), %rsi
movq -0x10(%rbp), %rdx
leaq 0x8a88(%rip), %rcx      # 0x1932c
callq 0x10b50
movq %rax, -0x338(%rbp)
movsbl -0x120(%rbp), %eax
cmpl $0x0, %eax
je 0x10b31
leaq -0x220(%rbp), %rdi
leaq -0x120(%rbp), %rdx
xorl %eax, %eax
movl %eax, %esi
leaq 0x8a56(%rip), %rcx      # 0x1932f
callq 0x10b50
movq %rax, -0x340(%rbp)
movsbl -0x220(%rbp), %eax
cmpl $0x0, %eax
je 0x109fa
movl $0x0, -0x344(%rbp)
movslq -0x344(%rbp), %rax
movsbl -0x220(%rbp,%rax), %eax
cmpl $0x7e, %eax
jne 0x10929
movb $0x1, -0x32a(%rbp)
movl -0x344(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x344(%rbp)
movslq -0x344(%rbp), %rax
movsbl -0x220(%rbp,%rax), %eax
cmpl $0x40, %eax
jne 0x10953
movb $0x3, -0x329(%rbp)
movl -0x344(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x344(%rbp)
leaq -0x220(%rbp), %rax
movslq -0x344(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x350(%rbp)
movq -0x350(%rbp), %rdi
leaq -0x328(%rbp), %rsi
callq 0x10db0
testb $0x1, %al
jne 0x109ce
movq -0x350(%rbp), %rdi
leaq -0x324(%rbp), %rsi
callq 0x110e0
testb $0x1, %al
jne 0x109ce
movq -0x350(%rbp), %rdi
leaq -0x325(%rbp), %rsi
callq 0x11170
testb $0x1, %al
jne 0x109ce
movq -0x350(%rbp), %rsi
leaq 0x8974(%rip), %rdi      # 0x19332
movb $0x0, %al
callq 0xf640
movb $0x0, -0x1(%rbp)
jmp 0x10b35
jmp 0x109d0
leaq -0x220(%rbp), %rdi
movq -0x340(%rbp), %rdx
xorl %eax, %eax
movl %eax, %esi
leaq 0x8946(%rip), %rcx      # 0x1932f
callq 0x10b50
movq %rax, -0x340(%rbp)
jmp 0x108e5
leaq -0x320(%rbp), %rdi
leaq 0x8925(%rip), %rsi      # 0x1932d
callq 0xe3f0
cmpq $0x0, %rax
je 0x10a1a
movb $0x1, -0x32b(%rbp)
movzbl -0x325(%rbp), %eax
cmpq $0x0, %rax
je 0x10a39
movzbl -0x329(%rbp), %edi
callq 0x111b0
movb %al, -0x329(%rbp)
movl -0x324(%rbp), %edi
movb -0x325(%rbp), %sil
movw -0x328(%rbp), %dx
movb -0x329(%rbp), %cl
movb -0x32a(%rbp), %r8b
movb -0x32b(%rbp), %al
andb $0x1, %r8b
andb $0x1, %al
movzbl %sil, %esi
movzwl %dx, %edx
movzbl %cl, %ecx
movzbl %r8b, %r8d
movzbl %al, %r9d
callq 0x11ca0
movq %rax, -0x358(%rbp)
cmpq $0x0, -0x358(%rbp)
jne 0x10a97
movb $0x0, -0x1(%rbp)
jmp 0x10b35
movq -0x18(%rbp), %rdi
movq -0x358(%rbp), %rsi
callq 0x11ff0
leaq 0x128a2(%rip), %rax     # 0x23350
cmpq $0x0, (%rax)
je 0x10ad5
movq -0x358(%rbp), %rdi
leaq -0x120(%rbp), %rcx
movl $0x100, %esi            # imm = 0x100
leaq 0x26ab(%rip), %rdx      # 0x13179
movb $0x0, %al
callq 0xe170
movl $0x0, -0x324(%rbp)
movb $0x0, -0x325(%rbp)
movw $0x0, -0x328(%rbp)
movb $0x2, -0x329(%rbp)
movb $0x0, -0x32a(%rbp)
movb $0x0, -0x32b(%rbp)
leaq -0x120(%rbp), %rdi
leaq -0x320(%rbp), %rsi
movq -0x338(%rbp), %rdx
leaq 0x880c(%rip), %rcx      # 0x1932c
callq 0x10b50
movq %rax, -0x338(%rbp)
jmp 0x108b0
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x360, %rsp            # imm = 0x360
popq %rbp
retq
nopw %cs:(%rax,%rax)