// File: /workspace/github_c_makefile_star2_O0/Oric4ever[P]lcc65/6502/build/../src/tree.c
// Function: root
Tree root(p) Tree p; {
	if (p == 0)
		return p;
	switch (generic(p->op)) {
	case COND: {
		Tree q = p->kids[1];
		assert(q && q->op == RIGHT);
		if (p->u.sym && q->kids[0] && generic(q->kids[0]->op) == ASGN)
			q->kids[0] = root(q->kids[0]->kids[1]);
		else
			q->kids[0] = root(q->kids[0]);
		if (p->u.sym && q->kids[1] && generic(q->kids[1]->op) == ASGN)
			q->kids[1] = root(q->kids[1]->kids[1]);
		else
			q->kids[1] = root(q->kids[1]);
		if (p->u.sym)
			release(p->u.sym);
		p->u.sym = 0;
		if (q->kids[0] == 0 && q->kids[1] == 0)
			p = root(p->kids[0]);
		}
		break;
	case AND: case OR:
		if ((p->kids[1] = root(p->kids[1])) == 0)
			p = root(p->kids[0]);
		break;
	case NOT:
		return root(p->kids[0]);
	case RIGHT:
		if (p->kids[1] == 0)
			return root(p->kids[0]);
		if (p->kids[0] && p->kids[0]->op == CALL+B
		&&  p->kids[1] && p->kids[1]->op == INDIR+B)
			/* avoid premature release of the CALL+B temporary */
			return p->kids[0];
		if (p->kids[0] && p->kids[0]->op == RIGHT
		&&  p->kids[1] == p->kids[0]->kids[0])
			/* de-construct e++ construction */
			return p->kids[0]->kids[1];
		/* fall thru */
	case EQ:  case NE:  case GT:   case GE:  case LE:  case LT:
	case ADD: case SUB: case MUL:  case DIV: case MOD:
	case LSH: case RSH: case BAND: case BOR: case BXOR:
		p = tree(RIGHT, p->type, root(p->kids[0]), root(p->kids[1]));
		return p->kids[0] || p->kids[1] ? p : 0;
	case INDIR:
		if (p->type->size == 0)
			warning("reference to `%t' elided\n", p->type);
		if (isptr(p->kids[0]->type) && isvolatile(p->kids[0]->type->type))
			warning("reference to `volatile %t' elided\n", p->type);
		/* fall thru */
	case CVI: case CVF:  case CVD:   case CVU: case CVC: case CVS: case CVP:
	case NEG: case BCOM: case FIELD:
		return root(p->kids[0]);
	case ADDRL:
		if (p->u.sym->temporary)
			release(p->u.sym);
		/* fall thru */
	case ADDRG: case ADDRF: case CNST:
		return 0;
	case ARG: case ASGN: case CALL: case JUMP: case LABEL:
		break;
	default: assert(0);
	}
	return p;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x25ab0
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x26104
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $-0x10, %eax
movl %eax, -0x1c(%rbp)
subl $0x10, %eax
je 0x260d1
jmp 0x25ac7
movl -0x1c(%rbp), %eax
subl $0x20, %eax
je 0x260db
jmp 0x25ad5
movl -0x1c(%rbp), %eax
subl $0x30, %eax
je 0x260db
jmp 0x25ae3
movl -0x1c(%rbp), %eax
subl $0x40, %eax
je 0x25ff2
jmp 0x25af1
movl -0x1c(%rbp), %eax
subl $0x50, %eax
je 0x26098
jmp 0x25aff
movl -0x1c(%rbp), %eax
subl $0x60, %eax
je 0x26098
jmp 0x25b0d
movl -0x1c(%rbp), %eax
subl $0x70, %eax
je 0x26098
jmp 0x25b1b
movl -0x1c(%rbp), %eax
subl $0x80, %eax
je 0x26098
jmp 0x25b2b
movl -0x1c(%rbp), %eax
subl $0x90, %eax
je 0x26098
jmp 0x25b3b
movl -0x1c(%rbp), %eax
subl $0xa0, %eax
je 0x26098
jmp 0x25b4b
movl -0x1c(%rbp), %eax
subl $0xb0, %eax
je 0x26098
jmp 0x25b5b
movl -0x1c(%rbp), %eax
subl $0xc0, %eax
je 0x26098
jmp 0x25b6b
movl -0x1c(%rbp), %eax
subl $0xd0, %eax
je 0x260db
jmp 0x25b7b
movl -0x1c(%rbp), %eax
subl $0x100, %eax            # imm = 0x100
je 0x260d1
jmp 0x25b8b
movl -0x1c(%rbp), %eax
subl $0x110, %eax            # imm = 0x110
je 0x260d1
jmp 0x25b9b
movl -0x1c(%rbp), %eax
subl $0x120, %eax            # imm = 0x120
je 0x260ab
jmp 0x25bab
movl -0x1c(%rbp), %eax
subl $0x130, %eax            # imm = 0x130
je 0x25f7a
jmp 0x25bbb
movl -0x1c(%rbp), %eax
subl $0x140, %eax            # imm = 0x140
je 0x25f7a
jmp 0x25bcb
movl -0x1c(%rbp), %eax
subl $0x150, %eax            # imm = 0x150
je 0x25f7a
jmp 0x25bdb
movl -0x1c(%rbp), %eax
subl $0x160, %eax            # imm = 0x160
je 0x25f7a
jmp 0x25beb
movl -0x1c(%rbp), %eax
subl $0x170, %eax            # imm = 0x170
je 0x25f7a
jmp 0x25bfb
movl -0x1c(%rbp), %eax
subl $0x180, %eax            # imm = 0x180
je 0x25f7a
jmp 0x25c0b
movl -0x1c(%rbp), %eax
subl $0x190, %eax            # imm = 0x190
je 0x26098
jmp 0x25c1b
movl -0x1c(%rbp), %eax
subl $0x1a0, %eax            # imm = 0x1A0
je 0x25f7a
jmp 0x25c2b
movl -0x1c(%rbp), %eax
subl $0x1b0, %eax            # imm = 0x1B0
je 0x25f7a
jmp 0x25c3b
movl -0x1c(%rbp), %eax
subl $0x1c0, %eax            # imm = 0x1C0
je 0x25f7a
jmp 0x25c4b
movl -0x1c(%rbp), %eax
subl $0x1d0, %eax            # imm = 0x1D0
je 0x25f7a
jmp 0x25c5b
movl -0x1c(%rbp), %eax
subl $0x1e0, %eax            # imm = 0x1E0
je 0x25f7a
jmp 0x25c6b
movl -0x1c(%rbp), %eax
subl $0x1f0, %eax            # imm = 0x1F0
je 0x25f7a
jmp 0x25c7b
movl -0x1c(%rbp), %eax
subl $0x200, %eax            # imm = 0x200
je 0x25f7a
jmp 0x25c8b
movl -0x1c(%rbp), %eax
subl $0x210, %eax            # imm = 0x210
je 0x25f7a
jmp 0x25c9b
movl -0x1c(%rbp), %eax
subl $0x220, %eax            # imm = 0x220
je 0x25f7a
jmp 0x25cab
movl -0x1c(%rbp), %eax
subl $0x230, %eax            # imm = 0x230
je 0x25f7a
jmp 0x25cbb
movl -0x1c(%rbp), %eax
subl $0x240, %eax            # imm = 0x240
je 0x260db
jmp 0x25ccb
movl -0x1c(%rbp), %eax
subl $0x250, %eax            # imm = 0x250
je 0x260db
jmp 0x25cdb
movl -0x1c(%rbp), %eax
subl $0x260, %eax            # imm = 0x260
je 0x25e86
jmp 0x25ceb
movl -0x1c(%rbp), %eax
subl $0x270, %eax            # imm = 0x270
je 0x25eb7
jmp 0x25cfb
movl -0x1c(%rbp), %eax
subl $0x280, %eax            # imm = 0x280
je 0x25e86
jmp 0x25d0b
movl -0x1c(%rbp), %eax
subl $0x290, %eax            # imm = 0x290
je 0x25d3a
jmp 0x25d17
movl -0x1c(%rbp), %eax
subl $0x2a0, %eax            # imm = 0x2A0
je 0x25ecd
jmp 0x25d27
movl -0x1c(%rbp), %eax
subl $0x2b0, %eax            # imm = 0x2B0
je 0x26098
jmp 0x260dd
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x25d5b
movq -0x18(%rbp), %rax
cmpl $0x2a0, (%rax)          # imm = 0x2A0
jne 0x25d5b
jmp 0x25d7a
leaq 0xc5f4(%rip), %rdi      # 0x32356
leaq 0xc503(%rip), %rsi      # 0x3226c
movl $0x9a, %edx
leaq 0xc5f5(%rip), %rcx      # 0x3236a
callq 0x30c0
movq -0x10(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x25dc0
movq -0x18(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x25dc0
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movl (%rax), %eax
andl $-0x10, %eax
cmpl $0x30, %eax
jne 0x25dc0
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x25a90
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x25dd8
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x25a90
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x25e1e
movq -0x18(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x25e1e
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movl (%rax), %eax
andl $-0x10, %eax
cmpl $0x30, %eax
jne 0x25e1e
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rax), %rdi
callq 0x25a90
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x18(%rax)
jmp 0x25e36
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x25a90
movq %rax, %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x28(%rax)
je 0x25e4e
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x251c0
movq -0x10(%rbp), %rax
movq $0x0, 0x28(%rax)
movq -0x18(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x25e81
movq -0x18(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x25e81
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x25a90
movq %rax, -0x10(%rbp)
jmp 0x260fc
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x25a90
movq -0x10(%rbp), %rcx
movq %rax, 0x18(%rcx)
cmpq $0x0, %rax
jne 0x25eb2
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x25a90
movq %rax, -0x10(%rbp)
jmp 0x260fc
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x25a90
movq %rax, -0x8(%rbp)
jmp 0x26104
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
jne 0x25eee
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x25a90
movq %rax, -0x8(%rbp)
jmp 0x26104
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x25f32
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
cmpl $0xd9, (%rax)
jne 0x25f32
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x25f32
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
cmpl $0x49, (%rax)
jne 0x25f32
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x26104
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x25f78
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
cmpl $0x2a0, (%rax)          # imm = 0x2A0
jne 0x25f78
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x10(%rbp), %rcx
movq 0x10(%rcx), %rcx
cmpq 0x10(%rcx), %rax
jne 0x25f78
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x18(%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x26104
jmp 0x25f7a
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x25a90
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
callq 0x25a90
movq -0x30(%rbp), %rsi
movq -0x28(%rbp), %rdx
movq %rax, %rcx
movl $0x2a0, %edi            # imm = 0x2A0
callq 0x256f0
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x25fd3
movq -0x10(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x25fdd
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
jmp 0x25fe5
xorl %eax, %eax
movq %rax, -0x38(%rbp)
jmp 0x25fe5
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x26104
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
cmpl $0x0, 0x8(%rax)
jne 0x26016
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0xc367(%rip), %rdi      # 0x32376
movb $0x0, %al
callq 0xdba0
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
cmpl $0xf, (%rax)
jb 0x2603d
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x2604d
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpl $0x7, (%rax)
jne 0x26096
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
cmpl $0x10, (%rax)
je 0x26080
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq 0x8(%rax), %rax
movq 0x10(%rax), %rax
cmpl $0x1f, (%rax)
jne 0x26096
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0xc301(%rip), %rdi      # 0x32390
movb $0x0, %al
callq 0xdba0
jmp 0x26098
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0x25a90
movq %rax, -0x8(%rbp)
jmp 0x26104
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rax
movb 0x1b(%rax), %al
shrb %al
andb $0x1, %al
movzbl %al, %eax
cmpl $0x0, %eax
je 0x260cf
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
callq 0x251c0
jmp 0x260d1
movq $0x0, -0x8(%rbp)
jmp 0x26104
jmp 0x260fc
leaq 0x8ff3(%rip), %rdi      # 0x2f0d7
leaq 0xc181(%rip), %rsi      # 0x3226c
movl $0xd2, %edx
leaq 0xc273(%rip), %rcx      # 0x3236a
callq 0x30c0
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nop