// File: /workspace/github_c_makefile_star2_O1/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 $0x38, %rsp
movq %r9, %r15
movq %r8, 0x8(%rsp)
movl %ecx, %r12d
movq %rdi, %rbx
movl %esi, 0x20(%rsp)
testl %esi, %esi
je 0x40299b
movq 0x8(%rbx), %rdi
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testq %rdi, %rdi
je 0x4029b1
movq %r15, 0x18(%rsp)
movq %rdx, %r15
movl $0x2, %r14d
cmpb $0x2d, (%rdi)
jne 0x402968
cmpb $0x2d, 0x1(%rdi)
jne 0x40296c
movb 0x2(%rdi), %al
xorl %ecx, %ecx
testb %al, %al
setne %cl
cmpb $0x1, %al
movl $0x0, %eax
sbbl %eax, %eax
orl %eax, %r13d
leal (%rcx,%rcx,2), %ecx
incl %ecx
jmp 0x402988
xorl %ecx, %ecx
jmp 0x402988
movl 0x20(%rsp), %esi
callq 0x4010e8
movl $0x0, %ecx
testq %rax, %rax
je 0x402988
leaq -0x1(%r14), %r13
movl $0x1, %ecx
testb $0x3, %cl
jne 0x4029a6
movq (%rbx,%r14,8), %rdi
incq %r14
testq %rdi, %rdi
jne 0x402940
jmp 0x4029a9
xorl %eax, %eax
movb $0x1, %cl
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x4029bd
movl %r13d, %ebp
movq %r15, %rdx
movq 0x18(%rsp), %r15
movl %ebp, %ecx
shrl $0x1f, %ecx
movl %ebp, %eax
notl %eax
shrl $0x1f, %eax
testq %rdx, %rdx
je 0x402aa2
testb %cl, %cl
je 0x402aa2
movq 0x8(%rbx), %rbp
testq %rbp, %rbp
je 0x402a85
movq %r15, 0x18(%rsp)
movq %rdx, 0x30(%rsp)
movq %rdx, %rdi
callq 0x4010e0
leal 0x2(%rax), %ecx
movslq %ecx, %r13
cltq
movq %rax, 0x28(%rsp)
movl $0x2, %r14d
movq %rax, 0x10(%rsp)
xorl %r15d, %r15d
cmpb $0x2d, (%rbp)
jne 0x402a6e
cmpb $0x2d, 0x1(%rbp)
jne 0x402a6e
cmpb $0x0, 0x2(%rbp)
je 0x402a5e
movq %rbp, %rdi
callq 0x4010e0
cmpq %r13, %rax
jb 0x402a56
movzbl (%rbp,%r13), %eax
cmpl $0x3d, %eax
je 0x402a36
testl %eax, %eax
jne 0x402a56
addq $0x2, %rbp
movq %rbp, %rdi
movq 0x30(%rsp), %rsi
movq 0x28(%rsp), %rdx
callq 0x401078
testl %eax, %eax
jne 0x402a6e
leaq -0x1(%r14), %rax
jmp 0x402a63
movl $0x4, %r15d
jmp 0x402a6e
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0x10(%rsp)
movl $0x1, %r15d
testb $0x3, %r15b
jne 0x402a8c
movq (%rbx,%r14,8), %rbp
incq %r14
testq %rbp, %rbp
jne 0x402a05
movq 0x18(%rsp), %r15
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x402a98
movq 0x10(%rsp), %rax
movl %eax, %ebp
movq 0x18(%rsp), %r15
movl %ebp, %eax
notl %eax
shrl $0x1e, %eax
andl $-0x2, %eax
xorl %r14d, %r14d
testl %eax, %eax
je 0x402d26
testl %r12d, %r12d
js 0x402ac2
sete %cl
cmpq $0x0, 0x8(%rsp)
setne %dl
orb %cl, %dl
jne 0x402ad4
testq %r15, %r15
je 0x402d26
orb $0x1, (%r15)
jmp 0x402d26
cmpl $0x1, %eax
jne 0x402b38
testl %r12d, %r12d
je 0x402c24
movslq %ebp, %rax
movq (%rbx,%rax,8), %rdi
movl 0x20(%rsp), %esi
callq 0x4010e8
cmpb $0x0, 0x1(%rax)
je 0x402c27
movq %rax, %r14
movq %rax, %rdi
incq %rdi
callq 0x42c0f0
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
cmpb $0x5c, (%rax)
jne 0x402b26
incq %rax
movb (%rax), %cl
movb %cl, -0x1(%rax)
incq %rax
testb %cl, %cl
jne 0x402b1a
addq $0x8, 0x8(%rsp)
decl %r12d
movb $0x0, (%r14)
jmp 0x402c27
movslq %ebp, %r13
testl %r12d, %r12d
je 0x402cc2
movq (%rbx,%r13,8), %rdi
movl $0x3d, %esi
callq 0x4010e8
testq %rax, %rax
je 0x402b87
incq %rax
movq %rax, %rdi
callq 0x42c0f0
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
cmpb $0x5c, (%rax)
jne 0x402b7e
incq %rax
movb (%rax), %cl
movb %cl, -0x1(%rax)
incq %rax
testb %cl, %cl
jne 0x402b72
addq $0x8, 0x8(%rsp)
decl %r12d
movq %r13, 0x20(%rsp)
testl %r12d, %r12d
je 0x402c03
movl %ebp, 0x10(%rsp)
movq %r15, 0x18(%rsp)
leaq 0xbc633(%rip), %r13     # 0x4bf1d4
movq 0x20(%rsp), %r15
movq 0x8(%rbx,%r15,8), %rbp
testq %rbp, %rbp
je 0x402d00
movq %rbp, %rdi
movq %r13, %rsi
callq 0x4010b0
testl %eax, %eax
je 0x402d07
movq %rbp, %rdi
callq 0x42c0f0
movq 0x8(%rsp), %rdx
movq %rax, (%rdx)
cmpb $0x5c, (%rax)
jne 0x402beb
incq %rax
movb (%rax), %cl
movb %cl, -0x1(%rax)
incq %rax
testb %cl, %cl
jne 0x402bdf
incq %r15
decl %r12d
addq $0x8, %rdx
movq %rdx, 0x8(%rsp)
movq %r13, (%rbx,%r15,8)
testl %r12d, %r12d
jne 0x402ba6
leaq 0xbc5ca(%rip), %rax     # 0x4bf1d4
movq 0x20(%rsp), %rcx
movq %rax, (%rbx,%rcx,8)
movq 0x8(%rsp), %rax
movq $0x0, (%rax)
jmp 0x402ccd
xorl %r12d, %r12d
testl %r12d, %r12d
movl %ebp, 0x10(%rsp)
je 0x402c97
movslq %ebp, %r13
leaq 0xbc59a(%rip), %r14     # 0x4bf1d4
movq 0x8(%rbx,%r13,8), %rbp
testq %rbp, %rbp
je 0x402cd5
movq %rbp, %rdi
movq %r14, %rsi
callq 0x4010b0
testl %eax, %eax
je 0x402cdc
movq %rbp, %rdi
callq 0x42c0f0
movq 0x8(%rsp), %rdx
movq %rax, (%rdx)
cmpb $0x5c, (%rax)
jne 0x402c7f
incq %rax
movb (%rax), %cl
movb %cl, -0x1(%rax)
incq %rax
testb %cl, %cl
jne 0x402c73
incq %r13
decl %r12d
addq $0x8, %rdx
movq %rdx, 0x8(%rsp)
movq %r14, (%rbx,%r13,8)
testl %r12d, %r12d
jne 0x402c3a
movq %rbx, %rdi
movl 0x20(%rsp), %esi
movl 0x10(%rsp), %ecx
movl %ecx, %edx
callq 0x402d38
movl $0x1, %r14d
movq 0x8(%rsp), %rax
testq %rax, %rax
je 0x402d26
movq $0x0, (%rax)
jmp 0x402d26
leaq 0xbc50b(%rip), %rax     # 0x4bf1d4
movq %rax, (%rbx,%r13,8)
movl $0x1, %r14d
jmp 0x402d26
movl $0x2, %eax
jmp 0x402ce1
movl $0x4, %eax
testq %r15, %r15
je 0x402ce9
orl %eax, (%r15)
movq %rbx, %rdi
movl 0x20(%rsp), %esi
movl 0x10(%rsp), %ecx
movl %ecx, %edx
callq 0x402d38
xorl %r14d, %r14d
jmp 0x402d26
movl $0x2, %eax
jmp 0x402d0c
movl $0x4, %eax
movq 0x18(%rsp), %rcx
testq %rcx, %rcx
je 0x402d18
orl %eax, (%rcx)
movq %rbx, %rdi
movl 0x10(%rsp), %edx
movl %edx, %esi
callq 0x4028a2
movl %r14d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq