// File: /workspace/github_c_makefile_star2_O1/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, %r15
movq %rsi, %r14
movq %rdi, %rbx
movl $0x4, %esi
movq %rdx, %rdi
callq 0x67f0
movq %rax, %r12
cmpq $0x2, %r15
jb 0xeb12
movl %ebp, 0xc(%rsp)
movq %r12, 0x30(%rsp)
movq %rbx, 0x10(%rsp)
movq %r13, 0x40(%rsp)
movl %r13d, %eax
movq %rax, 0x38(%rsp)
leaq 0x1c(%r14), %r12
xorl %edi, %edi
movl $0x1, %r13d
movl $0x1, %ebx
xorl %ecx, %ecx
movl $0x1, %ebp
movq %r15, 0x28(%rsp)
movzwl -0x8(%r12), %eax
btl $0xa, %eax
jb 0xeac5
movslq %r13d, %rsi
shlq $0x4, %rsi
movq 0x10(%rsp), %rdx
movq (%rdx,%rsi), %rsi
movslq %edi, %r15
shlq $0x4, %r15
cmpq (%rdx,%r15), %rsi
jne 0xeac9
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 0xeac9
addq %r14, %rsi
movl 0x8(%rsi), %eax
cmpl -0x4(%r12), %eax
jne 0xeac9
movl 0xc(%rsi), %eax
cmpl (%r12), %eax
jne 0xeac9
movq 0x38(%rsp), %rax
movl %edi, 0x1c(%rsp)
leal (%rax,%rbx), %edi
movl 0xc(%rsp), %esi
movq %rcx, 0x20(%rsp)
callq 0x7458
movl %eax, 0x18(%rsp)
movq 0x40(%rsp), %rax
movq 0x20(%rsp), %rcx
leal (%rcx,%rax), %edi
movl 0xc(%rsp), %esi
callq 0x7458
movl 0x1c(%rsp), %edi
movq 0x20(%rsp), %rcx
cmpl %eax, 0x18(%rsp)
jne 0xeac9
incl %ebp
jmp 0xeaeb
incl %ebp
jmp 0xeaf3
addq 0x10(%rsp), %r15
movq (%r15), %rdi
movq %r14, %rsi
movq 0x30(%rsp), %rdx
movl %ebp, %r8d
callq 0xeb90
movl $0x1, %ebp
movl %ebx, %ecx
movl %r13d, %edi
movq 0x28(%rsp), %r15
incl %r13d
incq %rbx
addq $0x10, %r12
cmpq %rbx, %r15
jne 0xea1f
movslq %edi, %rax
movq 0x10(%rsp), %rbx
movq 0x30(%rsp), %r12
jmp 0xeb1b
xorl %ecx, %ecx
movl $0x1, %ebp
xorl %eax, %eax
shlq $0x4, %rax
movq (%rbx,%rax), %rdi
movq %r14, %rsi
movq %r12, %rdx
movl %ebp, %r8d
callq 0xeb90
testq %r15, %r15
je 0xeb7a
addq $0x4, %r14
xorl %eax, %eax
xorl %ecx, %ecx
movl (%r14), %esi
btl $0xa, %esi
jb 0xeb6e
movl (%r12,%rax,4), %edx
movslq %ecx, %rdi
shlq $0x4, %rdi
cmpl 0x8(%rbx,%rdi), %edx
je 0xeb62
orl $0x800, %esi            # imm = 0x800
movw %si, (%r14)
leaq (%rbx,%rdi), %rsi
addq $0x8, %rsi
incl %ecx
movl %edx, (%rsi)
incq %rax
addq $0x10, %r14
cmpq %rax, %r15
jne 0xeb3e
movq %r12, %rdi
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6360