// File: /workspace/github_cpp_makefile_star2_O2/narula[P]skiplists/skiplist.cc
// Function: basic_test()
void basic_test() {
  SkipList* sk = SkipList::init_list(1000, 1000, 2);
  int error = 0;
  for (int i = 999; i >= 0; i--) {
	if (sk->lookup(i) <= 0) {
	  printf("Error lookup: %d\n", i);
	  error = 1;
	}
  }
  if (sk->insert(998) > 0) {
	printf("Error insert: %d\n", 998);
	error = 1;
  }
  if (sk->lookup(2000) > 0) {
	  printf("Error lookup: %d\n", 2000);
	  error = 1;
  }
  if (sk->insert(2000) <= 0) {
	printf("Error insert: %d\n", 2000);
	error = 1;
  }
  if (sk->lookup(2000) <= 0) {
	printf("Error lookup: %d\n", 2000);
	error = 1;
  }
  SkipList* sk2 = new SkipList(2, 4);
  for (int i = 0; i < 20; i+=4) {
	if (sk2->insert(i) <= 0)  {
	  printf("Error making small list: %d\n", i);
	  error = 1;
	}
  }
  for (int i = 1; i < 30; i+=5) {
	if (sk2->insert(i) <=0 && i%4 != 0) {
	  printf("Error making small list: %d\n", i);
	  error = 1;
	}
  }
  for (int i = 26; i >= 1; i-=5) {
	if (sk2->lookup(i) != 1) {
	  printf("Error lookup by 5 in small list: %d\n", i);
	  error = 1;	  
	}
  }
  for (int i = 16; i >= 0; i-=4) {
	if (sk2->lookup(i) != 1) {
	  printf("Error lookup by 4 in small list: %d\n", i);
	  error = 1;	  
	}
  }
  if (!error) {
	printf("PASSED\n");
  } else {
	sk2->pretty_print_skiplist();
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq $0x2
popq %rdx
movl $0x3e8, %edi            # imm = 0x3E8
movl $0x3e8, %esi            # imm = 0x3E8
callq 0x1700
movq %rax, %rbx
movl $0x3e7, %ebp            # imm = 0x3E7
leaq 0x8ab(%rip), %r14       # 0x2070
pushq $0x1
popq %r12
xorl %r15d, %r15d
movq %rbx, %rdi
testl %ebp, %ebp
js 0x17f1
movl %ebp, %esi
callq 0x12dc
testl %eax, %eax
jne 0x17ed
movq %r14, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x1030
movl %r12d, %r15d
decl %ebp
jmp 0x17cc
movl $0x3e6, %esi            # imm = 0x3E6
callq 0x1474
testl %eax, %eax
je 0x1816
leaq 0x87c(%rip), %rdi       # 0x2082
movl $0x3e6, %esi            # imm = 0x3E6
xorl %eax, %eax
callq 0x1030
pushq $0x1
popq %r15
movq %rbx, %rdi
movl $0x7d0, %esi            # imm = 0x7D0
callq 0x12dc
testl %eax, %eax
je 0x183e
leaq 0x842(%rip), %rdi       # 0x2070
movl $0x7d0, %esi            # imm = 0x7D0
xorl %eax, %eax
callq 0x1030
pushq $0x1
popq %r15
movq %rbx, %rdi
movl $0x7d0, %esi            # imm = 0x7D0
callq 0x1474
testl %eax, %eax
jne 0x1866
leaq 0x82c(%rip), %rdi       # 0x2082
movl $0x7d0, %esi            # imm = 0x7D0
xorl %eax, %eax
callq 0x1030
pushq $0x1
popq %r15
movq %rbx, %rdi
movl $0x7d0, %esi            # imm = 0x7D0
callq 0x12dc
testl %eax, %eax
jne 0x188e
leaq 0x7f2(%rip), %rdi       # 0x2070
movl $0x7d0, %esi            # imm = 0x7D0
xorl %eax, %eax
callq 0x1030
pushq $0x1
popq %r15
pushq $0x20
popq %rdi
callq 0x10a0
movq %rax, %rbx
pushq $0x2
popq %rsi
pushq $0x4
popq %rdx
movq %rax, %rdi
callq 0x120c
leaq 0x7e6(%rip), %r14       # 0x2094
pushq $0x1
popq %r12
xorl %ebp, %ebp
cmpl $0x14, %ebp
jae 0x18db
movq %rbx, %rdi
movl %ebp, %esi
callq 0x1474
testl %eax, %eax
jne 0x18d6
movq %r14, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x1030
movl %r12d, %r15d
addl $0x4, %ebp
jmp 0x18b4
pushq $0x1
popq %r12
leaq 0x7ae(%rip), %r14       # 0x2094
movl %r12d, %ebp
cmpl $0x1e, %ebp
jae 0x1916
movq %rbx, %rdi
movl %ebp, %esi
callq 0x1474
testb $0x3, %bpl
je 0x1911
testl %eax, %eax
jne 0x1911
movq %r14, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x1030
movl %r12d, %r15d
addl $0x5, %ebp
jmp 0x18e9
pushq $0x1a
popq %rbp
leaq 0x791(%rip), %r14       # 0x20b1
pushq $0x1
popq %r12
testl %ebp, %ebp
jle 0x194a
movq %rbx, %rdi
movl %ebp, %esi
callq 0x12dc
testl %eax, %eax
jne 0x1945
movq %r14, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x1030
movl %r12d, %r15d
addl $-0x5, %ebp
jmp 0x1924
pushq $0x10
popq %rbp
leaq 0x782(%rip), %r14       # 0x20d6
pushq $0x1
popq %r12
testl %ebp, %ebp
js 0x197e
movq %rbx, %rdi
movl %ebp, %esi
callq 0x12dc
testl %eax, %eax
jne 0x1979
movq %r14, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x1030
movl %r12d, %r15d
addl $-0x4, %ebp
jmp 0x1958
testl %r15d, %r15d
je 0x1993
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1584
leaq 0x7b4(%rip), %rdi       # 0x214e
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x10d0
movq %rax, %r14
pushq $0x20
popq %rsi
movq %rbx, %rdi
callq 0x10b0
movq %r14, %rdi
callq 0x1100