// File: /workspace/github_c_makefile_star2_O3/baskerville[P]sxhkd/src/parse.c
// Function: render_next
void render_next(chunk_t *chunks, char *dest)
{
	if (chunks == NULL)
		return;
	int i = 0;
	bool incr = false;
	for (chunk_t *c = chunks; c != NULL; c = c->next) {
		if (c->sequence) {
			if (!incr) {
				if (c->range_cur < c->range_max) {
					c->range_cur++;
					incr = true;
				} else {
					c->range_cur = 1, c->range_max = 0;
				}
			}
			if (c->advance == NULL) {
				incr = true;
				c->advance = get_token(c->item, NULL, c->text, SEQ_SEP);
			} else if (!incr && c->range_cur > c->range_max) {
				if (c->advance[0] == '\0') {
					c->advance = get_token(c->item, NULL, c->text, SEQ_SEP);
				} else {
					c->advance = get_token(c->item, NULL, c->advance, SEQ_SEP);
					incr = true;
				}
			}
			if (c->range_cur > c->range_max && strlen(c->item) == 3)
				sscanf(c->item, "%c-%c", &c->range_cur, &c->range_max);
			if (c->range_cur <= c->range_max) {
				dest[i++] = c->range_cur;
			} else {
				if (c->item[0] == SEQ_NONE && c->item[1] == '\0')
					continue;
				strcpy(dest + i, c->item);
				i += strlen(c->item);
			}
		} else {
			strcpy(dest + i, c->text);
			i += strlen(c->text);
		}
	}
	dest[i] = '\0';
	if (!incr)
		dest[0] = '\0';
}

// Assembly:
testq %rdi, %rdi
je 0xfd95
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r13
movq %rdi, %r14
xorl %ebx, %ebx
xorl %r15d, %r15d
cmpb $0x1, 0x408(%r14)
jne 0xfc17
testb $0x1, %bl
jne 0xfc42
movb 0x409(%r14), %al
cmpb 0x40a(%r14), %al
jge 0xfc38
incb %al
movb %al, 0x409(%r14)
movb $0x1, %bl
jmp 0xfc42
movslq %r15d, %rdi
addq %r13, %rdi
movq %r14, %rsi
callq 0xe070
movq %r14, %rdi
callq 0xe130
addl %r15d, %eax
movl %eax, %r15d
jmp 0xfd4c
movw $0x1, 0x409(%r14)
movq 0x400(%r14), %rdx
testq %rdx, %rdx
je 0xfc7d
testb $0x1, %bl
jne 0xfc77
movb 0x409(%r14), %al
cmpb 0x40a(%r14), %al
jle 0xfc77
leaq 0x200(%r14), %rdi
cmpb $0x0, (%rdx)
je 0xfd5e
xorl %esi, %esi
jmp 0xfc89
movq %rbx, (%rsp)
jmp 0xfca2
leaq 0x200(%r14), %rdi
xorl %esi, %esi
movq %r14, %rdx
leaq 0x76c6(%rip), %rcx      # 0x17356
callq 0x10049
movb $0x1, %bl
movq %rbx, (%rsp)
movq %rax, 0x400(%r14)
movq %r13, %rbx
movb 0x409(%r14), %bpl
movb 0x40a(%r14), %r12b
cmpb %r12b, %bpl
jle 0xfcfa
leaq 0x200(%r14), %r13
movq %r13, %rdi
callq 0xe130
cmpq $0x3, %rax
jne 0xfcfa
leaq 0x409(%r14), %rbp
leaq 0x40a(%r14), %r12
movq %r13, %rdi
leaq 0x7673(%rip), %rsi      # 0x17358
movq %rbp, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0xe290
movb (%rbp), %bpl
movb (%r12), %r12b
cmpb %r12b, %bpl
jle 0xfd3b
cmpb $0x5f, 0x200(%r14)
movq %rbx, %r13
jne 0xfd16
cmpb $0x0, 0x201(%r14)
je 0xfd48
leaq 0x200(%r14), %r12
movslq %r15d, %rdi
addq %r13, %rdi
movq %r12, %rsi
callq 0xe070
movq %r12, %rdi
callq 0xe130
addl %r15d, %eax
movl %eax, %r15d
jmp 0xfd48
movslq %r15d, %rax
incl %r15d
movq %rbx, %r13
movb %bpl, (%rbx,%rax)
movq (%rsp), %rbx
movq 0x410(%r14), %r14
testq %r14, %r14
jne 0xfbeb
jmp 0xfd74
xorl %esi, %esi
movq %r14, %rdx
leaq 0x75ec(%rip), %rcx      # 0x17356
callq 0x10049
jmp 0xfc97
movslq %r15d, %rax
movb $0x0, (%r13,%rax)
testb $0x1, %bl
jne 0xfd87
movb $0x0, (%r13)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq