// File: /workspace/github_c_makefile_star2_O3/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 0xc4aa
movq %rsi, %r15
movq %rdi, %rbx
movl (%rdi), %eax
cmpq $0x20, %rax
ja 0xc5cb
leaq 0x7ffb(%rip), %rcx      # 0x1446c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x18, %edi
callq *%r15
movq %rax, %r14
movq 0x8(%rbx), %rdi
movq %r15, %rsi
callq 0xc44b
movq %rax, 0x8(%r14)
movq 0x10(%rbx), %rdi
movq %r15, %rsi
callq 0xc44b
movq %rax, 0x10(%r14)
jmp 0xc5f7
xorl %r14d, %r14d
jmp 0xc5fc
movl $0x10, %edi
callq *%r15
movq %rax, %r14
movq 0x8(%rbx), %rdi
movq %r15, %rsi
callq 0xc44b
movq %rax, 0x8(%r14)
jmp 0xc5f7
movl $0x20, %edi
callq *%r15
movq %rax, %r14
movl 0x8(%rbx), %eax
movl %eax, 0x8(%r14)
movl 0x10(%rbx), %eax
movl %eax, 0x10(%r14)
jmp 0xc57e
movl $0x20, %edi
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 0xc60b
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 0xc5f0
movl $0x20, %edi
callq *%r15
movq %rax, %r14
movq 0x8(%rbx), %rdi
movq %r15, %rsi
callq 0xc44b
movq %rax, 0x8(%r14)
movq 0x10(%rbx), %rdi
movq %r15, %rsi
callq 0xc44b
movq %rax, 0x10(%r14)
movq 0x18(%rbx), %rdi
movq %r15, %rsi
callq 0xc44b
movq %rax, 0x18(%r14)
jmp 0xc5f7
movl $0x28, %edi
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 0xc44b
movq %rax, 0x18(%r14)
movq 0x20(%rbx), %rdi
movq %r15, %rsi
callq 0xc44b
movq %rax, 0x20(%r14)
jmp 0xc5f7
leaq 0x7fb8(%rip), %rdi      # 0x1458a
callq 0xc72e
movl $0x20, %edi
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
movq $0x0, 0x10(%r14)
jmp 0xc5f0