// File: /workspace/github_c_makefile_star2_O1/ccxvii[P]mujs/./jsrun.c
// Function: jsR_setproperty
static void jsR_setproperty(js_State *J, js_Object *obj, const char *name, int transient)
{
	js_Value *value = stackidx(J, -1);
	js_Property *ref;
	int k;
	int own;

	if (obj->type == JS_CARRAY) {
		if (!strcmp(name, "length")) {
			double rawlen = jsV_tonumber(J, value);
			int newlen = jsV_numbertointeger(rawlen);
			if (newlen != rawlen || newlen < 0)
				js_rangeerror(J, "invalid array length");
			if (newlen > JS_ARRAYLIMIT)
				js_rangeerror(J, "array too large");
			if (obj->u.a.simple) {
				obj->u.a.length = newlen;
				if (newlen <= obj->u.a.flat_length)
					obj->u.a.flat_length = newlen;
			} else  {
				jsV_resizearray(J, obj, newlen);
			}
			return;
		}

		if (js_isarrayindex(J, name, &k)) {
			if (obj->u.a.simple) {
				if (k >= 0 && k <= obj->u.a.flat_length) {
					jsR_setarrayindex(J, obj, k, value);
				} else {
					jsR_unflattenarray(J, obj);
					if (obj->u.a.length < k + 1)
						obj->u.a.length = k + 1;
				}
			} else {
				if (obj->u.a.length < k + 1)
					obj->u.a.length = k + 1;
			}
		}
	}

	else if (obj->type == JS_CSTRING) {
		if (!strcmp(name, "length"))
			goto readonly;
		if (js_isarrayindex(J, name, &k))
			if (k >= 0 && k < obj->u.s.length)
				goto readonly;
	}

	else if (obj->type == JS_CREGEXP) {
		if (!strcmp(name, "source")) goto readonly;
		if (!strcmp(name, "global")) goto readonly;
		if (!strcmp(name, "ignoreCase")) goto readonly;
		if (!strcmp(name, "multiline")) goto readonly;
		if (!strcmp(name, "lastIndex")) {
			obj->u.r.last = jsV_tointeger(J, value);
			return;
		}
	}

	else if (obj->type == JS_CUSERDATA) {
		if (obj->u.user.put && obj->u.user.put(J, obj->u.user.data, name))
			return;
	}

	/* First try to find a setter in prototype chain */
	ref = jsV_getpropertyx(J, obj, name, &own);
	if (ref) {
		if (ref->setter) {
			js_pushobject(J, ref->setter);
			js_pushobject(J, obj);
			js_pushvalue(J, *value);
			js_call(J, 1);
			js_pop(J, 1);
			return;
		} else {
			if (J->strict)
				if (ref->getter)
					js_typeerror(J, "setting property '%s' that only has a getter", name);
			if (ref->atts & JS_READONLY)
				goto readonly;
		}
	}

	/* Property not found on this object, so create one */
	if (!ref || !own) {
		if (transient) {
			if (J->strict)
				js_typeerror(J, "cannot create property '%s' on transient object", name);
			return;
		}
		ref = jsV_setproperty(J, obj, name);
	}

	if (ref) {
		if (!(ref->atts & JS_READONLY))
			ref->value = *value;
		else
			goto readonly;
	}

	return;

readonly:
	if (J->strict)
		js_typeerror(J, "'%s' is read-only", name);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %ecx, %ebp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movslq 0x140(%rdi), %rax
testq %rax, %rax
jle 0x15e0d
movq 0x148(%rbx), %rcx
shlq $0x4, %rax
leaq (%rcx,%rax), %r12
addq $-0x10, %r12
jmp 0x15e14
leaq 0x2a5e4(%rip), %r12     # 0x403f8
movl (%r14), %eax
cmpl $0x8, %eax
jg 0x15e7d
cmpl $0x1, %eax
je 0x15eb5
cmpl $0x8, %eax
jne 0x160d6
leaq 0x1d91c(%rip), %rsi     # 0x33751
movq %r15, %rdi
callq 0x32f0
testl %eax, %eax
je 0x161b5
leaq 0x8(%rsp), %r13
movq %r15, %rsi
movq %r13, %rdx
callq 0x15b35
testl %eax, %eax
setne %cl
movl (%r13), %eax
testl %eax, %eax
setns %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x160d6
cmpl 0x20(%r14), %eax
jge 0x160d6
jmp 0x161b5
cmpl $0x9, %eax
je 0x15f21
cmpl $0xf, %eax
jne 0x160d6
movq 0x38(%r14), %rax
testq %rax, %rax
je 0x160d6
movq 0x28(%r14), %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq *%rax
testl %eax, %eax
jne 0x161bb
jmp 0x160d6
leaq 0x1d895(%rip), %rsi     # 0x33751
movq %r15, %rdi
callq 0x32f0
testl %eax, %eax
je 0x15fd1
leaq 0x8(%rsp), %rdx
movq %r15, %rsi
callq 0x15b35
testl %eax, %eax
je 0x160d6
cmpl $0x0, 0x24(%r14)
je 0x16011
movl 0x8(%rsp), %r13d
testl %r13d, %r13d
js 0x15f00
cmpl 0x28(%r14), %r13d
jle 0x160c5
movq %rbx, %rdi
movq %r14, %rsi
callq 0x15b88
cmpl %r13d, 0x20(%r14)
jg 0x160d6
incl %r13d
movl %r13d, 0x20(%r14)
jmp 0x160d6
leaq 0x1ec15(%rip), %rsi     # 0x34b3d
movq %r15, %rdi
callq 0x32f0
testl %eax, %eax
je 0x161b5
leaq 0x1ec05(%rip), %rsi     # 0x34b44
movq %r15, %rdi
callq 0x32f0
testl %eax, %eax
je 0x161b5
leaq 0x1ebf5(%rip), %rsi     # 0x34b4b
movq %r15, %rdi
callq 0x32f0
testl %eax, %eax
je 0x161b5
leaq 0x1ebe9(%rip), %rsi     # 0x34b56
movq %r15, %rdi
callq 0x32f0
testl %eax, %eax
je 0x161b5
leaq 0x1ebdc(%rip), %rsi     # 0x34b60
movq %r15, %rdi
callq 0x32f0
testl %eax, %eax
jne 0x160d6
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1514c
xorpd %xmm1, %xmm1
ucomisd %xmm1, %xmm0
je 0x161ca
ucomisd %xmm0, %xmm1
jbe 0x161ce
xorpd 0x15441(%rip), %xmm0    # 0x2b400
callq 0x3370
xorpd 0x15434(%rip), %xmm0    # 0x2b400
jmp 0x161d3
movq %rbx, %rdi
movq %r12, %rsi
callq 0x1514c
movapd %xmm0, %xmm1
xorpd %xmm0, %xmm0
ucomisd %xmm0, %xmm1
je 0x1602a
ucomisd %xmm1, %xmm0
movapd %xmm1, 0x10(%rsp)
jbe 0x1602e
xorpd 0x15402(%rip), %xmm1    # 0x2b400
movapd %xmm1, %xmm0
callq 0x3370
xorpd 0x153f1(%rip), %xmm0    # 0x2b400
jmp 0x16037
movl 0x8(%rsp), %eax
cmpl %eax, 0x20(%r14)
jg 0x160d6
incl %eax
movl %eax, 0x20(%r14)
jmp 0x160d6
xorl %edx, %edx
jmp 0x16063
movapd %xmm1, %xmm0
callq 0x3370
movl $0x80000000, %edx       # imm = 0x80000000
movsd 0x153ec(%rip), %xmm1    # 0x2b430
ucomisd %xmm0, %xmm1
movapd 0x10(%rsp), %xmm1
ja 0x16063
movl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
ucomisd 0x153db(%rip), %xmm0    # 0x2b438
ja 0x16063
cvttsd2si %xmm0, %edx
testl %edx, %edx
js 0x16213
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
ucomisd %xmm0, %xmm1
jne 0x16213
jp 0x16213
cmpl $0x4000001, %edx        # imm = 0x4000001
jge 0x1621c
cmpl $0x0, 0x24(%r14)
je 0x160ac
movl %edx, 0x20(%r14)
cmpl 0x28(%r14), %edx
jg 0x161bb
movl %edx, 0x28(%r14)
jmp 0x161bb
movq %rbx, %rdi
movq %r14, %rsi
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x12d44
movq %rbx, %rdi
movq %r14, %rsi
movl %r13d, %edx
movq %r12, %rcx
callq 0x27345
leaq 0xc(%rsp), %rcx
movq %r14, %rsi
movq %r15, %rdx
callq 0x126db
testq %rax, %rax
je 0x16170
movq 0x30(%rax), %rsi
testq %rsi, %rsi
je 0x16159
movq %rbx, %rdi
callq 0x44e7
movq %rbx, %rdi
movq %r14, %rsi
callq 0x44e7
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %rbx, %rdi
callq 0x14a7d
movq %rbx, %rdi
movl $0x1, %esi
callq 0x16c25
movl 0x140(%rbx), %ecx
movl 0x144(%rbx), %eax
leal -0x1(%rcx), %edx
movl %edx, 0x140(%rbx)
cmpl %eax, %ecx
jg 0x161bb
movl %eax, 0x140(%rbx)
leaq 0x1d61f(%rip), %rsi     # 0x3376e
movq %rbx, %rdi
xorl %eax, %eax
callq 0xc939
cmpl $0x0, 0x34(%rbx)
je 0x1616a
cmpq $0x0, 0x28(%rax)
jne 0x1620a
testb $0x1, 0x14(%rax)
jne 0x161b5
testq %rax, %rax
je 0x1617c
cmpl $0x0, 0xc(%rsp)
jne 0x1619d
testl %ebp, %ebp
je 0x1618f
cmpl $0x0, 0x34(%rbx)
je 0x161bb
leaq 0x1ee25(%rip), %rsi     # 0x34fb2
jmp 0x161fd
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x127de
testq %rax, %rax
je 0x161bb
testb $0x1, 0x14(%rax)
jne 0x161b5
movupd (%r12), %xmm0
movupd %xmm0, 0x18(%rax)
jmp 0x161bb
cmpl $0x0, 0x34(%rbx)
jne 0x161f6
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0x161ef
callq 0x3370
movsd 0x15255(%rip), %xmm1    # 0x2b430
ucomisd %xmm0, %xmm1
ja 0x161ef
ucomisd 0x1524f(%rip), %xmm0    # 0x2b438
ja 0x161ef
cvttsd2si %xmm0, %eax
movw %ax, 0x32(%r14)
jmp 0x161bb
leaq 0x1ede5(%rip), %rsi     # 0x34fe2
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0xcce3
leaq 0x1ed74(%rip), %rsi     # 0x34f85
jmp 0x161fd
leaq 0x1ed46(%rip), %rsi     # 0x34f60
jmp 0x16223
leaq 0x1ed52(%rip), %rsi     # 0x34f75
movq %rbx, %rdi
xorl %eax, %eax
callq 0xcab5