// File: /workspace/github_c_makefile_star2_O2/lucvoo[P]sparse-dev/tokenize.c
// Function: eat_string
static int eat_string(int next, stream_t *stream, enum token_type type)
{
	static char buffer[MAX_STRING];
	struct string *string;
	struct token *token = stream->token;
	int len = 0;
	int escape;
	int want_hex = 0;
	char delim = type < TOKEN_STRING ? '\'' : '"';

	for (escape = 0; escape || next != delim; next = nextchar(stream)) {
		if (len < MAX_STRING)
			buffer[len] = next;
		len++;
		if (next == '\n') {
			warning(stream_pos(stream),
				"missing terminating %c character", delim);
			/* assume delimiter is lost */
			break;
		}
		if (next == EOF) {
			warning(stream_pos(stream),
				"End of file in middle of string");
			return next;
		}
		if (!escape) {
			if (want_hex && !(cclass[next + 1] & Hex))
				warning(stream_pos(stream),
					"\\x used with no following hex digits");
			want_hex = 0;
			escape = next == '\\';
		} else {
			escape = 0;
			want_hex = next == 'x';
		}
	}
	if (want_hex)
		warning(stream_pos(stream),
			"\\x used with no following hex digits");
	if (len > MAX_STRING) {
		warning(stream_pos(stream), "string too long (%d bytes, %d bytes max)", len, MAX_STRING);
		len = MAX_STRING;
	}
	if (delim == '\'' && len && len <= 4) {
		token_type(token) = type + len;
		memset(buffer + len, '\0', 4 - len);
		memcpy(token->embedded, buffer, 4);
	} else {
		token_type(token) = type;
		string = __alloc_string(len+1);
		memcpy(string->data, buffer, len);
		string->data[len] = '\0';
		string->length = len+1;
		token->string = string;
	}

	/* Pass it on.. */
	token = stream->token;
	add_token(stream);
	return nextchar(stream);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movl %edi, %r13d
movq 0x28(%rsi), %rax
movq %rax, 0x8(%rsp)
xorl %eax, %eax
movq %rdx, 0x10(%rsp)
cmpl $0x10, %edx
setb %al
leal (%rax,%rax,4), %ebp
addl $0x22, %ebp
xorl %r15d, %r15d
xorl %r14d, %r14d
xorl %r12d, %r12d
movl %r13d, %eax
xorl %ebp, %eax
orl %r12d, %eax
je 0x2a43b
cmpq $0x1ffe, %r15           # imm = 0x1FFE
ja 0x2a3a8
leaq 0x5d27c(%rip), %rax     # 0x87620
movb %r13b, (%r15,%rax)
cmpl $-0x1, %r13d
je 0x2a56b
cmpl $0xa, %r13d
je 0x2a41d
testl %r12d, %r12d
jne 0x2a3fc
testl %r14d, %r14d
je 0x2a3ec
movl %r13d, %eax
leaq 0x17024(%rip), %rcx     # 0x413f0
testb $0x4, 0x1(%rax,%rcx)
jne 0x2a3ec
movq %rbx, %rdi
callq 0x2a052
movq %rax, %rdi
leaq 0x17374(%rip), %rsi     # 0x41759
xorl %eax, %eax
callq 0x1108a
xorl %r12d, %r12d
cmpl $0x5c, %r13d
sete %r12b
xorl %r14d, %r14d
jmp 0x2a40a
xorl %r14d, %r14d
cmpl $0x78, %r13d
sete %r14b
xorl %r12d, %r12d
movq %rbx, %rdi
callq 0x2a08b
movl %eax, %r13d
incq %r15
jmp 0x2a386
movq %rbx, %rdi
callq 0x2a052
leaq 0x172ec(%rip), %rsi     # 0x41718
movq %rax, %rdi
movl %ebp, %edx
xorl %eax, %eax
callq 0x1108a
incq %r15
testl %r14d, %r14d
movq 0x10(%rsp), %r13
je 0x2a45e
movq %rbx, %rdi
callq 0x2a052
leaq 0x17305(%rip), %rsi     # 0x41759
movq %rax, %rdi
xorl %eax, %eax
callq 0x1108a
cmpl $0x2000, %r15d          # imm = 0x2000
jl 0x2a48e
movq %rbx, %rdi
callq 0x2a052
leaq 0x17308(%rip), %rsi     # 0x4177e
movq %rax, %rdi
movl %r15d, %edx
movl $0x1fff, %ecx           # imm = 0x1FFF
xorl %eax, %eax
callq 0x1108a
movl $0x1fff, %r15d          # imm = 0x1FFF
cmpl $0xf, %r13d
ja 0x2a4de
testl %r15d, %r15d
je 0x2a4de
cmpl $0x4, %r15d
jg 0x2a4de
addl %r15d, %r13d
movq 0x8(%rsp), %r14
movq (%r14), %rax
andl $0x3f, %r13d
andq $-0x40, %rax
orq %r13, %rax
movq %rax, (%r14)
movslq %r15d, %rax
leaq 0x5d15e(%rip), %rdi     # 0x87620
addq %rax, %rdi
pushq $0x4
popq %rdx
subl %r15d, %edx
xorl %esi, %esi
callq 0xe130
movl 0x5d148(%rip), %eax     # 0x87620
movl %eax, 0x10(%r14)
jmp 0x2a538
movq 0x8(%rsp), %r12
movq (%r12), %rax
andl $0x3f, %r13d
andq $-0x40, %rax
orq %r13, %rax
movq %rax, (%r12)
leal 0x1(%r15), %ebp
movl %ebp, %edi
callq 0x2abd2
movq %rax, %r14
leaq 0x4(%rax), %rdi
movslq %r15d, %r15
leaq 0x5d10e(%rip), %rsi     # 0x87620
movq %r15, %rdx
callq 0xe1e0
movb $0x0, 0x4(%r14,%r15)
movl $0x80000000, %eax       # imm = 0x80000000
andl (%r14), %eax
andl $0x7fffffff, %ebp       # imm = 0x7FFFFFFF
orl %ebp, %eax
movl %eax, (%r14)
movq %r14, 0x10(%r12)
movq 0x28(%rbx), %rax
andq $0x0, 0x28(%rbx)
leaq 0x8(%rax), %rcx
andq $0x0, 0x8(%rax)
movq 0x20(%rbx), %rdx
movq %rax, (%rdx)
movq %rcx, 0x20(%rbx)
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2a08b
movq %rbx, %rdi
callq 0x2a052
leaq 0x171bf(%rip), %rsi     # 0x41739
movq %rax, %rdi
xorl %eax, %eax
callq 0x1108a
pushq $-0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq