// File: /workspace/github_c_makefile_star2_O1/ccxvii[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, 0x34(%rsp)
movq %rdi, %rbx
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 %rax, 0x180(%rdi)
movq 0x98(%rdi), %rcx
movl %r14d, 0x60(%rcx)
movq %rax, 0x58(%rcx)
movq %rcx, 0x180(%rdi)
movq 0xa0(%rdi), %rax
movl %r14d, 0x60(%rax)
movq %rcx, 0x58(%rax)
movq %rax, 0x180(%rdi)
movq 0xa8(%rdi), %rcx
movl %r14d, 0x60(%rcx)
movq %rax, 0x58(%rcx)
movq %rcx, 0x180(%rdi)
movq 0xb0(%rdi), %rax
movl %r14d, 0x60(%rax)
movq %rcx, 0x58(%rax)
movq %rax, 0x180(%rdi)
movq 0xb8(%rdi), %rcx
movl %r14d, 0x60(%rcx)
movq %rax, 0x58(%rcx)
movq %rcx, 0x180(%rdi)
movq 0xc0(%rdi), %rax
movl %r14d, 0x60(%rax)
movq %rcx, 0x58(%rax)
movq %rax, 0x180(%rdi)
movq 0xc8(%rdi), %rcx
movl %r14d, 0x60(%rcx)
movq %rax, 0x58(%rcx)
movq %rcx, 0x180(%rdi)
movq 0xd0(%rdi), %rax
movl %r14d, 0x60(%rax)
movq %rcx, 0x58(%rax)
movq %rax, 0x180(%rdi)
movq 0xd8(%rdi), %rcx
movl %r14d, 0x60(%rcx)
movq %rax, 0x58(%rcx)
movq %rcx, 0x180(%rdi)
movq 0xe0(%rdi), %rax
movl %r14d, 0x60(%rax)
movq %rcx, 0x58(%rax)
movq %rax, 0x180(%rdi)
movq 0xe8(%rdi), %rcx
movl %r14d, 0x60(%rcx)
movq %rax, 0x58(%rcx)
movq %rcx, 0x180(%rdi)
movq 0xf0(%rdi), %rax
movl %r14d, 0x60(%rax)
movq %rcx, 0x58(%rax)
movq %rax, 0x180(%rdi)
movq 0xf8(%rdi), %rcx
movl %r14d, 0x60(%rcx)
movq %rax, 0x58(%rcx)
movq %rcx, 0x180(%rdi)
movq 0x100(%rdi), %rax
movl %r14d, 0x60(%rax)
movq %rcx, 0x58(%rax)
movq %rax, 0x180(%rdi)
movq 0x120(%rdi), %rcx
movl %r14d, 0x60(%rcx)
movq %rax, 0x58(%rcx)
movq %rcx, 0x180(%rdi)
movq 0x128(%rdi), %rax
movl %r14d, 0x60(%rax)
movq %rcx, 0x58(%rax)
movq %rax, 0x180(%rdi)
movl 0x140(%rdi), %eax
testl %eax, %eax
je 0xd9ba
movq 0x148(%rbx), %rcx
cmpb $0x6, 0xf(%rcx)
jne 0xd98b
movq (%rcx), %rdx
movsbl 0x8(%rdx), %esi
cmpl %esi, %r14d
je 0xd98b
movb %r14b, 0x8(%rdx)
cmpb $0x7, 0xf(%rcx)
jne 0xd9b0
movq (%rcx), %rdx
cmpl %r14d, 0x60(%rdx)
je 0xd9b0
movl %r14d, 0x60(%rdx)
movq 0x180(%rbx), %rsi
movq %rsi, 0x58(%rdx)
movq %rdx, 0x180(%rbx)
decl %eax
addq $0x10, %rcx
testl %eax, %eax
jne 0xd975
movq 0x130(%rbx), %rax
movl %r14d, 0x18(%rax)
movq 0x8(%rax), %rcx
cmpl %r14d, 0x60(%rcx)
je 0xd9e5
movl %r14d, 0x60(%rcx)
movq 0x180(%rbx), %rdx
movq %rdx, 0x58(%rcx)
movq %rcx, 0x180(%rbx)
movq (%rax), %rax
testq %rax, %rax
je 0xd9f3
cmpl %r14d, 0x18(%rax)
jne 0xd9c1
movq 0x138(%rbx), %rax
movl %r14d, 0x18(%rax)
movq 0x8(%rax), %rcx
cmpl %r14d, 0x60(%rcx)
je 0xda1e
movl %r14d, 0x60(%rcx)
movq 0x180(%rbx), %rdx
movq %rdx, 0x58(%rcx)
movq %rcx, 0x180(%rbx)
movq (%rax), %rax
testq %rax, %rax
je 0xda2c
cmpl %r14d, 0x18(%rax)
jne 0xd9fa
movslq 0x188(%rbx), %rax
testq %rax, %rax
jle 0xdbc5
xorl %ecx, %ecx
movq 0x190(%rbx,%rcx,8), %rdx
movl %r14d, 0x18(%rdx)
movq 0x8(%rdx), %rsi
cmpl %r14d, 0x60(%rsi)
je 0xda6a
movl %r14d, 0x60(%rsi)
movq 0x180(%rbx), %rdi
movq %rdi, 0x58(%rsi)
movq %rsi, 0x180(%rbx)
movq (%rdx), %rdx
testq %rdx, %rdx
je 0xda78
cmpl %r14d, 0x18(%rdx)
jne 0xda46
incq %rcx
cmpq %rax, %rcx
jne 0xda3e
jmp 0xdbc5
movq 0x58(%r15), %rax
movq %rax, 0x180(%rbx)
movq $0x0, 0x58(%r15)
movq 0x8(%r15), %rdx
cmpl $0x0, 0x10(%rdx)
je 0xdaad
movq %rbx, %rdi
movl %r14d, %esi
callq 0x2164b
movq 0x18(%r15), %rax
testq %rax, %rax
je 0xdad2
cmpl %r14d, 0x60(%rax)
je 0xdad2
movl %r14d, 0x60(%rax)
movq 0x180(%rbx), %rcx
movq %rcx, 0x58(%rax)
movq %rax, 0x180(%rbx)
movl (%r15), %eax
cmpl $0xe, %eax
je 0xdb4e
cmpl $0x1, %eax
jne 0xdb6e
cmpl $0x0, 0x24(%r15)
je 0xdb49
cmpl $0x0, 0x28(%r15)
jle 0xdb49
xorl %ecx, %ecx
xorl %edx, %edx
movq 0x30(%r15), %rsi
cmpb $0x6, 0xf(%rsi,%rcx)
jne 0xdb12
movq (%rsi,%rcx), %rdi
movsbl 0x8(%rdi), %r8d
cmpl %r8d, %r14d
je 0xdb12
movb %r14b, 0x8(%rdi)
cmpb $0x7, 0xf(%rsi,%rcx)
jne 0xdb39
movq (%rsi,%rcx), %rsi
cmpl %r14d, 0x60(%rsi)
je 0xdb39
movl %r14d, 0x60(%rsi)
movq 0x180(%rbx), %rdi
movq %rdi, 0x58(%rsi)
movq %rsi, 0x180(%rbx)
incq %rdx
movslq 0x28(%r15), %rsi
addq $0x10, %rcx
cmpq %rsi, %rdx
jl 0xdaf5
cmpl $0xe, %eax
jne 0xdb6e
movq 0x20(%r15), %rcx
cmpl %r14d, 0x60(%rcx)
je 0xdb6e
movl %r14d, 0x60(%rcx)
movq 0x180(%rbx), %rdx
movq %rdx, 0x58(%rcx)
movq %rcx, 0x180(%rbx)
andl $-0x2, %eax
cmpl $0x2, %eax
jne 0xdbc5
movq 0x28(%r15), %rax
testq %rax, %rax
je 0xdbae
cmpl %r14d, 0x18(%rax)
je 0xdbae
movl %r14d, 0x18(%rax)
movq 0x8(%rax), %rcx
cmpl %r14d, 0x60(%rcx)
je 0xdba9
movl %r14d, 0x60(%rcx)
movq 0x180(%rbx), %rdx
movq %rdx, 0x58(%rcx)
movq %rcx, 0x180(%rbx)
movq (%rax), %rax
jmp 0xdb7a
movq 0x20(%r15), %rsi
testq %rsi, %rsi
je 0xdbc5
cmpl %r14d, 0x68(%rsi)
je 0xdbc5
movl %r14d, %edi
callq 0x21705
movq 0x180(%rbx), %r15
testq %r15, %r15
jne 0xda85
movq 0x160(%rbx), %rsi
xorl %r13d, %r13d
movl $0x0, %ebp
movl $0x0, %eax
movq %rax, 0x20(%rsp)
testq %rsi, %rsi
je 0xdc3a
leaq 0x160(%rbx), %r12
movq $0x0, 0x20(%rsp)
xorl %ebp, %ebp
movq 0x10(%rsi), %r15
cmpl %r14d, 0x18(%rsi)
jne 0xdc18
addq $0x10, %rsi
movq %rsi, %r12
jmp 0xdc30
movq %r15, (%r12)
movq (%rbx), %rdi
xorl %edx, %edx
callq *0x10(%rbx)
movq 0x20(%rsp), %rax
incl %eax
movq %rax, 0x20(%rsp)
incl %ebp
movq %r15, %rsi
testq %r15, %r15
jne 0xdc05
movq 0x168(%rbx), %rsi
movl $0x0, %eax
movq %rax, 0x18(%rsp)
testq %rsi, %rsi
je 0xdc99
leaq 0x168(%rbx), %r12
movq $0x0, 0x18(%rsp)
xorl %r13d, %r13d
movq 0x60(%rsi), %r15
cmpl %r14d, 0x68(%rsi)
jne 0xdc76
addq $0x60, %rsi
movq %rsi, %r12
jmp 0xdc8e
movq %r15, (%r12)
movq %rbx, %rdi
callq 0xde55
movq 0x18(%rsp), %rax
incl %eax
movq %rax, 0x18(%rsp)
incl %r13d
movq %r15, %rsi
testq %r15, %r15
jne 0xdc63
movq %rbp, 0x48(%rsp)
movq %r13, 0x38(%rsp)
movq 0x170(%rbx), %rsi
xorl %ebp, %ebp
movl $0x0, %ecx
movl $0x0, %r13d
movl $0x0, %eax
movq %rax, 0x10(%rsp)
movl $0x0, %eax
movq %rax, 0x8(%rsp)
testq %rsi, %rsi
je 0xdd4e
leaq 0x170(%rbx), %rdx
movq $0x0, 0x8(%rsp)
movq $0x0, 0x10(%rsp)
xorl %r13d, %r13d
xorl %ecx, %ecx
movl 0x10(%rsi), %r12d
movq 0x50(%rsi), %r15
cmpl %r14d, 0x60(%rsi)
jne 0xdd05
addq $0x50, %rsi
movq %rsi, %rdx
jmp 0xdd41
movq 0x8(%rsp), %rax
addl %r12d, %eax
movq %rax, 0x8(%rsp)
movq %r15, (%rdx)
movq %rbx, %rdi
movq %r13, 0x28(%rsp)
movq %rcx, %r13
movq %rdx, %rbp
callq 0xde9b
movq %rbp, %rdx
movq %r13, %rcx
movq 0x28(%rsp), %r13
xorl %ebp, %ebp
movq 0x10(%rsp), %rax
incl %eax
movq %rax, 0x10(%rsp)
addl %r12d, %r13d
incl %ecx
movq %r15, %rsi
testq %r15, %r15
jne 0xdcee
movq %rcx, 0x40(%rsp)
movq 0x178(%rbx), %rsi
movl $0x0, %r10d
testq %rsi, %rsi
je 0xdda5
leaq 0x178(%rbx), %r12
xorl %r10d, %r10d
xorl %ebp, %ebp
movq (%rsi), %r15
movsbl 0x8(%rsi), %eax
cmpl %eax, %r14d
jne 0xdd82
movq %rsi, %r12
jmp 0xdd9b
movq %r15, (%r12)
movq %r10, 0x28(%rsp)
movq (%rbx), %rdi
xorl %edx, %edx
callq *0x10(%rbx)
movq 0x28(%rsp), %r10
incl %r10d
incl %ebp
movq %r15, %rsi
testq %r15, %r15
jne 0xdd71
movq 0x38(%rsp), %rsi
movq 0x48(%rsp), %r9
movq 0x40(%rsp), %r12
leal (%r12,%r13), %ecx
addl %esi, %ecx
addl %r9d, %ecx
addl %ebp, %ecx
movq 0x20(%rsp), %r8
movq 0x18(%rsp), %r11
movq 0x10(%rsp), %r14
movq 0x8(%rsp), %r15
leal (%r14,%r15), %eax
addl %r11d, %eax
addl %r8d, %eax
addl %r10d, %eax
movl %ecx, %edx
subl %eax, %edx
movl %edx, 0x154(%rbx)
leal (%rdx,%rdx,4), %edx
movl %edx, 0x158(%rbx)
cmpl $0x0, 0x34(%rsp)
je 0xde43
imull $0x64, %eax, %eax
xorl %edx, %edx
divl %ecx
leaq 0x25414(%rip), %rdx     # 0x3321c
leaq 0x50(%rsp), %rdi
movl $0x100, %esi            # imm = 0x100
movl %eax, %ecx
xorl %eax, %eax
pushq %rbp
pushq %r10
pushq %r13
pushq %r15
pushq %r12
pushq %r14
pushq 0x68(%rsp)
pushq %r11
callq 0x3080
addq $0x40, %rsp
movq 0x18(%rbx), %rax
testq %rax, %rax
je 0xde43
leaq 0x50(%rsp), %rsi
movq %rbx, %rdi
callq *%rax
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq