// File: /workspace/github_c_makefile_star2_O1/lucvoo[P]sparse-dev/char.c
// Function: get_string_constant
struct token *get_string_constant(struct token *token, struct expression *expr)
{
	struct string *string = token->string;
	struct token *next = token->next, *done = NULL;
	int stringtype = token_type(token);
	int is_wide = stringtype == TOKEN_WIDE_STRING;
	static char buffer[MAX_STRING];
	int len = 0;
	int bits;
	int esc_count = 0;

	while (!done) {
		switch (token_type(next)) {
		case TOKEN_WIDE_STRING:
			is_wide = 1;
		case TOKEN_STRING:
			next = next->next;
			break;
		default:
			done = next;
		}
	}
	bits = is_wide ? wchar_ctype->bit_size: bits_in_char;
	while (token != done) {
		unsigned v;
		const char *p = token->string->data;
		const char *end = p + token->string->length - 1;
		while (p < end) {
			if (*p == '\\')
				esc_count++;
			p = parse_escape(p, &v, end, bits, token->pos);
			if (len < MAX_STRING)
				buffer[len] = v;
			len++;
		}
		token = token->next;
	}
	if (len > MAX_STRING) {
		warning(token->pos, "trying to concatenate %d-character string (%d bytes max)", len, MAX_STRING);
		len = MAX_STRING;
	}

	if (esc_count || len >= string->length) {
		if (string->immutable || len >= string->length)	/* can't cannibalize */
			string = __alloc_string(len+1);
		string->length = len+1;
		memcpy(string->data, buffer, len);
		string->data[len] = '\0';
	}
	expr->string = string;
	expr->wide = is_wide;
	return token;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq 0x10(%rdi), %rax
movq %rax, 0x10(%rsp)
movq 0x8(%rdi), %rax
movl (%rdi), %ecx
andl $0x3f, %ecx
xorl %edx, %edx
cmpl $0x11, %ecx
sete %dl
xorl %esi, %esi
movl (%rax), %ecx
andl $0x3f, %ecx
cmpl $0x10, %ecx
je 0x4036e
cmpl $0x11, %ecx
jne 0x40374
movl $0x1, %edx
movq 0x8(%rax), %rax
jmp 0x40377
movq %rax, %rsi
testq %rsi, %rsi
je 0x4035a
testl %edx, %edx
jne 0x40389
leaq 0x25379(%rip), %rax     # 0x65700
jmp 0x40397
leaq 0x252d0(%rip), %rax     # 0x65660
movq (%rax), %rax
addq $0x50, %rax
movl %edx, 0x4(%rsp)
cmpq %rdi, %rsi
je 0x40442
movq %r14, 0x18(%rsp)
movl (%rax), %eax
movl %eax, 0x8(%rsp)
xorl %r15d, %r15d
xorl %r12d, %r12d
movq %rsi, 0x20(%rsp)
movq 0x10(%rdi), %rax
movl (%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl $0x2, %ecx
jb 0x4042c
leaq (%rax,%rcx), %rbx
addq $0x3, %rbx
addq $0x4, %rax
movslq %r12d, %r12
xorl %r13d, %r13d
cmpb $0x5c, (%rax)
sete %r14b
movq %rdi, %rbp
movq (%rdi), %r8
movq %rax, %rdi
leaq 0xc(%rsp), %rsi
movq %rbx, %rdx
movl 0x8(%rsp), %ecx
callq 0x4014e
cmpq $0x1ffe, %r12           # imm = 0x1FFE
jg 0x40416
movb 0xc(%rsp), %cl
leaq 0x50b8e(%rip), %rdx     # 0x90fa0
movb %cl, (%r12,%rdx)
movb %r14b, %r13b
addl %r13d, %r15d
incq %r12
cmpq %rbx, %rax
movq %rbp, %rdi
jb 0x403da
movq 0x20(%rsp), %rsi
movq 0x8(%rdi), %rdi
cmpq %rsi, %rdi
jne 0x403ba
testl %r15d, %r15d
sete %bl
movq 0x18(%rsp), %r14
jmp 0x40447
movb $0x1, %bl
xorl %r12d, %r12d
cmpl $0x2000, %r12d          # imm = 0x2000
jl 0x40475
movq %rdi, %r15
movq (%rdi), %rdi
leaq 0xc3cf(%rip), %rsi      # 0x4c82c
movl %r12d, %edx
movl $0x1fff, %ecx           # imm = 0x1FFF
xorl %eax, %eax
callq 0x118b4
movq %r15, %rdi
movl $0x1fff, %r12d          # imm = 0x1FFF
movq 0x10(%rsp), %rax
testb %bl, %bl
je 0x4048a
movl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
andl (%rax), %ecx
cmpl %ecx, %r12d
jl 0x404dd
movq %rdi, %r15
movl (%rax), %ecx
testl %ecx, %ecx
js 0x40498
cmpl %ecx, %r12d
jl 0x404a2
leal 0x1(%r12), %edi
callq 0x300ef
leal 0x1(%r12), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movl $0x80000000, %ecx       # imm = 0x80000000
andl (%rax), %ecx
orl %edx, %ecx
movl %ecx, (%rax)
leaq 0x4(%rax), %rdi
movslq %r12d, %rbx
leaq 0x50ada(%rip), %rsi     # 0x90fa0
movq %rax, %r12
movq %rbx, %rdx
callq 0xe1e0
movq %r12, %rax
movb $0x0, 0x4(%r12,%rbx)
movq %r15, %rdi
movq %rax, 0x28(%r14)
movl 0x4(%rsp), %eax
movl %eax, 0x20(%r14)
movq %rdi, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq