// File: /workspace/github_c_makefile_star2_O3/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 $0x38, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movl $0x2, 0x25895(%rip)     # 0x3361c
xorl %eax, %eax
movq %rax, (%rsi)
movq %rax, (%rdx)
movq 0x2587a(%rip), %rdx     # 0x33610
testq %rdx, %rdx
je 0xddbb
movq 0x2587e(%rip), %rsi     # 0x33620
movl 0x25870(%rip), %ecx     # 0x33618
movq %rbx, %rdi
callq 0x103dc
movq $0x0, 0x25855(%rip) # 0x33610
movl $0x5, %edi
callq 0xff64
testq %rax, %rax
je 0xde38
movq %rax, %r12
movq %rbx, %rdi
movq %r12, %rsi
movl $0x3, %edx
callq 0xd8ec
testl %eax, %eax
je 0xddf5
movl $0x5, %edi
callq 0xff64
movq %rax, %r12
testq %rax, %rax
jne 0xddcd
jmp 0xde38
callq 0xfeed
cmpb $0x28, %al
je 0xde15
movzbl %al, %eax
cmpl $0x3d, %eax
jne 0xde2c
movq %rbx, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0xe258
jmp 0xdde1
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r14, %rcx
callq 0xda2a
testl %eax, %eax
je 0xdde1
jmp 0xde95
movl $0x1, %edi
callq 0xff51
jmp 0xdde1
callq 0xfeed
cmpb $0x3b, %al
je 0xddbb
movl $0x1, %edi
callq 0xff51
movl $0x1, 0x257c3(%rip)     # 0x3361c
xorl %r12d, %r12d
movq %rbx, %rdi
xorl %esi, %esi
callq 0xe455
testq %rax, %rax
je 0xe21e
movq %rax, %r14
cmpq $0x0, (%rax)
je 0xdea0
movq 0x257a9(%rip), %rdi     # 0x33628
testq %rdi, %rdi
je 0xde89
callq 0x5040
movq %r14, 0x25798(%rip)     # 0x33628
jmp 0xe079
movl $0x1, %r12d
jmp 0xe246
movq %r14, %rdi
callq 0x5040
movq 0x25779(%rip), %r14     # 0x33628
testq %r14, %r14
jne 0xe079
movq 0x25749(%rip), %r14     # 0x33608
testb $0x1, 0x21(%r14)
jne 0xded4
movq $0x0, 0x10(%rsp)
jmp 0xe074
movq 0x28(%r14), %rax
movq 0x30(%r14), %rdx
movq 0x2574d(%rip), %rcx     # 0x33630
movq %rdx, %rsi
xorq %rcx, %rsi
movq %rax, %rdi
xorq %rdx, %rdi
orq %rsi, %rdi
jne 0xdfcc
cmpb $0x1, 0x20(%r14)
je 0xdf09
movb 0x22(%r14), %al
andb $0x6, %al
cmpb $0x2, %al
je 0xdf57
movq 0x1f8(%rbx), %rdi
leaq 0x18941(%rip), %rsi     # 0x26858
movq %rcx, %rdx
callq 0xe73f
movq %rax, %r15
movq %rax, 0x10(%rsp)
testq %rax, %rax
jne 0xdf48
leaq 0x14c41(%rip), %rdi     # 0x22b74
leaq 0x14c29(%rip), %rsi     # 0x22b63
leaq 0x18917(%rip), %rdx     # 0x26858
xorl %eax, %eax
callq 0x52b0
cmpw $0x0, 0x24(%r15)
jns 0xdf93
movq 0x256d9(%rip), %rcx     # 0x33630
movq 0x1f8(%rbx), %rdi
leaq 0x14d5a(%rip), %rsi     # 0x22cbf
movq %rcx, %rdx
callq 0xe73f
movq %rax, 0x10(%rsp)
testq %rax, %rax
jne 0xdf93
leaq 0x14bf6(%rip), %rdi     # 0x22b74
leaq 0x14bde(%rip), %rsi     # 0x22b63
leaq 0x14d33(%rip), %rdx     # 0x22cbf
xorl %eax, %eax
callq 0x52b0
movq 0x2566e(%rip), %rax     # 0x33608
movq 0x18(%rax), %rdi
leaq 0x28(%rsp), %rsi
callq 0xe78d
testw %ax, %ax
je 0xe06b
movq 0x28(%rsp), %r15
movq 0x25673(%rip), %rcx     # 0x33630
movq 0x1f8(%rbx), %rdi
movq %r15, %rsi
movq %rcx, %rdx
jmp 0xe039
movq 0x1f8(%rbx), %rdi
leaq 0x14d10(%rip), %rsi     # 0x22cea
movq %rax, %rcx
callq 0xe73f
movq %rax, 0x10(%rsp)
testq %rax, %rax
jne 0xe00f
leaq 0x14b81(%rip), %rdi     # 0x22b74
leaq 0x14b69(%rip), %rsi     # 0x22b63
leaq 0x14ce9(%rip), %rdx     # 0x22cea
xorl %eax, %eax
callq 0x52b0
movq 0x255f9(%rip), %r14     # 0x33608
movq 0x18(%r14), %rdi
leaq 0x28(%rsp), %rsi
callq 0xe78d
testw %ax, %ax
je 0xe06b
movq 0x28(%rsp), %r15
movq 0x28(%r14), %rcx
movq 0x30(%r14), %rdx
movq 0x1f8(%rbx), %rdi
movq %r15, %rsi
callq 0xe73f
movq %rax, 0x18(%rsp)
testq %rax, %rax
jne 0xe060
leaq 0x14b25(%rip), %rdi     # 0x22b74
leaq 0x14b0d(%rip), %rsi     # 0x22b63
movq %r15, %rdx
xorl %eax, %eax
callq 0x52b0
movq $0x0, 0x20(%rsp)
jmp 0xe074
movq $0x0, 0x18(%rsp)
leaq 0x10(%rsp), %r14
movq 0x25588(%rip), %r13     # 0x33608
testb $0x1, 0x21(%r13)
je 0xe21e
cmpb $0x0, 0x20(%r13)
je 0xe21e
movq %r14, 0x30(%rsp)
movq (%r14), %r14
testq %r14, %r14
je 0xe1db
leaq 0x1f8(%rbx), %rbp
movq 0x30(%rsp), %r15
movl $0x0, 0xc(%rsp)
cmpw $0x0, 0x24(%r14)
js 0xe104
cmpl $0x1, 0x20(%r14)
jne 0xe12f
cmpl $0x0, 0xc(%rsp)
je 0xe127
movq 0x25548(%rip), %r12     # 0x33620
callq 0x103d5
movq 0x18(%r13), %rcx
movl $0x50, %edi
movq %r12, %rsi
movl %eax, %edx
xorl %eax, %eax
callq 0x6f14
andb $-0x11, 0x24(%r14)
movl $0x1, 0xc(%rsp)
jmp 0xe1cb
movq 0x25515(%rip), %r12     # 0x33620
callq 0x103d5
movq 0x8(%r14), %rcx
movl $0x4b, %edi
movq %r12, %rsi
movl %eax, %edx
xorl %eax, %eax
callq 0x6f14
jmp 0xe17e
movl $0x1, 0xc(%rsp)
cmpq $-0x1, 0x30(%r14)
jne 0xe142
movq 0x38(%r13), %rax
movq %rax, 0x38(%r14)
movq %rax, 0x30(%r14)
cmpq $-0x1, 0x28(%r14)
jne 0xe151
movq 0x40(%r13), %rax
movq %rax, 0x28(%r14)
movq 0x38(%r13), %rax
movq 0x48(%r13), %rcx
addq %rax, %rcx
movq %rcx, 0x40(%r14)
movq 0x50(%r13), %rcx
testq %rcx, %rcx
je 0xe170
addq %rax, %rcx
movq %rcx, 0x38(%r14)
movb 0x23(%r13), %al
cmpb 0x26(%r14), %al
jbe 0xe17e
movb %al, 0x26(%r14)
movq (%rbp), %rax
cmpq %r14, %rax
je 0xe1aa
movq %rax, %rcx
movq %rbp, %rdx
testq %rax, %rax
je 0xe1c1
movq (%rcx), %rdx
cmpq %r14, %rdx
jne 0xe1a0
movq (%r14), %rdx
movq %rdx, (%rcx)
movq %rdx, %rcx
testq %rdx, %rdx
jne 0xe192
jmp 0xe1b1
movq (%r14), %rax
movq %rax, (%rbp)
movq %rbp, %rdx
testq %rax, %rax
je 0xe1c1
movq %rax, %rdx
movq (%rax), %rax
jmp 0xe1b4
movq %r14, (%rdx)
movq $0x0, (%r14)
addq $0x8, %r15
movq (%r15), %r14
testq %r14, %r14
jne 0xe0bb
movq 0x1f8(%rbx), %rax
testq %rax, %rax
movl $0x0, %r12d
movq 0x30(%rsp), %rsi
je 0xe21e
movq %rsi, %rcx
movq (%rcx), %rdx
testq %rdx, %rdx
je 0xe206
addq $0x8, %rcx
cmpq %rdx, %rax
jne 0xe1f5
testq %rdx, %rdx
jne 0xe216
cmpq $-0x1, 0x30(%rax)
je 0xe216
orb $-0x80, 0x25(%rax)
movq (%rax), %rax
testq %rax, %rax
jne 0xe1f2
movq 0x253e3(%rip), %rax     # 0x33608
movq 0x30(%rax), %rcx
movq %rcx, 0x25408(%rip)     # 0x33638
movq 0x28(%rax), %rax
movq %rax, 0x25405(%rip)     # 0x33640
movq $0x0, 0x253c2(%rip) # 0x33608
movl %r12d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq