// File: /workspace/github_c_makefile_star2_O0/deplinenoise[P]vlink/t_aout.c
// Function: aout_symconvert
static void aout_symconvert(struct GlobalVars *gv,struct Symbol *sym,
                            uint8_t symbind,uint8_t syminfo,
                            struct LinkedSection **ls,int sec,int be)
/* convert vlink symbol into a.out symbol(s) */
{
  uint32_t val = (uint32_t)sym->value;
  uint32_t size = sym->size;
  uint8_t ext = (symbind == BIND_GLOBAL) ? N_EXT : 0;
  uint8_t type = 0;

  if (sym->info == SYMI_SECTION) {
    return;   /* section symbols are ignored in a.out! */
  }
  else if (sym->info == SYMI_FILE) {
    type = N_FN | N_EXT;  /* special case: file name symbol */
    size = 0;
  }
  else {
    if (symbind == BIND_WEAK) {
      switch (sym->type) {
        case SYM_ABS:
          type = N_WEAKA;
          break;
        case SYM_RELOC:
          type = weaktype[sec];
          break;
        default:
          ierror("aout_symconvert(): Illegal weak symbol type: %d",
                 (int)sym->type);
          break;
      }
    }
    else {
      switch (sym->type) {
        case SYM_ABS:
          type = N_ABS | ext;
          break;
        case SYM_RELOC:
          type = sectype[sec] | ext;
          break;
        case SYM_COMMON:
          #if 0 /* GNU binutils prefers N_UNDF with value!=0 instead of N_COMM! */
          type = N_COMM | ext;
          #else
          type = N_UNDF | N_EXT;
          #endif
          val = sym->size;
          size = 0;
          break;
        case SYM_INDIR:
          aout_addsym(sym->name,0,symbind,0,N_INDR|ext,0,be);
          aout_addsym(sym->indir_name,0,0,0,N_UNDF|N_EXT,0,be);
          return;
        default:
          ierror("aout_symconvert(): Illegal symbol type: %d",(int)sym->type);
          break;
      }
    }
  }

  aout_addsym(sym->name,val,symbind,syminfo,type,0,be);
  if (size) {
    /* append N_SIZE symbol declaring the previous symbol's size */
    aout_addsym(sym->name,size,symbind,syminfo,N_SIZE,0,be);
  }
}

// Assembly:
subq $0x48, %rsp
movb %cl, %al
movb %dl, %cl
movl 0x50(%rsp), %edx
movq %rdi, 0x40(%rsp)
movq %rsi, 0x38(%rsp)
movb %cl, 0x37(%rsp)
movb %al, 0x36(%rsp)
movq %r8, 0x28(%rsp)
movl %r9d, 0x24(%rsp)
movq 0x38(%rsp), %rax
movq 0x30(%rax), %rax
movl %eax, 0x20(%rsp)
movq 0x38(%rsp), %rax
movl 0x44(%rax), %eax
movl %eax, 0x1c(%rsp)
movzbl 0x37(%rsp), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x1, %edx
cmovel %ecx, %eax
movb %al, 0x1b(%rsp)
movb $0x0, 0x1a(%rsp)
movq 0x38(%rsp), %rax
movzbl 0x42(%rax), %eax
cmpl $0x3, %eax
jne 0x2d40f
jmp 0x2d5f3
movq 0x38(%rsp), %rax
movzbl 0x42(%rax), %eax
cmpl $0x4, %eax
jne 0x2d42f
movb $0x1f, 0x1a(%rsp)
movl $0x0, 0x1c(%rsp)
jmp 0x2d587
movzbl 0x37(%rsp), %eax
cmpl $0x2, %eax
jne 0x2d490
movq 0x38(%rsp), %rax
movzbl 0x40(%rax), %eax
movl %eax, 0x14(%rsp)
subl $0x1, %eax
je 0x2d458
jmp 0x2d44d
movl 0x14(%rsp), %eax
subl $0x2, %eax
je 0x2d45f
jmp 0x2d474
movb $0xe, 0x1a(%rsp)
jmp 0x2d48b
movslq 0x24(%rsp), %rcx
leaq 0x13dd0(%rip), %rax     # 0x4123b
movb (%rax,%rcx), %al
movb %al, 0x1a(%rsp)
jmp 0x2d48b
movq 0x38(%rsp), %rax
movzbl 0x40(%rax), %esi
leaq 0x9cfd(%rip), %rdi      # 0x37181
movb $0x0, %al
callq 0x8ae0
jmp 0x2d585
movq 0x38(%rsp), %rax
movzbl 0x40(%rax), %eax
decl %eax
movl %eax, %ecx
movq %rcx, 0x8(%rsp)
subl $0x3, %eax
ja 0x2d56c
movq 0x8(%rsp), %rax
leaq 0x9a2d(%rip), %rcx      # 0x36ee4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movzbl 0x1b(%rsp), %eax
orl $0x2, %eax
movb %al, 0x1a(%rsp)
jmp 0x2d583
movslq 0x24(%rsp), %rcx
leaq 0x13d5b(%rip), %rax     # 0x41238
movzbl (%rax,%rcx), %eax
movzbl 0x1b(%rsp), %ecx
orl %ecx, %eax
movb %al, 0x1a(%rsp)
jmp 0x2d583
movb $0x1, 0x1a(%rsp)
movq 0x38(%rsp), %rax
movl 0x44(%rax), %eax
movl %eax, 0x20(%rsp)
movl $0x0, 0x1c(%rsp)
jmp 0x2d583
movq 0x38(%rsp), %rax
movq 0x20(%rax), %rdi
movb 0x37(%rsp), %cl
movzbl 0x1b(%rsp), %eax
orl $0xa, %eax
movb %al, %r8b
movl 0x50(%rsp), %eax
xorl %r9d, %r9d
movl %r9d, %esi
movzbl %cl, %edx
movl %r9d, %ecx
movzbl %r8b, %r8d
movl %eax, (%rsp)
callq 0x2d6e0
movq 0x38(%rsp), %rax
movq 0x28(%rax), %rdi
movl 0x50(%rsp), %eax
xorl %r9d, %r9d
movl $0x1, %r8d
movl %r9d, %esi
movl %r9d, %edx
movl %r9d, %ecx
movl %eax, (%rsp)
callq 0x2d6e0
jmp 0x2d5f3
movq 0x38(%rsp), %rax
movzbl 0x40(%rax), %esi
leaq 0x9c35(%rip), %rdi      # 0x371b1
movb $0x0, %al
callq 0x8ae0
jmp 0x2d585
jmp 0x2d587
jmp 0x2d589
movq 0x38(%rsp), %rax
movq 0x20(%rax), %rdi
movl 0x20(%rsp), %esi
movb 0x37(%rsp), %dl
movb 0x36(%rsp), %cl
movb 0x1a(%rsp), %r8b
movl 0x50(%rsp), %eax
xorl %r9d, %r9d
movzbl %dl, %edx
movzbl %cl, %ecx
movzbl %r8b, %r8d
movl %eax, (%rsp)
callq 0x2d6e0
cmpl $0x0, 0x1c(%rsp)
je 0x2d5f3
movq 0x38(%rsp), %rax
movq 0x20(%rax), %rdi
movl 0x1c(%rsp), %esi
movb 0x37(%rsp), %dl
movb 0x36(%rsp), %cl
movl 0x50(%rsp), %eax
movl $0xc, %r8d
xorl %r9d, %r9d
movzbl %dl, %edx
movzbl %cl, %ecx
movl %eax, (%rsp)
callq 0x2d6e0
addq $0x48, %rsp
retq
nopl (%rax,%rax)