// File: /workspace/github_c_makefile_star2_O0/jonof[P]jftekwar/jfbuild/src/osd.c
// Function: OSD_RegisterFunction
int OSD_RegisterFunction(const char *name, const char *help, int (*func)(const osdfuncparm_t*))
{
	symbol_t *symb;
	const char *cp;

	if (!osdinited) {
        buildputs("OSD_RegisterFunction(): OSD not initialised\n");
        return -1;
    }

	if (!name) {
		buildputs("OSD_RegisterFunction(): may not register a function with a null name\n");
		return -1;
	}
	if (!name[0]) {
		buildputs("OSD_RegisterFunction(): may not register a function with no name\n");
		return -1;
	}

	// check for illegal characters in name
	for (cp = name; *cp; cp++) {
		if ((cp == name) && (*cp >= '0') && (*cp <= '9')) {
			buildprintf("OSD_RegisterFunction(): first character of function name \"%s\" must not be a numeral\n", name);
			return -1;
		}
		if ((*cp < '0') ||
		    (*cp > '9' && *cp < 'A') ||
		    (*cp > 'Z' && *cp < 'a' && *cp != '_') ||
		    (*cp > 'z')) {
			buildprintf("OSD_RegisterFunction(): illegal character in function name \"%s\"\n", name);
			return -1;
		}
	}

	if (!help) help = "(no description for this function)";
	if (!func) {
		buildputs("OSD_RegisterFunction(): may not register a null function\n");
		return -1;
	}

	symb = findexactsymbol(name);
	if (symb && symb->func == func) {
		// Same function being defined a second time, so we'll quietly ignore it.
		return 0;
	} else if (symb) {
		buildprintf("OSD_RegisterFunction(): \"%s\" is already defined\n", name);
		return -1;
	}

	symb = addnewsymbol(name);
	if (!symb) {
		buildprintf("OSD_RegisterFunction(): Failed registering function \"%s\"\n", name);
		return -1;
	}

	symb->name = name;
	symb->help = help;
	symb->func = func;

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
cmpb $0x0, 0x57af7d(%rip)    # 0x5e7298
jne 0x6c335
leaq 0x478fa(%rip), %rdi     # 0xb3c1e
callq 0x4a720
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6c528
cmpq $0x0, -0x10(%rbp)
jne 0x6c354
leaq 0x47908(%rip), %rdi     # 0xb3c4b
callq 0x4a720
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6c528
movq -0x10(%rbp), %rax
cmpb $0x0, (%rax)
jne 0x6c375
leaq 0x4792d(%rip), %rdi     # 0xb3c91
callq 0x4a720
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6c528
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpb $0x0, (%rax)
je 0x6c44f
movq -0x30(%rbp), %rax
cmpq -0x10(%rbp), %rax
jne 0x6c3ca
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jl 0x6c3ca
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x39, %eax
jg 0x6c3ca
movq -0x10(%rbp), %rsi
leaq 0x4791c(%rip), %rdi     # 0xb3cd3
movb $0x0, %al
callq 0x37c90
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6c528
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jl 0x6c41e
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x39, %eax
jle 0x6c3ee
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x41, %eax
jl 0x6c41e
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5a, %eax
jle 0x6c412
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x61, %eax
jge 0x6c412
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x5f, %eax
jne 0x6c41e
movq -0x30(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x7a, %eax
jle 0x6c43c
movq -0x10(%rbp), %rsi
leaq 0x478ff(%rip), %rdi     # 0xb3d28
movb $0x0, %al
callq 0x37c90
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6c528
jmp 0x6c43e
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x6c37d
cmpq $0x0, -0x18(%rbp)
jne 0x6c461
leaq 0x4790c(%rip), %rax     # 0xb3d69
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x6c480
leaq 0x4791d(%rip), %rdi     # 0xb3d8c
callq 0x4a720
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6c528
movq -0x10(%rbp), %rdi
callq 0x6ea70
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x6c4ab
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
cmpq -0x20(%rbp), %rax
jne 0x6c4ab
movl $0x0, -0x4(%rbp)
jmp 0x6c528
cmpq $0x0, -0x28(%rbp)
je 0x6c4cd
movq -0x10(%rbp), %rsi
leaq 0x47909(%rip), %rdi     # 0xb3dc6
movb $0x0, %al
callq 0x37c90
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6c528
jmp 0x6c4cf
movq -0x10(%rbp), %rdi
callq 0x6eaf0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0x6c4fe
movq -0x10(%rbp), %rsi
leaq 0x47909(%rip), %rdi     # 0xb3df7
movb $0x0, %al
callq 0x37c90
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6c528
movq -0x10(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x18(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x18(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)