// File: /workspace/github_c_makefile_star2_O3/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, %r15
movq %r8, (%rsp)
movq %rcx, %r13
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 0x514f
movq %r14, 0x8(%rbx)
jmp 0x517b
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
incl %eax
cmpq $0x0, 0x10(%rbx,%rax,8)
jne 0x5154
cmpl $0x64, %eax
jae 0x5390
movl %eax, %ecx
incl %ecx
movq %r14, 0x10(%rbx,%rax,8)
movl %ecx, %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 %r12, 0x8(%r14)
movq %rbp, 0x10(%r14)
movq %r15, 0x680(%r14)
movq %rdi, 0x688(%r14)
movq %rsi, 0x690(%r14)
movq %rdx, 0x698(%r14)
movq %rcx, 0x6a0(%r14)
movq %rax, 0x6a8(%r14)
xorl %r15d, %r15d
movq %r15, 0x18(%r14)
movq %r15, 0x340(%r14)
movq %r15, 0x678(%r14)
testq %r13, %r13
je 0x51fa
cmpb $0x0, (%r13)
je 0x51f7
movq %r13, %rdi
callq 0x3570
movq %rax, %r15
jmp 0x51fa
xorl %r15d, %r15d
movq %r15, 0x668(%r14)
xorl %r12d, %r12d
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x5219
cmpb $0x0, (%rdi)
je 0x5219
callq 0x3570
jmp 0x521b
xorl %eax, %eax
movq %rax, 0x670(%r14)
testq %r15, %r15
je 0x5281
cmpb $0x0, (%r15)
je 0x5277
xorl %r12d, %r12d
movq %r15, 0x18(%r14,%r12,8)
movq $0x0, 0x20(%r14,%r12,8)
cmpq $0x63, %r12
je 0x5352
incq %r12
movzbl (%r15), %eax
testl %eax, %eax
je 0x5271
cmpl $0x2c, %eax
je 0x525d
incq %r15
jmp 0x524b
movq %r15, %rcx
leaq 0x1(%rcx), %r15
movb $0x0, (%rcx)
movb 0x1(%rcx), %al
movq %r15, %rcx
cmpb $0x2c, %al
je 0x5260
testb %al, %al
jne 0x5230
jmp 0x527a
xorl %r12d, %r12d
movq 0x670(%r14), %rax
movl %r12d, 0x678(%r14)
testq %rax, %rax
je 0x52e1
cmpb $0x0, (%rax)
je 0x52e5
xorl %ecx, %ecx
movq %rax, 0x340(%r14,%rcx,8)
movq $0x0, 0x348(%r14,%rcx,8)
cmpq $0x63, %rcx
je 0x5371
incq %rcx
movzbl (%rax), %edx
testl %edx, %edx
je 0x52db
cmpl $0x2c, %edx
je 0x52c6
incq %rax
jmp 0x52b5
movq %rax, %rsi
leaq 0x1(%rsi), %rax
movb $0x0, (%rsi)
movb 0x1(%rsi), %dl
movq %rax, %rsi
cmpb $0x2c, %dl
je 0x52c9
testb %dl, %dl
jne 0x5294
jmp 0x52e7
xorl %ecx, %ecx
jmp 0x52ee
xorl %ecx, %ecx
movl 0x678(%r14), %r12d
addl %ecx, %r12d
movl %r12d, 0x67c(%r14)
movl $0x0, 0x340(%rbx)
movq 0x10(%rbx), %rax
testq %rax, %rax
je 0x5340
xorl %r15d, %r15d
movl $0x1, %ebp
movq 0x8(%rax), %rdi
testq %rdi, %rdi
je 0x5332
callq 0x3190
movl %r15d, %ecx
cmpq %rcx, %rax
jbe 0x5332
movl %eax, 0x340(%rbx)
movl %eax, %r15d
movl %ebp, %eax
movq 0x10(%rbx,%rax,8), %rax
incl %ebp
testq %rax, %rax
jne 0x5313
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xf071(%rip), %rdi      # 0x143ca
leaq 0xefe2(%rip), %rsi      # 0x14342
leaq 0xefe5(%rip), %rcx      # 0x1434c
movl $0xd0, %edx
callq 0x3200
leaq 0xf052(%rip), %rdi      # 0x143ca
leaq 0xefc3(%rip), %rsi      # 0x14342
leaq 0xefc6(%rip), %rcx      # 0x1434c
movl $0xdc, %edx
callq 0x3200
leaq 0xef8f(%rip), %rdi      # 0x14326
leaq 0xefa4(%rip), %rsi      # 0x14342
leaq 0xefa7(%rip), %rcx      # 0x1434c
movl $0xab, %edx
callq 0x3200