// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]kivaloo/liball/../libcperciva/http/http.c
// Function: callback_chunkedheader
static int
callback_chunkedheader(void * cookie, int status)
{
	struct http_cookie * H = cookie;
	uint8_t * buf;
	size_t buflen;
	size_t eolpos;
	size_t clen;

	/* Did we fail?  (EOF while reading a chunk header is a failure.) */
	if (status)
		return (fail(H));

	/* Peek at the incoming data. */
	netbuf_read_peek(H->R, &buf, &buflen);

	/* Look for an EOL. */
	eolpos = findeol(buf, buflen);

	/* If we found one, handle the line. */
	if (eolpos != buflen) {
		/*
		 * Parse the chunk length; it's always in base 16, and allow
		 * trailing characters to accommodate the EOL.  ${buf} is not
		 * NUL-terminated but it does contain an EOL, so the cast is
		 * safe.
		 */
		if (PARSENUM_EX(&clen, (const char *)buf, 0, SIZE_MAX, 16, 1)) {
			/* Print ${buf} carefully (it's not NUL-terminated). */
			if (eolpos <= INT_MAX)
				warnp("parsenum failed on %.*s", (int)eolpos,
				    buf);
			else
				warnp("parsenum failed on %.*s", INT_MAX, buf);
			return (fail(H));
		}

		/* Consume the line and EOL. */
		netbuf_read_consume(H->R, eolpos + 2);

		/* If this is zero, we're done! */
		if (clen == 0)
			return (docallback(H));

		/* Otherwise, check that it's not too big. */
		if (clen > H->res_bodylen_max - H->res.bodylen)
			return (toobig(H));
		if (clen > SIZE_MAX - 2)
			return (toobig(H));

		/* Read the chunk data plus extra EOL (we strip it later). */
		H->readlen = clen + 2;
		return (callback_readdata(H, 0));
	}

	/* If we've read MAXCHLEN bytes, we should have gotten an EOL. */
	if (buflen >= MAXCHLEN)
		return (fail(H));

	/* Wait until some more data arrives. */
	if (netbuf_read_wait(H->R, buflen + 1, callback_chunkedheader, H))
		return (die(H));

	/* Success! */
	return (0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
testl %esi, %esi
je 0x96bd
movq 0x68(%rbx), %rdi
xorl %esi, %esi
callq *0x60(%rbx)
movl %eax, %ebp
movq %rbx, %rdi
callq 0x8f5d
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x28(%rbx), %rdi
movq %rsp, %r14
leaq 0x8(%rsp), %r15
movq %r14, %rsi
movq %r15, %rdx
callq 0x9c29
movq (%r14), %r12
movq (%r15), %rsi
movq %rsi, %r14
cmpq $0x2, %rsi
jb 0x9702
xorl %r14d, %r14d
cmpw $0xa0d, (%r12,%r14)     # imm = 0xA0D
je 0x9702
leaq 0x1(%r14), %rax
addq $0x3, %r14
cmpq %rsi, %r14
movq %rax, %r14
jbe 0x96e6
movq %rsi, %r14
cmpq %rsi, %r14
jne 0x9740
cmpq $0x100, %rsi            # imm = 0x100
jae 0x9699
movq 0x28(%rbx), %rdi
incq %rsi
leaq -0x9a(%rip), %rdx       # 0x9684
movq %rbx, %rcx
callq 0x9c42
testl %eax, %eax
je 0x97f6
movq %rbx, %rdi
callq 0x8f5d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x96ac
callq 0x3040
movl $0x0, (%rax)
testq %r12, %r12
je 0x9839
movq %rax, %r15
leaq 0x10(%rsp), %rbp
movq %r12, %rdi
movq %rbp, %rsi
movl $0x10, %edx
callq 0x3340
movq %rax, %r13
cmpq %r12, (%rbp)
jne 0x977c
movl $0x16, (%r15)
cmpl $0x0, (%r15)
je 0x979b
cmpq $0x7fffffff, %r14       # imm = 0x7FFFFFFF
ja 0x97d3
movq (%rsp), %rdx
leaq 0x8980(%rip), %rdi      # 0x12116
movl %r14d, %esi
jmp 0x97e3
movq 0x28(%rbx), %rdi
addq $0x2, %r14
movq %r14, %rsi
callq 0x9eb4
testq %r13, %r13
je 0x97fd
movq 0x98(%rbx), %rax
subq 0xc0(%rbx), %rax
cmpq %rax, %r13
ja 0x97c9
cmpq $-0x2, %r13
jb 0x981d
movq %rbx, %rdi
callq 0x99bf
jmp 0x9832
movq (%rsp), %rdx
leaq 0x8938(%rip), %rdi      # 0x12116
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
xorl %eax, %eax
callq 0x578c
movl $0x0, (%r15)
jmp 0x9699
xorl %ebp, %ebp
jmp 0x96ac
movq 0x68(%rbx), %rdi
leaq 0xa8(%rbx), %rsi
callq *0x60(%rbx)
movl %eax, %ebp
movq $0x0, 0xc8(%rbx)
jmp 0x96a4
addq $0x2, %r13
movq %r13, 0x90(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x9a0d
movl %eax, %ebp
jmp 0x96ac
leaq 0x88ee(%rip), %rdi      # 0x1212e
leaq 0x88f1(%rip), %rsi      # 0x12138
leaq 0x896c(%rip), %rcx      # 0x121ba
movl $0xbb, %edx
callq 0x3200