// File: /workspace/github_c_makefile_star2_O2/azhai[P]mlite/mlite.c
// Function: pp_set
cell pp_set(cell x) {
	int	p, k;
	cell	n, a, new;

	p = integer_value("set", cadr(x));
	if (tuple_p(car(x))) {
		a = node(NIL, NIL);
		save(a);
		for (n = car(x); n != NIL && p; n = cdr(n), p--) {
			car(a) = car(n);
			set(cdr(a), node(NIL, NIL));
			a = cdr(a);
		}
		if (n == NIL)
			return error("set: index out of range", cadr(x));
		car(a) = caddr(x);
		cdr(a) = cdr(n);
		return unsave(1);
	}
	if (vector_p(car(x))) {
		k = vector_len(car(x));
		if (p < 0 || p >= k)
			return error("set: index out of range", cadr(x));
		vector(car(x))[p] = caddr(x);
		return car(x);
	}
	if (!string_p(car(x)))
		return error("ref: expected str/tuple/vec, got", car(x));
	if (!char_p(caddr(x)))
		return error("ref: expected char, got", caddr(x));
	k = string_len(car(x))-1;
	if (p < 0 || p >= k)
		return error("set: index out of range", cadr(x));
	n = make_string("", k);
	memcpy(string(n), string(car(x)), k+1);
	string(n)[p] = char_value(caddr(x));
	return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0xd529(%rip), %rax      # 0x1c170
movq 0xd972(%rip), %rcx      # 0x1c5c0
movq (%rcx,%rdi,8), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x60e7(%rip), %rdi      # 0x14d44
callq 0x41c5
movq 0xd507(%rip), %rcx      # 0x1c170
movq (%rcx,%rbx,8), %rsi
testq %rsi, %rsi
js 0xec8b
movq %rax, %r14
movq 0xd964(%rip), %rdi      # 0x1c5e0
movb (%rdi,%rsi), %al
testb $0x19, %al
je 0xec97
testb $0x10, %al
jne 0xed5c
leaq 0x60ce(%rip), %rdi      # 0x14d60
jmp 0xeeba
pushq $-0x1
popq %r12
movq %r12, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x3613
movq %rax, %r15
movq 0xd476(%rip), %rsi      # 0x1c128
movq %rax, %rdi
xorl %edx, %edx
callq 0x3613
movq %rax, 0xd465(%rip)      # 0x1c128
leaq (,%rbx,8), %rcx
addq 0xd49e(%rip), %rcx      # 0x1c170
movq (%rcx), %r13
addl $-0x1, %r14d
setb %al
cmpq $-0x1, %r13
je 0xed16
testb %al, %al
je 0xed16
movq 0xd483(%rip), %rax      # 0x1c170
movq (%rax,%r13,8), %rcx
movq %rcx, (%rax,%r15,8)
movq %r12, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x3613
movq 0xd8b7(%rip), %rcx      # 0x1c5c0
movq %rax, (%rcx,%r15,8)
leaq (%rcx,%r13,8), %rcx
movq %rax, %r15
jmp 0xecd2
movq 0xd453(%rip), %rax      # 0x1c170
movq 0xd89c(%rip), %rcx      # 0x1c5c0
movq (%rcx,%rbx,8), %rdx
cmpq $-0x1, %r13
je 0xee99
movq (%rcx,%rdx,8), %rdx
movq (%rax,%rdx,8), %rdx
movq %rdx, (%rax,%r15,8)
movq (%rcx,%r13,8), %rax
movq %rax, (%rcx,%r15,8)
pushq $0x1
popq %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3775
cmpq $-0x24, (%rcx,%rsi,8)
jne 0xedb8
movq 0xd856(%rip), %rax      # 0x1c5c0
testl %r14d, %r14d
js 0xee9f
movq (%rax,%rsi,8), %rdx
movq 0xd86a(%rip), %rsi      # 0x1c5e8
movq -0x8(%rsi,%rdx,8), %rdi
addq $0x7, %rdi
shrq $0x3, %rdi
cmpl %edi, %r14d
jge 0xee9f
leaq (%rsi,%rdx,8), %rdx
movq (%rax,%rbx,8), %rsi
movq (%rax,%rsi,8), %rax
movq (%rcx,%rax,8), %rax
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
movq %rax, (%rdx,%r14,8)
movq (%rcx,%rbx,8), %r15
jmp 0xeec3
cmpq $-0x21, (%rcx,%rsi,8)
jne 0xec8b
movq 0xd7f6(%rip), %r8       # 0x1c5c0
movq (%r8,%rbx,8), %rdx
movq (%r8,%rdx,8), %rax
movq (%rcx,%rax,8), %rax
testq %rax, %rax
js 0xeeb0
testb $0x1, (%rdi,%rax)
je 0xeeb0
cmpq $-0x16, (%rcx,%rax,8)
jne 0xeeb0
testl %r14d, %r14d
js 0xeed5
movq 0xd7e4(%rip), %rax      # 0x1c5e8
movq (%r8,%rsi,8), %rsi
movq -0x8(%rax,%rsi,8), %rax
leal -0x1(%rax), %esi
cmpl %r14d, %esi
jle 0xeed5
movl %eax, %r12d
leaq 0x6ab5(%rip), %rdi      # 0x158d8
callq 0x729e
movq %rax, %r15
movq 0xd7b6(%rip), %rax      # 0x1c5e8
movq 0xd787(%rip), %rcx      # 0x1c5c0
movq (%rcx,%r15,8), %rdx
leaq (%rax,%rdx,8), %rdi
movq 0xd328(%rip), %rdx      # 0x1c170
movq (%rdx,%rbx,8), %rdx
movq (%rcx,%rdx,8), %rcx
leaq (%rax,%rcx,8), %rsi
movq %r12, %rdx
callq 0x3130
movq 0xd30d(%rip), %rax      # 0x1c170
movq 0xd756(%rip), %rcx      # 0x1c5c0
movq (%rcx,%rbx,8), %rdx
movq (%rcx,%rdx,8), %rdx
movq (%rax,%rdx,8), %rdx
movq (%rcx,%rdx,8), %rdx
movb (%rax,%rdx,8), %al
movq (%rcx,%r15,8), %rcx
shlq $0x3, %rcx
addq 0xd75c(%rip), %rcx      # 0x1c5e8
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
movb %al, (%r14,%rcx)
jmp 0xeec3
movq (%rax,%rdx,8), %rsi
jmp 0xeea7
movq (%rax,%rbx,8), %rax
movq (%rcx,%rax,8), %rsi
leaq 0x5e9a(%rip), %rdi      # 0x14d48
jmp 0xeeba
leaq 0x5eca(%rip), %rdi      # 0x14d81
movq %rax, %rsi
callq 0x33e4
pushq $-0x5
popq %r15
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rcx,%rdx,8), %rsi
jmp 0xeea7