// File: /workspace/github_c_makefile_star2_O2/ArtifexSoftware[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 $0x18, %rsp
movl %ecx, %ebp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
pushq $-0x1
popq %rsi
callq 0xf87b
movq %rax, %r12
movl (%r14), %eax
cmpl $0xf, %eax
je 0x105d5
cmpl $0x8, %eax
je 0x104fa
cmpl $0x9, %eax
je 0x10549
cmpl $0x1, %eax
jne 0x1069a
leaq 0x182bc(%rip), %rsi     # 0x28751
movq %r15, %rdi
callq 0x32f0
testl %eax, %eax
je 0x105fb
leaq 0x8(%rsp), %rdx
movq %r15, %rsi
callq 0x1022f
testl %eax, %eax
je 0x1069a
cmpl $0x0, 0x24(%r14)
je 0x1065c
movl 0x8(%rsp), %r13d
testl %r13d, %r13d
js 0x104d9
cmpl 0x28(%r14), %r13d
jle 0x10689
movq %rbx, %rdi
movq %r14, %rsi
callq 0x10280
cmpl %r13d, 0x20(%r14)
jg 0x1069a
incl %r13d
movl %r13d, 0x20(%r14)
jmp 0x1069a
leaq 0x18250(%rip), %rsi     # 0x28751
movq %r15, %rdi
callq 0x32f0
testl %eax, %eax
je 0x10758
leaq 0x8(%rsp), %r13
movq %r15, %rsi
movq %r13, %rdx
callq 0x1022f
testl %eax, %eax
setne %cl
movl (%r13), %eax
testl %eax, %eax
setns %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0x1069a
cmpl 0x20(%r14), %eax
jge 0x1069a
jmp 0x10758
leaq 0x195f8(%rip), %rsi     # 0x29b48
movq %r15, %rdi
callq 0x32f0
testl %eax, %eax
je 0x10758
leaq 0x195e8(%rip), %rsi     # 0x29b4f
movq %r15, %rdi
callq 0x32f0
testl %eax, %eax
je 0x10758
leaq 0x195d8(%rip), %rsi     # 0x29b56
movq %r15, %rdi
callq 0x32f0
testl %eax, %eax
je 0x10758
leaq 0x195cc(%rip), %rsi     # 0x29b61
movq %r15, %rdi
callq 0x32f0
testl %eax, %eax
je 0x10758
leaq 0x195bf(%rip), %rsi     # 0x29b6b
movq %r15, %rdi
callq 0x32f0
testl %eax, %eax
jne 0x1069a
movq %rbx, %rdi
movq %r12, %rsi
callq 0x13710
cvttsd2si %xmm0, %eax
movw %ax, 0x32(%r14)
jmp 0x1075e
movq 0x38(%r14), %rax
testq %rax, %rax
je 0x1069a
movq 0x28(%r14), %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq *%rax
testl %eax, %eax
jne 0x1075e
jmp 0x1069a
movq %rbx, %rdi
movq %r12, %rsi
callq 0xfb3d
movsd %xmm0, 0x10(%rsp)
callq 0xe1fd
testl %eax, %eax
js 0x1078a
cvtsi2sd %eax, %xmm0
movsd 0x10(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jne 0x1078a
jp 0x1078a
cmpl $0x4000001, %eax        # imm = 0x4000001
jae 0x10793
cmpl $0x0, 0x24(%r14)
je 0x1066e
movl %eax, 0x20(%r14)
cmpl 0x28(%r14), %eax
jg 0x1075e
movl %eax, 0x28(%r14)
jmp 0x1075e
movl 0x8(%rsp), %eax
cmpl %eax, 0x20(%r14)
jg 0x1069a
incl %eax
movl %eax, 0x20(%r14)
jmp 0x1069a
movq %rbx, %rdi
movq %r14, %rsi
movl %eax, %edx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xe10a
movq %rbx, %rdi
movq %r14, %rsi
movl %r13d, %edx
movq %r12, %rcx
callq 0x1cadd
leaq 0xc(%rsp), %rcx
movq %r14, %rsi
movq %r15, %rdx
callq 0xdc6d
testq %rax, %rax
je 0x1071d
movq 0x30(%rax), %rsi
testq %rsi, %rsi
je 0x10701
movq %rbx, %rdi
callq 0x4274
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4274
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %rbx, %rdi
callq 0xf74a
pushq $0x1
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x110b0
movq %rbx, %rdi
movl %ebp, %esi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3f3d
cmpl $0x0, 0x34(%rbx)
je 0x1070e
cmpq $0x0, 0x28(%rax)
jne 0x10781
movl 0x14(%rax), %ecx
testb $0x1, %cl
jne 0x10758
cmpl $0x0, 0xc(%rsp)
jne 0x10746
testl %ebp, %ebp
je 0x10730
cmpl $0x0, 0x34(%rbx)
je 0x1075e
leaq 0x1988f(%rip), %rsi     # 0x29fbd
jmp 0x10774
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xdcd0
testq %rax, %rax
je 0x1075e
movl 0x14(%rax), %ecx
testb $0x1, %cl
jne 0x10758
movupd (%r12), %xmm0
movupd %xmm0, 0x18(%rax)
jmp 0x1075e
cmpl $0x0, 0x34(%rbx)
jne 0x1076d
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x19879(%rip), %rsi     # 0x29fed
movq %rbx, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x99a6
leaq 0x19808(%rip), %rsi     # 0x29f90
jmp 0x10774
leaq 0x197da(%rip), %rsi     # 0x29f6b
jmp 0x1079a
leaq 0x197e6(%rip), %rsi     # 0x29f80
movq %rbx, %rdi
xorl %eax, %eax
callq 0x9778