// File: /workspace/github_c_makefile_star2_O1/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, %r13
leaq 0x12c55(%rip), %rbx     # 0x1c108
movl (%rbx), %r14d
leal -0x48(%r14), %eax
cmpl $0x7, %eax
ja 0x94f2
leaq 0x9e3e(%rip), %rcx      # 0x13304
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0xa9d0
movq %r13, %rdi
callq 0x94a0
movl %r14d, %edi
movq %rax, %rsi
xorl %edx, %edx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x9914
cmpl $0x9, %r14d
je 0x9502
cmpl $0x26, %r14d
jne 0x95f1
callq 0xa9d0
movl $0x42, %edi
callq 0xb099
testb %al, %al
je 0x95da
movq %r13, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3875
testq %rax, %rax
je 0x97aa
movq %rax, %r12
leaq 0xa245(%rip), %rsi      # 0x1377d
movl $0x43, %edi
callq 0xb07a
xorl %r15d, %r15d
cmpl $0x26, %r14d
jne 0x97dd
cmpl $0x44, (%rbx)
jne 0x97dd
movq %r13, %rdi
movq %r12, %rsi
callq 0x9b1d
xorl %r15d, %r15d
jmp 0x97dd
callq 0xa9d0
movq %r13, %rdi
callq 0x7f4f
movl %r14d, %edi
movq %rax, %rsi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x776b
callq 0xa9d0
movq %r13, %rdi
callq 0x7f4f
movq %rax, %r14
movq 0x8(%rax), %rax
testb $0x8, 0x4(%rax)
jne 0x95bb
addq $0x8, %rbx
leaq 0xa972(%rip), %rsi      # 0x13f23
movq %rbx, %rdi
xorl %eax, %eax
callq 0xd56a
movq 0x8(%r14), %rax
testb $0x2, 0x4(%rax)
je 0x9907
movq %r14, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x6b42
cmpl $0x26, %r14d
jne 0x978d
movq %r13, %rdi
callq 0x94a0
jmp 0x97d7
movq %r13, %rdi
xorl %esi, %esi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x818c
callq 0xa9d0
movq %r13, %rdi
callq 0x7f4f
movq %rax, %r14
movq 0x8(%rax), %rax
testb $0x10, 0x4(%rax)
jne 0x9630
leaq 0x8(%rbx), %rdi
leaq 0xa999(%rip), %rsi      # 0x13fc2
xorl %eax, %eax
callq 0xd56a
movl $0x40, %edi
callq 0xe13e
movl $0x0, 0x10(%rax)
leaq 0x125b8(%rip), %rcx     # 0x1bc00
movq %rcx, 0x8(%rax)
movw $0x0, 0x4(%rax)
movl $0x1, (%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rax)
movups %xmm0, 0x28(%rax)
addq $0x8, %rbx
movq %rbx, %rdi
movl $0x58, %esi
jmp 0x9779
callq 0xa9d0
movq %r13, %rdi
callq 0x7f4f
movq %rax, %r15
movq 0x8(%rax), %rax
testb $0x8, 0x4(%rax)
jne 0x96a3
addq $0x8, %rbx
leaq 0xa8c2(%rip), %rsi      # 0x13f5b
movq %rbx, %rdi
xorl %eax, %eax
callq 0xd56a
movq 0x8(%r15), %rax
testb $0x2, 0x4(%rax)
je 0x96b8
movq %r15, %rdi
callq 0x6b42
movq %rax, %r15
movq 0x8(%r15), %rbx
movl $0x40, %edi
callq 0xe13e
movq %rax, %r14
movabsq $0x4d00000000, %rax     # imm = 0x4D00000000
movq %rax, 0x10(%r14)
movq %rbx, 0x8(%r14)
movw $0x0, 0x4(%r14)
movl $0x7, (%r14)
movq %r15, 0x18(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%r14)
jmp 0x9907
callq 0xa9d0
movq %r13, %rdi
callq 0x7f4f
movq %rax, %r14
movq 0x8(%rax), %rax
testb $0x2, 0x4(%rax)
jne 0x9726
leaq 0x8(%rbx), %rdi
leaq 0xa874(%rip), %rsi      # 0x13f93
xorl %eax, %eax
callq 0xd56a
movq %r14, %rdi
callq 0x6b42
movq %rax, %r14
movq 0x8(%rax), %r15
movl $0x40, %edi
callq 0xe13e
movl $0x0, 0x10(%rax)
movq %r15, 0x8(%rax)
movw $0x0, 0x4(%rax)
movl $0x1, (%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rax)
movq $0x0, 0x28(%rax)
movq $-0x1, 0x30(%rax)
addq $0x8, %rbx
movq %rbx, %rdi
movl $0x5a, %esi
movq %r14, %rdx
movq %rax, %rcx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x78e0
addq $0x8, %rbx
leaq 0xa850(%rip), %rsi      # 0x13fe8
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xd56a
jmp 0x9907
movq %r13, %rdi
callq 0x73a2
movq %rax, %r15
leaq 0xa2ae(%rip), %rsi      # 0x13a6a
movl $0x43, %edi
callq 0xb07a
cmpl $0x26, %r14d
jne 0x97da
movq %r13, %rdi
movq %r15, %rsi
callq 0x818c
movq %rax, %r15
xorl %r12d, %r12d
testq %r12, %r12
jne 0x9814
cmpb $0x1, 0x5(%r15)
jne 0x97ed
movq 0x18(%r15), %r15
cmpl $0x4, (%r15)
jne 0x9810
leaq 0x11e16(%rip), %rax     # 0x1b610
movq (%rax,%r14,8), %rdx
leaq 0x8(%rbx), %rdi
leaq 0xa7fc(%rip), %rsi      # 0x14005
xorl %eax, %eax
callq 0xd56a
movq 0x8(%r15), %r12
cmpb $0x1, 0x3c(%r12)
jne 0x9839
leaq 0x11ded(%rip), %rax     # 0x1b610
movq (%rax,%r14,8), %rdx
leaq 0x8(%rbx), %rdi
leaq 0xa7fe(%rip), %rsi      # 0x14030
xorl %eax, %eax
callq 0xd56a
cmpl $0xe, (%r12)
jne 0x9860
leaq 0x11dc9(%rip), %rax     # 0x1b610
movq (%rax,%r14,8), %rdx
addq $0x8, %rbx
leaq 0xa801(%rip), %rsi      # 0x14057
movq %rbx, %rdi
xorl %eax, %eax
callq 0xd56a
cmpl $0xd, (%r12)
jne 0x98b4
cmpl $0x26, %r14d
jne 0x98b4
cmpq $0x0, 0x10(%r12)
jne 0x98b4
movl $0x40, %edi
callq 0xe13e
movq %rax, %r14
movl $0x0, 0x10(%rax)
leaq 0x12478(%rip), %rax     # 0x1bd08
movq %rax, 0x8(%r14)
movw $0x0, 0x4(%r14)
movl $0xf, (%r14)
movq %r15, 0x18(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%r14)
movq %r12, 0x30(%r14)
jmp 0x9907
cmpl $0x26, %r14d
jne 0x98c1
movq 0x10(%r12), %rbx
jmp 0x98c6
movslq 0x8(%r12), %rbx
movl $0x40, %edi
callq 0xe13e
movq %rax, %r14
movl $0x0, 0x10(%rax)
leaq 0x12427(%rip), %rax     # 0x1bd08
movq %rax, 0x8(%r14)
movw $0x0, 0x4(%r14)
movl $0x1, (%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%r14)
movq $0x0, 0x28(%r14)
movq %rbx, 0x30(%r14)
movq %r14, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq