// File: /workspace/github_c_makefile_star2_O0/rouming[P]io/io.c
// Function: _io_queue_submit
static int __io_queue_submit(struct io_req *req, bool tail)
{
	struct io_queue *q = req->q;
	int rc, wr;

	if (q->poller == NULL)
		return -EINVAL;
	rc = req_check(req);
	if (rc)
		return -EINVAL;

	if (!q->in_proto && q->proto && q->proto->on_submit) {
		/* Forward request to proto if any */
		rc = q->proto->on_submit(q->proto, req);
		if (rc)
			return rc;
	}
	wr = req->flags & REQ_RDWR_MASK;
	/*
	 * Firstly add request to the list (either to the head or to the tail)
	 * to simplify __poller_update() and _poller_set_prewait() logic, which
	 * simply picks up first request from the queue and updates poller events
	 * accordingly.
	 */
	if (tail)
		list_add_tail(&req->list, &q->queue);
	else
		list_add(&req->list, &q->queue);

	if (q->refs == 1) {
		if (!wr && is_stashed(q))
			/*
			 * We do submission outside the IO loop, but read can
			 * be completed right now from a stash, thus set prewait
			 * for an event to be called just before poller wait and
			 * then return to on_io.
			 */
			rc = __poller_set_prewait(q->poller, &q->item);

		if (rc == 0)
			rc = __poller_update(q);
	}
	if (rc)
		/* Rollback in case of error */
		list_del_init(&req->list);
	else
		/* Success, account added request */
		q->reqs_num[wr]++;

	return rc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movb %sil, %al
movq %rdi, -0x10(%rbp)
andb $0x1, %al
movb %al, -0x11(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x46d6
movl $0xffffffea, -0x4(%rbp) # imm = 0xFFFFFFEA
jmp 0x4811
movq -0x10(%rbp), %rdi
callq 0x57a0
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x46f4
movl $0xffffffea, -0x4(%rbp) # imm = 0xFFFFFFEA
jmp 0x4811
movq -0x20(%rbp), %rax
testb $0x1, 0x170(%rax)
jne 0x4757
movq -0x20(%rbp), %rax
cmpq $0x0, 0x150(%rax)
je 0x4757
movq -0x20(%rbp), %rax
movq 0x150(%rax), %rax
cmpq $0x0, 0x10(%rax)
je 0x4757
movq -0x20(%rbp), %rax
movq 0x150(%rax), %rax
movq 0x10(%rax), %rax
movq -0x20(%rbp), %rcx
movq 0x150(%rcx), %rdi
movq -0x10(%rbp), %rsi
callq *%rax
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
je 0x4755
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x4811
jmp 0x4757
movq -0x10(%rbp), %rax
movl 0x20(%rax), %eax
andl $0x1, %eax
movl %eax, -0x28(%rbp)
testb $0x1, -0x11(%rbp)
je 0x4780
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
addq $0x138, %rsi            # imm = 0x138
callq 0x6350
jmp 0x4794
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
addq $0x138, %rsi            # imm = 0x138
callq 0x5ab0
movq -0x20(%rbp), %rax
cmpl $0x1, 0x174(%rax)
jne 0x47e1
cmpl $0x0, -0x28(%rbp)
jne 0x47cd
movq -0x20(%rbp), %rdi
callq 0x4620
testb $0x1, %al
jne 0x47b6
jmp 0x47cd
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rsi
addq $0x8, %rsi
callq 0x6380
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x24(%rbp)
jne 0x47df
movq -0x20(%rbp), %rdi
callq 0x53c0
movl %eax, -0x24(%rbp)
jmp 0x47e1
cmpl $0x0, -0x24(%rbp)
je 0x47f2
movq -0x10(%rbp), %rdi
callq 0x5a80
jmp 0x480b
movq -0x20(%rbp), %rax
movslq -0x28(%rbp), %rcx
movl 0x148(%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, 0x148(%rax,%rcx,4)
movl -0x24(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)