// File: /workspace/github_c_makefile_star2_O0/Oric4ever[P]lcc65/6502/build/../src/gen.c
// Function: needtmp
static int needtmp(Node p) {
    Node left = p->kids[0];
    if (graph_output) return 0;
    switch (generic(p->op)) {
        case ADDRF: case ADDRG: case ADDRL:
        case CNST:
            assert(optimizelevel==0);
            return 1;
        case INDIR:
            if (optimizelevel!=0)
                if (optype(p->op)==B) { /* remove all INDIRB nodes */
                    p->x.optimized = 1;
                    p->x.result    = left->x.result;
                    p->x.name      = p->x.result->x.name;
                    p->x.adrmode   = left->x.adrmode;
                    return 0;
                }

            if (optimizelevel>=3) {
        /* these conditions must be true to optimize (=get rid of) an INDIR node:
         * - this INDIR node is referenced only once
         *   (otherwise by delaying the indirection in parent nodes we would duplicate it,
         *   and hence could have different behavior (TODO: example needed))
         * - the address mode of the INDIR operand is "de-referenceable"
         */
                if (p->count <= 1 && is_dereferenceable(left->x.adrmode)) {
                    p->x.optimized = 1;
                    p->x.result    = left->x.result;
                    p->x.name      = left->x.result->x.name;
                    p->x.adrmode   = dereference(left->x.adrmode);
                    return 0;
                }
            }
            return 1;
        case ASGN:
        case ARG:
        case EQ: case GE: case GT: case LE: case LT: case NE:
        case RET:
        case JUMP: case LABEL:
            return 0;
        case CALL:
            if (optype(p->op)==B) return 0;
            if (p->count==0) p->op=CALLV;
            if (optype(p->op)==V) return 0;
            else return 1;
        default:
            return 1;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq %rax, -0x18(%rbp)
testb $0x1, 0x17059(%rip)     # 0x446a8
je 0x2d65d
movl $0x0, -0x4(%rbp)
jmp 0x2d8e1
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $-0x10, %eax
movl %eax, -0x1c(%rbp)
subl $0x10, %eax
je 0x2d771
jmp 0x2d674
movl -0x1c(%rbp), %eax
subl $0x20, %eax
je 0x2d883
jmp 0x2d682
movl -0x1c(%rbp), %eax
subl $0x30, %eax
je 0x2d883
jmp 0x2d690
movl -0x1c(%rbp), %eax
subl $0x40, %eax
je 0x2d7a7
jmp 0x2d69e
movl -0x1c(%rbp), %eax
subl $0xd0, %eax
je 0x2d88c
jmp 0x2d6ae
movl -0x1c(%rbp), %eax
subl $0xf0, %eax
je 0x2d883
jmp 0x2d6be
movl -0x1c(%rbp), %eax
subl $0x100, %eax            # imm = 0x100
je 0x2d771
jmp 0x2d6ce
movl -0x1c(%rbp), %eax
subl $0x110, %eax            # imm = 0x110
je 0x2d771
jmp 0x2d6de
movl -0x1c(%rbp), %eax
subl $0x120, %eax            # imm = 0x120
je 0x2d771
jmp 0x2d6ee
movl -0x1c(%rbp), %eax
subl $0x1e0, %eax            # imm = 0x1E0
je 0x2d883
jmp 0x2d6fe
movl -0x1c(%rbp), %eax
subl $0x1f0, %eax            # imm = 0x1F0
je 0x2d883
jmp 0x2d70e
movl -0x1c(%rbp), %eax
subl $0x200, %eax            # imm = 0x200
je 0x2d883
jmp 0x2d71e
movl -0x1c(%rbp), %eax
subl $0x210, %eax            # imm = 0x210
je 0x2d883
jmp 0x2d72e
movl -0x1c(%rbp), %eax
subl $0x220, %eax            # imm = 0x220
je 0x2d883
jmp 0x2d73e
movl -0x1c(%rbp), %eax
subl $0x230, %eax            # imm = 0x230
je 0x2d883
jmp 0x2d74e
movl -0x1c(%rbp), %eax
subl $0x240, %eax            # imm = 0x240
je 0x2d883
jmp 0x2d75e
movl -0x1c(%rbp), %eax
subl $0x250, %eax            # imm = 0x250
je 0x2d883
jmp 0x2d8da
cmpl $0x0, 0xe1ac(%rip)      # 0x3b924
jne 0x2d77c
jmp 0x2d79b
leaq 0x6cdf(%rip), %rdi      # 0x34462
leaq 0x6a77(%rip), %rsi      # 0x34201
movl $0x1c9, %edx            # imm = 0x1C9
leaq 0x6cdd(%rip), %rcx      # 0x34473
callq 0x30c0
movl $0x1, -0x4(%rbp)
jmp 0x2d8e1
cmpl $0x0, 0xe176(%rip)      # 0x3b924
je 0x2d805
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0xf, %eax
cmpl $0x9, %eax
jne 0x2d803
movq -0x10(%rbp), %rax
movb $0x1, 0x60(%rax)
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x18(%rbp), %rax
movb 0x40(%rax), %cl
movq -0x10(%rbp), %rax
movb %cl, 0x40(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x2d8e1
jmp 0x2d805
cmpl $0x3, 0xe118(%rip)      # 0x3b924
jl 0x2d87a
movq -0x10(%rbp), %rax
movswl 0x4(%rax), %eax
cmpl $0x1, %eax
jg 0x2d878
movq -0x18(%rbp), %rax
movsbl 0x40(%rax), %edi
callq 0x2d550
testb $0x1, %al
jne 0x2d82e
jmp 0x2d878
movq -0x10(%rbp), %rax
movb $0x1, 0x60(%rax)
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x18(%rbp), %rax
movq 0x48(%rax), %rax
movq (%rax), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x18(%rbp), %rax
movsbl 0x40(%rax), %edi
callq 0x2d5a0
movb %al, %cl
movq -0x10(%rbp), %rax
movb %cl, 0x40(%rax)
movl $0x0, -0x4(%rbp)
jmp 0x2d8e1
jmp 0x2d87a
movl $0x1, -0x4(%rbp)
jmp 0x2d8e1
movl $0x0, -0x4(%rbp)
jmp 0x2d8e1
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0xf, %eax
cmpl $0x9, %eax
jne 0x2d8a3
movl $0x0, -0x4(%rbp)
jmp 0x2d8e1
movq -0x10(%rbp), %rax
movswl 0x4(%rax), %eax
cmpl $0x0, %eax
jne 0x2d8ba
movq -0x10(%rbp), %rax
movl $0xd8, (%rax)
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0xf, %eax
cmpl $0x8, %eax
jne 0x2d8d1
movl $0x0, -0x4(%rbp)
jmp 0x2d8e1
movl $0x1, -0x4(%rbp)
jmp 0x2d8e1
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopw (%rax,%rax)