// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x60, %rsp
movq 0x30(%rbp), %rax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
movq %r9, -0x30(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x599d
cmpq $0x0, -0x18(%rbp)
jne 0x599d
movl $0x8b0, %edi            # imm = 0x8B0
callq 0x33a0
movq -0x8(%rbp), %rcx
movq %rax, 0x8(%rcx)
movq %rax, -0x38(%rbp)
jmp 0x5a1f
movl $0x8b0, %edi            # imm = 0x8B0
callq 0x33a0
movq %rax, -0x38(%rbp)
movl $0x0, -0x44(%rbp)
movq -0x8(%rbp), %rax
movl -0x44(%rbp), %ecx
cmpq $0x0, 0x10(%rax,%rcx,8)
je 0x59ce
jmp 0x59c3
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x59b2
cmpl $0x64, -0x44(%rbp)
jae 0x59d6
jmp 0x59f5
leaq 0x1592f(%rip), %rdi     # 0x1b30c
leaq 0x15944(%rip), %rsi     # 0x1b328
movl $0xab, %edx
leaq 0x15942(%rip), %rcx     # 0x1b332
callq 0x3200
movq -0x38(%rbp), %rdx
movq -0x8(%rbp), %rax
movl -0x44(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x44(%rbp)
movl %ecx, %ecx
movq %rdx, 0x10(%rax,%rcx,8)
movq -0x8(%rbp), %rax
movl -0x44(%rbp), %ecx
movq $0x0, 0x10(%rax,%rcx,8)
movq -0x8(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x680(%rax)
movq 0x10(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x688(%rax)
movq 0x18(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x690(%rax)
movq 0x20(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x698(%rax)
movq 0x28(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x6a0(%rax)
movq 0x30(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x6a8(%rax)
movq -0x38(%rbp), %rax
movq $0x0, 0x18(%rax)
movq -0x38(%rbp), %rax
movq $0x0, 0x340(%rax)
movq -0x38(%rbp), %rax
movl $0x0, 0x678(%rax)
movq -0x38(%rbp), %rax
movl $0x0, 0x67c(%rax)
cmpq $0x0, -0x20(%rbp)
je 0x5b02
movq -0x20(%rbp), %rdi
callq 0x3190
cmpq $0x0, %rax
je 0x5b02
movq -0x20(%rbp), %rdi
callq 0x3560
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x668(%rax)
jmp 0x5b11
movq -0x38(%rbp), %rax
movq $0x0, 0x668(%rax)
cmpq $0x0, -0x28(%rbp)
je 0x5b40
movq -0x28(%rbp), %rdi
callq 0x3190
cmpq $0x0, %rax
je 0x5b40
movq -0x28(%rbp), %rdi
callq 0x3560
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x670(%rax)
jmp 0x5b4f
movq -0x38(%rbp), %rax
movq $0x0, 0x670(%rax)
movq -0x38(%rbp), %rax
movq 0x668(%rax), %rax
movq %rax, -0x50(%rbp)
movl $0x0, -0x48(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x50(%rbp)
movb %al, -0x51(%rbp)
je 0x5b81
movq -0x50(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x51(%rbp)
movb -0x51(%rbp), %al
testb $0x1, %al
jne 0x5b8d
jmp 0x5c5d
movq -0x50(%rbp), %rdx
movq -0x38(%rbp), %rax
movl -0x48(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x48(%rbp)
movl %ecx, %ecx
movq %rdx, 0x18(%rax,%rcx,8)
movq -0x38(%rbp), %rax
movl -0x48(%rbp), %ecx
movq $0x0, 0x18(%rax,%rcx,8)
cmpl $0x64, -0x48(%rbp)
jae 0x5bbf
jmp 0x5bde
leaq 0x157ea(%rip), %rdi     # 0x1b3b0
leaq 0x1575b(%rip), %rsi     # 0x1b328
movl $0xd0, %edx
leaq 0x15759(%rip), %rcx     # 0x1b332
callq 0x3200
jmp 0x5be0
movq -0x50(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x52(%rbp)
je 0x5c01
movq -0x50(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2c, %eax
setne %al
movb %al, -0x52(%rbp)
movb -0x52(%rbp), %al
testb $0x1, %al
jne 0x5c0a
jmp 0x5c18
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x5be0
jmp 0x5c1a
movq -0x50(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x53(%rbp)
je 0x5c3b
movq -0x50(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2c, %eax
sete %al
movb %al, -0x53(%rbp)
movb -0x53(%rbp), %al
testb $0x1, %al
jne 0x5c44
jmp 0x5c58
movq -0x50(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x50(%rbp)
movb $0x0, (%rax)
jmp 0x5c1a
jmp 0x5b65
movl -0x48(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x678(%rax)
movq -0x38(%rbp), %rax
movq 0x670(%rax), %rax
movq %rax, -0x50(%rbp)
movl $0x0, -0x48(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x50(%rbp)
movb %al, -0x54(%rbp)
je 0x5c9c
movq -0x50(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
setne %al
movb %al, -0x54(%rbp)
movb -0x54(%rbp), %al
testb $0x1, %al
jne 0x5ca8
jmp 0x5d7e
movq -0x50(%rbp), %rdx
movq -0x38(%rbp), %rax
movl -0x48(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x48(%rbp)
movl %ecx, %ecx
movq %rdx, 0x340(%rax,%rcx,8)
movq -0x38(%rbp), %rax
movl -0x48(%rbp), %ecx
movq $0x0, 0x340(%rax,%rcx,8)
cmpl $0x64, -0x48(%rbp)
jae 0x5ce0
jmp 0x5cff
leaq 0x156c9(%rip), %rdi     # 0x1b3b0
leaq 0x1563a(%rip), %rsi     # 0x1b328
movl $0xdc, %edx
leaq 0x15638(%rip), %rcx     # 0x1b332
callq 0x3200
jmp 0x5d01
movq -0x50(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x55(%rbp)
je 0x5d22
movq -0x50(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2c, %eax
setne %al
movb %al, -0x55(%rbp)
movb -0x55(%rbp), %al
testb $0x1, %al
jne 0x5d2b
jmp 0x5d39
movq -0x50(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x5d01
jmp 0x5d3b
movq -0x50(%rbp), %rax
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x56(%rbp)
je 0x5d5c
movq -0x50(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x2c, %eax
sete %al
movb %al, -0x56(%rbp)
movb -0x56(%rbp), %al
testb $0x1, %al
jne 0x5d65
jmp 0x5d79
movq -0x50(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x50(%rbp)
movb $0x0, (%rax)
jmp 0x5d3b
jmp 0x5c80
movq -0x38(%rbp), %rax
movl 0x678(%rax), %ecx
addl -0x48(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x67c(%rax)
movq -0x8(%rbp), %rax
movl $0x0, 0x340(%rax)
movl $0x0, -0x44(%rbp)
movq -0x8(%rbp), %rax
movl -0x44(%rbp), %ecx
movq 0x10(%rax,%rcx,8), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
je 0x5e0d
movq -0x40(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x5e00
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x3190
movq -0x8(%rbp), %rcx
movl 0x340(%rcx), %ecx
cmpq %rcx, %rax
jbe 0x5e00
movq -0x40(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x3190
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x340(%rax)
jmp 0x5e02
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x5daa
movq -0x38(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)