// File: /workspace/github_c_makefile_star2_O1/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, 0x20(%rsp)
leaq 0x15573(%rip), %r12     # 0x1c108
cmpl $0x7, (%r12)
jne 0x6e05
movq $0x0, 0x1540d(%rip) # 0x1bfb8
leaq 0x8(%r12), %r15
xorl %ebp, %ebp
xorl %r14d, %r14d
movq 0x20(%r12), %rbx
movzbl (%rbx), %eax
cmpl $0x54, %eax
jg 0x6bd1
cmpl $0x22, %eax
je 0x6bf1
cmpl $0x4c, %eax
je 0x6be8
jmp 0x6de6
cmpl $0x55, %eax
je 0x6be8
cmpl $0x75, %eax
jne 0x6de6
cmpb $0x38, 0x1(%rbx)
jne 0x6be8
incq %rbx
movsbl (%rbx), %r13d
incq %rbx
jmp 0x6bf4
xorl %r13d, %r13d
testl %r13d, %r13d
je 0x6c13
testl %ebp, %ebp
je 0x6c13
cmpl %r13d, %ebp
je 0x6c13
movq %r15, %rdi
leaq 0xc98d(%rip), %rsi      # 0x13599
xorl %eax, %eax
callq 0xd56a
testl %r13d, %r13d
cmovnel %r13d, %ebp
movl $0x20, %esi
leaq 0x1538a(%rip), %rdi     # 0x1bfb0
callq 0xe18c
movups 0x8(%r12), %xmm0
movups %xmm0, (%rax)
movq 0x18(%r12), %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 0xa9d0
cmpl $0x7, (%r12)
je 0x6bb5
cmpb $0x0, 0x10(%rsp)
movl $0x38, %eax
cmovnel %eax, %ebp
cmpl $0x4b, %ebp
jle 0x6c92
cmpl $0x4c, %ebp
je 0x6ca8
cmpl $0x55, %ebp
je 0x6cb8
cmpl $0x75, %ebp
jne 0x6e43
leaq 0x14f18(%rip), %rax     # 0x1bba8
jmp 0x6cc8
testl %ebp, %ebp
je 0x6cc1
cmpl $0x38, %ebp
jne 0x6e43
leaq 0x14e52(%rip), %rax     # 0x1baf8
jmp 0x6cc8
leaq 0x15451(%rip), %rax     # 0x1c100
movq (%rax), %rax
movq 0x10(%rax), %rax
jmp 0x6cc8
leaq 0x14f99(%rip), %rax     # 0x1bc58
jmp 0x6cc8
leaq 0x14d80(%rip), %rax     # 0x1ba48
movq 0x10(%rax), %rdx
cmpq $0x1, %rdx
movq %rax, 0x40(%rsp)
je 0x6cf9
cmpq $0x4, %rdx
je 0x6cf0
cmpq $0x2, %rdx
jne 0x6e24
leaq 0x185(%rip), %rax       # 0x6e73
jmp 0x6d00
leaq 0x197(%rip), %rax       # 0x6e8e
jmp 0x6d00
leaq 0x162(%rip), %rax       # 0x6e62
movq %rax, 0x28(%rsp)
incq %r14
xorl %edi, %edi
movq %r14, %rsi
movq %rdx, 0x38(%rsp)
callq 0xe10a
movq %rax, %r14
movq 0x20(%rsp), %rax
movq %r14, 0x8(%rax)
cmpq $0x0, 0x1528d(%rip)     # 0x1bfb8
movq %r14, 0x30(%rsp)
je 0x6db0
movq 0x15277(%rip), %r13     # 0x1bfb0
leaq 0xe039(%rip), %rcx      # 0x14d79
leaq 0x1c(%rsp), %r12
leaq 0xf(%rsp), %r15
movq 0x18(%r13), %rbx
cmpb $0x22, (%rbx)
je 0x6d99
movb $0x0, 0xf(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r13, %r8
callq 0x6e96
movq %rax, %rbp
addq %rbx, %rax
movq %rax, 0x10(%rsp)
movl 0x1c(%rsp), %esi
movzbl 0xf(%rsp), %edx
movq %r14, %rdi
callq *0x28(%rsp)
leaq 0xdfee(%rip), %rcx      # 0x14d79
addq %rax, %r14
cmpb $0x22, (%rbx,%rbp)
movq 0x10(%rsp), %rbx
jne 0x6d53
addq $0x20, %r13
movq 0x1520c(%rip), %rax     # 0x1bfb0
addq 0x1520d(%rip), %rax     # 0x1bfb8
cmpq %rax, %r13
jne 0x6d4a
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq *0x28(%rsp)
addq %r14, %rax
subq 0x30(%rsp), %rax
xorl %edx, %edx
divq 0x38(%rsp)
movq 0x20(%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 0xeed1(%rip), %rdi      # 0x15cbe
leaq 0xc6e1(%rip), %rsi      # 0x134d5
leaq 0xc769(%rip), %rcx      # 0x13564
movl $0x212, %edx            # imm = 0x212
callq 0x30e0
leaq 0xc741(%rip), %rdi      # 0x1354d
leaq 0xc6c2(%rip), %rsi      # 0x134d5
leaq 0xc74a(%rip), %rcx      # 0x13564
movl $0x207, %edx            # imm = 0x207
callq 0x30e0
leaq 0xee93(%rip), %rdi      # 0x15cbe
leaq 0xc6a3(%rip), %rsi      # 0x134d5
leaq 0xc72b(%rip), %rcx      # 0x13564
movl $0x237, %edx            # imm = 0x237
callq 0x30e0
leaq 0xee74(%rip), %rdi      # 0x15cbe
leaq 0xc684(%rip), %rsi      # 0x134d5
leaq 0xc70c(%rip), %rcx      # 0x13564
movl $0x227, %edx            # imm = 0x227
callq 0x30e0