// File: /workspace/github_c_makefile_star2_O0/glk[P]critbit/critbit-test.c
// Function: test_benchmark_critbit
static void
test_benchmark_critbit(void)
{
	CRITBIT_HEAD(eltree) tree;
	struct element *el, *test_data_el;
	struct critbit_node *nnode;
	int cnt;
	int i;

	CRITBIT_INIT(eltree, &tree, no_free, NULL);

	for (cnt = 0; test_data[cnt]; ) {
		cnt++;
	}
	test_data_el = malloc(cnt * sizeof(*test_data_el));

	int loopcnt = loopcnt_init;
	struct timeval tstart, tend;

        gettimeofday(&tstart, NULL);

again:
	for (i = 0; i < cnt; ++i) {
		el = &test_data_el[i];
		el->k = test_data[i];
		nnode = malloc(critbit_node_size());
		CRITBIT_INSERT(eltree, &tree, nnode, el);
	}

	for (i = cnt - 1; i >= 0; i--) {
		el = CRITBIT_GET(eltree, &tree, test_data[i]);
		if (el == NULL)
			abort();
	}

	for (i = 3; i < cnt; i += 5) {
		el = CRITBIT_REMOVE(eltree, &tree, test_data[i]);
		if (el == NULL)
			abort();
	}

	for (i = 2; i < cnt; i += 3) {
		el = CRITBIT_GET(eltree, &tree, test_data[i]);
	}

	for (i = 0; i < cnt; i ++) {
		el = CRITBIT_REMOVE(eltree, &tree, test_data[i]);
	}

	if (loopcnt-- > 0)
		goto again;
        gettimeofday(&tend, NULL);

	benchmark_result("critbit", loopcnt_init, &tstart, &tend);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
leaq -0x20(%rbp), %rax
movq %rax, -0x70(%rbp)
callq 0xea40
movq -0x70(%rbp), %rdi
movq %rax, %rcx
leaq 0x55d(%rip), %rsi       # 0xeb60
xorl %eax, %eax
movl %eax, %edx
callq 0xd1d0
movl $0x0, -0x3c(%rbp)
movslq -0x3c(%rbp), %rcx
leaq 0xba52(%rip), %rax      # 0x1a070
cmpq $0x0, (%rax,%rcx,8)
je 0xe630
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0xe613
movslq -0x3c(%rbp), %rax
imulq $0x48, %rax, %rdi
callq 0xd0b0
movq %rax, -0x30(%rbp)
movl $0x3e8, -0x44(%rbp)     # imm = 0x3E8
leaq -0x58(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xd070
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0xe6bb
movq -0x30(%rbp), %rax
movslq -0x40(%rbp), %rcx
imulq $0x48, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movslq -0x40(%rbp), %rcx
leaq 0xb9ee(%rip), %rax      # 0x1a070
movq (%rax,%rcx,8), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
callq 0xd1c0
movq %rax, %rdi
callq 0xd0b0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rsi
movq -0x28(%rbp), %rdx
leaq -0x20(%rbp), %rdi
callq 0xea60
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0xe65c
movl -0x3c(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x40(%rbp)
cmpl $0x0, -0x40(%rbp)
jl 0xe6ff
movslq -0x40(%rbp), %rcx
leaq 0xb99b(%rip), %rax      # 0x1a070
movq (%rax,%rcx,8), %rsi
leaq -0x20(%rbp), %rdi
callq 0xeac0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xe6f2
callq 0xd040
jmp 0xe6f4
movl -0x40(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0xe6c4
movl $0x3, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0xe743
movslq -0x40(%rbp), %rcx
leaq 0xb957(%rip), %rax      # 0x1a070
movq (%rax,%rcx,8), %rsi
leaq -0x20(%rbp), %rdi
callq 0xeb10
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xe736
callq 0xd040
jmp 0xe738
movl -0x40(%rbp), %eax
addl $0x5, %eax
movl %eax, -0x40(%rbp)
jmp 0xe706
movl $0x2, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0xe779
movslq -0x40(%rbp), %rcx
leaq 0xb913(%rip), %rax      # 0x1a070
movq (%rax,%rcx,8), %rsi
leaq -0x20(%rbp), %rdi
callq 0xeac0
movq %rax, -0x28(%rbp)
movl -0x40(%rbp), %eax
addl $0x3, %eax
movl %eax, -0x40(%rbp)
jmp 0xe74a
movl $0x0, -0x40(%rbp)
movl -0x40(%rbp), %eax
cmpl -0x3c(%rbp), %eax
jge 0xe7af
movslq -0x40(%rbp), %rcx
leaq 0xb8dd(%rip), %rax      # 0x1a070
movq (%rax,%rcx,8), %rsi
leaq -0x20(%rbp), %rdi
callq 0xeb10
movq %rax, -0x28(%rbp)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0xe780
movl -0x44(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x44(%rbp)
cmpl $0x0, %eax
jle 0xe7c4
jmp 0xe655
leaq -0x68(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xd070
leaq 0x9226(%rip), %rdi      # 0x179fe
movl $0x3e8, %esi            # imm = 0x3E8
leaq -0x58(%rbp), %rdx
leaq -0x68(%rbp), %rcx
callq 0xec30
addq $0x70, %rsp
popq %rbp
retq