// File: /workspace/github_c_makefile_star2_O2/deplinenoise[P]vlink/ldscript.c
// Function: next_pattern
int next_pattern(struct GlobalVars *gv,char **fpat,char ***spatlist)
/* Returns next file-pattern and a list of section-patterns, when present */
{
  static char *fn = "next_pattern(): ";
  static struct Phdr **defplist=NULL;
  struct Phdr **plist;
  char c,*keyword;

  level = 2;
  *fpat = NULL;
  *spatlist = NULL;
  if (secdefbase) {
    /* reset to beginning of section definition */
    init_parser(gv,scriptname,secdefbase,secdefline);
    secdefbase = NULL;
  }

  do {
    while (keyword = getpattern()) {
      if (check_command(gv,keyword,SCMDF_GLOBAL|SCMDF_SECDEF)) {
        continue;
      }
      else {
        c = getchr();
        if (c == '=') {
          symbol_assignment(gv,keyword,0);
        }
        else if (c == '(') {
          if (parse_pattern(gv,keyword,fpat,spatlist))
            return 1;
        }
        else
          back(1);
      }
    }
  }
  while (getchr() == ';');
  back(1);

  level = 1;
  if (plist = endofsecdef(gv,NULL)) {
    struct Phdr *guess_plist[3];

    if (*plist == NULL) {
      free(plist);
      if (!defplist) {
        /* No PHDR specification available, so we have to guess:
           In this default mode there are two PT_LOAD-segments
           available: text(non-writable,executable) and data(read-write).
           Dynamic, Interp and Note segments will be recognized by name */
        static char *phdr_miss_err = "%sPHDR %s missing";
        const char *pname;

        plist = guess_plist;

        if (!(current_ls->flags & SF_ALLOC)) {
          plist[0] = NULL;  /* not part of any segment */
        }

        else if (current_ls->relocmem==defmem &&
                 current_ls->destmem==defmem) {

          if (current_ls->type==ST_CODE ||
              (current_ls->protection & SP_EXEC) ||
              !(current_ls->protection & SP_WRITE)) {
            if (!(plist[0] = find_phdr(gv,deftxt,defmem,defmem)))
              ierror(phdr_miss_err,fn,deftxt);
            if (plist[0]->flags & PHDR_CLOSED) {
              if (!(plist[0] = find_phdr(gv,defdat,defmem,defmem)))
                ierror(phdr_miss_err,fn,defdat);
            }
          }
          else {
            if (!(plist[0] = find_phdr(gv,defdat,defmem,defmem)))
              ierror(phdr_miss_err,fn,defdat);
          }

          if (guess_special_segment(current_ls->name,&pname)) {
            if (!(plist[1] = find_phdr(gv,pname,defmem,defmem)))
              ierror(phdr_miss_err,fn,pname);
            plist[2] = NULL;
          }
          else
            plist[1] = NULL;
        }

        else {
          if (!(plist[0] = find_phdr(gv,defload,current_ls->relocmem,
                                     current_ls->destmem)))
            ierror(phdr_miss_err,fn,defload);

          if (guess_special_segment(current_ls->name,&pname)) {
            if (!(plist[1] = find_phdr(gv,pname,current_ls->relocmem,
                                       current_ls->destmem)))
              ierror(phdr_miss_err,fn,pname);
            plist[2] = NULL;
          }
          else
            plist[1] = NULL;
        }

      }
      else
        plist = defplist;
    }
    else {
      if (defplist)
        free(defplist);
      defplist = plist;
    }

    /* at this point there is at least one PHDR reference in the list */
    add_section_to_segments(gv,current_ls,plist);
  }

  vdefmem = current_ls->relocmem;
  ldefmem = current_ls->destmem;
  current_ls = NULL;
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r15
movl $0x2, 0x264ec(%rip)     # 0x33a0c
andq $0x0, (%rsi)
movq %rdx, %r12
andq $0x0, (%rdx)
movq %rdi, %rbx
movq 0x264cb(%rip), %rdx     # 0x33a00
testq %rdx, %rdx
je 0xd557
movq 0x264cf(%rip), %rsi     # 0x33a10
movl 0x264c1(%rip), %ecx     # 0x33a08
movq %rbx, %rdi
callq 0xf911
andq $0x0, 0x264a9(%rip)     # 0x33a00
pushq $0x3
popq %rbp
pushq $0x1
popq %r14
callq 0xd0eb
testq %rax, %rax
je 0xd59c
movq %rax, %r13
movq %rbx, %rdi
movq %rax, %rsi
movl %ebp, %edx
callq 0xd0f3
testl %eax, %eax
jne 0xd55e
callq 0xf457
cmpb $0x28, %al
je 0xd5a7
movzbl %al, %eax
cmpl $0x3d, %eax
jne 0xd5c1
movq %rbx, %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0xd9e1
jmp 0xd55e
callq 0xf457
cmpb $0x3b, %al
je 0xd55e
jmp 0xd5cb
movq %rbx, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %r12, %rcx
callq 0xd1ff
testl %eax, %eax
je 0xd55e
jmp 0xd9c4
movl %r14d, %edi
callq 0xf4ac
jmp 0xd55e
pushq $0x1
popq %rdi
callq 0xf4ac
movl $0x1, 0x2642f(%rip)     # 0x33a0c
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %esi, %esi
callq 0xdc21
testq %rax, %rax
je 0xd99f
movq %rax, %r15
cmpq $0x0, (%rax)
je 0xd614
movq 0x26415(%rip), %rdi     # 0x33a18
callq 0x5040
movq %r15, 0x26409(%rip)     # 0x33a18
jmp 0xd835
movq %r15, %rdi
callq 0x5040
movq 0x263f5(%rip), %r15     # 0x33a18
testq %r15, %r15
jne 0xd835
movq 0x263c5(%rip), %r14     # 0x339f8
testb $0x1, 0x21(%r14)
jne 0xd644
andq $0x0, (%rsp)
jmp 0xd82f
movq 0x28(%r14), %rax
movq 0x30(%r14), %rdx
movq 0x263cd(%rip), %rcx     # 0x33a20
movq %rdx, %rsi
xorq %rcx, %rsi
movq %rax, %rdi
xorq %rdx, %rdi
orq %rsi, %rdi
jne 0xd6a7
cmpb $0x1, 0x20(%r14)
je 0xd741
movb 0x22(%r14), %al
andb $0x6, %al
cmpb $0x2, %al
jne 0xd741
leaq 0x1364b(%rip), %rsi     # 0x20ccf
movq %rbx, %rdi
movq %rcx, %rdx
callq 0xdee8
movq %rax, (%rsp)
testq %rax, %rax
movl $0x0, %r14d
jne 0xd7c7
jmp 0xd7ab
leaq 0x1364c(%rip), %rsi     # 0x20cfa
movq %rbx, %rdi
movq %rax, %rcx
callq 0xdee8
movq %rax, (%rsp)
testq %rax, %rax
jne 0xd6e5
leaq 0x134bb(%rip), %rdi     # 0x20b84
leaq 0x134a3(%rip), %rsi     # 0x20b73
leaq 0x13623(%rip), %rdx     # 0x20cfa
xorl %eax, %eax
callq 0x6b2c
movq 0x26313(%rip), %r14     # 0x339f8
movq 0x18(%r14), %rdi
leaq 0x18(%rsp), %rsi
callq 0xdf3a
testw %ax, %ax
je 0xd829
movq 0x18(%rsp), %r15
movq 0x28(%r14), %rcx
movq 0x30(%r14), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0xdee8
movq %rax, 0x8(%rsp)
testq %rax, %rax
jne 0xd736
leaq 0x1345f(%rip), %rdi     # 0x20b84
leaq 0x13447(%rip), %rsi     # 0x20b73
movq %r15, %rdx
xorl %eax, %eax
callq 0x6b2c
andq $0x0, 0x10(%rsp)
jmp 0xd82f
leaq 0x16d30(%rip), %rsi     # 0x24478
movq %rbx, %rdi
movq %rcx, %rdx
callq 0xdee8
movq %rax, %r15
movq %rax, (%rsp)
testq %rax, %rax
jne 0xd77b
leaq 0x1341e(%rip), %rdi     # 0x20b84
leaq 0x13406(%rip), %rsi     # 0x20b73
leaq 0x16d04(%rip), %rdx     # 0x24478
xorl %eax, %eax
callq 0x6b2c
cmpw $0x0, 0x24(%r15)
movl $0x0, %r14d
jns 0xd7c7
movq 0x26290(%rip), %rcx     # 0x33a20
leaq 0x13538(%rip), %rsi     # 0x20ccf
movq %rbx, %rdi
movq %rcx, %rdx
callq 0xdee8
movq %rax, (%rsp)
testq %rax, %rax
jne 0xd7c7
leaq 0x133d2(%rip), %rdi     # 0x20b84
leaq 0x133ba(%rip), %rsi     # 0x20b73
leaq 0x1350f(%rip), %rdx     # 0x20ccf
xorl %eax, %eax
callq 0x6b2c
movq 0x2622a(%rip), %rax     # 0x339f8
movq 0x18(%rax), %rdi
leaq 0x18(%rsp), %rsi
callq 0xdf3a
testw %ax, %ax
je 0xd9d6
movq 0x18(%rsp), %r15
movq 0x2622f(%rip), %rcx     # 0x33a20
movq %rbx, %rdi
movq %r15, %rsi
movq %rcx, %rdx
callq 0xdee8
movq %rax, 0x8(%rsp)
testq %rax, %rax
jne 0xd821
leaq 0x13374(%rip), %rdi     # 0x20b84
leaq 0x1335c(%rip), %rsi     # 0x20b73
movq %r15, %rdx
xorl %eax, %eax
callq 0x6b2c
andq $0x0, 0x10(%rsp)
jmp 0xd832
andq $0x0, 0x8(%rsp)
xorl %r14d, %r14d
movq %rsp, %r15
movq 0x261bc(%rip), %rbp     # 0x339f8
testb $0x1, 0x21(%rbp)
je 0xd99f
cmpb $0x0, 0x20(%rbp)
je 0xd99f
addq $0x1f8, %rbx            # imm = 0x1F8
movq %r15, 0x20(%rsp)
xorl %r13d, %r13d
movq (%r15), %r14
testq %r14, %r14
je 0xd969
addq $0x8, %r15
cmpw $0x0, 0x24(%r14)
js 0xd905
cmpl $0x1, 0x20(%r14)
jne 0xd8b5
testl %r13d, %r13d
pushq $0x1
popq %r13
je 0xd8b5
movq 0x2617e(%rip), %r12     # 0x33a10
callq 0xf90a
movq 0x18(%rbp), %rcx
pushq $0x50
popq %rdi
movq %r12, %rsi
movl %eax, %edx
xorl %eax, %eax
callq 0x6c19
andb $-0x11, 0x24(%r14)
pushq $0x1
popq %r13
jmp 0xd85f
cmpq $-0x1, 0x30(%r14)
jne 0xd8c8
movq 0x38(%rbp), %rax
movq %rax, 0x38(%r14)
movq %rax, 0x30(%r14)
cmpq $-0x1, 0x28(%r14)
jne 0xd8d7
movq 0x40(%rbp), %rax
movq %rax, 0x28(%r14)
movq 0x38(%rbp), %rax
movq 0x48(%rbp), %rcx
addq %rax, %rcx
movq %rcx, 0x40(%r14)
movq 0x50(%rbp), %rcx
testq %rcx, %rcx
je 0xd8f6
addq %rax, %rcx
movq %rcx, 0x38(%r14)
movb 0x23(%rbp), %al
cmpb 0x26(%r14), %al
jbe 0xd924
movb %al, 0x26(%r14)
jmp 0xd924
movq 0x26104(%rip), %r12     # 0x33a10
callq 0xf90a
movq 0x8(%r14), %rcx
pushq $0x4b
popq %rdi
movq %r12, %rsi
movl %eax, %edx
xorl %eax, %eax
callq 0x6c19
movq (%rbx), %rax
movq %rax, %rcx
cmpq %r14, %rax
je 0xd947
testq %rcx, %rcx
je 0xd94d
movq %rcx, %rdx
movq (%rcx), %rcx
cmpq %r14, %rcx
jne 0xd92f
movq (%r14), %rcx
movq %rcx, (%rdx)
jmp 0xd92f
movq (%r14), %rax
movq %rax, (%rbx)
movq %rbx, %rcx
testq %rax, %rax
je 0xd95d
movq %rax, %rcx
movq (%rax), %rax
jmp 0xd950
movq %r14, (%rcx)
andq $0x0, (%r14)
jmp 0xd85f
xorl %r14d, %r14d
movq 0x20(%rsp), %rdx
movq (%rbx), %rbx
testq %rbx, %rbx
je 0xd99f
movq %rdx, %rax
movq (%rax), %rcx
testq %rcx, %rcx
je 0xd98d
addq $0x8, %rax
cmpq %rcx, %rbx
jne 0xd97c
testq %rcx, %rcx
jne 0xd971
cmpq $-0x1, 0x30(%rbx)
je 0xd971
orb $-0x80, 0x25(%rbx)
jmp 0xd971
movq 0x26052(%rip), %rax     # 0x339f8
movq 0x30(%rax), %rcx
movq %rcx, 0x26077(%rip)     # 0x33a28
movq 0x28(%rax), %rax
movq %rax, 0x26074(%rip)     # 0x33a30
andq $0x0, 0x26034(%rip)     # 0x339f8
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
andq $0x0, 0x8(%rsp)
jmp 0xd832