// File: /workspace/github_c_makefile_star2_O1/smilingthax[P]libfontembed/test_analyze.c
// Function: show_cmap
void show_cmap(OTF_FILE *otf,int full) // {{{
{
  assert(otf);
  int iA,len=0;

  char *cmap=otf_get_table(otf,OTF_TAG('c','m','a','p'),&len);
  if (!cmap) {
    assert(len==-1);
    printf("No cmap table\n");
    return;
  }
  printf("cmap:\n");
  assert(get_USHORT(cmap)==0x0000); // version
  const int numTables=get_USHORT(cmap+2);
  printf("  numTables: %d\n",numTables);
  for (iA=0;iA<numTables;iA++) {
    const char *nrec=cmap+4+8*iA;
    const char *ndata=cmap+get_ULONG(nrec+4);
    assert(ndata>=cmap+4+8*numTables);
    printf("  platformID/encodingID: %d/%d\n"
           "  offset: %d  data (format: %d, length: %d, language: %d);\n",
           get_USHORT(nrec),get_USHORT(nrec+2),
           get_ULONG(nrec+4),
           get_USHORT(ndata),get_USHORT(ndata+2),get_USHORT(ndata+4));

    if (full) {
      int iB;
      const int format=get_USHORT(ndata);
      if (format==4) {
        const int segCountX2=get_USHORT(ndata+6);
        for (iB=0;iB<segCountX2;iB+=2) {
          const int start=get_USHORT(ndata+16+segCountX2+iB);
          const int delta=get_USHORT(ndata+16+2*segCountX2+iB);
          const int offset=get_USHORT(ndata+16+3*segCountX2+iB);
          printf("    [%x, %x]: delta: %d, offset: %d  ",
                 start,
                 get_USHORT(ndata+14+iB), // end
                 delta,offset);
          if (offset) {
            printf("(glyphIndex offset: ndata + %d + 2*(c - start))",
                   16+3*segCountX2+iB+offset);
          } else {
            printf("(gid of start: %d)",
                   (start+delta)%65536);
          }
          putchar('\n');
          // either  offset!=0: *( ndata+16+3*segCountX2+iB + offset + 2*(X-start) )
          // or: just add delta to X (mod 65536)
        }
        // ... glyphIndexArray from  ndata+16+4*segCountX2  up to  get_USHORT(ndata+2))
      } else if (format==6) {
        const int len=get_USHORT(ndata+8);
        printf("    subrange start char: %x, length: %d, glyph indices:\n",
               get_USHORT(ndata+6),len);
        for (iB=0;iB<len;iB++) {
          printf("%d ",get_USHORT(ndata+10+2*iB));
        }
        putchar('\n');
      }
    }
  }
  free(cmap);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %esi, 0x8(%rsp)
testq %rdi, %rdi
je 0x24b7
leaq 0xc(%rsp), %rdx
movl $0x0, (%rdx)
movl $0x636d6170, %esi       # imm = 0x636D6170
callq 0x32fd
testq %rax, %rax
je 0x2476
movq %rax, %r14
leaq 0x72af(%rip), %rdi      # 0x94aa
callq 0x11f0
movb 0x1(%r14), %al
orb (%r14), %al
jne 0x24d6
movzwl 0x2(%r14), %eax
rolw $0x8, %ax
movzwl %ax, %ebx
leaq 0x6f86(%rip), %rdi      # 0x91a6
movl %ebx, %esi
xorl %eax, %eax
callq 0x1040
testw %bx, %bx
je 0x246c
leaq 0x4(%r14), %rax
movq %rax, 0x28(%rsp)
movl %ebx, %eax
movq %rax, 0x20(%rsp)
leaq (%r14,%rax,8), %rax
addq $0x4, %rax
movq %rax, 0x38(%rsp)
leaq 0xb(%r14), %rax
movq %rax, 0x18(%rsp)
leaq 0x11(%r14), %rax
movq %rax, 0x10(%rsp)
xorl %edx, %edx
movq %r14, 0x30(%rsp)
movl 0x8(%r14,%rdx,8), %r12d
bswapl %r12d
leaq (%r14,%r12), %r13
cmpq 0x38(%rsp), %r13
jb 0x2498
movq 0x28(%rsp), %rcx
movzwl (%rcx,%rdx,8), %eax
movq %rdx, 0x40(%rsp)
movzwl 0x2(%rcx,%rdx,8), %ecx
rolw $0x8, %ax
movzwl %ax, %esi
rolw $0x8, %cx
movzwl %cx, %edx
movzwl (%r13), %eax
movzwl 0x2(%r13), %ecx
rolw $0x8, %ax
movzwl %ax, %r8d
rolw $0x8, %cx
movzwl %cx, %r9d
movzwl 0x4(%r13), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movl %eax, (%rsp)
leaq 0x6f01(%rip), %rdi      # 0x91d1
movl %r12d, %ecx
xorl %eax, %eax
callq 0x1040
cmpl $0x0, 0x8(%rsp)
je 0x2454
movzwl (%r13), %eax
rolw $0x8, %ax
cmpw $0x6, %ax
je 0x23ed
movzwl %ax, %eax
cmpl $0x4, %eax
jne 0x2454
movzwl 0x6(%r13), %eax
rolw $0x8, %ax
testw %ax, %ax
je 0x2454
movzwl %ax, %edx
movl %edx, %eax
leal (%rdx,%rdx,2), %esi
movq 0x10(%rsp), %rcx
leaq (%rcx,%r12), %rdi
leaq (%rdi,%rsi), %r8
movq %r8, 0x50(%rsp)
addq $0x10, %rsi
movq %rsi, 0x48(%rsp)
leaq (%r12,%rax,2), %r14
addq %rcx, %r14
movq %rdx, 0x60(%rsp)
addq %rdx, %rdi
movq %rdi, 0x58(%rsp)
xorl %ebp, %ebp
movq 0x58(%rsp), %rax
movzwl -0x1(%rax,%rbp), %eax
rolw $0x8, %ax
movzwl %ax, %r12d
movzwl -0x1(%r14,%rbp), %eax
rolw $0x8, %ax
movzwl %ax, %r15d
movq 0x50(%rsp), %rax
movzwl -0x1(%rax,%rbp), %eax
rolw $0x8, %ax
movzwl %ax, %ebx
movzwl 0xe(%r13,%rbp), %eax
rolw $0x8, %ax
movzwl %ax, %edx
leaq 0x6e98(%rip), %rdi      # 0x922c
movl %r12d, %esi
movl %r15d, %ecx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x1040
testw %bx, %bx
je 0x23bd
movq 0x48(%rsp), %rax
addl %ebp, %eax
addl %eax, %ebx
leaq 0x6e99(%rip), %rdi      # 0x9252
movl %ebx, %esi
jmp 0x23cb
addl %r12d, %r15d
movzwl %r15w, %esi
leaq 0x6eb7(%rip), %rdi      # 0x9282
xorl %eax, %eax
callq 0x1040
movl $0xa, %edi
callq 0x11c0
addq $0x2, %rbp
cmpq 0x60(%rsp), %rbp
jb 0x234f
jmp 0x2454
movzwl 0x6(%r13), %eax
movzwl 0x8(%r13), %ecx
rolw $0x8, %cx
movzwl %cx, %ebx
rolw $0x8, %ax
movzwl %ax, %esi
leaq 0x6e89(%rip), %rdi      # 0x9295
movl %ebx, %edx
xorl %eax, %eax
callq 0x1040
testw %bx, %bx
leaq 0x6eaf(%rip), %r15      # 0x92ce
je 0x244a
movl %ebx, %ebx
addq 0x18(%rsp), %r12
xorl %r14d, %r14d
movzwl -0x1(%r12,%r14,2), %eax
rolw $0x8, %ax
movzwl %ax, %esi
movq %r15, %rdi
xorl %eax, %eax
callq 0x1040
incq %r14
cmpq %r14, %rbx
jne 0x242b
movl $0xa, %edi
callq 0x11c0
movq 0x40(%rsp), %rdx
incq %rdx
cmpq 0x20(%rsp), %rdx
movq 0x30(%rsp), %r14
jne 0x2268
movq %r14, %rdi
callq 0x1190
jmp 0x2489
cmpl $-0x1, 0xc(%rsp)
jne 0x24f5
leaq 0x7018(%rip), %rdi      # 0x949c
callq 0x11f0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x6d18(%rip), %rdi      # 0x91b7
leaq 0x6b62(%rip), %rsi      # 0x9008
leaq 0x6cc0(%rip), %rcx      # 0x916d
movl $0x77, %edx
callq 0x10e0
leaq 0x6b46(%rip), %rdi      # 0x9004
leaq 0x6b43(%rip), %rsi      # 0x9008
leaq 0x6ca1(%rip), %rcx      # 0x916d
movl $0x67, %edx
callq 0x10e0
leaq 0x6cb0(%rip), %rdi      # 0x918d
leaq 0x6b24(%rip), %rsi      # 0x9008
leaq 0x6c82(%rip), %rcx      # 0x916d
movl $0x71, %edx
callq 0x10e0
leaq 0x6b36(%rip), %rdi      # 0x9032
leaq 0x6b05(%rip), %rsi      # 0x9008
leaq 0x6c63(%rip), %rcx      # 0x916d
movl $0x6c, %edx
callq 0x10e0