// File: /workspace/github_c_makefile_star2_O0/deplinenoise[P]vlink/t_amigahunk.c
// Function: skiphunk
static uint32_t skiphunk(struct HunkInfo *hi)
/* Skip the hunk where hunkptr points to. */
/* Return first word of next hunk. */
{
  uint32_t type,n;

  switch (type = read32be(hi->hunkptr) & 0x3fffffff) {
    case HUNK_UNIT:
    case HUNK_NAME:
    case HUNK_CODE:
    case HUNK_DATA:
    case HUNK_DEBUG:
    case HUNK_LIB:
    case HUNK_INDEX:
    case HUNK_PPC_CODE: /* EHF */
      movehunkptr32(hi,read32be(hi->hunkptr+4)+2);
      break;

    case HUNK_BSS:
      movehunkptr32(hi,2);  /* skip size specifier */
      break;

    case HUNK_ABSRELOC32:
    case HUNK_RELRELOC16:
    case HUNK_RELRELOC8:
    case HUNK_RELRELOC32:
    case HUNK_ABSRELOC16:
    case HUNK_DREL32:
    case HUNK_DREL16:
    case HUNK_DREL8:
    case HUNK_RELRELOC26: /* EHF */
      if (!(type==HUNK_DREL32 && hi->exec)) {
        nextword32(hi);
        while (n = nextword32(hi))
          movehunkptr32(hi,n+1);
        break;
      }
      /* else, fall through to HUNK_RELOC32SHORT */

    case HUNK_RELOC32SHORT:
      nextword32(hi);
      while (n = (uint32_t)nextword16(hi))
        movehunkptr16(hi,n+1);
      alignhunkptr(hi);
      break;

    case HUNK_EXT:
    case HUNK_SYMBOL:
      nextword32(hi);
      while (n = nextword32(hi)) {
        if (n & 0x80000000) {  /* external reference */
          movehunkptr32(hi,n & 0xffffff);
          if ((n>>24)==EXT_ABSCOMMON || (n>>24)==EXT_RELCOMMON ||
              ((n>>24)>=EXT_DEXT32COMMON && (n>>24)<=EXT_DEXT8COMMON)) {
            nextword32(hi);  /* size of common area */
          }
          movehunkptr32(hi,nextword32(hi));  /* skip reference offsets */
        }
        else
          movehunkptr32(hi,(n&0xffffff)+1);  /* skip xdef-value */
      }
      break;

    case HUNK_HEADER:
      nextword32(hi);
      movehunkptr32(hi,nextword32(hi)+2);
      n = nextword32(hi);  /* first root hunk index */
      n = nextword32(hi) - n + 1;  /* number of size specifiers */
      while (n--) {
        if ((nextword32(hi) & 0xc0000000) == 0xc0000000)
        nextword32(hi);
      }
      break;

    case HUNK_OVERLAY:
      movehunkptr32(hi,read32be(hi->hunkptr+4)+3); /* @@@ I'm not sure...*/
      break;

    case HUNK_END:
    case HUNK_BREAK:
      nextword32(hi);
      break;

    default:
      error(13,hi->filename);  /* File format corrupted */
      break;
  }

  /* return next 32-bit word */
  return (testword32(hi));
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x30(%rsp)
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rdi
callq 0x7a00
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
movl %eax, 0x24(%rsp)
movl %eax, 0x2c(%rsp)
addl $0xfffffc19, %eax       # imm = 0xFFFFFC19
subl $0x4, %eax
jb 0x1ccc4
jmp 0x1cbd4
movl 0x24(%rsp), %eax
subl $0x3eb, %eax            # imm = 0x3EB
je 0x1ccf4
jmp 0x1cbe5
movl 0x24(%rsp), %eax
addl $0xfffffc14, %eax       # imm = 0xFFFFFC14
subl $0x3, %eax
jb 0x1cd08
jmp 0x1cbf9
movl 0x24(%rsp), %eax
addl $0xfffffc11, %eax       # imm = 0xFFFFFC11
subl $0x2, %eax
jb 0x1cd96
jmp 0x1cc0d
movl 0x24(%rsp), %eax
subl $0x3f1, %eax            # imm = 0x3F1
je 0x1ccc4
jmp 0x1cc1e
movl 0x24(%rsp), %eax
subl $0x3f2, %eax            # imm = 0x3F2
je 0x1cf0f
jmp 0x1cc2f
movl 0x24(%rsp), %eax
subl $0x3f3, %eax            # imm = 0x3F3
je 0x1ce5e
jmp 0x1cc40
movl 0x24(%rsp), %eax
subl $0x3f5, %eax            # imm = 0x3F5
je 0x1cee4
jmp 0x1cc51
movl 0x24(%rsp), %eax
subl $0x3f6, %eax            # imm = 0x3F6
je 0x1cf0f
jmp 0x1cc62
movl 0x24(%rsp), %eax
addl $0xfffffc09, %eax       # imm = 0xFFFFFC09
subl $0x3, %eax
jb 0x1cd08
jmp 0x1cc76
movl 0x24(%rsp), %eax
addl $0xfffffc06, %eax       # imm = 0xFFFFFC06
subl $0x2, %eax
jb 0x1ccc4
jmp 0x1cc86
movl 0x24(%rsp), %eax
subl $0x3fc, %eax            # imm = 0x3FC
je 0x1cd54
jmp 0x1cc97
movl 0x24(%rsp), %eax
addl $0xfffffc03, %eax       # imm = 0xFFFFFC03
subl $0x2, %eax
jb 0x1cd08
jmp 0x1cca7
movl 0x24(%rsp), %eax
subl $0x4e9, %eax            # imm = 0x4E9
je 0x1ccc4
jmp 0x1ccb4
movl 0x24(%rsp), %eax
subl $0x4ec, %eax            # imm = 0x4EC
je 0x1cd08
jmp 0x1cf1b
movq 0x30(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rdi
addq $0x4, %rdi
callq 0x7a00
movq 0x18(%rsp), %rdi
movl %eax, %esi
addl $0x2, %esi
callq 0x1cf40
jmp 0x1cf30
movq 0x30(%rsp), %rdi
movl $0x2, %esi
callq 0x1cf40
jmp 0x1cf30
cmpl $0x3f7, 0x2c(%rsp)      # imm = 0x3F7
jne 0x1cd1d
movq 0x30(%rsp), %rax
cmpl $0x0, 0x20(%rax)
jne 0x1cd52
movq 0x30(%rsp), %rdi
callq 0x1cfa0
movq 0x30(%rsp), %rdi
callq 0x1cfa0
movl %eax, 0x28(%rsp)
cmpl $0x0, %eax
je 0x1cd4d
movq 0x30(%rsp), %rdi
movl 0x28(%rsp), %esi
addl $0x1, %esi
callq 0x1cf40
jmp 0x1cd27
jmp 0x1cf30
jmp 0x1cd54
movq 0x30(%rsp), %rdi
callq 0x1cfa0
movq 0x30(%rsp), %rdi
callq 0x1d010
movzwl %ax, %eax
movl %eax, 0x28(%rsp)
cmpl $0x0, %eax
je 0x1cd87
movq 0x30(%rsp), %rdi
movl 0x28(%rsp), %esi
addl $0x1, %esi
callq 0x1d080
jmp 0x1cd5e
movq 0x30(%rsp), %rdi
callq 0x1d0e0
jmp 0x1cf30
movq 0x30(%rsp), %rdi
callq 0x1cfa0
movq 0x30(%rsp), %rdi
callq 0x1cfa0
movl %eax, 0x28(%rsp)
cmpl $0x0, %eax
je 0x1ce59
movl 0x28(%rsp), %eax
andl $0x80000000, %eax       # imm = 0x80000000
cmpl $0x0, %eax
je 0x1ce3d
movq 0x30(%rsp), %rdi
movl 0x28(%rsp), %esi
andl $0xffffff, %esi         # imm = 0xFFFFFF
callq 0x1cf40
movl 0x28(%rsp), %eax
shrl $0x18, %eax
cmpl $0x82, %eax
je 0x1ce11
movl 0x28(%rsp), %eax
shrl $0x18, %eax
cmpl $0x89, %eax
je 0x1ce11
movl 0x28(%rsp), %eax
shrl $0x18, %eax
cmpl $0xd0, %eax
jb 0x1ce1b
movl 0x28(%rsp), %eax
shrl $0x18, %eax
cmpl $0xd2, %eax
ja 0x1ce1b
movq 0x30(%rsp), %rdi
callq 0x1cfa0
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movq 0x30(%rsp), %rdi
callq 0x1cfa0
movq 0x10(%rsp), %rdi
movl %eax, %esi
callq 0x1cf40
jmp 0x1ce54
movq 0x30(%rsp), %rdi
movl 0x28(%rsp), %esi
andl $0xffffff, %esi         # imm = 0xFFFFFF
addl $0x1, %esi
callq 0x1cf40
jmp 0x1cda0
jmp 0x1cf30
movq 0x30(%rsp), %rdi
callq 0x1cfa0
movq 0x30(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x30(%rsp), %rdi
callq 0x1cfa0
movq 0x8(%rsp), %rdi
movl %eax, %esi
addl $0x2, %esi
callq 0x1cf40
movq 0x30(%rsp), %rdi
callq 0x1cfa0
movl %eax, 0x28(%rsp)
movq 0x30(%rsp), %rdi
callq 0x1cfa0
subl 0x28(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28(%rsp)
movl 0x28(%rsp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, 0x28(%rsp)
cmpl $0x0, %eax
je 0x1cee2
movq 0x30(%rsp), %rdi
callq 0x1cfa0
andl $0xc0000000, %eax       # imm = 0xC0000000
cmpl $0xc0000000, %eax       # imm = 0xC0000000
jne 0x1cee0
movq 0x30(%rsp), %rdi
callq 0x1cfa0
jmp 0x1ceae
jmp 0x1cf30
movq 0x30(%rsp), %rax
movq %rax, (%rsp)
movq 0x30(%rsp), %rax
movq 0x8(%rax), %rdi
addq $0x4, %rdi
callq 0x7a00
movq (%rsp), %rdi
movl %eax, %esi
addl $0x3, %esi
callq 0x1cf40
jmp 0x1cf30
movq 0x30(%rsp), %rdi
callq 0x1cfa0
jmp 0x1cf30
movq 0x30(%rsp), %rax
movq 0x18(%rax), %rsi
movl $0xd, %edi
movb $0x0, %al
callq 0x8c00
movq 0x30(%rsp), %rdi
callq 0x1d120
addq $0x38, %rsp
retq
nop