// File: /workspace/github_c_makefile_star2_O0/chatziko-k08[P]lecture-code/tests/ADTVector_test.c
// Function: test_iterate
void test_iterate(void) {
	Vector vec = vector_create(0, NULL);
	int N = 1000;
	int* array = malloc(N * sizeof(*array));		// Στο vector θα προσθέσουμε pointers προς τα στοιχεία αυτού του πίνακα

	// first/last σε κενό vector
	TEST_ASSERT(vector_first(vec) == VECTOR_BOF);
	TEST_ASSERT(vector_last(vec) == VECTOR_EOF);

	// εισαγωγή στοιχείων
	for (int i = 0; i < 1000; i++)
		vector_insert_last(vec, &array[i]);

	int i = 0;
	for (VectorNode node = vector_first(vec); node != VECTOR_EOF; node = vector_next(vec, node))
		TEST_ASSERT(vector_node_value(vec, node) == &array[i++]);
	TEST_ASSERT(i == N);

	for (VectorNode node = vector_last(vec); node != VECTOR_BOF; node = vector_previous(vec, node))
		TEST_ASSERT(vector_node_value(vec, node) == &array[--i]);
	TEST_ASSERT(i == 0);

	vector_destroy(vec);
	free(array);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
xorl %edi, %edi
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)
movq -0x8(%rbp), %rdi
callq 0x5d70
cmpq $0x0, %rax
sete %al
andb $0x1, %al
movzbl %al, %edi
leaq 0x1986(%rip), %rsi      # 0x62e1
movl $0x5d, %edx
leaq 0x1c6a(%rip), %rcx      # 0x65d1
leaq 0x1a39(%rip), %r8       # 0x63a7
movb $0x0, %al
callq 0x2370
cmpl $0x0, %eax
jne 0x497f
callq 0x2e50
jmp 0x4981
jmp 0x4983
movq -0x8(%rbp), %rdi
callq 0x5da0
cmpq $0x0, %rax
sete %al
andb $0x1, %al
movzbl %al, %edi
leaq 0x1942(%rip), %rsi      # 0x62e1
movl $0x5e, %edx
leaq 0x1c26(%rip), %rcx      # 0x65d1
leaq 0x1a15(%rip), %r8       # 0x63c7
movb $0x0, %al
callq 0x2370
cmpl $0x0, %eax
jne 0x49c3
callq 0x2e50
jmp 0x49c5
movl $0x0, -0x1c(%rbp)
cmpl $0x3e8, -0x1c(%rbp)     # imm = 0x3E8
jge 0x49f8
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rsi
movslq -0x1c(%rbp), %rax
shlq $0x2, %rax
addq %rax, %rsi
callq 0x5af0
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x49cc
movl $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rdi
callq 0x5d70
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x4a88
jmp 0x4a15
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x5e80
movq -0x18(%rbp), %rcx
movl -0x20(%rbp), %edx
movl %edx, %esi
addl $0x1, %esi
movl %esi, -0x20(%rbp)
movslq %edx, %rdx
shlq $0x2, %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
sete %al
andb $0x1, %al
movzbl %al, %edi
leaq 0x1894(%rip), %rsi      # 0x62e1
movl $0x66, %edx
leaq 0x1b78(%rip), %rcx      # 0x65d1
leaq 0x1986(%rip), %r8       # 0x63e6
movb $0x0, %al
callq 0x2370
cmpl $0x0, %eax
jne 0x4a71
callq 0x2e50
jmp 0x4a73
jmp 0x4a75
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x5df0
movq %rax, -0x28(%rbp)
jmp 0x4a0c
jmp 0x4a8a
movl -0x20(%rbp), %eax
cmpl -0xc(%rbp), %eax
sete %al
andb $0x1, %al
movzbl %al, %edi
leaq 0x1842(%rip), %rsi      # 0x62e1
movl $0x67, %edx
leaq 0x1b26(%rip), %rcx      # 0x65d1
leaq 0x1960(%rip), %r8       # 0x6412
movb $0x0, %al
callq 0x2370
cmpl $0x0, %eax
jne 0x4ac3
callq 0x2e50
jmp 0x4ac5
movq -0x8(%rbp), %rdi
callq 0x5da0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x4b4c
jmp 0x4adb
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x5e80
movq -0x18(%rbp), %rcx
movl -0x20(%rbp), %edx
addl $-0x1, %edx
movl %edx, -0x20(%rbp)
movslq %edx, %rdx
shlq $0x2, %rdx
addq %rdx, %rcx
cmpq %rcx, %rax
sete %al
andb $0x1, %al
movzbl %al, %edi
leaq 0x17d0(%rip), %rsi      # 0x62e1
movl $0x6a, %edx
leaq 0x1ab4(%rip), %rcx      # 0x65d1
leaq 0x18f5(%rip), %r8       # 0x6419
movb $0x0, %al
callq 0x2370
cmpl $0x0, %eax
jne 0x4b35
callq 0x2e50
jmp 0x4b37
jmp 0x4b39
movq -0x8(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x5e40
movq %rax, -0x30(%rbp)
jmp 0x4ad2
jmp 0x4b4e
cmpl $0x0, -0x20(%rbp)
sete %al
andb $0x1, %al
movzbl %al, %edi
leaq 0x1780(%rip), %rsi      # 0x62e1
movl $0x6b, %edx
leaq 0x1a64(%rip), %rcx      # 0x65d1
leaq 0x18d1(%rip), %r8       # 0x6445
movb $0x0, %al
callq 0x2370
cmpl $0x0, %eax
jne 0x4b85
callq 0x2e50
jmp 0x4b87
movq -0x8(%rbp), %rdi
callq 0x5d00
movq -0x18(%rbp), %rdi
callq 0x2270
addq $0x30, %rsp
popq %rbp
retq
nop