// File: /workspace/github_c_makefile_star2_O3/haxlang[P]hax/haxUnixUtil.c
// Function: Hax_CreatePipeline
int
Hax_CreatePipeline(
    Hax_Interp *interp,		/* Interpreter to use for error reporting. */
    ClientData clientData,	/* Unix Client Data */
    int argc,			/* Number of entries in argv. */
    char **argv,		/* Array of strings describing commands in
				 * pipeline plus I/O redirection with <,
				 * <<, and >.  Argv[argc] must be NULL. */
    int **pidArrayPtr,		/* Word at *pidArrayPtr gets filled in with
				 * address of array of pids for processes
				 * in pipeline (first pid is first process
				 * in pipeline). */
    int *inPipePtr,		/* If non-NULL, input to the pipeline comes
				 * from a pipe (unless overridden by
				 * redirection in the command).  The file
				 * id with which to write to this pipe is
				 * stored at *inPipePtr.  -1 means command
				 * specified its own input source. */
    int *outPipePtr,		/* If non-NULL, output to the pipeline goes
				 * to a pipe, unless overriden by redirection
				 * in the command.  The file id with which to
				 * read frome this pipe is stored at
				 * *outPipePtr.  -1 means command specified
				 * its own output sink. */
    int *errFilePtr		/* If non-NULL, all stderr output from the
				 * pipeline will go to a temporary file
				 * created here, and a descriptor to read
				 * the file will be left at *errFilePtr.
				 * The file will be removed already, so
				 * closing this descriptor will be the end
				 * of the file.  If this is NULL, then
				 * all stderr output goes to our stderr. */)
{
    Hax_Memoryp *memoryp;
    int *pidPtr = NULL;		/* Points to malloc-ed array holding all
				 * the pids of child processes. */
    int numPids = 0;		/* Actual number of processes that exist
				 * at *pidPtr right now. */
    int cmdCount;		/* Count of number of distinct commands
				 * found in argc/argv. */
    char *input = NULL;		/* Describes input for pipeline, depending
				 * on "inputFile".  NULL means take input
				 * from stdin/pipe. */
    int inputFile = 0;		/* Non-zero means input is name of input
				 * file.  Zero means input holds actual
				 * text to be input to command. */
    char *output = NULL;	/* Holds name of output file to pipe to,
				 * or NULL if output goes to stdout/pipe. */
    int inputId = -1;		/* Readable file id input to current command in
				 * pipeline (could be file or pipe).  -1
				 * means use stdin. */
    int outputId = -1;		/* Writable file id for output from current
				 * command in pipeline (could be file or pipe).
				 * -1 means use stdout. */
    int errorId = -1;		/* Writable file id for all standard error
				 * output from all commands in pipeline.  -1
				 * means use stderr. */
    int lastOutputId = -1;	/* Write file id for output from last command
				 * in pipeline (could be file or pipe).
				 * -1 means use stdout. */
    int pipeIds[2];		/* File ids for pipe that's being created. */
    int firstArg, lastArg;	/* Indexes of first and last arguments in
				 * current command. */
    int lastBar;
    char *execName;
    int i, j, pid;

    if (inPipePtr != NULL) {
	*inPipePtr = -1;
    }
    if (outPipePtr != NULL) {
	*outPipePtr = -1;
    }
    if (errFilePtr != NULL) {
	*errFilePtr = -1;
    }
    pipeIds[0] = pipeIds[1] = -1;

    memoryp = Hax_GetMemoryp(interp);

    /*
     * First, scan through all the arguments to figure out the structure
     * of the pipeline.  Count the number of distinct processes (it's the
     * number of "|" arguments).  If there are "<", "<<", or ">" arguments
     * then make note of input and output redirection and remove these
     * arguments and the arguments that follow them.
     */

    cmdCount = 1;
    lastBar = -1;
    for (i = 0; i < argc; i++) {
	if ((argv[i][0] == '|') && ((argv[i][1] == 0))) {
	    if ((i == (lastBar+1)) || (i == (argc-1))) {
		interp->result = (char *) "illegal use of | in command";
		return -1;
	    }
	    lastBar = i;
	    cmdCount++;
	    continue;
	} else if (argv[i][0] == '<') {
	    if (argv[i][1] == 0) {
		input = argv[i+1];
		inputFile = 1;
	    } else if ((argv[i][1] == '<') && (argv[i][2] == 0)) {
		input = argv[i+1];
		inputFile = 0;
	    } else {
		continue;
	    }
	} else if ((argv[i][0] == '>') && (argv[i][1] == 0)) {
	    output = argv[i+1];
	} else {
	    continue;
	}
	if (i >= (argc-1)) {
	    Hax_AppendResult(interp, "can't specify \"", argv[i],
		    "\" as last word in command", (char *) NULL);
	    return -1;
	}
	for (j = i+2; j < argc; j++) {
	    argv[j-2] = argv[j];
	}
	argc -= 2;
	i--;			/* Process new arg from same position. */
    }
    if (argc == 0) {
	interp->result = (char *) "didn't specify command to execute";
	return -1;
    }

    /*
     * Set up the redirected input source for the pipeline, if
     * so requested.
     */

    if (input != NULL) {
	if (!inputFile) {
	    /*
	     * Immediate data in command.  Create temporary file and
	     * put data into file.
	     */

#	    define TMP_STDIN_NAME "/tmp/hax.in.XXXXXX"
	    char inName[sizeof(TMP_STDIN_NAME) + 1];
	    int length;

	    strcpy(inName, TMP_STDIN_NAME);
	    inputId = mkstemp(inName);
	    if (inputId < 0) {
		Hax_AppendResult(interp,
			"couldn't create input file for command: ",
			Hax_UnixError(interp), (char *) NULL);
		goto error;
	    }
	    length = strlen(input);
	    if (write(inputId, input, length) != length) {
		Hax_AppendResult(interp,
			"couldn't write file input for command: ",
			Hax_UnixError(interp), (char *) NULL);
		goto error;
	    }
	    if ((lseek(inputId, 0L, 0) == -1) || (unlink(inName) == -1)) {
		Hax_AppendResult(interp,
			"couldn't reset or remove input file for command: ",
			Hax_UnixError(interp), (char *) NULL);
		goto error;
	    }
	} else {
	    /*
	     * File redirection.  Just open the file.
	     */

	    inputId = open(input, O_RDONLY, 0);
	    if (inputId < 0) {
		Hax_AppendResult(interp,
			"couldn't read file \"", input, "\": ",
			Hax_UnixError(interp), (char *) NULL);
		goto error;
	    }
	}
    } else if (inPipePtr != NULL) {
	if (pipe(pipeIds) != 0) {
	    Hax_AppendResult(interp,
		    "couldn't create input pipe for command: ",
		    Hax_UnixError(interp), (char *) NULL);
	    goto error;
	}
	inputId = pipeIds[0];
	*inPipePtr = pipeIds[1];
	pipeIds[0] = pipeIds[1] = -1;
    }

    /*
     * Set up the redirected output sink for the pipeline from one
     * of two places, if requested.
     */

    if (output != NULL) {
	/*
	 * Output is to go to a file.
	 */

	lastOutputId = open(output, O_WRONLY|O_CREAT|O_TRUNC, 0666);
	if (lastOutputId < 0) {
	    Hax_AppendResult(interp,
		    "couldn't write file \"", output, "\": ",
		    Hax_UnixError(interp), (char *) NULL);
	    goto error;
	}
    } else if (outPipePtr != NULL) {
	/*
	 * Output is to go to a pipe.
	 */

	if (pipe(pipeIds) != 0) {
	    Hax_AppendResult(interp,
		    "couldn't create output pipe: ",
		    Hax_UnixError(interp), (char *) NULL);
	    goto error;
	}
	lastOutputId = pipeIds[1];
	*outPipePtr = pipeIds[0];
	pipeIds[0] = pipeIds[1] = -1;
    }

    /*
     * Set up the standard error output sink for the pipeline, if
     * requested.  Use a temporary file which is opened, then deleted.
     * Could potentially just use pipe, but if it filled up it could
     * cause the pipeline to deadlock:  we'd be waiting for processes
     * to complete before reading stderr, and processes couldn't complete
     * because stderr was backed up.
     */

    if (errFilePtr != NULL) {
#	define TMP_STDERR_NAME "/tmp/hax.err.XXXXXX"
	char errName[sizeof(TMP_STDERR_NAME) + 1];

	strcpy(errName, TMP_STDERR_NAME);

	/*
	 * mktemp() usage warns on NetBSD as it is an insecure function.
	 * Fake it with mkstemp()+close() to pacify the warning. The I/O
	 * mechanism should be certainly done in a better way.
	 */
	if ((errorId = mkstemp(errName)) == -1 || close(errorId)) {
	    goto errFileError;
	}
	errorId = open(errName, O_WRONLY|O_CREAT|O_TRUNC, 0600);
	if (errorId < 0) {
	    errFileError:
	    Hax_AppendResult(interp,
		    "couldn't create error file for command: ",
		    Hax_UnixError(interp), (char *) NULL);
	    goto error;
	}
	*errFilePtr = open(errName, O_RDONLY, 0);
	if (*errFilePtr < 0) {
	    goto errFileError;
	}
	if (unlink(errName) == -1) {
	    Hax_AppendResult(interp,
		    "couldn't remove error file for command: ",
		    Hax_UnixError(interp), (char *) NULL);
	    goto error;
	}
    }

    /*
     * Scan through the argc array, forking off a process for each
     * group of arguments between "|" arguments.
     */

    pidPtr = (int *) ckalloc(memoryp, (unsigned) (cmdCount * sizeof(int)));
    for (i = 0; i < numPids; i++) {
	pidPtr[i] = -1;
    }
    for (firstArg = 0; firstArg < argc; numPids++, firstArg = lastArg+1) {
	for (lastArg = firstArg; lastArg < argc; lastArg++) {
	    if ((argv[lastArg][0] == '|') && (argv[lastArg][1] == 0)) {
		break;
	    }
	}
	argv[lastArg] = NULL;
	if (lastArg == argc) {
	    outputId = lastOutputId;
	} else {
	    if (pipe(pipeIds) != 0) {
		Hax_AppendResult(interp, "couldn't create pipe: ",
			Hax_UnixError(interp), (char *) NULL);
		goto error;
	    }
	    outputId = pipeIds[1];
	}
	execName = Hax_TildeSubst(interp, clientData, argv[firstArg]);
	pid = Hax_Fork(interp, clientData);
	if (pid == -1) {
	    Hax_AppendResult(interp, "couldn't fork child process: ",
		    Hax_UnixError(interp), (char *) NULL);
	    goto error;
	}
	if (pid == 0) {
	    char errSpace[200];

	    if (((inputId != -1) && (dup2(inputId, 0) == -1))
		    || ((outputId != -1) && (dup2(outputId, 1) == -1))
		    || ((errorId != -1) && (dup2(errorId, 2) == -1))) {
		char *err;
		err = (char *) "forked process couldn't set up input/output\n";
		write(errorId < 0 ? 2 : errorId, err, strlen(err));
		_exit(1);
	    }
	    for (i = 3; (i <= outputId) || (i <= inputId) || (i <= errorId);
		    i++) {
		close(i);
	    }
	    execvp(execName, &argv[firstArg]);
	    sprintf(errSpace, "couldn't find \"%.150s\" to execute\n",
		    argv[firstArg]);
	    write(2, errSpace, strlen(errSpace));
	    _exit(1);
	} else {
	    pidPtr[numPids] = pid;
	}

	/*
	 * Close off our copies of file descriptors that were set up for
	 * this child, then set up the input for the next child.
	 */

	if (inputId != -1) {
	    close(inputId);
	}
	if (outputId != -1) {
	    close(outputId);
	}
	inputId = pipeIds[0];
	pipeIds[0] = pipeIds[1] = -1;
    }
    *pidArrayPtr = pidPtr;

    /*
     * All done.  Cleanup open files lying around and then return.
     */

cleanup:
    if (inputId != -1) {
	close(inputId);
    }
    if (lastOutputId != -1) {
	close(lastOutputId);
    }
    if (errorId != -1) {
	close(errorId);
    }
    return numPids;

    /*
     * An error occurred.  There could have been extra files open, such
     * as pipes between children.  Clean them all up.  Detach any child
     * processes that have been created.
     */

    error:
    if ((inPipePtr != NULL) && (*inPipePtr != -1)) {
	close(*inPipePtr);
	*inPipePtr = -1;
    }
    if ((outPipePtr != NULL) && (*outPipePtr != -1)) {
	close(*outPipePtr);
	*outPipePtr = -1;
    }
    if ((errFilePtr != NULL) && (*errFilePtr != -1)) {
	close(*errFilePtr);
	*errFilePtr = -1;
    }
    if (pipeIds[0] != -1) {
	close(pipeIds[0]);
    }
    if (pipeIds[1] != -1) {
	close(pipeIds[1]);
    }
    if (pidPtr != NULL) {
	for (i = 0; i < numPids; i++) {
	    if (pidPtr[i] != -1) {
		Hax_DetachPids(clientData, 1, &pidPtr[i]);
	    }
	}
	ckfree(memoryp, (char *) pidPtr);
    }
    numPids = -1;
    goto cleanup;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %r8, 0x68(%rsp)
movq %rcx, %rbp
movl %edx, %r14d
movq %rsi, %r13
movq 0x170(%rsp), %rcx
testq %r9, %r9
je 0x7296
movl $0xffffffff, (%r9)      # imm = 0xFFFFFFFF
movq 0x178(%rsp), %rax
testq %rcx, %rcx
je 0x72a9
movl $0xffffffff, (%rcx)     # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x72b4
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movq %r9, 0x30(%rsp)
movq $-0x1, 0x18(%rsp)
movq %rdi, 0x20(%rsp)
callq 0x3540
movq %rax, 0x50(%rsp)
testl %r14d, %r14d
jle 0x742d
movl $0x1, %r15d
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
xorl %ecx, %ecx
xorl %r12d, %r12d
xorl %eax, %eax
xorl %ebx, %ebx
movslq %ecx, %rdi
movq (%rbp,%rdi,8), %rdx
movzbl (%rdx), %r8d
cmpl $0x3c, %r8d
je 0x7344
cmpl $0x3e, %r8d
je 0x7337
cmpl $0x7c, %r8d
jne 0x73b1
cmpb $0x0, 0x1(%rdx)
jne 0x73b1
incl %esi
cmpl %esi, %ecx
je 0x766c
leal -0x1(%r14), %edx
cmpl %edx, %ecx
je 0x766c
incl %r15d
movl %ecx, %esi
jmp 0x73b1
cmpb $0x0, 0x1(%rdx)
jne 0x73b1
movq 0x8(%rbp,%rdi,8), %r12
jmp 0x736d
movzbl 0x1(%rdx), %r8d
cmpl $0x3c, %r8d
je 0x7360
testl %r8d, %r8d
jne 0x73b1
movq 0x8(%rbp,%rdi,8), %rbx
movl $0x1, %eax
jmp 0x736d
cmpb $0x0, 0x2(%rdx)
jne 0x73b1
movq 0x8(%rbp,%rdi,8), %rbx
xorl %eax, %eax
leal -0x1(%r14), %edi
cmpl %edi, %ecx
jge 0x74d9
leal 0x2(%rcx), %edx
cmpl %r14d, %edx
jge 0x73ab
movslq %edx, %rdx
leaq (,%rdx,8), %rdx
addq %rbp, %rdx
movl %r14d, %edi
subl %ecx, %edi
addl $-0x2, %edi
xorl %r8d, %r8d
movq (%rdx,%r8,8), %r9
movq %r9, -0x10(%rdx,%r8,8)
incq %r8
cmpl %r8d, %edi
jne 0x739a
addl $-0x2, %r14d
decl %ecx
incl %ecx
cmpl %r14d, %ecx
jl 0x72ee
testl %r14d, %r14d
je 0x74bc
shll $0x2, %r15d
testq %rbx, %rbx
je 0x743c
testl %eax, %eax
je 0x75e7
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x34e0
movq %rax, 0x10(%rsp)
testl %eax, %eax
jns 0x751d
movq $0x0, 0x40(%rsp)
movq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0x31b0
leaq 0x1ea2(%rip), %rsi      # 0x92b0
leaq 0xdd6(%rip), %rcx       # 0x81eb
movq %r14, %rdi
movq %rbx, %rdx
movq %rax, %r8
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x3510
jmp 0x793a
je 0x74bc
movl $0x4, %r15d
xorl %r12d, %r12d
cmpq $0x0, 0x30(%rsp)
je 0x74cd
leaq 0x18(%rsp), %rdi
callq 0x32a0
testl %eax, %eax
je 0x7500
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x31b0
leaq 0x1fe3(%rip), %rsi      # 0x9451
movq $0x0, 0x28(%rsp)
movq %rbx, %rdi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x3510
movl $0xffffffff, 0xc(%rsp)  # imm = 0xFFFFFFFF
movq $0x0, 0x40(%rsp)
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movq 0x178(%rsp), %rbx
movq 0x170(%rsp), %r14
movq 0x30(%rsp), %r15
jmp 0x796f
leaq 0x1ed6(%rip), %rax      # 0x9399
movq 0x20(%rsp), %rcx
movq %rax, (%rcx)
jmp 0x74f6
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movq %rax, 0x10(%rsp)
jmp 0x751d
leaq 0x1e8f(%rip), %rsi      # 0x936f
leaq 0x1e98(%rip), %rcx      # 0x937f
movq 0x20(%rsp), %rdi
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x3510
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x7a4f
movl 0x18(%rsp), %eax
movq %rax, 0x10(%rsp)
movl 0x1c(%rsp), %eax
movq 0x30(%rsp), %rcx
movl %eax, (%rcx)
movq $-0x1, 0x18(%rsp)
testq %r12, %r12
je 0x7583
movq %r12, %rdi
movl $0x241, %esi            # imm = 0x241
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x34e0
movl %eax, 0xc(%rsp)
testl %eax, %eax
jns 0x7680
movq $0x0, 0x40(%rsp)
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x31b0
leaq 0x1f1b(%rip), %rsi      # 0x947a
leaq 0xc85(%rip), %rcx       # 0x81eb
movq %rbx, %rdi
movq %r12, %rdx
movq %rax, %r8
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x3510
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x7947
cmpq $0x0, 0x170(%rsp)
je 0x7678
leaq 0x18(%rsp), %rdi
callq 0x32a0
testl %eax, %eax
movq 0x10(%rsp), %r12
je 0x78e7
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x31b0
leaq 0x1ed3(%rip), %rsi      # 0x9490
movq $0x0, 0x40(%rsp)
movq %rbx, %rdi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x3510
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0xffffffff, 0xc(%rsp)  # imm = 0xFFFFFFFF
jmp 0x7839
movups 0x1dcd(%rip), %xmm0     # 0x93bb
leaq 0x70(%rsp), %rdi
movaps %xmm0, (%rdi)
movl $0x585858, 0xf(%rdi)    # imm = 0x585858
callq 0x3460
testl %eax, %eax
movq %rax, 0x10(%rsp)
js 0x78de
movq %rbx, %rdi
callq 0x3190
cltq
movq 0x10(%rsp), %rdi
movq %rbx, %rsi
movq %rax, %rbx
movq %rax, %rdx
callq 0x3150
cmpq %rbx, %rax
jne 0x790b
movq 0x10(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3220
leaq 0x1dd5(%rip), %rbx      # 0x941f
cmpq $-0x1, %rax
je 0x7912
leaq 0x70(%rsp), %rdi
callq 0x3090
cmpl $-0x1, %eax
jne 0x751d
jmp 0x7912
leaq 0x1ce0(%rip), %rax      # 0x9353
jmp 0x74c3
movl $0xffffffff, 0xc(%rsp)  # imm = 0xFFFFFFFF
movq 0x10(%rsp), %r12
cmpq $0x0, 0x178(%rsp)
je 0x76da
movups 0x1e17(%rip), %xmm0     # 0x94ae
leaq 0x70(%rsp), %rdi
movaps %xmm0, (%rdi)
movl $0x585858, 0x10(%rdi)   # imm = 0x585858
callq 0x3460
leaq 0x1e10(%rip), %rbx      # 0x94c2
cmpl $-0x1, %eax
je 0x780c
movl %eax, %ebx
movl %eax, %edi
callq 0x3290
testl %eax, %eax
je 0x7874
movl %ebx, %ebp
leaq 0x1ded(%rip), %rbx      # 0x94c2
jmp 0x7811
movl $0xffffffff, 0x8(%rsp)  # imm = 0xFFFFFFFF
leaq 0x1bf1(%rip), %rdx      # 0x92da
movq 0x50(%rsp), %rdi
movq %r15, %rsi
movl $0x2a8, %ecx            # imm = 0x2A8
callq 0x34c0
movq %rax, 0x28(%rsp)
testl %r14d, %r14d
jle 0x785c
movq %r13, 0x48(%rsp)
movl %r14d, %r13d
xorl %ebx, %ebx
xorl %r15d, %r15d
movslq %r15d, %rdx
leal 0x1(%rdx), %r15d
cmpl %r15d, %r14d
cmovgl %r14d, %r15d
movq %rdx, %rax
movq %r12, 0x10(%rsp)
movq (%rbp,%rax,8), %rcx
cmpb $0x7c, (%rcx)
jne 0x773c
cmpb $0x0, 0x1(%rcx)
je 0x7746
incq %rax
cmpq %r13, %rax
jl 0x772c
jmp 0x7749
movl %eax, %r15d
movslq %r15d, %rax
movq $0x0, (%rbp,%rax,8)
movl 0xc(%rsp), %ecx
cmpl %r14d, %eax
movq %rbx, 0x40(%rsp)
je 0x777f
movq %rdx, %r12
leaq 0x18(%rsp), %rdi
callq 0x32a0
testl %eax, %eax
jne 0x7a82
movl 0x1c(%rsp), %ecx
movq %r12, %rdx
movl %ecx, 0x3c(%rsp)
movq %rdx, 0x60(%rsp)
movq (%rbp,%rdx,8), %rdx
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
movq 0x48(%rsp), %r12
movq %r12, %rsi
callq 0x3570
movq %rax, 0x58(%rsp)
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3360
cmpl $-0x1, %eax
je 0x7a63
testl %eax, %eax
movq 0x10(%rsp), %rdi
je 0x7acd
movq 0x40(%rsp), %rbx
movq 0x28(%rsp), %rcx
movl %eax, (%rcx,%rbx,4)
cmpl $-0x1, %edi
je 0x77df
callq 0x3290
movl 0x3c(%rsp), %edi
cmpl $-0x1, %edi
je 0x77ed
callq 0x3290
movl 0x18(%rsp), %r12d
movq $-0x1, 0x18(%rsp)
incq %rbx
incl %r15d
cmpl %r14d, %r15d
jl 0x7716
jmp 0x785e
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0x31b0
movq $0x0, 0x40(%rsp)
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x3510
movq $0x0, 0x28(%rsp)
movq 0x178(%rsp), %rbx
movq 0x170(%rsp), %r14
movq 0x30(%rsp), %r15
jmp 0x796a
xorl %ebx, %ebx
movq 0x68(%rsp), %rax
movq 0x28(%rsp), %rcx
movq %rcx, (%rax)
movl 0x8(%rsp), %ebp
jmp 0x7a27
leaq 0x70(%rsp), %rdi
movl $0x241, %esi            # imm = 0x241
movl $0x180, %edx            # imm = 0x180
xorl %eax, %eax
callq 0x34e0
movl %eax, 0x8(%rsp)
testl %eax, %eax
js 0x7a79
leaq 0x70(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x34e0
movq 0x178(%rsp), %rcx
movl %eax, (%rcx)
testl %eax, %eax
leaq 0x1c09(%rip), %rbx      # 0x94c2
js 0x78d5
leaq 0x70(%rsp), %rdi
callq 0x3090
cmpl $-0x1, %eax
jne 0x76e2
leaq 0x1c16(%rip), %rbx      # 0x94eb
movl 0x8(%rsp), %ebp
jmp 0x7811
leaq 0x1ae9(%rip), %rbx      # 0x93ce
jmp 0x7912
movl 0x18(%rsp), %eax
movl 0x1c(%rsp), %ecx
movl %ecx, 0xc(%rsp)
movq 0x170(%rsp), %rcx
movl %eax, (%rcx)
movq $-0x1, 0x18(%rsp)
jmp 0x7685
leaq 0x1ae5(%rip), %rbx      # 0x93f7
movq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0x31b0
movq $0x0, 0x40(%rsp)
movq %r14, %rdi
movq %rbx, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x3510
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl $0xffffffff, 0xc(%rsp)  # imm = 0xFFFFFFFF
movq $0x0, 0x28(%rsp)
movq 0x178(%rsp), %rbx
movq 0x170(%rsp), %r14
movq 0x30(%rsp), %r15
movq 0x10(%rsp), %r12
testq %r15, %r15
je 0x7983
movl (%r15), %edi
cmpl $-0x1, %edi
je 0x7983
callq 0x3290
movl $0xffffffff, (%r15)     # imm = 0xFFFFFFFF
testq %r14, %r14
je 0x799c
movl (%r14), %edi
cmpl $-0x1, %edi
je 0x799c
callq 0x3290
movl $0xffffffff, (%r14)     # imm = 0xFFFFFFFF
testq %rbx, %rbx
je 0x79b3
movl (%rbx), %edi
cmpl $-0x1, %edi
je 0x79b3
callq 0x3290
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
movl 0x18(%rsp), %edi
cmpl $-0x1, %edi
je 0x79c1
callq 0x3290
movl 0x1c(%rsp), %edi
cmpl $-0x1, %edi
je 0x79cf
callq 0x3290
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpq $0x0, 0x28(%rsp)
je 0x7a27
movq 0x40(%rsp), %rax
testl %eax, %eax
je 0x7a0c
movl %eax, %r15d
movq 0x28(%rsp), %r14
cmpl $-0x1, (%r14)
je 0x7a03
movq %r13, %rdi
movl $0x1, %esi
movq %r14, %rdx
callq 0x32b0
addq $0x4, %r14
decq %r15
jne 0x79ed
leaq 0x18c7(%rip), %rdx      # 0x92da
movq 0x50(%rsp), %rdi
movq 0x28(%rsp), %rsi
movl $0x31b, %ecx            # imm = 0x31B
callq 0x31f0
cmpl $-0x1, %r12d
je 0x7a35
movl %r12d, %edi
callq 0x3290
movl 0xc(%rsp), %edi
cmpl $-0x1, %edi
je 0x7a43
callq 0x3290
cmpl $-0x1, %ebp
je 0x7a4f
movl %ebp, %edi
callq 0x3290
movl %ebx, %eax
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x31b0
leaq 0x1ab4(%rip), %rsi      # 0x952b
jmp 0x7a96
movl 0x8(%rsp), %ebp
jmp 0x76ce
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x31b0
leaq 0x1a7e(%rip), %rsi      # 0x9514
movq %rbx, %rdi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x3510
movq 0x48(%rsp), %r13
movq 0x178(%rsp), %rbx
movq 0x170(%rsp), %r14
movq 0x30(%rsp), %r15
movq 0x10(%rsp), %r12
movl 0x8(%rsp), %ebp
jmp 0x796a
movq %rdi, %r14
cmpl $-0x1, %edi
je 0x7ae4
movl %r14d, %edi
xorl %esi, %esi
callq 0x31d0
cmpl $-0x1, %eax
je 0x7b18
cmpl $-0x1, 0x3c(%rsp)
je 0x7afe
movl 0x3c(%rsp), %edi
movl $0x1, %esi
callq 0x31d0
cmpl $-0x1, %eax
je 0x7b18
cmpl $-0x1, 0x8(%rsp)
je 0x7b37
movl 0x8(%rsp), %edi
movl $0x2, %esi
callq 0x31d0
cmpl $-0x1, %eax
jne 0x7b37
movl 0x8(%rsp), %eax
testl %eax, %eax
movl $0x2, %edi
cmovnsl %eax, %edi
leaq 0x1a1c(%rip), %rsi      # 0x9549
movl $0x2c, %edx
jmp 0x7bbc
movl 0x3c(%rsp), %eax
cmpl %r14d, %eax
cmovgl %eax, %r14d
movl 0x8(%rsp), %eax
cmpl %r14d, %eax
cmovgl %eax, %r14d
cmpl $0x3, %r14d
jl 0x7b73
negl %r14d
movl $0x3, %ebx
movl %ebx, %edi
callq 0x3290
leal (%r14,%rbx), %eax
incl %eax
movl %ebx, %ecx
incl %ecx
movl %ecx, %ebx
cmpl $0x1, %eax
jne 0x7b5b
movq 0x60(%rsp), %rax
leaq (,%rax,8), %rbx
addq %rbp, %rbx
movq 0x58(%rsp), %rdi
movq %rbx, %rsi
callq 0x3560
movq (%rbx), %rdx
leaq 0x19dc(%rip), %rsi      # 0x9576
leaq 0x70(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x35a0
movq %rbx, %rdi
callq 0x3190
movl $0x2, %edi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x3150
movl $0x1, %edi
callq 0x30d0