// File: /workspace/github_c_makefile_star2_O0/deplinenoise[P]vlink/t_elf32arm.c
// Function: armle_reloc_vlink2elf
static uint8_t armle_reloc_vlink2elf(struct Reloc *r)
/* Try to map vlink-internal representation to a valid ELF reloc type */
{
  struct RelocInsert *ri;

  if (ri = r->insert) {
    int pos = (int)ri->bpos;
    int size = (int)ri->bsiz;
    lword mask = ri->mask;
    struct RelocInsert *ri2 = ri->next;

    switch (r->rtype) {
      case R_ABS:
        if (!(pos&7) && mask==-1 && !ri2) {
          switch (size) {
            case 32: return R_ARM_ABS32;
            case 16: return R_ARM_ABS16;
            case 8: return R_ARM_ABS8;
          }
        }
        else if (size==24 && (pos&31)==8 && mask==0xffffff && !ri2)
          return R_ARM_SWI24; /* @@@ obsolete */
        else if (size==12 && (pos&31)==20 && mask==0xfff && !ri2)
          return R_ARM_ABS12;
        else if (size==8 && (pos&15)==8 && mask==0xff && !ri2)
          return R_ARM_THM_SWI8; /* @@@ obsolete */
        else if (size==5 && (pos&15)==5 && mask==0x1f && !ri2)
          return R_ARM_THM_ABS5;
        break;

      case R_PC:
        if (size==32 && !(pos&7) && mask==-1 && !ri2)
          return R_ARM_REL32;
        else if (size==24 && (pos&31)==8 && mask==0x3fffffc && !ri2)
          return R_ARM_PC24;  /* @@@ deprecated: use R_ARM_CALL/JUMP24!!! */
        else if (size==12 && (pos&31)==20 && mask==0x1fff && !ri2)
          return R_ARM_LDR_PC_G0;
        else if (size==8 && (pos&31)==24 && mask==0xff && !ri2)
          return R_ARM_ALU_PCREL_7_0;  /* @@@ obsolete */
        else if (size==8 && (pos&31)==24 && mask==0xff00 && !ri2)
          return R_ARM_ALU_PCREL_15_8;  /* @@@ obsolete */
        else if (size==8 && (pos&31)==24 && mask==0xff0000 && !ri2)
          return R_ARM_ALU_PCREL_23_15;  /* @@@ obsolete */
        else if (size==8 && (pos&15)==8 && mask==0x3fc && !ri2)
          return R_ARM_THM_PC8;
        else if (size==11 && (pos&15)==5 && ri2) {
          if (ri2->bsiz==11 && (ri2->bpos&15)==5) {
            if ((mask==0x7ff000 && ri2->mask==0xffe) ||
                (mask==0xffe && ri2->mask==0x7ff000))
              return R_ARM_THM_CALL;
          }
        }
        break;
    }
  }

  return R_NONE;
}

// Assembly:
movq %rdi, -0x10(%rsp)
movq -0x10(%rsp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x18(%rsp)
cmpq $0x0, %rax
je 0x2abbe
movq -0x18(%rsp), %rax
movzwl 0x8(%rax), %eax
movl %eax, -0x1c(%rsp)
movq -0x18(%rsp), %rax
movzwl 0xa(%rax), %eax
movl %eax, -0x20(%rsp)
movq -0x18(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x28(%rsp)
movq -0x18(%rsp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rsp)
movq -0x10(%rsp), %rax
movzbl 0x38(%rax), %eax
movl %eax, -0x34(%rsp)
subl $0x1, %eax
je 0x2a8b8
jmp 0x2a8a6
movl -0x34(%rsp), %eax
subl $0x2, %eax
je 0x2a9e6
jmp 0x2abbc
movl -0x1c(%rsp), %eax
andl $0x7, %eax
cmpl $0x0, %eax
jne 0x2a91c
cmpq $-0x1, -0x28(%rsp)
jne 0x2a91c
cmpq $0x0, -0x30(%rsp)
jne 0x2a91c
movl -0x20(%rsp), %eax
movl %eax, -0x38(%rsp)
subl $0x8, %eax
je 0x2a90d
jmp 0x2a8e3
movl -0x38(%rsp), %eax
subl $0x10, %eax
je 0x2a903
jmp 0x2a8ee
movl -0x38(%rsp), %eax
subl $0x20, %eax
jne 0x2a917
jmp 0x2a8f9
movb $0x2, -0x1(%rsp)
jmp 0x2abc3
movb $0x5, -0x1(%rsp)
jmp 0x2abc3
movb $0x8, -0x1(%rsp)
jmp 0x2abc3
jmp 0x2a9e1
cmpl $0x18, -0x20(%rsp)
jne 0x2a94c
movl -0x1c(%rsp), %eax
andl $0x1f, %eax
cmpl $0x8, %eax
jne 0x2a94c
cmpq $0xffffff, -0x28(%rsp)  # imm = 0xFFFFFF
jne 0x2a94c
cmpq $0x0, -0x30(%rsp)
jne 0x2a94c
movb $0xd, -0x1(%rsp)
jmp 0x2abc3
cmpl $0xc, -0x20(%rsp)
jne 0x2a97c
movl -0x1c(%rsp), %eax
andl $0x1f, %eax
cmpl $0x14, %eax
jne 0x2a97c
cmpq $0xfff, -0x28(%rsp)     # imm = 0xFFF
jne 0x2a97c
cmpq $0x0, -0x30(%rsp)
jne 0x2a97c
movb $0x6, -0x1(%rsp)
jmp 0x2abc3
cmpl $0x8, -0x20(%rsp)
jne 0x2a9ac
movl -0x1c(%rsp), %eax
andl $0xf, %eax
cmpl $0x8, %eax
jne 0x2a9ac
cmpq $0xff, -0x28(%rsp)
jne 0x2a9ac
cmpq $0x0, -0x30(%rsp)
jne 0x2a9ac
movb $0xe, -0x1(%rsp)
jmp 0x2abc3
cmpl $0x5, -0x20(%rsp)
jne 0x2a9d9
movl -0x1c(%rsp), %eax
andl $0xf, %eax
cmpl $0x5, %eax
jne 0x2a9d9
cmpq $0x1f, -0x28(%rsp)
jne 0x2a9d9
cmpq $0x0, -0x30(%rsp)
jne 0x2a9d9
movb $0x7, -0x1(%rsp)
jmp 0x2abc3
jmp 0x2a9db
jmp 0x2a9dd
jmp 0x2a9df
jmp 0x2a9e1
jmp 0x2abbc
cmpl $0x20, -0x20(%rsp)
jne 0x2aa13
movl -0x1c(%rsp), %eax
andl $0x7, %eax
cmpl $0x0, %eax
jne 0x2aa13
cmpq $-0x1, -0x28(%rsp)
jne 0x2aa13
cmpq $0x0, -0x30(%rsp)
jne 0x2aa13
movb $0x3, -0x1(%rsp)
jmp 0x2abc3
cmpl $0x18, -0x20(%rsp)
jne 0x2aa43
movl -0x1c(%rsp), %eax
andl $0x1f, %eax
cmpl $0x8, %eax
jne 0x2aa43
cmpq $0x3fffffc, -0x28(%rsp) # imm = 0x3FFFFFC
jne 0x2aa43
cmpq $0x0, -0x30(%rsp)
jne 0x2aa43
movb $0x1, -0x1(%rsp)
jmp 0x2abc3
cmpl $0xc, -0x20(%rsp)
jne 0x2aa73
movl -0x1c(%rsp), %eax
andl $0x1f, %eax
cmpl $0x14, %eax
jne 0x2aa73
cmpq $0x1fff, -0x28(%rsp)    # imm = 0x1FFF
jne 0x2aa73
cmpq $0x0, -0x30(%rsp)
jne 0x2aa73
movb $0x4, -0x1(%rsp)
jmp 0x2abc3
cmpl $0x8, -0x20(%rsp)
jne 0x2aaa3
movl -0x1c(%rsp), %eax
andl $0x1f, %eax
cmpl $0x18, %eax
jne 0x2aaa3
cmpq $0xff, -0x28(%rsp)
jne 0x2aaa3
cmpq $0x0, -0x30(%rsp)
jne 0x2aaa3
movb $0x20, -0x1(%rsp)
jmp 0x2abc3
cmpl $0x8, -0x20(%rsp)
jne 0x2aad3
movl -0x1c(%rsp), %eax
andl $0x1f, %eax
cmpl $0x18, %eax
jne 0x2aad3
cmpq $0xff00, -0x28(%rsp)    # imm = 0xFF00
jne 0x2aad3
cmpq $0x0, -0x30(%rsp)
jne 0x2aad3
movb $0x21, -0x1(%rsp)
jmp 0x2abc3
cmpl $0x8, -0x20(%rsp)
jne 0x2ab03
movl -0x1c(%rsp), %eax
andl $0x1f, %eax
cmpl $0x18, %eax
jne 0x2ab03
cmpq $0xff0000, -0x28(%rsp)  # imm = 0xFF0000
jne 0x2ab03
cmpq $0x0, -0x30(%rsp)
jne 0x2ab03
movb $0x22, -0x1(%rsp)
jmp 0x2abc3
cmpl $0x8, -0x20(%rsp)
jne 0x2ab33
movl -0x1c(%rsp), %eax
andl $0xf, %eax
cmpl $0x8, %eax
jne 0x2ab33
cmpq $0x3fc, -0x28(%rsp)     # imm = 0x3FC
jne 0x2ab33
cmpq $0x0, -0x30(%rsp)
jne 0x2ab33
movb $0xb, -0x1(%rsp)
jmp 0x2abc3
cmpl $0xb, -0x20(%rsp)
jne 0x2abac
movl -0x1c(%rsp), %eax
andl $0xf, %eax
cmpl $0x5, %eax
jne 0x2abac
cmpq $0x0, -0x30(%rsp)
je 0x2abac
movq -0x30(%rsp), %rax
movzwl 0xa(%rax), %eax
cmpl $0xb, %eax
jne 0x2abaa
movq -0x30(%rsp), %rax
movzwl 0x8(%rax), %eax
andl $0xf, %eax
cmpl $0x5, %eax
jne 0x2abaa
cmpq $0x7ff000, -0x28(%rsp)  # imm = 0x7FF000
jne 0x2ab87
movq -0x30(%rsp), %rax
cmpq $0xffe, 0x10(%rax)      # imm = 0xFFE
je 0x2aba1
cmpq $0xffe, -0x28(%rsp)     # imm = 0xFFE
jne 0x2aba8
movq -0x30(%rsp), %rax
cmpq $0x7ff000, 0x10(%rax)   # imm = 0x7FF000
jne 0x2aba8
movb $0xa, -0x1(%rsp)
jmp 0x2abc3
jmp 0x2abaa
jmp 0x2abac
jmp 0x2abae
jmp 0x2abb0
jmp 0x2abb2
jmp 0x2abb4
jmp 0x2abb6
jmp 0x2abb8
jmp 0x2abba
jmp 0x2abbc
jmp 0x2abbe
movb $0x0, -0x1(%rsp)
movb -0x1(%rsp), %al
retq
nopl (%rax,%rax)