// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x70, %rsp
movb %sil, %al
movq %rdi, -0x8(%rbp)
andb $0x1, %al
movb %al, -0x9(%rbp)
leaq 0x19dfd(%rip), %rax     # 0x221a8
cmpl $0x7, (%rax)
jne 0x83b2
jmp 0x83d1
leaq 0x11624(%rip), %rdi     # 0x199dd
leaq 0x115a5(%rip), %rsi     # 0x19965
movl $0x207, %edx            # imm = 0x207
leaq 0x11628(%rip), %rcx     # 0x199f4
callq 0x30f0
movq $0x0, 0x19c7c(%rip) # 0x22058
movq $0x0, -0x58(%rbp)
movl $0x0, -0x1c(%rbp)
leaq 0x19db6(%rip), %rax     # 0x221a8
movq 0x20(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x64(%rbp)
subl $0x22, %eax
je 0x845c
jmp 0x840b
movl -0x64(%rbp), %eax
subl $0x4c, %eax
je 0x8444
jmp 0x8415
movl -0x64(%rbp), %eax
subl $0x55, %eax
je 0x8444
jmp 0x841f
movl -0x64(%rbp), %eax
subl $0x75, %eax
jne 0x8465
jmp 0x8429
movq -0x38(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x38, %eax
jne 0x8442
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x8444
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x20(%rbp)
movq -0x38(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x38(%rbp)
jmp 0x8484
movl $0x0, -0x20(%rbp)
jmp 0x8484
leaq 0x14086(%rip), %rdi     # 0x1c4f2
leaq 0x114f2(%rip), %rsi     # 0x19965
movl $0x212, %edx            # imm = 0x212
leaq 0x11575(%rip), %rcx     # 0x199f4
callq 0x30f0
movl -0x1c(%rbp), %eax
cmpl -0x20(%rbp), %eax
je 0x84b1
cmpl $0x0, -0x1c(%rbp)
je 0x84b1
cmpl $0x0, -0x20(%rbp)
je 0x84b1
leaq 0x19d09(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x1157f(%rip), %rsi     # 0x19a29
movb $0x0, %al
callq 0x11190
cmpl $0x0, -0x20(%rbp)
je 0x84bd
movl -0x20(%rbp), %eax
movl %eax, -0x1c(%rbp)
leaq 0x19b8c(%rip), %rdi     # 0x22050
movl $0x20, %esi
callq 0x12870
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
leaq 0x19ccb(%rip), %rcx     # 0x221a8
movq 0x8(%rcx), %rdx
movq %rdx, (%rax)
movq 0x10(%rcx), %rdx
movq %rdx, 0x8(%rax)
movq 0x18(%rcx), %rcx
movq %rcx, 0x10(%rax)
movq -0x38(%rbp), %rcx
addq $0x1, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x38(%rbp), %rdi
callq 0x30a0
subq $0x2, %rax
addq -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
callq 0xd540
leaq 0x19c83(%rip), %rax     # 0x221a8
cmpl $0x7, (%rax)
je 0x83eb
testb $0x1, -0x9(%rbp)
je 0x853b
movl $0x38, -0x1c(%rbp)
movq -0x58(%rbp), %rax
incq %rax
movq %rax, -0x58(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, -0x68(%rbp)
testl %eax, %eax
je 0x857a
jmp 0x8552
movl -0x68(%rbp), %eax
subl $0x38, %eax
je 0x8587
jmp 0x855c
movl -0x68(%rbp), %eax
subl $0x4c, %eax
je 0x85ae
jmp 0x8566
movl -0x68(%rbp), %eax
subl $0x55, %eax
je 0x85a1
jmp 0x8570
movl -0x68(%rbp), %eax
subl $0x75, %eax
je 0x8594
jmp 0x85c2
leaq 0x19567(%rip), %rax     # 0x21ae8
movq %rax, -0x28(%rbp)
jmp 0x85e1
leaq 0x1960a(%rip), %rax     # 0x21b98
movq %rax, -0x28(%rbp)
jmp 0x85e1
leaq 0x196ad(%rip), %rax     # 0x21c48
movq %rax, -0x28(%rbp)
jmp 0x85e1
leaq 0x19750(%rip), %rax     # 0x21cf8
movq %rax, -0x28(%rbp)
jmp 0x85e1
leaq 0x19beb(%rip), %rax     # 0x221a0
movq (%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rbp)
jmp 0x85e1
leaq 0x13f29(%rip), %rdi     # 0x1c4f2
leaq 0x11395(%rip), %rsi     # 0x19965
movl $0x227, %edx            # imm = 0x227
leaq 0x11418(%rip), %rcx     # 0x199f4
callq 0x30f0
movq -0x28(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x70(%rbp)
subq $0x1, %rax
je 0x860d
jmp 0x85f5
movq -0x70(%rbp), %rax
subq $0x2, %rax
je 0x8622
jmp 0x8601
movq -0x70(%rbp), %rax
subq $0x4, %rax
je 0x8637
jmp 0x864c
movq $0x1, -0x60(%rbp)
leaq 0x154(%rip), %rax       # 0x8770
movq %rax, -0x30(%rbp)
jmp 0x866b
movq $0x2, -0x60(%rbp)
leaq 0x18f(%rip), %rax       # 0x87c0
movq %rax, -0x30(%rbp)
jmp 0x866b
movq $0x4, -0x60(%rbp)
leaq 0x1ca(%rip), %rax       # 0x8810
movq %rax, -0x30(%rbp)
jmp 0x866b
leaq 0x13e9f(%rip), %rdi     # 0x1c4f2
leaq 0x1130b(%rip), %rsi     # 0x19965
movl $0x237, %edx            # imm = 0x237
leaq 0x1138e(%rip), %rcx     # 0x199f4
callq 0x30f0
movq -0x58(%rbp), %rsi
movq -0x60(%rbp), %rdx
xorl %eax, %eax
movl %eax, %edi
callq 0x12760
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq 0x199b5(%rip), %rax     # 0x22050
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq 0x199a6(%rip), %rcx     # 0x22050
addq 0x199a7(%rip), %rcx     # 0x22058
cmpq %rcx, %rax
je 0x8729
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x22, %eax
je 0x8716
movb $0x0, -0x4d(%rbp)
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %r8
leaq -0x4c(%rbp), %rsi
leaq -0x4d(%rbp), %rdx
leaq 0x12c90(%rip), %rcx     # 0x1b379
callq 0x8840
addq -0x38(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq -0x48(%rbp), %rdi
movl -0x4c(%rbp), %esi
movb -0x4d(%rbp), %cl
andb $0x1, %cl
movzbl %cl, %edx
callq *%rax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
jmp 0x86c2
jmp 0x8718
movq -0x18(%rbp), %rax
addq $0x20, %rax
movq %rax, -0x18(%rbp)
jmp 0x869f
movq -0x30(%rbp), %rax
movq -0x48(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq *%rax
addq -0x48(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq -0x40(%rbp), %rcx
subq %rcx, %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0x60(%rbp)
movq %rax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)