// File: /workspace/github_c_makefile_star2_O3/ArtifexSoftware[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 0x22c(%rip), %r15       # 0x18179
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 0x18156
movq %rax, %rbx
movq %rax, %rdi
addq $0x8, %rdi
movl $0xbd98, %edx           # imm = 0xBD98
xorl %esi, %esi
callq 0x3060
movq %r14, (%rbx)
movq %r15, 0x10(%rbx)
testb $0x1, %bpl
je 0x17f9d
movabsq $0x100000001, %rax      # imm = 0x100000001
movq %rax, 0x30(%rbx)
leaq 0x1b8d0(%rip), %rax     # 0x33874
movq %rax, 0x2198(%rbx)
leaq 0x1b879(%rip), %rax     # 0x3382b
movq %rax, 0x21a0(%rbx)
movl $0x0, 0x21a8(%rbx)
leaq -0x14a8c(%rip), %rax    # 0x353e
movq %rax, 0x18(%rbx)
leaq 0x1bd(%rip), %rax       # 0x18192
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 0x1802f
movl $0x1, 0x150(%rbx)
movl %ebp, 0x118(%rbx)
movl %ebp, 0x158(%rbx)
movq %rbx, %rdi
callq 0x13b6c
movq %rax, %rdi
callq 0x3100
testl %eax, %eax
je 0x18043
movq %rbx, %rdi
callq 0xdc9e
xorl %eax, %eax
movl %eax, %ebx
jmp 0x18156
xorl %ebp, %ebp
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq *%r15
movl %ebp, %ebx
jmp 0x18156
movl $0x68, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0xde05
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)
leaq 0x28324(%rip), %r12     # 0x403b8
movq %r12, 0x8(%rax)
movl $0x1, %r13d
movl %r13d, 0x4(%rax)
movq %rax, 0x120(%rbx)
movq %rbx, %rdi
movl %ebp, %esi
callq 0xde05
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, 0x8(%r14)
movl %r13d, 0x4(%r14)
movq %r14, 0x128(%rbx)
movq %rbx, %rdi
movl $0x20, %esi
callq 0xde05
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 0x677a
movl 0x8198(%rbx), %eax
testl %eax, %eax
je 0x18168
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 0x1b6ca(%rip), %rsi     # 0x33839
xorl %eax, %eax
movq %rbx, %rdi
callq 0xc666