// File: /workspace/github_cpp_makefile_star2_O3/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 %rbx
pushq %rax
movl $0x3e8, %edi            # imm = 0x3E8
movl $0x3e8, %esi            # imm = 0x3E8
movl $0x2, %edx
callq 0x1788
movq %rax, %rbx
movl $0x3e7, %ebp            # imm = 0x3E7
leaq 0x813(%rip), %r14       # 0x2070
xorl %r15d, %r15d
movq %rbx, %rdi
movl %ebp, %esi
callq 0x12f2
testl %eax, %eax
jns 0x1880
movq %r14, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x1030
movl $0x1, %r15d
addl $-0x1, %ebp
jb 0x1860
movq %rbx, %rdi
movl $0x3e6, %esi            # imm = 0x3E6
callq 0x14ce
testl %eax, %eax
je 0x18af
leaq 0x7e5(%rip), %rdi       # 0x2082
movl $0x3e6, %esi            # imm = 0x3E6
xorl %eax, %eax
callq 0x1030
movl $0x1, %r15d
movq %rbx, %rdi
movl $0x7d0, %esi            # imm = 0x7D0
callq 0x12f2
testl %eax, %eax
js 0x18d9
leaq 0x7a9(%rip), %rdi       # 0x2070
movl $0x7d0, %esi            # imm = 0x7D0
xorl %eax, %eax
callq 0x1030
movl $0x1, %r15d
movq %rbx, %rdi
movl $0x7d0, %esi            # imm = 0x7D0
callq 0x14ce
testl %eax, %eax
jne 0x1903
leaq 0x791(%rip), %rdi       # 0x2082
movl $0x7d0, %esi            # imm = 0x7D0
xorl %eax, %eax
callq 0x1030
movl $0x1, %r15d
movq %rbx, %rdi
movl $0x7d0, %esi            # imm = 0x7D0
callq 0x12f2
testl %eax, %eax
jns 0x192d
leaq 0x755(%rip), %rdi       # 0x2070
movl $0x7d0, %esi            # imm = 0x7D0
xorl %eax, %eax
callq 0x1030
movl $0x1, %r15d
movl $0x20, %edi
callq 0x10a0
movq %rax, %rbx
movq %rax, %rdi
movl $0x2, %esi
movl $0x4, %edx
callq 0x120c
movl $0xfffffffc, %ebp       # imm = 0xFFFFFFFC
leaq 0x73c(%rip), %r14       # 0x2094
addl $0x4, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x14ce
testl %eax, %eax
jne 0x197b
movq %r14, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x1030
movl $0x1, %r15d
cmpl $0x10, %ebp
jb 0x1958
movl $0xfffffffc, %ebp       # imm = 0xFFFFFFFC
leaq 0x708(%rip), %r14       # 0x2094
addl $0x5, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x14ce
testb $0x3, %bpl
je 0x19b5
testl %eax, %eax
jne 0x19b5
movq %r14, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x1030
movl $0x1, %r15d
cmpl $0x19, %ebp
jb 0x198c
movl $0x1f, %ebp
leaq 0x6eb(%rip), %r14       # 0x20b1
addl $-0x5, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x12f2
testl %eax, %eax
jns 0x19e9
movq %r14, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x1030
movl $0x1, %r15d
cmpl $0x5, %ebp
ja 0x19c6
testl %r15d, %r15d
sete %bpl
movl $0x10, %r15d
leaq 0x6d4(%rip), %r14       # 0x20d6
movq %rbx, %rdi
movl %r15d, %esi
callq 0x12f2
testl %eax, %eax
js 0x1a1d
addl $-0x4, %r15d
cmpl $-0x4, %r15d
jne 0x1a02
jmp 0x1a3a
xorl %ebp, %ebp
movq %r14, %rdi
movl %r15d, %esi
xorl %eax, %eax
callq 0x1030
leal -0x4(%r15), %eax
testl %r15d, %r15d
movl %eax, %r15d
jne 0x1a02
jmp 0x1a56
testb $0x1, %bpl
je 0x1a56
leaq 0x707(%rip), %rdi       # 0x214e
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x10d0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x15de
movq %rax, %r14
movl $0x20, %esi
movq %rbx, %rdi
callq 0x10b0
movq %r14, %rdi
callq 0x1100