// File: /workspace/github_c_makefile_star2_O3/lh3[P]minigraph/./ketopt.h
// Function: ketopt
static int ketopt(ketopt_t *s, int argc, char *argv[], int permute, const char *ostr, const ko_longopt_t *longopts)
{
	int opt = -1, i0, j;
	if (permute) {
		while (s->i < argc && (argv[s->i][0] != '-' || argv[s->i][1] == '\0'))
			++s->i, ++s->n_args;
	}
	s->arg = 0, s->longidx = -1, i0 = s->i;
	if (s->i >= argc || argv[s->i][0] != '-' || argv[s->i][1] == '\0') {
		s->ind = s->i - s->n_args;
		return -1;
	}
	if (argv[s->i][0] == '-' && argv[s->i][1] == '-') { /* "--" or a long option */
		if (argv[s->i][2] == '\0') { /* a bare "--" */
			ketopt_permute(argv, s->i, s->n_args);
			++s->i, s->ind = s->i - s->n_args;
			return -1;
		}
		s->opt = 0, opt = '?', s->pos = -1;
		if (longopts) { /* parse long options */
			int k, n_matches = 0;
			const ko_longopt_t *o = 0;
			for (j = 2; argv[s->i][j] != '\0' && argv[s->i][j] != '='; ++j) {} /* find the end of the option name */
			for (k = 0; longopts[k].name != 0; ++k)
				if (strncmp(&argv[s->i][2], longopts[k].name, j - 2) == 0)
					++n_matches, o = &longopts[k];
			if (n_matches == 1) {
				s->opt = opt = o->val, s->longidx = o - longopts;
				if (argv[s->i][j] == '=') s->arg = &argv[s->i][j + 1];
				if (o->has_arg == 1 && argv[s->i][j] == '\0') {
					if (s->i < argc - 1) s->arg = argv[++s->i];
					else opt = ':'; /* missing option argument */
				}
			}
		}
	} else { /* a short option */
		char *p;
		if (s->pos == 0) s->pos = 1;
		opt = s->opt = argv[s->i][s->pos++];
		p = strchr((char*)ostr, opt);
		if (p == 0) {
			opt = '?'; /* unknown option */
		} else if (p[1] == ':') {
			if (argv[s->i][s->pos] == 0) {
				if (s->i < argc - 1) s->arg = argv[++s->i];
				else opt = ':'; /* missing option argument */
			} else s->arg = &argv[s->i][s->pos];
			s->pos = -1;
		}
	}
	if (s->pos < 0 || argv[s->i][s->pos] == 0) {
		++s->i, s->pos = 0;
		if (s->n_args > 0) /* permute */
			for (j = i0; j < s->i; ++j)
				ketopt_permute(argv, j, s->n_args);
	}
	s->ind = s->i - s->n_args;
	return opt;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
movl 0x14(%rdi), %r13d
cmpl %esi, %r13d
jge 0x273c1
movl %esi, %r8d
movslq %r13d, %r11
movabsq $0x100000000, %rax      # imm = 0x100000000
leaq (%rdx,%r11,8), %r14
movq %r11, %r12
shlq $0x20, %r12
movl %esi, %ecx
negl %ecx
addq %r13, %rcx
xorl %r15d, %r15d
xorl %ebp, %ebp
movq (%r14,%rbp,8), %rsi
cmpb $0x2d, (%rsi)
jne 0x273a3
cmpb $0x0, 0x1(%rsi)
jne 0x273eb
leal 0x1(%r13,%rbp), %esi
movl %esi, 0x14(%rbx)
incl 0x1c(%rbx)
incq %rbp
addq $-0x8, %r15
addq %rax, %r12
movl %ecx, %esi
addl %ebp, %esi
jne 0x27394
movl %r8d, %r13d
movq $0x0, 0x8(%rbx)
movl $0xffffffff, 0x10(%rbx) # imm = 0xFFFFFFFF
subl 0x1c(%rbx), %r13d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %r13d, (%rbx)
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r13, %rsi
addq %rbp, %rsi
movq $0x0, 0x8(%rbx)
movl $0xffffffff, 0x10(%rbx) # imm = 0xFFFFFFFF
movq %r12, %rcx
sarq $0x1d, %rcx
movq (%rdx,%rcx), %r9
cmpb $0x2d, (%r9)
jne 0x2741f
movzbl 0x1(%r9), %ecx
cmpl $0x2d, %ecx
je 0x27424
testl %ecx, %ecx
jne 0x27477
movl %esi, %r13d
jmp 0x273d0
cmpb $0x0, 0x2(%r9)
je 0x275ff
movq %rsi, 0x10(%rsp)
sarq $0x20, %r12
leaq 0x2(%r9), %rsi
movl $0x0, 0x4(%rbx)
movl $0xffffffff, 0x18(%rbx) # imm = 0xFFFFFFFF
addq $0x3, %r9
movl $0x2, %r10d
xorl %edi, %edi
movzbl -0x1(%r9), %ecx
testl %ecx, %ecx
je 0x27505
cmpl $0x3d, %ecx
je 0x27505
incq %r10
incq %r9
addq %rax, %rdi
jmp 0x27456
movl %r8d, 0x1c(%rsp)
movq %rsi, 0x10(%rsp)
movq %r13, 0x28(%rsp)
movq %r11, 0x20(%rsp)
movq %rdx, 0x8(%rsp)
movl 0x18(%rbx), %r13d
cmpl $0x1, %r13d
adcl $0x0, %r13d
movslq %r13d, %rax
leaq 0x1(%rax), %r12
movl %r12d, 0x18(%rbx)
movq %r9, 0x30(%rsp)
movsbl (%r9,%rax), %esi
movl %esi, 0x4(%rbx)
leaq 0x3631(%rip), %rdi      # 0x2aaec
movl $0x2f, %edx
movl %esi, 0x4(%rsp)
callq 0x21d0
testq %rax, %rax
je 0x27630
cmpb $0x3a, 0x1(%rax)
movq 0x20(%rsp), %r11
jne 0x2763d
movq 0x30(%rsp), %rax
cmpb $0x0, (%rax,%r12)
movq 0x10(%rsp), %rdi
je 0x276d1
addq %r12, %rax
movl %edi, %ecx
movq 0x8(%rsp), %rdx
jmp 0x276f5
movq %rsi, %rax
movq 0xaf01(%rip), %rsi      # 0x32410
testq %rsi, %rsi
je 0x2767d
movq %r10, 0x38(%rsp)
movq %r9, 0x30(%rsp)
movl %r8d, 0x1c(%rsp)
movq %r13, 0x28(%rsp)
movq %r11, 0x20(%rsp)
movq %rdx, 0x8(%rsp)
sarq $0x20, %rdi
xorl %r8d, %r8d
leaq 0xaecc(%rip), %r13      # 0x32410
xorl %ecx, %ecx
movq %rax, 0x40(%rsp)
movq %rdi, 0x48(%rsp)
movl %ecx, 0x4(%rsp)
movq %r8, 0x50(%rsp)
movq 0x40(%rsp), %rdi
movq 0x48(%rsp), %rdx
callq 0x2070
movq 0x50(%rsp), %r8
xorl %ecx, %ecx
testl %eax, %eax
sete %cl
cmoveq %r13, %r8
addl %ecx, 0x4(%rsp)
movl 0x4(%rsp), %ecx
movq 0x10(%r13), %rsi
addq $0x10, %r13
testq %rsi, %rsi
jne 0x27550
cmpl $0x1, %ecx
jne 0x2768b
movl 0xc(%r8), %eax
movl %eax, %esi
movl %eax, 0x4(%rbx)
leaq 0xae6a(%rip), %rax      # 0x32410
movq %r8, %rcx
subq %rax, %rcx
shrq $0x4, %rcx
movl %ecx, 0x10(%rbx)
movq 0x30(%rsp), %rax
cmpb $0x3d, -0x1(%rax)
movq 0x8(%rsp), %rdx
movq 0x20(%rsp), %r11
movq 0x10(%rsp), %rdi
jne 0x275d1
movq %rax, 0x8(%rbx)
cmpl $0x1, 0x8(%r8)
movq 0x28(%rsp), %rcx
movl 0x1c(%rsp), %r8d
movq 0x38(%rsp), %r9
jne 0x275f6
movq (%rdx,%r12,8), %rax
cmpb $0x0, (%rax,%r9)
je 0x27775
movl %edi, %ecx
movl %esi, %eax
jmp 0x27704
movslq 0x1c(%rbx), %rax
testq %rax, %rax
jle 0x276a3
movq %rax, %rcx
negq %rcx
movslq %esi, %rsi
leaq (%rdx,%rsi,8), %r8
xorl %esi, %esi
movq -0x8(%r8,%rsi,8), %rdi
movq %rdi, (%r8,%rsi,8)
decq %rsi
cmpq %rsi, %rcx
jne 0x2761b
movl %eax, %ecx
jmp 0x276a5
movl $0x3f, 0x4(%rsp)
movq 0x20(%rsp), %r11
movq 0x10(%rsp), %rdi
cmpl $-0x2, %r13d
jg 0x27658
movl %edi, %ecx
movq 0x8(%rsp), %rdx
movl 0x4(%rsp), %eax
jmp 0x27704
movslq %edi, %rax
movq 0x8(%rsp), %rdx
movq (%rdx,%rax,8), %rax
movl %r12d, %ecx
cmpb $0x0, (%rax,%rcx)
movl 0x1c(%rbx), %r12d
je 0x276c9
movl %edi, %r13d
movl 0x4(%rsp), %eax
jmp 0x27764
movl $0x3f, %eax
movq 0x10(%rsp), %rdi
movl %edi, %ecx
jmp 0x27704
movl $0x3f, %eax
movq 0x10(%rsp), %rdi
movl %edi, %ecx
movq 0x8(%rsp), %rdx
movq 0x20(%rsp), %r11
jmp 0x27704
xorl %ecx, %ecx
movl %r13d, %esi
subl %ecx, %esi
addl %ebp, %esi
movslq %esi, %rcx
movq %r9, (%rdx,%rcx,8)
leal 0x1(%r13,%rbp), %ecx
movl %ecx, 0x14(%rbx)
subl %eax, %r13d
addl %ebp, %r13d
incl %r13d
jmp 0x273d4
movl %edi, %ecx
movl 0x4(%rsp), %eax
jmp 0x27708
movl 0x1c(%rsp), %eax
decl %eax
cmpl %edi, %eax
movq 0x8(%rsp), %rdx
jle 0x2776c
movq 0x28(%rsp), %rax
leal (%rax,%rbp), %ecx
incl %ecx
movslq %ecx, %rax
movq (%rdx,%rax,8), %rax
movq %rax, 0x8(%rbx)
movl 0x4(%rsp), %eax
movl $0xffffffff, 0x18(%rbx) # imm = 0xFFFFFFFF
movl 0x1c(%rbx), %r12d
leal 0x1(%rcx), %r13d
movl %r13d, 0x14(%rbx)
movl $0x0, 0x18(%rbx)
testl %r12d, %r12d
jle 0x27764
cmpl %edi, %ecx
jl 0x27764
subq %r15, %r14
addq %rbp, %r11
movl %r12d, %r10d
movslq %ecx, %rcx
movq %r10, %rsi
negq %rsi
movq (%rdx,%r11,8), %rdi
xorl %r8d, %r8d
movq -0x8(%r14,%r8,8), %r9
movq %r9, (%r14,%r8,8)
decq %r8
cmpq %r8, %rsi
jne 0x27739
movq %r11, %r8
subq %r10, %r8
movq %rdi, (%rdx,%r8,8)
leaq 0x1(%r11), %rdi
addq $0x8, %r14
cmpq %rcx, %r11
movq %rdi, %r11
jl 0x27732
subl %r12d, %r13d
jmp 0x273d9
movl $0x3a, %eax
movl %edi, %ecx
jmp 0x276fd
decl %r8d
cmpl %edi, %r8d
jle 0x27793
movl %esi, %eax
addl %ebp, %ecx
incl %ecx
movslq %ecx, %rcx
movq (%rdx,%rcx,8), %rsi
movq %rsi, 0x8(%rbx)
jmp 0x27704
movl $0x3a, %eax
jmp 0x27687