// File: /workspace/github_c_makefile_star2_O1/rakitzis[P]rc/walk.c
// Function: dopipe
static void dopipe(Node *n) {
	int i, j, sp, pid, fd_prev, fd_out, pids[MAX_PIPELINE], p[2];
	bool intr;
	Node *r;
	struct termios t;

	if (interactive)
		tcgetattr(0, &t);
	fd_prev = fd_out = 1;
	for (r = n, i = 0; r != NULL && r->type == nPipe; r = r->u[2].p, i++) {
		if (i + 1 >= MAX_PIPELINE)
			rc_error("pipe too long");
		if (pipe(p) < 0) {
			uerror("pipe");
			rc_error(NULL);
		}
		if ((pid = rc_fork()) == 0) {
			setsigdefaults(FALSE);
			redirq = NULL; /* clear preredir queue */
			mvfd(p[0], r->u[1].i);
			if (fd_prev != 1)
				mvfd(fd_prev, fd_out);
			close(p[1]);
			walk(r->u[3].p, FALSE);
			exit(getstatus());
		}
		if (fd_prev != 1)
			close(fd_prev); /* parent must close all pipe fd's */
		pids[i] = pid;
		fd_prev = p[1];
		fd_out = r->u[0].i;
		close(p[0]);
	}
	if ((pid = rc_fork()) == 0) {
		setsigdefaults(FALSE);
		mvfd(fd_prev, fd_out);
		walk(r, FALSE);
		exit(getstatus());
		/* NOTREACHED */
	}
	redirq = NULL; /* clear preredir queue */
	close(fd_prev);
	pids[i++] = pid;

	/* collect statuses */

	intr = FALSE;
	setpipestatuslength(i);
	for (j = 0; j < i; j++) {
		rc_wait4(pids[j], &sp, TRUE);
		setpipestatus(j, -1, sp);
		intr |= WIFSIGNALED(sp);
	}
	if (interactive && intr)
		tcsetattr(0, TCSANOW, &t);
	sigchk();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x858, %rsp            # imm = 0x858
movq %rdi, %r14
leaq 0xbea9(%rip), %r13      # 0x19bd4
cmpl $0x0, (%r13)
je 0xdd3e
leaq 0x14(%rsp), %rsi
xorl %edi, %edi
callq 0x32c0
testq %r14, %r14
je 0xddda
movl $0x1, %r15d
xorl %ebx, %ebx
leaq 0xc(%rsp), %r13
movl $0x1, %ebp
cmpl $0x12, (%r14)
jne 0xddd1
cmpq $0x1ff, %rbx            # imm = 0x1FF
jb 0xdd74
leaq 0x69ab(%rip), %rdi      # 0x1471a
callq 0x47be
movq %r13, %rdi
callq 0x3180
testl %eax, %eax
jns 0xdd93
leaq 0x5fce(%rip), %rdi      # 0x13d55
callq 0xc7ed
xorl %edi, %edi
callq 0x47be
callq 0xcfb8
testl %eax, %eax
je 0xde9c
movl %eax, %r12d
cmpl $0x1, %ebp
je 0xddaf
movl %ebp, %edi
callq 0x3170
movl %r12d, 0x50(%rsp,%rbx,4)
movl 0xc(%rsp), %edi
movl 0x10(%rsp), %ebp
movl 0x8(%r14), %r15d
callq 0x3170
movq 0x18(%r14), %r14
incq %rbx
testq %r14, %r14
jne 0xdd59
leaq 0xbdfc(%rip), %r13      # 0x19bd4
jmp 0xdde7
movl $0x1, %ebp
xorl %ebx, %ebx
movl $0x1, %r15d
callq 0xcfb8
testl %eax, %eax
je 0xdeed
movl %eax, %r12d
leaq 0xbcca(%rip), %rax      # 0x19ac8
movq $0x0, (%rax)
movl %ebp, %edi
callq 0x3170
movl %ebx, %eax
incl %ebx
movl %r12d, 0x50(%rsp,%rax,4)
movl %ebx, %edi
callq 0xbe35
xorl %r14d, %r14d
leaq 0x8(%rsp), %r15
xorl %ebp, %ebp
movl 0x50(%rsp,%r14,4), %edi
movq %r15, %rsi
movl $0x1, %edx
callq 0xd068
movl 0x8(%rsp), %edx
movl %r14d, %edi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xbe3c
movl 0x8(%rsp), %eax
andl $0x7f, %eax
shll $0x18, %eax
addl $0x1000000, %eax        # imm = 0x1000000
xorl %ecx, %ecx
cmpl $0x2000000, %eax        # imm = 0x2000000
setge %cl
orl %ecx, %ebp
incq %r14
cmpq %r14, %rbx
jne 0xde26
cmpl $0x0, (%r13)
je 0xde85
testl %ebp, %ebp
je 0xde85
leaq 0x14(%rsp), %rdx
xorl %edi, %edi
xorl %esi, %esi
callq 0x32f0
callq 0xbae1
addq $0x858, %rsp            # imm = 0x858
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %edi, %edi
callq 0x4eba
leaq 0xbc1e(%rip), %rax      # 0x19ac8
movq $0x0, (%rax)
movl 0xc(%rsp), %edi
movl 0x10(%r14), %esi
callq 0xc8f5
cmpl $0x1, %ebp
je 0xdecd
movl %ebp, %edi
movl %r15d, %esi
callq 0xc8f5
movl 0x10(%rsp), %edi
callq 0x3170
movq 0x20(%r14), %rdi
xorl %esi, %esi
callq 0xd3c0
callq 0xbc85
movl %eax, %edi
callq 0x3330
xorl %edi, %edi
callq 0x4eba
movl %ebp, %edi
movl %r15d, %esi
callq 0xc8f5
movq %r14, %rdi
jmp 0xdeda
nop