// File: /workspace/github_c_makefile_star2_O3/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 0xbff3(%rip), %r13      # 0x19bd4
cmpl $0x0, (%r13)
je 0xdbf4
leaq 0x14(%rsp), %rsi
xorl %edi, %edi
callq 0x32c0
testq %r14, %r14
je 0xdc93
movl $0x1, %r15d
leaq 0xc(%rsp), %r13
xorl %ebx, %ebx
movl $0x1, %ebp
cmpl $0x12, (%r14)
jne 0xdc8a
cmpq $0x1ff, %rbx            # imm = 0x1FF
jb 0xdc2a
leaq 0x6b79(%rip), %rdi      # 0x1479e
callq 0x46c0
movq %r13, %rdi
callq 0x3180
testl %eax, %eax
jns 0xdc49
leaq 0x619b(%rip), %rdi      # 0x13dd8
callq 0xc6dd
xorl %edi, %edi
callq 0x46c0
callq 0xce78
testl %eax, %eax
je 0xdd58
movl %eax, %r12d
cmpl $0x1, %ebp
je 0xdc65
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 0xdc0f
xorl %r14d, %r14d
leaq 0xbf43(%rip), %r13      # 0x19bd4
jmp 0xdca3
movl $0x1, %ebp
xorl %ebx, %ebx
movl $0x1, %r15d
xorl %r14d, %r14d
callq 0xce78
testl %eax, %eax
je 0xdda9
movl %eax, %r12d
leaq 0xbe0e(%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 0xbd5c
xorl %r14d, %r14d
leaq 0x8(%rsp), %r15
xorl %ebp, %ebp
movl 0x50(%rsp,%r14,4), %edi
movq %r15, %rsi
movl $0x1, %edx
callq 0xcf0f
movl 0x8(%rsp), %edx
movl %r14d, %edi
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0xbd63
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 0xdce2
cmpl $0x0, (%r13)
je 0xdd41
testl %ebp, %ebp
je 0xdd41
leaq 0x14(%rsp), %rdx
xorl %edi, %edi
xorl %esi, %esi
callq 0x32f0
callq 0xb9f9
addq $0x858, %rsp            # imm = 0x858
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %edi, %edi
callq 0x4dba
leaq 0xbd62(%rip), %rax      # 0x19ac8
movq $0x0, (%rax)
movl 0xc(%rsp), %edi
movl 0x10(%r14), %esi
callq 0xc7e5
cmpl $0x1, %ebp
je 0xdd89
movl %ebp, %edi
movl %r15d, %esi
callq 0xc7e5
movl 0x10(%rsp), %edi
callq 0x3170
movq 0x20(%r14), %rdi
xorl %esi, %esi
callq 0xd284
callq 0xbb95
movl %eax, %edi
callq 0x3330
xorl %edi, %edi
callq 0x4dba
movl %ebp, %edi
movl %r15d, %esi
callq 0xc7e5
movq %r14, %rdi
jmp 0xdd96
nop