// File: /workspace/github_c_makefile_star2_O0/xemul[P]cylang/tokenizer.c
// Function: cy_advance
static int cy_advance(struct cy_file *cf, struct cy_token *t)
{
	char span_start = '\0';

	t->typ = NULL;
	t->v.t = CY_V_NOVALUE;

	while (1) {
		if (cf->cur == cf->end)
			return 0;

		if (is_space_at(cf->cur)) {
			if (*cf->cur == '\n') {
				cf->ln++;
				cf->tn = 1;
			}

			cf->cur++;
			continue;
		}

		break;
	}

	t->val = cf->cur;
	t->ln = cf->ln;
	t->tn = cf->tn;
	if (*cf->cur == '"' || *cf->cur == '\'' || *cf->cur == '#') {
		/* This is a spanning token. It ends at the next peer value. */
		span_start = *cf->cur;
		cf->cur++;
	}

	while (1) {
		if (cf->cur >= cf->end) {
			fprintf(stderr, "Parse error -- can't find token end\n");
			return -1;
		}

		if (span_start == '\0') {
			if (!is_space_at(cf->cur)) {
				cf->cur++;
				continue;
			}
		} else {
			if (*cf->cur != span_start) {
				if (*cf->cur == '\n') {
					cf->ln++;
					cf->tn = 1;
				}

				cf->cur++;
				continue;
			}
		}


		if (*cf->cur == '\n') {
			cf->ln++;
			cf->tn = 1;
		} else
			cf->tn++;

		*cf->cur = '\0';
		cf->cur++;

		if (cf->verbose)
			printf("Found token %s @%d.%d\n", t->val, t->ln, t->tn);
		break;
	}

	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movb $0x0, -0x19(%rbp)
movq -0x18(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x18(%rbp), %rax
movl $0x0, 0x18(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jne 0x3fd9
movl $0x0, -0x4(%rbp)
jmp 0x41e0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x41f0
testb $0x1, %al
jne 0x3fec
jmp 0x4026
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
jne 0x4014
movq -0x10(%rbp), %rax
movl 0x18(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x18(%rax)
movq -0x10(%rbp), %rax
movl $0x1, 0x1c(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
jmp 0x3fbb
jmp 0x4028
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movl 0x18(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rax
movl 0x1c(%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x22, %eax
je 0x4083
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x27, %eax
je 0x4083
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
jne 0x40a0
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movb (%rax), %al
movb %al, -0x19(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
jmp 0x40a2
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x10(%rcx), %rax
jb 0x40d8
movq 0xaf3d(%rip), %rax      # 0xeff8
movq (%rax), %rdi
leaq 0x6ff7(%rip), %rsi      # 0xb0bc
movb $0x0, %al
callq 0x3110
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x41e0
movsbl -0x19(%rbp), %eax
cmpl $0x0, %eax
jne 0x4106
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x41f0
testb $0x1, %al
jne 0x4104
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
jmp 0x40a2
jmp 0x4158
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
movsbl -0x19(%rbp), %ecx
cmpl %ecx, %eax
je 0x4156
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
jne 0x4141
movq -0x10(%rbp), %rax
movl 0x18(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x18(%rax)
movq -0x10(%rbp), %rax
movl $0x1, 0x1c(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
jmp 0x40a2
jmp 0x4158
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0xa, %eax
jne 0x4182
movq -0x10(%rbp), %rax
movl 0x18(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x18(%rax)
movq -0x10(%rbp), %rax
movl $0x1, 0x1c(%rax)
jmp 0x418f
movq -0x10(%rbp), %rax
movl 0x1c(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x1c(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movb $0x0, (%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
testb $0x1, 0x20(%rax)
je 0x41d7
movq -0x18(%rbp), %rax
movq (%rax), %rsi
movq -0x18(%rbp), %rax
movl 0x10(%rax), %edx
movq -0x18(%rbp), %rax
movl 0x14(%rax), %ecx
leaq 0x6f11(%rip), %rdi      # 0xb0e1
movb $0x0, %al
callq 0x30a0
jmp 0x41d9
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)