// File: /workspace/github_c_makefile_star2_O0/michaelforney[P]cproc/expr.c
// Function: mkunaryexpr
static struct expr *
mkunaryexpr(enum tokenkind op, struct expr *base)
{
	struct expr *expr;
	struct type *type;

	switch (op) {
	case TBAND:
		if (base->decayed) {
			expr = base;
			base = base->base;
			free(expr);
		}
		/*
		Allow struct and union types even if they are not lvalues,
		since we take their address when compiling member access.
		*/
		if (!base->lvalue && base->type->kind != TYPEFUNC && base->type->kind != TYPESTRUCT && base->type->kind != TYPEUNION)
			error(&tok.loc, "'&' operand is not an lvalue or function designator");
		if (base->kind == EXPRBITFIELD)
			error(&tok.loc, "cannot take address of bit-field");
		expr = mkexpr(EXPRUNARY, mkpointertype(base->type, base->qual), base);
		expr->op = op;
		return expr;
	case TMUL:
		if (base->type->kind != TYPEPOINTER)
			error(&tok.loc, "cannot dereference non-pointer");
		if (base->kind == EXPRUNARY && base->op == TBAND) {
			type = base->type->base;
			expr = base->base;
			expr->type = type;
		} else {
			expr = mkexpr(EXPRUNARY, base->type->base, base);
			expr->qual = base->type->qual;
			expr->lvalue = true;
			expr->op = op;
		}
		return decay(expr);
	}
	/* other unary operators get compiled as equivalent binary ones */
	fatal("internal error: unknown unary operator %d", op);
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0xc(%rbp)
movq %rsi, -0x18(%rbp)
movl -0xc(%rbp), %eax
movl %eax, -0x2c(%rbp)
subl $0x4a, %eax
je 0x943d
jmp 0x942c
movl -0x2c(%rbp), %eax
subl $0x4b, %eax
je 0x9510
jmp 0x95c4
movq -0x18(%rbp), %rax
testb $0x1, 0x5(%rax)
je 0x9464
movq -0x18(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rdi
callq 0x3260
movq -0x18(%rbp), %rax
testb $0x1, 0x4(%rax)
jne 0x94ae
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0xe, (%rax)
je 0x94ae
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0xf, (%rax)
je 0x94ae
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x10, (%rax)
je 0x94ae
leaq 0x18d0c(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x11065(%rip), %rsi     # 0x1a50c
movb $0x0, %al
callq 0x11190
movq -0x18(%rbp), %rax
cmpl $0x4, (%rax)
jne 0x94d0
leaq 0x18cea(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x11077(%rip), %rsi     # 0x1a540
movb $0x0, %al
callq 0x11190
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x18(%rbp), %rax
movl 0x10(%rax), %esi
callq 0x11760
movq %rax, %rsi
movq -0x18(%rbp), %rdx
movl $0x7, %edi
callq 0x9040
movq %rax, -0x20(%rbp)
movl -0xc(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x95dd
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0xc, (%rax)
je 0x9536
leaq 0x18c84(%rip), %rdi     # 0x221a8
addq $0x8, %rdi
leaq 0x11032(%rip), %rsi     # 0x1a561
movb $0x0, %al
callq 0x11190
movq -0x18(%rbp), %rax
cmpl $0x7, (%rax)
jne 0x9573
movq -0x18(%rbp), %rax
cmpl $0x4a, 0x14(%rax)
jne 0x9573
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x20(%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x20(%rbp)
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0x95b5
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movq 0x20(%rax), %rsi
movq -0x18(%rbp), %rdx
movl $0x7, %edi
callq 0x9040
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rax
movl 0x38(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x20(%rbp), %rax
movb $0x1, 0x4(%rax)
movl -0xc(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x14(%rax)
movq -0x20(%rbp), %rdi
callq 0xa660
movq %rax, -0x8(%rbp)
jmp 0x95dd
movl -0xc(%rbp), %esi
leaq 0x10fb2(%rip), %rdi     # 0x1a580
movb $0x0, %al
callq 0x12650
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)