// File: /workspace/github_c_makefile_star2_O0/rouming[P]io/zmtp.c
// Function: on_recv__REP
static int on_recv__REP(struct io_req *req, int len)
{
	struct zmtp *zmtp = req->data;
	struct io_queue *q = zmtp->io_proto.q;
	struct io_req *rd_req;
	int exp_len;
	bool more;

	if (len < 0)
		goto out;

	exp_len = zmtp_expect_msg(zmtp, req, false, &more);
	if (exp_len < 0) {
		len = exp_len;
		goto out;
	}
	if (exp_len == 0)
		/* Package is not fully received, continue */
		return 0;

	rd_req = list_first_entry_or_null(&q->queue, struct io_req, list);
	/* Should be checked by on_proto_submit_REP() */
	assert(rd_req);
	assert((rd_req->flags & REQ_RDWR_MASK) == REQ_RD);

	if (!buf_vari_len(&rd_req->buf)) {
		/* Expect exact size if request is not of a variable length */
		if (exp_len != (buf_len(&rd_req->buf) - buf_pos(&rd_req->buf))) {
			len = -EPROTO;
			goto out;
		}
	} else {
		rd_req->buf.__proto.read_hint = exp_len;
	}
	if (more)
		rd_req->flags |= REQ_MORE;

out:
	io_req_put(req);
	if (len < 0)
		zmtp->inner_state = ZMTP_REP_CLOSED;

	return len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x28(%rbp)
cmpl $0x0, -0x14(%rbp)
jge 0x28f1
jmp 0x2a39
movq -0x20(%rbp), %rdi
movq -0x10(%rbp), %rsi
xorl %edx, %edx
leaq -0x35(%rbp), %rcx
callq 0x2b00
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x34(%rbp)
jge 0x2918
movl -0x34(%rbp), %eax
movl %eax, -0x14(%rbp)
jmp 0x2a39
cmpl $0x0, -0x34(%rbp)
jne 0x292a
movl $0x0, -0x4(%rbp)
jmp 0x2a59
movq -0x28(%rbp), %rdi
addq $0x138, %rdi            # imm = 0x138
callq 0x2db0
cmpl $0x0, %eax
jne 0x2960
movq -0x28(%rbp), %rax
movq 0x138(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x2968
xorl %eax, %eax
movq %rax, -0x50(%rbp)
jmp 0x2968
movq -0x50(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x2979
jmp 0x2998
leaq 0x48f1(%rip), %rdi      # 0x7271
leaq 0x48f1(%rip), %rsi      # 0x7278
movl $0x9a, %edx
leaq 0x48ec(%rip), %rcx      # 0x727f
callq 0x10d0
movq -0x30(%rbp), %rax
movl 0x20(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x29a9
jmp 0x29c8
leaq 0x48f6(%rip), %rdi      # 0x72a6
leaq 0x48c1(%rip), %rsi      # 0x7278
movl $0x9b, %edx
leaq 0x48bc(%rip), %rcx      # 0x727f
callq 0x10d0
movq -0x30(%rbp), %rdi
addq $0x28, %rdi
callq 0x3810
testb $0x1, %al
jne 0x2a15
movl -0x34(%rbp), %eax
movl %eax, -0x54(%rbp)
movq -0x30(%rbp), %rdi
addq $0x28, %rdi
callq 0x3940
movl %eax, -0x58(%rbp)
movq -0x30(%rbp), %rdi
addq $0x28, %rdi
callq 0x3890
movl -0x58(%rbp), %ecx
movl %eax, %edx
movl -0x54(%rbp), %eax
subl %edx, %ecx
cmpl %ecx, %eax
je 0x2a13
movl $0xffffffb9, -0x14(%rbp) # imm = 0xFFFFFFB9
jmp 0x2a39
jmp 0x2a24
movslq -0x34(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, 0x158(%rax)
testb $0x1, -0x35(%rbp)
je 0x2a37
movq -0x30(%rbp), %rax
movl 0x20(%rax), %ecx
orl $0x2, %ecx
movl %ecx, 0x20(%rax)
jmp 0x2a39
movq -0x10(%rbp), %rdi
callq 0x4bb0
cmpl $0x0, -0x14(%rbp)
jge 0x2a53
movq -0x20(%rbp), %rax
movl $0x2, 0x28(%rax)
movl -0x14(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)