// File: /workspace/github_c_makefile_star2_O0/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
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0x114(%rax)
je 0x5659
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5a85
movq -0x10(%rbp), %rax
cmpl $0x0, 0x118(%rax)
je 0x56bf
leaq 0x6077(%rip), %rax      # 0xb6e4
movl (%rax), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jne 0x5683
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5a85
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
leaq 0x6052(%rip), %rcx      # 0xb6e4
movl (%rcx), %ecx
movl %ecx, %esi
addl $0x1, %esi
leaq 0x6044(%rip), %rdx      # 0xb6e4
movl %esi, (%rdx)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rcx
leaq 0x60b0(%rip), %rax      # 0xb760
movq %rcx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x5a85
movl $0xffffffff, -0x20(%rbp) # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rax
movl (%rax), %edi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
movq -0x10(%rbp), %rdx
addq $0x28, %rdx
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rcx
leaq -0x20(%rbp), %r8
callq 0x6a10
movl %eax, -0x1c(%rbp)
cmpl $-0x1, %eax
jne 0x5897
leaq 0x5fe4(%rip), %rax      # 0xb6e4
movl (%rax), %eax
movq -0x10(%rbp), %rcx
cmpl (%rcx), %eax
jge 0x57a5
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
leaq 0x5fc7(%rip), %rcx      # 0xb6e4
movl (%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x333c(%rip), %rsi      # 0x8a6c
callq 0x21a0
cmpl $0x0, %eax
jne 0x573c
jmp 0x575b
leaq 0x332c(%rip), %rdi      # 0x8a6f
leaq 0x3350(%rip), %rsi      # 0x8a9a
movl $0x141, %edx            # imm = 0x141
leaq 0x334f(%rip), %rcx      # 0x8aa5
callq 0x2140
movq -0x10(%rbp), %rax
movl $0x1, 0x118(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
leaq 0x5f6c(%rip), %rcx      # 0xb6e4
movl (%rcx), %ecx
movl %ecx, %esi
addl $0x1, %esi
leaq 0x5f5e(%rip), %rdx      # 0xb6e4
movl %esi, (%rdx)
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rcx
leaq 0x5fca(%rip), %rax      # 0xb760
movq %rcx, (%rax)
movl $0x1, -0x4(%rbp)
jmp 0x5a85
movq -0x10(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x588b
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
je 0x588b
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
andl $0xff, %eax
addl $0x300, %eax            # imm = 0x300
movl $0x40, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x38(%rbp), %rax
movslq %ecx, %rcx
movq 0x90(%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
andl $0xff, %eax
addl $0x300, %eax            # imm = 0x300
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x30(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
jne 0x586e
jmp 0x583f
movq -0x28(%rbp), %rax
movsbl (%rax), %ecx
leaq 0x324d(%rip), %rdi      # 0x8a9a
movl $0x14a, %esi            # imm = 0x14A
leaq 0x3288(%rip), %rdx      # 0x8ae1
movb $0x0, %al
callq 0x7000
movq -0x10(%rbp), %rax
movl $0xffffffff, 0x114(%rax) # imm = 0xFFFFFFFF
jmp 0x5870
movq -0x28(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x28(%rbp)
cmpb $0x0, 0x1(%rax)
jne 0x57d4
jmp 0x588b
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5a85
movl -0x1c(%rbp), %eax
movl %eax, -0x3c(%rbp)
testl %eax, %eax
je 0x59e8
jmp 0x58a7
movl -0x3c(%rbp), %eax
subl $0x3a, %eax
je 0x58c2
jmp 0x58b1
movl -0x3c(%rbp), %eax
subl $0x3f, %eax
je 0x59e6
jmp 0x59ea
leaq 0x5e1f(%rip), %rax      # 0xb6e8
cmpl $0x0, (%rax)
je 0x598f
movq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
leaq 0x5e07(%rip), %rax      # 0xb6e8
movl (%rax), %eax
andl $0xff, %eax
addl $0x100, %eax            # imm = 0x100
movl $0x40, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x50(%rbp), %rax
movslq %ecx, %rcx
movq 0x90(%rax,%rcx,8), %rax
movq %rax, -0x48(%rbp)
leaq 0x5dd7(%rip), %rax      # 0xb6e8
movl (%rax), %eax
andl $0xff, %eax
addl $0x100, %eax            # imm = 0x100
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x48(%rbp), %rax
movl %edx, %ecx
movl $0x1, %edx
shlq %cl, %rdx
movq %rdx, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
je 0x5966
jmp 0x5941
leaq 0x5da0(%rip), %rax      # 0xb6e8
movl (%rax), %ecx
leaq 0x3149(%rip), %rdi      # 0x8a9a
movl $0x15b, %esi            # imm = 0x15B
leaq 0x31a2(%rip), %rdx      # 0x8aff
movb $0x0, %al
callq 0x7000
jmp 0x598d
jmp 0x5968
leaq 0x5d79(%rip), %rax      # 0xb6e8
movl (%rax), %ecx
leaq 0x3122(%rip), %rdi      # 0x8a9a
movl $0x15d, %esi            # imm = 0x15D
leaq 0x319e(%rip), %rdx      # 0x8b22
movb $0x0, %al
callq 0x7000
jmp 0x598d
jmp 0x59cc
jmp 0x5991
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
leaq 0x5d44(%rip), %rcx      # 0xb6e4
movl (%rcx), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rcx
movl -0x20(%rbp), %r8d
leaq 0x30e3(%rip), %rdi      # 0x8a9a
movl $0x160, %esi            # imm = 0x160
leaq 0x318d(%rip), %rdx      # 0x8b50
movb $0x0, %al
callq 0x7000
jmp 0x59cc
movq -0x10(%rbp), %rax
movl $0x1, 0x114(%rax)
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x5a85
jmp 0x5a49
jmp 0x5a49
movl -0x1c(%rbp), %eax
andl $0xff, %eax
addl $0x300, %eax            # imm = 0x300
movl $0x40, %ecx
cltd
idivl %ecx
movl %edx, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x58(%rbp)
movl -0x1c(%rbp), %eax
andl $0xff, %eax
addl $0x300, %eax            # imm = 0x300
movl $0x40, %ecx
cltd
idivl %ecx
movq -0x60(%rbp), %rdx
movl %eax, %ecx
movq -0x58(%rbp), %rax
movslq %ecx, %rcx
orq 0x90(%rax,%rcx,8), %rdx
movq %rdx, 0x90(%rax,%rcx,8)
cmpq $0x0, -0x18(%rbp)
je 0x5a7f
cmpl $0x0, -0x20(%rbp)
jl 0x5a72
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rcx
movslq -0x20(%rbp), %rax
shlq $0x5, %rax
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
jmp 0x5a7d
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
jmp 0x5a7f
movl -0x1c(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nop