// File: /workspace/github_c_makefile_star2_O1/hsjoihs[P]c-compiler/parse_expression.c
// Function: parse_unary_expression
static struct UntypedExpr
parse_unary_expression(const struct Token **ptr_tokvec)
{
	const struct Token *tokvec = *ptr_tokvec;

	if (tokvec[0].kind == OP_NOT || tokvec[0].kind == OP_TILDA ||
	    tokvec[0].kind == OP_PLUS || tokvec[0].kind == OP_MINUS ||
	    tokvec[0].kind == OP_ASTERISK || tokvec[0].kind == OP_AND) {
		enum TokenKind kind = tokvec[0].kind;
		++tokvec;

		const struct UntypedExpr expr = parse_cast_expression(&tokvec);

		const struct UntypedExpr new_expr = unary_op_untyped(&expr, kind);

		*ptr_tokvec = tokvec;
		return new_expr;
	} else if (tokvec[0].kind == RES_SIZEOF && tokvec[1].kind == LEFT_PAREN &&
	           can_start_a_type(tokvec + 2)) {
		tokvec += 2;
		struct Type type = parse_type_name(&tokvec);
		expect_and_consume(&tokvec, RIGHT_PAREN,
		                   "closing parenthesis of sizeof(typename)");

		struct UntypedExpr expr;
		expr.category = SIZEOF_TYPE;
		expr.operand_of_sizeof_or_alignof = type;
		*ptr_tokvec = tokvec;
		return expr;
	} else if (tokvec[0].kind == OP_PLUS_PLUS ||
	           tokvec[0].kind == OP_MINUS_MINUS ||
	           tokvec[0].kind == RES_SIZEOF) {
		enum TokenKind opkind = tokvec[0].kind;
		++tokvec;

		const struct UntypedExpr expr = parse_unary_expression(&tokvec);

		const struct UntypedExpr new_expr = unary_op_untyped(&expr, opkind);
		*ptr_tokvec = tokvec;
		return new_expr;
	} else if (tokvec[0].kind == RES_ALIGNOF && tokvec[1].kind == LEFT_PAREN) {
		tokvec += 2;
		if (!can_start_a_type(tokvec)) {
			fprintf(stderr, "_Alignof can only take type name\n");
			exit(EXIT_FAILURE);
		}
		struct Type type = parse_type_name(&tokvec);
		expect_and_consume(&tokvec, RIGHT_PAREN,
		                   "closing parenthesis of _Alignof(typename)");

		struct UntypedExpr expr;
		expr.category = ALIGNOF_TYPE;
		expr.operand_of_sizeof_or_alignof = type;
		*ptr_tokvec = tokvec;
		return expr;
	} else {

		struct UntypedExpr expr = parse_postfix_expression(&tokvec);
		*ptr_tokvec = tokvec;
		return expr;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rsi, %r12
movq %rdi, %rbx
movq (%rsi), %rdi
movq %rdi, -0x38(%rbp)
movl (%rdi), %r14d
cmpq $0x3b, %r14
ja 0x833b
movl $0x620023, %eax         # imm = 0x620023
btq %r14, %rax
jae 0x82d3
addq $0x20, %rdi
leaq -0x38(%rbp), %r15
movq %rdi, (%r15)
leaq -0xf8(%rbp), %rdi
movq %r15, %rsi
callq 0x8229
movl $0x1, %edi
movl $0xa0, %esi
callq 0x10d0
movq %rax, %r13
movl $0xa0, %edx
movq %rax, %rdi
leaq -0xf8(%rbp), %rsi
callq 0x1100
movl $0x1, 0x4(%rbx)
movl %r14d, (%rbx)
movq %r13, 0x8(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movq (%r15), %rax
movq %rax, (%r12)
movq %rbx, %rax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x3b, %r14
jne 0x833b
cmpl $0x6, 0x20(%rdi)
jne 0x833b
addq $0x40, %rdi
callq 0x9d5f
testl %eax, %eax
je 0x833b
leaq -0x38(%rbp), %r15
addq $0x40, (%r15)
movq %r12, %r14
leaq -0xf8(%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x9e67
leaq 0x7d70(%rip), %rdx      # 0x10080
movq %r15, %rdi
movl $0x7, %esi
callq 0x94af
movl $0x9, 0x4(%rbx)
leaq 0x48(%rbx), %rdi
movl $0xa, %ecx
movq %r12, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq (%r15), %rax
jmp 0x83c3
movq -0x38(%rbp), %rdi
movl (%rdi), %r14d
leal -0x32(%r14), %eax
cmpl $0x2, %eax
jb 0x8262
cmpl $0x42, %r14d
je 0x8361
cmpl $0x3b, %r14d
je 0x8262
jmp 0x83cb
cmpl $0x6, 0x20(%rdi)
jne 0x83cb
movq %r12, %r14
addq $0x40, %rdi
movq %rdi, -0x38(%rbp)
callq 0x9d5f
testl %eax, %eax
je 0x87bb
leaq -0xf8(%rbp), %r15
leaq -0x38(%rbp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x9e67
leaq 0x7d2e(%rip), %rdx      # 0x100ca
movq %r12, %rdi
movl $0x7, %esi
callq 0x94af
movl $0xa, 0x4(%rbx)
leaq 0x48(%rbx), %rdi
movl $0xa, %ecx
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq (%r12), %rax
movq %rax, (%r14)
jmp 0x82be
movq %rdi, -0x30(%rbp)
cmpl $0x18, (%rdi)
movq %r12, -0x48(%rbp)
jne 0x8432
cmpl $0x6, 0x20(%rdi)
jne 0x8432
movq 0x8(%rdi), %r15
addq $0x40, %rdi
leaq -0x30(%rbp), %rax
movq %rdi, (%rax)
movq %rax, %rdi
callq 0x8acc
movq %rax, %r12
movq %rdx, %r13
leaq 0x7cf2(%rip), %rdi      # 0x100f4
movl $0x9, %edx
movq %r15, %rsi
callq 0x1030
testl %eax, %eax
movl $0xc, %eax
movl $0x6, %ecx
cmovel %eax, %ecx
movl %ecx, 0x4(%rbx)
movq %r12, 0x38(%rbx)
movq %r13, 0x40(%rbx)
movq %r15, 0x28(%rbx)
jmp 0x8501
movq %rdi, -0x58(%rbp)
movl (%rdi), %eax
cmpl $0x17, %eax
jg 0x8486
cmpl $0x4, %eax
je 0x84b3
cmpl $0x6, %eax
jne 0x87c0
addq $0x20, %rdi
leaq -0x58(%rbp), %r15
movq %rdi, (%r15)
movq %rdi, -0x30(%rbp)
leaq -0xf8(%rbp), %rdi
movq %r15, %rsi
callq 0x89f1
leaq 0x7d06(%rip), %rdx      # 0x10176
movq %r15, %rdi
movl $0x7, %esi
callq 0x94af
movq (%r15), %rax
movq %rax, -0x30(%rbp)
jmp 0x84ed
cmpl $0x18, %eax
je 0x84d0
cmpl $0x39, %eax
jne 0x87c0
movl $0x8, -0xf4(%rbp)
movq 0x10(%rdi), %rax
movq %rax, -0xc8(%rbp)
addq $0x20, %rdi
movq %rdi, -0x30(%rbp)
jmp 0x84ed
leaq 0x20(%rdi), %rax
movq %rax, -0x30(%rbp)
movl 0x4(%rdi), %eax
movl %eax, -0xd8(%rbp)
movl $0x4, -0xf4(%rbp)
jmp 0x84ed
leaq 0x20(%rdi), %rax
movq %rax, -0x30(%rbp)
movl $0x3, -0xf4(%rbp)
movq 0x8(%rdi), %rax
movq %rax, -0xd0(%rbp)
leaq -0xf8(%rbp), %rsi
movl $0xa0, %edx
movq %rbx, %rdi
callq 0x1100
leaq 0x10(%rbx), %rax
movq %rax, -0x40(%rbp)
leaq 0x7b40(%rip), %r15      # 0x10050
movq -0x30(%rbp), %rax
movl (%rax), %r12d
leal -0x32(%r12), %ecx
cmpl $0xb, %ecx
ja 0x856e
movslq (%r15,%rcx,4), %rcx
addq %r15, %rcx
jmpq *%rcx
addq $0x20, %rax
movq %rax, -0x30(%rbp)
movl $0x1, %edi
movl $0xa0, %esi
callq 0x10d0
movq %rax, %r14
movl $0xa0, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1100
movl %r12d, (%rbx)
movl $0x5, 0x4(%rbx)
movq %r14, 0x8(%rbx)
movq -0x40(%rbp), %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
jmp 0x8510
cmpl $0x6, %r12d
jne 0x87ab
addq $0x20, %rax
movq %rax, -0x30(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x8acc
movq %rax, %r13
movq %rdx, %r14
movl $0x1, %edi
movl $0xa0, %esi
callq 0x10d0
movq %rax, %r12
movl $0xa0, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1100
movl $0x7, 0x4(%rbx)
movq %r12, 0x8(%rbx)
movq %r13, 0x38(%rbx)
movq %r14, 0x40(%rbx)
jmp 0x8510
addq $0x20, %rax
movq %rax, -0x30(%rbp)
leaq -0x30(%rbp), %rdi
movl $0x18, %esi
leaq 0x7b2d(%rip), %rdx      # 0x1010e
callq 0x94af
movq -0x30(%rbp), %rax
movq -0x18(%rax), %r12
movl $0x1, %edi
movl $0xa0, %esi
callq 0x10d0
movq %rax, %r14
movl $0xa0, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1100
movl $0x1, %edi
movl $0xa0, %esi
callq 0x10d0
movl $0xb, 0x4(%rax)
movq %r14, 0x8(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movq %r12, 0x98(%rax)
movq -0x40(%rbp), %rcx
jmp 0x8792
addq $0x20, %rax
movq %rax, -0x30(%rbp)
leaq -0x30(%rbp), %rdi
movl $0x18, %esi
leaq 0x7ad5(%rip), %rdx      # 0x1012e
callq 0x94af
movq -0x30(%rbp), %rax
movq -0x18(%rax), %rax
movq %rax, -0x50(%rbp)
movl $0x1, %edi
movl $0xa0, %esi
callq 0x10d0
movq %rax, %r14
movl $0xa0, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1100
movl $0x1, %edi
movl $0xa0, %esi
callq 0x10d0
movq %rax, %r12
movabsq $0x100000005, %r13      # imm = 0x100000005
movq %r13, (%rax)
movq %r14, 0x8(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movl $0x1, %edi
movl $0xa0, %esi
callq 0x10d0
movl $0xb, 0x4(%rax)
movq %r12, 0x8(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rax)
movq -0x50(%rbp), %rcx
movq %rcx, 0x98(%rax)
movq -0x40(%rbp), %rcx
movups %xmm0, (%rcx)
movq %r13, (%rbx)
movq %rax, 0x8(%rbx)
jmp 0x8510
addq $0x20, %rax
movq %rax, -0x30(%rbp)
leaq -0xf8(%rbp), %r12
movq %r12, %rdi
leaq -0x30(%rbp), %r14
movq %r14, %rsi
callq 0x89f1
movq %r14, %rdi
movl $0x37, %esi
leaq 0x79dc(%rip), %rdx      # 0x100fe
callq 0x94af
movl $0x1, %edi
movl $0xa0, %esi
callq 0x10d0
movq %rax, %r13
movl $0x1, %edi
movl $0xa0, %esi
callq 0x10d0
movq %rax, %r14
movl $0xa0, %edx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x1100
movl $0xa0, %edx
movq %r14, %rdi
movq %r12, %rsi
callq 0x1100
movl $0x1, %edi
movl $0xa0, %esi
callq 0x10d0
xorl %ecx, %ecx
movq %rcx, (%rax)
movq %r13, 0x8(%rax)
movq %r14, 0x10(%rax)
movq %rcx, 0x18(%rax)
movq -0x40(%rbp), %rcx
xorps %xmm0, %xmm0
movups %xmm0, (%rcx)
movabsq $0x100000005, %rcx      # imm = 0x100000005
movq %rcx, (%rbx)
movq %rax, 0x8(%rbx)
jmp 0x8510
movq %rax, -0x38(%rbp)
movq -0x48(%rbp), %rcx
movq %rax, (%rcx)
jmp 0x82be
callq 0x1ce8
leaq 0x79bb(%rip), %rsi      # 0x10182
callq 0x93c4