// File: /workspace/github_c_makefile_star2_O0/mgrosvenor[P]evec/test.c
// Function: test8
static int test8() {
    int* a = NULL;
    int ints[] = { 4,2,6,10,8 };
    int ints_srt[] = { 2,4,6,8,10 };
    const int ints_cnt = sizeof(ints)/sizeof(int);

#define REPEATS 1000
    for(int i = 0; i < REPEATS; i++){
        for(int j = 0; j < ints_cnt; j++){
            evpsh(a, ints[j]);
        }
    }

    if(evcnt(a) != REPEATS * ints_cnt) return 0;


    evsort(a,compare);

    //Remove duplicates
    for(int i = 1; i < evcnt(a); i++){
        if(a[i] == a[i-1]){
            evdel(a,i);
            i--;
        }
    }

    if(evcnt(a) != ints_cnt) {
        printf("%li != %i", evcnt(a) , ints_cnt);
        return 0;
    }

    for(int i =0; i < evcnt(a); i++){
        if(a[i] != ints_srt[i]) {
            printf("%i != %i", a[i], ints_srt[i]);
            return 0;
        }
    }

    a = evfree(a);
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq $0x0, -0x10(%rbp)
movq 0x19b6(%rip), %rax      # 0x45e0
movq %rax, -0x30(%rbp)
movq 0x19b3(%rip), %rax      # 0x45e8
movq %rax, -0x28(%rbp)
movl 0x19b1(%rip), %eax      # 0x45f0
movl %eax, -0x20(%rbp)
movq 0x19b7(%rip), %rax      # 0x4600
movq %rax, -0x50(%rbp)
movq 0x19b4(%rip), %rax      # 0x4608
movq %rax, -0x48(%rbp)
movl 0x19b2(%rip), %eax      # 0x4610
movl %eax, -0x40(%rbp)
movl $0x5, -0x54(%rbp)
movl $0x0, -0x58(%rbp)
cmpl $0x3e8, -0x58(%rbp)     # imm = 0x3E8
jge 0x2cc2
movl $0x0, -0x5c(%rbp)
cmpl $0x5, -0x5c(%rbp)
jge 0x2cb5
jmp 0x2c87
movslq -0x5c(%rbp), %rax
movl -0x30(%rbp,%rax,4), %eax
movl %eax, -0x60(%rbp)
movq -0x10(%rbp), %rdi
leaq -0x60(%rbp), %rsi
movl $0x4, %edx
callq 0x1940
movq %rax, -0x10(%rbp)
jmp 0x2caa
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x2c7f
jmp 0x2cb7
movl -0x58(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x58(%rbp)
jmp 0x2c6f
movq -0x10(%rbp), %rdi
callq 0x1aa0
cmpq $0x1388, %rax           # imm = 0x1388
je 0x2cdf
movl $0x0, -0x4(%rbp)
jmp 0x2e11
movq -0x10(%rbp), %rdi
leaq 0x136(%rip), %rsi       # 0x2e20
callq 0x24c0
movl $0x1, -0x64(%rbp)
movslq -0x64(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1aa0
movq %rax, %rcx
movq -0x70(%rbp), %rax
cmpq %rcx, %rax
jae 0x2d53
movq -0x10(%rbp), %rax
movslq -0x64(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movq -0x10(%rbp), %rcx
movl -0x64(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
cmpl (%rcx,%rdx,4), %eax
jne 0x2d46
movq -0x10(%rbp), %rdi
movslq -0x64(%rbp), %rsi
callq 0x2050
movl -0x64(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x2d48
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x2cf6
movq -0x10(%rbp), %rdi
callq 0x1aa0
cmpq $0x5, %rax
je 0x2d8d
movq -0x10(%rbp), %rdi
callq 0x1aa0
movq %rax, %rsi
leaq 0x184f(%rip), %rdi      # 0x45c4
movl $0x5, %edx
movb $0x0, %al
callq 0x1060
movl $0x0, -0x4(%rbp)
jmp 0x2e11
movl $0x0, -0x68(%rbp)
movslq -0x68(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1aa0
movq %rax, %rcx
movq -0x78(%rbp), %rax
cmpq %rcx, %rax
jae 0x2dfd
movq -0x10(%rbp), %rax
movslq -0x68(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movslq -0x68(%rbp), %rcx
cmpl -0x50(%rbp,%rcx,4), %eax
je 0x2df0
movq -0x10(%rbp), %rax
movslq -0x68(%rbp), %rcx
movl (%rax,%rcx,4), %esi
movslq -0x68(%rbp), %rax
movl -0x50(%rbp,%rax,4), %edx
leaq 0x17ee(%rip), %rdi      # 0x45ce
movb $0x0, %al
callq 0x1060
movl $0x0, -0x4(%rbp)
jmp 0x2e11
jmp 0x2df2
movl -0x68(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x68(%rbp)
jmp 0x2d94
movq -0x10(%rbp), %rdi
callq 0x1f10
movq %rax, -0x10(%rbp)
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)