// File: /workspace/github_c_makefile_star2_O0/DeforaOS[P]libSystem/tests/array.c
// Function: test
static int _test(intArray * array)
{
	int i;
	int j;
	int * p;
	intArray * a;

	if(array_get(array, 0) != NULL
			|| array_get_copy(array, 0, &i) == 0)
		return 2;
	i = 0;
	if(array_set(array, 0, &i) != 0)
		return 3;
	if(array_set(array, SIZE_MAX, NULL) == 0)
		return 4;
	i = 0xffffffff;
	if(array_get_copy(array, 0, &i) != 0 || i != 0)
		return 5;
	for(i = 0; i < 1024; i++)
		if(array_set(array, i, &i) != 0)
			return 6;
	for(i = 0; i < 1024; i++)
		if(array_get_copy(array, i, &j) != 0)
			return 7;
		else if(j != i)
			return 8;
	if(array_count(array) != 1024)
		return 9;
	if((p = (int *)array_get(array, 512)) == NULL || *p != 512)
		return 10;
	j = 0;
	array_foreach(array, _test_foreach, &j);
	if(j != 523776)
		return 11;
	j = 0;
	array_foreach_swap(array, _test_foreach_swap, &j);
	if(j != 523776)
		return 12;
	if(array_remove_pos(array, 512) != 0)
		return 13;
	if((p = (int *)array_get(array, 512)) == NULL || *p != 513)
		return 14;
	if((a = array_new_filter(array, _test_filter, NULL)) == NULL)
		return 15;
	if(array_count(a) != 1022)
		return 16;
	array_delete(a);
	array_filter(array, _test_filter, NULL);
	if(array_count(array) != 1022)
		return 17;
	array_filter_swap(array, _test_filter_swap, NULL);
	if(array_count(array) != 0)
		return 18;
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x10c0
cmpq $0x0, %rax
jne 0x12c5
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x14(%rbp), %rdx
callq 0x10f0
cmpl $0x0, %eax
jne 0x12d1
movl $0x2, -0x4(%rbp)
jmp 0x158c
movl $0x0, -0x14(%rbp)
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x14(%rbp), %rdx
callq 0x1090
cmpl $0x0, %eax
je 0x12fa
movl $0x3, -0x4(%rbp)
jmp 0x158c
movq -0x10(%rbp), %rdi
movq $-0x1, %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x1090
cmpl $0x0, %eax
jne 0x131f
movl $0x4, -0x4(%rbp)
jmp 0x158c
movl $0xffffffff, -0x14(%rbp) # imm = 0xFFFFFFFF
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
leaq -0x14(%rbp), %rdx
callq 0x10f0
cmpl $0x0, %eax
jne 0x1342
cmpl $0x0, -0x14(%rbp)
je 0x134e
movl $0x5, -0x4(%rbp)
jmp 0x158c
movl $0x0, -0x14(%rbp)
cmpl $0x400, -0x14(%rbp)     # imm = 0x400
jge 0x138d
movq -0x10(%rbp), %rdi
movslq -0x14(%rbp), %rsi
leaq -0x14(%rbp), %rdx
callq 0x1090
cmpl $0x0, %eax
je 0x1380
movl $0x6, -0x4(%rbp)
jmp 0x158c
jmp 0x1382
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1355
movl $0x0, -0x14(%rbp)
cmpl $0x400, -0x14(%rbp)     # imm = 0x400
jge 0x13e2
movq -0x10(%rbp), %rdi
movslq -0x14(%rbp), %rsi
leaq -0x18(%rbp), %rdx
callq 0x10f0
cmpl $0x0, %eax
je 0x13bf
movl $0x7, -0x4(%rbp)
jmp 0x158c
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
je 0x13d3
movl $0x8, -0x4(%rbp)
jmp 0x158c
jmp 0x13d5
jmp 0x13d7
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x1394
movq -0x10(%rbp), %rdi
callq 0x1040
cmpq $0x400, %rax            # imm = 0x400
je 0x13ff
movl $0x9, -0x4(%rbp)
jmp 0x158c
movq -0x10(%rbp), %rdi
movl $0x200, %esi            # imm = 0x200
callq 0x10c0
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0x1423
movq -0x20(%rbp), %rax
cmpl $0x200, (%rax)          # imm = 0x200
je 0x142f
movl $0xa, -0x4(%rbp)
jmp 0x158c
movl $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x15f(%rip), %rsi       # 0x15a0
leaq -0x18(%rbp), %rdx
callq 0x1030
cmpl $0x7fe00, -0x18(%rbp)   # imm = 0x7FE00
je 0x145f
movl $0xb, -0x4(%rbp)
jmp 0x158c
movl $0x0, -0x18(%rbp)
movq -0x10(%rbp), %rdi
leaq 0x15f(%rip), %rsi       # 0x15d0
leaq -0x18(%rbp), %rdx
callq 0x1050
cmpl $0x7fe00, -0x18(%rbp)   # imm = 0x7FE00
je 0x148f
movl $0xc, -0x4(%rbp)
jmp 0x158c
movq -0x10(%rbp), %rdi
movl $0x200, %esi            # imm = 0x200
callq 0x10a0
cmpl $0x0, %eax
je 0x14ae
movl $0xd, -0x4(%rbp)
jmp 0x158c
movq -0x10(%rbp), %rdi
movl $0x200, %esi            # imm = 0x200
callq 0x10c0
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
je 0x14d2
movq -0x20(%rbp), %rax
cmpl $0x201, (%rax)          # imm = 0x201
je 0x14de
movl $0xe, -0x4(%rbp)
jmp 0x158c
movq -0x10(%rbp), %rdi
leaq 0x117(%rip), %rsi       # 0x1600
xorl %eax, %eax
movl %eax, %edx
callq 0x10b0
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x1508
movl $0xf, -0x4(%rbp)
jmp 0x158c
movq -0x28(%rbp), %rdi
callq 0x1040
cmpq $0x3fe, %rax            # imm = 0x3FE
je 0x1522
movl $0x10, -0x4(%rbp)
jmp 0x158c
movq -0x28(%rbp), %rdi
callq 0x1080
movq -0x10(%rbp), %rdi
leaq 0xca(%rip), %rsi        # 0x1600
xorl %eax, %eax
movl %eax, %edx
callq 0x1060
movq -0x10(%rbp), %rdi
callq 0x1040
cmpq $0x3fe, %rax            # imm = 0x3FE
je 0x1559
movl $0x11, -0x4(%rbp)
jmp 0x158c
movq -0x10(%rbp), %rdi
leaq 0xdc(%rip), %rsi        # 0x1640
xorl %eax, %eax
movl %eax, %edx
callq 0x1070
movq -0x10(%rbp), %rdi
callq 0x1040
cmpq $0x0, %rax
je 0x1585
movl $0x12, -0x4(%rbp)
jmp 0x158c
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)