// File: /workspace/github_cpp_makefile_star2_O1/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 0x177c
movq %rax, %rbx
movl $0x3e7, %ebp            # imm = 0x3E7
leaq 0x81f(%rip), %r14       # 0x2070
xorl %r15d, %r15d
movq %rbx, %rdi
movl %ebp, %esi
callq 0x12f2
testl %eax, %eax
jns 0x1874
movq %r14, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x1030
movl $0x1, %r15d
addl $-0x1, %ebp
jb 0x1854
movq %rbx, %rdi
movl $0x3e6, %esi            # imm = 0x3E6
callq 0x14c2
testl %eax, %eax
je 0x18a3
leaq 0x7f1(%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 0x18cd
leaq 0x7b5(%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 0x14c2
testl %eax, %eax
jne 0x18f7
leaq 0x79d(%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 0x1921
leaq 0x761(%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 0x748(%rip), %r14       # 0x2094
addl $0x4, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x14c2
testl %eax, %eax
jne 0x196f
movq %r14, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x1030
movl $0x1, %r15d
cmpl $0x10, %ebp
jb 0x194c
movl $0xfffffffc, %ebp       # imm = 0xFFFFFFFC
leaq 0x714(%rip), %r14       # 0x2094
addl $0x5, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x14c2
testb $0x3, %bpl
je 0x19a9
testl %eax, %eax
jne 0x19a9
movq %r14, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x1030
movl $0x1, %r15d
cmpl $0x19, %ebp
jb 0x1980
movl $0x1f, %ebp
leaq 0x6f7(%rip), %r14       # 0x20b1
addl $-0x5, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x12f2
testl %eax, %eax
jns 0x19dd
movq %r14, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x1030
movl $0x1, %r15d
cmpl $0x5, %ebp
ja 0x19ba
movl $0x10, %ebp
leaq 0x6e8(%rip), %r14       # 0x20d6
movq %rbx, %rdi
movl %ebp, %esi
callq 0x12f2
testl %eax, %eax
jns 0x1a0e
movq %r14, %rdi
movl %ebp, %esi
xorl %eax, %eax
callq 0x1030
movl $0x1, %r15d
addl $-0x4, %ebp
cmpl $-0x4, %ebp
jne 0x19ee
testl %r15d, %r15d
je 0x1a2d
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x15d2
leaq 0x71a(%rip), %rdi       # 0x214e
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x10d0
movq %rax, %r14
movl $0x20, %esi
movq %rbx, %rdi
callq 0x10b0
movq %r14, %rdi
callq 0x1100