// File: /workspace/github_c_makefile_star2_O0/Tarsnap[P]kivaloo/bench/bulk_insert/main.c
// Function: callback_done
static int
callback_done(void * cookie, int failed)
{
	struct bulkinsert_state * C = cookie;
	struct timeval tv_now;

	/* This request is no longer in progress. */
	C->Nip -= 1;

	/* This request is done. */
	C->Ndone += 1;

	/* Did we fail? */
	if (failed) {
		C->done = 1;
		C->failed = 1;
	}

	/* Store new power-of-two timestamp? */
	if ((C->Ndone & (C->Ndone - 1)) == 0) {
		/* If we have a saved timestamp, print results. */
		if (C->Ndone_saved)
			printperf(C);

		/* Store new timestamp. */
		C->Ndone_saved = C->Ndone;
		if (monoclock_get(&C->tv_saved)) {
			warnp("Error reading clock");
			goto err0;
		}
	}

	/* Has it been 1s since the stored timestamp? */
	if (C->Ndone_saved) {
		if (monoclock_get(&tv_now)) {
			warnp("Error reading clock");
			goto err0;
		}
		if ((tv_now.tv_sec >= C->tv_saved.tv_sec + 10) &&
		    ((tv_now.tv_sec > C->tv_saved.tv_sec + 10) ||
		     (tv_now.tv_usec > C->tv_saved.tv_usec)))
			printperf(C);
	}

	/* Send more requests if possible. */
	if (sendbatch(C))
		goto err0;

	/* Are we done? */
	if (C->Nip == 0)
		C->done = 1;

	/* Success! */
	return (0);

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rcx
subq $0x1, %rcx
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x20(%rax)
cmpl $0x0, -0x14(%rbp)
je 0x2853
movq -0x20(%rbp), %rax
movl $0x1, 0x1c(%rax)
movq -0x20(%rbp), %rax
movl $0x1, 0x18(%rax)
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x20(%rbp), %rcx
movq 0x20(%rcx), %rcx
subq $0x1, %rcx
andq %rcx, %rax
cmpq $0x0, %rax
jne 0x28e4
movq -0x20(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x2884
movq -0x20(%rbp), %rdi
callq 0x29c0
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x20(%rbp), %rdi
addq $0x30, %rdi
callq 0x49a0
cmpl $0x0, %eax
je 0x28e2
jmp 0x28a8
callq 0x20a0
cmpl $0x0, (%rax)
je 0x28cd
leaq 0xc81c(%rip), %rdi      # 0xf0d5
movb $0x0, %al
callq 0x6930
callq 0x20a0
movl $0x0, (%rax)
jmp 0x28db
leaq 0xc801(%rip), %rdi      # 0xf0d5
movb $0x0, %al
callq 0x6b80
jmp 0x28dd
jmp 0x29ac
jmp 0x28e4
movq -0x20(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x297d
leaq -0x30(%rbp), %rdi
callq 0x49a0
cmpl $0x0, %eax
je 0x293a
jmp 0x2903
callq 0x20a0
cmpl $0x0, (%rax)
je 0x2928
leaq 0xc7c1(%rip), %rdi      # 0xf0d5
movb $0x0, %al
callq 0x6930
callq 0x20a0
movl $0x0, (%rax)
jmp 0x2936
leaq 0xc7a6(%rip), %rdi      # 0xf0d5
movb $0x0, %al
callq 0x6b80
jmp 0x2938
jmp 0x29ac
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
movq 0x30(%rcx), %rcx
addq $0xa, %rcx
cmpq %rcx, %rax
jl 0x297b
movq -0x30(%rbp), %rax
movq -0x20(%rbp), %rcx
movq 0x30(%rcx), %rcx
addq $0xa, %rcx
cmpq %rcx, %rax
jg 0x2972
movq -0x28(%rbp), %rax
movq -0x20(%rbp), %rcx
cmpq 0x38(%rcx), %rax
jle 0x297b
movq -0x20(%rbp), %rdi
callq 0x29c0
jmp 0x297d
movq -0x20(%rbp), %rdi
callq 0x2730
cmpl $0x0, %eax
je 0x298d
jmp 0x29ac
movq -0x20(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x29a3
movq -0x20(%rbp), %rax
movl $0x1, 0x1c(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x29b3
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopl (%rax)