// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/osd.c
// Function: OSD_Dispatch
int OSD_Dispatch(const char *cmd)
{
	char *workbuf, *wp, *wtp, *state;
	char *parms[MAXPARMS];
	int  numparms, restart = 0;
	osdfuncparm_t ofp;
	symbol_t *symb;
	//int i;

	workbuf = state = Bstrdup(cmd);
	if (!workbuf) return -1;

	do {
		numparms = 0;
		Bmemset(parms, 0, sizeof(parms));
		wp = strtoken(state, &wtp, &restart);
		if (!wp) {
			state = wtp;
			continue;
		}

		symb = findexactsymbol(wp);
		if (!symb) {
			OSD_Printf("Error: \"%s\" is not defined\n", wp);
			free(workbuf);
			return -1;
		}

		ofp.name = wp;
		while (wtp && !restart) {
			wp = strtoken(NULL, &wtp, &restart);
			if (wp && numparms < MAXPARMS) parms[numparms++] = wp;
		}
		ofp.numparms = numparms;
		ofp.parms    = (const char **)parms;
		ofp.raw      = cmd;
		switch (symb->func(&ofp)) {
			case OSDCMD_OK: break;
			case OSDCMD_SHOWHELP: OSD_Printf("%s\n", symb->help); break;
		}

		state = wtp;
	} while (wtp && restart);

	free(workbuf);

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1070, %rsp           # imm = 0x1070
movq %rdi, -0x10(%rbp)
movl $0x0, -0x1038(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6060
movq %rax, -0x30(%rbp)
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x6e5fd
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6e7c1
jmp 0x6e5ff
movl $0x0, -0x1034(%rbp)
leaq -0x1030(%rbp), %rdi
xorl %esi, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x62d0
movq -0x30(%rbp), %rdi
leaq -0x28(%rbp), %rsi
leaq -0x1038(%rbp), %rdx
callq 0x6e7d0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x6e648
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0x6e784
movq -0x20(%rbp), %rdi
callq 0x6ea70
movq %rax, -0x1060(%rbp)
cmpq $0x0, -0x1060(%rbp)
jne 0x6e689
movq -0x20(%rbp), %rsi
leaq 0x45595(%rip), %rdi     # 0xb3c02
movb $0x0, %al
callq 0x6e340
movq -0x18(%rbp), %rdi
callq 0x61c0
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6e7c1
movq -0x20(%rbp), %rax
movq %rax, -0x1050(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x28(%rbp)
movb %al, -0x1061(%rbp)
je 0x6e6b5
cmpl $0x0, -0x1038(%rbp)
setne %al
xorb $-0x1, %al
movb %al, -0x1061(%rbp)
movb -0x1061(%rbp), %al
testb $0x1, %al
jne 0x6e6c1
jmp 0x6e70d
xorl %eax, %eax
movl %eax, %edi
leaq -0x28(%rbp), %rsi
leaq -0x1038(%rbp), %rdx
callq 0x6e7d0
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
je 0x6e70b
cmpl $0x200, -0x1034(%rbp)   # imm = 0x200
jge 0x6e70b
movq -0x20(%rbp), %rcx
movl -0x1034(%rbp), %eax
movl %eax, %edx
addl $0x1, %edx
movl %edx, -0x1034(%rbp)
cltq
movq %rcx, -0x1030(%rbp,%rax,8)
jmp 0x6e694
movl -0x1034(%rbp), %eax
movl %eax, -0x1058(%rbp)
leaq -0x1030(%rbp), %rax
movq %rax, -0x1048(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x1040(%rbp)
movq -0x1060(%rbp), %rax
movq 0x18(%rax), %rax
leaq -0x1058(%rbp), %rdi
callq *%rax
movl %eax, %ecx
movl %ecx, -0x1068(%rbp)
testl %eax, %eax
je 0x6e761
jmp 0x6e754
movl -0x1068(%rbp), %eax
subl $0x1, %eax
je 0x6e763
jmp 0x6e77c
jmp 0x6e77c
movq -0x1060(%rbp), %rax
movq 0x10(%rax), %rsi
leaq 0x4785f(%rip), %rdi     # 0xb5fd4
movb $0x0, %al
callq 0x6e340
movq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
xorl %eax, %eax
cmpq $0x0, -0x28(%rbp)
movb %al, -0x1069(%rbp)
je 0x6e7a3
cmpl $0x0, -0x1038(%rbp)
setne %al
movb %al, -0x1069(%rbp)
movb -0x1069(%rbp), %al
testb $0x1, %al
jne 0x6e5ff
movq -0x18(%rbp), %rdi
callq 0x61c0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x1070, %rsp           # imm = 0x1070
popq %rbp
retq
nopl (%rax)