// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]cproc/qbe.c
// Function: funclval
static struct lvalue
funclval(struct func *f, struct expr *e)
{
	struct lvalue lval = {0};
	struct decl *d;

	if (e->kind == EXPRBITFIELD) {
		lval.bits = e->u.bitfield.bits;
		e = e->base;
	}
	switch (e->kind) {
	case EXPRIDENT:
		d = e->u.ident.decl;
		if (d->kind != DECLOBJECT && d->kind != DECLFUNC)
			error(&tok.loc, "identifier '%s' is not an object or function", d->name);
		if (d == f->namedecl) {
			fputs("data ", stdout);
			emitname(d->value);
			printf(" = { b \"%s\", b 0 }\n", f->name);
			f->namedecl = NULL;
		}
		lval.addr = d->value;
		break;
	case EXPRSTRING:
		d = stringdecl(e);
		lval.addr = d->value;
		break;
	case EXPRCOMPOUND:
		if (e->toeval)
			funcexpr(f, e->toeval);
		d = e->u.compound.decl;
		funcinit(f, d, e->u.compound.init, true);
		lval.addr = d->value;
		break;
	case EXPRUNARY:
		if (e->op != TMUL)
			error(&tok.loc, "expression is not an object");
		lval.addr = funcexpr(f, e->base);
		break;
	default:
		if (e->type->kind != TYPESTRUCT && e->type->kind != TYPEUNION)
			error(&tok.loc, "expression is not an object");
		lval.addr = funcexpr(f, e);
	}
	return lval;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
leaq -0x10(%rbp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x3110
movq -0x20(%rbp), %rax
cmpl $0x4, (%rax)
jne 0x1568f
movq -0x20(%rbp), %rax
movl 0x30(%rax), %eax
movl %eax, -0x8(%rbp)
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x30(%rbp)
subq $0x7, %rax
ja 0x15803
movq -0x30(%rbp), %rax
leaq 0x685e(%rip), %rcx      # 0x1bf0c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpl $0x1, 0x8(%rax)
je 0x156f7
movq -0x28(%rbp), %rax
cmpl $0x2, 0x8(%rax)
je 0x156f7
movq -0x28(%rbp), %rax
movq (%rax), %rdx
leaq 0xcac3(%rip), %rdi      # 0x221a8
addq $0x8, %rdi
leaq 0x6fb0(%rip), %rsi      # 0x1c6a0
movb $0x0, %al
callq 0x11190
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rcx
cmpq 0x8(%rcx), %rax
jne 0x1574a
movq 0xb8c4(%rip), %rax      # 0x20fd0
movq (%rax), %rsi
leaq 0x6b77(%rip), %rdi      # 0x1c28d
callq 0x3100
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rdi
callq 0x164a0
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
leaq 0x6f96(%rip), %rdi      # 0x1c6cd
movb $0x0, %al
callq 0x30c0
movq -0x18(%rbp), %rax
movq $0x0, 0x8(%rax)
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x15847
movq -0x20(%rbp), %rdi
callq 0x5440
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x15847
movq -0x20(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x15795
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x28(%rax), %rsi
callq 0x13fe0
movq -0x20(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
movq -0x28(%rbp), %rsi
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rdx
movl $0x1, %ecx
callq 0x15ab0
movq -0x28(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x15847
movq -0x20(%rbp), %rax
cmpl $0x4b, 0x14(%rax)
je 0x157ec
leaq 0xc9ce(%rip), %rdi      # 0x221a8
addq $0x8, %rdi
leaq 0x6efc(%rip), %rsi      # 0x1c6e1
movb $0x0, %al
callq 0x11190
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rax
movq 0x18(%rax), %rsi
callq 0x13fe0
movq %rax, -0x10(%rbp)
jmp 0x15847
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0xf, (%rax)
je 0x15836
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x10, (%rax)
je 0x15836
leaq 0xc984(%rip), %rdi      # 0x221a8
addq $0x8, %rdi
leaq 0x6eb2(%rip), %rsi      # 0x1c6e1
movb $0x0, %al
callq 0x11190
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x13fe0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rdx
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)