// File: /workspace/github_c_makefile_star2_O0/bobrippling[P]tim/parse_cmd.c
// Function: parse_ranged_cmd
bool parse_ranged_cmd(
		char *cmd,
		const cmd_t **pcmd_f,
		char ***pargv, int *pargc,
		bool *pforce,
		struct range **prange)
{
#define cmd_f (*pcmd_f)
#define argv (*pargv)
#define argc (*pargc)
#define force (*pforce)
#define range (*prange)
	argv = NULL;
	argc = 0;

	char *cmd_i = skipspace(cmd);

	if(!*cmd_i)
		return false;

	switch(parse_range(cmd_i, &cmd_i, range)){
		case RANGE_PARSE_FAIL:
			return false;
		case RANGE_PARSE_NONE:
			range = NULL;
		case RANGE_PARSE_PASS:
			break;
	}

	cmd_i = skipspace(cmd_i);

	/* alpha or single non-ascii for command */
	argc = 1;
	argv = umalloc((argc + 1) * sizeof *argv);

	if(isalpha(*cmd_i)){
		char *p;
		for(p = cmd_i + 1; isalpha(*p); p++);
		argv[0] = ustrdup_len(cmd_i, p - cmd_i);
		cmd_i = p - 1;
	}else if(*cmd_i){
		argv[0] = ustrdup_len(cmd_i, 1);
	}else{
		return false;
	}
	cmd_i++;

	/* look for command */
	cmd_f = NULL;
	for(int i = 0; cmds[i].arg0; i++)
		if(!strcmp(cmds[i].arg0, argv[0])){
			cmd_f = &cmds[i];
			break;
		}

	if(!cmd_f)
		return false;

	force = false;
	/* no whitespace - force must be directly after */
	if(*cmd_i == '!')
		force = true, cmd_i++;

	cmd_i = skipspace(cmd_i);

	if(cmd_f->single_arg){
		argv = urealloc(argv, (++argc + 1) * sizeof *argv);
		argv[1] = ustrdup(cmd_i);

	}else{
		parse_cmd(cmd_i, &argc, &argv, !cmd_f->skipglob);
	}
	argv[argc] = NULL;

	filter_argv(&argc, &argv);

	return true;
#undef cmd_f
#undef argv
#undef argc
#undef force
#undef range
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
movq -0x28(%rbp), %rax
movl $0x0, (%rax)
movq -0x10(%rbp), %rdi
callq 0x10a20
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpb $0x0, (%rax)
jne 0x125c4
movb $0x0, -0x1(%rbp)
jmp 0x12867
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rax
movq (%rax), %rdx
leaq -0x40(%rbp), %rsi
callq 0x121f0
movl %eax, %ecx
movl %ecx, -0x50(%rbp)
testl %eax, %eax
je 0x12600
jmp 0x125e3
movl -0x50(%rbp), %eax
subl $0x1, %eax
je 0x125f7
jmp 0x125ed
movl -0x50(%rbp), %eax
subl $0x2, %eax
je 0x1260b
jmp 0x1260d
movb $0x0, -0x1(%rbp)
jmp 0x12867
movq -0x38(%rbp), %rax
movq $0x0, (%rax)
jmp 0x1260d
movq -0x40(%rbp), %rdi
callq 0x10a20
movq %rax, -0x40(%rbp)
movq -0x28(%rbp), %rax
movl $0x1, (%rax)
movq -0x28(%rbp), %rax
movl (%rax), %eax
addl $0x1, %eax
movslq %eax, %rdi
shlq $0x3, %rdi
callq 0x5f20
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
callq 0x4530
movq (%rax), %rax
movq -0x40(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x126ce
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
callq 0x4530
movq (%rax), %rax
movq -0x48(%rbp), %rcx
movsbl (%rcx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x400, %eax            # imm = 0x400
cmpl $0x0, %eax
je 0x1269f
jmp 0x12691
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x1266f
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rax
subq %rax, %rsi
callq 0x5fe0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rcx, (%rax)
movq -0x48(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x126ff
movq -0x40(%rbp), %rax
cmpb $0x0, (%rax)
je 0x126f4
movq -0x40(%rbp), %rdi
movl $0x1, %esi
callq 0x5fe0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rcx, (%rax)
jmp 0x126fd
movb $0x0, -0x1(%rbp)
jmp 0x12867
jmp 0x126ff
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
movl $0x0, -0x4c(%rbp)
movslq -0x4c(%rbp), %rcx
leaq 0x9378(%rip), %rax      # 0x1baa0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, (%rax)
je 0x12786
movslq -0x4c(%rbp), %rcx
leaq 0x9360(%rip), %rax      # 0x1baa0
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rsi
callq 0x42d0
cmpl $0x0, %eax
jne 0x12779
movslq -0x4c(%rbp), %rax
leaq 0x9337(%rip), %rcx      # 0x1baa0
imulq $0x18, %rax, %rax
addq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
jmp 0x12786
jmp 0x1277b
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x1271d
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x12799
movb $0x0, -0x1(%rbp)
jmp 0x12867
movq -0x30(%rbp), %rax
movb $0x0, (%rax)
movq -0x40(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x21, %eax
jne 0x127bf
movq -0x30(%rbp), %rax
movb $0x1, (%rax)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
callq 0x10a20
movq %rax, -0x40(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rax
testb $0x1, 0x10(%rax)
je 0x1281d
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rcx
movl (%rcx), %eax
addl $0x1, %eax
movl %eax, (%rcx)
addl $0x1, %eax
movslq %eax, %rsi
shlq $0x3, %rsi
callq 0x5f60
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rdi
callq 0x5fa0
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rcx, 0x8(%rax)
jmp 0x12840
movq -0x40(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x18(%rbp), %rax
movq (%rax), %rax
movb 0x12(%rax), %al
xorb $-0x1, %al
movzbl %al, %ecx
andl $0x1, %ecx
callq 0x12310
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq -0x28(%rbp), %rcx
movslq (%rcx), %rcx
movq $0x0, (%rax,%rcx,8)
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x12880
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)