// File: /workspace/github_c_makefile_star2_O3/alexgirao[P]aimant/getopt_x.c
// Function: getopt_x_next
int getopt_x_next(struct getopt_x *state, struct option **opt)
{
	int c;
	int index;

	if (state->got_error) {
		return -1;
	}

	if (state->got_dashdash) {
		if (optind == state->argc) return -1;
		optarg = state->argv[optind++];
		return 1;
	}

	index = -1;

	if ((c = getopt_long(state->argc, state->argv, state->optstring, state->longopts, &index)) == -1) {
		if (optind < state->argc) {
			assert(strcmp(state->argv[optind - 1], "--") == 0);
			state->got_dashdash = 1;
			optarg = state->argv[optind++];
			return 1;
		}
		if (state->optreq && *state->optreq) {
			const char *cp = state->optreq;
			do {
				if (!FD_ISSET_OPT_INFORMED(*cp, state->optset)) {
					DEBUG("error: option -%c is required", *cp);
					state->got_error = -1;
				}
			} while (*++cp);
		}
		return -1;
	}

	//DEBUG("c=%c/%i, index=%i, optopt=%c/%i", c, c, *indexp, optopt, optopt);

	/* sanity check
	 */

	switch (c) {
	case ':':
		if (optopt) {
			if (FD_ISSET_HAS_ARG(optopt, state->optset)) {
				DEBUG("error: option -%c need an argument", optopt);
			} else {
				DEBUG("error: option -%c does not accept an argument", optopt);
			}
		} else {
			DEBUG("error: invalid argument [%s], index=%i", state->argv[optind - 1], index);
		}
		state->got_error = 1;
		return -1;
	case '?': break; /* unknown */
	case 0: break; /* long option only */
	default:
		FD_SET_OPT_INFORMED(c, state->optset);
	}

	if (opt) {
		if (index >= 0) {
			*opt = &state->longopts[index];
		} else {
			*opt = NULL;
		}
	}

	return c;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpl $0x0, 0x114(%rdi)
je 0x3189
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rdi, %rbx
cmpl $0x0, 0x118(%rdi)
je 0x31c2
leaq 0x5538(%rip), %rax      # 0x86d4
movslq (%rax), %rcx
cmpl (%rbx), %ecx
je 0x3177
movq 0x8(%rbx), %rdx
leal 0x1(%rcx), %esi
movl %esi, (%rax)
movq (%rdx,%rcx,8), %rax
leaq 0x5551(%rip), %rcx      # 0x8708
movq %rax, (%rcx)
movl $0x1, %r14d
jmp 0x3177
movq %rsi, %r15
leaq -0x2c(%rbp), %r8
movl $0xffffffff, (%r8)      # imm = 0xFFFFFFFF
movl (%rbx), %edi
movq 0x8(%rbx), %rsi
leaq 0x28(%rbx), %rdx
movq 0x18(%rbx), %rcx
callq 0x3e60
cmpl $0x39, %eax
jg 0x31f3
cmpl $-0x1, %eax
je 0x3241
testl %eax, %eax
je 0x321b
jmp 0x3201
cmpl $0x3a, %eax
je 0x3288
cmpl $0x3f, %eax
je 0x321b
movl $0x1, %edx
movl %eax, %ecx
shlq %cl, %rdx
movl %eax, %ecx
shrl $0x3, %ecx
andl $0x18, %ecx
orq %rdx, 0xf0(%rbx,%rcx)
testq %r15, %r15
je 0x32d3
movslq -0x2c(%rbp), %rcx
testq %rcx, %rcx
js 0x32cc
shlq $0x5, %rcx
addq 0x18(%rbx), %rcx
movq %rcx, (%r15)
jmp 0x32d3
leaq 0x548c(%rip), %rax      # 0x86d4
movslq (%rax), %rcx
cmpl (%rbx), %ecx
jge 0x32db
movq 0x8(%rbx), %rdx
movq -0x8(%rdx,%rcx,8), %rsi
cmpb $0x2d, (%rsi)
jne 0x33a2
cmpb $0x2d, 0x1(%rsi)
jne 0x33a2
cmpb $0x0, 0x2(%rsi)
jne 0x33a2
movl $0x1, 0x118(%rbx)
jmp 0x31a7
leaq 0x5449(%rip), %rax      # 0x86d8
movl (%rax), %ecx
testq %rcx, %rcx
je 0x334d
movl %ecx, %eax
shrl $0x3, %eax
andl $0x18, %eax
movq 0xb0(%rbx,%rax), %rax
leaq 0x2646(%rip), %rdi      # 0x58f7
btq %rcx, %rax
jae 0x3380
leaq 0x269a(%rip), %rdx      # 0x595c
movl $0x15b, %esi            # imm = 0x15B
jmp 0x338c
movq $0x0, (%r15)
movl %eax, %r14d
jmp 0x3177
movq 0x20(%rbx), %r13
testq %r13, %r13
je 0x3177
movb (%r13), %al
testb %al, %al
je 0x3177
incq %r13
leaq 0x25f9(%rip), %r15      # 0x58f7
leaq 0x2639(%rip), %r12      # 0x593e
movsbl %al, %ecx
movl %ecx, %eax
shrl $0x3, %eax
andl $0x18, %eax
movq 0xf0(%rbx,%rax), %rax
movzbl %cl, %edx
btq %rdx, %rax
jb 0x333d
movq %r15, %rdi
movl $0x14a, %esi            # imm = 0x14A
movq %r12, %rdx
xorl %eax, %eax
callq 0x4228
movl $0xffffffff, 0x114(%rbx) # imm = 0xFFFFFFFF
movb (%r13), %al
incq %r13
testb %al, %al
jne 0x3305
jmp 0x3177
movq 0x8(%rbx), %rax
leaq 0x537c(%rip), %rcx      # 0x86d4
movslq (%rcx), %rcx
movq -0x8(%rax,%rcx,8), %rcx
movl -0x2c(%rbp), %r8d
leaq 0x258c(%rip), %rdi      # 0x58f7
leaq 0x263b(%rip), %rdx      # 0x59ad
movl $0x160, %esi            # imm = 0x160
xorl %eax, %eax
callq 0x4228
jmp 0x3393
leaq 0x25f8(%rip), %rdx      # 0x597f
movl $0x15d, %esi            # imm = 0x15D
xorl %eax, %eax
callq 0x4228
movl $0x1, 0x114(%rbx)
jmp 0x3177
leaq 0x2523(%rip), %rdi      # 0x58cc
leaq 0x2547(%rip), %rsi      # 0x58f7
leaq 0x254b(%rip), %rcx      # 0x5902
movl $0x141, %edx            # imm = 0x141
callq 0x1140