// File: /workspace/github_c_makefile_star2_O1/lucvoo[P]sparse-dev/expression.c
// Function: unary_expression
static struct token *unary_expression(struct token *token, struct expression **tree)
{
	if (token_type(token) == TOKEN_IDENT) {
		struct ident *ident = token->ident;
		if (ident->reserved) {
			static const struct {
				struct ident *id;
				int type;
			} type_information[] = {
				{ &sizeof_ident, EXPR_SIZEOF },
				{ &__alignof___ident, EXPR_ALIGNOF },
				{ &__alignof_ident, EXPR_ALIGNOF },
				{ &_Alignof_ident, EXPR_ALIGNOF },
				{ &__sizeof_ptr___ident, EXPR_PTRSIZEOF },
			};
			int i;
			for (i = 0; i < ARRAY_SIZE(type_information); i++) {
				if (ident == type_information[i].id)
					return type_info_expression(token, tree, type_information[i].type);
			}
		}
	}

	if (token_type(token) == TOKEN_SPECIAL) {
		if (match_oplist(token->special,
		    SPECIAL_INCREMENT, SPECIAL_DECREMENT,
		    '&', '*', 0)) {
		    	struct expression *unop;
			struct expression *unary;
			struct token *next;

			next = cast_expression(token->next, &unop);
			if (!unop) {
				sparse_error(token->pos, "Syntax error in unary expression");
				*tree = NULL;
				return next;
			}
			unary = alloc_expression(token->pos, EXPR_PREOP);
			unary->op = token->special;
			unary->unop = unop;
			*tree = unary;
			return next;
		}
		/* possibly constant ones */
		if (match_oplist(token->special, '+', '-', '~', '!', 0)) {
		    	struct expression *unop;
			struct expression *unary;
			struct token *next;

			next = cast_expression(token->next, &unop);
			if (!unop) {
				sparse_error(token->pos, "Syntax error in unary expression");
				*tree = NULL;
				return next;
			}
			unary = alloc_expression(token->pos, EXPR_PREOP);
			unary->op = token->special;
			unary->unop = unop;
			*tree = unary;
			return next;
		}
		/* Gcc extension: &&label gives the address of a label */
		if (match_op(token, SPECIAL_LOGICAL_AND) &&
		    token_type(token->next) == TOKEN_IDENT) {
			struct expression *label = alloc_expression(token->pos, EXPR_LABEL);
			struct symbol *sym = label_symbol(token->next, 1);
			if (!(sym->ctype.modifiers & MOD_ADDRESSABLE)) {
				sym->ctype.modifiers |= MOD_ADDRESSABLE;
				add_symbol(&function_computed_target_list, sym);
			}
			check_label_usage(sym, token->pos);
			label->flags = CEF_ADDR;
			label->label_symbol = sym;
			*tree = label;
			return token->next->next;
		}
						
	}
			
	return postfix_expression(token, tree, NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %r13
movl %r13d, %eax
andl $0x3f, %eax
cmpl $0x3, %eax
jne 0x3b9f7
movq 0x10(%r14), %rax
testb $0x2, 0x11(%rax)
jne 0x3b925
movb $0x1, %bpl
jmp 0x3b9ee
cmpq 0x25644(%rip), %rax     # 0x60f70
je 0x3b95e
leaq 0x252db(%rip), %rsi     # 0x60c10
xorl %edx, %edx
cmpq $0x4, %rdx
je 0x3b9ea
leaq 0x10(%rsi), %rcx
incq %rdx
cmpq 0x10(%rsi), %rax
movq %rcx, %rsi
jne 0x3b937
decq %rdx
cmpq $0x4, %rdx
setae %bpl
jmp 0x3b967
leaq 0x252ab(%rip), %rcx     # 0x60c10
xorl %ebp, %ebp
movslq 0x8(%rcx), %r15
xorl %edi, %edi
callq 0x30029
movq %rax, %r12
movzwl 0x2(%rax), %eax
shll $0x10, %eax
movzbl %r15b, %ecx
orl %eax, %ecx
movq %r13, 0x8(%r12)
movl %ecx, (%r12)
movq %r12, (%rbx)
movb $0x30, 0x1(%r12)
movq 0x8(%r14), %r13
movl (%r13), %eax
andl $0x3f, %eax
cmpl $0x12, %eax
jne 0x3b9d6
cmpl $0x28, 0x10(%r13)
jne 0x3b9d6
movq 0x8(%r13), %rax
movl (%rax), %ecx
andl $0x3f, %ecx
cmpl $0x3, %ecx
jne 0x3b9d6
movq 0x10(%rax), %rdi
movl $0x12, %esi
callq 0x2b511
testq %rax, %rax
je 0x3b9d6
testb $0x2, 0x1(%rax)
jne 0x3bb87
addq $0x28, %r12
movq %r13, %rdi
movq %r12, %rsi
callq 0x3b8ed
movq %rax, %r15
jmp 0x3b9ee
setae %bpl
testb %bpl, %bpl
je 0x3bab8
movl (%r14), %eax
andl $0x3f, %eax
cmpl $0x12, %eax
jne 0x3bb6c
movl 0x10(%r14), %edi
movl $0x101, %esi            # imm = 0x101
movl $0x103, %edx            # imm = 0x103
movl $0x26, %ecx
movl $0x2a, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x3bc58
testl %eax, %eax
jne 0x3ba54
movl 0x10(%r14), %edi
movl $0x2b, %esi
movl $0x2d, %edx
movl $0x7e, %ecx
movl $0x21, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x3bc58
testl %eax, %eax
je 0x3baca
movq 0x8(%r14), %rdi
leaq 0x10(%rsp), %r12
movq %r12, %rsi
callq 0x3b4bc
movq %rax, %r15
movq (%r12), %rbp
movq (%r14), %r13
testq %rbp, %rbp
je 0x3baa1
xorl %edi, %edi
callq 0x30029
movq %rax, %r12
movl (%rax), %eax
orl $0x9, %eax
movq %r13, 0x8(%r12)
andl $0xffff0009, %eax       # imm = 0xFFFF0009
movl %eax, (%r12)
movl 0x10(%r14), %eax
movl %eax, 0x4(%r12)
movq %rbp, 0x20(%r12)
jmp 0x3bab5
leaq 0x10528(%rip), %rsi     # 0x4bfd0
xorl %r12d, %r12d
movq %r13, %rdi
xorl %eax, %eax
callq 0x11a38
movq %r12, (%rbx)
movq %r15, %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r14), %r12
movl %r12d, %eax
andl $0x3f, %eax
cmpl $0x12, %eax
jne 0x3bb6c
cmpl $0x10c, 0x10(%r14)      # imm = 0x10C
jne 0x3bb6c
movq 0x8(%r14), %rax
movl (%rax), %eax
andl $0x3f, %eax
cmpl $0x3, %eax
jne 0x3bb6c
xorl %edi, %edi
callq 0x30029
movq %rax, %r15
movl (%rax), %eax
orl $0x17, %eax
movq %r12, 0x8(%r15)
andl $0xffff0017, %eax       # imm = 0xFFFF0017
movl %eax, (%r15)
movq 0x8(%r14), %rdi
movl $0x1, %esi
callq 0x196a5
movq %rax, %r12
movq 0x68(%rax), %rax
btl $0x8, %eax
jb 0x3bb48
orq $0x100, %rax            # imm = 0x100
movq %rax, 0x68(%r12)
leaq 0x2c3e0(%rip), %rdi     # 0x67f20
movq %r12, %rsi
callq 0x2285b
movq (%r14), %rsi
movq %r12, %rdi
callq 0x1a212
movb $0x40, 0x1(%r15)
movq %r12, 0x20(%r15)
movq %r15, (%rbx)
movq 0x8(%r14), %rax
movq 0x8(%rax), %r15
jmp 0x3bab8
movq %r14, %rdi
movq %rbx, %rsi
xorl %edx, %edx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3b640
movq 0x8(%r13), %rdi
leaq 0x20(%r12), %rsi
xorl %edx, %edx
callq 0x19726
movl (%rax), %ecx
andl $0x3f, %ecx
cmpl $0x12, %ecx
jne 0x3bc3b
cmpl $0x29, 0x10(%rax)
jne 0x3bc3b
movq 0x8(%rax), %r15
movl (%r15), %eax
andl $0x3f, %eax
cmpl $0x12, %eax
jne 0x3b9ee
cmpl $0x7b, 0x10(%r15)
jne 0x3b9ee
movq (%r13), %rax
movq %rax, 0x8(%rsp)
xorl %edi, %edi
callq 0x30029
movq %rax, %r13
movl (%rax), %eax
orl $0xb, %eax
movq 0x8(%rsp), %rcx
movq %rcx, 0x8(%r13)
andl $0xffff000b, %eax       # imm = 0xFFFF000B
movl %eax, (%r13)
movq 0x20(%r12), %rax
movq %rax, 0x20(%r13)
movq $0x0, 0x20(%r12)
movq %r12, %rax
addq $0x28, %rax
movq %rax, 0x8(%rsp)
movq %r13, 0x28(%r12)
leaq 0x28(%r13), %rdi
movq %r15, %rsi
callq 0x1a4b6
movq %rax, %rdi
movq 0x8(%rsp), %rsi
movq %r13, %rdx
callq 0x3b640
jmp 0x3b9e5
leaq 0x2501e(%rip), %rcx     # 0x60c60
movq (%rcx,%r15,8), %rdx
movq %rax, %rdi
movl $0x29, %esi
callq 0x195d7
jmp 0x3b9e5