// File: /workspace/github_c_makefile_star2_O3/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 0x954b
movq 0x68(%rbx), %rdi
xorl %esi, %esi
callq *0x60(%rbx)
movl %eax, %ebp
movq %rbx, %rdi
callq 0x8df7
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, %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdx
callq 0x9ab5
movq (%r14), %rsi
cmpq $0x2, %rsi
jb 0x9598
movq (%rsp), %r12
xorl %r14d, %r14d
cmpw $0xa0d, (%r12,%r14)     # imm = 0xA0D
je 0x958a
leaq 0x1(%r14), %rax
addq $0x3, %r14
cmpq %rsi, %r14
movq %rax, %r14
jbe 0x956f
jmp 0x958f
cmpq %r14, %rsi
jne 0x95cb
cmpq $0x100, %rsi            # imm = 0x100
jae 0x9527
movq 0x28(%rbx), %rdi
incq %rsi
leaq -0x94(%rip), %rdx       # 0x9512
movq %rbx, %rcx
callq 0x9ace
testl %eax, %eax
je 0x95c4
movq %rbx, %rdi
callq 0x8df7
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x953a
xorl %ebp, %ebp
jmp 0x953a
callq 0x3040
movl $0x0, (%rax)
testq %r12, %r12
je 0x96bd
movq %rax, %r15
leaq 0x10(%rsp), %rbp
movq %r12, %rdi
movq %rbp, %rsi
movl $0x10, %edx
callq 0x3340
cmpq %r12, (%rbp)
je 0x963e
cmpl $0x0, (%r15)
jne 0x9645
movq %rax, %r13
movq 0x28(%rbx), %rdi
addq $0x2, %r14
movq %r14, %rsi
callq 0x9d46
testq %r13, %r13
je 0x9681
movq 0x98(%rbx), %rax
subq 0xc0(%rbx), %rax
cmpq %rax, %r13
ja 0x9634
cmpq $-0x2, %r13
jb 0x96a1
movq %rbx, %rdi
callq 0x9843
jmp 0x96b6
movl $0x16, (%r15)
cmpq $0x7fffffff, %r14       # imm = 0x7FFFFFFF
ja 0x965e
movq (%rsp), %rdx
leaq 0x8935(%rip), %rdi      # 0x11f8e
movl %r14d, %esi
jmp 0x966e
movq (%rsp), %rdx
leaq 0x8925(%rip), %rdi      # 0x11f8e
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
xorl %eax, %eax
callq 0x57b8
movl $0x0, (%r15)
jmp 0x9527
movq 0x68(%rbx), %rdi
leaq 0xa8(%rbx), %rsi
callq *0x60(%rbx)
movl %eax, %ebp
movq $0x0, 0xc8(%rbx)
jmp 0x9532
addq $0x2, %r13
movq %r13, 0x90(%rbx)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x9891
movl %eax, %ebp
jmp 0x953a
leaq 0x88e2(%rip), %rdi      # 0x11fa6
leaq 0x88e5(%rip), %rsi      # 0x11fb0
leaq 0x8960(%rip), %rcx      # 0x12032
movl $0xbb, %edx
callq 0x3200