// File: /workspace/github_c_makefile_star2_O0/azhai[P]mlite/mlite.c
// Function: pp_ref
cell pp_ref(cell x) {
	int	p, k, n;

	p = integer_value("ref", cadr(x));
	if (cons_p(car(x))) {
		for (n = car(x); n != NIL && p; n = cdr(n), p--)
			;
		if (n == NIL)
			return error("ref: index out of range", cadr(x));
		return car(n);
	}
	if (vector_p(car(x))) {
		k = vector_len(car(x))-1;
		if (p < 0 || p > k)
			return error("ref: index out of range", cadr(x));
		return vector(car(x))[p];
	}
	if (!string_p(car(x)))
		return error("ref: expected str/tuple/list/vec, got", car(x));
	k = string_len(car(x))-1;
	if (p < 0 || p >= k)
		return error("ref: index out of range", cadr(x));
	return make_char(string(car(x))[p]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq 0x112fd(%rip), %rax     # 0x28180
movq 0x11746(%rip), %rcx     # 0x285d0
movq -0x10(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x9f30(%rip), %rdi      # 0x20dcd
callq 0x4960
movl %eax, -0x14(%rbp)
movq 0x112d4(%rip), %rax     # 0x28180
movq -0x10(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jl 0x16fa3
movq 0x1172e(%rip), %rax     # 0x285f0
movq 0x112b7(%rip), %rcx     # 0x28180
movq -0x10(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movsbl (%rax,%rcx), %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x16fa3
movq 0x11708(%rip), %rax     # 0x285f0
movq 0x11291(%rip), %rcx     # 0x28180
movq -0x10(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movsbl (%rax,%rcx), %eax
andl $0x10, %eax
cmpl $0x0, %eax
jne 0x16fa3
movq 0x11272(%rip), %rax     # 0x28180
movq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, -0x1c(%rbp)
xorl %eax, %eax
cmpl $-0x1, -0x1c(%rbp)
movb %al, -0x1d(%rbp)
je 0x16f2e
cmpl $0x0, -0x14(%rbp)
setne %al
movb %al, -0x1d(%rbp)
movb -0x1d(%rbp), %al
testb $0x1, %al
jne 0x16f37
jmp 0x16f56
jmp 0x16f39
movq 0x11690(%rip), %rax     # 0x285d0
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movl %eax, -0x1c(%rbp)
movl -0x14(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x16f19
cmpl $-0x1, -0x1c(%rbp)
jne 0x16f8b
movq 0x1121d(%rip), %rax     # 0x28180
movq 0x11666(%rip), %rcx     # 0x285d0
movq -0x10(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x9e54(%rip), %rdi      # 0x20dd1
callq 0x34b0
movq %rax, -0x8(%rbp)
jmp 0x171d2
movq 0x111ee(%rip), %rax     # 0x28180
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x8(%rbp)
jmp 0x171d2
movq 0x111d6(%rip), %rax     # 0x28180
movq -0x10(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jl 0x170ba
movq 0x11630(%rip), %rax     # 0x285f0
movq 0x111b9(%rip), %rcx     # 0x28180
movq -0x10(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movsbl (%rax,%rcx), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x170ba
movq 0x1119a(%rip), %rax     # 0x28180
movq 0x11193(%rip), %rcx     # 0x28180
movq -0x10(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
cmpq $-0x24, (%rax,%rcx,8)
jne 0x170ba
movq 0x115f1(%rip), %rax     # 0x285f8
movq 0x115c2(%rip), %rcx     # 0x285d0
movq 0x1116b(%rip), %rdx     # 0x28180
movq -0x10(%rbp), %rsi
movq (%rdx,%rsi,8), %rdx
movq (%rcx,%rdx,8), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rax
addq $0x8, %rax
subq $0x1, %rax
shrq $0x3, %rax
addq $0x3, %rax
subq $0x3, %rax
subq $0x1, %rax
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x14(%rbp)
jl 0x17052
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
jle 0x17081
movq 0x11127(%rip), %rax     # 0x28180
movq 0x11570(%rip), %rcx     # 0x285d0
movq -0x10(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x9d5e(%rip), %rdi      # 0x20dd1
callq 0x34b0
movq %rax, -0x8(%rbp)
jmp 0x171d2
movq 0x11570(%rip), %rax     # 0x285f8
movq 0x11541(%rip), %rcx     # 0x285d0
movq 0x110ea(%rip), %rdx     # 0x28180
movq -0x10(%rbp), %rsi
movq (%rdx,%rsi,8), %rdx
movq (%rcx,%rdx,8), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x8(%rbp)
jmp 0x171d2
movq 0x110bf(%rip), %rax     # 0x28180
movq -0x10(%rbp), %rcx
cmpq $0x0, (%rax,%rcx,8)
jl 0x1710b
movq 0x1151d(%rip), %rax     # 0x285f0
movq 0x110a6(%rip), %rcx     # 0x28180
movq -0x10(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movsbl (%rax,%rcx), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x1710b
movq 0x1108b(%rip), %rax     # 0x28180
movq 0x11084(%rip), %rcx     # 0x28180
movq -0x10(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
cmpq $-0x21, (%rax,%rcx,8)
je 0x1712f
movq 0x1106e(%rip), %rax     # 0x28180
movq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x9cc8(%rip), %rdi      # 0x20de9
callq 0x34b0
movq %rax, -0x8(%rbp)
jmp 0x171d2
movq 0x114c2(%rip), %rax     # 0x285f8
movq 0x11493(%rip), %rcx     # 0x285d0
movq 0x1103c(%rip), %rdx     # 0x28180
movq -0x10(%rbp), %rsi
movq (%rdx,%rsi,8), %rdx
movq (%rcx,%rdx,8), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rax
subq $0x1, %rax
movl %eax, -0x18(%rbp)
cmpl $0x0, -0x14(%rbp)
jl 0x1716d
movl -0x14(%rbp), %eax
cmpl -0x18(%rbp), %eax
jl 0x17199
movq 0x1100c(%rip), %rax     # 0x28180
movq 0x11455(%rip), %rcx     # 0x285d0
movq -0x10(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0x9c43(%rip), %rdi      # 0x20dd1
callq 0x34b0
movq %rax, -0x8(%rbp)
jmp 0x171d2
movq 0x11458(%rip), %rax     # 0x285f8
movq 0x11429(%rip), %rcx     # 0x285d0
movq 0x10fd2(%rip), %rdx     # 0x28180
movq -0x10(%rbp), %rsi
movq (%rdx,%rsi,8), %rdx
movq (%rcx,%rdx,8), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movslq -0x14(%rbp), %rcx
movsbl (%rax,%rcx), %edi
callq 0xa240
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)