// File: /workspace/github_c_makefile_star2_O2/rakitzis[P]rc/tree.c
// Function: treecpy
extern Node *treecpy(Node *s, void *(*alloc)(size_t)) {
	Node *n;
	if (s == NULL)
		return NULL;
	switch (s->type) {
	default:
		panic("unexpected node in treecpy");
		/* NOTREACHED */
	case nDup:
		n = (*alloc)(offsetof(Node, u[3]));
		n->u[0].i = s->u[0].i;
		n->u[1].i = s->u[1].i;
		n->u[2].i = s->u[2].i;
		break;
	case nWord:
		n = (*alloc)(offsetof(Node, u[3]));
		n->u[0].s = strcpy((char *) (*alloc)(strlen(s->u[0].s) + 1), s->u[0].s);
		if (s->u[1].s != NULL) {
			size_t i = strlen(s->u[0].s);
			n->u[1].s = (*alloc)(i);
			memcpy(n->u[1].s, s->u[1].s, i);
		} else
			n->u[1].s = NULL;
		n->u[2].i = s->u[2].i;
		break;
	case nBang: case nNowait: case nCase:
	case nCount: case nFlat: case nRmfn: case nSubshell: case nVar:
		n = (*alloc)(offsetof(Node, u[1]));
		n->u[0].p = treecpy(s->u[0].p, alloc);
		break;
	case nAndalso: case nAssign: case nBackq: case nBody: case nBrace: case nConcat:
	case nElse: case nEpilog: case nIf: case nNewfn: case nCbody:
	case nOrelse: case nPre: case nArgs: case nSwitch:
	case nMatch: case nVarsub: case nWhile: case nLappend:
		n = (*alloc)(offsetof(Node, u[2]));
		n->u[0].p = treecpy(s->u[0].p, alloc);
		n->u[1].p = treecpy(s->u[1].p, alloc);
		break;
	case nForin:
		n = (*alloc)(offsetof(Node, u[3]));
		n->u[0].p = treecpy(s->u[0].p, alloc);
		n->u[1].p = treecpy(s->u[1].p, alloc);
		n->u[2].p = treecpy(s->u[2].p, alloc);
		break;
	case nPipe:
		n = (*alloc)(offsetof(Node, u[4]));
		n->u[0].i = s->u[0].i;
		n->u[1].i = s->u[1].i;
		n->u[2].p = treecpy(s->u[2].p, alloc);
		n->u[3].p = treecpy(s->u[3].p, alloc);
		break;
	case nRedir:
	case nNmpipe:
		n = (*alloc)(offsetof(Node, u[3]));
		n->u[0].i = s->u[0].i;
		n->u[1].i = s->u[1].i;
		n->u[2].p = treecpy(s->u[2].p, alloc);
		break;
	}
	n->type = s->type;
	return n;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0xbc7a
movq %rsi, %r15
movq %rdi, %rbx
movl (%rdi), %eax
cmpq $0x20, %rax
ja 0xbd91
leaq 0x77f5(%rip), %rcx      # 0x13438
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
pushq $0x18
popq %rdi
callq *%r15
movq %rax, %r14
movq 0x8(%rbx), %rdi
movq %r15, %rsi
callq 0xbc1d
movq %rax, 0x8(%r14)
movq 0x10(%rbx), %rdi
movq %r15, %rsi
callq 0xbc1d
movq %rax, 0x10(%r14)
jmp 0xbdbb
xorl %r14d, %r14d
jmp 0xbdc0
pushq $0x10
popq %rdi
callq *%r15
movq %rax, %r14
movq 0x8(%rbx), %rdi
movq %r15, %rsi
callq 0xbc1d
movq %rax, 0x8(%r14)
jmp 0xbdbb
pushq $0x20
popq %rdi
callq *%r15
movq %rax, %r14
movl 0x8(%rbx), %eax
movl %eax, 0x8(%r14)
movl 0x10(%rbx), %eax
movl %eax, 0x10(%r14)
jmp 0xbd46
pushq $0x20
popq %rdi
callq *%r15
movq %rax, %r14
movq 0x8(%rbx), %rdi
callq 0x30f0
leaq 0x1(%rax), %rdi
callq *%r15
movq %rax, %r12
movq 0x8(%rbx), %rsi
movq %rax, %rdi
callq 0x3070
movq %r12, 0x8(%r14)
cmpq $0x0, 0x10(%rbx)
je 0xbdcf
movq 0x8(%rbx), %rdi
callq 0x30f0
movq %rax, %r12
movq %rax, %rdi
callq *%r15
movq %rax, 0x10(%r14)
movq 0x10(%rbx), %rsi
movq %rax, %rdi
movq %r12, %rdx
callq 0x3230
jmp 0xbdb4
pushq $0x20
popq %rdi
callq *%r15
movq %rax, %r14
movq 0x8(%rbx), %rdi
movq %r15, %rsi
callq 0xbc1d
movq %rax, 0x8(%r14)
movq 0x10(%rbx), %rdi
movq %r15, %rsi
callq 0xbc1d
movq %rax, 0x10(%r14)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xbc1d
movq %rax, 0x18(%r14)
jmp 0xbdbb
pushq $0x28
popq %rdi
callq *%r15
movq %rax, %r14
movl 0x8(%rbx), %eax
movl %eax, 0x8(%r14)
movl 0x10(%rbx), %eax
movl %eax, 0x10(%r14)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xbc1d
movq %rax, 0x18(%r14)
movq 0x20(%rbx), %rdi
movq %r15, %rsi
callq 0xbc1d
movq %rax, 0x20(%r14)
jmp 0xbdbb
leaq 0x77be(%rip), %rdi      # 0x13556
callq 0xbeea
pushq $0x20
popq %rdi
callq *%r15
movq %rax, %r14
movl 0x8(%rbx), %eax
movl %eax, 0x8(%r14)
movl 0x10(%rbx), %eax
movl %eax, 0x10(%r14)
movl 0x18(%rbx), %eax
movl %eax, 0x18(%r14)
movl (%rbx), %eax
movl %eax, (%r14)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
andq $0x0, 0x10(%r14)
jmp 0xbdb4