// File: /workspace/github_c_makefile_star2_O0/wahern[P]cqueues/src/socket.c
// Function: lso_getbody
static lso_error_t lso_getbody(struct luasocket *S, struct iovec *iov, int *eom, const char *eob, size_t eoblen, int mode) {
	size_t bufsiz, maxbuf, n;
	int error;

	bufsiz = (mode & LSO_TEXT)? MAX(S->ibuf.bufsiz, S->ibuf.maxline) : S->ibuf.bufsiz;
	bufsiz = MAX(bufsiz, 2); /* see comment in text-mode handling below wrt >=2 */

	/*
	 * Adjust window. We need at least 1 + "\r\n" + eoblen to make
	 * forward progress. But we actually want to return bufsiz-sized
	 * intermediate chunks. So we want a temporary buffer of bufsiz +
	 * "\r\n" + eoblen.
	 */
	if ((error = cqs_addzu(&maxbuf, bufsiz, 2)))
		return error;
	if ((error = cqs_addzu(&maxbuf, maxbuf, eoblen)))
		return error;

	error = lso_fill(S, maxbuf);

	fifo_slice(&S->ibuf.fifo, iov, 0, maxbuf);

	if ((n = iov_eob(iov, eob, eoblen))) {
		iov->iov_len = n - eoblen; /* n >= eoblen */

		*eom = 1;
	} else if (iov->iov_len >= maxbuf) {
		/*
		 * Because maxbuf is >= bufsiz + 2 + eoblen we can be sure
		 * that returning bufsiz bytes won't cause problems trimming
		 * the \r\n preceding the boundary marker. It's inelegant
		 * but very simple. In the case of a stall or broken
		 * connection we may be leaving more bytes in the buffer
		 * than strictly necessary, but in those cases something is
		 * broken, anyhow.
		 */
		iov->iov_len = bufsiz;

		if (mode & LSO_TEXT) {
			iov->iov_len = iov_eol(iov);

			/* trim if might be part of \r\n sequence */
			if (iov_lc(iov) == '\r')
				--iov->iov_len;
			/*
			 * NOTE: we guaranteed above that bufsiz >= 2 so we
			 * don't accidentally return an empty string if we
			 * trimmed a \r here.
			 */
		}
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movl %r9d, -0x34(%rbp)
movl -0x34(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x1d9c1
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x10(%rbp), %rcx
cmpq 0x48(%rcx), %rax
jbe 0x1d9ab
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x60(%rbp)
jmp 0x1d9b7
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x68(%rbp)
jmp 0x1d9cd
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpq $0x2, -0x40(%rbp)
jbe 0x1d9e6
movq -0x40(%rbp), %rax
movq %rax, -0x70(%rbp)
jmp 0x1d9f1
movl $0x2, %eax
movq %rax, -0x70(%rbp)
jmp 0x1d9f1
movq -0x70(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rsi
leaq -0x48(%rbp), %rdi
movl $0x2, %edx
callq 0x1e4f0
movl %eax, -0x54(%rbp)
cmpl $0x0, %eax
je 0x1da1e
movl -0x54(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1db0a
movq -0x48(%rbp), %rsi
movq -0x30(%rbp), %rdx
leaq -0x48(%rbp), %rdi
callq 0x1e4f0
movl %eax, -0x54(%rbp)
cmpl $0x0, %eax
je 0x1da42
movl -0x54(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1db0a
movq -0x10(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x1d280
movl %eax, -0x54(%rbp)
movq -0x10(%rbp), %rdi
addq $0x40, %rdi
addq $0x18, %rdi
movq -0x18(%rbp), %rsi
movq -0x48(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
callq 0x1c230
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x30(%rbp), %rdx
callq 0x1e540
movq %rax, -0x50(%rbp)
cmpq $0x0, %rax
je 0x1daa6
movq -0x50(%rbp), %rcx
subq -0x30(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x20(%rbp), %rax
movl $0x1, (%rax)
jmp 0x1db03
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
cmpq -0x48(%rbp), %rax
jb 0x1db01
movq -0x40(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movl -0x34(%rbp), %eax
andl $0x8, %eax
cmpl $0x0, %eax
je 0x1daff
movq -0x18(%rbp), %rdi
callq 0x1e5c0
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x18(%rbp), %rdi
callq 0x1d630
cmpl $0xd, %eax
jne 0x1dafd
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x8(%rax)
jmp 0x1daff
jmp 0x1db01
jmp 0x1db03
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)