// File: /workspace/github_c_makefile_star2_O2/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, %r15
movq %rdx, %rbp
movq %rsi, %r12
movq %rdi, %rbx
movl $0x8b0, %edi            # imm = 0x8B0
callq 0x33b0
movq %rax, %r14
movq %r12, %rax
orq %rbp, %rax
jne 0x5064
movq %r14, 0x8(%rbx)
jmp 0x508b
pushq $-0x1
popq %rax
incl %eax
cmpq $0x0, 0x10(%rbx,%rax,8)
jne 0x5067
cmpl $0x64, %eax
jae 0x5269
movl %eax, %ecx
incl %ecx
movq %r14, 0x10(%rbx,%rax,8)
movl %ecx, %eax
andq $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 %r12, 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)
andq $0x0, 0x18(%r14)
andq $0x0, 0x340(%r14)
andq $0x0, 0x678(%r14)
testq %r15, %r15
je 0x5106
cmpb $0x0, (%r15)
je 0x5106
movq %r15, %rdi
callq 0x3570
movq %rax, %r15
jmp 0x5109
xorl %r15d, %r15d
movq %r15, 0x668(%r14)
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x5125
cmpb $0x0, (%rdi)
je 0x5125
callq 0x3570
jmp 0x5127
xorl %eax, %eax
movq %rax, 0x670(%r14)
xorl %eax, %eax
testq %r15, %r15
je 0x5177
cmpb $0x0, (%r15)
je 0x5177
movq %r15, 0x18(%r14,%rax,8)
andq $0x0, 0x20(%r14,%rax,8)
cmpq $0x63, %rax
je 0x522b
incq %rax
movzbl (%r15), %ecx
cmpl $0x2c, %ecx
je 0x5170
testl %ecx, %ecx
je 0x5170
incq %r15
jmp 0x5153
movb $0x0, (%r15)
movb 0x1(%r15), %cl
incq %r15
cmpb $0x2c, %cl
je 0x5165
jmp 0x5130
movl %eax, 0x678(%r14)
movq 0x670(%r14), %rcx
xorl %eax, %eax
testq %rcx, %rcx
je 0x51d0
cmpb $0x0, (%rcx)
je 0x51d0
movq %rcx, 0x340(%r14,%rax,8)
andq $0x0, 0x348(%r14,%rax,8)
cmpq $0x63, %rax
je 0x524a
incq %rax
movzbl (%rcx), %edx
cmpl $0x2c, %edx
je 0x51c9
testl %edx, %edx
je 0x51c9
incq %rcx
jmp 0x51af
movb $0x0, (%rcx)
movb 0x1(%rcx), %dl
incq %rcx
cmpb $0x2c, %dl
je 0x51c0
jmp 0x5187
addl 0x678(%r14), %eax
movl %eax, 0x67c(%r14)
andl $0x0, 0x340(%rbx)
xorl %r15d, %r15d
xorl %ebp, %ebp
movl %ebp, %eax
movq 0x10(%rbx,%rax,8), %rax
testq %rax, %rax
je 0x5219
movq 0x8(%rax), %rdi
testq %rdi, %rdi
je 0x5215
callq 0x3190
movl %r15d, %ecx
cmpq %rcx, %rax
jbe 0x5215
movl %eax, 0x340(%rbx)
movl %eax, %r15d
incl %ebp
jmp 0x51ea
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xe1aa(%rip), %rdi      # 0x133dc
leaq 0xe11b(%rip), %rsi      # 0x13354
leaq 0xe11e(%rip), %rcx      # 0x1335e
movl $0xd0, %edx
callq 0x3200
leaq 0xe18b(%rip), %rdi      # 0x133dc
leaq 0xe0fc(%rip), %rsi      # 0x13354
leaq 0xe0ff(%rip), %rcx      # 0x1335e
movl $0xdc, %edx
callq 0x3200
leaq 0xe0c8(%rip), %rdi      # 0x13338
leaq 0xe0dd(%rip), %rsi      # 0x13354
leaq 0xe0e0(%rip), %rcx      # 0x1335e
movl $0xab, %edx
callq 0x3200