// File: /workspace/github_c_makefile_star2_O3/alexgirao[P]aimant/getopt_x.c
// Function: getopt_x_prepare0
static int getopt_x_prepare0(struct getopt_x *state, int argc, char **argv, const char *optstring, struct option *longopts, const char *optreq, int verbose)
{
	int optstring_len = 0;
	int optstring0_alnum_len = 0;

	opterr = 0; /* prevent the error message */

#ifdef GETOPTX_CHECK_FUNDAMENTALS
	/* fundamental assumptions
	 */

	assert(required_argument == 1);
	assert(FD_SETSIZE == 1024);
	assert(BYTE_PLANE_0(0) == 0);
	assert(BYTE_PLANE_0(255) == 255);
	assert(BYTE_PLANE_1(0) == 256);
	assert(BYTE_PLANE_1(255) == 256+255);
	assert(BYTE_PLANE_2(0) == 512);
	assert(BYTE_PLANE_2(255) == 512+255);
	assert(BYTE_PLANE_3(0) == 768);
	assert(BYTE_PLANE_3(255) == 768+255);
	assert(BYTE_PLANE_3(255) == FD_SETSIZE-1);
#endif

	/* sanity check
	 */

	assert(longopts);

	/* initialize
	 */

	memset(state, 0, sizeof(struct getopt_x));
	/* FD_ZERO(state->optset); */

	state->argc = argc;
	state->argv = argv;
	state->optstring0 = optstring;
	state->longopts = longopts;

	state->optreq = optreq;

	state->verbose = verbose;

	/* optstring
	 */

	if (verbose) {
		DEBUG("optstring=[%s]", optstring);
		DEBUG("optreq=[%s]", optreq);
	}

	assert(optstring_len < sizeof(state->optstring)-1);
	state->optstring[optstring_len++] = '-'; /* this turn non-option arguments swap off */

	assert(optstring_len < sizeof(state->optstring)-1);
	state->optstring[optstring_len++] = ':'; /* this diferentiates error from unknown option */

	if (optstring && *optstring) {
		int prior = 0;
		const char *cp = optstring;
		assert(isalnum(*cp));
		do {
			if (isalnum(*cp)) {
				if (FD_ISSET_IS_OPT(*cp, state->optset)) {
					DEBUG("error: duplicate option '%c' in optstring", *cp);
					return -1;
				}
				FD_SET_IS_OPT(*cp, state->optset);
				if (prior && prior != ':') {
					if (verbose) DEBUG("found short option -%c, has arg? 0", prior);
					state->n_short_options++;
				}

				assert(optstring0_alnum_len < sizeof(state->optstring0_alnum)-1);
				state->optstring0_alnum[optstring0_alnum_len++] = *cp;
			} else if (*cp == ':') {
				if (prior == ':') {
					/* optional arguments not allowed here, use
					 * ':' in return of getopt
					 */
					DEBUG("error: optional arguments not allowed in optstring");
					return -1;
				} else {
					if (verbose) DEBUG("found short option -%c, has arg? 1", prior);
					FD_SET_HAS_ARG(prior, state->optset);
					state->n_short_options++;
				}
			} else {
				if (isprint(*cp)) {
					DEBUG("error: invalid char '%c' (byte %i) in optstring", *cp, *cp);
				} else {
					DEBUG("error: invalid byte %i in optstring", *cp);
				}
				return -1;
			}

			assert(optstring_len < sizeof(state->optstring)-1);
			state->optstring[optstring_len++] = *cp;

			prior = *cp;
		} while (*++cp);

		if (verbose) {
			if (prior != ':') {
				DEBUG("found short option -%c, has arg? 0", prior);
				state->n_short_options++;
			}
		}
	}

	/* close state->optstring0_alnum
	 */

	state->optstring0_alnum[optstring0_alnum_len++] = 0;

	/* DEBUG("state->optstring0_alnum=[%s]", state->optstring0_alnum);
	 */

	/* state->longopts
	 */

	state->n_all_options = state->n_short_options;

	if (state->longopts->name) {
		struct option *opt = state->longopts;
		do {
			int namelen;
			if ((namelen = strlen(opt->name)) > state->longest_name_option) {
				state->longest_name_option = namelen;
			}
			if (opt->val) {
				assert(isalnum(opt->val));
				if (verbose) DEBUG("found long option -%c/--%s, has arg? %i", opt->val, opt->name, !!opt->has_arg);
				if (FD_ISSET_IS_OPT(opt->val, state->optset)) {
					DEBUG("error: duplicate option -%c/--%s in longopts", opt->val, opt->name);
					return -1;
				}
				FD_SET_IS_OPT(opt->val, state->optset);
				assert(optstring_len < sizeof(state->optstring)-1);
				state->optstring[optstring_len++] = opt->val;
				if (opt->has_arg) {
					assert(opt->has_arg == 1); /* optional arguments not allowed */
					assert(optstring_len < sizeof(state->optstring)-1);
					state->optstring[optstring_len++] = ':';
					FD_SET_HAS_ARG(opt->val, state->optset);
				}
			} else {
				if (opt->has_arg) {
					assert(opt->has_arg == 1); /* optional arguments not allowed */
				}
				if (verbose) DEBUG("found long option --%s, has arg? %i", opt->name, !!opt->has_arg);
			}
			state->n_all_options++;
			opt++;
		} while (opt->name);
	}

	/* close state->optstring
	 */

	state->optstring[optstring_len++] = 0;

	/* optreq
	 */

	if (optreq && *optreq) {
		const char *cp = optreq;
		do {
			if (isalnum(*cp)) {
				if (!FD_ISSET_IS_OPT(*cp, state->optset)) {
					DEBUG("error: unknown option '%c' in optstring", *cp);
					return -1;
				}
				if (FD_ISSET_IS_REQUIRED(*cp, state->optset)) {
					DEBUG("error: duplicate option '%c' in optreq", *cp);
					return -1;
				}
				FD_SET_IS_REQUIRED(*cp, state->optset);
			} else {
				if (isprint(*cp)) {
					DEBUG("error: invalid char '%c' (byte %i) in optreq", *cp, *cp);
				} else {
					DEBUG("error: invalid byte %i in optreq", *cp);
				}
				return -1;
			}
		} while (*++cp);
	}

	{
		int i = state->longest_name_option + 4;
		snprintf(state->fmt_both, sizeof(state->fmt_both), ", --%%-%is", i + 6);
		snprintf(state->fmt_long, sizeof(state->fmt_long), "--%%-%is", i + 8);
		snprintf(state->fmt_short, sizeof(state->fmt_short), " %%-%is", i + 9);
	}

	/*
	 */

	if (verbose) DEBUG("state->optstring=[%s]", state->optstring);

#ifdef OPTSET_VERIFY
	optset_verify(state->optset);
#endif
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, -0x38(%rbp)
movq %rdx, -0x30(%rbp)
leaq 0x5c72(%rip), %rax      # 0x86d0
movl $0x0, (%rax)
testq %r8, %r8
je 0x3102
movq %r8, %r12
movq %rcx, %r15
movl %esi, %r14d
movq %rdi, %rbx
movl 0x10(%rbp), %r13d
movl $0x208, %edx            # imm = 0x208
xorl %esi, %esi
callq 0x1170
movl %r14d, (%rbx)
movq -0x30(%rbp), %rax
movq %rax, 0x8(%rbx)
movq %r15, 0x10(%rbx)
movq %r12, 0x18(%rbx)
movq -0x38(%rbp), %r12
movq %r12, 0x20(%rbx)
movl %r13d, 0x110(%rbx)
testl %r13d, %r13d
je 0x2ae9
leaq 0x2e40(%rip), %r14      # 0x58f7
leaq 0x345b(%rip), %rdx      # 0x5f19
movq %r14, %rdi
movl $0x84, %esi
movq %r15, %rcx
xorl %eax, %eax
callq 0x4228
leaq 0x318c(%rip), %rdx      # 0x5c63
movq %r14, %rdi
movl $0x85, %esi
movq %r12, %rcx
xorl %eax, %eax
callq 0x4228
movw $0x3a2d, 0x28(%rbx)     # imm = 0x3A2D
movl $0x2, %r14d
testq %r15, %r15
je 0x2c90
movsbq (%r15), %r12
testq %r12, %r12
movl $0x0, %edi
je 0x2c92
callq 0x1260
movq (%rax), %rcx
testb $0x8, (%rcx,%r12,2)
je 0x3121
xorl %r14d, %r14d
xorl %edi, %edi
xorl %r13d, %r13d
movq %rax, -0x30(%rbp)
movq (%rax), %rsi
movsbl %r12b, %ecx
movsbq %cl, %rdx
movzwl (%rsi,%rdx,2), %edx
testb $0x8, %dl
jne 0x2baa
cmpb $0x3a, %r12b
jne 0x2f6a
cmpl $0x3a, %r13d
je 0x2f85
cmpl $0x0, 0x10(%rbp)
je 0x2b84
movl %edi, %r12d
leaq 0x2d90(%rip), %rdi      # 0x58f7
movl $0xa8, %esi
leaq 0x31ed(%rip), %rdx      # 0x5d60
movl %r13d, %ecx
xorl %eax, %eax
callq 0x4228
movq -0x30(%rbp), %rax
movl %r12d, %edi
movl $0x1, %edx
movl %r13d, %ecx
shlq %cl, %rdx
shrl $0x3, %r13d
andl $0x18, %r13d
orq %rdx, 0xb0(%rbx,%r13)
incl 0x180(%rbx)
jmp 0x2c30
movl %ecx, %r8d
shrl $0x6, %r8d
andl $0x3, %r8d
movq 0x90(%rbx,%r8,8), %rdx
movl $0x1, %esi
shlq %cl, %rsi
btq %rcx, %rdx
jb 0x2f55
orq %rsi, %rdx
movq %rdx, 0x90(%rbx,%r8,8)
testl %r13d, %r13d
je 0x2c18
cmpl $0x3a, %r13d
je 0x2c18
cmpl $0x0, 0x10(%rbp)
je 0x2c12
movl %edi, %r12d
leaq 0x2d02(%rip), %rdi      # 0x58f7
movl $0x9a, %esi
leaq 0x30d0(%rip), %rdx      # 0x5cd1
movl %r13d, %ecx
xorl %eax, %eax
callq 0x4228
movq -0x30(%rbp), %rax
movl %r12d, %edi
incl 0x180(%rbx)
cmpl $0x63, %edi
jae 0x30e3
movl %edi, %edx
movb (%r15,%r14), %cl
incl %edi
movb %cl, 0x11c(%rbx,%rdx)
cmpq $0x61, %r14
je 0x3067
movsbl (%r15,%r14), %r13d
movb %r13b, 0x2a(%rbx,%r14)
movb 0x1(%r15,%r14), %r12b
incq %r14
testb %r12b, %r12b
jne 0x2b2f
addq $0x2, %r14
cmpl $0x0, 0x10(%rbp)
je 0x2c92
cmpb $0x3a, %r13b
je 0x2c92
movl %edi, %r15d
leaq 0x2c88(%rip), %rdi      # 0x58f7
leaq 0x305b(%rip), %rdx      # 0x5cd1
movl $0xbd, %esi
movl %r13d, %ecx
xorl %eax, %eax
callq 0x4228
movl %r15d, %edi
incl 0x180(%rbx)
jmp 0x2c92
xorl %edi, %edi
leaq 0x28(%rbx), %rax
movq %rax, -0x30(%rbp)
movslq %edi, %rax
movb $0x0, 0x11c(%rbx,%rax)
movl 0x180(%rbx), %eax
movl %eax, 0x184(%rbx)
movq 0x18(%rbx), %r15
movq (%r15), %r13
testq %r13, %r13
je 0x2e09
addq $0x20, %r15
movq %r13, %rdi
callq 0x10e0
cmpl %eax, 0x188(%rbx)
jge 0x2cdb
movl %eax, 0x188(%rbx)
movslq -0x8(%r15), %r12
testq %r12, %r12
je 0x2dba
callq 0x1260
movq (%rax), %rax
testb $0x8, (%rax,%r12,2)
je 0x3029
cmpl $0x0, 0x10(%rbp)
je 0x2d31
xorl %r9d, %r9d
cmpl $0x0, -0x18(%r15)
setne %r9b
leaq 0x2be3(%rip), %rdi      # 0x58f7
movl $0xd9, %esi
leaq 0x30b7(%rip), %rdx      # 0x5dd7
movl %r12d, %ecx
movq %r13, %r8
xorl %eax, %eax
callq 0x4228
movl -0x8(%r15), %r12d
movl %r12d, %eax
shrl $0x6, %eax
andl $0x3, %eax
movq 0x90(%rbx,%rax,8), %rdx
movl $0x1, %esi
movl %r12d, %ecx
shlq %cl, %rsi
btq %r12, %rdx
jb 0x2f2f
orq %rdx, %rsi
movq %rsi, 0x90(%rbx,%rax,8)
cmpl $0x63, %r14d
jae 0x3048
movl %r14d, %eax
movq -0x30(%rbp), %rcx
movb %r12b, (%rcx,%rax)
incq %rax
movl -0x18(%r15), %ecx
testl %ecx, %ecx
je 0x2dee
cmpl $0x1, %ecx
jne 0x30a5
cmpl $0x62, %r14d
je 0x30c4
movb $0x3a, 0x28(%rbx,%rax)
movl -0x8(%r15), %ecx
movl $0x1, %eax
shlq %cl, %rax
addl $0x2, %r14d
shrl $0x3, %ecx
andl $0x18, %ecx
orq %rax, 0xb0(%rbx,%rcx)
jmp 0x2deb
movl -0x18(%r15), %r8d
cmpl $0x2, %r8d
jae 0x3086
cmpl $0x0, 0x10(%rbp)
je 0x2deb
leaq 0x2b22(%rip), %rdi      # 0x58f7
movl $0xeb, %esi
leaq 0x305d(%rip), %rdx      # 0x5e3e
movq %r13, %rcx
xorl %eax, %eax
callq 0x4228
movl %r14d, %eax
incl 0x184(%rbx)
movq (%r15), %r13
addq $0x20, %r15
movl %eax, %r14d
testq %r13, %r13
jne 0x2cc5
jmp 0x2e0c
movl %r14d, %eax
cltq
movq -0x30(%rbp), %rcx
movb $0x0, (%rcx,%rax)
movq -0x38(%rbp), %r15
testq %r15, %r15
je 0x2e93
movb (%r15), %r14b
testb %r14b, %r14b
je 0x2e93
callq 0x1260
movq (%rax), %rax
incq %r15
movsbl %r14b, %ecx
movsbq %cl, %rdx
movzwl (%rax,%rdx,2), %edx
testb $0x8, %dl
je 0x2fa1
movl %ecx, %edx
shrl $0x6, %edx
andl $0x3, %edx
movq 0x90(%rbx,%rdx,8), %rdi
movl $0x1, %esi
shlq %cl, %rsi
btq %rcx, %rdi
jae 0x2fbc
orl $0x8, %edx
movq 0x90(%rbx,%rdx,8), %rdi
testq %rsi, %rdi
jne 0x2fd1
orq %rsi, %rdi
movq %rdi, 0x90(%rbx,%rdx,8)
movb (%r15), %r14b
incq %r15
testb %r14b, %r14b
jne 0x2e32
movl 0x188(%rbx), %r12d
leaq 0x1b4(%rbx), %rdi
leal 0xa(%r12), %ecx
leaq 0x3052(%rip), %rdx      # 0x5eff
xorl %r14d, %r14d
movl $0x28, %esi
xorl %eax, %eax
callq 0x1110
leaq 0x18c(%rbx), %rdi
leal 0xc(%r12), %ecx
leaq 0x3032(%rip), %rdx      # 0x5f01
movl $0x28, %esi
xorl %eax, %eax
callq 0x1110
addq $0x1dc, %rbx            # imm = 0x1DC
addl $0xd, %r12d
leaq 0x301d(%rip), %rdx      # 0x5f0a
movl $0x28, %esi
movq %rbx, %rdi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x1110
cmpl $0x0, 0x10(%rbp)
je 0x3017
leaq 0x29e7(%rip), %rdi      # 0x58f7
leaq 0x2ffb(%rip), %rdx      # 0x5f12
xorl %r14d, %r14d
movl $0x11c, %esi            # imm = 0x11C
movq -0x30(%rbp), %rcx
xorl %eax, %eax
callq 0x4228
jmp 0x3017
movq -0x20(%r15), %r8
leaq 0x29bd(%rip), %rdi      # 0x58f7
leaq 0x2ebe(%rip), %rdx      # 0x5dff
movl $0xdb, %esi
movl %r12d, %ecx
xorl %eax, %eax
callq 0x4228
jmp 0x3011
leaq 0x299b(%rip), %rdi      # 0x58f7
leaq 0x2d44(%rip), %rdx      # 0x5ca7
movl $0x95, %esi
jmp 0x2fe4
leaq 0x2986(%rip), %rdi      # 0x58f7
btl $0xe, %edx
jb 0x2fed
leaq 0x2e35(%rip), %rdx      # 0x5db3
movl $0xb0, %esi
jmp 0x2fe4
leaq 0x296b(%rip), %rdi      # 0x58f7
leaq 0x2d9a(%rip), %rdx      # 0x5d2d
movl $0xa5, %esi
xorl %eax, %eax
callq 0x4228
jmp 0x3011
leaq 0x294f(%rip), %rdi      # 0x58f7
btl $0xe, %edx
jb 0x2ffb
leaq 0x2f29(%rip), %rdx      # 0x5ede
movl $0x10b, %esi            # imm = 0x10B
jmp 0x2fe4
leaq 0x2934(%rip), %rdi      # 0x58f7
leaq 0x2e98(%rip), %rdx      # 0x5e62
movl $0xff, %esi
jmp 0x2fe4
leaq 0x291f(%rip), %rdi      # 0x58f7
leaq 0x2eab(%rip), %rdx      # 0x5e8a
movl $0x103, %esi            # imm = 0x103
xorl %eax, %eax
callq 0x4228
jmp 0x3011
leaq 0x2d8f(%rip), %rdx      # 0x5d83
movl $0xae, %esi
jmp 0x3007
leaq 0x2eaf(%rip), %rdx      # 0x5eb1
movl $0x109, %esi            # imm = 0x109
movl %ecx, %r8d
xorl %eax, %eax
callq 0x4228
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl %r14d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x29ea(%rip), %rdi      # 0x5a1a
leaq 0x28c0(%rip), %rsi      # 0x58f7
leaq 0x2bb7(%rip), %rcx      # 0x5bf5
movl $0xd8, %edx
callq 0x1140
leaq 0x2c20(%rip), %rdi      # 0x5c6f
leaq 0x28a1(%rip), %rsi      # 0x58f7
leaq 0x2b98(%rip), %rcx      # 0x5bf5
movl $0xdf, %edx
callq 0x1140
leaq 0x2c01(%rip), %rdi      # 0x5c6f
leaq 0x2882(%rip), %rsi      # 0x58f7
leaq 0x2b79(%rip), %rcx      # 0x5bf5
movl $0xb5, %edx
callq 0x1140
leaq 0x2d9f(%rip), %rdi      # 0x5e2c
leaq 0x2863(%rip), %rsi      # 0x58f7
leaq 0x2b5a(%rip), %rcx      # 0x5bf5
movl $0xe9, %edx
callq 0x1140
leaq 0x2d80(%rip), %rdi      # 0x5e2c
leaq 0x2844(%rip), %rsi      # 0x58f7
leaq 0x2b3b(%rip), %rcx      # 0x5bf5
movl $0xe2, %edx
callq 0x1140
leaq 0x2ba4(%rip), %rdi      # 0x5c6f
leaq 0x2825(%rip), %rsi      # 0x58f7
leaq 0x2b1c(%rip), %rcx      # 0x5bf5
movl $0xe3, %edx
callq 0x1140
leaq 0x2c0a(%rip), %rdi      # 0x5cf4
leaq 0x2806(%rip), %rsi      # 0x58f7
leaq 0x2afd(%rip), %rcx      # 0x5bf5
movl $0x9e, %edx
callq 0x1140
leaq 0x2d1a(%rip), %rdi      # 0x5e23
leaq 0x27e7(%rip), %rsi      # 0x58f7
leaq 0x2ade(%rip), %rcx      # 0x5bf5
movl $0x6f, %edx
callq 0x1140
leaq 0x2b72(%rip), %rdi      # 0x5c9a
leaq 0x27c8(%rip), %rsi      # 0x58f7
leaq 0x2abf(%rip), %rcx      # 0x5bf5
movl $0x91, %edx
callq 0x1140