// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpl $0x0, -0x14(%rbp)
je 0xd73e
movq -0x20(%rbp), %rdi
callq 0xcc10
movl %eax, -0x4(%rbp)
jmp 0xd9e8
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rdi
leaq -0x28(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0xe0f0
movq -0x28(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0xd500
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rax
cmpq -0x30(%rbp), %rax
je 0xd996
callq 0x3040
movl $0x0, (%rax)
movq $0x1, -0x40(%rbp)
movq -0x40(%rbp), %rax
shrq %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, %rax
jbe 0xd7c7
movq 0x18843(%rip), %rax     # 0x25fe0
movq (%rax), %rdi
leaq 0x119e6(%rip), %rsi     # 0x1f18d
leaq 0x11b6e(%rip), %rdx     # 0x1f31c
leaq 0x11758(%rip), %rcx     # 0x1ef0d
movl $0x2b6, %r8d            # imm = 0x2B6
movb $0x0, %al
callq 0x3530
callq 0x31f0
movq $-0x1, -0x40(%rbp)
xorl %eax, %eax
testb $0x1, %al
jne 0xd7d7
jmp 0xd818
movq -0x28(%rbp), %rdi
movq -0x40(%rbp), %rcx
xorl %eax, %eax
cmpq $0x0, %rcx
cmovbel %eax, %eax
movslq %eax, %rsi
movq -0x40(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
movq $-0x1, %rax
cmpq $0x0, %rcx
cmovbeq %rax, %rdx
movl $0x10, %ecx
movl $0x1, %r8d
callq 0xdc30
movq %rax, -0x40(%rbp)
jmp 0xd840
movq -0x28(%rbp), %rdi
movq -0x40(%rbp), %rcx
xorl %eax, %eax
movl %eax, %esi
movq $-0x1, %rdx
movl $0x10, %r8d
movl $0x1, %r9d
callq 0xda00
movq %rax, -0x40(%rbp)
callq 0x3040
cmpl $0x0, (%rax)
je 0xd901
cmpq $0x7fffffff, -0x38(%rbp) # imm = 0x7FFFFFFF
ja 0xd8a5
jmp 0xd85a
callq 0x3040
cmpl $0x0, (%rax)
je 0xd889
movq -0x38(%rbp), %rax
movl %eax, %esi
movq -0x28(%rbp), %rdx
leaq 0x11abe(%rip), %rdi     # 0x1f333
movb $0x0, %al
callq 0x66e0
callq 0x3040
movl $0x0, (%rax)
jmp 0xd8a1
movq -0x38(%rbp), %rax
movl %eax, %esi
movq -0x28(%rbp), %rdx
leaq 0x11a99(%rip), %rdi     # 0x1f333
movb $0x0, %al
callq 0x6930
jmp 0xd8a3
jmp 0xd8f0
jmp 0xd8a7
callq 0x3040
cmpl $0x0, (%rax)
je 0xd8d5
movq -0x28(%rbp), %rdx
leaq 0x11a77(%rip), %rdi     # 0x1f333
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movb $0x0, %al
callq 0x66e0
callq 0x3040
movl $0x0, (%rax)
jmp 0xd8ec
movq -0x28(%rbp), %rdx
leaq 0x11a53(%rip), %rdi     # 0x1f333
movl $0x7fffffff, %esi       # imm = 0x7FFFFFFF
movb $0x0, %al
callq 0x6930
jmp 0xd8ee
jmp 0xd8f0
movq -0x20(%rbp), %rdi
callq 0xcc10
movl %eax, -0x4(%rbp)
jmp 0xd9e8
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x38(%rbp), %rsi
addq $0x2, %rsi
callq 0xe600
cmpq $0x0, -0x40(%rbp)
jne 0xd92e
movq -0x20(%rbp), %rdi
callq 0xd6c0
movl %eax, -0x4(%rbp)
jmp 0xd9e8
movq -0x40(%rbp), %rax
movq -0x20(%rbp), %rcx
movq 0x98(%rcx), %rcx
movq -0x20(%rbp), %rdx
subq 0xc0(%rdx), %rcx
cmpq %rcx, %rax
jbe 0xd95e
movq -0x20(%rbp), %rdi
callq 0xdcf0
movl %eax, -0x4(%rbp)
jmp 0xd9e8
cmpq $-0x3, -0x40(%rbp)
jbe 0xd973
movq -0x20(%rbp), %rdi
callq 0xdcf0
movl %eax, -0x4(%rbp)
jmp 0xd9e8
movq -0x40(%rbp), %rcx
addq $0x2, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x90(%rax)
movq -0x20(%rbp), %rdi
xorl %esi, %esi
callq 0xdd40
movl %eax, -0x4(%rbp)
jmp 0xd9e8
cmpq $0x100, -0x30(%rbp)     # imm = 0x100
jb 0xd9ae
movq -0x20(%rbp), %rdi
callq 0xcc10
movl %eax, -0x4(%rbp)
jmp 0xd9e8
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x30(%rbp), %rsi
addq $0x1, %rsi
movq -0x20(%rbp), %rcx
leaq -0x2b9(%rip), %rdx      # 0xd710
callq 0xe130
cmpl $0x0, %eax
je 0xd9e1
movq -0x20(%rbp), %rdi
callq 0xcc50
movl %eax, -0x4(%rbp)
jmp 0xd9e8
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)