// File: /workspace/github_c_makefile_star2_O1/hsjoihs[P]c-compiler/parse_expression.c
// Function: parse_conditional_expression
static struct UntypedExpr
parse_conditional_expression(const struct Token **ptr_tokvec)
{
	const struct Token *tokvec = *ptr_tokvec;
	struct UntypedExpr expr = parse_logical_OR_expression(&tokvec);
	if (tokvec[0].kind == QUESTION) {

		++tokvec;
		*ptr_tokvec = tokvec;
		struct UntypedExpr true_branch = parse_expression(&tokvec);

		expect_and_consume(&tokvec, COLON, "colon of the conditional operator");

		*ptr_tokvec = tokvec;
		struct UntypedExpr false_branch = parse_conditional_expression(&tokvec);

		*ptr_tokvec = tokvec;

		struct UntypedExpr *ptr_expr1 = calloc(1, sizeof(struct UntypedExpr));
		struct UntypedExpr *ptr_expr2 = calloc(1, sizeof(struct UntypedExpr));
		struct UntypedExpr *ptr_expr3 = calloc(1, sizeof(struct UntypedExpr));
		*ptr_expr1 = expr;
		*ptr_expr2 = true_branch;
		*ptr_expr3 = false_branch;

		struct UntypedExpr new_expr;
		new_expr.category = CONDITIONAL;
		new_expr.ptr1 = ptr_expr1;
		new_expr.ptr2 = ptr_expr2;
		new_expr.ptr3 = ptr_expr3;

		return new_expr;
	}
	*ptr_tokvec = tokvec;
	return expr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1f8, %rsp            # imm = 0x1F8
movq %rdi, -0x38(%rbp)
movq %rsi, -0x30(%rbp)
movq (%rsi), %rax
movq %rax, -0x40(%rbp)
leaq -0x180(%rbp), %r15
movq %rax, (%r15)
leaq -0xe0(%rbp), %rdi
movq %r15, %rsi
callq 0x8be3
movq (%r15), %rax
cmpl $0x21, (%rax)
jne 0x88b7
leaq -0x220(%rbp), %r15
leaq -0x180(%rbp), %r12
leaq -0xe0(%rbp), %r13
addq $0x20, %rax
movq %rax, -0x180(%rbp)
movq %r15, %rdi
movq %r12, %rsi
callq 0x8be3
movl $0x1, %edi
movl $0xa0, %esi
callq 0x10d0
movq %rax, %rbx
movl $0x1, %edi
movl $0xa0, %esi
callq 0x10d0
movq %rax, %r14
movl $0xa0, %edx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x1100
movl $0xa0, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x1100
movq $0x21, -0xe0(%rbp)
movq %rbx, -0xd8(%rbp)
movq %r14, -0xd0(%rbp)
movq $0x0, -0xc8(%rbp)
movq -0x180(%rbp), %rax
cmpl $0x21, (%rax)
je 0x8829
movq -0x180(%rbp), %rax
movq %rax, -0x40(%rbp)
cmpl $0x1c, (%rax)
jne 0x89a5
addq $0x20, %rax
leaq -0x40(%rbp), %rbx
movq %rax, (%rbx)
movq -0x30(%rbp), %r14
movq %rax, (%r14)
leaq -0x220(%rbp), %rdi
movq %rbx, %rsi
callq 0x89f1
leaq 0x78c3(%rip), %rdx      # 0x101b6
movq %rbx, %rdi
movl $0x1d, %esi
callq 0x94af
movq (%rbx), %rax
movq %rax, (%r14)
leaq -0x180(%rbp), %r12
movq %r12, %rdi
movq %rbx, %rsi
callq 0x87cc
movq (%rbx), %rax
movq %rax, (%r14)
movl $0x1, %edi
movl $0xa0, %esi
callq 0x10d0
movq %rax, %r14
movl $0x1, %edi
movl $0xa0, %esi
callq 0x10d0
movq %rax, %r13
movl $0x1, %edi
movl $0xa0, %esi
callq 0x10d0
movq %rax, %r15
leaq -0xe0(%rbp), %rsi
movl $0xa0, %edx
movq %r14, %rdi
callq 0x1100
movl $0xa0, %edx
movq %r13, %rdi
leaq -0x220(%rbp), %rsi
callq 0x1100
movl $0xa0, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x1100
movq -0x38(%rbp), %rbx
movl $0x2, 0x4(%rbx)
movq %r14, 0x8(%rbx)
movq %r13, 0x10(%rbx)
movq %r15, 0x18(%rbx)
jmp 0x89c4
movq -0x30(%rbp), %rcx
movq %rax, (%rcx)
leaq -0xe0(%rbp), %rsi
movl $0xa0, %edx
movq -0x38(%rbp), %rbx
movq %rbx, %rdi
callq 0x1100
movq %rbx, %rax
addq $0x1f8, %rsp            # imm = 0x1F8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq