// File: /workspace/github_c_makefile_star2_O1/j-hoppe[P]tu58fs/getopt2.c
// Function: getopt_def
getopt_option_descr_t	*getopt_def(getopt_t *_this,
	char	*short_option_name,
	char	*long_option_name,
	char	*fix_args_csv,
	char	*opt_args_csv,
	char	*default_args,
	char	*info,
	char	*example_simple_cline, char *example_simple_info,
	char	*example_complex_cline, char *example_complex_info
	)
{
	getopt_option_descr_t	*res, *odesc;
	unsigned	i, argc;
	char	*rp; // read pointer

	if (short_option_name == NULL && long_option_name == NULL) {
		// non-option commandline arg
		res = _this->nonoption_descr = (getopt_option_descr_t *)malloc(sizeof(getopt_option_descr_t));
	}
	else {
		// instantiate new option descr
		res = (getopt_option_descr_t *)malloc(sizeof(getopt_option_descr_t));
		// add this option description to global list
		for (i = 0; _this->option_descrs[i]; i++); // find end of list
		assert(i < GETOPT_MAX_OPTION_DESCR);
		_this->option_descrs[i++] = res;
		_this->option_descrs[i] = NULL;
	}
	res->parent = _this ; // uplink
	res->short_name = short_option_name;
	res->long_name = long_option_name;
	res->default_args = default_args;
	res->info = info;
	res->example_simple_cline_args = example_simple_cline;
	res->example_simple_info = example_simple_info;
	res->example_complex_cline_args = example_complex_cline;
	res->example_complex_info = example_complex_info;

	res->fix_args[0] = NULL;
	res->var_args[0] = NULL;
	res->fix_arg_count = 0;
	res->max_arg_count = 0;

	// separate name lists

	// get own copies of argument name list
	if (fix_args_csv && strlen(fix_args_csv))
		res->fix_args_name_buff = strdup(fix_args_csv);
	else res->fix_args_name_buff = NULL;

	if (opt_args_csv && strlen(opt_args_csv))
		res->var_args_name_buff = strdup(opt_args_csv);
	else res->var_args_name_buff = NULL;

	// separate
	// i counts chars, argc counts arguments
	rp = res->fix_args_name_buff;
	argc = 0;
	while (rp && *rp) {
		res->fix_args[argc++] = rp; 		// start of arg name
		res->fix_args[argc] = NULL;
		assert(argc < GETOPT_MAX_OPTION_ARGS);
		while (*rp && *rp != ',') rp++; // skip arg name
		while (*rp && *rp == ',') *rp++ = 0; // terminate arg name
	}
	res->fix_arg_count = argc;

	// same for opt args
	rp = res->var_args_name_buff;
	argc = 0;
	while (rp && *rp) {
		res->var_args[argc++] = rp; 		// start of arg name
		res->var_args[argc] = NULL;
		assert(argc < GETOPT_MAX_OPTION_ARGS);
		while (*rp && *rp != ',') rp++; // skip arg name
		while (*rp && *rp == ',') *rp++ = 0; // terminate arg name
	}
	res->max_arg_count = res->fix_arg_count + argc;

	// calc global maximum of short_names
	_this->max_short_name_len = 0 ;
	// determine longest "short_name"
	for (i = 0; (odesc = _this->option_descrs[i]); i++)
		if (odesc->short_name && strlen(odesc->short_name) > _this->max_short_name_len)
			_this->max_short_name_len = strlen(odesc->short_name) ;

	return res;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, %r13
movq %r8, (%rsp)
movq %rcx, %r12
movq %rdx, %rbp
movq %rsi, %r15
movq %rdi, %rbx
movl $0x8b0, %edi            # imm = 0x8B0
callq 0x33c0
movq %rax, %r14
movq %r15, %rax
orq %rbp, %rax
jne 0x5153
movq %r14, 0x8(%rbx)
jmp 0x517d
xorl %eax, %eax
movl %eax, %ecx
incl %eax
cmpq $0x0, 0x10(%rbx,%rcx,8)
jne 0x5155
leal -0x1(%rax), %edx
cmpl $0x64, %edx
jae 0x5394
movq %r14, 0x10(%rbx,%rcx,8)
movl %eax, %eax
movq $0x0, 0x10(%rbx,%rax,8)
movq 0x60(%rsp), %rax
movq 0x58(%rsp), %rcx
movq 0x50(%rsp), %rdx
movq 0x48(%rsp), %rsi
movq 0x40(%rsp), %rdi
movq %rbx, (%r14)
movq %r15, 0x8(%r14)
movq %rbp, 0x10(%r14)
movq %r13, 0x680(%r14)
movq %rdi, 0x688(%r14)
movq %rsi, 0x690(%r14)
movq %rdx, 0x698(%r14)
movq %rcx, 0x6a0(%r14)
movq %rax, 0x6a8(%r14)
xorl %eax, %eax
movq %rax, 0x18(%r14)
movq %rax, 0x340(%r14)
movq %rax, 0x678(%r14)
testq %r12, %r12
je 0x51f7
cmpb $0x0, (%r12)
je 0x51f5
movq %r12, %rdi
callq 0x3580
jmp 0x51f7
xorl %eax, %eax
movq %rax, 0x668(%r14)
xorl %r15d, %r15d
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x5216
cmpb $0x0, (%rdi)
je 0x5216
callq 0x3580
jmp 0x5218
xorl %eax, %eax
movq %rax, 0x670(%r14)
movq 0x668(%r14), %rax
testq %rax, %rax
je 0x5281
cmpb $0x0, (%rax)
je 0x5281
xorl %r15d, %r15d
movq %rax, 0x18(%r14,%r15,8)
movq $0x0, 0x20(%r14,%r15,8)
cmpq $0x63, %r15
je 0x5356
incq %r15
movzbl (%rax), %ecx
testl %ecx, %ecx
je 0x525f
cmpl $0x2c, %ecx
je 0x525f
incq %rax
jmp 0x524e
cmpb $0x2c, (%rax)
jne 0x5276
leaq 0x1(%rax), %rcx
movb $0x0, (%rax)
cmpb $0x2c, 0x1(%rax)
movq %rcx, %rax
je 0x5264
jmp 0x5279
movq %rax, %rcx
cmpb $0x0, (%rcx)
movq %rcx, %rax
jne 0x5233
movl %r15d, 0x678(%r14)
movq 0x670(%r14), %rcx
xorl %eax, %eax
testq %rcx, %rcx
je 0x52f1
cmpb $0x0, (%rcx)
je 0x52f1
xorl %eax, %eax
movq %rcx, 0x340(%r14,%rax,8)
movq $0x0, 0x348(%r14,%rax,8)
cmpq $0x63, %rax
je 0x5375
incq %rax
movzbl (%rcx), %edx
testl %edx, %edx
je 0x52cf
cmpl $0x2c, %edx
je 0x52cf
incq %rcx
jmp 0x52be
cmpb $0x2c, (%rcx)
jne 0x52e6
leaq 0x1(%rcx), %rdx
movb $0x0, (%rcx)
cmpb $0x2c, 0x1(%rcx)
movq %rdx, %rcx
je 0x52d4
jmp 0x52e9
movq %rcx, %rdx
cmpb $0x0, (%rdx)
movq %rdx, %rcx
jne 0x529d
addl 0x678(%r14), %eax
movl %eax, 0x67c(%r14)
movl $0x0, 0x340(%rbx)
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0x5344
movl $0x1, %ebp
movq 0x8(%rax), %rdi
testq %rdi, %rdi
je 0x5336
callq 0x31a0
movl 0x340(%rbx), %ecx
cmpq %rcx, %rax
jbe 0x5336
movl %eax, 0x340(%rbx)
movl %ebp, %eax
movq 0x10(%rbx,%rax,8), %rax
incl %ebp
testq %rax, %rax
jne 0x5317
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xf06d(%rip), %rdi      # 0x143ca
leaq 0xefde(%rip), %rsi      # 0x14342
leaq 0xefe1(%rip), %rcx      # 0x1434c
movl $0xd0, %edx
callq 0x3210
leaq 0xf04e(%rip), %rdi      # 0x143ca
leaq 0xefbf(%rip), %rsi      # 0x14342
leaq 0xefc2(%rip), %rcx      # 0x1434c
movl $0xdc, %edx
callq 0x3210
leaq 0xef8b(%rip), %rdi      # 0x14326
leaq 0xefa0(%rip), %rsi      # 0x14342
leaq 0xefa3(%rip), %rcx      # 0x1434c
movl $0xab, %edx
callq 0x3210