// File: /workspace/github_c_makefile_star2_O0/baskerville[P]sxhkd/src/parse.c
// Function: extract_chunks
chunk_t *extract_chunks(char *s)
{
	size_t len = strlen(s);
	unsigned int i = 0, j = 0;
	bool inhibit = false;
	int num_seq = 0;
	chunk_t *c = make_chunk();
	chunk_t *head = c;
	while (i < len) {
		if (inhibit) {
			c->text[j++] = s[i];
			inhibit = false;
		} else if (s[i] == MAGIC_INHIBIT) {
			inhibit = true;
			if ((s[i+1] != MAGIC_INHIBIT || c->sequence)
					&& s[i+1] != SEQ_BEGIN
					&& s[i+1] != SEQ_END)
				c->text[j++] = s[i];
		} else if (s[i] == SEQ_BEGIN) {
			if (j > 0) {
				c->text[j] = '\0';
				j = 0;
				chunk_t *next = make_chunk();
				c->next = next;
				c = next;
			}
			c->sequence = true;
		} else if (s[i] == SEQ_END) {
			if (c->sequence)
				num_seq++;
			if (j > 0) {
				c->text[j] = '\0';
				j = 0;
				chunk_t *next = make_chunk();
				c->next = next;
				c = next;
			}
			c->sequence = false;
		} else {
			c->text[j++] = s[i];
		}
		i++;
	}
	c->text[j] = '\0';
	return head;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
callq 0xe120
movq %rax, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movb $0x0, -0x19(%rbp)
movl $0x0, -0x20(%rbp)
callq 0x10d40
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movl -0x14(%rbp), %eax
cmpq -0x10(%rbp), %rax
jae 0x104c5
testb $0x1, -0x19(%rbp)
je 0x1034d
movq -0x8(%rbp), %rax
movl -0x14(%rbp), %ecx
movb (%rax,%rcx), %dl
movq -0x28(%rbp), %rax
movl -0x18(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x18(%rbp)
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
movb $0x0, -0x19(%rbp)
jmp 0x104b7
movq -0x8(%rbp), %rax
movl -0x14(%rbp), %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x5c, %eax
jne 0x103d0
movb $0x1, -0x19(%rbp)
movq -0x8(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x5c, %eax
jne 0x10383
movq -0x28(%rbp), %rax
testb $0x1, 0x408(%rax)
je 0x103cb
movq -0x8(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x7b, %eax
je 0x103cb
movq -0x8(%rbp), %rax
movl -0x14(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x7d, %eax
je 0x103cb
movq -0x8(%rbp), %rax
movl -0x14(%rbp), %ecx
movb (%rax,%rcx), %dl
movq -0x28(%rbp), %rax
movl -0x18(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x18(%rbp)
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
jmp 0x104b5
movq -0x8(%rbp), %rax
movl -0x14(%rbp), %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x7b, %eax
jne 0x10428
cmpl $0x0, -0x18(%rbp)
jbe 0x10418
movq -0x28(%rbp), %rax
movl -0x18(%rbp), %ecx
movb $0x0, (%rax,%rcx)
movl $0x0, -0x18(%rbp)
callq 0x10d40
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x410(%rax)
movq -0x38(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movb $0x1, 0x408(%rax)
jmp 0x104b3
movq -0x8(%rbp), %rax
movl -0x14(%rbp), %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x7d, %eax
jne 0x10493
movq -0x28(%rbp), %rax
testb $0x1, 0x408(%rax)
je 0x1044e
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
cmpl $0x0, -0x18(%rbp)
jbe 0x10486
movq -0x28(%rbp), %rax
movl -0x18(%rbp), %ecx
movb $0x0, (%rax,%rcx)
movl $0x0, -0x18(%rbp)
callq 0x10d40
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x410(%rax)
movq -0x40(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movb $0x0, 0x408(%rax)
jmp 0x104b1
movq -0x8(%rbp), %rax
movl -0x14(%rbp), %ecx
movb (%rax,%rcx), %dl
movq -0x28(%rbp), %rax
movl -0x18(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x18(%rbp)
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
jmp 0x104b3
jmp 0x104b5
jmp 0x104b7
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x10313
movq -0x28(%rbp), %rax
movl -0x18(%rbp), %ecx
movb $0x0, (%rax,%rcx)
movq -0x30(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)