// File: /workspace/github_c_makefile_star2_O3/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), %r13
movl (%rdi), %eax
andl $0x3f, %eax
xorl %ebp, %ebp
cmpl $0x11, %eax
sete %bpl
movq %rdi, %rdx
movq 0x8(%rdx), %rdx
movl (%rdx), %eax
andl $0x3f, %eax
cmpl $0x10, %eax
je 0x3f274
cmpl $0x11, %eax
jne 0x3f28e
movl $0x1, %ebp
jmp 0x3f274
testl %ebp, %ebp
jne 0x3f29b
leaq 0x25467(%rip), %rax     # 0x64700
jmp 0x3f2a9
leaq 0x253be(%rip), %rax     # 0x64660
movq (%rax), %rax
addq $0x50, %rax
cmpq %rdi, %rdx
je 0x3f389
movq %r13, 0x10(%rsp)
movl %ebp, 0x4(%rsp)
movq %r14, 0x18(%rsp)
movl (%rax), %eax
movl %eax, 0x8(%rsp)
xorl %r13d, %r13d
xorl %r12d, %r12d
movq %rdx, 0x20(%rsp)
movq 0x10(%rdi), %rax
movl (%rax), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl $0x2, %ecx
jb 0x3f343
leaq (%rax,%rcx), %rbx
addq $0x3, %rbx
addq $0x4, %rax
movslq %r12d, %r12
xorl %r15d, %r15d
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 0x3f066
cmpq $0x1ffe, %r12           # imm = 0x1FFE
jg 0x3f32d
movb 0xc(%rsp), %cl
leaq 0x50c77(%rip), %rdx     # 0x8ffa0
movb %cl, (%r12,%rdx)
movb %r14b, %r15b
addl %r15d, %r13d
incq %r12
cmpq %rbx, %rax
movq %rbp, %rdi
jb 0x3f2f1
movq 0x20(%rsp), %rdx
movq 0x8(%rdi), %rdi
cmpq %rdx, %rdi
jne 0x3f2d1
cmpl $0x2000, %r12d          # imm = 0x2000
jl 0x3f392
movq %rdi, %rbx
movq (%rdi), %rdi
leaq 0xc43a(%rip), %rsi      # 0x4b79c
movl $0x1fff, %r15d          # imm = 0x1FFF
movl %r12d, %edx
movl $0x1fff, %ecx           # imm = 0x1FFF
xorl %eax, %eax
callq 0x118fc
movq %rbx, %rdi
movq 0x10(%rsp), %rcx
movl (%rcx), %eax
movl $0x1fff, %r12d          # imm = 0x1FFF
jmp 0x3f39c
movl (%r13), %eax
xorl %r12d, %r12d
jmp 0x3f3ad
movq 0x10(%rsp), %rcx
movl (%rcx), %eax
movl %r12d, %r15d
testl %r13d, %r13d
movq %rcx, %r13
movq 0x18(%rsp), %r14
movl 0x4(%rsp), %ebp
jne 0x3f3bd
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movl %r12d, %r15d
cmpl %ecx, %r12d
jl 0x3f409
movq %rdi, %r12
leal 0x1(%r15), %ebx
testl %eax, %eax
js 0x3f3cd
cmpl %eax, %r15d
jl 0x3f3d9
movl %ebx, %edi
callq 0x2fabb
movq %rax, %r13
movl (%rax), %eax
andl $0x7fffffff, %ebx       # imm = 0x7FFFFFFF
andl $0x80000000, %eax       # imm = 0x80000000
orl %ebx, %eax
movl %eax, (%r13)
leaq 0x4(%r13), %rdi
movslq %r15d, %rbx
leaq 0x50ba8(%rip), %rsi     # 0x8ffa0
movq %rbx, %rdx
callq 0xe1e0
movb $0x0, 0x4(%r13,%rbx)
movq %r12, %rdi
movq %r13, 0x28(%r14)
movl %ebp, 0x20(%r14)
movq %rdi, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq