// File: narula[P]skiplists/skiplist-extra.cc
// Function: insert_test(int)
int insert_test(int sz) {
  printf("Testing imperfect inserts...\n");
  SkipList* sk4 = empty_fill(sz, &fillForward);
  for (int i = 0; i < sz; i++) {
	assert(sk4->lookup(i) > 0);
	assert(sk4->fastFindNode(i) >= 0);
	assert(sk4->fastFindTest(i) >= 0);
  }
  sk4 = empty_fill(sz, &fillBackward);
  for (int i = 0; i < sz; i++) {
	assert(sk4->lookup(i) > 0);
	assert(sk4->fastFindNode(i) >= 0);
	assert(sk4->fastFindTest(i) >= 0);
  }
  sk4 = empty_fill(sz, &fillRandom);
  for (int i = 0; i < sz; i++) {
	assert(sk4->lookup(i) > 0);
	assert(sk4->fastFindNode(i) >= 0);
	assert(sk4->fastFindTest(i) >= 0);
  }
  printf("PASSED\n");
}

// Assembly:
subq $0x28, %rsp
movl %edi, 0x24(%rsp)
leaq 0x1acf(%rip), %rdi      # 0x532e
movb $0x0, %al
callq 0x1040
movl 0x24(%rsp), %edi
leaq -0x691(%rip), %rsi      # 0x31e0
callq 0x32a0
movq %rax, 0x18(%rsp)
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
cmpl 0x24(%rsp), %eax
jge 0x393f
movq 0x18(%rsp), %rdi
movl 0x14(%rsp), %esi
callq 0x14e0
cmpl $0x0, %eax
jle 0x38a6
jmp 0x38c5
leaq 0x1a9f(%rip), %rdi      # 0x534c
leaq 0x183c(%rip), %rsi      # 0x50f0
movl $0x209, %edx            # imm = 0x209
leaq 0x1a9f(%rip), %rcx      # 0x535f
callq 0x1070
movq 0x18(%rsp), %rdi
movl 0x14(%rsp), %esi
callq 0x1550
cmpl $0x0, %eax
jl 0x38da
jmp 0x38f9
leaq 0x1a93(%rip), %rdi      # 0x5374
leaq 0x1808(%rip), %rsi      # 0x50f0
movl $0x20a, %edx            # imm = 0x20A
leaq 0x1a6b(%rip), %rcx      # 0x535f
callq 0x1070
movq 0x18(%rsp), %rdi
movl 0x14(%rsp), %esi
callq 0x1780
cmpl $0x0, %eax
jl 0x390e
jmp 0x392d
leaq 0x1a79(%rip), %rdi      # 0x538e
leaq 0x17d4(%rip), %rsi      # 0x50f0
movl $0x20b, %edx            # imm = 0x20B
leaq 0x1a37(%rip), %rcx      # 0x535f
callq 0x1070
jmp 0x392f
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x3883
movl 0x24(%rsp), %edi
leaq -0x70a(%rip), %rsi      # 0x3240
callq 0x32a0
movq %rax, 0x18(%rsp)
movl $0x0, 0x10(%rsp)
movl 0x10(%rsp), %eax
cmpl 0x24(%rsp), %eax
jge 0x3a18
movq 0x18(%rsp), %rdi
movl 0x10(%rsp), %esi
callq 0x14e0
cmpl $0x0, %eax
jle 0x397f
jmp 0x399e
leaq 0x19c6(%rip), %rdi      # 0x534c
leaq 0x1763(%rip), %rsi      # 0x50f0
movl $0x20f, %edx            # imm = 0x20F
leaq 0x19c6(%rip), %rcx      # 0x535f
callq 0x1070
movq 0x18(%rsp), %rdi
movl 0x10(%rsp), %esi
callq 0x1550
cmpl $0x0, %eax
jl 0x39b3
jmp 0x39d2
leaq 0x19ba(%rip), %rdi      # 0x5374
leaq 0x172f(%rip), %rsi      # 0x50f0
movl $0x210, %edx            # imm = 0x210
leaq 0x1992(%rip), %rcx      # 0x535f
callq 0x1070
movq 0x18(%rsp), %rdi
movl 0x10(%rsp), %esi
callq 0x1780
cmpl $0x0, %eax
jl 0x39e7
jmp 0x3a06
leaq 0x19a0(%rip), %rdi      # 0x538e
leaq 0x16fb(%rip), %rsi      # 0x50f0
movl $0x211, %edx            # imm = 0x211
leaq 0x195e(%rip), %rcx      # 0x535f
callq 0x1070
jmp 0x3a08
movl 0x10(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x10(%rsp)
jmp 0x395c
movl 0x24(%rsp), %edi
leaq -0x8c3(%rip), %rsi      # 0x3160
callq 0x32a0
movq %rax, 0x18(%rsp)
movl $0x0, 0xc(%rsp)
movl 0xc(%rsp), %eax
cmpl 0x24(%rsp), %eax
jge 0x3af1
movq 0x18(%rsp), %rdi
movl 0xc(%rsp), %esi
callq 0x14e0
cmpl $0x0, %eax
jle 0x3a58
jmp 0x3a77
leaq 0x18ed(%rip), %rdi      # 0x534c
leaq 0x168a(%rip), %rsi      # 0x50f0
movl $0x215, %edx            # imm = 0x215
leaq 0x18ed(%rip), %rcx      # 0x535f
callq 0x1070
movq 0x18(%rsp), %rdi
movl 0xc(%rsp), %esi
callq 0x1550
cmpl $0x0, %eax
jl 0x3a8c
jmp 0x3aab
leaq 0x18e1(%rip), %rdi      # 0x5374
leaq 0x1656(%rip), %rsi      # 0x50f0
movl $0x216, %edx            # imm = 0x216
leaq 0x18b9(%rip), %rcx      # 0x535f
callq 0x1070
movq 0x18(%rsp), %rdi
movl 0xc(%rsp), %esi
callq 0x1780
cmpl $0x0, %eax
jl 0x3ac0
jmp 0x3adf
leaq 0x18c7(%rip), %rdi      # 0x538e
leaq 0x1622(%rip), %rsi      # 0x50f0
movl $0x217, %edx            # imm = 0x217
leaq 0x1885(%rip), %rcx      # 0x535f
callq 0x1070
jmp 0x3ae1
movl 0xc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0xc(%rsp)
jmp 0x3a35
leaq 0x18b0(%rip), %rdi      # 0x53a8
movb $0x0, %al
callq 0x1040
ud2
nopw %cs:(%rax,%rax)