// File: /workspace/github_c_makefile_star2_O3/michaelforney[P]cproc/expr.c
// Function: stringconcat
struct type *
stringconcat(struct stringlit *str, bool forceutf8)
{
	static struct array parts;
	struct {
		struct location loc;
		char *str;
	} *p;
	int kind, newkind;
	struct type *t;
	size_t (*encodechar)(void *, uint_least32_t, bool);
	char *src;
	unsigned char *buf, *dst;
	uint_least32_t chr;
	bool hexoct;
	size_t len, width;

	assert(tok.kind == TSTRINGLIT);
	parts.len = 0;
	len = 0;
	kind = 0;
	do {
		src = tok.lit;
		switch (*src) {
		case 'u': if (src[1] == '8') ++src; /* fallthrough */
		case 'L':
		case 'U': newkind = *src, ++src; break;
		case '"': newkind = 0; break;
		default: assert(0);
		}
		if (kind != newkind && kind && newkind)
			error(&tok.loc, "adjacent string literals have differing prefixes");
		if (newkind)
			kind = newkind;
		p = arrayadd(&parts, sizeof(*p));
		p->loc = tok.loc;
		p->str = src + 1;
		len += strlen(src) - 2;
		next();
	} while (tok.kind == TSTRINGLIT);
	if (forceutf8)
		kind = '8';
	++len;  /* null byte */
	switch (kind) {
	case 0: t = &typechar; break;
	case '8': t = &typeuchar; break;
	case 'u': t = &typeushort; break;
	case 'U': t = &typeuint; break;
	case 'L': t = targ->typewchar; break;
	default: assert(0);
	}
	switch (t->size) {
	case 1:
		width = 1;
		encodechar = encodechar8;
		break;
	case 2:
		width = sizeof(uint_least16_t);
		encodechar = encodechar16;
		break;
	case 4:
		width = sizeof(uint_least32_t);
		encodechar = encodechar32;
		break;
	default:
		assert(0);
	}
	buf = xreallocarray(NULL, len, width);
	str->data = buf;
	dst = buf;
	arrayforeach(&parts, p) {
		src = p->str;
		while (*src != '"') {
			hexoct = false;
			src += decodechar(src, &chr, &hexoct, "string literal", &p->loc);
			dst += encodechar(dst, chr, hexoct);
		}
	}
	dst += encodechar(dst, 0, false);
	str->size = (dst - buf) / width;
	return t;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %esi, 0x10(%rsp)
movq %rdi, 0x28(%rsp)
leaq 0x156ff(%rip), %rbp     # 0x1c108
cmpl $0x7, (%rbp)
jne 0x6ca8
movq $0x0, 0x1559a(%rip) # 0x1bfb8
leaq 0x1558b(%rip), %r15     # 0x1bfb0
leaq 0x8(%rbp), %rax
movq %rax, 0x18(%rsp)
xorl %r12d, %r12d
xorl %r14d, %r14d
movq 0x20(%rbp), %rbx
movb (%rbx), %al
movzbl %al, %ecx
cmpl $0x54, %ecx
jg 0x6a51
cmpl $0x22, %ecx
je 0x6aa5
cmpl $0x4c, %ecx
je 0x6a78
jmp 0x6c89
cmpl $0x55, %ecx
je 0x6a78
cmpl $0x75, %ecx
jne 0x6c89
leaq 0x1(%rbx), %rcx
cmpb $0x38, 0x1(%rbx)
movl $0x75, %eax
movl $0x38, %edx
cmovel %edx, %eax
cmoveq %rcx, %rbx
movzbl %al, %r13d
incq %rbx
cmpl %r13d, %r12d
sete %al
testl %r12d, %r12d
sete %cl
orb %al, %cl
jne 0x6aa2
movq 0x18(%rsp), %rdi
leaq 0xcb5e(%rip), %rsi      # 0x135f9
xorl %eax, %eax
callq 0xd55c
movl %r13d, %r12d
movl $0x20, %esi
movq %r15, %rdi
callq 0xe190
movups 0x8(%rbp), %xmm0
movups %xmm0, (%rax)
movq 0x18(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x1(%rbx), %rcx
movq %rcx, 0x18(%rax)
movq %rbx, %rdi
callq 0x3090
addq %rax, %r14
addq $-0x2, %r14
callq 0xa920
cmpl $0x7, (%rbp)
je 0x6a34
cmpb $0x0, 0x10(%rsp)
movl $0x38, %eax
cmovnel %eax, %r12d
cmpl $0x4b, %r12d
jle 0x6b1a
cmpl $0x4c, %r12d
je 0x6b32
cmpl $0x55, %r12d
je 0x6b42
cmpl $0x75, %r12d
jne 0x6ce6
leaq 0x15090(%rip), %rax     # 0x1bba8
jmp 0x6b52
testl %r12d, %r12d
je 0x6b4b
cmpl $0x38, %r12d
jne 0x6ce6
leaq 0x14fc8(%rip), %rax     # 0x1baf8
jmp 0x6b52
leaq 0x155c7(%rip), %rax     # 0x1c100
movq (%rax), %rax
movq 0x10(%rax), %rax
jmp 0x6b52
leaq 0x1510f(%rip), %rax     # 0x1bc58
jmp 0x6b52
leaq 0x14ef6(%rip), %rax     # 0x1ba48
movq 0x10(%rax), %rdx
cmpq $0x1, %rdx
movq %rax, 0x40(%rsp)
je 0x6b83
cmpq $0x4, %rdx
je 0x6b7a
cmpq $0x2, %rdx
jne 0x6cc7
leaq 0x19e(%rip), %rax       # 0x6d16
jmp 0x6b8a
leaq 0x1b0(%rip), %rax       # 0x6d31
jmp 0x6b8a
leaq 0x17b(%rip), %rax       # 0x6d05
movq %rax, 0x10(%rsp)
incq %r14
xorl %edi, %edi
movq %r14, %rsi
movq %rdx, 0x38(%rsp)
callq 0xe10e
movq %rax, %r14
movq 0x28(%rsp), %rax
movq %r14, 0x8(%rax)
movq 0x15404(%rip), %rax     # 0x1bfb8
testq %rax, %rax
movq %r14, 0x30(%rsp)
je 0x6c53
movq 0x153e7(%rip), %rdi     # 0x1bfb0
leaq 0xe241(%rip), %rcx      # 0x14e11
leaq 0x24(%rsp), %r15
leaq 0xf(%rsp), %rbp
movq %rdi, %r8
movq 0x18(%r8), %r12
cmpb $0x22, (%r12)
je 0x6c46
movq %r14, %rbx
movb $0x0, 0xf(%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %rbp, %rdx
movq %r8, %r14
callq 0x6d39
movq %rax, %r13
addq %r12, %rax
movq %rax, 0x18(%rsp)
movl 0x24(%rsp), %esi
movzbl 0xf(%rsp), %edx
movq %rbx, %rdi
callq *0x10(%rsp)
movq %r14, %r8
leaq 0xe1eb(%rip), %rcx      # 0x14e11
movq %rax, %r14
addq %rbx, %r14
cmpb $0x22, (%r12,%r13)
movq 0x18(%rsp), %r12
jne 0x6be8
movq 0x15371(%rip), %rdi     # 0x1bfb0
movq 0x15372(%rip), %rax     # 0x1bfb8
addq $0x20, %r8
leaq (%rdi,%rax), %r9
cmpq %r9, %r8
jne 0x6bdd
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq *0x10(%rsp)
addq %r14, %rax
subq 0x30(%rsp), %rax
xorl %edx, %edx
divq 0x38(%rsp)
movq 0x28(%rsp), %rcx
movq %rax, (%rcx)
movq 0x40(%rsp), %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xf0ce(%rip), %rdi      # 0x15d5e
leaq 0xc89e(%rip), %rsi      # 0x13535
leaq 0xc926(%rip), %rcx      # 0x135c4
movl $0x212, %edx            # imm = 0x212
callq 0x30e0
leaq 0xc8fe(%rip), %rdi      # 0x135ad
leaq 0xc87f(%rip), %rsi      # 0x13535
leaq 0xc907(%rip), %rcx      # 0x135c4
movl $0x207, %edx            # imm = 0x207
callq 0x30e0
leaq 0xf090(%rip), %rdi      # 0x15d5e
leaq 0xc860(%rip), %rsi      # 0x13535
leaq 0xc8e8(%rip), %rcx      # 0x135c4
movl $0x237, %edx            # imm = 0x237
callq 0x30e0
leaq 0xf071(%rip), %rdi      # 0x15d5e
leaq 0xc841(%rip), %rsi      # 0x13535
leaq 0xc8c9(%rip), %rcx      # 0x135c4
movl $0x227, %edx            # imm = 0x227
callq 0x30e0