// File: /workspace/github_c_makefile_star2_O2/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 $0x128, %rsp            # imm = 0x128
movq %r8, 0x58(%rsp)
movq %rcx, %r13
movl %edx, %r12d
movq %rsi, 0x28(%rsp)
movq 0x160(%rsp), %rcx
testq %r9, %r9
je 0x7130
orl $-0x1, (%r9)
movq 0x168(%rsp), %rax
testq %rcx, %rcx
je 0x7140
orl $-0x1, (%rcx)
movq %r9, 0x30(%rsp)
testq %rax, %rax
je 0x714d
orl $-0x1, (%rax)
orq $-0x1, 0xc(%rsp)
movq %rdi, 0x18(%rsp)
callq 0x3530
movq %rax, 0x40(%rsp)
pushq $-0x1
popq %rdi
xorl %r14d, %r14d
pushq $0x1
popq %rax
movl %eax, %r15d
xorl %ecx, %ecx
xorl %ebp, %ebp
xorl %esi, %esi
movslq %r12d, %rbx
cmpl %r12d, %esi
jge 0x722e
movslq %esi, %r8
movq (%r13,%r8,8), %rdx
movzbl (%rdx), %r9d
cmpl $0x3c, %r9d
je 0x71d3
cmpl $0x3e, %r9d
je 0x71c6
cmpl $0x7c, %r9d
jne 0x7227
cmpb $0x0, 0x1(%rdx)
jne 0x7227
incl %edi
cmpl %edi, %esi
je 0x73d2
leal -0x1(%r12), %edx
cmpl %edx, %esi
je 0x73d2
incl %r15d
movl %esi, %edi
jmp 0x7227
cmpb $0x0, 0x1(%rdx)
jne 0x7227
movq 0x8(%r13,%r8,8), %rbp
jmp 0x71f9
movzbl 0x1(%rdx), %r9d
cmpl $0x3c, %r9d
je 0x71ec
testl %r9d, %r9d
jne 0x7227
movq 0x8(%r13,%r8,8), %r14
movl %eax, %ecx
jmp 0x71f9
cmpb $0x0, 0x2(%rdx)
jne 0x7227
movq 0x8(%r13,%r8,8), %r14
xorl %ecx, %ecx
leal -0x1(%r12), %r8d
cmpl %r8d, %esi
jge 0x72f2
leal 0x2(%rsi), %edx
movslq %edx, %rdx
cmpq %rbx, %rdx
jge 0x7221
movq (%r13,%rdx,8), %r8
movq %r8, -0x10(%r13,%rdx,8)
incq %rdx
jmp 0x720d
addl $-0x2, %r12d
decl %esi
incl %esi
jmp 0x7174
testl %r12d, %r12d
je 0x7263
testq %r14, %r14
je 0x7277
testl %ecx, %ecx
je 0x7317
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x34d0
movl %eax, (%rsp)
testl %eax, %eax
js 0x7396
movq 0x30(%rsp), %r14
jmp 0x73fa
leaq 0x212f(%rip), %rax      # 0x9399
movq 0x18(%rsp), %rcx
movq %rax, (%rcx)
jmp 0x730f
movq 0x30(%rsp), %r14
testq %r14, %r14
je 0x73de
leaq 0xc(%rsp), %rdi
callq 0x3290
testl %eax, %eax
je 0x73e6
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x31b0
leaq 0x21a6(%rip), %rsi      # 0x9451
movq $0x0, 0x20(%rsp)
movq %rbx, %rdi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x3500
pushq $-0x1
popq %r15
movq $0x0, 0x38(%rsp)
movl %r15d, %r12d
movl %r15d, 0x8(%rsp)
movq 0x28(%rsp), %r13
movq 0x168(%rsp), %rbp
movq 0x160(%rsp), %rbx
jmp 0x776b
leaq 0x2076(%rip), %rsi      # 0x936f
leaq 0x207f(%rip), %rcx      # 0x937f
movq 0x18(%rsp), %rdi
xorl %r8d, %r8d
xorl %eax, %eax
callq 0x3500
pushq $-0x1
popq %rbp
jmp 0x784e
movups 0x209d(%rip), %xmm0     # 0x93bb
leaq 0x60(%rsp), %rdi
movaps %xmm0, (%rdi)
movl $0x585858, 0xf(%rdi)    # imm = 0x585858
callq 0x3450
testl %eax, %eax
movl %eax, (%rsp)
js 0x74f4
movq %r14, %rdi
callq 0x3190
cltq
movl (%rsp), %edi
movq %r14, %rsi
movq %rax, %r14
movq %rax, %rdx
callq 0x3150
cmpq %r14, %rax
jne 0x74fd
movl (%rsp), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3220
leaq 0x20ab(%rip), %r14      # 0x941f
cmpq $-0x1, %rax
je 0x7504
leaq 0x60(%rsp), %rdi
callq 0x3090
cmpl $-0x1, %eax
jne 0x7259
jmp 0x7504
movq $0x0, 0x38(%rsp)
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x31b0
leaq 0x1efd(%rip), %rsi      # 0x92b0
leaq 0xe31(%rip), %rcx       # 0x81eb
movq %rbx, %rdi
movq %r14, %rdx
movq %rax, %r8
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x3500
jmp 0x752c
leaq 0x1f7a(%rip), %rax      # 0x9353
jmp 0x726a
pushq $-0x1
popq %rax
movl %eax, (%rsp)
jmp 0x73fa
movl 0xc(%rsp), %eax
movl %eax, (%rsp)
movl 0x10(%rsp), %eax
movl %eax, (%r14)
orq $-0x1, 0xc(%rsp)
testq %rbp, %rbp
je 0x7428
movq %rbp, %rdi
movl $0x241, %esi            # imm = 0x241
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x34d0
movl %eax, 0x8(%rsp)
testl %eax, %eax
js 0x7496
movq 0x168(%rsp), %rbp
jmp 0x7575
cmpq $0x0, 0x160(%rsp)
movq 0x168(%rsp), %rbp
je 0x7550
leaq 0xc(%rsp), %rdi
callq 0x3290
testl %eax, %eax
je 0x7559
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x31b0
leaq 0x202b(%rip), %rsi      # 0x9490
movq $0x0, 0x38(%rsp)
movq %rbx, %rdi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x3500
pushq $-0x1
popq %r12
movl %r12d, 0x8(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x28(%rsp), %r13
jmp 0x74e7
movq $0x0, 0x38(%rsp)
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x31b0
leaq 0x1fc7(%rip), %rsi      # 0x947a
leaq 0xd31(%rip), %rcx       # 0x81eb
movq %rbx, %rdi
movq %rbp, %rdx
movq %rax, %r8
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x3500
pushq $-0x1
popq %r12
movq $0x0, 0x20(%rsp)
movq 0x28(%rsp), %r13
movq 0x168(%rsp), %rbp
movq 0x160(%rsp), %rbx
jmp 0x7762
leaq 0x1ed3(%rip), %r14      # 0x93ce
jmp 0x7504
leaq 0x1ef3(%rip), %r14      # 0x93f7
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x31b0
movq $0x0, 0x38(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x3500
pushq $-0x1
popq %r12
movl %r12d, 0x8(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x28(%rsp), %r13
movq 0x168(%rsp), %rbp
jmp 0x7755
pushq $-0x1
popq %rax
movl %eax, 0x8(%rsp)
jmp 0x7575
movl 0xc(%rsp), %eax
movl 0x10(%rsp), %ecx
movl %ecx, 0x8(%rsp)
movq 0x160(%rsp), %rcx
movl %eax, (%rcx)
orq $-0x1, 0xc(%rsp)
testq %rbp, %rbp
je 0x75c6
movups 0x1f2d(%rip), %xmm0     # 0x94ae
leaq 0x60(%rsp), %rdi
movaps %xmm0, (%rdi)
movl $0x585858, 0x10(%rdi)   # imm = 0x585858
callq 0x3450
leaq 0x1f26(%rip), %r14      # 0x94c2
cmpl $-0x1, %eax
je 0x771b
movl %eax, %r14d
movl %eax, %edi
callq 0x3280
testl %eax, %eax
je 0x78b7
movl %r14d, %r12d
leaq 0x1f01(%rip), %r14      # 0x94c2
jmp 0x771f
pushq $-0x1
popq %rax
movl %eax, 0x4(%rsp)
shll $0x2, %r15d
leaq 0x1d02(%rip), %rdx      # 0x92da
movq 0x40(%rsp), %rdi
movq %r15, %rsi
movl $0x2a8, %ecx            # imm = 0x2A8
callq 0x34b0
movq %rax, %rcx
xorl %ebp, %ebp
movabsq $0x100000000, %rsi      # imm = 0x100000000
xorl %r14d, %r14d
movl (%rsp), %r15d
movq %rax, 0x20(%rsp)
cmpl %r12d, %r14d
jge 0x7862
movslq %r14d, %rdx
movq %rdx, %rax
shlq $0x20, %rax
movq %rdx, %r14
movl %r15d, (%rsp)
movq %rbp, 0x38(%rsp)
cmpq %r14, %rbx
je 0x7645
movq (%r13,%r14,8), %rcx
cmpb $0x7c, (%rcx)
jne 0x763d
cmpb $0x0, 0x1(%rcx)
je 0x76e3
incq %r14
addq %rsi, %rax
jmp 0x7624
andq $0x0, (%r13,%rbx,8)
movl %r12d, %r14d
movl 0x8(%rsp), %eax
movl %eax, 0x14(%rsp)
movq %rdx, 0x50(%rsp)
movq (%r13,%rdx,8), %rdx
movq 0x18(%rsp), %rbp
movq %rbp, %rdi
movq 0x28(%rsp), %r15
movq %r15, %rsi
callq 0x3560
movq %rax, 0x48(%rsp)
movq %rbp, %rdi
movq %r15, %rsi
callq 0x3350
cmpl $-0x1, %eax
je 0x786c
testl %eax, %eax
movl (%rsp), %edi
je 0x7968
movq 0x38(%rsp), %rbp
movq 0x20(%rsp), %rcx
movl %eax, (%rcx,%rbp,4)
cmpl $-0x1, %edi
je 0x76b0
callq 0x3280
movl 0x14(%rsp), %edi
cmpl $-0x1, %edi
je 0x76be
callq 0x3280
movl 0xc(%rsp), %r15d
orq $-0x1, 0xc(%rsp)
incq %rbp
incl %r14d
movq 0x20(%rsp), %rcx
movabsq $0x100000000, %rsi      # imm = 0x100000000
jmp 0x7605
sarq $0x1d, %rax
andq $0x0, (%r13,%rax)
cmpl %r14d, %r12d
je 0x764e
movq %rdx, %r15
leaq 0xc(%rsp), %rdi
callq 0x3290
testl %eax, %eax
jne 0x7921
movl 0x10(%rsp), %eax
movl %eax, 0x14(%rsp)
movq %r15, %rdx
jmp 0x7656
pushq $-0x1
popq %r12
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x31b0
movq $0x0, 0x38(%rsp)
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x3500
movq $0x0, 0x20(%rsp)
movq 0x28(%rsp), %r13
movq 0x160(%rsp), %rbx
movq 0x30(%rsp), %r14
movl (%rsp), %r15d
testq %r14, %r14
je 0x777c
movl (%r14), %edi
cmpl $-0x1, %edi
je 0x777c
callq 0x3280
orl $-0x1, (%r14)
testq %rbx, %rbx
je 0x7790
movl (%rbx), %edi
cmpl $-0x1, %edi
je 0x7790
callq 0x3280
orl $-0x1, (%rbx)
testq %rbp, %rbp
je 0x77a6
movl (%rbp), %edi
cmpl $-0x1, %edi
je 0x77a6
callq 0x3280
orl $-0x1, (%rbp)
movl 0xc(%rsp), %edi
cmpl $-0x1, %edi
je 0x77b4
callq 0x3280
movl 0x10(%rsp), %edi
cmpl $-0x1, %edi
je 0x77c2
callq 0x3280
pushq $-0x1
popq %rbp
movq 0x20(%rsp), %rsi
testq %rsi, %rsi
je 0x7824
movl %r12d, 0x4(%rsp)
movl 0x38(%rsp), %ebx
shlq $0x2, %rbx
xorl %r12d, %r12d
pushq $0x1
popq %r14
cmpq %r12, %rbx
je 0x7809
cmpl $-0x1, (%rsi,%r12)
je 0x7803
leaq (%rsi,%r12), %rdx
movq %r13, %rdi
movl %r14d, %esi
callq 0x32a0
movq 0x20(%rsp), %rsi
addq $0x4, %r12
jmp 0x77e3
leaq 0x1aca(%rip), %rdx      # 0x92da
movq 0x40(%rsp), %rdi
movl $0x31b, %ecx            # imm = 0x31B
callq 0x31f0
movl 0x4(%rsp), %r12d
cmpl $-0x1, %r15d
je 0x7832
movl %r15d, %edi
callq 0x3280
movl 0x8(%rsp), %edi
cmpl $-0x1, %edi
je 0x7840
callq 0x3280
cmpl $-0x1, %r12d
je 0x784e
movl %r12d, %edi
callq 0x3280
movl %ebp, %eax
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x58(%rsp), %rax
movq %rcx, (%rax)
jmp 0x781f
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x31b0
leaq 0x1cab(%rip), %rsi      # 0x952b
movq %rbx, %rdi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x3500
movq 0x28(%rsp), %r13
movq 0x168(%rsp), %rbp
movq 0x160(%rsp), %rbx
movq 0x30(%rsp), %r14
movl (%rsp), %r15d
movl 0x4(%rsp), %r12d
jmp 0x7766
leaq 0x60(%rsp), %rdi
movl $0x241, %esi            # imm = 0x241
movl $0x180, %edx            # imm = 0x180
xorl %eax, %eax
callq 0x34d0
movl %eax, 0x4(%rsp)
testl %eax, %eax
js 0x7917
leaq 0x60(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x34d0
movl %eax, (%rbp)
testl %eax, %eax
leaq 0x1bd1(%rip), %r14      # 0x94c2
js 0x790d
leaq 0x60(%rsp), %rdi
callq 0x3090
cmpl $-0x1, %eax
jne 0x75cd
leaq 0x1bde(%rip), %r14      # 0x94eb
movl 0x4(%rsp), %r12d
jmp 0x771f
movl 0x4(%rsp), %r12d
jmp 0x75ba
movq 0x18(%rsp), %rbx
movq %rbx, %rdi
callq 0x31b0
leaq 0x1bdf(%rip), %rsi      # 0x9514
movq %rbx, %rdi
movq %rax, %rdx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x3500
movq 0x28(%rsp), %r13
movq 0x168(%rsp), %rbp
movq 0x160(%rsp), %rbx
movq 0x30(%rsp), %r14
movl 0x4(%rsp), %r12d
jmp 0x7762
movl %edi, %ebx
cmpl $-0x1, %edi
je 0x797d
movl %ebx, %edi
xorl %esi, %esi
callq 0x31d0
cmpl $-0x1, %eax
je 0x79ad
cmpl $-0x1, 0x14(%rsp)
je 0x7995
pushq $0x1
popq %rsi
movl 0x14(%rsp), %edi
callq 0x31d0
cmpl $-0x1, %eax
je 0x79ad
cmpl $-0x1, 0x4(%rsp)
je 0x79c5
pushq $0x2
popq %rsi
movl 0x4(%rsp), %edi
callq 0x31d0
cmpl $-0x1, %eax
jne 0x79c5
movl 0x4(%rsp), %eax
testl %eax, %eax
pushq $0x2
popq %rdi
cmovnsl %eax, %edi
leaq 0x1b89(%rip), %rsi      # 0x9549
pushq $0x2c
popq %rdx
jmp 0x7a32
movl %ebx, %ebp
movl 0x14(%rsp), %eax
cmpl %ebx, %eax
cmovgl %eax, %ebp
movl 0x4(%rsp), %eax
cmpl %ebp, %eax
cmovgl %eax, %ebp
pushq $0x3
popq %rbx
cmpl %ebp, %ebx
jg 0x79eb
movl %ebx, %edi
callq 0x3280
incl %ebx
jmp 0x79dc
movq 0x50(%rsp), %rax
leaq (,%rax,8), %rbx
addq %r13, %rbx
movq 0x48(%rsp), %rdi
movq %rbx, %rsi
callq 0x3550
movq (%rbx), %rdx
leaq 0x1b64(%rip), %rsi      # 0x9576
leaq 0x60(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3590
movq %rbx, %rdi
callq 0x3190
pushq $0x2
popq %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x3150
pushq $0x1
popq %rdi
callq 0x30d0