// File: /workspace/github_c_makefile_star2_O3/chrispanag[P]operating-systems-scheduler/shell.c
// Function: process_cmdline
void process_cmdline(char *cmdline, int wfd, int rfd)
{
	struct request_struct rq;

	if (strlen(cmdline) == 0 || strcmp(cmdline, "?") == 0){
		help();
		return;
	}

	/* Quit */
	if (strcmp(cmdline, "q") == 0 || strcmp(cmdline, "Q") == 0) {
		fprintf(stderr, "Shell: Exiting. Goodbye.\n");
		exit(0);
	}

	/* Print Tasks */
	if (strcmp(cmdline, "p") == 0 || strcmp(cmdline, "P") == 0) {
		rq.request_no = REQ_PRINT_TASKS;
		issue_request(wfd, rfd, &rq);
		return;
	}

	/* Kill Task */
	if ((cmdline[0] == 'k' || cmdline[0] == 'K') &&
	    cmdline[1] == ' ') {
		rq.request_no = REQ_KILL_TASK;
		rq.task_arg = atoi(&cmdline[2]);
		issue_request(wfd, rfd, &rq);
		return;
	}

	/* Exec Task */
	if ((cmdline[0] == 'e' || cmdline[0] == 'E') && cmdline[1] == ' ') {
		rq.request_no = REQ_EXEC_TASK;
		strncpy(rq.exec_task_arg, &cmdline[2], EXEC_TASK_NAME_SZ);
		rq.exec_task_arg[EXEC_TASK_NAME_SZ - 1] = '\0';
		issue_request(wfd, rfd, &rq);
		return;
	}

	/* High-prioritize task */
	if ((cmdline[0] == 'h' || cmdline[0] == 'H') && cmdline[1] == ' ') {
		rq.request_no = REQ_HIGH_TASK;
		rq.task_arg = atoi(&cmdline[2]);
		issue_request(wfd, rfd, &rq);
		return;
	}

	/* Low-prioritize task */
	if ((cmdline[0] == 'l' || cmdline[0] == 'L') && cmdline[1] == ' ') {
		rq.request_no = REQ_LOW_TASK;
		rq.task_arg = atoi(&cmdline[2]);
		issue_request(wfd, rfd, &rq);
		return;
	}

	/* Parse error, malformed command, whatever... */
	printf("command `%s': Bad Command.\n", cmdline);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x50, %rsp
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %rsi
movzbl (%rdi), %eax
cmpl $0x64, %eax
jg 0x151f
leal -0x45(%rax), %ecx
cmpl $0xc, %ecx
ja 0x15a2
leaq 0xaee(%rip), %rdx       # 0x2004
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
leal -0x65(%rax), %ecx
cmpl $0xc, %ecx
ja 0x15e2
leaq 0xb06(%rip), %rdx       # 0x2038
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpb $0x20, 0x1(%rsi)
je 0x1634
cmpl $0x4c, %eax
je 0x158b
cmpl $0x68, %eax
je 0x1580
cmpl $0x65, %eax
jne 0x15e2
cmpb $0x20, 0x1(%rsi)
je 0x1606
leal -0x48(%rax), %ecx
rolb $0x6, %cl
cmpb $0x9, %cl
ja 0x15e2
movzbl %cl, %ecx
leaq 0xaf5(%rip), %rdx       # 0x206c
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpb $0x20, 0x1(%rsi)
je 0x15f8
cmpl $0x4c, %eax
jne 0x15e2
cmpb $0x20, 0x1(%rsi)
jne 0x15e2
leaq 0xc(%rsp), %r14
movl $0x4, (%r14)
jmp 0x1640
testl %eax, %eax
je 0x15b1
cmpl $0x3f, %eax
jne 0x15e2
cmpb $0x0, 0x1(%rsi)
jne 0x15e2
leaq 0xc67(%rip), %rdi       # 0x221f
addq $0x50, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x1040
cmpb $0x0, 0x1(%rsi)
jne 0x15e2
leaq 0xc(%rsp), %rdx
movl $0x0, (%rdx)
jmp 0x162e
cmpb $0x0, 0x1(%rsi)
je 0x1665
leaq 0xba6(%rip), %rdi       # 0x218f
xorl %eax, %eax
addq $0x50, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x10a0
leaq 0xc(%rsp), %r14
movl $0x3, (%r14)
jmp 0x1640
leaq 0x14(%rsp), %r14
movl $0x2, -0x8(%r14)
addq $0x2, %rsi
movl $0x3c, %edx
movq %r14, %rdi
callq 0x1030
movb $0x0, 0x3b(%r14)
leaq 0xc(%rsp), %rdx
movl %ebp, %edi
movl %ebx, %esi
jmp 0x1657
leaq 0xc(%rsp), %r14
movl $0x1, (%r14)
addq $0x2, %rsi
movq %rsi, %rdi
callq 0x1140
movl %eax, 0x4(%r14)
movl %ebp, %edi
movl %ebx, %esi
movq %r14, %rdx
callq 0x11a0
addq $0x50, %rsp
popq %rbx
popq %r14
popq %rbp
retq
callq 0x1299