// File: /workspace/github_c_makefile_star2_O3/spacifici[P]st/src/hb.c
// Function: hbtransform
void
hbtransform(XftGlyphFontSpec *specs, const Glyph *glyphs, size_t len, int x, int y)
{
	int start = 0, length = 1, gstart = 0;
	hb_codepoint_t *codepoints = calloc(len, sizeof(hb_codepoint_t));

	for (int idx = 1, specidx = 1; idx < len; idx++) {
		if (glyphs[idx].mode & ATTR_WDUMMY) {
			length += 1;
			continue;
		}

		if (specs[specidx].font != specs[start].font || ATTRCMP(glyphs[gstart], glyphs[idx]) || selected(x + idx, y) != selected(x + gstart, y)) {
			hbtransformsegment(specs[start].font, glyphs, codepoints, gstart, length);

			/* Reset the sequence. */
			length = 1;
			start = specidx;
			gstart = idx;
		} else {
			length += 1;
		}

		specidx++;
	}

	/* EOL. */
	hbtransformsegment(specs[start].font, glyphs, codepoints, gstart, length);

	/* Apply the transformation to glyph specs. */
	for (int i = 0, specidx = 0; i < len; i++) {
		if (glyphs[i].mode & ATTR_WDUMMY)
			continue;

		if (codepoints[i] != specs[specidx].glyph)
			((Glyph *)glyphs)[i].mode |= ATTR_LIGA;

		specs[specidx++].glyph = codepoints[i];
	}

	free(codepoints);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movl %r8d, %ebp
movl %ecx, %r13d
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movl $0x4, %esi
movq %rdx, %rdi
callq 0x67e0
movq %rax, %r12
cmpq $0x2, %rbx
jb 0xedf1
movl %ebp, 0xc(%rsp)
movq %r12, 0x28(%rsp)
movq %r15, 0x18(%rsp)
movq %r13, 0x38(%rsp)
movl %r13d, %eax
movq %rax, 0x30(%rsp)
leaq 0x1c(%r14), %r12
xorl %r8d, %r8d
movl $0x1, %r13d
movl $0x1, %r15d
xorl %ecx, %ecx
movl $0x1, %ebp
movq %rbx, 0x40(%rsp)
movzwl -0x8(%r12), %eax
btl $0xa, %eax
jb 0xed9e
movslq %r13d, %rsi
shlq $0x4, %rsi
movslq %r8d, %rbx
shlq $0x4, %rbx
movq 0x18(%rsp), %rdx
movq (%rdx,%rbx), %rdi
cmpq %rdi, (%rdx,%rsi)
jne 0xedaf
movslq %ecx, %rsi
shlq $0x4, %rsi
movzwl 0x4(%r14,%rsi), %edx
andl $0xf6ff, %edx           # imm = 0xF6FF
andl $0xf2ff, %eax           # imm = 0xF2FF
cmpl %edx, %eax
jne 0xedaf
addq %r14, %rsi
movl 0x8(%rsi), %eax
cmpl -0x4(%r12), %eax
jne 0xedaf
movl 0xc(%rsi), %eax
cmpl (%r12), %eax
jne 0xedaf
movl %r8d, 0x20(%rsp)
movq 0x30(%rsp), %rax
leal (%rax,%r15), %edi
movl 0xc(%rsp), %esi
movq %rcx, 0x10(%rsp)
callq 0x752e
movl %eax, 0x24(%rsp)
movq 0x38(%rsp), %rax
movq 0x10(%rsp), %rcx
leal (%rcx,%rax), %edi
movl 0xc(%rsp), %esi
callq 0x752e
cmpl %eax, 0x24(%rsp)
jne 0xeda2
incl %ebp
movq 0x10(%rsp), %rcx
movl 0x20(%rsp), %r8d
jmp 0xedca
incl %ebp
jmp 0xedd2
addq 0x18(%rsp), %rbx
movq (%rbx), %rdi
movq 0x10(%rsp), %rcx
movq %r14, %rsi
movq 0x28(%rsp), %rdx
movl %ebp, %r8d
callq 0xee70
movl $0x1, %ebp
movl %r15d, %ecx
movl %r13d, %r8d
incl %r13d
movq 0x40(%rsp), %rbx
incq %r15
addq $0x10, %r12
cmpq %r15, %rbx
jne 0xecf1
movslq %r8d, %rax
movq 0x18(%rsp), %r15
movq 0x28(%rsp), %r12
jmp 0xedfa
xorl %ecx, %ecx
movl $0x1, %ebp
xorl %eax, %eax
shlq $0x4, %rax
movq (%r15,%rax), %rdi
movq %r14, %rsi
movq %r12, %rdx
movl %ebp, %r8d
callq 0xee70
testq %rbx, %rbx
je 0xee5a
addq $0x4, %r14
xorl %eax, %eax
xorl %ecx, %ecx
movl (%r14), %esi
btl $0xa, %esi
jb 0xee4e
movl (%r12,%rax,4), %edx
movslq %ecx, %rdi
shlq $0x4, %rdi
cmpl 0x8(%r15,%rdi), %edx
je 0xee42
orl $0x800, %esi            # imm = 0x800
movw %si, (%r14)
leaq (%r15,%rdi), %rsi
addq $0x8, %rsi
incl %ecx
movl %edx, (%rsi)
incq %rax
addq $0x10, %r14
cmpq %rax, %rbx
jne 0xee1d
movq %r12, %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6360