// File: /workspace/github_c_makefile_star2_O1/Oric4ever[P]lcc65/6502/build/../src/enode.c
// Function: condnode
Tree condnode(Tree e, Tree l, Tree r) {
	Symbol t1 = 0;
	Type ty = 0, lty = l->type, rty = r->type;
	Tree p;

	if (isarith(lty) && isarith(rty)) {
		ty = binary(lty, rty);
		l = cast(l, ty);
		r = cast(r, ty);
	} else if (eqtype(lty, rty, 1)
	|| (isptr(lty) && isint(rty) && assign(lty, r)))
		ty = unqual(lty);
	else if (isptr(rty) && isint(lty) && assign(rty, l))
		ty = unqual(rty);
	else if (isptr(lty) && isptr(rty)) {
		lty = lty->type;
		rty = rty->type;
		if (unqual(lty) == voidtype || unqual(rty) == voidtype)
			ty = voidtype;
		else if (eqtype(unqual(lty), unqual(rty), 1))
			ty = unqual(lty);
		if (ty) {
			if (isconst(lty) || isconst(rty))
				ty = qual(CONST, ty);
			if (isvolatile(lty) || isvolatile(rty))
				ty = qual(VOLATILE, ty);
			ty = ptr(ty);
		}
	}
	if (ty == 0) {
		typeerror(COND, l, r);
		ty = inttype;
	} else if (e->op == CNST+D || e->op == CNST+F) {
		e = cast(e, doubletype);
		return retype(e->u.v.d != 0.0 ? l : r, ty);
	} else if (generic(e->op) == CNST) {
		e = cast(e, unsignedtype);
		return retype(e->u.v.u ? l : r, ty);
	} else if (ty != voidtype && ty->size > 0) {
		Opcode op = generic(e->op);
		t1 = temporary(REGISTER, ty);
		l = root(asgn(t1, l));
		if (op != AND && op != OR && op != NOT && op != EQ && op != NE
		&&  op !=  LE && op != LT && op !=  GE && op != GT && op != RIGHT
		&& r->op == CNST+I && r->u.v.i == 0
		&& assign(e->type, r)) {
			/* e1?e2:0 => ((t1=e1)?(t1=e2): ) */
			e = asgn(t1, cast(e, ty));
			r = 0;
		} else
			r = root(asgn(t1, r));
	}
	p = tree(COND, ty, cond(e), tree(RIGHT, ty, l, r));
	p->u.sym = t1;
	return p;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %rbx
movq %rdi, %r15
movq 0x8(%rsi), %r12
cmpl $0xf, (%r12)
movq %r12, %rax
jb 0x92b7
movq 0x10(%r12), %rax
movq 0x8(%r14), %r13
cmpl $0x6, (%rax)
ja 0x9302
cmpl $0xf, (%r13)
movq %r13, %rax
jb 0x92ce
movq 0x10(%r13), %rax
cmpl $0x6, (%rax)
ja 0x9302
movq %r12, %rdi
movq %r13, %rsi
callq 0x9092
movq %rax, %r12
movq %rbx, %rdi
movq %rax, %rsi
callq 0xa341
movq %rax, %rbx
movq %r14, %rdi
movq %r12, %rsi
callq 0xa341
movq %rax, %r14
jmp 0x94e3
movq %r12, %rdi
movq %r13, %rsi
movl $0x1, %edx
callq 0x192a9
testl %eax, %eax
je 0x932b
cmpl $0xf, (%r12)
jb 0x94e3
movq 0x10(%r12), %r12
jmp 0x94e3
cmpl $0xf, (%r12)
movq %r12, %rax
jb 0x933a
movq 0x10(%r12), %rax
cmpl $0x7, (%rax)
jne 0x9375
movl (%r13), %eax
movq %r13, %rcx
cmpl $0xf, %eax
jb 0x934f
movq 0x10(%r13), %rcx
cmpl $0x3, (%rcx)
jb 0x9375
movq %r13, %rcx
cmpl $0xf, %eax
jb 0x9360
movq 0x10(%r13), %rcx
cmpl $0x6, (%rcx)
ja 0x9375
movq %r12, %rdi
movq %r14, %rsi
callq 0x9fe1
testq %rax, %rax
jne 0x9316
cmpl $0xf, (%r13)
movq %r13, %rax
jb 0x9383
movq 0x10(%r13), %rax
cmpl $0x7, (%rax)
jne 0x93d4
movl (%r12), %eax
movq %r12, %rcx
cmpl $0xf, %eax
jb 0x9399
movq 0x10(%r12), %rcx
cmpl $0x3, (%rcx)
jb 0x93d4
movq %r12, %rcx
cmpl $0xf, %eax
jb 0x93ab
movq 0x10(%r12), %rcx
cmpl $0x6, (%rcx)
ja 0x93d4
movq %r13, %rdi
movq %rbx, %rsi
callq 0x9fe1
testq %rax, %rax
je 0x93d4
cmpl $0xf, (%r13)
jb 0x9479
movq 0x10(%r13), %r12
jmp 0x94e3
cmpl $0xf, (%r12)
movq %r12, %rax
jb 0x93e3
movq 0x10(%r12), %rax
cmpl $0x7, (%rax)
jne 0x94e0
cmpl $0xf, (%r13)
movq %r13, %rax
jb 0x93fa
movq 0x10(%r13), %rax
cmpl $0x7, (%rax)
jne 0x94e0
movq 0x10(%r12), %r12
movl (%r12), %ecx
movq %r12, %rdx
cmpl $0xf, %ecx
jb 0x9419
movq 0x10(%r12), %rdx
movq 0x10(%r13), %r13
leaq 0x28bbc(%rip), %rax     # 0x31fe0
movq (%rax), %rax
cmpq %rax, %rdx
je 0x9480
movl (%r13), %edx
movq %r13, %rsi
cmpl $0xf, %edx
jb 0x943c
movq 0x10(%r13), %rsi
cmpq %rax, %rsi
je 0x9480
movq %r12, %rdi
cmpl $0xf, %ecx
jb 0x944e
movq 0x10(%r12), %rdi
movq %r13, %rsi
cmpl $0xf, %edx
jb 0x945a
movq 0x10(%r13), %rsi
movl $0x1, %edx
callq 0x192a9
testl %eax, %eax
je 0x947e
cmpl $0xf, (%r12)
movq %r12, %rax
jb 0x9480
movq 0x10(%r12), %rax
jmp 0x9480
movq %r13, %r12
jmp 0x94e3
xorl %eax, %eax
testq %rax, %rax
je 0x94e0
movl (%r12), %ecx
orl $0x10, %ecx
cmpl $0x1f, %ecx
je 0x949d
movl (%r13), %ecx
orl $0x10, %ecx
cmpl $0x1f, %ecx
jne 0x94aa
movl $0xf, %edi
movq %rax, %rsi
callq 0x19015
movl (%r12), %ecx
cmpl $0x10, %ecx
je 0x94c6
cmpl $0x1f, %ecx
je 0x94c6
movl (%r13), %ecx
cmpl $0x1f, %ecx
je 0x94c6
cmpl $0x10, %ecx
jne 0x94d3
movl $0x10, %edi
movq %rax, %rsi
callq 0x19015
movq %rax, %rdi
callq 0x18a44
movq %rax, %r12
jmp 0x94e3
xorl %r12d, %r12d
testq %r12, %r12
je 0x951b
movl (%r15), %ebp
leal -0x11(%rbp), %eax
cmpl $0x1, %eax
ja 0x953d
leaq 0x28a8e(%rip), %rax     # 0x31f88
movq (%rax), %rsi
movq %r15, %rdi
callq 0xa341
xorpd %xmm0, %xmm0
ucomisd 0x28(%rax), %xmm0
cmovneq %rbx, %r14
cmovpq %rbx, %r14
movq %r14, %rdi
jmp 0x956c
movl $0x290, %edi            # imm = 0x290
movq %rbx, %rsi
movq %r14, %rdx
callq 0x8fcb
leaq 0x28a66(%rip), %rax     # 0x31f98
movq (%rax), %r12
xorl %r13d, %r13d
jmp 0x963d
movq %r15, (%rsp)
movl %ebp, %r15d
andl $-0x10, %r15d
cmpl $0x10, %r15d
jne 0x9582
leaq 0x28a83(%rip), %rax     # 0x31fd8
movq (%rax), %rsi
movq (%rsp), %rdi
callq 0xa341
cmpl $0x0, 0x28(%rax)
cmoveq %r14, %rbx
movq %rbx, %rdi
movq %r12, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x17ca2
leaq 0x28a57(%rip), %rax     # 0x31fe0
cmpq (%rax), %r12
je 0x9636
cmpl $0x0, 0x8(%r12)
jle 0x9636
movl $0x4e, %edi
movq %r12, %rsi
callq 0x1783c
movq %rax, %r13
movq %rax, %rdi
movq %rbx, %rsi
callq 0x9efb
movq %rax, %rdi
callq 0x17ccb
movq %rax, %rbx
cmpl $0x2a0, %r15d           # imm = 0x2A0
je 0x961e
cmpl $0x200, %r15d           # imm = 0x200
je 0x961e
cmpl $0x1f0, %r15d           # imm = 0x1F0
je 0x961e
cmpl $0x220, %r15d           # imm = 0x220
je 0x961e
movl %ebp, %eax
andl $-0x30, %eax
cmpl $0x210, %eax            # imm = 0x210
je 0x961e
cmpl $0x1e0, %r15d           # imm = 0x1E0
je 0x961e
andl $-0x20, %ebp
cmpl $0x260, %ebp            # imm = 0x260
je 0x961e
cmpl $0x280, %r15d           # imm = 0x280
je 0x961e
cmpl $0x15, (%r14)
jne 0x961e
cmpl $0x0, 0x28(%r14)
je 0x9681
movq %r13, %rdi
movq %r14, %rsi
callq 0x9efb
movq %rax, %rdi
callq 0x17ccb
movq %rax, %r14
jmp 0x9639
xorl %r13d, %r13d
movq (%rsp), %r15
movq %r15, %rdi
callq 0xab54
movq %rax, %r15
movl $0x2a0, %edi            # imm = 0x2A0
movq %r12, %rsi
movq %rbx, %rdx
movq %r14, %rcx
callq 0x17b61
movl $0x290, %edi            # imm = 0x290
movq %r12, %rsi
movq %r15, %rdx
movq %rax, %rcx
callq 0x17b61
movq %r13, 0x28(%rax)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rsp), %rax
movq 0x8(%rax), %rdi
movq %r14, %rsi
callq 0x9fe1
testq %rax, %rax
je 0x961e
movq (%rsp), %rdi
movq %r12, %rsi
callq 0xa341
movq %r13, %rdi
movq %rax, %rsi
callq 0x9efb
movq %rax, %r15
xorl %r14d, %r14d
jmp 0x963d