// File: /workspace/github_c_makefile_star2_O2/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, 0x18(%rsp)
movq 0x10(%rdi), %rax
movq %rax, 0x10(%rsp)
movl (%rdi), %eax
andl $0x3f, %eax
xorl %esi, %esi
cmpl $0x11, %eax
sete %sil
pushq $0x1
popq %rax
movq %rdi, %rcx
movq 0x8(%rcx), %rcx
movl (%rcx), %edx
andl $0x3f, %edx
xorl %r8d, %r8d
testq %r8, %r8
jne 0x38409
cmpl $0x11, %edx
je 0x38405
movq %rcx, %r8
cmpl $0x10, %edx
jne 0x383f1
jmp 0x383e5
movl %eax, %esi
jmp 0x383e5
testl %esi, %esi
movl %esi, 0x4(%rsp)
jne 0x3841a
leaq 0x262e8(%rip), %rax     # 0x5e700
jmp 0x38428
leaq 0x2623f(%rip), %rax     # 0x5e660
movq (%rax), %rax
addq $0x50, %rax
movl (%rax), %eax
movl %eax, 0x8(%rsp)
xorl %r12d, %r12d
xorl %r15d, %r15d
movq %r8, 0x20(%rsp)
cmpq %r8, %rdi
je 0x384b3
movq 0x10(%rdi), %rcx
leaq 0x4(%rcx), %rax
movl (%rcx), %edx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
leaq (%rcx,%rdx), %rbx
addq $0x3, %rbx
movslq %r12d, %r12
cmpq %rbx, %rax
jae 0x384a8
xorl %r14d, %r14d
cmpb $0x5c, (%rax)
sete %r13b
movq %rdi, %rbp
movq (%rdi), %r8
movq %rax, %rdi
leaq 0xc(%rsp), %rsi
movq %rbx, %rdx
movl 0x8(%rsp), %ecx
callq 0x3820e
cmpq $0x1ffe, %r12           # imm = 0x1FFE
jg 0x3849a
movb 0xc(%rsp), %cl
leaq 0x51b0a(%rip), %rdx     # 0x89fa0
movb %cl, (%r12,%rdx)
movb %r13b, %r14b
addl %r14d, %r15d
incq %r12
movq %rbp, %rdi
jmp 0x38459
movq 0x8(%rdi), %rdi
movq 0x20(%rsp), %r8
jmp 0x38439
cmpl $0x2000, %r12d          # imm = 0x2000
jl 0x384e1
movq %rdi, %rbx
movq (%rdi), %rdi
leaq 0xc523(%rip), %rsi      # 0x449ec
movl %r12d, %edx
movl $0x1fff, %ecx           # imm = 0x1FFF
xorl %eax, %eax
callq 0x1108a
movq %rbx, %rdi
movl $0x1fff, %r12d          # imm = 0x1FFF
movq 0x10(%rsp), %rax
movl (%rax), %edx
testl %r15d, %r15d
jne 0x38500
movl %edx, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %r12d
jge 0x38500
movl 0x4(%rsp), %ebp
jmp 0x38553
movq %rdi, %r14
leal 0x1(%r12), %ebx
testl %edx, %edx
movl 0x4(%rsp), %ebp
js 0x38515
cmpl %edx, %r12d
jl 0x3851e
movl %ebx, %edi
callq 0x2abd2
movl (%rax), %edx
andl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
andl $0x80000000, %edx       # imm = 0x80000000
orl %ebx, %edx
movl %edx, (%rax)
leaq 0x4(%rax), %rdi
movslq %r12d, %rbx
leaq 0x51a64(%rip), %rsi     # 0x89fa0
movq %rax, %r15
movq %rbx, %rdx
callq 0xe1e0
movq %r15, %rax
movb $0x0, 0x4(%r15,%rbx)
movq %r14, %rdi
movq 0x18(%rsp), %rcx
movq %rax, 0x28(%rcx)
movl %ebp, 0x20(%rcx)
movq %rdi, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq