LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../lib/dynamodb/dynamodb_request_queue.c
// Function: compar
static int
compar(void * cookie, const void * x, const void * y)
{
	const struct request * _x = x;
	const struct request * _y = y;

	(void)cookie; /* UNUSED */

	/* Is one of the requests in progress? */
	if ((_x->timeout_cookie != NULL) && (_y->timeout_cookie == NULL))
		return (1);
	if ((_x->timeout_cookie == NULL) && (_y->timeout_cookie != NULL))
		return (-1);

	/* Is one a higher priority? */
	if (_x->prio > _y->prio)
		return (1);
	if (_x->prio < _y->prio)
		return (-1);

	/* Sort in order of arrival. */
	if (_x->reqnum > _y->reqnum)
		return (1);
	else
		return (-1);
}

// Assembly:
cmpq $0x0, 0x58(%rsi)
movq 0x58(%rdx), %rdi
pushq $0x1
popq %rax
pushq $-0x1
popq %rcx
je 0x610c
testq %rdi, %rdi
jne 0x6114
retq
testq %rdi, %rdi
je 0x6114
movl %ecx, %eax
retq
movl 0x78(%rdx), %edi
cmpl %edi, 0x78(%rsi)
jg 0x610b
movl %ecx, %eax
jl 0x610b
movq 0x80(%rdx), %rcx
xorl %eax, %eax
cmpq 0x80(%rsi), %rcx
adcl $-0x1, %eax
orl $0x1, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../lib/dynamodb/dynamodb_request_queue.c
// Function: dynamodb_request_queue
int
dynamodb_request_queue(struct dynamodb_request_queue * Q, int prio,
    const char * op, const char * body, size_t maxrlen, const char * logstr,
    int (* callback)(void *, struct http_response *, const char *),
    void * cookie)
{
	struct request * R;

	/* Allocate and fill request structure. */
	if ((R = malloc(sizeof(struct request))) == NULL)
		goto err0;
	R->Q = Q;
	R->op = op;
	R->body = (const uint8_t *)body;
	R->bodylen = strlen(body);
	R->maxrlen = maxrlen;
	R->callback = callback;
	R->cookie = cookie;
	R->http_cookie = NULL;
	R->timeout_cookie = NULL;
	R->addrs[0] = NULL;
	R->addrs[1] = NULL;
	R->prio = prio;
	R->reqnum = Q->reqnum++;
	R->rc = 0;
	R->ntries = 0;

	/* Duplicate the additional logging data. */
	if (logstr != NULL) {
		if ((R->logstr = strdup(logstr)) == NULL)
			goto err1;
	} else {
		R->logstr = NULL;
	}

	/* Add the request to the queue. */
	if (ptrheap_add(Q->reqs, R))
		goto err2;

	/* Poke the request queue if necessary. */
	if (poke(Q))
		goto err3;

	/* Success! */
	return (0);

err3:
	ptrheap_delete(Q->reqs, R->rc);
err2:
	free(R->logstr);
err1:
	free(R);
err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r9, (%rsp)
movq %r8, %r13
movq %rcx, %rbx
movq %rdx, %r12
movl %esi, %ebp
movq %rdi, %r15
movl $0x90, %edi
callq 0x34d0
movq %rax, %r14
pushq $-0x1
popq %rax
testq %r14, %r14
je 0x6239
movq %r15, (%r14)
movq %r12, 0x8(%r14)
movq %rbx, 0x10(%r14)
movq %rbx, %rdi
callq 0x3190
movq %rax, 0x18(%r14)
movq %r13, 0x20(%r14)
movq 0x40(%rsp), %rax
movq %rax, 0x30(%r14)
movq 0x48(%rsp), %rax
movq %rax, 0x38(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x40(%r14)
movups %xmm0, 0x50(%r14)
movl %ebp, 0x78(%r14)
movq 0x78(%r15), %rax
leaq 0x1(%rax), %rcx
movq %rcx, 0x78(%r15)
movq %rax, 0x80(%r14)
andq $0x0, 0x88(%r14)
andq $0x0, 0x60(%r14)
movq (%rsp), %rdi
testq %rdi, %rdi
je 0x61f4
callq 0x35f0
movq %rax, 0x28(%r14)
testq %rax, %rax
jne 0x61f9
jmp 0x622e
andq $0x0, 0x28(%r14)
movq 0x70(%r15), %rdi
movq %r14, %rsi
callq 0x8025
testl %eax, %eax
jne 0x6225
movq %r15, %rdi
callq 0x624c
testl %eax, %eax
je 0x6248
movq 0x70(%r15), %rdi
movq 0x88(%r14), %rsi
callq 0x8137
movq 0x28(%r14), %rdi
callq 0x3460
movq %r14, %rdi
callq 0x3460
pushq $-0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0x6239
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../lib/dynamodb/dynamodb_request_queue.c
// Function: dynamodb_request_queue_flush
void
dynamodb_request_queue_flush(struct dynamodb_request_queue * Q)
{
	struct request * R;

	/* Pull requests off the queue until there are none left. */
	while ((R = ptrheap_getmin(Q->reqs)) != NULL) {
		/* Delete it from the queue. */
		ptrheap_deletemin(Q->reqs);

		/* Cancel any in-progress operation. */
		if (R->timeout_cookie != NULL)
			events_timer_cancel(R->timeout_cookie);
		if (R->http_cookie != NULL) {
			http_request_cancel(R->http_cookie);
			sock_addr_free(R->addrs[0]);
			Q->inflight--;
		}

		/* Free the request. */
		free(R->logstr);
		free(R);
	}
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x70(%rbx), %rdi
callq 0x8119
testq %rax, %rax
je 0x62e0
movq %rax, %r14
movq 0x70(%rbx), %rdi
callq 0x82ee
movq 0x58(%r14), %rdi
testq %rdi, %rdi
je 0x62b2
callq 0x4fb3
movq 0x50(%r14), %rdi
testq %rdi, %rdi
je 0x62cd
callq 0x881d
movq 0x40(%r14), %rdi
callq 0xb1bb
decq 0x68(%rbx)
movq 0x28(%r14), %rdi
callq 0x3460
movq %r14, %rdi
callq 0x3460
jmp 0x628a
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../lib/dynamodb/dynamodb_request_queue.c
// Function: dynamodb_request_queue_free
void
dynamodb_request_queue_free(struct dynamodb_request_queue * Q)
{

	/* Flush the queue. */
	dynamodb_request_queue_flush(Q);

	/* Stop the rate-limiting timer (if any). */
	if (Q->timer_cookie != NULL)
		events_timer_cancel(Q->timer_cookie);

	/* Cancel the immediate callback (if any). */
	if (Q->immediate_cookie != NULL)
		events_immediate_cancel(Q->immediate_cookie);

	/* Free the (now empty) request queue. */
	ptrheap_free(Q->reqs);

	/* Free string allocated by strdup. */
	free(Q->region);

	/* Free the AWS keys. */
	insecure_memzero(Q->key_secret, strlen(Q->key_secret));
	free(Q->key_secret);
	free(Q->key_id);

	/* Free the request queue structure. */
	free(Q);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x6283
movq 0x58(%rbx), %rdi
testq %rdi, %rdi
je 0x6302
callq 0x4fb3
movq 0x60(%rbx), %rdi
testq %rdi, %rdi
je 0x6310
callq 0x43d3
movq 0x70(%rbx), %rdi
callq 0x8344
movq 0x10(%rbx), %rdi
callq 0x3460
movq 0x8(%rbx), %r14
movq %r14, %rdi
callq 0x3190
leaq 0x122a3(%rip), %rcx     # 0x185d8
movq (%rcx), %rcx
movq %r14, %rdi
movq %rax, %rsi
callq *%rcx
movq 0x8(%rbx), %rdi
callq 0x3460
movq (%rbx), %rdi
callq 0x3460
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3460
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../lib/dynamodb/dynamodb_request_queue.c
// Function: callback_timeout
static int
callback_timeout(void * cookie)
{
	struct request * R = cookie;
	struct dynamodb_request_queue * Q = R->Q;

	/* We are no longer waiting for a timer callback. */
	R->timeout_cookie = NULL;

	/* Clean up the HTTP request. */
	if ((R->http_cookie != NULL) && done_http(R, 1))
		goto err0;

	/* The priority of this request has changed. */
	ptrheap_decrease(Q->reqs, R->rc);

	/*
	 * Poke the queue -- this request has moved from "in progress" back
	 * to "waiting to be sent", so it might be possible to send it now.
	 */
	if (poke(Q))
		goto err0;

	/* Success! */
	return (0);

err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq (%rdi), %rbx
andq $0x0, 0x58(%rdi)
cmpq $0x0, 0x50(%rdi)
je 0x6637
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x6a2f
testl %eax, %eax
jne 0x6653
movq 0x70(%rbx), %rdi
movq 0x88(%r14), %rsi
callq 0x82f5
movq %rbx, %rdi
callq 0x624c
testl %eax, %eax
je 0x6658
pushq $-0x1
popq %rax
jmp 0x665a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../lib/dynamodb/dynamodb_request_queue.c
// Function: done_http
static int
done_http(struct request * R, int timedout)
{
	struct dynamodb_request_queue * Q = R->Q;
	struct timeval t_end;
	int rc = 0;

	/* Cancel the request if we timed out. */
	if (timedout) {
		http_request_cancel(R->http_cookie);
		if (Q->logfile) {
			if (monoclock_get(&t_end)) {
				warnp("monoclock_get");
				t_end = R->t_start;
				rc = -1;
			}
			if (logreq(Q->logfile, R, NULL, 0.0, t_end, NULL))
				rc = -1;
		}
	}

	/* There is no longer a request in flight. */
	R->http_cookie = NULL;
	Q->inflight--;
	sock_addr_free(R->addrs[0]);
	R->addrs[0] = NULL;

	/* Return status. */
	return (rc);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movq (%rdi), %r12
xorl %r14d, %r14d
testl %esi, %esi
je 0x6ad7
movq 0x50(%rbx), %rdi
callq 0x881d
cmpq $0x0, 0x80(%r12)
je 0x6ad7
movq %rsp, %rdi
callq 0x5134
xorl %r14d, %r14d
movl $0x0, %ebp
testl %eax, %eax
je 0x6aae
callq 0x3040
cmpl $0x0, (%rax)
je 0x6a95
movq %rax, %r15
leaq 0x9d08(%rip), %rdi      # 0x10790
xorl %eax, %eax
callq 0x53ad
andl $0x0, (%r15)
jmp 0x6aa3
leaq 0x9cf4(%rip), %rdi      # 0x10790
xorl %eax, %eax
callq 0x553c
movups 0x68(%rbx), %xmm0
movaps %xmm0, (%rsp)
pushq $-0x1
popq %rbp
movq 0x80(%r12), %rdi
movq (%rsp), %rcx
movq 0x8(%rsp), %r8
xorps %xmm0, %xmm0
movq %rbx, %rsi
xorl %edx, %edx
xorl %r9d, %r9d
callq 0x6aff
negl %eax
sbbl %r14d, %r14d
orl %ebp, %r14d
andq $0x0, 0x50(%rbx)
decq 0x68(%r12)
movq 0x40(%rbx), %rdi
callq 0xb1bb
andq $0x0, 0x40(%rbx)
movl %r14d, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../lib/dynamodb/dynamodb_request_queue.c
// Function: logreq
static int
logreq(struct logging_file * F, struct request * R,
    struct http_response * res, double capacity,
    struct timeval t_end, char * ddberr)
{
	long t_micros;
	char * addr;
	int status;
	size_t bodylen;

	/* Compute how long the request took. */
	t_micros = (long)(t_end.tv_sec - R->t_start.tv_sec) * 1000000 +
	    t_end.tv_usec - R->t_start.tv_usec;

	/* Prettyprint the address we selected. */
	if ((addr = sock_addr_prettyprint(R->addrs[0])) == NULL)
		goto err0;

	/* Extract parameters from HTTP response. */
	if (res != NULL) {
		status = res->status;
		bodylen = res->bodylen;
	} else {
		status = 0;
		bodylen = 0;
	}

	/* Write to the log file. */
	if (logging_printf(F, "|%s|%s|%d|%s|%ld|%zu|%f|%s",
	    R->op, R->logstr ? R->logstr : "",
	    status, addr, t_micros, bodylen, capacity,
	    ddberr ? ddberr : ""))
		goto err1;

	/* Free string allocated by sock_addr_prettyprint. */
	free(addr);

	/* Success! */
	return (0);

err1:
	free(addr);
err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r9, %r14
movq %r8, %rbx
movq %rcx, %r15
movsd %xmm0, 0x10(%rsp)
movq %rdx, %r13
movq %rsi, %rbp
subq 0x68(%rsi), %r15
movq %rdi, 0x8(%rsp)
subq 0x70(%rsi), %rbx
movq 0x40(%rsi), %rdi
callq 0xb862
testq %rax, %rax
je 0x6b5c
movq %rax, %r12
imulq $0xf4240, %r15, %rax    # imm = 0xF4240
addq %rax, %rbx
xorl %r15d, %r15d
testq %r13, %r13
je 0x6b62
movl (%r13), %r8d
movq 0x18(%r13), %r10
jmp 0x6b68
pushq $-0x1
popq %r15
jmp 0x6bbf
xorl %r8d, %r8d
xorl %r10d, %r10d
movq 0x28(%rbp), %rcx
testq %rcx, %rcx
leaq 0xa334(%rip), %rax      # 0x10eaa
cmoveq %rax, %rcx
movq 0x8(%rbp), %rdx
testq %r14, %r14
cmoveq %rax, %r14
subq $0x8, %rsp
leaq 0x9c0e(%rip), %rsi      # 0x1079e
movq 0x10(%rsp), %rdi
movq %r12, %r9
movsd 0x18(%rsp), %xmm0
movb $0x1, %al
pushq %r14
pushq %r10
pushq %rbx
callq 0x6fe8
addq $0x20, %rsp
movq %rax, %rbx
movq %r12, %rdi
callq 0x3460
negq %rbx
sbbl %r15d, %r15d
movl %r15d, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../lib/logging/logging.c
// Function: logging_open
struct logging_file *
logging_open(const char * path)
{
	struct logging_file * F;

	/* Allocate a log file structure. */
	if ((F = malloc(sizeof(struct logging_file))) == NULL)
		goto err0;

	/* Duplicate the provided path. */
	if ((F->path = strdup(path)) == NULL)
		goto err1;

	/* Open the file. */
	if ((F->fd = doopen(F->path)) == -1)
		goto err2;

	/* Start the has-file-moved timer. */
	if ((F->timer_cookie =
	    events_timer_register_double(callback_timer, F, 1.0)) == NULL)
		goto err3;

	/* Success! */
	return (F);

err3:
	if (close(F->fd))
		warnp("close");
err2:
	free(F->path);
err1:
	free(F);
err0:
	/* Failure! */
	return (NULL);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
pushq $0x18
popq %rdi
callq 0x34d0
testq %rax, %rax
je 0x6c7a
movq %rax, %rbx
movq %r14, %rdi
callq 0x35f0
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x6c72
movq %rax, %rdi
callq 0x6c87
movl %eax, (%rbx)
cmpl $-0x1, %eax
je 0x6c69
leaq 0x276(%rip), %rdi       # 0x6e8c
movsd 0x9882(%rip), %xmm0     # 0x104a0
movq %rbx, %rsi
callq 0x4f7e
movq %rax, 0x10(%rbx)
testq %rax, %rax
jne 0x6c7c
movl (%rbx), %edi
callq 0x3650
testl %eax, %eax
je 0x6c69
callq 0x3040
cmpl $0x0, (%rax)
je 0x6c5b
movq %rax, %r14
leaq 0x95c3(%rip), %rdi      # 0x10211
xorl %eax, %eax
callq 0x53ad
andl $0x0, (%r14)
jmp 0x6c69
leaq 0x95af(%rip), %rdi      # 0x10211
xorl %eax, %eax
callq 0x553c
movq 0x8(%rbx), %rdi
callq 0x3460
movq %rbx, %rdi
callq 0x3460
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../lib/logging/logging.c
// Function: callback_timer
static int
callback_timer(void * cookie)
{
	struct stat sb_fd;
	struct stat sb_path;
	struct logging_file * F = cookie;

	/* Timer callback is no longer pending. */
	F->timer_cookie = NULL;

	/* Stat the file and the path. */
	if (fstat(F->fd, &sb_fd)) {
		warnp("fstat(%s)", F->path);
		goto err0;
	}
	if (stat(F->path, &sb_path)) {
		/* If the path doesn't exist, we need to reopen the file. */
		if (errno == ENOENT)
			goto reopen;

		/* Any other error is bad. */
		warnp("stat(%s)", F->path);
		goto err0;
	}

	/* If the path still points at the same file, do nothing. */
	if (S_ISREG(sb_fd.st_mode) && S_ISREG(sb_path.st_mode) &&
	    (sb_fd.st_dev == sb_path.st_dev) &&
	    (sb_fd.st_ino == sb_path.st_ino))
		goto done;

reopen:
	/* We need to close and re-open the log file. */
	if (close(F->fd))
		warnp("close");
	if ((F->fd = doopen(F->path)) == -1)
		goto err0;

done:
	/* Reset the callback. */
	if ((F->timer_cookie =
	    events_timer_register_double(callback_timer, F, 1.0)) == NULL)
		goto err0;

	/* Success! */
	return (0);

err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rdi, %rbx
andq $0x0, 0x10(%rdi)
movl (%rdi), %edi
leaq 0x98(%rsp), %rsi
callq 0x35c0
testl %eax, %eax
je 0x6ed9
callq 0x3040
cmpl $0x0, (%rax)
movq 0x8(%rbx), %rsi
je 0x6f0f
movq %rax, %r14
leaq 0x9a3a(%rip), %rdi      # 0x10903
xorl %eax, %eax
callq 0x53ad
andl $0x0, (%r14)
jmp 0x6fda
movq 0x8(%rbx), %rdi
leaq 0x8(%rsp), %rsi
callq 0x3310
testl %eax, %eax
je 0x6f18
callq 0x3040
movq %rax, %r14
movl (%rax), %eax
testl %eax, %eax
je 0x6f83
cmpl $0x2, %eax
je 0x6f57
movq 0x8(%rbx), %rsi
leaq 0x99f7(%rip), %rdi      # 0x10904
jmp 0x6ec9
leaq 0x99ed(%rip), %rdi      # 0x10903
jmp 0x6f8e
movl $0xf000, %eax           # imm = 0xF000
movl 0xb0(%rsp), %ecx
andl %eax, %ecx
cmpl $0x8000, %ecx           # imm = 0x8000
jne 0x6f57
andl 0x20(%rsp), %eax
cmpl $0x8000, %eax           # imm = 0x8000
jne 0x6f57
movq 0x98(%rsp), %rax
cmpq 0x8(%rsp), %rax
jne 0x6f57
movq 0xa0(%rsp), %rax
cmpq 0x10(%rsp), %rax
je 0x6fb5
movl (%rbx), %edi
callq 0x3650
testl %eax, %eax
je 0x6fa5
callq 0x3040
cmpl $0x0, (%rax)
je 0x6f97
movq %rax, %r14
leaq 0x929b(%rip), %rdi      # 0x10211
xorl %eax, %eax
callq 0x53ad
andl $0x0, (%r14)
jmp 0x6fa5
movq 0x8(%rbx), %rsi
leaq 0x9976(%rip), %rdi      # 0x10904
xorl %eax, %eax
callq 0x553c
jmp 0x6fda
leaq 0x9273(%rip), %rdi      # 0x10211
xorl %eax, %eax
callq 0x553c
movq 0x8(%rbx), %rdi
callq 0x6c87
movl %eax, (%rbx)
cmpl $-0x1, %eax
je 0x6fda
leaq -0x130(%rip), %rdi      # 0x6e8c
movsd 0x94dc(%rip), %xmm0     # 0x104a0
movq %rbx, %rsi
callq 0x4f7e
movq %rax, %rcx
movq %rax, 0x10(%rbx)
xorl %eax, %eax
testq %rcx, %rcx
jne 0x6fdd
pushq $-0x1
popq %rax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../lib/logging/logging.c
// Function: logging_close
void
logging_close(struct logging_file * F)
{

	/* Stop the has-file-moved timer if it's running. */
	if (F->timer_cookie != NULL)
		events_timer_cancel(F->timer_cookie);

	/* Close the log file if we have it open. */
	if ((F->fd != -1) && close(F->fd))
		warnp("close");

	/* Free the duplicated path string. */
	free(F->path);

	/* Free the structure. */
	free(F);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x10(%rdi), %rdi
testq %rdi, %rdi
je 0x7242
callq 0x4fb3
movl (%rbx), %edi
cmpl $-0x1, %edi
je 0x7281
callq 0x3650
testl %eax, %eax
je 0x7281
callq 0x3040
cmpl $0x0, (%rax)
je 0x7273
movq %rax, %r14
leaq 0x8fab(%rip), %rdi      # 0x10211
xorl %eax, %eax
callq 0x53ad
andl $0x0, (%r14)
jmp 0x7281
leaq 0x8f97(%rip), %rdi      # 0x10211
xorl %eax, %eax
callq 0x553c
movq 0x8(%rbx), %rdi
callq 0x3460
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3460
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/http/http.c
// Function: callback_connected
static int
callback_connected(void * cookie, int s)
{
	struct http_cookie * H = cookie;

	/* We're not connecting any more. */
	H->connect_cookie = NULL;

	/* Did we fail? */
	if (s == -1)
		return (fail(H));

	/* We have a connected socket. */
	H->s = s;

	/* Create a reader and a writer. */
	if (H->sslhost != NULL) {
		if ((H->ssl =
		    (network_ssl_open_func)(H->s, H->sslhost)) == NULL)
			return (die(H));
		if ((H->R =
		    (netbuf_ssl_read_init_func)(H->ssl)) == NULL)
			return (die(H));
		if ((H->W =
		    (netbuf_ssl_write_init_func)(H->ssl, fail, H)) == NULL)
			return (die(H));
	} else {
		if ((H->R = netbuf_read_init(H->s)) == NULL)
			return (die(H));
		if ((H->W = netbuf_write_init(H->s, fail, H)) == NULL)
			return (die(H));
	}

	/* Send the request. */
	if (netbuf_write_write(H->W, H->req_head, H->req_headlen))
		return (die(H));
	if ((H->req_bodylen > 0) &&
	    netbuf_write_write(H->W, H->req_body, H->req_bodylen))
		return (die(H));

	/* Enter response-reading loop. */
	return (callback_read_header(H, 0));
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
andq $0x0, 0x18(%rdi)
cmpl $-0x1, %esi
je 0x87a5
movl %esi, 0x8(%rbx)
movq 0x58(%rbx), %rax
movl %esi, %edi
testq %rax, %rax
je 0x87ae
movq %rax, %rsi
callq *0x20024(%rip)          # 0x28798
movq %rax, 0x10(%rbx)
testq %rax, %rax
je 0x87eb
movq %rax, %rdi
callq *0x20022(%rip)          # 0x287a8
movq %rax, 0x28(%rbx)
testq %rax, %rax
je 0x87eb
movq 0x10(%rbx), %rdi
leaq 0x1c7(%rip), %rsi       # 0x8961
movq %rbx, %rdx
callq *0x2000d(%rip)          # 0x287b0
jmp 0x87ce
movq %rbx, %rdi
popq %rbx
jmp 0x8961
callq 0x9368
movq %rax, 0x28(%rbx)
testq %rax, %rax
je 0x87eb
movl 0x8(%rbx), %edi
leaq 0x19b(%rip), %rsi       # 0x8961
movq %rbx, %rdx
callq 0x96e4
movq %rax, 0x20(%rbx)
testq %rax, %rax
je 0x87eb
movq 0x38(%rbx), %rdx
movq 0x40(%rbx), %rsi
movq %rax, %rdi
callq 0x99dc
testl %eax, %eax
je 0x87f8
movq %rbx, %rdi
callq 0x881d
pushq $-0x1
popq %rax
popq %rbx
retq
movq 0x48(%rbx), %rdx
testq %rdx, %rdx
je 0x8812
movq 0x20(%rbx), %rdi
movq 0x50(%rbx), %rsi
callq 0x99dc
testl %eax, %eax
jne 0x87eb
movq %rbx, %rdi
xorl %esi, %esi
popq %rbx
jmp 0x8983
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/http/http.c
// Function: http_request_cancel
void
http_request_cancel(void * cookie)
{
	struct http_cookie * H = cookie;

	/* Stop connecting if we're in the process of doing so. */
	if (H->connect_cookie != NULL)
		network_connect_cancel(H->connect_cookie);

	/* If we have a network reader, cancel any in-progress read. */
	if (H->R != NULL)
		netbuf_read_wait_cancel(H->R);

	/* Free the network reader and writer if they exist. */
	if (H->W != NULL)
		netbuf_write_free(H->W);
	if (H->R != NULL)
		netbuf_read_free(H->R);

	/* Close SSL context if we have one. */
	if (H->ssl != NULL)
		(network_ssl_close_func)(H->ssl);

	/* Close the socket if we are connected. */
	if ((H->s != -1) && close(H->s))
		warnp("close");

	/* Free duplicated SSL target hostname if we have one. */
	free(H->sslhost);

	/*
	 * Free internal buffers.  (req_body does not need to be freed since
	 * it is owned by the caller; res_body does need to be freed, since
	 * it is set to NULL if/when it is passed off to the caller).
	 */
	free(H->req_head);
	free(H->res_head);
	free(H->res.headers);
	free(H->res.body);

	/* Free the cookie. */
	free(H);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x18(%rdi), %rdi
testq %rdi, %rdi
je 0x8832
callq 0x9c3b
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x8840
callq 0x9608
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0x884e
callq 0x9a30
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0x885c
callq 0x967b
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x886b
callq *0x1ff35(%rip)          # 0x287a0
movl 0x8(%rbx), %edi
cmpl $-0x1, %edi
je 0x88ab
callq 0x3650
testl %eax, %eax
je 0x88ab
callq 0x3040
cmpl $0x0, (%rax)
je 0x889d
movq %rax, %r14
leaq 0x7981(%rip), %rdi      # 0x10211
xorl %eax, %eax
callq 0x53ad
andl $0x0, (%r14)
jmp 0x88ab
leaq 0x796d(%rip), %rdi      # 0x10211
xorl %eax, %eax
callq 0x553c
movq 0x58(%rbx), %rdi
callq 0x3460
movq 0x40(%rbx), %rdi
callq 0x3460
movq 0x80(%rbx), %rdi
callq 0x3460
movq 0xb8(%rbx), %rdi
callq 0x3460
movq 0xc8(%rbx), %rdi
callq 0x3460
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x3460
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/http/http.c
// Function: http_findheader
const char *
http_findheader(struct http_header * headers, size_t nheaders,
    const char * header)
{
	size_t i;

	/* Sanity check. */
	assert((headers != NULL) || (nheaders == 0));

	/* Search for the header. */
	for (i = 0; i < nheaders; i++) {
		if (strcmp(headers[i].header, header) == 0)
			return (headers[i].value);
	}

	/* Didn't find it. */
	return (NULL);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
sete %al
testq %rsi, %rsi
setne %cl
testb %cl, %al
jne 0x8942
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
incq %r15
xorl %r12d, %r12d
decq %r15
je 0x8933
movq (%r14), %rdi
addq $0x10, %r14
movq %rbx, %rsi
callq 0x3510
testl %eax, %eax
jne 0x8917
movq -0x8(%r14), %r12
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x83ca(%rip), %rdi      # 0x10d13
leaq 0x8321(%rip), %rsi      # 0x10c71
leaq 0x83e1(%rip), %rcx      # 0x10d38
movl $0x355, %edx            # imm = 0x355
callq 0x3210
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/http/http.c
// Function: sgetline
static char *
sgetline(uint8_t * buf, size_t buflen, size_t * bufpos, size_t * linelen)
{
	uint8_t * s = &buf[*bufpos];

	/* Find the \r\n. */
	*linelen = findeol(s, buflen - *bufpos);

	/* It had better be there. */
	assert(*linelen < buflen - *bufpos);

	/* Add NUL-terminator. */
	s[*linelen] = '\0';

	/* Adjust buffer position. */
	*bufpos += *linelen + 2;

	/* Return string. */
	return (char *)(s);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r15
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r14
movq (%rdx), %rax
addq %rax, %r14
subq %rax, %rsi
movq %r14, %rdi
callq 0x8e5e
movq %rax, (%r15)
subq (%rbx), %r12
cmpq %r12, %rax
jae 0x8ed1
movb $0x0, (%r14,%rax)
movq (%r15), %rax
movq (%rbx), %rcx
addq %rcx, %rax
addq $0x2, %rax
movq %rax, (%rbx)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x8034(%rip), %rdi      # 0x10f0c
leaq 0x7d92(%rip), %rsi      # 0x10c71
leaq 0x8042(%rip), %rcx      # 0x10f28
movl $0xa7, %edx
callq 0x3210
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/http/http.c
// Function: docallback
static int
docallback(struct http_cookie * H)
{
	int rc;

	/* Perform callback. */
	rc = (H->callback)(H->cookie, &H->res);

	/* The callback function now owns the response body buffer. */
	H->res.body = NULL;

	/* Free the cookie. */
	http_request_cancel(H);

	/* Return status from callback. */
	return (rc);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x68(%rdi), %rdi
leaq 0xa8(%rbx), %rsi
callq *0x60(%rbx)
movl %eax, %ebp
andq $0x0, 0xc8(%rbx)
movq %rbx, %rdi
callq 0x881d
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/util/parsenum.h
// Function: parsenum_unsigned
static inline uintmax_t
parsenum_unsigned(const char * s, uintmax_t min, uintmax_t max,
    uintmax_t typemax, int base, int trailing)
{
	char * eptr;
	uintmax_t val;

	/* Sanity check. */
	assert(s != NULL);

	val = strtoumax(s, &eptr, base);
	if (eptr == s || (!trailing && (*eptr != '\0')))
		errno = EINVAL;
	else if ((val < min) || (val > max) || (val > typemax))
		errno = ERANGE;
	return (val);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x90c8
movl %edx, %ebp
movl %esi, %edx
movq %rdi, %r14
movq %rsp, %r15
movq %r15, %rsi
callq 0x3350
movq %rax, %rbx
movq (%r15), %rax
cmpq %r14, %rax
je 0x90af
testl %ebp, %ebp
jne 0x90ba
cmpb $0x0, (%rax)
je 0x90ba
callq 0x3040
movl $0x16, (%rax)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x7ea7(%rip), %rdi      # 0x10f76
leaq 0x7eaa(%rip), %rsi      # 0x10f80
leaq 0x7f25(%rip), %rcx      # 0x11002
movl $0xbb, %edx
callq 0x3210
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/http/http.c
// Function: callback_read_toeof
static int
callback_read_toeof(void * cookie, int status)
{
	struct http_cookie * H = cookie;
	uint8_t * buf;
	size_t buflen;

	/* Did we fail? */
	if (status == -1)
		return (fail(H));

	/* Did we hit EOF? */
	if (status == 1)
		return (docallback(H));

	/* How much data is there? */
	netbuf_read_peek(H->R, &buf, &buflen);

	/* Is it too much? */
	if (buflen > H->res_bodylen_max - H->res.bodylen)
		return (toobig(H));

	/* Add this to our internal buffer. */
	if (addbody(H, buf, buflen))
		return (die(H));

	/* Consume the data. */
	netbuf_read_consume(H->R, buflen);

	/* Wait for at least one more byte to arrive. */
	if (netbuf_read_wait(H->R, 1, callback_read_toeof, H))
		return (die(H));

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

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
cmpl $0x1, %esi
je 0x910a
cmpl $-0x1, %esi
jne 0x9119
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r14
jmp 0x8961
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r14
jmp 0x8ef0
movq 0x28(%rbx), %rdi
leaq 0x10(%rsp), %rsi
leaq 0x8(%rsp), %r14
movq %r14, %rdx
callq 0x93cb
movq (%r14), %rdx
movq 0x98(%rbx), %rax
subq 0xc0(%rbx), %rax
cmpq %rax, %rdx
jbe 0x914f
movq %rbx, %rdi
callq 0x919f
jmp 0x9193
movq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x92a7
testl %eax, %eax
jne 0x9188
movq 0x28(%rbx), %rdi
movq 0x8(%rsp), %rsi
callq 0x9643
movq 0x28(%rbx), %rdi
leaq -0x92(%rip), %rdx       # 0x90e7
pushq $0x1
popq %rsi
movq %rbx, %rcx
callq 0x93e4
testl %eax, %eax
je 0x919b
movq %rbx, %rdi
callq 0x881d
pushq $-0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r14
retq
xorl %eax, %eax
jmp 0x9193
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/http/http.c
// Function: addbody
static int
addbody(struct http_cookie * H, uint8_t * buf, size_t buflen)
{
	size_t nalloc;
	uint8_t * nbuf;

	/* The caller should make sure we don't exceed the maximum length. */
	assert(H->res.bodylen + buflen <= H->res_bodylen_max);

	/* Reallocate if necessary. */
	if (H->res.bodylen + buflen > H->res_bodylen_alloc) {
		/* Double the buffer size. */
		nalloc = H->res_bodylen_alloc * 2;

		/* Increase if that isn't enough. */
		if (nalloc < H->res.bodylen + buflen)
			nalloc = H->res.bodylen + buflen;

		/* Decrease if we've gone too far. */
		if (nalloc > H->res_bodylen_max)
			nalloc = H->res_bodylen_max;

		/* Expand our memory allocation. */
		if ((nbuf = realloc(H->res.body, nalloc)) == NULL)
			goto err0;

		/* Record the new allocation and its size. */
		H->res.body = nbuf;
		H->res_bodylen_alloc = nalloc;
	}

	/* Copy the data into our (possibly expanded) buffer. */
	memcpy(&H->res.body[H->res.bodylen], buf, buflen);

	/* Record the increased data length. */
	H->res.bodylen += buflen;

	/* Success! */
	return (0);

err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x98(%rdi), %rax
movq 0xc0(%rdi), %rdi
leaq (%rdi,%rdx), %rcx
cmpq %rax, %rcx
ja 0x9346
movq %rdx, %rbx
movq %rsi, %r15
movq 0xa0(%r14), %r12
cmpq %r12, %rcx
jbe 0x9317
addq %r12, %r12
cmpq %rcx, %r12
cmovbeq %rcx, %r12
cmpq %rax, %r12
cmovaeq %rax, %r12
movq 0xc8(%r14), %rdi
movq %r12, %rsi
callq 0x35a0
testq %rax, %rax
je 0x9341
movq %rax, 0xc8(%r14)
movq %r12, 0xa0(%r14)
movq 0xc0(%r14), %rdi
jmp 0x931e
movq 0xc8(%r14), %rax
addq %rax, %rdi
movq %r15, %rsi
movq %rbx, %rdx
callq 0x3290
addq %rbx, 0xc0(%r14)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
pushq $-0x1
popq %rax
jmp 0x9335
leaq 0x7c52(%rip), %rdi      # 0x10f9f
leaq 0x791d(%rip), %rsi      # 0x10c71
leaq 0x7c72(%rip), %rcx      # 0x10fcd
movl $0xbb, %edx
callq 0x3210
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/util/b64encode.c
// Function: b64encode
void
b64encode(const uint8_t * in, char * out, size_t len)
{
	uint32_t t;
	size_t j;

	/* Repeat {read up to 3 bytes; write 4 bytes} until we're done. */
	while (len) {
		/* Read up to 3 bytes. */
		for (t = 0, j = 0; j < 3; j++) {
			t <<= 8;
			if (j < len)
				t += *in++;
		}

		/* Write 4 bytes. */
		for (j = 0; j < 4; j++) {
			if (j <= len)
				*out++ = b64chars[(t >> 18) & 0x3f];
			else
				*out++ = '=';
			t <<= 6;
		}

		/* Adjust the remaining length. */
		if (len < 3)
			len = 0;
		else
			len -= 3;
	}

	/* NUL terminate. */
	*out++ = '\0';
}

// Assembly:
leaq 0xe055(%rip), %rax      # 0x18670
testq %rdx, %rdx
je 0xa680
xorl %ecx, %ecx
xorl %r8d, %r8d
cmpq $0x3, %r8
je 0xa642
shll $0x8, %ecx
cmpq %rdx, %r8
jae 0xa63d
movzbl (%rdi), %r9d
incq %rdi
orl %r9d, %ecx
incq %r8
jmp 0xa625
xorl %r8d, %r8d
cmpq $0x4, %r8
je 0xa66e
movb $0x3d, %r9b
cmpq %rdx, %r8
ja 0xa662
movl %ecx, %r9d
shrl $0x12, %r9d
andl $0x3f, %r9d
movb (%r9,%rax), %r9b
movb %r9b, (%rsi,%r8)
shll $0x6, %ecx
incq %r8
jmp 0xa645
subq $0x3, %rdx
movl $0x0, %ecx
cmovbq %rcx, %rdx
addq %r8, %rsi
jmp 0xa61b
movb $0x0, (%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/util/b64encode.c
// Function: b64decode
int
b64decode(const char * in, size_t inlen, uint8_t * out, size_t * outlen)
{
	uint32_t t;
	ptrdiff_t pos;
	size_t deadbytes = 0;
	size_t i;

	/* We must have a multiple of 4 input bytes. */
	if (inlen % 4 != 0)
		goto bad;

	/* Check that we have valid input and count trailing '='s. */
	for (i = 0; i < inlen; i++) {
		/* Must be characters from our b64 character set. */
		if ((in[i] == '\0') || (strchr(b64chars, in[i]) == NULL))
			goto bad;

		/* Is this a '=' character? */
		if (in[i] == '=')
			deadbytes += 1;

		/* No non-'=' bytes after a '=' byte. */
		if ((in[i] != '=') && (deadbytes > 0))
			goto bad;
	}

	/* Can't have more than 2 trailing '=' bytes. */
	if (deadbytes > 2)
		goto bad;

	/* We have no output yet. */
	*outlen = 0;

	/* Loop until we run out of data. */
	while (inlen) {
		/* Parse 4 bytes. */
		for (t = 0, i = 0; i < 4; i++) {
			t <<= 6;
			pos = strchr(b64chars, in[i]) - b64chars;
			t += (uint32_t)(pos & 0x3f);
		}

		/* Output 3 bytes. */
		for (i = 0; i < 3; i++) {
			out[i] = (t >> 16) & 0xff;
			t <<= 8;
		}

		/* Adjust pointers and lengths for the completed block. */
		in += 4;
		inlen -= 4;
		out += 3;
		*outlen += 3;
	}

	/* Ignore dead bytes. */
	*outlen -= deadbytes;

	/* Success! */
	return (0);

bad:
	/* The input is not valid base-64 encoded text. */
	return (1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r15
pushq $0x1
popq %rax
testb $0x3, %r15b
jne 0xa6f0
movq %rdx, %r14
movq %rdi, %r12
xorl %ebx, %ebx
xorl %r13d, %r13d
movq %rcx, 0x8(%rsp)
cmpq %r13, %r15
je 0xa6ff
movsbl (%r12,%r13), %ebp
testl %ebp, %ebp
je 0xa6ed
leaq 0xdfad(%rip), %rdi      # 0x18670
movl %ebp, %esi
callq 0x3160
testq %rax, %rax
je 0xa6ed
xorl %eax, %eax
cmpb $0x3d, %bpl
sete %al
setne %cl
addq %rax, %rbx
setne %al
incq %r13
testb %al, %cl
movq 0x8(%rsp), %rcx
je 0xa6ae
pushq $0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x2, %rbx
pushq $0x1
popq %rax
ja 0xa6f0
xorl %eax, %eax
leaq 0xdf5f(%rip), %r13      # 0x18670
movq %rax, (%rcx)
testq %r15, %r15
je 0xa780
movq %r15, 0x10(%rsp)
xorl %ebp, %ebp
xorl %r15d, %r15d
cmpq $0x4, %r15
je 0xa748
shll $0x6, %ebp
movsbl (%r12,%r15), %esi
movq %r13, %rdi
callq 0x3160
subl %r13d, %eax
andl $0x3f, %eax
orl %ebp, %eax
incq %r15
movl %eax, %ebp
jmp 0xa723
xorl %eax, %eax
movq 0x8(%rsp), %rcx
movq 0x10(%rsp), %r15
cmpq $0x3, %rax
je 0xa76b
movl %ebp, %edx
shrl $0x10, %edx
movb %dl, (%r14,%rax)
shll $0x8, %ebp
incq %rax
jmp 0xa754
addq $0x4, %r12
addq $-0x4, %r15
addq $0x3, %r14
movq (%rcx), %rax
addq $0x3, %rax
jmp 0xa711
subq %rbx, %rax
movq %rax, (%rcx)
xorl %eax, %eax
jmp 0xa6f0
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/util/json.c
// Function: json_find
const uint8_t *
json_find(const uint8_t * buf, const uint8_t * end, const char * s)
{
	int foundit;

	/* After optional whitespace there should be a '{'. */
	SCAN(buf, end, '{');

	/* Scan the object looking for the child we want. */
	do {
		/*
		 * After optional whitespace we should have a '"' (unless
		 * the object is empty, in which case the key we're looking
		 * for is not present).
		 */
		SCAN(buf, end, '"');

		/* Is this the string we want? */
		buf = match_str(buf, end, s, &foundit);

		/* After optional whitespace we should have a ':'. */
		SCAN(buf, end, ':');

		/* Skip whitespace looking for the associated value. */
		buf = skip_ws(buf, end);

		/* Return the value if this is the one we wanted. */
		if (foundit)
			return (buf);

		/* Skip this JSON object. */
		buf = skip_value(buf, end);

		/*
		 * After optional whitespace we should have a ','.  (Or we
		 * could hit the closing '}' of the object, but that would
		 * mean that we don't have the key we're looking for anyway.)
		 */
		SCAN(buf, end, ',');
	} while (1);

	/* NOTREACHED */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
callq 0xa8f3
cmpq %rbx, %rax
je 0xa8e1
cmpb $0x7b, (%rax)
jne 0xa8e1
pushq $0x1
popq %rbp
leaq 0x6dfe(%rip), %r15      # 0x115c0
xorl %r12d, %r12d
incq %rax
movq %rax, %rdi
movq %rbx, %rsi
callq 0xa8f3
cmpq %rbx, %rax
je 0xa8e1
cmpb $0x22, (%rax)
jne 0xa8e1
incq %rax
movl %ebp, %r13d
movq %r14, %rcx
cmpq %rbx, %rax
je 0xa890
leaq 0x1(%rax), %rdi
movzbl (%rax), %edx
cmpl $0x5c, %edx
je 0xa81b
cmpl $0x22, %edx
je 0xa884
movb (%rcx), %al
cmpb %al, %dl
cmovnel %r12d, %r13d
cmpb $0x1, %al
sbbq $-0x1, %rcx
movq %rdi, %rax
jmp 0xa7ee
cmpq %rbx, %rdi
je 0xa890
leaq 0x2(%rax), %rdi
movb 0x1(%rax), %dl
movzbl %dl, %esi
leal -0x6e(%rsi), %r8d
cmpl $0x7, %r8d
jbe 0xa851
cmpl $0x22, %esi
je 0xa808
cmpl $0x2f, %esi
je 0xa808
cmpl $0x5c, %esi
je 0xa808
cmpl $0x66, %esi
je 0xa880
cmpl $0x62, %esi
jne 0xa88d
movb $0x8, %dl
jmp 0xa808
movslq (%r15,%r8,4), %rdx
addq %r15, %rdx
jmpq *%rdx
movb $0xa, %dl
jmp 0xa808
movb $0xd, %dl
jmp 0xa808
movq %rbx, %rdx
subq %rdi, %rdx
cmpq $0x4, %rdx
jl 0xa890
addq $0x6, %rax
movb $0x5c, %dl
xorl %r13d, %r13d
movq %rax, %rdi
jmp 0xa808
movb $0x9, %dl
jmp 0xa808
movb $0xc, %dl
jmp 0xa808
cmpb $0x0, (%rcx)
cmovnel %r12d, %r13d
jmp 0xa893
xorl %r13d, %r13d
movq %rbx, %rdi
movq %rbx, %rsi
callq 0xa8f3
cmpq %rbx, %rax
je 0xa8e1
cmpb $0x3a, (%rax)
jne 0xa8e1
incq %rax
movq %rax, %rdi
movq %rbx, %rsi
callq 0xa8f3
testl %r13d, %r13d
jne 0xa8de
movq %rax, %rdi
movq %rbx, %rsi
callq 0xa91a
movq %rax, %rdi
movq %rbx, %rsi
callq 0xa8f3
cmpq %rbx, %rax
je 0xa8e1
cmpb $0x2c, (%rax)
je 0xa7c5
jmp 0xa8e1
movq %rax, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/util/json.c
// Function: skip_value
static const uint8_t *
skip_value(const uint8_t * buf, const uint8_t * end)
{

	/* If there's nothing here, return. */
	if (buf == end)
		return (end);

	/* Handle different types of objects. */
	switch (buf[0]) {
	case 'f':
	case 'n':
	case 't':
		/* This must be a literal.  Skip it. */
		return (skip_literal(buf, end));
	case '"':
		/* This must be a string.  Skip it. */
		return (skip_string(buf, end));
	case '[':
		/* This must be an array.  Skip it. */
		return (skip_array(buf, end));
	case '{':
		/* This must be an object.  Skip it. */
		return (skip_object(buf, end));
	default:
		/* Could this plausibly be a number? */
		if (strchr(numchars, buf[0]) != NULL)
			return (skip_number(buf, end));

		/* We don't have a valid JSON value.  Return. */
		return (end);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
cmpq %rsi, %rdi
je 0xaad3
movq %rdi, %r14
movzbl (%rdi), %esi
cmpl $0x22, %esi
je 0xaabf
cmpl $0x5b, %esi
je 0xaa72
cmpl $0x66, %esi
je 0xa95b
cmpl $0x6e, %esi
je 0xa95b
cmpl $0x7b, %esi
je 0xa9b1
cmpl $0x74, %esi
jne 0xaa3b
movq %rbx, %rax
subq %r14, %rax
cmpq $0x5, %rax
jl 0xa986
leaq 0x6c72(%rip), %rsi      # 0x115e0
pushq $0x5
popq %rdx
movq %r14, %rdi
callq 0x33a0
testl %eax, %eax
jne 0xa990
addq $0x5, %r14
jmp 0xaad0
cmpq $0x4, %rax
jne 0xaad3
cmpl $0x6c6c756e, (%r14)     # imm = 0x6C6C756E
je 0xaacc
leaq 0x4(%r14), %rax
cmpl $0x65757274, (%r14)     # imm = 0x65757274
cmoveq %rax, %rbx
jmp 0xaad3
incq %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0xa8f3
cmpq %rbx, %rax
je 0xaad3
cmpb $0x7d, (%rax)
je 0xaa8a
movq %rax, %rdi
movq %rbx, %rsi
callq 0xaadc
movq %rax, %rdi
movq %rbx, %rsi
callq 0xa8f3
cmpq %rbx, %rax
je 0xaad3
cmpb $0x3a, (%rax)
jne 0xaad3
incq %rax
movq %rax, %rdi
movq %rbx, %rsi
callq 0xa8f3
movq %rax, %rdi
movq %rbx, %rsi
callq 0xa91a
movq %rax, %rdi
movq %rbx, %rsi
callq 0xa8f3
cmpq %rbx, %rax
je 0xaad3
movzbl (%rax), %ecx
incq %rax
cmpl $0x2c, %ecx
je 0xa9d1
cmpl $0x7d, %ecx
je 0xaa8d
jmp 0xaad3
leaq 0xdc7e(%rip), %rdi      # 0x186c0
callq 0x3160
testq %rax, %rax
je 0xaad3
leaq 0xdc69(%rip), %r15      # 0x186c0
cmpq %rbx, %r14
jae 0xaad0
movzbl (%r14), %esi
movq %r15, %rdi
callq 0x3160
testq %rax, %rax
je 0xaad0
incq %r14
jmp 0xaa57
incq %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0xa8f3
cmpq %rbx, %rax
je 0xaad3
cmpb $0x5d, (%rax)
jne 0xaa92
incq %rax
movq %rax, %rbx
jmp 0xaad3
movq %rax, %rdi
movq %rbx, %rsi
callq 0xa91a
movq %rax, %rdi
movq %rbx, %rsi
callq 0xa8f3
cmpq %rbx, %rax
je 0xaad3
movzbl (%rax), %ecx
incq %rax
cmpl $0x2c, %ecx
je 0xaa92
cmpl $0x5d, %ecx
je 0xaa8d
jmp 0xaad3
movq %r14, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0xaadc
addq $0x4, %r14
movq %r14, %rbx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/util/json.c
// Function: skip_string
static const uint8_t *
skip_string(const uint8_t * buf, const uint8_t * end)
{
	uint8_t ch;

	/* Advance past leading '"'. */
	buf++;

	/* Scan until we find a terminating '"' or run out of input. */
	while (buf < end) {
		ch = *buf++;
		if (ch == '"')
			break;
		if (ch == '\\') {
			if (buf == end)
				break;
			ch = *buf++;
			if (ch == 'u') {
				if (end - buf < 4)
					break;
				buf += 4;
			}
		}
	}

	/* Return our current position. */
	return (buf);
}

// Assembly:
movq %rdi, %rax
incq %rax
movq %rax, %rcx
cmpq %rsi, %rax
jae 0xab22
leaq 0x1(%rcx), %rax
movzbl (%rcx), %edx
cmpl $0x5c, %edx
je 0xaafd
cmpl $0x22, %edx
jne 0xaae2
jmp 0xab21
cmpq %rsi, %rax
je 0xab21
leaq 0x2(%rcx), %rax
cmpb $0x75, 0x1(%rcx)
jne 0xaae2
movq %rsi, %rdx
subq %rax, %rdx
cmpq $0x4, %rdx
jl 0xab21
addq $0x6, %rcx
movq %rcx, %rax
jmp 0xaae2
retq
movq %rcx, %rax
retq
nop
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../lib/dynamodb/dynamodb_request.c
// Function: dynamodb_request_extracterror
int
dynamodb_request_extracterror(struct http_response * res, char ** errstr)
{
	const uint8_t * buf = res->body;
	const uint8_t * end = res->body + res->bodylen;
	size_t len;

	/* Look for __type. */
	buf = json_find(buf, end, "__type");

	/*
	 * We should be pointing at the opening double-quote of a string;
	 * move past it.
	 */
	if (buf[0] != '"')
		goto bad;
	buf++;

	/* Find a '#' inside the double-quoted string and move past it. */
	for ( ; ; buf++) {
		if ((buf == end) || (buf[0] == '"'))
			goto bad;
		if (buf[0] == '#')
			break;
	}
	buf++;

	/* Find a '"' ending the double-quoted string. */
	for (len = 0; ; len++) {
		if (&buf[len] == end)
			goto bad;
		if (buf[len] == '"')
			break;
	}

	/* Duplicate the error string. */
	if ((*errstr = malloc(len + 1)) == NULL)
		goto err0;
	memcpy(*errstr, buf, len);
	(*errstr)[len] = '\0';

	/* Success! */
	return (0);

bad:
	warn0("DynamoDB sent HTTP 400 response without valid error string!");
	if ((*errstr = strdup("ErrorNotSpecified")) == NULL)
		goto err0;

	/* We successfully parsed; not our fault DynamoDB gave us garbage. */
	return (0);

err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movq 0x20(%rdi), %rax
movq 0x18(%rdi), %r14
addq %rax, %r14
leaq 0x5f37(%rip), %rdx      # 0x119a4
movq %rax, %rdi
movq %r14, %rsi
callq 0xa790
cmpb $0x22, (%rax)
jne 0xbae1
movq %rax, %r15
incq %rax
cmpq %r14, %rax
je 0xbae1
movzbl (%rax), %ecx
cmpl $0x22, %ecx
je 0xbae1
cmpl $0x23, %ecx
jne 0xba7d
addq $0x2, %r15
pushq $0x1
popq %rcx
leaq (%rax,%rcx), %rdx
cmpq %r14, %rdx
je 0xbae1
leaq 0x1(%rcx), %r12
cmpb $0x22, (%rax,%rcx)
movq %r12, %rcx
jne 0xba9c
leaq -0x1(%r12), %rdi
callq 0x34d0
movq %rax, (%rbx)
testq %rax, %rax
je 0xbb0d
movq %rax, %r14
leaq -0x2(%r12), %rdx
movq %rax, %rdi
movq %r15, %rsi
callq 0x3290
movb $0x0, -0x2(%r14,%r12)
xorl %ebp, %ebp
jmp 0xbb10
leaq 0x5ec3(%rip), %rdi      # 0x119ab
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x553c
callq 0x3040
andl $0x0, (%rax)
leaq 0x5ee7(%rip), %rdi      # 0x119e7
callq 0x35f0
movq %rax, (%rbx)
testq %rax, %rax
jne 0xbb10
pushq $-0x1
popq %rbp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/http/https.c
// Function: https_request
void *
https_request(struct sock_addr * const * addrs, struct http_request * request,
    size_t maxrlen, int (* callback)(void *, struct http_response *),
    void * cookie, const char * hostname)
{
	struct http_cookie * H;
	char * sslhost;

	/* Set function pointers. */
	network_ssl_open_func = network_ssl_open;
	network_ssl_close_func = network_ssl_close;
	netbuf_ssl_read_init_func = netbuf_ssl_read_init;
	netbuf_ssl_write_init_func = netbuf_ssl_write_init;

	/* Duplicate the hostname. */
	if ((sslhost = strdup(hostname)) == NULL)
		goto err0;

	/* Create an HTTP state. */
	if ((H = http_request2(addrs, request, maxrlen, callback,
	    cookie, sslhost)) == NULL)
		goto err1;

	/* Success! */
	return (H);

err1:
	free(sslhost);
err0:
	/* Failure! */
	return (NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %r13
leaq 0xe3(%rip), %rax        # 0xc874
leaq 0x1c000(%rip), %rcx     # 0x28798
movq %rax, (%rcx)
leaq 0x5e8(%rip), %rax       # 0xcd8a
leaq 0x1bff7(%rip), %rcx     # 0x287a0
movq %rax, (%rcx)
leaq 0x61(%rip), %rax        # 0xc814
leaq 0x1bfee(%rip), %rcx     # 0x287a8
movq %rax, (%rcx)
leaq 0x7d(%rip), %rax        # 0xc841
leaq 0x1bfe5(%rip), %rcx     # 0x287b0
movq %rax, (%rcx)
movq %r9, %rdi
callq 0x35f0
testq %rax, %rax
je 0xc802
movq %rax, %rbp
movq %r13, %rdi
movq %r12, %rsi
movq %r15, %rdx
movq %r14, %rcx
movq %rbx, %r8
movq %rax, %r9
callq 0x84ec
testq %rax, %rax
jne 0xc804
movq %rbp, %rdi
callq 0x3460
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/network_ssl/network_ssl.c
// Function: network_ssl_read
void *
network_ssl_read(struct network_ssl_ctx * ssl, uint8_t * buf,
    size_t buflen, size_t minread,
    int (* callback)(void *, ssize_t), void * cookie)
{

	/* We must be initialized before we get here. */
	assert(ctx != NULL);

	/* Make sure buflen is non-zero. */
	assert(buflen != 0);

	/* Sanity-check: # bytes must fit into a ssize_t. */
	assert(buflen <= SSIZE_MAX);

	/* Sanity-check: Must not have a read already in progress. */
	assert(ssl->read_callback == NULL);

	/* Record details of the pending request. */
	ssl->read_callback = callback;
	ssl->read_cookie = cookie;
	ssl->read_buf = buf;
	ssl->read_buflen = buflen;
	ssl->read_minlen = minread;
	ssl->read_bufpos = 0;
	ssl->read_needs_r = 0;
	ssl->read_needs_w = 0;

	/* Poke the SSL stack. */
	if (ssl->immediate_cookie == NULL) {
		if ((ssl->immediate_cookie = events_immediate_register(
		    callback_immediate, ssl, 0)) == NULL)
			goto err0;
	}

	/* Success! */
	return (ssl);

err0:
	/* Failure! */
	return (NULL);
}

// Assembly:
pushq %rbx
cmpq $0x0, 0x1be3e(%rip)     # 0x288e0
je 0xcb00
testq %rdx, %rdx
je 0xcb1f
js 0xcb3e
movq %rdi, %rbx
cmpq $0x0, 0x20(%rdi)
jne 0xcb5d
movq %r8, 0x20(%rbx)
movq %r9, 0x28(%rbx)
movq %rsi, 0x30(%rbx)
movq %rdx, 0x38(%rbx)
movq %rcx, 0x40(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x48(%rbx)
cmpq $0x0, 0x18(%rbx)
jne 0xcafb
leaq 0x96(%rip), %rdi        # 0xcb7c
movq %rbx, %rsi
xorl %edx, %edx
callq 0x42e8
movq %rax, 0x18(%rbx)
testq %rax, %rax
cmoveq %rax, %rbx
movq %rbx, %rax
popq %rbx
retq
leaq 0x54b7(%rip), %rdi      # 0x11fbe
leaq 0x54bc(%rip), %rsi      # 0x11fca
leaq 0x54de(%rip), %rcx      # 0x11ff3
movl $0x23f, %edx            # imm = 0x23F
callq 0x3210
leaq 0x494b(%rip), %rdi      # 0x11471
leaq 0x549d(%rip), %rsi      # 0x11fca
leaq 0x54bf(%rip), %rcx      # 0x11ff3
movl $0x242, %edx            # imm = 0x242
callq 0x3210
leaq 0x49b3(%rip), %rdi      # 0x114f8
leaq 0x547e(%rip), %rsi      # 0x11fca
leaq 0x54a0(%rip), %rcx      # 0x11ff3
movl $0x245, %edx            # imm = 0x245
callq 0x3210
leaq 0x54fd(%rip), %rdi      # 0x12061
leaq 0x545f(%rip), %rsi      # 0x11fca
leaq 0x5481(%rip), %rcx      # 0x11ff3
movl $0x248, %edx            # imm = 0x248
callq 0x3210
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/liball/../libcperciva/network_ssl/network_ssl.c
// Function: setupevents
static int
setupevents(struct network_ssl_ctx * ssl)
{

	/* Cancel network events if no longer needed. */
	if (ssl->waiting_r && !ssl->read_needs_r && !ssl->write_needs_r) {
		if (events_network_cancel(ssl->s, EVENTS_NETWORK_OP_READ))
			goto err0;
		ssl->waiting_r = 0;
	}
	if (ssl->waiting_w && !ssl->read_needs_w && !ssl->write_needs_w) {
		if (events_network_cancel(ssl->s, EVENTS_NETWORK_OP_WRITE))
			goto err0;
		ssl->waiting_w = 0;
	}

	/* Register network events if needed. */
	if (!ssl->waiting_r && (ssl->read_needs_r || ssl->write_needs_r)) {
		if (events_network_register(callback_read, ssl, ssl->s,
		    EVENTS_NETWORK_OP_READ))
			goto err0;
		ssl->waiting_r = 1;
	}
	if (!ssl->waiting_w && (ssl->read_needs_w || ssl->write_needs_w)) {
		if (events_network_register(callback_write, ssl, ssl->s,
		    EVENTS_NETWORK_OP_WRITE))
			goto err0;
		ssl->waiting_w = 1;
	}

	/* Success! */
	return (0);

err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
movl 0x10(%rdi), %eax
pushq $-0x1
popq %rbx
movl $0x0, %ebp
testl %eax, %eax
je 0xcbc3
cmpl $0x0, 0x50(%r14)
je 0xcbb3
movl %eax, %ebp
jmp 0xcbc3
cmpl $0x0, 0x88(%r14)
movl %eax, %ebp
je 0xcc71
movl 0x14(%r14), %eax
testl %eax, %eax
je 0xcbf8
cmpl $0x0, 0x54(%r14)
jne 0xcbfa
cmpl $0x0, 0x8c(%r14)
jne 0xcbfa
movl (%r14), %edi
pushq $0x1
popq %rsi
callq 0x493c
testl %eax, %eax
jne 0xcc81
andl $0x0, 0x14(%r14)
movl 0x10(%r14), %ebp
xorl %eax, %eax
testl %ebp, %ebp
je 0xcc06
testl %eax, %eax
je 0xcc3d
xorl %ebx, %ebx
jmp 0xcc81
cmpl $0x0, 0x50(%r14)
jne 0xcc17
cmpl $0x0, 0x88(%r14)
je 0xcbfe
movl (%r14), %edx
leaq 0x630(%rip), %rdi       # 0xd251
movq %r14, %rsi
xorl %ecx, %ecx
callq 0x45e0
testl %eax, %eax
jne 0xcc81
movl $0x1, 0x10(%r14)
movl 0x14(%r14), %eax
jmp 0xcbfe
cmpl $0x0, 0x54(%r14)
jne 0xcc4e
cmpl $0x0, 0x8c(%r14)
je 0xcc02
movl (%r14), %edx
leaq 0x60d(%rip), %rdi       # 0xd265
pushq $0x1
popq %rcx
movq %r14, %rsi
callq 0x45e0
testl %eax, %eax
jne 0xcc81
movl $0x1, 0x14(%r14)
jmp 0xcc02
movl (%r14), %edi
xorl %ebp, %ebp
xorl %esi, %esi
callq 0x493c
testl %eax, %eax
je 0xcc88
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
andl $0x0, 0x10(%r14)
jmp 0xcbc3