// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
andq $0x3f, %rax
movl %eax, -0x2c(%rbp)
cmpl $0x11, -0x2c(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl $0x0, -0x3c(%rbp)
cmpq $0x0, -0x28(%rbp)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x60eeb
jmp 0x60f27
movq -0x20(%rbp), %rax
movl (%rax), %eax
andl $0x3f, %eax
movl %eax, -0x54(%rbp)
subl $0x10, %eax
je 0x60f0f
jmp 0x60efe
movl -0x54(%rbp), %eax
subl $0x11, %eax
jne 0x60f1d
jmp 0x60f08
movl $0x1, -0x30(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x60f25
movq -0x20(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x60edb
cmpl $0x0, -0x30(%rbp)
je 0x60f3f
leaq 0x296fc(%rip), %rax     # 0x8a630
movq (%rax), %rax
movl 0x50(%rax), %eax
movl %eax, -0x58(%rbp)
jmp 0x60f4b
leaq 0x2978a(%rip), %rax     # 0x8a6d0
movl (%rax), %eax
movl %eax, -0x58(%rbp)
movl -0x58(%rbp), %eax
movl %eax, -0x38(%rbp)
movq -0x8(%rbp), %rax
cmpq -0x28(%rbp), %rax
je 0x61007
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
addq $0x4, %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq -0x8(%rbp), %rcx
movq 0x10(%rcx), %rcx
movl (%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
movslq %ecx, %rcx
addq %rcx, %rax
addq $-0x1, %rax
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x50(%rbp), %rax
jae 0x60ff6
movq -0x48(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5c, %eax
jne 0x60fb0
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rdx
movl -0x38(%rbp), %ecx
movq -0x8(%rbp), %rax
movq (%rax), %r8
leaq -0x40(%rbp), %rsi
callq 0x60c30
movq %rax, -0x48(%rbp)
cmpl $0x1fff, -0x34(%rbp)    # imm = 0x1FFF
jge 0x60feb
movl -0x40(%rbp), %eax
movb %al, %dl
movslq -0x34(%rbp), %rcx
leaq 0x55398(%rip), %rax     # 0xb6380
movb %dl, (%rax,%rcx)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x60f91
movq -0x8(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x60f51
cmpl $0x1fff, -0x34(%rbp)    # imm = 0x1FFF
jle 0x61034
movq -0x8(%rbp), %rax
movl -0x34(%rbp), %edx
movq (%rax), %rdi
leaq 0xc5df(%rip), %rsi      # 0x6d600
movl $0x1fff, %ecx           # imm = 0x1FFF
movb $0x0, %al
callq 0x16d80
movl $0x1fff, -0x34(%rbp)    # imm = 0x1FFF
cmpl $0x0, -0x3c(%rbp)
jne 0x6104d
movl -0x34(%rbp), %eax
movq -0x18(%rbp), %rcx
movl (%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
jl 0x610be
movq -0x18(%rbp), %rax
movl (%rax), %eax
shrl $0x1f, %eax
cmpl $0x0, %eax
jne 0x6106e
movl -0x34(%rbp), %eax
movq -0x18(%rbp), %rcx
movl (%rcx), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
cmpl %ecx, %eax
jl 0x6107d
movl -0x34(%rbp), %edi
addl $0x1, %edi
callq 0x46f20
movq %rax, -0x18(%rbp)
movl -0x34(%rbp), %edx
addl $0x1, %edx
movq -0x18(%rbp), %rax
movl (%rax), %ecx
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
andl $0x80000000, %ecx       # imm = 0x80000000
orl %edx, %ecx
movl %ecx, (%rax)
movq -0x18(%rbp), %rdi
addq $0x4, %rdi
movslq -0x34(%rbp), %rdx
leaq 0x552d4(%rip), %rsi     # 0xb6380
callq 0x111d0
movq -0x18(%rbp), %rax
movslq -0x34(%rbp), %rcx
movb $0x0, 0x4(%rax,%rcx)
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movl -0x30(%rbp), %ecx
movq -0x10(%rbp), %rax
movl %ecx, 0x20(%rax)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq