// File: /workspace/github_c_makefile_star2_O2/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 0xc9b5(%rip), %rax      # 0x19bd4
cmpl $0x0, (%rax)
je 0xd230
leaq 0x14(%rsp), %rsi
xorl %edi, %edi
callq 0x32c0
pushq $0x1
popq %rbp
pushq $0x1
popq %rbx
leaq 0xc(%rsp), %r13
movl %ebp, %r15d
leaq -0x1(%rbx), %r12
testq %r14, %r14
je 0xd2bc
cmpl $0x12, (%r14)
jne 0xd2bc
cmpq $0x1ff, %r12            # imm = 0x1FF
jb 0xd262
leaq 0x650d(%rip), %rdi      # 0x1376a
callq 0x45b7
movq %r13, %rdi
callq 0x3180
testl %eax, %eax
jns 0xd281
leaq 0x5b30(%rip), %rdi      # 0x12da5
callq 0xbe9d
xorl %edi, %edi
callq 0x45b7
callq 0xc5b0
testl %eax, %eax
je 0xd379
movl %eax, %r12d
cmpl $0x1, %ebp
je 0xd29d
movl %ebp, %edi
callq 0x3170
movl %r12d, 0x4c(%rsp,%rbx,4)
movl 0xc(%rsp), %edi
movl 0x10(%rsp), %ebp
movl 0x8(%r14), %r15d
callq 0x3170
movq 0x18(%r14), %r14
incq %rbx
jmp 0xd23e
callq 0xc5b0
testl %eax, %eax
je 0xd3c7
movl %eax, %r13d
leaq 0xc7f5(%rip), %rax      # 0x19ac8
andq $0x0, (%rax)
movl %ebp, %edi
callq 0x3170
movl %r12d, %eax
movl %r13d, 0x50(%rsp,%rax,4)
movl %ebx, %edi
callq 0xb57c
xorl %r14d, %r14d
leaq 0x8(%rsp), %r15
pushq $0x1
popq %rbp
pushq $-0x1
popq %r12
xorl %r13d, %r13d
cmpq %r14, %rbx
je 0xd343
movl 0x50(%rsp,%r14,4), %edi
movq %r15, %rsi
movl %ebp, %edx
callq 0xc644
movl 0x8(%rsp), %edx
movl %r14d, %edi
movl %r12d, %esi
callq 0xb583
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, %r13d
incq %r14
jmp 0xd2ff
leaq 0xc88a(%rip), %rax      # 0x19bd4
cmpl $0x0, (%rax)
je 0xd362
testl %r13d, %r13d
je 0xd362
leaq 0x14(%rsp), %rdx
xorl %edi, %edi
xorl %esi, %esi
callq 0x32f0
callq 0xb266
addq $0x858, %rsp            # imm = 0x858
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %edi, %edi
callq 0x4c71
leaq 0xc741(%rip), %rax      # 0x19ac8
andq $0x0, (%rax)
movl 0xc(%rsp), %edi
movl 0x10(%r14), %esi
callq 0xbf88
cmpl $0x1, %ebp
je 0xd3a7
movl %ebp, %edi
movl %r15d, %esi
callq 0xbf88
movl 0x10(%rsp), %edi
callq 0x3170
movq 0x20(%r14), %rdi
xorl %esi, %esi
callq 0xc950
callq 0xb3ff
movl %eax, %edi
callq 0x3330
xorl %edi, %edi
callq 0x4c71
movl %ebp, %edi
movl %r15d, %esi
callq 0xbf88
movq %r14, %rdi
jmp 0xd3b4
nopl (%rax)