// File: /workspace/github_c_makefile_star2_O0/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 %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x117a4
movq $0x0, -0x8(%rbp)
jmp 0x11a89
movq -0x10(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x30(%rbp)
subq $0x20, %rax
ja 0x117c8
movq -0x30(%rbp), %rax
leaq 0x8f11(%rip), %rcx      # 0x1a6d0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x901f(%rip), %rdi      # 0x1a7ee
callq 0x11c80
xorl %eax, %eax
movl %eax, %edi
addq $0x8, %rdi
addq $0x18, %rdi
callq *-0x18(%rbp)
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rax
movl 0x18(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x18(%rax)
jmp 0x11a75
xorl %eax, %eax
movl %eax, %edi
addq $0x8, %rdi
addq $0x18, %rdi
callq *-0x18(%rbp)
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x30f0
movq %rax, %rdi
movq -0x38(%rbp), %rax
addq $0x1, %rdi
callq *%rax
movq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0x3070
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x118b2
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x30f0
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rax
movq -0x28(%rbp), %rdi
callq *%rax
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x28(%rbp), %rdx
callq 0x3220
jmp 0x118be
movq -0x20(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x10(%rbp), %rax
movl 0x18(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x18(%rax)
jmp 0x11a75
xorl %eax, %eax
movl %eax, %edi
addq $0x8, %rdi
addq $0x8, %rdi
callq *-0x18(%rbp)
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x11780
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0x11a75
xorl %eax, %eax
movl %eax, %edi
addq $0x8, %rdi
addq $0x10, %rdi
callq *-0x18(%rbp)
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x11780
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x11780
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
jmp 0x11a75
xorl %eax, %eax
movl %eax, %edi
addq $0x8, %rdi
addq $0x18, %rdi
callq *-0x18(%rbp)
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x11780
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x11780
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x11780
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
jmp 0x11a75
xorl %eax, %eax
movl %eax, %edi
addq $0x8, %rdi
addq $0x20, %rdi
callq *-0x18(%rbp)
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x11780
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x11780
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x20(%rax)
jmp 0x11a75
xorl %eax, %eax
movl %eax, %edi
addq $0x8, %rdi
addq $0x18, %rdi
callq *-0x18(%rbp)
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x10(%rbp), %rax
movl 0x10(%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x11780
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
movl (%rax), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)