// File: /workspace/github_c_makefile_star2_O3/jelaas[P]egetty/jelopt.c
// Function: jelopt_multi
int jelopt_multi(char **argv, int opt_short, char *opt_long,
		 int count, char **values,
		 int *err)
{
  int j,i = -1;
  int type = 0;

  if(opt_short)
    if( (i = find_short_arg(argv, opt_short)) >= 0)
      type = FOUND_SHORT;
  
  if(!type && opt_long)
    if( (i = find_long_arg(argv, opt_long)) >= 0)
      type = FOUND_LONG;
  
  if(!type)
    return 0;

  if(count < 0)
    {
      if(err) *err |= ERR_JELOPT_COUNT;
      return 0;
    }
  
  if(count && values == NULL)
    {
      if(err) *err |= ERR_JELOPT_COUNT;
      return 0;
    }
  
  if(type == FOUND_SHORT)
    {
      if(count)
	{
	  char *p = strchr(argv[i], opt_short);
	  if(*(p+1))
	    {
	      *values = strdup(p+1);
	      unquote(*values++);
	      count--;
	      *p = 0;
	    }
	}
      for(j=i+1;count--;j++)
	{
	  if(argv[j])
	    {
	      if(strcmp(argv[j], OPT_VALUE_USED))
		*values = strdup(argv[j]);
	      else
		{
		  if(err) *err |= ERR_JELOPT_VALUE_COLLISION;
		  goto err_short;
		}
	    }
	  else
	    {
	      if(err) *err |= ERR_JELOPT_MISSING_VALUE;
	    err_short:
	      rem_short_opt(argv, opt_short, i, i);
	      return 0;
	    }
	  unquote(*values++);
	  argv[j] = OPT_VALUE_USED;
	}
      rem_short_opt(argv, opt_short, i, i);
      if(values) *values++ = 0;
      return 1;
    }
  
  if(type == FOUND_LONG)
    {
      if(count == 0)
	{
	  argv[i] = OPT_VALUE_USED;
	  return 1;
	}
      
      if(strchr(argv[i], '='))
	{
	  *values = strdup(strchr(argv[i], '=')+1);
	  unquote(*values++);
	  count--;
	}
      
      for(j=i+1;count--;j++)
	{
	  if(argv[j])
	    {
	      if(strcmp(argv[j], OPT_VALUE_USED))
		*values = strdup(argv[j]);
	      else
		{
		  if(err) *err |= ERR_JELOPT_VALUE_COLLISION;
		  goto err_long;
		}
	    }
	  else
	    {
	      if(err) *err |= ERR_JELOPT_MISSING_VALUE;
	    err_long:
	      rem_opt(argv, i, i);
	      return 0;
	    }
	  unquote(*values++);
	  argv[j] = OPT_VALUE_USED;
	}
      argv[i] = OPT_VALUE_USED;
      *values++ = 0;
      return 1;
    }
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %r13
movq %r8, %rbp
movl %ecx, 0x8(%rsp)
movq %rdx, %r15
movq %rdi, %rbx
movl %esi, 0xc(%rsp)
testl %esi, %esi
je 0x402923
movq 0x8(%rbx), %rdi
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x402936
movl $0x2, %r14d
cmpb $0x2d, (%rdi)
jne 0x402915
cmpb $0x2d, 0x1(%rdi)
jne 0x402907
cmpb $0x0, 0x2(%rdi)
jne 0x402915
jmp 0x402936
movl 0xc(%rsp), %esi
callq 0x4010e8
testq %rax, %rax
jne 0x402930
movq (%rbx,%r14,8), %rdi
incq %r14
testq %rdi, %rdi
jne 0x4028f4
jmp 0x402936
testq %r15, %r15
jne 0x402948
xorl %r14d, %r14d
jmp 0x402bf4
decl %r14d
movl %r14d, %r12d
testq %r15, %r15
je 0x4029dc
testl %r12d, %r12d
jns 0x4029dc
movq %rbp, 0x18(%rsp)
movq 0x8(%rbx), %rbp
xorl %r14d, %r14d
testq %rbp, %rbp
je 0x402bf4
movq %r13, 0x10(%rsp)
movq %r15, %rdi
callq 0x4010e0
leal 0x2(%rax), %ecx
movslq %ecx, %r13
cltq
movq %rax, 0x20(%rsp)
movl $0x2, %r12d
cmpb $0x2d, (%rbp)
jne 0x4029cb
cmpb $0x2d, 0x1(%rbp)
jne 0x4029cb
cmpb $0x0, 0x2(%rbp)
je 0x402bf4
movq %rbp, %rdi
callq 0x4010e0
cmpq %r13, %rax
jb 0x4029cb
movzbl (%rbp,%r13), %eax
cmpl $0x3d, %eax
je 0x4029af
testl %eax, %eax
jne 0x4029cb
addq $0x2, %rbp
movq %rbp, %rdi
movq %r15, %rsi
movq 0x20(%rsp), %rdx
callq 0x401078
testl %eax, %eax
je 0x402bad
movq (%rbx,%r12,8), %rbp
incq %r12
testq %rbp, %rbp
jne 0x40297d
jmp 0x402bf4
xorl %r14d, %r14d
testl %r12d, %r12d
js 0x402bf4
movl 0x8(%rsp), %r15d
testl %r15d, %r15d
js 0x4029ff
sete %al
testq %rbp, %rbp
setne %cl
orb %al, %cl
jne 0x402a15
xorl %r14d, %r14d
testq %r13, %r13
je 0x402bf4
orb $0x1, (%r13)
jmp 0x402bf4
testb %r14b, %r14b
je 0x402ae6
movslq %r12d, %r14
testl %r15d, %r15d
je 0x402bc2
movq (%rbx,%r14,8), %rdi
movl $0x3d, %esi
callq 0x4010e8
testq %rax, %rax
movq %r13, 0x10(%rsp)
je 0x402a73
incq %rax
movq %rax, %rdi
callq 0x42c000
movq %rax, (%rbp)
cmpb $0x5c, (%rax)
jne 0x402a65
incq %rax
movb (%rax), %cl
movb %cl, -0x1(%rax)
incq %rax
testb %cl, %cl
jne 0x402a59
addq $0x8, %rbp
decl %r15d
movl %r15d, 0x8(%rsp)
je 0x402ad6
leaq 0xbc75a(%rip), %r15     # 0x4bf1d4
movq %r14, %r13
movq 0x8(%rbx,%r13,8), %rdi
testq %rdi, %rdi
je 0x402c06
cmpb $0x1, (%rdi)
jne 0x402aa0
cmpb $0x2, 0x1(%rdi)
jne 0x402aa0
cmpb $0x0, 0x2(%rdi)
je 0x402c50
callq 0x42c000
movq %rax, (%rbp)
cmpb $0x5c, (%rax)
jne 0x402abd
incq %rax
movb (%rax), %cl
movb %cl, -0x1(%rax)
incq %rax
testb %cl, %cl
jne 0x402ab1
incq %r13
movl 0x8(%rsp), %eax
decl %eax
addq $0x8, %rbp
movq %r15, (%rbx,%r13,8)
movl %eax, 0x8(%rsp)
testl %eax, %eax
jne 0x402a7d
leaq 0xbc6f7(%rip), %rax     # 0x4bf1d4
movq %rax, (%rbx,%r14,8)
jmp 0x402be6
testl %r15d, %r15d
je 0x402bcf
movslq %r12d, %r15
movq (%rbx,%r15,8), %rdi
movl 0xc(%rsp), %esi
callq 0x4010e8
cmpb $0x0, 0x1(%rax)
je 0x402b39
movq %rax, %r14
movq %rax, %rdi
incq %rdi
callq 0x42c000
movq %rax, (%rbp)
cmpb $0x5c, (%rax)
jne 0x402b2b
incq %rax
movb (%rax), %cl
movb %cl, -0x1(%rax)
incq %rax
testb %cl, %cl
jne 0x402b1f
addq $0x8, %rbp
movb $0x0, (%r14)
decl 0x8(%rsp)
je 0x402b99
leaq 0xbc694(%rip), %r14     # 0x4bf1d4
movq 0x8(%rbx,%r15,8), %rdi
testq %rdi, %rdi
je 0x402c2b
cmpb $0x1, (%rdi)
jne 0x402b63
cmpb $0x2, 0x1(%rdi)
jne 0x402b63
cmpb $0x0, 0x2(%rdi)
je 0x402c57
callq 0x42c000
movq %rax, (%rbp)
cmpb $0x5c, (%rax)
jne 0x402b80
incq %rax
movb (%rax), %cl
movb %cl, -0x1(%rax)
incq %rax
testb %cl, %cl
jne 0x402b74
incq %r15
movl 0x8(%rsp), %eax
decl %eax
addq $0x8, %rbp
movq %r14, (%rbx,%r15,8)
movl %eax, 0x8(%rsp)
testl %eax, %eax
jne 0x402b40
movq %rbx, %rdi
movl 0xc(%rsp), %esi
movl %r12d, %edx
movl %r12d, %ecx
callq 0x402c5e
jmp 0x402be6
decl %r12d
movb $0x1, %r14b
movq 0x10(%rsp), %r13
movq 0x18(%rsp), %rbp
jmp 0x4029e8
leaq 0xbc60b(%rip), %rax     # 0x4bf1d4
movq %rax, (%rbx,%r14,8)
jmp 0x402bee
movq %rbx, %rdi
movl 0xc(%rsp), %esi
movl %r12d, %edx
movl %r12d, %ecx
callq 0x402c5e
testq %rbp, %rbp
je 0x402bee
movq $0x0, (%rbp)
movl $0x1, %r14d
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x2, %eax
movq 0x10(%rsp), %rbp
testq %rbp, %rbp
je 0x402c18
orl %eax, (%rbp)
movq %rbx, %rdi
movl %r12d, %esi
movl %r12d, %edx
callq 0x40285b
jmp 0x402928
movl $0x2, %eax
testq %r13, %r13
je 0x402c39
orl %eax, (%r13)
movq %rbx, %rdi
movl 0xc(%rsp), %esi
movl %r12d, %edx
movl %r12d, %ecx
callq 0x402c5e
jmp 0x402928
movl $0x4, %eax
jmp 0x402c0b
movl $0x4, %eax
jmp 0x402c30