// File: /workspace/github_c_makefile_star2_O0/aligrudi[P]neatmkfn/otf.c
// Function: otf_gpostype4
static void otf_gpostype4(struct otf *otf, void *sub, char *feat)
{
	int fmt = U16(sub, 0);
	int *mcov;		/* mark coverage */
	int *bcov;		/* base coverage */
	int cgrp[1024];		/* glyph groups assigned to classes */
	int bgrp;		/* the group assigned to base glyphs */
	int mcnt;		/* mark coverage size */
	int bcnt;		/* base coverage size */
	int ccnt;		/* class count */
	void *marks;		/* mark array table */
	void *bases;		/* base array table */
	int i, j;
	if (fmt != 1)
		return;
	mcov = coverage(sub + U16(sub, 2), &mcnt);
	bcov = coverage(sub + U16(sub, 4), &bcnt);
	ccnt = U16(sub, 6);
	marks = sub + U16(sub, 8);
	bases = sub + U16(sub, 10);
	/* define a group for base glyphs */
	bgrp = ggrp_coverage(bcov, bcnt);
	/* define a group for each mark class */
	for (i = 0; i < ccnt; i++) {
		int *grp = malloc(mcnt * sizeof(grp[0]));
		int cnt = 0;
		for (j = 0; j < mcnt; j++)
			if (U16(marks, 2 + 4 * j) == i)
				grp[cnt++] = mcov[j];
		cgrp[i] = ggrp_coverage(grp, cnt);
		free(grp);
	}
	/* GPOS rules for each mark after base glyphs */
	printf("gsec %d\n", sec);
	for (i = 0; i < mcnt; i++) {
		void *mark = marks + U16(marks, 2 + 4 * i + 2);	/* mark anchor */
		int dx = -uwid(S16(mark, 2));
		int dy = -uwid(S16(mark, 4));
		if (otf_r2l(feat)) {
			dx += uwid(glyph_wid[mcov[i]]);
			dy = -dy;
		}
		printf("gpos %s 2 @%d %s:%+d%+d%+d%+d\n",
			feat, bgrp, glyph_name[mcov[i]], dx, dy, 0, 0);
	}
	/* GPOS rules for each base glyph before a mark */
	printf("gsec %d\n", sec + 1);
	for (i = 0; i < bcnt; i++) {
		for (j = 0; j < ccnt; j++) {
			void *base = bases + U16(bases, 2 + ccnt * 2 * i + 2 * j);
			int dx = uwid(S16(base, 2)) - uwid(glyph_wid[bcov[i]]);
			int dy = uwid(S16(base, 4));
			if (otf_r2l(feat)) {
				dx += uwid(glyph_wid[bcov[i]]);
				dy = -dy;
			}
			printf("gpos %s 2 %s @%d:%+d%+d%+d%+d\n",
				feat, glyph_name[bcov[i]], cgrp[j], dx, dy, 0, 0);
		}
	}
	free(mcov);
	free(bcov);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10d0, %rsp           # imm = 0x10D0
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movzwl (%rax), %edi
callq 0x3d090
movzwl %ax, %eax
movl %eax, -0x1c(%rbp)
cmpl $0x1, -0x1c(%rbp)
je 0x44184
jmp 0x446df
movq -0x10(%rbp), %rax
movq %rax, -0x10a8(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x2(%rax), %edi
callq 0x3d090
movq -0x10a8(%rbp), %rdi
movzwl %ax, %eax
cltq
addq %rax, %rdi
leaq -0x1038(%rbp), %rsi
callq 0x431f0
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x10a0(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x4(%rax), %edi
callq 0x3d090
movq -0x10a0(%rbp), %rdi
movzwl %ax, %eax
cltq
addq %rax, %rdi
leaq -0x103c(%rbp), %rsi
callq 0x431f0
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x6(%rax), %edi
callq 0x3d090
movzwl %ax, %eax
movl %eax, -0x1040(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x1098(%rbp)
movq -0x10(%rbp), %rax
movzwl 0x8(%rax), %edi
callq 0x3d090
movw %ax, %cx
movq -0x1098(%rbp), %rax
movzwl %cx, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x1048(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x1090(%rbp)
movq -0x10(%rbp), %rax
movzwl 0xa(%rax), %edi
callq 0x3d090
movw %ax, %cx
movq -0x1090(%rbp), %rax
movzwl %cx, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x1050(%rbp)
movq -0x30(%rbp), %rdi
movl -0x103c(%rbp), %esi
callq 0x434e0
movl %eax, -0x1034(%rbp)
movl $0x0, -0x1054(%rbp)
movl -0x1054(%rbp), %eax
cmpl -0x1040(%rbp), %eax
jge 0x44381
movslq -0x1038(%rbp), %rdi
shlq $0x2, %rdi
callq 0x3d150
movq %rax, -0x1060(%rbp)
movl $0x0, -0x1064(%rbp)
movl $0x0, -0x1058(%rbp)
movl -0x1058(%rbp), %eax
cmpl -0x1038(%rbp), %eax
jge 0x4433f
movq -0x1048(%rbp), %rax
movl -0x1058(%rbp), %ecx
shll $0x2, %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx), %edi
callq 0x3d090
movzwl %ax, %eax
cmpl -0x1054(%rbp), %eax
jne 0x4432c
movq -0x28(%rbp), %rax
movslq -0x1058(%rbp), %rcx
movl (%rax,%rcx,4), %edx
movq -0x1060(%rbp), %rax
movl -0x1064(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x1064(%rbp)
movslq %ecx, %rcx
movl %edx, (%rax,%rcx,4)
jmp 0x4432e
movl -0x1058(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1058(%rbp)
jmp 0x442c8
movq -0x1060(%rbp), %rdi
movl -0x1064(%rbp), %esi
callq 0x434e0
movl %eax, %ecx
movslq -0x1054(%rbp), %rax
movl %ecx, -0x1030(%rbp,%rax,4)
movq -0x1060(%rbp), %rdi
callq 0x3d030
movl -0x1054(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1054(%rbp)
jmp 0x4428b
movl 0x5b24a9(%rip), %esi    # 0x5f6830
leaq 0x13905(%rip), %rdi     # 0x57c93
movb $0x0, %al
callq 0x3d0b0
movl $0x0, -0x1054(%rbp)
movl -0x1054(%rbp), %eax
cmpl -0x1038(%rbp), %eax
jge 0x444f1
movq -0x1048(%rbp), %rax
movq %rax, -0x10b0(%rbp)
movq -0x1048(%rbp), %rax
movl -0x1054(%rbp), %ecx
shll $0x2, %ecx
addl $0x2, %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx), %edi
callq 0x3d090
movw %ax, %cx
movq -0x10b0(%rbp), %rax
movzwl %cx, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x1070(%rbp)
movq -0x1070(%rbp), %rax
movzwl 0x2(%rax), %edi
callq 0x3d090
movswl %ax, %edi
callq 0x40ca0
movl %eax, %ecx
xorl %eax, %eax
subl %ecx, %eax
movl %eax, -0x1074(%rbp)
movq -0x1070(%rbp), %rax
movzwl 0x4(%rax), %edi
callq 0x3d090
movswl %ax, %edi
callq 0x40ca0
movl %eax, %ecx
xorl %eax, %eax
subl %ecx, %eax
movl %eax, -0x1078(%rbp)
movq -0x18(%rbp), %rdi
callq 0x45160
cmpl $0x0, %eax
je 0x44489
movq -0x28(%rbp), %rax
movslq -0x1054(%rbp), %rcx
movslq (%rax,%rcx,4), %rcx
leaq 0x4723c9(%rip), %rax    # 0x4b6830
movl (%rax,%rcx,4), %edi
callq 0x40ca0
addl -0x1074(%rbp), %eax
movl %eax, -0x1074(%rbp)
xorl %eax, %eax
subl -0x1078(%rbp), %eax
movl %eax, -0x1078(%rbp)
movq -0x18(%rbp), %rsi
movl -0x1034(%rbp), %edx
movq -0x28(%rbp), %rax
movslq -0x1054(%rbp), %rcx
movslq (%rax,%rcx,4), %rax
leaq 0x32387(%rip), %rcx     # 0x76830
shlq $0x6, %rax
addq %rax, %rcx
movl -0x1074(%rbp), %r8d
movl -0x1078(%rbp), %r9d
leaq 0x13790(%rip), %rdi     # 0x57c55
xorl %eax, %eax
movl $0x0, (%rsp)
movl $0x0, 0x8(%rsp)
movb $0x0, %al
callq 0x3d0b0
movl -0x1054(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1054(%rbp)
jmp 0x4439f
movl 0x5b2339(%rip), %esi    # 0x5f6830
addl $0x1, %esi
leaq 0x13792(%rip), %rdi     # 0x57c93
movb $0x0, %al
callq 0x3d0b0
movl $0x0, -0x1054(%rbp)
movl -0x1054(%rbp), %eax
cmpl -0x103c(%rbp), %eax
jge 0x446cd
movl $0x0, -0x1058(%rbp)
movl -0x1058(%rbp), %eax
cmpl -0x1040(%rbp), %eax
jge 0x446b7
movq -0x1050(%rbp), %rax
movq %rax, -0x10c0(%rbp)
movq -0x1050(%rbp), %rax
movl -0x1040(%rbp), %ecx
shll %ecx
imull -0x1054(%rbp), %ecx
addl $0x2, %ecx
movl -0x1058(%rbp), %edx
shll %edx
addl %edx, %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx), %edi
callq 0x3d090
movw %ax, %cx
movq -0x10c0(%rbp), %rax
movzwl %cx, %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x1080(%rbp)
movq -0x1080(%rbp), %rax
movzwl 0x2(%rax), %edi
callq 0x3d090
movswl %ax, %edi
callq 0x40ca0
movl %eax, -0x10b4(%rbp)
movq -0x30(%rbp), %rax
movslq -0x1054(%rbp), %rcx
movslq (%rax,%rcx,4), %rcx
leaq 0x472265(%rip), %rax    # 0x4b6830
movl (%rax,%rcx,4), %edi
callq 0x40ca0
movl %eax, %ecx
movl -0x10b4(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x1084(%rbp)
movq -0x1080(%rbp), %rax
movzwl 0x4(%rax), %edi
callq 0x3d090
movswl %ax, %edi
callq 0x40ca0
movl %eax, -0x1088(%rbp)
movq -0x18(%rbp), %rdi
callq 0x45160
cmpl $0x0, %eax
je 0x44647
movq -0x30(%rbp), %rax
movslq -0x1054(%rbp), %rcx
movslq (%rax,%rcx,4), %rcx
leaq 0x47220b(%rip), %rax    # 0x4b6830
movl (%rax,%rcx,4), %edi
callq 0x40ca0
addl -0x1084(%rbp), %eax
movl %eax, -0x1084(%rbp)
xorl %eax, %eax
subl -0x1088(%rbp), %eax
movl %eax, -0x1088(%rbp)
movq -0x18(%rbp), %rsi
movq -0x30(%rbp), %rax
movslq -0x1054(%rbp), %rcx
movslq (%rax,%rcx,4), %rax
leaq 0x321cf(%rip), %rdx     # 0x76830
shlq $0x6, %rax
addq %rax, %rdx
movslq -0x1058(%rbp), %rax
movl -0x1030(%rbp,%rax,4), %ecx
movl -0x1084(%rbp), %r8d
movl -0x1088(%rbp), %r9d
leaq 0x135e9(%rip), %rdi     # 0x57c74
xorl %eax, %eax
movl $0x0, (%rsp)
movl $0x0, 0x8(%rsp)
movb $0x0, %al
callq 0x3d0b0
movl -0x1058(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1058(%rbp)
jmp 0x4452e
jmp 0x446b9
movl -0x1054(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1054(%rbp)
jmp 0x44512
movq -0x28(%rbp), %rdi
callq 0x3d030
movq -0x30(%rbp), %rdi
callq 0x3d030
addq $0x10d0, %rsp           # imm = 0x10D0
popq %rbp
retq
nopl (%rax,%rax)