// File: /workspace/github_c_makefile_star2_O2/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 $0x38, %rsp
movl %esi, 0x10(%rsp)
movq %rdi, 0x20(%rsp)
leaq 0x15a52(%rip), %r13     # 0x1c108
cmpl $0x7, (%r13)
jne 0x68f6
andq $0x0, 0x158ef(%rip)     # 0x1bfb8
leaq 0x8(%r13), %r15
xorl %r12d, %r12d
xorl %r14d, %r14d
movq 0x20(%r13), %rbp
movzbl (%rbp), %eax
cmpl $0x22, %eax
je 0x6710
cmpl $0x4c, %eax
je 0x6708
cmpl $0x55, %eax
je 0x6708
cmpl $0x75, %eax
jne 0x68d7
leaq 0x1(%rbp), %rcx
cmpb $0x38, 0x1(%rbp)
pushq $0x75
popq %rax
pushq $0x38
popq %rdx
cmovel %edx, %eax
cmoveq %rcx, %rbp
movzbl %al, %ebx
incq %rbp
jmp 0x6712
xorl %ebx, %ebx
testl %ebx, %ebx
je 0x6731
testl %r12d, %r12d
je 0x6731
cmpl %ebx, %r12d
je 0x6731
movq %r15, %rdi
leaq 0xbecf(%rip), %rsi      # 0x125f9
xorl %eax, %eax
callq 0xc536
testl %ebx, %ebx
cmovnel %ebx, %r12d
leaq 0x15872(%rip), %rdi     # 0x1bfb0
pushq $0x20
popq %rsi
callq 0xd12f
movups 0x8(%r13), %xmm0
movups %xmm0, (%rax)
movq 0x18(%r13), %rcx
movq %rcx, 0x10(%rax)
leaq 0x1(%rbp), %rcx
movq %rcx, 0x18(%rax)
movq %rbp, %rdi
callq 0x3090
addq %rax, %r14
addq $-0x2, %r14
callq 0x9c1e
cmpl $0x7, (%r13)
je 0x66d3
cmpb $0x0, 0x10(%rsp)
pushq $0x38
popq %rax
cmovnel %eax, %r12d
testl %r12d, %r12d
je 0x67bc
cmpl $0x75, %r12d
je 0x67b3
cmpl $0x4c, %r12d
je 0x67c5
cmpl $0x55, %r12d
je 0x67d5
cmpl $0x38, %r12d
jne 0x6934
leaq 0x15347(%rip), %rax     # 0x1baf8
jmp 0x67dc
leaq 0x153ee(%rip), %rax     # 0x1bba8
jmp 0x67dc
leaq 0x15285(%rip), %rax     # 0x1ba48
jmp 0x67dc
leaq 0x15934(%rip), %rax     # 0x1c100
movq (%rax), %rax
movq 0x10(%rax), %rax
jmp 0x67dc
leaq 0x1547c(%rip), %rax     # 0x1bc58
movq 0x10(%rax), %rdx
cmpq $0x1, %rdx
movq %rax, 0x10(%rsp)
je 0x680d
cmpq $0x4, %rdx
je 0x6804
cmpq $0x2, %rdx
jne 0x6915
leaq 0x160(%rip), %r13       # 0x6962
jmp 0x6814
leaq 0x170(%rip), %r13       # 0x697b
jmp 0x6814
leaq 0x13f(%rip), %r13       # 0x6953
incq %r14
xorl %edi, %edi
movq %r14, %rsi
movq %rdx, 0x30(%rsp)
callq 0xd0af
movq %rax, %r14
movq 0x20(%rsp), %rax
movq %r14, 0x8(%rax)
movq 0x15777(%rip), %rax     # 0x1bfb0
leaq 0x1c(%rsp), %rbp
leaq 0xf(%rsp), %r15
movq %rax, %r12
movq %r14, 0x28(%rsp)
addq 0x15766(%rip), %rax     # 0x1bfb8
cmpq %rax, %r12
je 0x68a2
movq 0x18(%r12), %rbx
cmpb $0x22, (%rbx)
je 0x6895
movb $0x0, 0xf(%rsp)
movq %rbx, %rdi
movq %rbp, %rsi
movq %r15, %rdx
leaq 0xd563(%rip), %rcx      # 0x13dd9
movq %r12, %r8
callq 0x6981
addq %rax, %rbx
movl 0x1c(%rsp), %esi
movzbl 0xf(%rsp), %edx
movq %r14, %rdi
callq *%r13
addq %rax, %r14
jmp 0x685c
addq $0x20, %r12
movq 0x15710(%rip), %rax     # 0x1bfb0
jmp 0x684b
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq *%r13
addq %r14, %rax
subq 0x28(%rsp), %rax
xorl %edx, %edx
divq 0x30(%rsp)
movq 0x20(%rsp), %rcx
movq %rax, (%rcx)
movq 0x10(%rsp), %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xe444(%rip), %rdi      # 0x14d22
leaq 0xbc50(%rip), %rsi      # 0x12535
leaq 0xbcd8(%rip), %rcx      # 0x125c4
movl $0x212, %edx            # imm = 0x212
callq 0x30e0
leaq 0xbcb0(%rip), %rdi      # 0x125ad
leaq 0xbc31(%rip), %rsi      # 0x12535
leaq 0xbcb9(%rip), %rcx      # 0x125c4
movl $0x207, %edx            # imm = 0x207
callq 0x30e0
leaq 0xe406(%rip), %rdi      # 0x14d22
leaq 0xbc12(%rip), %rsi      # 0x12535
leaq 0xbc9a(%rip), %rcx      # 0x125c4
movl $0x237, %edx            # imm = 0x237
callq 0x30e0
leaq 0xe3e7(%rip), %rdi      # 0x14d22
leaq 0xbbf3(%rip), %rsi      # 0x12535
leaq 0xbc7b(%rip), %rcx      # 0x125c4
movl $0x227, %edx            # imm = 0x227
callq 0x30e0