// File: /workspace/github_c_makefile_star2_O0/deplinenoise[P]vlink/t_amigahunk.c
// Function: create_debuginfo
static bool create_debuginfo(struct GlobalVars *gv,struct HunkInfo *hi,
                             struct Section *s)
/* read amigahunk/ehf debugging informations */
{
  int32_t len;
  uint32_t base;

  if (s) {
    nextword32(hi);
    if ((len = nextword32(hi)) >= 3) {
      base = nextword32(hi);
      switch (nextword32(hi)) {

        case 0x4c494e45:  /* "LINE" - line/offset table and source name */
          {
            struct LineDebug *ldb;
            uint32_t *lptr,*optr;

            ldb = (struct LineDebug *)addtargetext(s,TGEXT_AMIGAOS,
                                                   SUBID_LINE,0,
                                                   sizeof(struct LineDebug));
            len -= testword32(hi) + 3; /* number of longwords for file name */
            ldb->source_name = gethunkname(hi);
            ldb->num_entries = len >> 1;
            lptr = ldb->lines = alloc(ldb->num_entries * sizeof(uint32_t));
            optr = ldb->offsets = alloc(ldb->num_entries * sizeof(uint32_t));
            while (len > 0) {
              *lptr++ = nextword32(hi);
              *optr++ = nextword32(hi) + base;
              len -= 2;
            }
          }
          break;

        default:
          movehunkptr32(hi,len-2);  /* ignore unknown debug hunk */
          break;
      }
    }
    else /* too short... ignore */
      movehunkptr32(hi,len);
    return (TRUE);
  }
  return (FALSE);
}

// Assembly:
subq $0x48, %rsp
movq %rdi, 0x38(%rsp)
movq %rsi, 0x30(%rsp)
movq %rdx, 0x28(%rsp)
cmpq $0x0, 0x28(%rsp)
je 0x1d975
movq 0x30(%rsp), %rdi
callq 0x1cfa0
movq 0x30(%rsp), %rdi
callq 0x1cfa0
movl %eax, 0x24(%rsp)
cmpl $0x3, %eax
jl 0x1d95d
movq 0x30(%rsp), %rdi
callq 0x1cfa0
movl %eax, 0x20(%rsp)
movq 0x30(%rsp), %rdi
callq 0x1cfa0
subl $0x4c494e45, %eax       # imm = 0x4C494E45
jne 0x1d94a
jmp 0x1d855
movq 0x28(%rsp), %rdi
movl $0x1, %edx
xorl %ecx, %ecx
movl $0x30, %r8d
movl %edx, %esi
callq 0x10d20
movq %rax, 0x18(%rsp)
movq 0x30(%rsp), %rdi
callq 0x1d120
movl %eax, %ecx
addl $0x3, %ecx
movl 0x24(%rsp), %eax
subl %ecx, %eax
movl %eax, 0x24(%rsp)
movq 0x30(%rsp), %rdi
callq 0x1d160
movq %rax, %rcx
movq 0x18(%rsp), %rax
movq %rcx, 0x10(%rax)
movl 0x24(%rsp), %ecx
sarl %ecx
movq 0x18(%rsp), %rax
movl %ecx, 0x18(%rax)
movq 0x18(%rsp), %rax
movl 0x18(%rax), %eax
movl %eax, %edi
shlq $0x2, %rdi
callq 0x71f0
movq 0x18(%rsp), %rcx
movq %rax, 0x20(%rcx)
movq %rax, 0x10(%rsp)
movq 0x18(%rsp), %rax
movl 0x18(%rax), %eax
movl %eax, %edi
shlq $0x2, %rdi
callq 0x71f0
movq 0x18(%rsp), %rcx
movq %rax, 0x28(%rcx)
movq %rax, 0x8(%rsp)
cmpl $0x0, 0x24(%rsp)
jle 0x1d948
movq 0x30(%rsp), %rdi
callq 0x1cfa0
movl %eax, %ecx
movq 0x10(%rsp), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, 0x10(%rsp)
movl %ecx, (%rax)
movq 0x30(%rsp), %rdi
callq 0x1cfa0
movl %eax, %ecx
addl 0x20(%rsp), %ecx
movq 0x8(%rsp), %rax
movq %rax, %rdx
addq $0x4, %rdx
movq %rdx, 0x8(%rsp)
movl %ecx, (%rax)
movl 0x24(%rsp), %eax
subl $0x2, %eax
movl %eax, 0x24(%rsp)
jmp 0x1d8f2
jmp 0x1d95b
movq 0x30(%rsp), %rdi
movl 0x24(%rsp), %esi
subl $0x2, %esi
callq 0x1cf40
jmp 0x1d96b
movq 0x30(%rsp), %rdi
movl 0x24(%rsp), %esi
callq 0x1cf40
movl $0x1, 0x44(%rsp)
jmp 0x1d97d
movl $0x0, 0x44(%rsp)
movl 0x44(%rsp), %eax
addq $0x48, %rsp
retq
nopw %cs:(%rax,%rax)