// File: /workspace/github_c_makefile_star2_O0/Tarsnap[P]kivaloo/liball/../lib/bench/bench.c
// Function: bench_init
struct bench *
bench_init(size_t start, size_t num_seconds)
{
	struct bench * B;
	struct timeval tv_now;

	/* Sanity checks. */
	assert((start + num_seconds) < INT_MAX);
	assert(num_seconds > 0);

	/* Allocate and initialize cookie. */
	if ((B = malloc(sizeof(struct bench))) == NULL) {
		warn0("malloc");
		goto err0;
	}
	B->num_seconds = num_seconds;
	B->started = 0;

	/* Allocate and initialize tick counts. */
	if ((B->ticks = malloc(num_seconds * sizeof(uint64_t))) == NULL) {
		warn0("malloc");
		goto err1;
	}
	if ((B->sorted = malloc(num_seconds * sizeof(uint64_t))) == NULL) {
		warn0("malloc");
		goto err2;
	}
	memset(B->ticks, 0, num_seconds * sizeof(uint64_t));
	B->tick_pos = 0;

	/* Get current time. */
	if (monoclock_get(&tv_now)) {
		warnp("monoclock_get");
		goto err3;
	}

	/* Prepare start benchmark time value. */
	B->tv_start.tv_sec = tv_now.tv_sec + (int)start;
	B->tv_start.tv_usec = tv_now.tv_usec;

	/* Success! */
	return (B);

err3:
	free(B->sorted);
err2:
	free(B->ticks);
err1:
	free(B);
err0:
	/* Failure! */
	return (NULL);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
addq -0x18(%rbp), %rax
cmpq $0x7fffffff, %rax       # imm = 0x7FFFFFFF
jae 0x6c72
jmp 0x6c91
leaq 0x8ba7(%rip), %rdi      # 0xf820
leaq 0x8bc0(%rip), %rsi      # 0xf840
movl $0x27, %edx
leaq 0x8bc9(%rip), %rcx      # 0xf855
callq 0x21a0
cmpq $0x0, -0x18(%rbp)
jbe 0x6c9a
jmp 0x6cb9
leaq 0x8bf5(%rip), %rdi      # 0xf896
leaq 0x8b98(%rip), %rsi      # 0xf840
movl $0x28, %edx
leaq 0x8ba1(%rip), %rcx      # 0xf855
callq 0x21a0
movl $0x48, %edi
callq 0x2230
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0x6ced
jmp 0x6ccf
leaq 0x8ba8(%rip), %rdi      # 0xf87e
movb $0x0, %al
callq 0x6a10
callq 0x20a0
movl $0x0, (%rax)
jmp 0x6e31
movq -0x18(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movq -0x20(%rbp), %rax
movl $0x0, 0x40(%rax)
movq -0x18(%rbp), %rdi
shlq $0x3, %rdi
callq 0x2230
movq -0x20(%rbp), %rcx
movq %rax, 0x8(%rcx)
cmpq $0x0, %rax
jne 0x6d3e
jmp 0x6d20
leaq 0x8b57(%rip), %rdi      # 0xf87e
movb $0x0, %al
callq 0x6a10
callq 0x20a0
movl $0x0, (%rax)
jmp 0x6e28
movq -0x18(%rbp), %rdi
shlq $0x3, %rdi
callq 0x2230
movq -0x20(%rbp), %rcx
movq %rax, 0x10(%rcx)
cmpq $0x0, %rax
jne 0x6d79
jmp 0x6d5b
leaq 0x8b1c(%rip), %rdi      # 0xf87e
movb $0x0, %al
callq 0x6a10
callq 0x20a0
movl $0x0, (%rax)
jmp 0x6e1b
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x18(%rbp), %rdx
shlq $0x3, %rdx
xorl %esi, %esi
callq 0x21b0
movq -0x20(%rbp), %rax
movq $0x0, 0x18(%rax)
leaq -0x30(%rbp), %rdi
callq 0x4830
cmpl $0x0, %eax
je 0x6de3
jmp 0x6dac
callq 0x20a0
cmpl $0x0, (%rax)
je 0x6dd1
leaq 0x8ac8(%rip), %rdi      # 0xf885
movb $0x0, %al
callq 0x67c0
callq 0x20a0
movl $0x0, (%rax)
jmp 0x6ddf
leaq 0x8aad(%rip), %rdi      # 0xf885
movb $0x0, %al
callq 0x6a10
jmp 0x6de1
jmp 0x6e0e
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
cltq
addq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6e39
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x2040
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x2040
movq -0x20(%rbp), %rdi
callq 0x2040
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)