// File: /workspace/github_c_makefile_star2_O0/zpole[P]IICV/vl/getopt_long.c
// Function: getopt_long
VL_EXPORT int
getopt_long(int argc, char *const argv[],
            const char *optstring,
            const struct option * longopts,
            int *longindex)
{
  static char *place = EMSG;	/* option letter processing */
  static int   optbegin  = 0 ;
  static int   optend    = 0 ;
  char        *oli;		/* option letter list index */
  int          has_colon = 0 ;
  int          ret_val   = 0 ;

  /*
     A semicolon at the beginning of optstring has a special meaning.
     If we find one, we annote and remove it.
  */
  has_colon = optstring && optstring[0] == ':' ;
  if (has_colon) ++ optstring ;

  /*
   Here we are either processing a short option sequence or
   we start processing a new option. This is indicated by optreset.
  */

  if (optreset || *place == '\0') {

    /* ---------------------------------------------------------------
     *                                 Look for next short/long option
     * ------------------------------------------------------------ */
    optreset = 0 ;

    /* no more arguments ? */
    if (optind >= argc) {
      place = EMSG ;
      return -1 ;
    }

    /* next argument that may hold an option */
    optbegin = optind ;

    /* ---------------------------------------------------------------
     *                                     Look for an option to parse
     * ------------------------------------------------------------ */

  parse_option_at_optbegin :

    /* place points to the candidate option */
    place = argv [optbegin] ;

    /* an option is introduced by '-' */
    if (place [0] != '-') {
      /* this argument is not an option: try next argument */
      ++ optbegin ;
      if (optbegin >= argc) {
        /* no more arguments to look for options */
        place = EMSG ;
        return -1 ;
      }
      goto parse_option_at_optbegin ;
    }

    /* consume leading `-' */
    ++ place ;

    /* assume the option is composed of one argument only */
    optend = optbegin + 1 ;

    /* assume no argument */
    optarg = 0 ;

    /* ---------------------------------------------------------------
     *                                                     option `--'
     * ------------------------------------------------------------ */

    /* this special option (void long option) ends the option processing */
    if (place[0]        &&
        place[0] == '-' &&
        place[1] == '\0') {

      optind  = optend ;
      place   = EMSG ;
      ret_val = -1 ;
      goto done_option ;
    }

    /* ---------------------------------------------------------------
     *                                                     long option
     * ------------------------------------------------------------ */

    if (place[0]        &&
        place[0] == '-' &&
        place[1] ) {

      size_t namelen ;
      int i ;

      /* consume second `-' */
      ++ place ;

      /* count characters before `=' */
      namelen = strcspn(place, "=") ;

      /* scan longopts for this option */
      for (i = 0 ; longopts[i].name != NULL ; ++ i) {

        if (strlen  (       longopts[i].name) == namelen &&
            strncmp (place, longopts[i].name, namelen) == 0 ) {

          /* save back long option index */
          if (longindex) *longindex = i ;

          /* process long option argument */
          if (longopts[i].has_arg == required_argument ||
              longopts[i].has_arg == optional_argument) {

            /* --option=value style */
            if (place[namelen] == '=') {
              optarg = place + namelen + 1 ;
            }

            /* --option value style (only required_argument) */
            else if (longopts[i].has_arg == required_argument) {
              /* missing argument ? */
              if (optbegin >= argc - 1) {
                if (! has_colon && opterr)
                  fprintf(stderr,
                          "%s: option requires an argument -- %s\n",
                          argv[0], place);
                place   = EMSG ;
                ret_val = has_colon ? BADARG : BADCH ;
                goto done_option ;
              }
              optarg = argv [optend] ;
              ++ optend ;
            }
          }

          /* determine return value */
          if (longopts[i].flag == NULL) {
            ret_val = longopts[i].val ;
          }
          else {
            *longopts[i].flag = longopts[i].val;
            ret_val = 0 ;
          }

          /* mark sequence closed */
          place = EMSG ;
          goto done_option ;
        } /* if match */

      } /* scan longoptions */

      /* no matching option found */
      if (! has_colon && opterr)
        fprintf(stderr,
                "%s: illegal option -- %s\n", argv[0], place) ;
      place   = EMSG ;
      ret_val = BADCH ;
      goto done_option ;
    }
  } /* end new option */

  /* -----------------------------------------------------------------
   *                                      Finish short option sequence
   * -------------------------------------------------------------- */
  optopt = (int) *place++ ;

  /* search charcater in option list */
  oli = strchr(optstring, optopt);

  /* short option not found */
  if (!oli) {

    if (! has_colon && opterr)
      fprintf(stderr,
              "%s: illegal option -- %c\n",
              argv[0], optopt);

    if (*place) {
      /* more short options in the list */
      return BADCH ;
    }

    else {
      /* error occured as last option in the list */
      place   = EMSG ;
      ret_val = BADCH ;
      goto done_option ;
    }
  } /* end short option not found */

  if (oli[1] != ':') {
    /* short option with no argument */

    if (*place) {
      /* more short options in the list */
      return optopt ;
    }
    else {
      /* last option in the list */
      place   = EMSG ;
      ret_val = optopt ;
      goto done_option ;
    }

  } else {
    /* short option with argument */

    /* -ovalue style */
    if (*place) {
      optarg  = place ;
      place   = EMSG ;
      ret_val = optopt ;
      goto done_option ;
    }
    /* -o value style: missing argument */
    else if (optbegin >= argc - 1) {
      if (! has_colon && opterr)
        fprintf(stderr,
                "%s: option requires an argument -- %c\n",
                argv[0], optopt);
      place   = EMSG ;
      ret_val = has_colon ? BADARG : BADCH ;
      goto done_option ;
    }

    /* -o value style: process argument */
    optarg = argv [optend] ;
    ++ optend ;
    place   = EMSG ;
    ret_val = optopt ;
    goto done_option ;
  } /* short with argument */

 done_option :
  {
    int pos = optend - optbegin ;  /* n of circular shifts */
    int c   = pos ;

    while (c --) {
      int i ;
      char *tmp = argv [optend - 1] ;
      for (i = optend - 1 ; i > optind ; -- i) {
        ((char**)argv) [i] = argv [i-1] ;
      }
      ((char**)argv) [optind] = tmp ;
    }
    optind += pos ;
  }

  return ret_val ;
}

// Assembly:
subq $0x68, %rsp
movl %edi, 0x60(%rsp)
movq %rsi, 0x58(%rsp)
movq %rdx, 0x50(%rsp)
movq %rcx, 0x48(%rsp)
movq %r8, 0x40(%rsp)
movl $0x0, 0x34(%rsp)
movl $0x0, 0x30(%rsp)
xorl %eax, %eax
cmpq $0x0, 0x50(%rsp)
movb %al, 0xf(%rsp)
je 0x1778c
movq 0x50(%rsp), %rax
movsbl (%rax), %eax
cmpl $0x3a, %eax
sete %al
movb %al, 0xf(%rsp)
movb 0xf(%rsp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, 0x34(%rsp)
cmpl $0x0, 0x34(%rsp)
je 0x177ae
movq 0x50(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x50(%rsp)
movq 0x49613(%rip), %rax     # 0x60dc8
cmpl $0x0, (%rax)
jne 0x177cd
movq 0x49f07(%rip), %rax     # 0x616c8
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x17be9
movq 0x495f4(%rip), %rax     # 0x60dc8
movl $0x0, (%rax)
movq 0x49727(%rip), %rax     # 0x60f08
movl (%rax), %eax
cmpl 0x60(%rsp), %eax
jl 0x17804
leaq 0x41ed1(%rip), %rax     # 0x596c1
movq %rax, 0x49ed1(%rip)     # 0x616c8
movl $0xffffffff, 0x64(%rsp) # imm = 0xFFFFFFFF
jmp 0x17eab
movq 0x496fd(%rip), %rax     # 0x60f08
movl (%rax), %eax
movl %eax, 0x49fc5(%rip)     # 0x617d8
movq 0x58(%rsp), %rax
movslq 0x49fb9(%rip), %rcx     # 0x617d8
movq (%rax,%rcx,8), %rax
movq %rax, 0x49e9e(%rip)     # 0x616c8
movq 0x49e97(%rip), %rax     # 0x616c8
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x17871
movl 0x49f99(%rip), %eax     # 0x617d8
addl $0x1, %eax
movl %eax, 0x49f90(%rip)     # 0x617d8
movl 0x49f8a(%rip), %eax     # 0x617d8
cmpl 0x60(%rsp), %eax
jl 0x1786f
leaq 0x41e66(%rip), %rax     # 0x596c1
movq %rax, 0x49e66(%rip)     # 0x616c8
movl $0xffffffff, 0x64(%rsp) # imm = 0xFFFFFFFF
jmp 0x17eab
jmp 0x17813
movq 0x49e50(%rip), %rax     # 0x616c8
addq $0x1, %rax
movq %rax, 0x49e45(%rip)     # 0x616c8
movl 0x49f4f(%rip), %eax     # 0x617d8
addl $0x1, %eax
movl %eax, 0x49f4a(%rip)     # 0x617dc
movq 0x49747(%rip), %rax     # 0x60fe0
movq $0x0, (%rax)
movq 0x49e21(%rip), %rax     # 0x616c8
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x178f8
movq 0x49e12(%rip), %rax     # 0x616c8
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x178f8
movq 0x49e03(%rip), %rax     # 0x616c8
movsbl 0x1(%rax), %eax
cmpl $0x0, %eax
jne 0x178f8
movl 0x49f08(%rip), %ecx     # 0x617dc
movq 0x4962d(%rip), %rax     # 0x60f08
movl %ecx, (%rax)
leaq 0x41ddd(%rip), %rax     # 0x596c1
movq %rax, 0x49ddd(%rip)     # 0x616c8
movl $0xffffffff, 0x30(%rsp) # imm = 0xFFFFFFFF
jmp 0x17dde
movq 0x49dc9(%rip), %rax     # 0x616c8
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x17be7
movq 0x49db6(%rip), %rax     # 0x616c8
movsbl (%rax), %eax
cmpl $0x2d, %eax
jne 0x17be7
movq 0x49da3(%rip), %rax     # 0x616c8
movsbl 0x1(%rax), %eax
cmpl $0x0, %eax
je 0x17be7
movq 0x49d8f(%rip), %rax     # 0x616c8
addq $0x1, %rax
movq %rax, 0x49d84(%rip)     # 0x616c8
movq 0x49d7d(%rip), %rdi     # 0x616c8
leaq 0x41963(%rip), %rsi     # 0x592b5
callq 0x9500
movq %rax, 0x28(%rsp)
movl $0x0, 0x24(%rsp)
movq 0x48(%rsp), %rax
movslq 0x24(%rsp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
je 0x17b92
movq 0x48(%rsp), %rax
movslq 0x24(%rsp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdi
callq 0x9350
cmpq 0x28(%rsp), %rax
jne 0x17b80
movq 0x49d1e(%rip), %rdi     # 0x616c8
movq 0x48(%rsp), %rax
movslq 0x24(%rsp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rsi
movq 0x28(%rsp), %rdx
callq 0x90e0
cmpl $0x0, %eax
jne 0x17b80
cmpq $0x0, 0x40(%rsp)
je 0x179e4
movl 0x24(%rsp), %ecx
movq 0x40(%rsp), %rax
movl %ecx, (%rax)
movq 0x48(%rsp), %rax
movslq 0x24(%rsp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $0x1, 0x8(%rax)
je 0x17a16
movq 0x48(%rsp), %rax
movslq 0x24(%rsp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $0x2, 0x8(%rax)
jne 0x17b08
movq 0x49cab(%rip), %rax     # 0x616c8
movq 0x28(%rsp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x3d, %eax
jne 0x17a4a
movq 0x49c96(%rip), %rcx     # 0x616c8
addq 0x28(%rsp), %rcx
addq $0x1, %rcx
movq 0x4959e(%rip), %rax     # 0x60fe0
movq %rcx, (%rax)
jmp 0x17b06
movq 0x48(%rsp), %rax
movslq 0x24(%rsp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $0x1, 0x8(%rax)
jne 0x17b04
movl 0x49d6d(%rip), %eax     # 0x617d8
movl 0x60(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jl 0x17adb
cmpl $0x0, 0x34(%rsp)
jne 0x17ab0
movq 0x493bc(%rip), %rax     # 0x60e40
cmpl $0x0, (%rax)
je 0x17ab0
movq 0x49568(%rip), %rax     # 0x60ff8
movq (%rax), %rdi
movq 0x58(%rsp), %rax
movq (%rax), %rdx
movq 0x49c26(%rip), %rcx     # 0x616c8
leaq 0x4180e(%rip), %rsi     # 0x592b7
movb $0x0, %al
callq 0x95f0
leaq 0x41c0a(%rip), %rax     # 0x596c1
movq %rax, 0x49c0a(%rip)     # 0x616c8
movl 0x34(%rsp), %edx
movl $0x3f, %eax
movl $0x3a, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, 0x30(%rsp)
jmp 0x17dde
movq 0x58(%rsp), %rax
movslq 0x49cf5(%rip), %rcx     # 0x617dc
movq (%rax,%rcx,8), %rcx
movq 0x494ee(%rip), %rax     # 0x60fe0
movq %rcx, (%rax)
movl 0x49ce1(%rip), %eax     # 0x617dc
addl $0x1, %eax
movl %eax, 0x49cd8(%rip)     # 0x617dc
jmp 0x17b06
jmp 0x17b08
movq 0x48(%rsp), %rax
movslq 0x24(%rsp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpq $0x0, 0x10(%rax)
jne 0x17b3a
movq 0x48(%rsp), %rax
movslq 0x24(%rsp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x18(%rax), %eax
movl %eax, 0x30(%rsp)
jmp 0x17b6d
movq 0x48(%rsp), %rax
movslq 0x24(%rsp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movl 0x18(%rax), %ecx
movq 0x48(%rsp), %rax
movslq 0x24(%rsp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movq 0x10(%rax), %rax
movl %ecx, (%rax)
movl $0x0, 0x30(%rsp)
leaq 0x41b4d(%rip), %rax     # 0x596c1
movq %rax, 0x49b4d(%rip)     # 0x616c8
jmp 0x17dde
jmp 0x17b82
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
jmp 0x17964
cmpl $0x0, 0x34(%rsp)
jne 0x17bcc
movq 0x492a0(%rip), %rax     # 0x60e40
cmpl $0x0, (%rax)
je 0x17bcc
movq 0x4944c(%rip), %rax     # 0x60ff8
movq (%rax), %rdi
movq 0x58(%rsp), %rax
movq (%rax), %rdx
movq 0x49b0a(%rip), %rcx     # 0x616c8
leaq 0x41719(%rip), %rsi     # 0x592de
movb $0x0, %al
callq 0x95f0
leaq 0x41aee(%rip), %rax     # 0x596c1
movq %rax, 0x49aee(%rip)     # 0x616c8
movl $0x3f, 0x30(%rsp)
jmp 0x17dde
jmp 0x17be9
movq 0x49ad8(%rip), %rax     # 0x616c8
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x49aca(%rip)     # 0x616c8
movsbl (%rax), %ecx
movq 0x49318(%rip), %rax     # 0x60f20
movl %ecx, (%rax)
movq 0x50(%rsp), %rdi
movq 0x4930a(%rip), %rax     # 0x60f20
movl (%rax), %esi
callq 0x93e0
movq %rax, 0x38(%rsp)
cmpq $0x0, 0x38(%rsp)
jne 0x17c9a
cmpl $0x0, 0x34(%rsp)
jne 0x17c66
movq 0x49208(%rip), %rax     # 0x60e40
cmpl $0x0, (%rax)
je 0x17c66
movq 0x493b4(%rip), %rax     # 0x60ff8
movq (%rax), %rdi
movq 0x58(%rsp), %rax
movq (%rax), %rdx
movq 0x492ca(%rip), %rax     # 0x60f20
movl (%rax), %ecx
leaq 0x41699(%rip), %rsi     # 0x592f8
movb $0x0, %al
callq 0x95f0
movq 0x49a5b(%rip), %rax     # 0x616c8
cmpb $0x0, (%rax)
je 0x17c7f
movl $0x3f, 0x64(%rsp)
jmp 0x17eab
leaq 0x41a3b(%rip), %rax     # 0x596c1
movq %rax, 0x49a3b(%rip)     # 0x616c8
movl $0x3f, 0x30(%rsp)
jmp 0x17dde
movq 0x38(%rsp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x3a, %eax
je 0x17ce6
movq 0x49a19(%rip), %rax     # 0x616c8
cmpb $0x0, (%rax)
je 0x17cc6
movq 0x49265(%rip), %rax     # 0x60f20
movl (%rax), %eax
movl %eax, 0x64(%rsp)
jmp 0x17eab
leaq 0x419f4(%rip), %rax     # 0x596c1
movq %rax, 0x499f4(%rip)     # 0x616c8
movq 0x49245(%rip), %rax     # 0x60f20
movl (%rax), %eax
movl %eax, 0x30(%rsp)
jmp 0x17dde
movq 0x499db(%rip), %rax     # 0x616c8
cmpb $0x0, (%rax)
je 0x17d23
movq 0x499cf(%rip), %rcx     # 0x616c8
movq 0x492e0(%rip), %rax     # 0x60fe0
movq %rcx, (%rax)
leaq 0x419b7(%rip), %rax     # 0x596c1
movq %rax, 0x499b7(%rip)     # 0x616c8
movq 0x49208(%rip), %rax     # 0x60f20
movl (%rax), %eax
movl %eax, 0x30(%rsp)
jmp 0x17dde
movl 0x49aaf(%rip), %eax     # 0x617d8
movl 0x60(%rsp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jl 0x17d98
cmpl $0x0, 0x34(%rsp)
jne 0x17d70
movq 0x490fe(%rip), %rax     # 0x60e40
cmpl $0x0, (%rax)
je 0x17d70
movq 0x492aa(%rip), %rax     # 0x60ff8
movq (%rax), %rdi
movq 0x58(%rsp), %rax
movq (%rax), %rdx
movq 0x491c0(%rip), %rax     # 0x60f20
movl (%rax), %ecx
leaq 0x415a9(%rip), %rsi     # 0x59312
movb $0x0, %al
callq 0x95f0
leaq 0x4194a(%rip), %rax     # 0x596c1
movq %rax, 0x4994a(%rip)     # 0x616c8
movl 0x34(%rsp), %edx
movl $0x3f, %eax
movl $0x3a, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, 0x30(%rsp)
jmp 0x17dde
jmp 0x17d9a
movq 0x58(%rsp), %rax
movslq 0x49a36(%rip), %rcx     # 0x617dc
movq (%rax,%rcx,8), %rcx
movq 0x4922f(%rip), %rax     # 0x60fe0
movq %rcx, (%rax)
movl 0x49a22(%rip), %eax     # 0x617dc
addl $0x1, %eax
movl %eax, 0x49a19(%rip)     # 0x617dc
leaq 0x418f7(%rip), %rax     # 0x596c1
movq %rax, 0x498f7(%rip)     # 0x616c8
movq 0x49148(%rip), %rax     # 0x60f20
movl (%rax), %eax
movl %eax, 0x30(%rsp)
movl 0x499f8(%rip), %eax     # 0x617dc
subl 0x499ee(%rip), %eax     # 0x617d8
movl %eax, 0x20(%rsp)
movl 0x20(%rsp), %eax
movl %eax, 0x1c(%rsp)
movl 0x1c(%rsp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, 0x1c(%rsp)
cmpl $0x0, %eax
je 0x17e8d
movq 0x58(%rsp), %rax
movl 0x499c5(%rip), %ecx     # 0x617dc
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x10(%rsp)
movl 0x499b0(%rip), %eax     # 0x617dc
subl $0x1, %eax
movl %eax, 0x18(%rsp)
movl 0x18(%rsp), %eax
movq 0x490ca(%rip), %rcx     # 0x60f08
cmpl (%rcx), %eax
jle 0x17e70
movq 0x58(%rsp), %rax
movl 0x18(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdx
movq 0x58(%rsp), %rax
movslq 0x18(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movl 0x18(%rsp), %eax
addl $-0x1, %eax
movl %eax, 0x18(%rsp)
jmp 0x17e33
movq 0x10(%rsp), %rdx
movq 0x58(%rsp), %rax
movq 0x49087(%rip), %rcx     # 0x60f08
movslq (%rcx), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x17df6
movl 0x20(%rsp), %ecx
movq 0x49070(%rip), %rax     # 0x60f08
addl (%rax), %ecx
movq 0x49067(%rip), %rax     # 0x60f08
movl %ecx, (%rax)
movl 0x30(%rsp), %eax
movl %eax, 0x64(%rsp)
movl 0x64(%rsp), %eax
addq $0x68, %rsp
retq
nopw %cs:(%rax,%rax)
nop