// File: /workspace/github_c_makefile_star2_O3/ArtifexSoftware[P]mujs/./jsgc.c
// Function: js_gc
void js_gc(js_State *J, int report)
{
	js_Function *fun, *nextfun, **prevnextfun;
	js_Object *obj, *nextobj, **prevnextobj;
	js_String *str, *nextstr, **prevnextstr;
	js_Environment *env, *nextenv, **prevnextenv;
	unsigned int nenv = 0, nfun = 0, nobj = 0, nstr = 0, nprop = 0;
	unsigned int genv = 0, gfun = 0, gobj = 0, gstr = 0, gprop = 0;
	int mark;
	int i;

	mark = J->gcmark = J->gcmark == 1 ? 2 : 1;

	/* Add initial roots. */

	jsG_markobject(J, mark, J->Object_prototype);
	jsG_markobject(J, mark, J->Array_prototype);
	jsG_markobject(J, mark, J->Function_prototype);
	jsG_markobject(J, mark, J->Boolean_prototype);
	jsG_markobject(J, mark, J->Number_prototype);
	jsG_markobject(J, mark, J->String_prototype);
	jsG_markobject(J, mark, J->RegExp_prototype);
	jsG_markobject(J, mark, J->Date_prototype);

	jsG_markobject(J, mark, J->Error_prototype);
	jsG_markobject(J, mark, J->EvalError_prototype);
	jsG_markobject(J, mark, J->RangeError_prototype);
	jsG_markobject(J, mark, J->ReferenceError_prototype);
	jsG_markobject(J, mark, J->SyntaxError_prototype);
	jsG_markobject(J, mark, J->TypeError_prototype);
	jsG_markobject(J, mark, J->URIError_prototype);

	jsG_markobject(J, mark, J->R);
	jsG_markobject(J, mark, J->G);

	jsG_markstack(J, mark);

	jsG_markenvironment(J, mark, J->E);
	jsG_markenvironment(J, mark, J->GE);
	for (i = 0; i < J->envtop; ++i)
		jsG_markenvironment(J, mark, J->envstack[i]);

	/* Scan objects until none remain. */

	while ((obj = J->gcroot) != NULL) {
		J->gcroot = obj->gcroot;
		obj->gcroot = NULL;
		jsG_scanobject(J, mark, obj);
	}

	/* Free everything not marked. */

	prevnextenv = &J->gcenv;
	for (env = J->gcenv; env; env = nextenv) {
		nextenv = env->gcnext;
		if (env->gcmark != mark) {
			*prevnextenv = nextenv;
			jsG_freeenvironment(J, env);
			++genv;
		} else {
			prevnextenv = &env->gcnext;
		}
		++nenv;
	}

	prevnextfun = &J->gcfun;
	for (fun = J->gcfun; fun; fun = nextfun) {
		nextfun = fun->gcnext;
		if (fun->gcmark != mark) {
			*prevnextfun = nextfun;
			jsG_freefunction(J, fun);
			++gfun;
		} else {
			prevnextfun = &fun->gcnext;
		}
		++nfun;
	}

	prevnextobj = &J->gcobj;
	for (obj = J->gcobj; obj; obj = nextobj) {
		nprop += obj->count;
		nextobj = obj->gcnext;
		if (obj->gcmark != mark) {
			gprop += obj->count;
			*prevnextobj = nextobj;
			jsG_freeobject(J, obj);
			++gobj;
		} else {
			prevnextobj = &obj->gcnext;
		}
		++nobj;
	}

	prevnextstr = &J->gcstr;
	for (str = J->gcstr; str; str = nextstr) {
		nextstr = str->gcnext;
		if (str->gcmark != mark) {
			*prevnextstr = nextstr;
			js_free(J, str);
			++gstr;
		} else {
			prevnextstr = &str->gcnext;
		}
		++nstr;
	}

	unsigned int ntot = nenv + nfun + nobj + nstr + nprop;
	unsigned int gtot = genv + gfun + gobj + gstr + gprop;
	unsigned int remaining = ntot - gtot;

	J->gccounter = remaining;
	J->gcthresh = remaining * JS_GCFACTOR;

	if (report) {
		char buf[256];
		snprintf(buf, sizeof buf, "garbage collected (%d%%): %d/%d envs, %d/%d funs, %d/%d objs, %d/%d props, %d/%d strs",
			100*gtot/ntot, genv, nenv, gfun, nfun, gobj, nobj, gprop, nprop, gstr, nstr);
		js_report(J, buf);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x158, %rsp            # imm = 0x158
movl %esi, 0x2c(%rsp)
movq %rdi, %r13
xorl %r14d, %r14d
cmpl $0x1, 0x150(%rdi)
sete %r14b
incl %r14d
movl %r14d, 0x150(%rdi)
movq 0x90(%rdi), %rax
movl %r14d, 0x60(%rax)
movq 0x180(%rdi), %rcx
movq %rcx, 0x58(%rax)
movq 0x98(%rdi), %rcx
movl %r14d, 0x60(%rcx)
movq %rax, 0x58(%rcx)
movq 0xa0(%rdi), %rax
movl %r14d, 0x60(%rax)
movq %rcx, 0x58(%rax)
movq 0xa8(%rdi), %rcx
movl %r14d, 0x60(%rcx)
movq %rax, 0x58(%rcx)
movq 0xb0(%rdi), %rax
movl %r14d, 0x60(%rax)
movq %rcx, 0x58(%rax)
movq 0xb8(%rdi), %rcx
movl %r14d, 0x60(%rcx)
movq %rax, 0x58(%rcx)
movq 0xc0(%rdi), %rax
movl %r14d, 0x60(%rax)
movq %rcx, 0x58(%rax)
movq 0xc8(%rdi), %rcx
movl %r14d, 0x60(%rcx)
movq %rax, 0x58(%rcx)
movq 0xd0(%rdi), %rax
movl %r14d, 0x60(%rax)
movq %rcx, 0x58(%rax)
movq 0xd8(%rdi), %rcx
movl %r14d, 0x60(%rcx)
movq %rax, 0x58(%rcx)
movq 0xe0(%rdi), %rax
movl %r14d, 0x60(%rax)
movq %rcx, 0x58(%rax)
movq 0xe8(%rdi), %rcx
movl %r14d, 0x60(%rcx)
movq %rax, 0x58(%rcx)
movq 0xf0(%rdi), %rax
movl %r14d, 0x60(%rax)
movq %rcx, 0x58(%rax)
movq 0xf8(%rdi), %rcx
movl %r14d, 0x60(%rcx)
movq %rax, 0x58(%rcx)
movq 0x100(%rdi), %rax
movl %r14d, 0x60(%rax)
movq %rcx, 0x58(%rax)
movq 0x120(%rdi), %rcx
movl %r14d, 0x60(%rcx)
movq %rax, 0x58(%rcx)
movq 0x128(%rdi), %rdx
movl %r14d, 0x60(%rdx)
movq %rcx, 0x58(%rdx)
movq %rdx, 0x180(%rdi)
movl 0x140(%rdi), %eax
testl %eax, %eax
je 0xd689
movq 0x148(%r13), %rcx
movb 0xf(%rcx), %sil
cmpb $0x6, %sil
jne 0xd657
movq (%rcx), %rsi
movsbl 0x8(%rsi), %edi
cmpl %edi, %r14d
je 0xd666
movb %r14b, 0x8(%rsi)
movb 0xf(%rcx), %sil
cmpb $0x7, %sil
jne 0xd666
movq (%rcx), %r15
cmpl %r14d, 0x60(%r15)
jne 0xd678
movq %rdx, %r15
decl %eax
addq $0x10, %rcx
movq %r15, %rdx
testl %eax, %eax
jne 0xd639
jmp 0xd68c
movl %r14d, 0x60(%r15)
movq %rdx, 0x58(%r15)
movq %r15, 0x180(%r13)
jmp 0xd669
movq %rdx, %r15
movq 0x130(%r13), %rax
movl %r14d, 0x18(%rax)
movq 0x8(%rax), %rcx
cmpl %r14d, 0x60(%rcx)
je 0xd6b3
movl %r14d, 0x60(%rcx)
movq %r15, 0x58(%rcx)
movq %rcx, 0x180(%r13)
movq %rcx, %r15
movq (%rax), %rax
testq %rax, %rax
je 0xd6c1
cmpl %r14d, 0x18(%rax)
jne 0xd693
movq 0x138(%r13), %rax
movl %r14d, 0x18(%rax)
movq 0x8(%rax), %rcx
cmpl %r14d, 0x60(%rcx)
je 0xd6e8
movl %r14d, 0x60(%rcx)
movq %r15, 0x58(%rcx)
movq %rcx, 0x180(%r13)
movq %rcx, %r15
movq (%rax), %rax
testq %rax, %rax
je 0xd6f6
cmpl %r14d, 0x18(%rax)
jne 0xd6c8
movslq 0x188(%r13), %rax
testq %rax, %rax
jle 0xd89f
xorl %ecx, %ecx
movq 0x190(%r13,%rcx,8), %rdx
movl %r14d, 0x18(%rdx)
movq 0x8(%rdx), %rsi
cmpl %r14d, 0x60(%rsi)
je 0xd730
movl %r14d, 0x60(%rsi)
movq %r15, 0x58(%rsi)
movq %rsi, 0x180(%r13)
movq %rsi, %r15
movq (%rdx), %rdx
testq %rdx, %rdx
je 0xd73e
cmpl %r14d, 0x18(%rdx)
jne 0xd710
incq %rcx
cmpq %rax, %rcx
jne 0xd708
jmp 0xd89f
movq 0x58(%r15), %rax
movq %rax, 0x180(%r13)
movq $0x0, 0x58(%r15)
movq 0x8(%r15), %rdx
cmpl $0x0, 0x10(%rdx)
je 0xd773
movq %r13, %rdi
movl %r14d, %esi
callq 0x21314
movq 0x18(%r15), %rax
testq %rax, %rax
je 0xd798
cmpl %r14d, 0x60(%rax)
je 0xd798
movl %r14d, 0x60(%rax)
movq 0x180(%r13), %rcx
movq %rcx, 0x58(%rax)
movq %rax, 0x180(%r13)
movl (%r15), %eax
cmpl $0xe, %eax
je 0xd85f
cmpl $0x1, %eax
jne 0xd81f
cmpl $0x0, 0x24(%r15)
je 0xd898
cmpl $0x0, 0x28(%r15)
jle 0xd898
xorl %ecx, %ecx
xorl %edx, %edx
movq 0x30(%r15), %rsi
movb 0xf(%rsi,%rcx), %dil
cmpb $0x6, %dil
jne 0xd7e9
movq (%rsi,%rcx), %rdi
movsbl 0x8(%rdi), %r8d
cmpl %r8d, %r14d
je 0xd80f
movb %r14b, 0x8(%rdi)
movb 0xf(%rsi,%rcx), %dil
cmpb $0x7, %dil
jne 0xd80f
movq (%rsi,%rcx), %rsi
cmpl %r14d, 0x60(%rsi)
je 0xd80f
movl %r14d, 0x60(%rsi)
movq 0x180(%r13), %rdi
movq %rdi, 0x58(%rsi)
movq %rsi, 0x180(%r13)
incq %rdx
movslq 0x28(%r15), %rsi
addq $0x10, %rcx
cmpq %rsi, %rdx
jl 0xd7c3
andl $-0x2, %eax
cmpl $0x2, %eax
jne 0xd898
movq 0x28(%r15), %rax
testq %rax, %rax
je 0xd881
cmpl %r14d, 0x18(%rax)
je 0xd881
movl %r14d, 0x18(%rax)
movq 0x8(%rax), %rcx
cmpl %r14d, 0x60(%rcx)
je 0xd85a
movl %r14d, 0x60(%rcx)
movq 0x180(%r13), %rdx
movq %rdx, 0x58(%rcx)
movq %rcx, 0x180(%r13)
movq (%rax), %rax
jmp 0xd82b
movq 0x20(%r15), %r15
cmpl %r14d, 0x60(%r15)
je 0xd898
movl %r14d, 0x60(%r15)
movq 0x180(%r13), %rax
movq %rax, 0x58(%r15)
movq %r15, 0x180(%r13)
jmp 0xd89f
movq 0x20(%r15), %rsi
testq %rsi, %rsi
je 0xd898
cmpl %r14d, 0x68(%rsi)
je 0xd898
movl %r14d, %edi
callq 0x213d0
movq 0x180(%r13), %r15
testq %r15, %r15
jne 0xd74b
movq 0x160(%r13), %rsi
xorl %ebp, %ebp
movl $0x0, %ebx
movl $0x0, %eax
movq %rax, 0x20(%rsp)
testq %rsi, %rsi
je 0xd90e
leaq 0x160(%r13), %r12
movq $0x0, 0x20(%rsp)
xorl %ebx, %ebx
movq 0x10(%rsi), %r15
cmpl %r14d, 0x18(%rsi)
jne 0xd8ea
addq $0x10, %rsi
movq %rsi, %r12
jmp 0xd904
movq %r15, (%r12)
movq (%r13), %rdi
xorl %edx, %edx
callq *0x10(%r13)
movq 0x20(%rsp), %rax
incl %eax
movq %rax, 0x20(%rsp)
incl %ebx
movq %r15, %rsi
testq %r15, %r15
jne 0xd8d7
movq %rbx, 0x38(%rsp)
movq 0x168(%r13), %rsi
movl $0x0, %r15d
testq %rsi, %rsi
je 0xd95d
leaq 0x168(%r13), %r12
xorl %r15d, %r15d
xorl %ebp, %ebp
movq 0x60(%rsi), %rbx
cmpl %r14d, 0x68(%rsi)
jne 0xd944
addq $0x60, %rsi
movq %rsi, %r12
jmp 0xd953
movq %rbx, (%r12)
movq %r13, %rdi
callq 0xdb2e
incl %r15d
incl %ebp
movq %rbx, %rsi
testq %rbx, %rbx
jne 0xd931
movq %r15, 0x30(%rsp)
movq %rbp, 0x40(%rsp)
movq %r13, 0x8(%rsp)
movq 0x170(%r13), %rsi
xorl %ebp, %ebp
movl $0x0, %r12d
movl $0x0, %r13d
movl $0x0, %eax
movq %rax, 0x18(%rsp)
movl $0x0, %eax
movq %rax, 0x10(%rsp)
testq %rsi, %rsi
je 0xda1f
movq 0x8(%rsp), %rax
leaq 0x170(%rax), %rcx
movq $0x0, 0x10(%rsp)
movq $0x0, 0x18(%rsp)
xorl %r13d, %r13d
xorl %r12d, %r12d
movl 0x10(%rsi), %ebx
movq 0x50(%rsi), %r15
cmpl %r14d, 0x60(%rsi)
jne 0xd9d8
addq $0x50, %rsi
movq %rsi, %rcx
jmp 0xda11
movq 0x10(%rsp), %rax
addl %ebx, %eax
movq %rax, 0x10(%rsp)
movq %r15, (%rcx)
movq 0x8(%rsp), %rdi
movq %r13, %rbp
movq %r12, %r13
movq %rcx, %r12
callq 0xdb74
movq %r12, %rcx
movq %r13, %r12
movq %rbp, %r13
xorl %ebp, %ebp
movq 0x18(%rsp), %rax
incl %eax
movq %rax, 0x18(%rsp)
addl %ebx, %r13d
incl %r12d
movq %r15, %rsi
testq %r15, %r15
jne 0xd9c2
movq 0x8(%rsp), %rax
movq 0x178(%rax), %rsi
movl $0x0, %edi
testq %rsi, %rsi
je 0xda7c
movq 0x8(%rsp), %rax
leaq 0x178(%rax), %r15
xorl %edi, %edi
xorl %ebp, %ebp
movq (%rsi), %rbx
movsbl 0x8(%rsi), %eax
cmpl %eax, %r14d
jne 0xda56
movq %rsi, %r15
jmp 0xda72
movq %rbx, (%r15)
movq 0x8(%rsp), %rax
movq %rdi, 0x48(%rsp)
movq (%rax), %rdi
xorl %edx, %edx
callq *0x10(%rax)
movq 0x48(%rsp), %rdi
incl %edi
incl %ebp
movq %rbx, %rsi
testq %rbx, %rbx
jne 0xda45
movq 0x40(%rsp), %r10
movq 0x38(%rsp), %r9
leal (%r12,%r13), %ecx
addl %r10d, %ecx
addl %r9d, %ecx
addl %ebp, %ecx
movq 0x20(%rsp), %r8
movq 0x30(%rsp), %rsi
movq 0x18(%rsp), %r11
movq 0x10(%rsp), %r14
leal (%r11,%r14), %eax
addl %esi, %eax
addl %r8d, %eax
addl %edi, %eax
movl %ecx, %edx
subl %eax, %edx
movq 0x8(%rsp), %rbx
movl %edx, 0x154(%rbx)
leal (%rdx,%rdx,4), %edx
movl %edx, 0x158(%rbx)
cmpl $0x0, 0x2c(%rsp)
je 0xdb1c
imull $0x64, %eax, %eax
xorl %edx, %edx
divl %ecx
leaq 0x2576e(%rip), %rdx     # 0x3324c
movq %rdi, %r15
leaq 0x50(%rsp), %rdi
movl $0x100, %esi            # imm = 0x100
movl %eax, %ecx
xorl %eax, %eax
pushq %rbp
pushq %r15
pushq %r13
pushq %r14
pushq %r12
pushq %r11
pushq %r10
pushq 0x68(%rsp)
callq 0x3080
addq $0x40, %rsp
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0xdb1c
movq %rbx, %rdi
leaq 0x50(%rsp), %rsi
callq *%rax
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq