// File: /workspace/github_c_makefile_star2_O0/ccxvii[P]mujs/./jsarray.c
// Function: Ap_sort_cmp
static int Ap_sort_cmp(js_State *J, int idx_a, int idx_b)
{
	js_Object *obj = js_tovalue(J, 0)->u.object;
	if (obj->u.a.simple) {
		js_Value *val_a = &obj->u.a.array[idx_a];
		js_Value *val_b = &obj->u.a.array[idx_b];
		int und_a = val_a->t.type == JS_TUNDEFINED;
		int und_b = val_b->t.type == JS_TUNDEFINED;
		if (und_a) return und_b;
		if (und_b) return -1;
		if (js_iscallable(J, 1)) {
			double v;
			js_copy(J, 1); /* copy function */
			js_pushundefined(J); /* no 'this' binding */
			js_pushvalue(J, *val_a);
			js_pushvalue(J, *val_b);
			js_call(J, 2);
			v = js_tonumber(J, -1);
			js_pop(J, 1);
			if (isnan(v))
				return 0;
			if (v == 0)
				return 0;
			return v < 0 ? -1 : 1;
		} else {
			const char *str_a, *str_b;
			int c;
			js_pushvalue(J, *val_a);
			js_pushvalue(J, *val_b);
			str_a = js_tostring(J, -2);
			str_b = js_tostring(J, -1);
			c = strcmp(str_a, str_b);
			js_pop(J, 2);
			return c;
		}
	} else {
		int und_a, und_b;
		int has_a = js_hasindex(J, 0, idx_a);
		int has_b = js_hasindex(J, 0, idx_b);
		if (!has_a && !has_b) {
			return 0;
		}
		if (has_a && !has_b) {
			js_pop(J, 1);
			return -1;
		}
		if (!has_a && has_b) {
			js_pop(J, 1);
			return 1;
		}

		und_a = js_isundefined(J, -2);
		und_b = js_isundefined(J, -1);
		if (und_a) {
			js_pop(J, 2);
			return und_b;
		}
		if (und_b) {
			js_pop(J, 2);
			return -1;
		}

		if (js_iscallable(J, 1)) {
			double v;
			js_copy(J, 1); /* copy function */
			js_pushundefined(J); /* no 'this' binding */
			js_copy(J, -4);
			js_copy(J, -4);
			js_call(J, 2);
			v = js_tonumber(J, -1);
			js_pop(J, 3);
			if (isnan(v))
				return 0;
			if (v == 0)
				return 0;
			return v < 0 ? -1 : 1;
		} else {
			const char *str_a = js_tostring(J, -2);
			const char *str_b = js_tostring(J, -1);
			int c = strcmp(str_a, str_b);
			js_pop(J, 2);
			return c;
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq -0x10(%rbp), %rdi
xorl %esi, %esi
callq 0x15020
movq (%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpl $0x0, 0x24(%rax)
je 0x1e417
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x14(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movslq -0x18(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movsbl 0xf(%rax), %eax
cmpl $0x1, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x34(%rbp)
movq -0x30(%rbp), %rax
movsbl 0xf(%rax), %eax
cmpl $0x1, %eax
sete %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x34(%rbp)
je 0x1e2b0
movl -0x38(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1e61a
cmpl $0x0, -0x38(%rbp)
je 0x1e2c2
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1e61a
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x15290
cmpl $0x0, %eax
je 0x1e3a2
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x14410
movq -0x10(%rbp), %rdi
callq 0x8640
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
callq 0x14d40
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
callq 0x14d40
movq -0x10(%rbp), %rdi
movl $0x2, %esi
callq 0x17ea0
movq -0x10(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15750
movsd %xmm0, -0x40(%rbp)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x4400
movsd -0x40(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x1e359
jmp 0x1e365
movl $0x0, -0x4(%rbp)
jmp 0x1e61a
movsd -0x40(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x1e381
jp 0x1e381
movl $0x0, -0x4(%rbp)
jmp 0x1e61a
movsd -0x40(%rbp), %xmm1
xorps %xmm0, %xmm0
movl $0x1, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
ucomisd %xmm1, %xmm0
cmoval %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x1e61a
movq -0x10(%rbp), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
callq 0x14d40
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
callq 0x14d40
movq -0x10(%rbp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x14b80
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x14b80
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rsi
callq 0x32d0
movl %eax, -0x54(%rbp)
movq -0x10(%rbp), %rdi
movl $0x2, %esi
callq 0x4400
movl -0x54(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1e61a
movq -0x10(%rbp), %rdi
movl -0x14(%rbp), %edx
xorl %esi, %esi
callq 0x17b20
movl %eax, -0x60(%rbp)
movq -0x10(%rbp), %rdi
movl -0x18(%rbp), %edx
xorl %esi, %esi
callq 0x17b20
movl %eax, -0x64(%rbp)
cmpl $0x0, -0x60(%rbp)
jne 0x1e451
cmpl $0x0, -0x64(%rbp)
jne 0x1e451
movl $0x0, -0x4(%rbp)
jmp 0x1e61a
cmpl $0x0, -0x60(%rbp)
je 0x1e477
cmpl $0x0, -0x64(%rbp)
jne 0x1e477
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x4400
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1e61a
cmpl $0x0, -0x60(%rbp)
jne 0x1e49d
cmpl $0x0, -0x64(%rbp)
je 0x1e49d
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x4400
movl $0x1, -0x4(%rbp)
jmp 0x1e61a
movq -0x10(%rbp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x15100
movl %eax, -0x58(%rbp)
movq -0x10(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15100
movl %eax, -0x5c(%rbp)
cmpl $0x0, -0x58(%rbp)
je 0x1e4de
movq -0x10(%rbp), %rdi
movl $0x2, %esi
callq 0x4400
movl -0x5c(%rbp), %eax
movl %eax, -0x4(%rbp)
jmp 0x1e61a
cmpl $0x0, -0x5c(%rbp)
je 0x1e4fe
movq -0x10(%rbp), %rdi
movl $0x2, %esi
callq 0x4400
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x1e61a
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x15290
cmpl $0x0, %eax
je 0x1e5cc
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x14410
movq -0x10(%rbp), %rdi
callq 0x8640
movq -0x10(%rbp), %rdi
movl $0xfffffffc, %esi       # imm = 0xFFFFFFFC
callq 0x14410
movq -0x10(%rbp), %rdi
movl $0xfffffffc, %esi       # imm = 0xFFFFFFFC
callq 0x14410
movq -0x10(%rbp), %rdi
movl $0x2, %esi
callq 0x17ea0
movq -0x10(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x15750
movsd %xmm0, -0x70(%rbp)
movq -0x10(%rbp), %rdi
movl $0x3, %esi
callq 0x4400
movsd -0x70(%rbp), %xmm0
ucomisd %xmm0, %xmm0
setp %al
testb $0x1, %al
jne 0x1e589
jmp 0x1e595
movl $0x0, -0x4(%rbp)
jmp 0x1e61a
movsd -0x70(%rbp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x1e5ae
jp 0x1e5ae
movl $0x0, -0x4(%rbp)
jmp 0x1e61a
movsd -0x70(%rbp), %xmm1
xorps %xmm0, %xmm0
movl $0x1, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
ucomisd %xmm1, %xmm0
cmoval %ecx, %eax
movl %eax, -0x4(%rbp)
jmp 0x1e61a
movq -0x10(%rbp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x14b80
movq %rax, -0x78(%rbp)
movq -0x10(%rbp), %rdi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x14b80
movq %rax, -0x80(%rbp)
movq -0x78(%rbp), %rdi
movq -0x80(%rbp), %rsi
callq 0x32d0
movl %eax, -0x84(%rbp)
movq -0x10(%rbp), %rdi
movl $0x2, %esi
callq 0x4400
movl -0x84(%rbp), %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)