// File: /workspace/github_c_makefile_star2_O3/lucvoo[P]sparse-dev/linearize.c
// Function: linearize_cond_branch
static pseudo_t linearize_cond_branch(struct entrypoint *ep, struct expression *expr, struct basic_block *bb_true, struct basic_block *bb_false)
{
	pseudo_t cond;

	if (!expr || !valid_type(expr->ctype) || !bb_reachable(ep->active))
		return VOID;

	switch (expr->type) {

	case EXPR_STRING:
	case EXPR_VALUE:
		add_goto(ep, expr->value ? bb_true : bb_false);
		break;
	case EXPR_FVALUE:
		add_goto(ep, expr->fvalue ? bb_true : bb_false);
		break;
	case EXPR_LOGICAL:
		linearize_logical_branch(ep, expr, bb_true, bb_false);
		break;
	case EXPR_COMPARE:
		cond = linearize_compare(ep, expr);
		add_branch(ep, cond, bb_true, bb_false);
		break;
	case EXPR_PREOP:
		if (expr->op == '!')
			return linearize_cond_branch(ep, expr->unop, bb_false, bb_true);
		/* fall through */
	default:
		cond = linearize_expression_to_bool(ep, expr);
		add_branch(ep, cond, bb_true, bb_false);
		break;
	}
	return VOID;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rsi, %rsi
je 0x170ff
movq %rdx, %rbx
movq %rsi, %r12
movq %rdi, %r14
leaq 0x5587e(%rip), %rbp     # 0x6c8b8
movq %rcx, 0x10(%rsp)
movq 0x10(%r12), %rax
testq %rax, %rax
je 0x170ff
cmpq %rbp, %rax
je 0x170ff
cmpq $0x0, 0x20(%r14)
je 0x170ff
movzbl (%r12), %eax
cmpl $0x7, %eax
jne 0x170d7
movq 0x8(%r12), %r15
xorl %edi, %edi
callq 0x2fbe3
movq %rax, %r13
movq %r15, (%rax)
movq %r14, 0x10(%rax)
movl 0x4fce9(%rip), %eax     # 0x66d70
leal 0x1(%rax), %ecx
movl %ecx, 0x4fce0(%rip)     # 0x66d70
movl %eax, 0x38(%r13)
cmpl $0x10e, 0x4(%r12)       # imm = 0x10E
movq 0x20(%r12), %rsi
movq %r14, %rdi
jne 0x170af
movq %rbx, %rdx
movq %r13, %rcx
jmp 0x170b7
movq %r13, %rdx
movq 0x10(%rsp), %rcx
callq 0x17013
movq %r14, %rdi
movq %r13, %rsi
callq 0x14060
movq 0x28(%r12), %r12
testq %r12, %r12
jne 0x1703f
jmp 0x170ff
cmpl $0x8, %eax
jle 0x1710e
cmpl $0x9, %eax
jne 0x17129
cmpl $0x21, 0x4(%r12)
jne 0x17165
movq 0x20(%r12), %r12
movq %rbx, %rcx
movq 0x10(%rsp), %rbx
testq %r12, %r12
jne 0x1703a
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
decl %eax
cmpl $0x2, %eax
jae 0x17165
cmpq $0x0, 0x20(%r12)
cmoveq 0x10(%rsp), %rbx
movq %r14, %rdi
movq %rbx, %rsi
jmp 0x17152
cmpl $0x16, %eax
je 0x171c4
cmpl $0x1c, %eax
jne 0x17165
fldt 0x20(%r12)
fldz
fucompi %st(1), %st
fstp %st(0)
movq 0x10(%rsp), %rsi
cmovneq %rbx, %rsi
cmovpq %rbx, %rsi
movq %r14, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x14453
movq %r14, %rdi
movq %r12, %rsi
callq 0x144d5
movq %rax, %r13
movq 0x10(%r12), %r12
testq %r12, %r12
sete %al
leaq 0x4e84b(%rip), %rsi     # 0x659d0
cmpq %rsi, %r13
sete %cl
orb %al, %cl
jne 0x17261
movzbl (%r12), %eax
movq %r12, %rcx
cmpl $0x3, %eax
jne 0x171a5
movq 0x60(%r12), %rcx
cmpq 0x48e3c(%rip), %rcx     # 0x5ffe8
je 0x171bc
cmpl $0x6, 0x4(%r13)
jne 0x171da
cmpq $0x2, 0x18(%r13)
jae 0x171da
movq %r13, %rsi
jmp 0x17261
movq %r14, %rdi
movq %r12, %rsi
callq 0x164bb
movq %r14, %rdi
movq %rax, %rsi
jmp 0x17264
movq %r12, %rcx
cmpl $0x3, %eax
jne 0x171e7
movq 0x60(%r12), %rcx
movq 0x60(%rcx), %rax
cmpq 0x48d5e(%rip), %rax     # 0x5ff50
je 0x17202
xorl %edi, %edi
callq 0x13745
movl $0x30, %edx
jmp 0x17241
fldz
fstpt (%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x1558f
cmpb $0x3, (%r12)
movq %r12, %rcx
jne 0x17221
movq 0x60(%r12), %rcx
movq 0x60(%rcx), %rcx
movl $0x30, %edx
cmpq 0x48d1f(%rip), %rcx     # 0x5ff50
jne 0x17241
leaq 0x2a9e6(%rip), %rcx     # 0x41c20
movsbl 0x183(%rcx), %edx
leaq 0x53df0(%rip), %rsi     # 0x6b038
movq %r14, %rdi
movq %r13, %rcx
movq %rax, %r8
callq 0x16d1b
movq %rax, %rsi
movq 0x18(%rax), %rax
movq %r12, 0x40(%rax)
movq %r14, %rdi
movq %rbx, %rdx
movq 0x10(%rsp), %rcx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x17371