// File: /workspace/github_c_makefile_star2_O0/oridb[P]mc/6/simp.c
// Function: simpslice
static Node *
simpslice(Simp *s, Node *n, Node *dst)
{
	Node *t;
	Node *start, *end, *arg;
	Node *seq, *base, *sz, *len, *max;
	Node *stbase, *stlen;

	if (dst)
		t = dst;
	else
		t = temp(s, n);
	arg = n->expr.args[0];
	if (exprop(arg) == Oarr && arg->expr.nargs == 0) {
		seq = arg;
		base = mkintlit(n->loc, 0);
		base->expr.type = tyintptr;
	} else {
		/* *(&slice) = (void*)base + off*sz */
		seq = rval(s, arg, NULL);
		base = slicebase(s, seq, n->expr.args[1]);
	}
	start = ptrsized(s, rval(s, n->expr.args[1], NULL));
	end = ptrsized(s, rval(s, n->expr.args[2], NULL));
	len = sub(end, start);
	/* we can be storing through a pointer, in the case
	 * of '*foo = bar'. */
	max = seqlen(s, seq, tyword);
	if (max)
		checkidx(s, Ole, max, end);
	if (tybase(exprtype(t))->type == Typtr) {
		stbase = set(simpcast(s, t, mktyptr(t->loc, tyintptr)), base);
		sz = addk(simpcast(s, t, mktyptr(t->loc, tyintptr)), Ptrsz);
	} else {
		stbase = set(deref(addr(s, t, tyintptr), NULL), base);
		sz = addk(addr(s, t, tyintptr), Ptrsz);
	}
	/* *(&slice + ptrsz) = len */
	stlen = set(deref(sz, NULL), len);
	append(s, stbase);
	append(s, stlen);
	return t;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x18478
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x18489
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x16940
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
callq 0x2f210
cmpl $0x39, %eax
jne 0x184de
movq -0x38(%rbp), %rax
cmpq $0x0, 0x40(%rax)
jne 0x184de
movq -0x38(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x2f3c0
movq %rax, -0x48(%rbp)
movq 0x64974(%rip), %rcx     # 0x7ce48
movq -0x48(%rbp), %rax
movq %rcx, 0x20(%rax)
jmp 0x18510
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x177e0
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq 0x8(%rax), %rdx
callq 0x1a290
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x80(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq 0x8(%rax), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x177e0
movq -0x80(%rbp), %rdi
movq %rax, %rsi
callq 0x1a440
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq 0x10(%rax), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0x177e0
movq -0x78(%rbp), %rdi
movq %rax, %rsi
callq 0x1a440
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x1a4f0
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq 0x648be(%rip), %rdx     # 0x7ce50
callq 0x189d0
movq %rax, -0x60(%rbp)
cmpq $0x0, -0x60(%rbp)
je 0x185b8
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rdx
movq -0x30(%rbp), %rcx
movl $0x1c, %esi
callq 0x1a540
movq -0x20(%rbp), %rdi
callq 0x30340
movq %rax, %rdi
callq 0x36a30
cmpl $0x12, (%rax)
jne 0x18673
movq -0x8(%rbp), %rax
movq %rax, -0xa0(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x98(%rbp)
movq -0x20(%rbp), %rax
movq 0x64855(%rip), %rsi     # 0x7ce48
movq (%rax), %rdi
callq 0x37430
movq -0xa0(%rbp), %rdi
movq -0x98(%rbp), %rsi
movq %rax, %rdx
callq 0x18fe0
movq %rax, %rdi
movq -0x48(%rbp), %rsi
callq 0x17580
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x20(%rbp), %rax
movq 0x64806(%rip), %rsi     # 0x7ce48
movq (%rax), %rdi
callq 0x37430
movq -0x90(%rbp), %rdi
movq -0x88(%rbp), %rsi
movq %rax, %rdx
callq 0x18fe0
movq %rax, %rdi
movl $0x8, %esi
callq 0x18400
movq %rax, -0x50(%rbp)
jmp 0x186c8
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq 0x647c6(%rip), %rdx     # 0x7ce48
callq 0x16af0
movq %rax, %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x17670
movq %rax, %rdi
movq -0x48(%rbp), %rsi
callq 0x17580
movq %rax, -0x68(%rbp)
movq -0x8(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq 0x64796(%rip), %rdx     # 0x7ce48
callq 0x16af0
movq %rax, %rdi
movl $0x8, %esi
callq 0x18400
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x17670
movq %rax, %rdi
movq -0x58(%rbp), %rsi
callq 0x17580
movq %rax, -0x70(%rbp)
movq -0x8(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x17710
movq -0x8(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x17710
movq -0x20(%rbp), %rax
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)