// File: /workspace/github_c_makefile_star2_O0/jarun[P]nnn/src/nnn.c
// Function: entrycmp
static int entrycmp(const void *va, const void *vb)
{
	const struct entry *pa = (pEntry)va;
	const struct entry *pb = (pEntry)vb;

	if ((pb->flags & DIR_OR_DIRLNK) != (pa->flags & DIR_OR_DIRLNK)) {
		if (pb->flags & DIR_OR_DIRLNK)
			return 1;
		return -1;
	}

	/* Sort based on specified order */
	if (cfg.timeorder) {
		if (pb->sec > pa->sec)
			return 1;
		if (pb->sec < pa->sec)
			return -1;
		/* If sec matches, comare nsec */
		if (pb->nsec > pa->nsec)
			return 1;
		if (pb->nsec < pa->nsec)
			return -1;
	} else if (cfg.sizeorder) {
		if (pb->size > pa->size)
			return 1;
		if (pb->size < pa->size)
			return -1;
	} else if (cfg.blkorder) {
		if (pb->blocks > pa->blocks)
			return 1;
		if (pb->blocks < pa->blocks)
			return -1;
	} else if (cfg.extnorder && !(pb->flags & DIR_OR_DIRLNK)) {
		char *extna = xextension(pa->name, pa->nlen - 1);
		char *extnb = xextension(pb->name, pb->nlen - 1);

		if (extna || extnb) {
			if (!extna)
				return -1;

			if (!extnb)
				return 1;

			int ret = strcasecmp(extna, extnb);

			if (ret)
				return ret;
		}
	}

	return namecmpfn(pa->name, pb->name);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
shrq $0x38, %rax
andl $0x1, %eax
movq -0x20(%rbp), %rcx
movq 0x20(%rcx), %rcx
shrq $0x38, %rcx
andl $0x1, %ecx
cmpl %ecx, %eax
je 0xd52e
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
shrq $0x38, %rax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xd522
movl $0x1, -0x4(%rbp)
jmp 0xd776
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd776
movl 0x12f9c(%rip), %eax     # 0x204d0
shrl %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xd5b7
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jle 0xd55c
movl $0x1, -0x4(%rbp)
jmp 0xd776
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jge 0xd57a
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd776
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x20(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jbe 0xd596
movl $0x1, -0x4(%rbp)
jmp 0xd776
movq -0x28(%rbp), %rax
movl 0x10(%rax), %eax
movq -0x20(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0xd5b2
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd776
jmp 0xd75c
movl 0x12f13(%rip), %eax     # 0x204d0
shrl $0x2, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xd609
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jle 0xd5e6
movl $0x1, -0x4(%rbp)
jmp 0xd776
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x20(%rbp), %rcx
cmpq 0x18(%rcx), %rax
jge 0xd604
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd776
jmp 0xd75a
movl 0x12ec1(%rip), %eax     # 0x204d0
shrl $0x4, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xd689
movq -0x28(%rbp), %rcx
movabsq $0xffffffffff, %rax     # imm = 0xFFFFFFFFFF
andq 0x20(%rcx), %rax
movq -0x20(%rbp), %rdx
movabsq $0xffffffffff, %rcx     # imm = 0xFFFFFFFFFF
andq 0x20(%rdx), %rcx
cmpq %rcx, %rax
jbe 0xd64f
movl $0x1, -0x4(%rbp)
jmp 0xd776
movq -0x28(%rbp), %rcx
movabsq $0xffffffffff, %rax     # imm = 0xFFFFFFFFFF
andq 0x20(%rcx), %rax
movq -0x20(%rbp), %rdx
movabsq $0xffffffffff, %rcx     # imm = 0xFFFFFFFFFF
andq 0x20(%rdx), %rcx
cmpq %rcx, %rax
jae 0xd684
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd776
jmp 0xd758
movl 0x12e41(%rip), %eax     # 0x204d0
shrl $0x5, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xd756
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
shrq $0x38, %rax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0xd756
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x20(%rbp), %rax
movq 0x20(%rax), %rax
shrq $0x28, %rax
andq $0xffff, %rax           # imm = 0xFFFF
subl $0x1, %eax
movslq %eax, %rsi
callq 0xdda0
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
shrq $0x28, %rax
andq $0xffff, %rax           # imm = 0xFFFF
subl $0x1, %eax
movslq %eax, %rsi
callq 0xdda0
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0xd714
cmpq $0x0, -0x38(%rbp)
je 0xd754
cmpq $0x0, -0x30(%rbp)
jne 0xd724
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0xd776
cmpq $0x0, -0x38(%rbp)
jne 0xd734
movl $0x1, -0x4(%rbp)
jmp 0xd776
movq -0x30(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x40b0
movl %eax, -0x3c(%rbp)
cmpl $0x0, -0x3c(%rbp)
je 0xd752
movl -0x3c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0xd776
jmp 0xd754
jmp 0xd756
jmp 0xd758
jmp 0xd75a
jmp 0xd75c
movq 0x13075(%rip), %rax     # 0x207d8
movq -0x20(%rbp), %rcx
movq (%rcx), %rdi
movq -0x28(%rbp), %rcx
movq (%rcx), %rsi
callq *%rax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nop