// File: /workspace/github_c_makefile_star2_O1/ccxvii[P]mujs/./jsstate.c
// Function: js_newstate
js_State *js_newstate(js_Alloc alloc, void *actx, int flags)
{
	js_State *J;

	assert(sizeof(js_Value) == 16);
	assert(soffsetof(js_Value, t.type) == 15);

	if (!alloc)
		alloc = js_defaultalloc;

	J = alloc(actx, NULL, sizeof *J);
	if (!J)
		return NULL;
	memset(J, 0, sizeof(*J));
	J->actx = actx;
	J->alloc = alloc;

	if (flags & JS_STRICT)
		J->strict = J->default_strict = 1;

	J->trace[0].name = "-top-";
	J->trace[0].file = "native";
	J->trace[0].line = 0;

	J->report = js_defaultreport;
	J->panic = js_defaultpanic;

	J->stack = alloc(actx, NULL, JS_STACKSIZE * sizeof *J->stack);
	if (!J->stack) {
		alloc(actx, J, 0);
		return NULL;
	}

	J->gcmark = 1;
	J->nextref = 0;
	J->gcthresh = 0; /* reaches stability within ~ 2-5 GC cycles */

	if (js_try(J)) {
		js_freestate(J);
		return NULL;
	}

	J->R = jsV_newobject(J, JS_COBJECT, NULL);
	J->G = jsV_newobject(J, JS_COBJECT, NULL);
	J->E = jsR_newenvironment(J, J->G, NULL);
	J->GE = J->E;

	jsB_init(J);

	js_endtry(J);
	return J;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r14
testq %rdi, %rdi
leaq 0x232(%rip), %r15       # 0x18690
cmovneq %rdi, %r15
xorl %eax, %eax
movl %eax, %ebx
movq %rsi, %rdi
movq %rbx, %rsi
movl $0xbda0, %edx           # imm = 0xBDA0
callq *%r15
testq %rax, %rax
je 0x1866d
movq %rax, %rbx
movl $0xbda0, %edx           # imm = 0xBDA0
movq %rax, %rdi
xorl %esi, %esi
callq 0x3060
movq %r14, (%rbx)
movq %r15, 0x10(%rbx)
testb $0x1, %bpl
je 0x184aa
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x30(%rbx)
leaq 0x1b393(%rip), %rax     # 0x33844
movq %rax, 0x2198(%rbx)
leaq 0x1b33c(%rip), %rax     # 0x337fb
movq %rax, 0x21a0(%rbx)
movl $0x0, 0x21a8(%rbx)
leaq -0x14f99(%rip), %rax    # 0x353e
movq %rax, 0x18(%rbx)
leaq 0x1c7(%rip), %rax       # 0x186a9
movq %rax, 0x20(%rbx)
xorl %ebp, %ebp
movl %ebp, %esi
movq %r14, %rdi
movl $0x10000, %edx          # imm = 0x10000
callq *%r15
movq %rax, 0x148(%rbx)
testq %rax, %rax
je 0x1853c
movl $0x1, 0x150(%rbx)
movl %ebp, 0x118(%rbx)
movl %ebp, 0x158(%rbx)
movq %rbx, %rdi
callq 0x13fbb
movq %rax, %rdi
callq 0x3100
testl %eax, %eax
je 0x18550
movq %rbx, %rdi
callq 0xdfb9
xorl %eax, %eax
movl %eax, %ebx
jmp 0x1866d
xorl %ebp, %ebp
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq *%r15
movl %ebp, %ebx
jmp 0x1866d
movl $0x68, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0xe119
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x50(%rax)
xorl %ecx, %ecx
movl %ecx, %r15d
movq %r15, 0x60(%rax)
movq 0x170(%rbx), %rcx
movq %rcx, 0x50(%rax)
movq %rax, 0x170(%rbx)
incl 0x154(%rbx)
movabsq $0x100000000, %r12      # imm = 0x100000000
movq %r12, (%rax)
leaq 0x27e0a(%rip), %r13     # 0x403b8
movq %r13, 0x8(%rax)
movq %r15, 0x18(%rax)
movq %rax, 0x120(%rbx)
movq %rbx, %rdi
movl %ebp, %esi
callq 0xe119
movq %rax, %r14
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movups %xmm0, 0x10(%rax)
movups %xmm0, 0x20(%rax)
movups %xmm0, 0x30(%rax)
movups %xmm0, 0x40(%rax)
movups %xmm0, 0x50(%rax)
movq %r15, 0x60(%rax)
movq 0x170(%rbx), %rax
movq %rax, 0x50(%r14)
movq %r14, 0x170(%rbx)
incl 0x154(%rbx)
movq %r12, (%r14)
movq %r13, 0x8(%r14)
movq %r15, 0x18(%r14)
movq %r14, 0x128(%rbx)
movq %rbx, %rdi
movl $0x20, %esi
callq 0xe119
movl $0x0, 0x18(%rax)
movq 0x160(%rbx), %rcx
movq %rcx, 0x10(%rax)
movq %rax, 0x160(%rbx)
incl 0x154(%rbx)
movq %r15, (%rax)
movq %r14, 0x8(%rax)
movq %rax, 0x130(%rbx)
movq %rax, 0x138(%rbx)
movq %rbx, %rdi
callq 0x682f
movl 0x8198(%rbx), %eax
testl %eax, %eax
je 0x1867f
decl %eax
movl %eax, 0x8198(%rbx)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1b183(%rip), %rsi     # 0x33809
xorl %eax, %eax
movq %rbx, %rdi
callq 0xc939