// File: /workspace/github_c_makefile_star2_O2/michaelforney[P]cproc/expr.c
// Function: unaryexpr
static struct expr *
unaryexpr(struct scope *s)
{
	enum tokenkind op;
	struct expr *e, *l;
	struct type *t;

	op = tok.kind;
	switch (op) {
	case TINC:
	case TDEC:
		next();
		l = unaryexpr(s);
		e = mkincdecexpr(op, l, false);
		break;
	case TBAND:
	case TMUL:
		next();
		return mkunaryexpr(op, castexpr(s));
	case TADD:
		next();
		e = castexpr(s);
		if (!(e->type->prop & PROPARITH))
			error(&tok.loc, "operand of unary '+' operator must have arithmetic type");
		if (e->type->prop & PROPINT)
			e = exprpromote(e);
		break;
	case TSUB:
		next();
		e = castexpr(s);
		if (!(e->type->prop & PROPARITH))
			error(&tok.loc, "operand of unary '-' operator must have arithmetic type");
		if (e->type->prop & PROPINT)
			e = exprpromote(e);
		e = mkexpr(EXPRUNARY, e->type, e);
		e->op = op;
		break;
	case TBNOT:
		next();
		e = castexpr(s);
		if (!(e->type->prop & PROPINT))
			error(&tok.loc, "operand of '~' operator must have integer type");
		e = exprpromote(e);
		e = mkbinaryexpr(&tok.loc, TXOR, e, mkconstexpr(e->type, -1));
		break;
	case TLNOT:
		next();
		e = castexpr(s);
		if (!(e->type->prop & PROPSCALAR))
			error(&tok.loc, "operator '!' must have scalar operand");
		e = mkbinaryexpr(&tok.loc, TEQL, e, mkconstexpr(&typeint, 0));
		break;
	case TSIZEOF:
	case TALIGNOF:
		next();
		if (consume(TLPAREN)) {
			t = typename(s, NULL, NULL);
			if (t) {
				expect(TRPAREN, "after type name");
				/* might be part of a compound literal */
				if (op == TSIZEOF && tok.kind == TLBRACE)
					parseinit(s, t);
				e = NULL;
			} else {
				e = expr(s);
				expect(TRPAREN, "after expression");
				if (op == TSIZEOF)
					e = postfixexpr(s, e);
			}
		} else if (op == TSIZEOF) {
			t = NULL;
			e = unaryexpr(s);
		} else {
			error(&tok.loc, "expected ')' after 'alignof'");
			return NULL;  /* unreachable */
		}
		if (!t) {
			if (e->decayed)
				e = e->base;
			if (e->kind == EXPRBITFIELD)
				error(&tok.loc, "%s operator applied to bitfield expression", tokstr[op]);
			t = e->type;
		}
		if (t->incomplete)
			error(&tok.loc, "%s operator applied to incomplete type", tokstr[op]);
		if (t->kind == TYPEFUNC)
			error(&tok.loc, "%s operator applied to function type", tokstr[op]);
		if (t->kind == TYPEARRAY && t->size == 0 && op == TSIZEOF) {
			e = mkexpr(EXPRSIZEOF, &typeulong, e);
			e->u.szof.type = e ? t : e->base->type;
		} else {
			e = mkconstexpr(&typeulong, op == TSIZEOF ? t->size : t->align);
		}
		break;
	default:
		e = postfixexpr(s, NULL);
	}

	return e;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdi, %r12
leaq 0x1362b(%rip), %rbx     # 0x1c108
movl (%rbx), %r14d
leal -0x48(%r14), %eax
cmpl $0x7, %eax
ja 0x8b1c
leaq 0x9874(%rip), %rcx      # 0x12364
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0x9c1e
movq %r12, %rdi
callq 0x8aca
movl %r14d, %edi
movq %rax, %rsi
xorl %edx, %edx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x8e86
cmpl $0x9, %r14d
je 0x8b2c
cmpl $0x26, %r14d
jne 0x8c19
callq 0x9c1e
pushq $0x42
popq %rdi
callq 0xa28d
testb %al, %al
je 0x8c02
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3784
testq %rax, %rax
je 0x8d53
movq %rax, %r13
leaq 0x9c7d(%rip), %rsi      # 0x127dd
pushq $0x43
popq %rdi
callq 0xa26e
xorl %r15d, %r15d
cmpl $0x26, %r14d
jne 0x8db3
cmpl $0x44, (%rbx)
jne 0x8db3
movq %r12, %rdi
movq %r13, %rsi
callq 0x8f44
xorl %r15d, %r15d
jmp 0x8db3
callq 0x9c1e
movq %r12, %rdi
callq 0x784c
movl %r14d, %edi
movq %rax, %rsi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x715a
callq 0x9c1e
movq %r12, %rdi
callq 0x784c
movq %rax, %r14
movq 0x8(%rax), %rax
movl 0x4(%rax), %eax
testb $0x8, %al
jne 0x8be9
addq $0x8, %rbx
leaq 0xa3ab(%rip), %rsi      # 0x12f83
movq %rbx, %rdi
xorl %eax, %eax
callq 0xc536
movq 0x8(%r14), %rax
movl 0x4(%rax), %eax
testb $0x2, %al
je 0x8e40
movq %r14, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x664f
cmpl $0x26, %r14d
jne 0x8d36
movq %r12, %rdi
callq 0x8aca
jmp 0x8d7e
movq %r12, %rdi
xorl %esi, %esi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x7a07
callq 0x9c1e
movq %r12, %rdi
callq 0x784c
movq %rax, %r14
movq 0x8(%rax), %rax
testb $0x10, 0x4(%rax)
jne 0x8c58
leaq 0x8(%rbx), %rdi
leaq 0xa3d1(%rip), %rsi      # 0x13022
xorl %eax, %eax
callq 0xc536
leaq 0x12fa1(%rip), %rdi     # 0x1bc00
xorl %esi, %esi
callq 0x8e6f
addq $0x8, %rbx
pushq $0x58
jmp 0x8d1e
callq 0x9c1e
movq %r12, %rdi
callq 0x784c
movq %rax, %r14
movq 0x8(%rax), %rsi
movl 0x4(%rsi), %eax
testb $0x8, %al
jne 0x8ca8
addq $0x8, %rbx
leaq 0xa324(%rip), %rsi      # 0x12fbb
movq %rbx, %rdi
xorl %eax, %eax
callq 0xc536
movq 0x8(%r14), %rsi
movl 0x4(%rsi), %eax
testb $0x2, %al
je 0x8cbb
movq %r14, %rdi
callq 0x664f
movq %rax, %r14
movq 0x8(%rax), %rsi
pushq $0x7
popq %rdi
movq %r14, %rdx
callq 0x6efa
movq %rax, %r14
movl $0x4d, 0x14(%rax)
jmp 0x8e40
callq 0x9c1e
movq %r12, %rdi
callq 0x784c
movq %rax, %r14
movq 0x8(%rax), %rax
testb $0x2, 0x4(%rax)
jne 0x8d01
leaq 0x8(%rbx), %rdi
leaq 0xa2f9(%rip), %rsi      # 0x12ff3
xorl %eax, %eax
callq 0xc536
movq %r14, %rdi
callq 0x664f
movq %rax, %r14
movq 0x8(%rax), %rdi
pushq $-0x1
popq %rsi
callq 0x8e6f
addq $0x8, %rbx
pushq $0x5a
popq %rsi
movq %rbx, %rdi
movq %r14, %rdx
movq %rax, %rcx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x728c
addq $0x8, %rbx
leaq 0xa307(%rip), %rsi      # 0x13048
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xc536
jmp 0x8e40
movq %r12, %rdi
callq 0x6e32
movq %rax, %r15
leaq 0x9d65(%rip), %rsi      # 0x12aca
pushq $0x43
popq %rdi
callq 0xa26e
cmpl $0x26, %r14d
jne 0x8d81
movq %r12, %rdi
movq %r15, %rsi
callq 0x7a07
movq %rax, %r15
cmpb $0x1, 0x5(%r15)
jne 0x8d8c
movq 0x18(%r15), %r15
cmpl $0x4, (%r15)
jne 0x8daf
leaq 0x12877(%rip), %rax     # 0x1b610
movq (%rax,%r14,8), %rdx
leaq 0x8(%rbx), %rdi
leaq 0xa2bd(%rip), %rsi      # 0x13065
xorl %eax, %eax
callq 0xc536
movq 0x8(%r15), %r13
cmpb $0x1, 0x3c(%r13)
jne 0x8dd7
leaq 0x1284f(%rip), %rax     # 0x1b610
movq (%rax,%r14,8), %rdx
leaq 0x8(%rbx), %rdi
leaq 0xa2c0(%rip), %rsi      # 0x13090
xorl %eax, %eax
callq 0xc536
movl (%r13), %eax
cmpl $0xe, %eax
jne 0x8e04
leaq 0x12829(%rip), %rax     # 0x1b610
movq (%rax,%r14,8), %rdx
addq $0x8, %rbx
leaq 0xa2c1(%rip), %rsi      # 0x130b7
movq %rbx, %rdi
xorl %eax, %eax
callq 0xc536
movl (%r13), %eax
cmpl $0xd, %eax
jne 0x8e4d
cmpl $0x26, %r14d
jne 0x8e4d
cmpq $0x0, 0x10(%r13)
jne 0x8e4d
leaq 0x12eeb(%rip), %rsi     # 0x1bd08
pushq $0xf
popq %rdi
movq %r15, %rdx
callq 0x6efa
movq %rax, %r14
testq %rax, %rax
jne 0x8e3c
movq 0x18, %rax
movq 0x8(%rax), %r13
movq %r13, 0x30(%r14)
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
cmpl $0x26, %r14d
jne 0x8e59
movq 0x10(%r13), %rsi
jmp 0x8e5d
movslq 0x8(%r13), %rsi
leaq 0x12ea4(%rip), %rdi     # 0x1bd08
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x8e6f