// File: /workspace/github_c_makefile_star2_O3/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 0x12dd8(%rip), %rbx     # 0x1c108
movl (%rbx), %r14d
leal -0x48(%r14), %eax
cmpl $0x7, %eax
ja 0x936f
leaq 0xa021(%rip), %rcx      # 0x13364
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0xa920
movq %r12, %rdi
callq 0x931d
movl %r14d, %edi
movq %rax, %rsi
xorl %edx, %edx
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x9791
cmpl $0x9, %r14d
je 0x937f
cmpl $0x26, %r14d
jne 0x9470
callq 0xa920
movl $0x42, %edi
callq 0xb00a
testb %al, %al
je 0x9459
movq %r12, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3846
testq %rax, %rax
je 0x962f
movq %rax, %r13
leaq 0xa428(%rip), %rsi      # 0x137dd
movl $0x43, %edi
callq 0xafeb
xorl %r15d, %r15d
cmpl $0x26, %r14d
jne 0x9691
cmpl $0x44, (%rbx)
jne 0x9691
movq %r12, %rdi
movq %r13, %rsi
callq 0x997d
xorl %r15d, %r15d
jmp 0x9691
callq 0xa920
movq %r12, %rdi
callq 0x7e09
movl %r14d, %edi
movq %rax, %rsi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x761b
callq 0xa920
movq %r12, %rdi
callq 0x7e09
movq %rax, %r14
movq 0x8(%rax), %rax
movl 0x4(%rax), %eax
testb $0x8, %al
jne 0x9440
addq $0x8, %rbx
leaq 0xab54(%rip), %rsi      # 0x13f83
movq %rbx, %rdi
xorl %eax, %eax
callq 0xd55c
movq 0x8(%r14), %rax
movl 0x4(%rax), %eax
testb $0x2, %al
je 0x9784
movq %r14, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x69b6
cmpl $0x26, %r14d
jne 0x9612
movq %r12, %rdi
callq 0x931d
jmp 0x965c
movq %r12, %rdi
xorl %esi, %esi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x802a
callq 0xa920
movq %r12, %rdi
callq 0x7e09
movq %rax, %r14
movq 0x8(%rax), %rax
testb $0x10, 0x4(%rax)
jne 0x94af
leaq 0x8(%rbx), %rdi
leaq 0xab7a(%rip), %rsi      # 0x14022
xorl %eax, %eax
callq 0xd55c
movl $0x40, %edi
callq 0xe142
movl $0x0, 0x10(%rax)
leaq 0x12739(%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 0x95fe
callq 0xa920
movq %r12, %rdi
callq 0x7e09
movq %rax, %r15
movq 0x8(%rax), %r12
movl 0x4(%r12), %eax
testb $0x8, %al
jne 0x952e
addq $0x8, %rbx
leaq 0xaaa0(%rip), %rsi      # 0x13fbb
movq %rbx, %rdi
xorl %eax, %eax
callq 0xd55c
movq 0x8(%r15), %r12
movl 0x4(%r12), %eax
testb $0x2, %al
je 0x9541
movq %r15, %rdi
callq 0x69b6
movq %rax, %r15
movq 0x8(%rax), %r12
movl $0x40, %edi
callq 0xe142
movq %rax, %r14
movabsq $0x4d00000000, %rax     # imm = 0x4D00000000
movq %rax, 0x10(%r14)
movq %r12, 0x8(%r14)
movw $0x0, 0x4(%r14)
movl $0x7, (%r14)
movq %r15, 0x18(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%r14)
jmp 0x9784
callq 0xa920
movq %r12, %rdi
callq 0x7e09
movq %rax, %r14
movq 0x8(%rax), %rax
testb $0x2, 0x4(%rax)
jne 0x95ab
leaq 0x8(%rbx), %rdi
leaq 0xaa4f(%rip), %rsi      # 0x13ff3
xorl %eax, %eax
callq 0xd55c
movq %r14, %rdi
callq 0x69b6
movq %rax, %r14
movq 0x8(%rax), %r15
movl $0x40, %edi
callq 0xe142
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 0x7787
addq $0x8, %rbx
leaq 0xaa2b(%rip), %rsi      # 0x14048
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %eax, %eax
callq 0xd55c
jmp 0x9784
movq %r12, %rdi
callq 0x7252
movq %rax, %r15
leaq 0xa489(%rip), %rsi      # 0x13aca
movl $0x43, %edi
callq 0xafeb
cmpl $0x26, %r14d
jne 0x965f
movq %r12, %rdi
movq %r15, %rsi
callq 0x802a
movq %rax, %r15
cmpb $0x1, 0x5(%r15)
jne 0x966a
movq 0x18(%r15), %r15
cmpl $0x4, (%r15)
jne 0x968d
leaq 0x11f99(%rip), %rax     # 0x1b610
movq (%rax,%r14,8), %rdx
leaq 0x8(%rbx), %rdi
leaq 0xa9df(%rip), %rsi      # 0x14065
xorl %eax, %eax
callq 0xd55c
movq 0x8(%r15), %r13
cmpb $0x1, 0x3c(%r13)
jne 0x96b5
leaq 0x11f71(%rip), %rax     # 0x1b610
movq (%rax,%r14,8), %rdx
leaq 0x8(%rbx), %rdi
leaq 0xa9e2(%rip), %rsi      # 0x14090
xorl %eax, %eax
callq 0xd55c
movl (%r13), %eax
cmpl $0xe, %eax
jne 0x96e2
leaq 0x11f4b(%rip), %rax     # 0x1b610
movq (%rax,%r14,8), %rdx
addq $0x8, %rbx
leaq 0xa9e3(%rip), %rsi      # 0x140b7
movq %rbx, %rdi
xorl %eax, %eax
callq 0xd55c
movl (%r13), %eax
cmpl $0xd, %eax
jne 0x9733
cmpl $0x26, %r14d
jne 0x9733
cmpq $0x0, 0x10(%r13)
jne 0x9733
movl $0x40, %edi
callq 0xe142
movq %rax, %r14
movl $0x0, 0x10(%rax)
leaq 0x125f9(%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 %r13, 0x30(%r14)
jmp 0x9784
cmpl $0x26, %r14d
jne 0x973f
movq 0x10(%r13), %rbx
jmp 0x9743
movslq 0x8(%r13), %rbx
movl $0x40, %edi
callq 0xe142
movq %rax, %r14
movl $0x0, 0x10(%rax)
leaq 0x125aa(%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