// File: /workspace/github_c_makefile_star2_O3/aligrudi[P]neatmkfn/otf.c
// Function: otf_gtab
static int otf_gtab(struct otf *otf, void *gpos, struct otflookup *lookups)
{
	void *scripts = gpos + U16(gpos, 4);
	int nscripts, nlangs;
	void *script;
	char stag[8], ltag[8];		/* script and language tags */
	int i, j;
	int n = 0;
	nscripts = U16(scripts, 0);
	for (i = 0; i < nscripts; i++) {
		void *grec = scripts + 2 + 6 * i;
		memcpy(stag, grec, 4);
		stag[4] = '\0';
		if (!mkfn_script(stag, nscripts))
			continue;
		script = scripts + U16(grec, 4);
		nlangs = U16(script, 2);
		if (U16(script, 0) && mkfn_lang(NULL, nlangs + (U16(script, 0) != 0)))
			n = otf_lang(otf, gpos, script + U16(script, 0),
						stag, "", lookups, n);
		for (j = 0; j < nlangs; j++) {
			void *lrec = script + 4 + 6 * j;
			memcpy(ltag, lrec, 4);
			ltag[4] = '\0';
			if (mkfn_lang(ltag, nlangs + (U16(script, 0) != 0)))
				n = otf_lang(otf, gpos, script + U16(lrec, 4),
						stag, ltag, lookups, n);
		}
	}
	qsort(lookups, n, sizeof(lookups[0]), (void *) lookupcmp);
	return n;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movzwl 0x4(%rdi), %eax
rolw $0x8, %ax
movq %rsi, 0x18(%rsp)
movzwl %ax, %eax
movzwl (%rdi,%rax), %ecx
testw %cx, %cx
je 0x41e79
rolw $0x8, %cx
leaq (%rdi,%rax), %r12
movzwl %cx, %ecx
cmpl $0x1, %ecx
movl %ecx, 0x24(%rsp)
adcl $0x0, %ecx
movq %rcx, 0x40(%rsp)
movq %rdi, 0x30(%rsp)
addq %rdi, %rax
addq $0x8, %rax
movq %rax, 0x38(%rsp)
xorl %eax, %eax
movl $0x0, 0xc(%rsp)
movq %r12, 0x48(%rsp)
movq %rax, 0x50(%rsp)
addq %rax, %rax
leaq (%rax,%rax,2), %rbx
movl 0x2(%r12,%rbx), %eax
movl %eax, 0x10(%rsp)
movb $0x0, 0x14(%rsp)
leaq 0x10(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0x3d39c
testl %eax, %eax
je 0x41e5f
movzwl 0x6(%r12,%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %r15d
movzwl 0x2(%r12,%r15), %ebp
movl %ebp, %eax
rolw $0x8, %ax
leaq (%r12,%r15), %rbx
movzwl %ax, %r14d
cmpw $0x0, (%r12,%r15)
je 0x41ddb
leal 0x1(%r14), %esi
xorl %edi, %edi
callq 0x3d446
testl %eax, %eax
je 0x41ddb
movzwl (%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %esi
addq %rbx, %rsi
movq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rdx
leaq 0x1942(%rip), %rcx      # 0x4370a
movq 0x18(%rsp), %r8
movl 0xc(%rsp), %r9d
callq 0x4248d
movl %eax, 0xc(%rsp)
testw %bp, %bp
leaq 0x28(%rsp), %r13
je 0x41e5f
cmpl $0x1, %r14d
movl %r14d, %eax
adcl $0x0, %eax
addq 0x38(%rsp), %r15
addq %rax, %rax
leaq (%rax,%rax,2), %rbp
xorl %r12d, %r12d
movl -0x4(%r15,%r12), %eax
movl %eax, 0x28(%rsp)
movb $0x0, 0x2c(%rsp)
cmpw $0x1, (%rbx)
movl %r14d, %esi
sbbl $-0x1, %esi
movq %r13, %rdi
callq 0x3d446
testl %eax, %eax
je 0x41e51
movzwl (%r15,%r12), %eax
rolw $0x8, %ax
movzwl %ax, %esi
addq %rbx, %rsi
movq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rdx
movq %r13, %rcx
movq 0x18(%rsp), %r8
movl 0xc(%rsp), %r9d
callq 0x4248d
movl %eax, 0xc(%rsp)
addq $0x6, %r12
cmpq %r12, %rbp
leaq 0x28(%rsp), %r13
jne 0x41dfe
movq 0x50(%rsp), %rax
incq %rax
cmpq 0x40(%rsp), %rax
movq 0x48(%rsp), %r12
jne 0x41d41
jmp 0x41e81
movl $0x0, 0xc(%rsp)
movslq 0xc(%rsp), %r14
leaq 0x6e1(%rip), %rcx       # 0x4256e
movl $0x1c, %edx
movq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x3d080
movl %r14d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq