// File: /workspace/github_c_makefile_star2_O2/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 %r8, %rbp
movl %ecx, 0xc(%rsp)
movq %rdx, %rbx
movq %rdi, %r14
movl %esi, 0x20(%rsp)
testl %esi, %esi
movq %r9, 0x18(%rsp)
je 0x40283e
pushq $0x1
popq %r12
pushq $-0x1
popq %r15
movq (%r14,%r12,8), %rdi
testq %rdi, %rdi
je 0x40284d
cmpb $0x2d, (%rdi)
jne 0x402839
cmpb $0x2d, 0x1(%rdi)
jne 0x40282b
cmpb $0x0, 0x2(%rdi)
jne 0x402839
jmp 0x40284d
movl 0x20(%rsp), %esi
callq 0x4010f0
testq %rax, %rax
jne 0x40284a
incq %r12
jmp 0x40280f
testq %rbx, %rbx
jne 0x40285d
xorl %eax, %eax
jmp 0x402b14
movl %r12d, %r15d
testl %r15d, %r15d
sets %al
testq %rbx, %rbx
setne %cl
testb %al, %cl
je 0x4028db
movq %rbp, 0x10(%rsp)
movq %rbx, %rdi
callq 0x4010e8
leal 0x2(%rax), %ecx
movslq %ecx, %rbp
movslq %eax, %r13
pushq $0x1
popq %r15
movq (%r14,%r15,8), %r12
xorl %eax, %eax
testq %r12, %r12
je 0x402b14
cmpb $0x2d, (%r12)
jne 0x4028d6
cmpb $0x2d, 0x1(%r12)
jne 0x4028d6
cmpb $0x0, 0x2(%r12)
je 0x402b14
movq %r12, %rdi
callq 0x4010e8
cmpq %rbp, %rax
jb 0x4028d6
movzbl (%r12,%rbp), %eax
cmpl $0x3d, %eax
je 0x4028bc
testl %eax, %eax
jne 0x4028d6
addq $0x2, %r12
movq %r12, %rdi
movq %rbx, %rsi
movq %r13, %rdx
callq 0x401080
testl %eax, %eax
je 0x4029cd
incq %r15
jmp 0x402877
movq %rbp, 0x10(%rsp)
xorl %eax, %eax
testl %r15d, %r15d
js 0x402b14
movl 0xc(%rsp), %esi
testl %esi, %esi
js 0x40291f
sete %cl
movq 0x10(%rsp), %rbp
testq %rbp, %rbp
setne %dl
orb %cl, %dl
movq 0x18(%rsp), %r13
jne 0x402937
xorl %eax, %eax
testq %r13, %r13
je 0x402b14
orb $0x1, (%r13)
jmp 0x402b14
xorl %eax, %eax
movq 0x18(%rsp), %rcx
testq %rcx, %rcx
je 0x402b14
orb $0x1, (%rcx)
jmp 0x402b14
movslq %r15d, %r12
testb %al, %al
je 0x402981
testl %esi, %esi
je 0x4029d4
movq (%r14,%r12,8), %rdi
pushq $0x3d
popq %rsi
callq 0x4010f0
testq %rax, %rax
je 0x4029ed
incq %rax
movq %rax, %rdi
callq 0x42bf10
movq %rax, (%rbp)
addq $0x8, %rbp
movq %rbp, %rbx
movq %rax, %rdi
callq 0x402b6c
movl 0xc(%rsp), %eax
decl %eax
jmp 0x4029f4
testl %esi, %esi
je 0x4029e1
movq (%r14,%r12,8), %rdi
movl 0x20(%rsp), %esi
callq 0x4010f0
cmpb $0x0, 0x1(%rax)
je 0x402a89
movq %rax, %rbx
movq %rax, %rdi
incq %rdi
callq 0x42bf10
movq %rax, (%rbp)
addq $0x8, %rbp
movq %rbp, 0x10(%rsp)
movq %rax, %rdi
callq 0x402b6c
movl 0xc(%rsp), %eax
decl %eax
movb $0x0, (%rbx)
jmp 0x402a92
movb $0x1, %al
jmp 0x4028eb
leaq 0xbc7f9(%rip), %rax     # 0x4bf1d4
movq %rax, (%r14,%r12,8)
jmp 0x402a5f
movq %rbp, 0x10(%rsp)
xorl %eax, %eax
jmp 0x402a92
movq %rbp, %rbx
movl 0xc(%rsp), %eax
movq %r12, 0x20(%rsp)
leaq (%r14,%r12,8), %r12
addq $0x8, %r12
movl %eax, %ebp
xorl %r13d, %r13d
cmpl %r13d, %ebp
je 0x402a4a
movq (%r12,%r13,8), %rdi
testq %rdi, %rdi
je 0x402a67
cmpb $0x1, (%rdi)
jne 0x402a29
cmpb $0x2, 0x1(%rdi)
jne 0x402a29
cmpb $0x0, 0x2(%rdi)
je 0x402b57
callq 0x42bf10
movq %rax, (%rbx,%r13,8)
movq %rax, %rdi
callq 0x402b6c
leaq 0xbc793(%rip), %rax     # 0x4bf1d4
movq %rax, (%r12,%r13,8)
incq %r13
jmp 0x402a06
movq 0x20(%rsp), %rax
leaq 0xbc77e(%rip), %rcx     # 0x4bf1d4
movq %rcx, (%r14,%rax,8)
andq $0x0, (%rbx,%r13,8)
pushq $0x1
popq %rax
jmp 0x402b14
movq 0x18(%rsp), %rcx
testq %rcx, %rcx
je 0x402a76
pushq $0x2
popq %rax
orl %eax, (%rcx)
movq %r14, %rdi
movl %r15d, %esi
movl %r15d, %edx
callq 0x402798
jmp 0x402843
movq %rbp, 0x10(%rsp)
movl 0xc(%rsp), %eax
leaq (%r14,%r12,8), %r13
addq $0x8, %r13
movl %eax, %ebp
xorl %ebx, %ebx
xorl %r12d, %r12d
cmpl %r12d, %ebp
je 0x402af0
movq (%r13,%r12,8), %rdi
testq %rdi, %rdi
je 0x402b23
cmpb $0x1, (%rdi)
jne 0x402ac5
cmpb $0x2, 0x1(%rdi)
jne 0x402ac5
cmpb $0x0, 0x2(%rdi)
je 0x402b49
callq 0x42bf10
movq 0x10(%rsp), %rcx
movq %rax, (%rcx,%r12,8)
movq %rax, %rdi
callq 0x402b6c
leaq 0xbc6f2(%rip), %rax     # 0x4bf1d4
movq %rax, (%r13,%r12,8)
incq %r12
addq $-0x8, %rbx
jmp 0x402aa1
movq %r14, %rdi
movl 0x20(%rsp), %esi
movl %r15d, %edx
movl %r15d, %ecx
callq 0x402b85
pushq $0x1
popq %rax
movq 0x10(%rsp), %rcx
cmpq %rbx, %rcx
je 0x402b14
andq $0x0, (%rcx,%r12,8)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x18(%rsp), %rcx
testq %rcx, %rcx
je 0x402b32
pushq $0x2
popq %rax
orl %eax, (%rcx)
movq %r14, %rdi
movl 0x20(%rsp), %esi
movl %r15d, %edx
movl %r15d, %ecx
callq 0x402b85
jmp 0x402843
movq 0x18(%rsp), %rcx
testq %rcx, %rcx
je 0x402b32
pushq $0x4
jmp 0x402b2f
movq 0x18(%rsp), %rcx
testq %rcx, %rcx
je 0x402a76
pushq $0x4
jmp 0x402a73