// File: /workspace/github_c_makefile_star2_O0/chatziko-k08[P]lecture-code/tests/ADTVector_test.c
// Function: test_find
void test_find(void) {
	Vector vec = vector_create(1000, NULL);
	int N = 1000;
	int* array = malloc(N * sizeof(*array));

	// replace για προσθήκη δεδομένων
	for (int i = 0; i < 1000; i++) {
		array[i] = i;
		vector_set_at(vec, i, &array[i]);
	}

	for (int i = 0; i < 1000; i++) {
		int* p = vector_find(vec, &i, compare_ints);
		TEST_ASSERT(*p == i);

		VectorNode node = vector_find_node(vec, &i, compare_ints);
		TEST_ASSERT(*(int*)vector_node_value(vec, node) == i);
	}

	int not_exists = -12;
	TEST_ASSERT(vector_find(vec, &not_exists, compare_ints) == NULL);
	TEST_ASSERT(vector_find_node(vec, &not_exists, compare_ints) == VECTOR_EOF);

	vector_destroy(vec);
	free(array);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl $0x3e8, %edi            # imm = 0x3E8
xorl %eax, %eax
movl %eax, %esi
callq 0x5950
movq %rax, -0x8(%rbp)
movl $0x3e8, -0xc(%rbp)      # imm = 0x3E8
movslq -0xc(%rbp), %rdi
shlq $0x2, %rdi
callq 0x2180
movq %rax, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
cmpl $0x3e8, -0x1c(%rbp)     # imm = 0x3E8
jge 0x4c36
movl -0x1c(%rbp), %edx
movq -0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl %edx, (%rax,%rcx,4)
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %esi
movq -0x18(%rbp), %rdx
movslq -0x1c(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rdx
callq 0x5a50
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x4bf9
movl $0x0, -0x20(%rbp)
cmpl $0x3e8, -0x20(%rbp)     # imm = 0x3E8
jge 0x4d0f
movq -0x8(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0xb9(%rip), %rdx       # 0x4ba0
callq 0x5c50
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movl (%rax), %eax
cmpl -0x20(%rbp), %eax
sete %al
andb $0x1, %al
movzbl %al, %edi
leaq 0x1667(%rip), %rsi      # 0x62e1
movl $0x82, %edx
leaq 0x194b(%rip), %rcx      # 0x65d1
leaq 0x17bf(%rip), %r8       # 0x644c
movb $0x0, %al
callq 0x2370
cmpl $0x0, %eax
jne 0x4c9e
callq 0x2e50
jmp 0x4ca0
movq -0x8(%rbp), %rdi
leaq -0x20(%rbp), %rsi
leaq -0x10f(%rip), %rdx      # 0x4ba0
callq 0x5ea0
movq %rax, -0x30(%rbp)
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x5e80
movl (%rax), %eax
cmpl -0x20(%rbp), %eax
sete %al
andb $0x1, %al
movzbl %al, %edi
leaq 0x1608(%rip), %rsi      # 0x62e1
movl $0x85, %edx
leaq 0x18ec(%rip), %rcx      # 0x65d1
leaq 0x1768(%rip), %r8       # 0x6454
movb $0x0, %al
callq 0x2370
cmpl $0x0, %eax
jne 0x4cfd
callq 0x2e50
jmp 0x4cff
jmp 0x4d01
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x4c3d
movl $0xfffffff4, -0x34(%rbp) # imm = 0xFFFFFFF4
movq -0x8(%rbp), %rdi
leaq -0x34(%rbp), %rsi
leaq -0x185(%rip), %rdx      # 0x4ba0
callq 0x5c50
cmpq $0x0, %rax
sete %al
andb $0x1, %al
movzbl %al, %edi
leaq 0x15a4(%rip), %rsi      # 0x62e1
movl $0x89, %edx
leaq 0x1888(%rip), %rcx      # 0x65d1
leaq 0x172d(%rip), %r8       # 0x647d
movb $0x0, %al
callq 0x2370
cmpl $0x0, %eax
jne 0x4d61
callq 0x2e50
jmp 0x4d63
jmp 0x4d65
movq -0x8(%rbp), %rdi
leaq -0x34(%rbp), %rsi
leaq -0x1d4(%rip), %rdx      # 0x4ba0
callq 0x5ea0
cmpq $0x0, %rax
sete %al
andb $0x1, %al
movzbl %al, %edi
leaq 0x1555(%rip), %rsi      # 0x62e1
movl $0x8a, %edx
leaq 0x1839(%rip), %rcx      # 0x65d1
leaq 0x1712(%rip), %r8       # 0x64b1
movb $0x0, %al
callq 0x2370
cmpl $0x0, %eax
jne 0x4db0
callq 0x2e50
jmp 0x4db2
movq -0x8(%rbp), %rdi
callq 0x5d00
movq -0x18(%rbp), %rdi
callq 0x2270
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)