// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/ldscript.c
// Function: init_ld_script
void init_ld_script(struct GlobalVars *gv)
{
  char c;

  if (!gv->dest_object) {
    scriptbase = gv->ldscript ? gv->ldscript :
                                fff[gv->dest_format]->exeldscript;
  }
  else if (gv->dest_sharedobj) {
    scriptbase = gv->ldscript ? gv->ldscript :
                                fff[gv->dest_format]->soldscript;
  }

  if (scriptbase) {
    bool secdef = FALSE;
    char *keyword;

    /* initialization */
    preparse = TRUE;
    current_ls = NULL;
    level = 0; /* outside SECTIONS block */
    defmem = vdefmem = ldefmem = add_memblock(defmemname,MEM_DEFORG,MEM_DEFLEN);
    atdefmem = add_memblock("lmadefault",MEM_DEFORG,MEM_DEFLEN);
    change_address(defmem,gv->start_addr);
    if (!(scriptname = gv->scriptname))
      scriptname = "built-in script";
    script_obj = make_ld_objunit(gv);

    /* pre-parse script: get memory-regions and symbol definitions */
    init_parser(gv,scriptname,scriptbase,1);

    do {
      while (keyword = getword()) {

        if (!strcmp(keyword,"MEMORY")) {
          gv->use_ldscript = TRUE;
          if (secdef == FALSE) {
            define_memory(gv);
          }
          else {
            /* MEMORY behind SECTIONS ignored */
            error(100,scriptname,getlineno(),keyword);
            skipblock(0,'{','}');
          }
        }

        else if (!strcmp(keyword,"PHDRS")) {
          gv->use_ldscript = TRUE;
          if (secdef == FALSE) {
            define_phdrs(gv);
          }
          else {
            /* PHDRS behind SECTIONS ignored */
            error(100,scriptname,getlineno(),keyword);
            skipblock(0,'{','}');
          }
        }

        else if (!strcmp(keyword,"SECTIONS")) {
          gv->use_ldscript = TRUE;
          if (secdef)
            error(74,scriptname,getlineno());  /* SECTIONS block def. twice */
          else
            secdef = TRUE;

          /* Define default PHDRs */
          if (gv->phdrlist == NULL) {
            add_phdr(gv,deftxt,PT_LOAD,PHDR_FLAGS|PF_X|PF_R,
                     ADDR_NONE,defmem,defmem);
            add_phdr(gv,defdat,PT_LOAD,PHDR_FLAGS|PF_R|PF_W,
                     ADDR_NONE,defmem,defmem);
          }
          level = 1;
          predefine_sections(gv);
          level = 0;
        }

        else {
          if (check_command(gv,keyword,SCMDF_GLOBAL)) {
            /* script-command executed */
            continue;
          }

          else if (getchr() == '=') {
            /* symbol assignment */
            symbol_assignment(gv,keyword,0);
          }

          else {
            /* unknown keyword ignored */
            error(65,scriptname,getlineno(),keyword);
            back(1);
          }
        }
      }
    }
    while ((c = getchr()) == ';');

    if (c) {
      back(1);
      error(78,scriptname,getlineno());   /* missing argument */
    }
    preparse = FALSE;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movq %rdi, %rbx
cmpl $0x0, 0x54(%rdi)
je 0xe3d9
cmpl $0x0, 0x58(%rbx)
je 0xe401
movq 0xc8(%rbx), %rax
testq %rax, %rax
jne 0xe3f8
movzbl 0x50(%rbx), %eax
leaq 0x20dc1(%rip), %rcx     # 0x2f190
movq (%rcx,%rax,8), %rax
movq 0x10(%rax), %rax
jmp 0xe3f8
movq 0xc8(%rbx), %rax
testq %rax, %rax
jne 0xe3f8
movzbl 0x50(%rbx), %eax
leaq 0x20da0(%rip), %rcx     # 0x2f190
movq (%rcx,%rax,8), %rax
movq 0x8(%rax), %rax
movq %rax, 0x25649(%rip)     # 0x33a48
jmp 0xe408
movq 0x25640(%rip), %rax     # 0x33a48
testq %rax, %rax
je 0xede7
andq $0x0, 0x255df(%rip)     # 0x339f8
movb $0x1, 0x25630(%rip)     # 0x33a50
andl $0x0, 0x255e5(%rip)     # 0x33a0c
leaq 0x12798(%rip), %rdi     # 0x20bc6
movabsq $0x7fffffffffffffff, %r14 # imm = 0x7FFFFFFFFFFFFFFF
xorl %esi, %esi
movq %r14, %rdx
callq 0xe2fc
movq %rax, 0x255e7(%rip)     # 0x33a30
movq %rax, 0x255d8(%rip)     # 0x33a28
movq %rax, 0x255c9(%rip)     # 0x33a20
leaq 0x12765(%rip), %rdi     # 0x20bc3
xorl %esi, %esi
movq %r14, %rdx
callq 0xe2fc
movq %rax, 0x255e9(%rip)     # 0x33a58
movq 0x255aa(%rip), %rdi     # 0x33a20
movq 0xd8(%rbx), %rsi
callq 0xe2bb
movq 0xc0(%rbx), %rax
testq %rax, %rax
leaq 0x1273b(%rip), %rcx     # 0x20bce
cmovneq %rax, %rcx
movq %rcx, 0x25572(%rip)     # 0x33a10
leaq 0x1285b(%rip), %rdx     # 0x20d00
leaq 0x50(%rsp), %r14
movl $0x100, %esi            # imm = 0x100
movq %r14, %rdi
xorl %eax, %eax
callq 0x5100
movq %r14, %rdi
callq 0x63a1
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xb906
movq %rax, %r14
testq %rax, %rax
je 0xe4f1
orw $0x8001, 0x80(%r14)     # imm = 0x8001
leaq 0x138(%rbx), %rdi
movq %r14, %rsi
callq 0x63fe
movq %r14, 0x25568(%rip)     # 0x33a60
movq 0x25511(%rip), %rsi     # 0x33a10
movq 0x25542(%rip), %rdx     # 0x33a48
pushq $0x1
popq %rcx
movq %rbx, %rdi
callq 0xf911
leaq 0x1f8(%rbx), %rax
movq %rax, 0x30(%rsp)
leaq 0x126ba(%rip), %r14     # 0x20bde
leaq 0x126ba(%rip), %r15     # 0x20be5
xorl %r13d, %r13d
callq 0xe109
testq %rax, %rax
je 0xe59e
movq %rax, %rbp
movq %rax, %rdi
movq %r14, %rsi
callq 0x5160
testl %eax, %eax
je 0xe5ac
movq %rbp, %rdi
movq %r15, %rsi
callq 0x5160
testl %eax, %eax
je 0xe5c0
movq %rbp, %rdi
leaq 0x1146b(%rip), %rsi     # 0x1f9ce
callq 0x5160
testl %eax, %eax
je 0xe607
movq %rbx, %rdi
movq %rbp, %rsi
pushq $0x2
popq %rdx
callq 0xd0f3
testl %eax, %eax
jne 0xe52e
callq 0xf457
cmpb $0x3d, %al
jne 0xea41
movq %rbx, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0xd9e1
jmp 0xe52e
callq 0xf457
cmpb $0x3b, %al
je 0xe52e
jmp 0xedb6
movl $0x1, 0x244(%rbx)
testl %r13d, %r13d
jne 0xe5d3
jmp 0xea6c
movl $0x1, 0x244(%rbx)
testl %r13d, %r13d
je 0xeb2d
movq 0x25436(%rip), %r12     # 0x33a10
callq 0xf90a
pushq $0x64
popq %rdi
movq %r12, %rsi
movl %eax, %edx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x6c19
xorl %edi, %edi
pushq $0x7b
popq %rsi
pushq $0x7d
popq %rdx
callq 0xf476
pushq $0x1
popq %r13
jmp 0xe52e
movl $0x1, 0x244(%rbx)
testl %r13d, %r13d
je 0xe631
movq 0x253f3(%rip), %r12     # 0x33a10
callq 0xf90a
pushq $0x4a
popq %rdi
movq %r12, %rsi
movl %eax, %edx
xorl %eax, %eax
callq 0x6c19
movq 0x30(%rsp), %rax
cmpq $0x0, (%rax)
pushq $0x1
popq %r13
jne 0xe68a
movq 0x253d9(%rip), %r9      # 0x33a20
movq %r9, (%rsp)
movq %rbx, %rdi
leaq 0x15e23(%rip), %rsi     # 0x24478
movl %r13d, %edx
pushq $0x45
popq %rcx
pushq $-0x1
popq %r12
movq %r12, %r8
callq 0xedf9
movq 0x253b2(%rip), %r9      # 0x33a20
movq %r9, (%rsp)
movq %rbx, %rdi
leaq 0x12653(%rip), %rsi     # 0x20ccf
movl %r13d, %edx
pushq $0x46
popq %rcx
movq %r12, %r8
callq 0xedf9
movl $0x1, 0x25378(%rip)     # 0x33a0c
pushq $0x7b
popq %rdi
callq 0xef1d
testl %eax, %eax
je 0xea35
callq 0xf3c4
callq 0xf4b7
movq %rax, 0x25383(%rip)     # 0x33a38
callq 0xf90a
movl %eax, 0x25380(%rip)     # 0x33a40
movq $0x0, 0x10(%rsp)
callq 0xe109
testq %rax, %rax
je 0xe702
movq %rax, %rbp
movq %rbx, %rdi
movq %rax, %rsi
movl $0x8002, %edx           # imm = 0x8002
callq 0xd0f3
testl %eax, %eax
jne 0xe6c9
callq 0xf457
cmpb $0x3d, %al
jne 0xe710
movq %rbx, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0xd9e1
jmp 0xe6c9
callq 0xf457
cmpb $0x3b, %al
je 0xe6c9
jmp 0xea18
movl %r13d, %edi
callq 0xf4ac
movq %rbp, %rdi
callq 0x63a1
movq %rax, %r13
leaq 0x48(%rsp), %rdi
leaq 0x50(%rsp), %r12
movq %r12, %rsi
leaq 0x40(%rsp), %rdx
callq 0xe111
testl %eax, %eax
je 0xe906
movl %eax, %ebp
movq %rbx, %rdi
movq %r13, 0x20(%rsp)
movq %r13, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0xbcdb
movq %rax, %r13
movq %r12, %rdi
leaq 0x125c4(%rip), %rsi     # 0x20d2f
pushq $0x7
popq %rdx
callq 0x51f0
movq %r13, %rcx
testl %eax, %eax
jne 0xe77e
orb $0x1, 0x24(%rcx)
cmpl $0x4, %ebp
pushq $0x1
popq %r13
jb 0xe792
movq 0x252ca(%rip), %rax     # 0x33a58
movq %rax, 0x28(%rcx)
movq %rcx, 0x18(%rsp)
movq 0x18(%rcx), %rax
movq %rax, 0x252c6(%rip)     # 0x33a68
movl $0x2, 0x25260(%rip)     # 0x33a0c
movq $0x0, 0x28(%rsp)
callq 0xd0eb
testq %rax, %rax
je 0xe80f
movq %rax, %rbp
movq %rbx, %rdi
movq %rax, %rsi
movl $0x8002, %edx           # imm = 0x8002
callq 0xd0f3
testl %eax, %eax
jne 0xe7b5
callq 0xf457
cmpb $0x3d, %al
je 0xe81a
movzbl %al, %eax
cmpl $0x28, %eax
je 0xe829
movq 0x25222(%rip), %r12     # 0x33a10
callq 0xf90a
pushq $0x41
popq %rdi
movq %r12, %rsi
movl %eax, %edx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x6c19
movl %r13d, %edi
callq 0xf4ac
jmp 0xe7b5
callq 0xf457
cmpb $0x3b, %al
je 0xe7b5
jmp 0xe87a
movq %rbx, %rdi
movq %rbp, %rsi
xorl %edx, %edx
callq 0xd9e1
jmp 0xe7b5
cmpq $0x0, 0x28(%rsp)
jne 0xe867
movq 0x25228(%rip), %rdi     # 0x33a60
movq 0x20(%rsp), %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0xba41
movq %rax, %rsi
movq 0x18(%rsp), %rax
movq %rax, 0x18(%rsi)
movq 0x25207(%rip), %rdi     # 0x33a60
addq $0x20, %rdi
movq %rsi, 0x28(%rsp)
callq 0x6414
movl %r13d, %edi
pushq $0x28
popq %rsi
pushq $0x29
popq %rdx
callq 0xf476
jmp 0xe7b5
movl %r13d, %edi
callq 0xf4ac
movl $0x1, 0x25180(%rip)     # 0x33a0c
andq $0x0, 0x251d4(%rip)     # 0x33a68
movq %rbx, %rdi
movq 0x18(%rsp), %r12
movq %r12, %rsi
callq 0xdc21
testq %rax, %rax
je 0xe6c9
movq %rax, %rbp
cmpq $0x0, 0x30(%r12)
movq 0x10(%rsp), %rdi
jne 0xe8c9
movq 0x25164(%rip), %rax     # 0x33a28
movq %rax, 0x30(%r12)
cmpq $0x0, 0x28(%r12)
jne 0xe8dd
movq 0x25158(%rip), %rax     # 0x33a30
movq %rax, 0x28(%r12)
movq (%rbp), %rax
testq %rax, %rax
sete %cl
testq %rdi, %rdi
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0xe935
movq %rbp, %rdi
callq 0x5040
movq 0x10(%rsp), %rdi
movq %rdi, %rbp
jmp 0xe94d
movq %r13, %rdi
callq 0x5040
movq 0x250fb(%rip), %r12     # 0x33a10
callq 0xf90a
pushq $0x41
popq %rdi
movq %r12, %rsi
movl %eax, %edx
movq %r13, %rcx
xorl %eax, %eax
callq 0x6c19
pushq $0x1
popq %r13
jmp 0xe6c9
testq %rax, %rax
sete %cl
cmpq %rdi, %rbp
sete %dl
orb %cl, %dl
jne 0xe955
callq 0x5040
movq %rbp, %rdi
movq (%rdi), %rax
movq 0x18(%rsp), %r12
testq %rax, %rax
movq %rdi, 0x10(%rsp)
je 0xe97c
addq $0x8, %rbp
testq %rax, %rax
je 0xe6c9
cmpl $0x0, 0x20(%rax)
je 0xe976
orb $0x10, 0x24(%rax)
movq (%rbp), %rax
jmp 0xe95f
movq 0x28(%r12), %r8
movq 0x30(%r12), %rcx
movq 0x25093(%rip), %rax     # 0x33a20
movq %rcx, %rdx
xorq %rax, %rdx
movq %r8, %rsi
xorq %rcx, %rsi
movq %rbx, %rdi
orq %rdx, %rsi
jne 0xe9cf
leaq 0x15ad0(%rip), %rsi     # 0x24478
movl %r13d, %edx
movq %rax, %rcx
movq %rax, %r8
callq 0xf30b
movq 0x25063(%rip), %rcx     # 0x33a20
movq %rbx, %rdi
leaq 0x12308(%rip), %rsi     # 0x20ccf
movl %r13d, %edx
movq %rcx, %r8
jmp 0xe9d9
leaq 0x12324(%rip), %rsi     # 0x20cfa
movl %r13d, %edx
callq 0xf30b
movq 0x20(%rsp), %rdi
leaq 0x38(%rsp), %rsi
callq 0xdf3a
testw %ax, %ax
je 0xe6c9
movzwl %ax, %edx
movq 0x38(%rsp), %rsi
movq 0x18(%rsp), %rax
movq 0x28(%rax), %r8
movq 0x30(%rax), %rcx
movq %rbx, %rdi
callq 0xf30b
jmp 0xe6c9
movl %r13d, %edi
callq 0xf4ac
movq 0x10(%rsp), %rdi
callq 0x5040
pushq $0x7b
popq %rdi
pushq $0x7d
popq %rsi
callq 0xefde
andl $0x0, 0x24fd0(%rip)     # 0x33a0c
jmp 0xe52e
movq 0x24fc8(%rip), %r12     # 0x33a10
callq 0xf90a
pushq $0x41
popq %rdi
movq %r12, %rsi
movl %eax, %edx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x6c19
pushq $0x1
popq %rdi
callq 0xf4ac
jmp 0xe52e
pushq $0x7b
popq %rdi
callq 0xef1d
testl %eax, %eax
pushq $0x1
popq %r12
je 0xe52b
leaq 0x50(%rsp), %r13
callq 0xe109
testq %rax, %rax
je 0xed43
movq %r13, %rdi
movq %rax, %rsi
callq 0x5080
callq 0xf457
cmpb $0x28, %al
jne 0xeaba
movl %r12d, %edi
pushq $0x28
popq %rsi
pushq $0x29
popq %rdx
callq 0xf476
callq 0xf457
cmpb $0x3a, %al
jne 0xeaf2
leaq 0x1224e(%rip), %rdi     # 0x20d13
callq 0xf25f
movq %rax, %rbp
callq 0xf457
cmpb $0x2c, %al
jne 0xeb0a
leaq 0x1223d(%rip), %rdi     # 0x20d1a
callq 0xf25f
movq %r13, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0xe2fc
jmp 0xea85
movq 0x24f17(%rip), %rbp     # 0x33a10
callq 0xf90a
pushq $0x42
popq %rdi
movq %rbp, %rsi
movl %eax, %edx
pushq $0x3a
jmp 0xeb20
movq 0x24eff(%rip), %rbp     # 0x33a10
callq 0xf90a
pushq $0x42
popq %rdi
movq %rbp, %rsi
movl %eax, %edx
pushq $0x2c
popq %rcx
xorl %eax, %eax
callq 0x6c19
jmp 0xea85
pushq $0x7b
popq %rdi
callq 0xef1d
testl %eax, %eax
je 0xe52b
pushq $0x1
popq %r13
callq 0xe109
testq %rax, %rax
je 0xed53
leaq 0x50(%rsp), %rdi
movq %rax, %rsi
callq 0x5080
callq 0xe109
testq %rax, %rax
je 0xeb9a
movq %rax, %rbp
cmpb $0x50, (%rax)
jne 0xeb7a
cmpb $0x54, 0x1(%rbp)
jne 0xeb7a
cmpb $0x5f, 0x2(%rbp)
je 0xebc7
movq 0x24e8f(%rip), %r12     # 0x33a10
callq 0xf90a
pushq $0x63
popq %rdi
movq %r12, %rsi
movl %eax, %edx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x6c19
jmp 0xebb5
movq 0x24e6f(%rip), %r12     # 0x33a10
callq 0xf90a
pushq $0x4e
popq %rdi
movq %r12, %rsi
movl %eax, %edx
xorl %eax, %eax
callq 0x6c19
movl %r13d, %edi
xorl %esi, %esi
pushq $0x3b
popq %rdx
callq 0xf476
jmp 0xeb41
movzbl 0x3(%rbp), %eax
leal -0x49(%rax), %ecx
cmpl $0xa, %ecx
ja 0xebe7
leaq 0x11ec6(%rip), %rdx     # 0x20aa0
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
pushq $0x3
jmp 0xec1d
cmpl $0x44, %eax
jne 0xebf0
pushq $0x2
jmp 0xec1d
movq 0x24e19(%rip), %r12     # 0x33a10
callq 0xf90a
xorl %r13d, %r13d
pushq $0x63
popq %rdi
movq %r12, %rsi
movl %eax, %edx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x6c19
jmp 0xec1f
pushq $0x5
jmp 0xec1d
pushq $0x4
jmp 0xec1d
pushq $0x6
popq %r13
movl %r13d, 0x18(%rsp)
xorl %r13d, %r13d
pushq $-0x1
popq %rax
movq %rax, 0x10(%rsp)
callq 0xe109
testq %rax, %rax
je 0xece9
movq %rax, %rbp
movq %rax, %rdi
leaq 0x120d7(%rip), %rsi     # 0x20d21
callq 0x5160
testl %eax, %eax
je 0xeca7
movq %rbp, %rdi
movq %r15, %rsi
callq 0x5160
testl %eax, %eax
je 0xecb3
cmpb $0x41, (%rbp)
jne 0xec74
cmpb $0x54, 0x1(%rbp)
jne 0xec74
cmpb $0x0, 0x2(%rbp)
je 0xecd3
movq %rbp, %rdi
leaq 0x120ab(%rip), %rsi     # 0x20d29
callq 0x5160
testl %eax, %eax
je 0xecbf
movq 0x24d82(%rip), %r12     # 0x33a10
callq 0xf90a
pushq $0x41
popq %rdi
movq %r12, %rsi
movl %eax, %edx
movq %rbp, %rcx
xorl %eax, %eax
callq 0x6c19
jmp 0xec2f
orl $0x800, %r13d           # imm = 0x800
jmp 0xec2f
orl $0x400, %r13d           # imm = 0x400
jmp 0xec2f
callq 0xf037
andl $0x7, %eax
orl %eax, %r13d
orl $0x40, %r13d
jmp 0xec2f
callq 0xf037
movq %rax, 0x10(%rsp)
orl $0x80, %r13d
jmp 0xec2f
callq 0xf457
cmpb $0x3b, %al
je 0xed1c
movl %eax, %ebp
movq 0x24d15(%rip), %r12     # 0x33a10
callq 0xf90a
pushq $0x42
popq %rdi
movq %r12, %rsi
movl %eax, %edx
pushq $0x3b
popq %rcx
xorl %eax, %eax
callq 0x6c19
cmpb $0x7d, %bpl
je 0xe52b
andq $0x0, (%rsp)
movzwl %r13w, %ecx
movq %rbx, %rdi
leaq 0x50(%rsp), %rsi
movl 0x18(%rsp), %edx
movq 0x10(%rsp), %r8
xorl %r9d, %r9d
callq 0xedf9
jmp 0xeb3d
pushq $0x7b
popq %rdi
pushq $0x7d
popq %rsi
callq 0xefde
jmp 0xe52b
pushq $0x7b
popq %rdi
pushq $0x7d
popq %rsi
callq 0xefde
xorl %eax, %eax
movq 0x30(%rsp), %rcx
movq (%rcx), %rcx
testq %rcx, %rcx
je 0xed83
cmpl $0x6, 0x20(%rcx)
je 0xe52b
testb $0x4, 0x25(%rcx)
pushq $0x1
popq %rdx
cmovnel %edx, %eax
jmp 0xed65
testl %eax, %eax
je 0xe52b
movq 0x24c8e(%rip), %r9      # 0x33a20
movq %r9, (%rsp)
movq %rbx, %rdi
leaq 0x11e4b(%rip), %rsi     # 0x20beb
pushq $0x6
popq %rdx
movl $0x400, %ecx            # imm = 0x400
pushq $-0x1
popq %r8
callq 0xedf9
jmp 0xe52b
movzbl %al, %eax
testl %eax, %eax
je 0xede0
pushq $0x1
popq %rdi
callq 0xf4ac
movq 0x24c44(%rip), %rbx     # 0x33a10
callq 0xf90a
pushq $0x4e
popq %rdi
movq %rbx, %rsi
movl %eax, %edx
xorl %eax, %eax
callq 0x6c19
movb $0x0, 0x24c69(%rip)     # 0x33a50
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq