// File: /workspace/github_c_makefile_star2_O2/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 $0x168, %rsp            # imm = 0x168
movq %rsi, %r13
movq %rdi, %rbx
movq (%rsi), %r14
movq %r14, -0x38(%rbp)
movl (%r14), %r15d
cmpq $0x3b, %r15
ja 0x734c
movl $0x620023, %eax         # imm = 0x620023
btq %r15, %rax
jae 0x72df
addq $0x20, %r14
leaq -0x38(%rbp), %r12
movq %r14, (%r12)
leaq -0xe8(%rbp), %r14
movq %r14, %rdi
movq %r12, %rsi
callq 0x725d
movq %rbx, %rdi
movq %r14, %rsi
movl %r15d, %edx
callq 0x7952
movq (%r12), %rax
movq %rax, (%r13)
movq %rbx, %rax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x3b, %r15
jne 0x734c
cmpl $0x6, 0x20(%r14)
jne 0x7340
leaq 0x40(%r14), %r15
movq %r15, %rdi
callq 0x8cfa
testl %eax, %eax
je 0x7349
leaq -0x38(%rbp), %r14
movq %r15, (%r14)
leaq -0xe8(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x8e02
leaq 0x7d54(%rip), %rdx      # 0xf070
pushq $0x7
popq %rsi
movq %r14, %rdi
callq 0x8168
movl $0x9, 0x4(%rbx)
leaq 0x48(%rbx), %rdi
pushq $0xa
popq %rcx
movq %r15, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq (%r14), %rax
jmp 0x72c6
pushq $0x3b
popq %r15
jmp 0x7296
movl (%r14), %r15d
leal -0x32(%r15), %eax
cmpl $0x2, %eax
jb 0x7296
cmpl $0x42, %r15d
je 0x73cd
cmpl $0x3b, %r15d
je 0x7296
cmpl $0x18, %r15d
movq %r13, -0x40(%rbp)
jne 0x7434
cmpl $0x6, 0x20(%r14)
jne 0x746c
movq 0x8(%r14), %r15
addq $0x40, %r14
leaq -0x30(%rbp), %rdi
movq %r14, (%rdi)
callq 0x79a8
movq %rax, %r14
movq %rdx, %r12
leaq 0x7d41(%rip), %rdi      # 0xf0e4
pushq $0x9
popq %rdx
movq %r15, %rsi
callq 0x1030
testl %eax, %eax
pushq $0xc
popq %rax
pushq $0x6
popq %rcx
cmovel %eax, %ecx
movl %ecx, 0x4(%rbx)
movq %r14, 0x38(%rbx)
movq %r12, 0x40(%rbx)
movq %r15, 0x28(%rbx)
jmp 0x74f4
cmpl $0x6, 0x20(%r14)
jne 0x76cc
addq $0x40, %r14
movq %r14, -0x38(%rbp)
movq %r14, %rdi
callq 0x8cfa
testl %eax, %eax
je 0x76db
leaq -0xe8(%rbp), %r14
leaq -0x38(%rbp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x8e02
leaq 0x7cad(%rip), %rdx      # 0xf0ba
pushq $0x7
popq %rsi
movq %r15, %rdi
callq 0x8168
movl $0xa, 0x4(%rbx)
leaq 0x48(%rbx), %rdi
pushq $0xa
popq %rcx
movq %r14, %rsi
rep  movsq (%rsi), %es:(%rdi)
movq (%r15), %rax
jmp 0x72c6
cmpl $0x39, %r15d
je 0x74c3
cmpl $0x6, %r15d
je 0x748b
cmpl $0x4, %r15d
jne 0x76cc
leaq 0x20(%r14), %rax
movq %rax, -0x30(%rbp)
movl 0x4(%r14), %eax
movl %eax, -0xc8(%rbp)
movl $0x4, -0xe4(%rbp)
jmp 0x74e0
leaq 0x20(%r14), %rax
movq %rax, -0x30(%rbp)
movl $0x3, -0xe4(%rbp)
movq 0x8(%r14), %rax
movq %rax, -0xc0(%rbp)
jmp 0x74e0
addq $0x20, %r14
leaq -0x188(%rbp), %r15
movq %r14, (%r15)
leaq -0xe8(%rbp), %rdi
movq %r15, %rsi
callq 0x78ba
leaq 0x7cb7(%rip), %rdx      # 0xf166
pushq $0x7
popq %rsi
movq %r15, %rdi
callq 0x8168
movq (%r15), %rax
movq %rax, -0x30(%rbp)
jmp 0x74e0
movl $0x8, -0xe4(%rbp)
movq 0x10(%r14), %rax
movq %rax, -0xb8(%rbp)
addq $0x20, %r14
movq %r14, -0x30(%rbp)
leaq -0xe8(%rbp), %rsi
movl $0xa0, %edx
movq %rbx, %rdi
callq 0x1100
leaq 0x10(%rbx), %rax
movq %rax, -0x48(%rbp)
pushq $0x18
popq %r13
movq -0x30(%rbp), %rax
movl (%rax), %r15d
leal -0x32(%r15), %ecx
cmpl $0xb, %ecx
ja 0x7562
leaq 0x7b29(%rip), %rdx      # 0xf040
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
addq $0x20, %rax
movq %rax, -0x30(%rbp)
movl $0xa0, %esi
pushq $0x1
popq %rdi
callq 0x10d0
movq %rax, %r14
movl $0xa0, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1100
movl %r15d, (%rbx)
movl $0x5, 0x4(%rbx)
movq %r14, 0x8(%rbx)
xorps %xmm0, %xmm0
movq -0x48(%rbp), %rax
movups %xmm0, (%rax)
jmp 0x7500
cmpl $0x6, %r15d
jne 0x76c0
addq $0x20, %rax
movq %rax, -0x30(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x79a8
movq %rax, %r12
movq %rdx, %r14
movl $0xa0, %esi
pushq $0x1
popq %rdi
callq 0x10d0
movq %rax, %r15
movl $0xa0, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x1100
movl $0x7, 0x4(%rbx)
movq %r15, 0x8(%rbx)
movq %r12, 0x38(%rbx)
movq %r14, 0x40(%rbx)
jmp 0x7500
addq $0x20, %rax
movq %rax, -0x30(%rbp)
leaq -0x30(%rbp), %rdi
movl %r13d, %esi
leaq 0x7b2d(%rip), %rdx      # 0xf0fe
callq 0x8168
movq -0x30(%rbp), %rax
movq -0x18(%rax), %rdx
leaq -0xe8(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x7ab8
movq %rbx, %rdi
movq %r14, %rsi
jmp 0x76b3
addq $0x20, %rax
movq %rax, -0x30(%rbp)
leaq -0x30(%rbp), %rdi
movl %r13d, %esi
leaq 0x7b0d(%rip), %rdx      # 0xf11e
callq 0x8168
movq -0x30(%rbp), %rax
movq -0x18(%rax), %r14
leaq -0xe8(%rbp), %rdi
movq %rbx, %rsi
movl %r13d, %r15d
pushq $0x5
popq %r13
movl %r13d, %edx
callq 0x7952
leaq -0x188(%rbp), %r12
movq %r12, %rdi
leaq -0xe8(%rbp), %rsi
movq %r14, %rdx
callq 0x7ab8
movq %rbx, %rdi
movq %r12, %rsi
movl %r13d, %edx
movl %r15d, %r13d
callq 0x7952
jmp 0x7500
addq $0x20, %rax
movq %rax, -0x30(%rbp)
leaq -0xe8(%rbp), %r14
movq %r14, %rdi
leaq -0x30(%rbp), %r15
movq %r15, %rsi
callq 0x78ba
movq %r15, %rdi
pushq $0x37
popq %rsi
leaq 0x7a5d(%rip), %rdx      # 0xf0ee
callq 0x8168
leaq -0x188(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x7114
movq %rbx, %rdi
movq %r15, %rsi
pushq $0x5
popq %rdx
callq 0x7952
jmp 0x7500
movq -0x40(%rbp), %rcx
movq %rax, (%rcx)
jmp 0x72ca
leaq 0x7a9f(%rip), %rsi      # 0xf172
movq %r14, %rdi
callq 0x8084
movq 0xe916(%rip), %rax      # 0x15ff8
movq (%rax), %rcx
leaq 0x79ac(%rip), %rdi      # 0xf098
pushq $0x21
popq %rsi
pushq $0x1
popq %rdx
callq 0x1180
pushq $0x1
popq %rdi
callq 0x1170