// File: /workspace/github_c_makefile_star2_O2/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 0xfc57
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r13
movq %rdi, %r14
xorl %r15d, %r15d
xorl %r12d, %r12d
movslq %r12d, %rbx
testq %r14, %r14
je 0xfc38
cmpb $0x1, 0x408(%r14)
jne 0xfad3
testb $0x1, %r15b
jne 0xfafb
movb 0x409(%r14), %al
cmpb 0x40a(%r14), %al
jge 0xfaf1
incb %al
movb %al, 0x409(%r14)
movb $0x1, %r15b
jmp 0xfafb
leaq (%rbx,%r13), %rdi
movq %r14, %rsi
callq 0xe070
movq %r14, %rdi
callq 0xe130
addl %eax, %ebx
movl %ebx, %r12d
jmp 0xfc0a
movw $0x1, 0x409(%r14)
movq 0x400(%r14), %rdx
testq %rdx, %rdx
movl %r12d, 0x14(%rsp)
je 0xfb3d
testb $0x1, %r15b
jne 0xfb36
movb 0x409(%r14), %al
cmpb 0x40a(%r14), %al
jle 0xfb36
leaq 0x200(%r14), %rdi
cmpb $0x0, (%rdx)
je 0xfc22
xorl %esi, %esi
jmp 0xfb49
movq %r15, 0x8(%rsp)
jmp 0xfb64
leaq 0x200(%r14), %rdi
xorl %esi, %esi
movq %r14, %rdx
leaq 0x7806(%rip), %rcx      # 0x17356
callq 0xfe8b
movb $0x1, %r15b
movq %r15, 0x8(%rsp)
movq %rax, 0x400(%r14)
movq %r13, %r15
movb 0x409(%r14), %bpl
movb 0x40a(%r14), %r12b
cmpb %r12b, %bpl
jle 0xfbbc
leaq 0x200(%r14), %r13
movq %r13, %rdi
callq 0xe130
cmpq $0x3, %rax
jne 0xfbbc
leaq 0x409(%r14), %rbp
leaq 0x40a(%r14), %r12
movq %r13, %rdi
leaq 0x77b1(%rip), %rsi      # 0x17358
movq %rbp, %rdx
movq %r12, %rcx
xorl %eax, %eax
callq 0xe290
movb (%rbp), %bpl
movb (%r12), %r12b
cmpb %r12b, %bpl
jle 0xfbfa
cmpb $0x5f, 0x200(%r14)
movq %r15, %r13
jne 0xfbd8
cmpb $0x0, 0x201(%r14)
je 0xfc16
leaq 0x200(%r14), %r12
leaq (%rbx,%r13), %rdi
movq %r12, %rsi
callq 0xe070
movq %r12, %rdi
callq 0xe130
addl %eax, %ebx
movl %ebx, %r12d
jmp 0xfc05
leal 0x1(%rbx), %r12d
movq %r15, %r13
movb %bpl, (%r15,%rbx)
movq 0x8(%rsp), %r15
movq 0x410(%r14), %r14
jmp 0xfa99
movq 0x8(%rsp), %r15
movl 0x14(%rsp), %r12d
jmp 0xfc0a
xorl %esi, %esi
movq %r14, %rdx
leaq 0x7728(%rip), %rcx      # 0x17356
callq 0xfe8b
jmp 0xfb58
movb $0x0, (%r13,%rbx)
testb $0x1, %r15b
jne 0xfc49
movb $0x0, (%r13)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq