// File: /workspace/github_c_makefile_star2_O2/inflex[P]ripMIME/uuencode.c
// Function: UUENCODE_decode_uu
int UUENCODE_decode_uu( FFGET_FILE *f, char *unpackdir, char *input_filename, char *out_filename, int out_filename_size, int decode_whole_file, int keep )
{
	int filename_found = 0;
	char buf[ UUENCODE_STRLEN_MAX ];
	char *bp = buf, *fn, *fp;
	int n, i, expected;
	char fullpath[ UUENCODE_STRLEN_MAX ]="";
	struct PLD_strtok tx;
	unsigned char *writebuffer = NULL;
	unsigned char *wbpos;
	int wbcount = 0;
	int loop = 0;
	int buflen = 0;
	int filecount = 0;
	FFGET_FILE ffinf;	// Local static FFGET struct used if *f is  NULL
	FFGET_FILE *finf;	// Points to either *f or &ffinf
	FILE *outf;
	int outfo =0; 			// set if outfile was opened.
	FILE *inf = NULL;
	int output_filename_supplied = 0;
	int start_found = 0;

	if ((out_filename != NULL))
	{
		if ((out_filename[0] != '\0'))
		{
			output_filename_supplied = 1;
		}
	}

	bp = buf;

	if (UUENCODE_DNORMAL) LOGGER_log("%s:%d:UUENCODE_decode_uu:DEBUG: Starting.(input=%s,output=%s)\n", FL, input_filename,out_filename );


	// If no FFGET_FILE param is passed to us directly, then we must create out own.

	if (!f)
	{
		if (UUENCODE_DNORMAL) LOGGER_log("%s:%d:UUENCODE_decode_uu:DEBUG: NULL FFGET source stream given to us, create our own.\n",FL);

		// Setup the full source-data file path.
		snprintf(fullpath, sizeof(fullpath),"%s", input_filename );

		if (UUENCODE_DNORMAL) LOGGER_log("%s:%d:UUENCODE_decode_uu:DEBUG: Full INPUT file path set as '%s'\n", FL, fullpath);

		inf = fopen(fullpath,"r");
		if (!inf)
		{
			LOGGER_log("%s:%d:UUENCODE_decode_uu:ERROR: Cannot open file '%s' for reading (%s)", FL, fullpath, strerror(errno));
			uuencode_error = UUENCODE_STATUS_CANNOT_OPEN_FILE;
			return -1;
		}

		FFGET_setstream(&ffinf, inf);
		FFGET_set_watch_SDL( glb.doubleCR_mode );
		finf = &ffinf;

		if (UUENCODE_DNORMAL) LOGGER_log("%s:%d:UUENCODE_decode_uu:DEBUG: Creation done. [FFGET-FILE=%p, FILE=%p]\n", FL, finf, inf);
	} else {
		if (UUENCODE_DNORMAL) LOGGER_log("%s:%d:UUENCODE_decode_uu:DEBUG: File handle already exists to read from, using",FL);	
		finf = f;
	}

	writebuffer = malloc( UUENCODE_WRITE_BUFFER_SIZE *sizeof(unsigned char));
	if (!writebuffer)
	{
		LOGGER_log("%s:%d:UUENCODE_decode_uu:ERROR: cannot allocate 100K of memory for the write buffer",FL);
		uuencode_error = UUENCODE_STATUS_CANNOT_ALLOCATE_MEMORY;
		return -1;
	}
	else {
		wbpos = writebuffer;
		wbcount = 0;
	}


	if (UUENCODE_DNORMAL) LOGGER_log("%s:%d:UUENCODE_decode_uu:DEBUG: Beginning.(%s)\n",FL,fullpath);


	while (!FFGET_feof(finf))
	{
		filename_found = 0;


		// First lets locate the BEGIN line of this UUDECODE file

		//		if (output_filename_supplied == 0)

		if (1) /** 20041105-23H00:PLD: Stepan Kasal - UUbegin patch **/
		{

			while (FFGET_fgets(buf, sizeof(buf), finf))
			{

				if (UUENCODE_DNORMAL) LOGGER_log("%s:%d:UUENCODE_decode_uu:DEBUG: BUFFER: \n%s\n", FL, buf);

				// Check for the presence of 'BEGIN', but make sure it's not followed by a 
				//		colon ( which indicates a VCARD instead of UUENCODE

				if ((strncasecmp(buf,"begin",5)==0)&&(buf[5] !=':')&&(isspace((int)buf[5])))
				{
					if (UUENCODE_DNORMAL) LOGGER_log("%s:%d:UUENCODE_decode_uu:DEBUG: Located BEGIN\n",FL);
					// Okay, so the line contains begin at the start, now, lets get the decode details
					fp = fn = NULL;

					bp = PLD_strtok(&tx, buf, " \n\r\t"); // Get the begin

					if (UUENCODE_DNORMAL) LOGGER_log("%s:%d:UUENCODE_decode_uu:DEBUG: BEGIN = '%s'\n", FL, bp);
					if (bp) fp = PLD_strtok(&tx, NULL, " \n\r\t"); // Get the file-permissions

					if (UUENCODE_DNORMAL) LOGGER_log("%s:%d:UUENCODE_decode_uu:DEBUG: Permissions/Name = '%s'\n", FL, fp);
					if (fp) fn = PLD_strtok(&tx, NULL, "\n\r"); // Get the file-name

					if (UUENCODE_DNORMAL) LOGGER_log("%s:%d:UUENCODE_decode_uu:DEBUG: Name = '%s'\n", FL, fn);

					if (!fn)
					{
						bp = fp;
					}
					else bp = fn;

					if ((!bp)&&(!f))
					{
						LOGGER_log("%s:%d:UUENCODE_decode_uu:WARNING: unable to obtain filename from UUencoded text file header", FL);
						if (writebuffer) free(writebuffer);
						fclose(inf);
						uuencode_error = UUENCODE_STATUS_CANNOT_FIND_FILENAME;
						return -1;
					}

					if (UUENCODE_DNORMAL) LOGGER_log("%s:%d:UUENCODE_decode_uu:DEBUG: Full path = (%s)\n",FL,bp);

					filename_found = 1;
					break;
				} // If line starts with BEGIN

			} // While more lines in the INPUT file.

		}

		/** 20041105-23H02:PLD: Stepan Kasal Patch **/
		// Filename from header has precedence:
		if (output_filename_supplied != 0)
		{
			filename_found = 1;
			bp = out_filename;
			if (UUENCODE_DNORMAL) LOGGER_log("%s:%d:UUENCODE_decode_uu:DEBUG: Output filename set to '%s'",FL, bp);
		}




		// If we have a filename, and we have our bp as NON-null, then we shall commence
		//	to decode the UUencoded data from the stream.

		if ((filename_found != 0)&&(bp))
		{
			if (UUENCODE_DNORMAL) LOGGER_log("%s:%d:UUENCODE_decode_uu:DEBUG: Located filename (%s), now decoding.\n", FL, bp);

			// Clean up the file name
			FNFILTER_filter( bp, out_filename_size );

			// If our filename wasn't supplied via the params, then copy it over here
			if (output_filename_supplied == 0) snprintf( out_filename, out_filename_size, "%s", bp );


			// Create the new output full path

			snprintf(fullpath, sizeof(fullpath), "%s/%s", unpackdir, bp );
			if (UUENCODE_DNORMAL) LOGGER_log("%s:%d:UUENCODE_decode_uu:DEBUG: Filename = (%s)\n", FL, fullpath);

			outf = fopen(fullpath, "wb");
			if (!outf)
			{
				LOGGER_log("%s:%d:UUENCODE_decode_uu:ERROR: Cannot open file '%s' (%s)", FL, fullpath,strerror(errno));
				if (writebuffer) free(writebuffer);
				uuencode_error = UUENCODE_STATUS_CANNOT_OPEN_FILE;
				return -1;
			}
			else outfo = 1;

			// Allocate the write buffer.  By using the write buffer we gain an additional 10% in performance
			// due to the lack of function call (fwrite) overheads

			// Okay, now we have the UUDECODE data to decode...

			wbcount = 0;
			wbpos = writebuffer;

			while (outf)
			{

				// for each input line
				FFGET_fgets(buf, sizeof(buf), finf);
				if (UUENCODE_DPEDANTIC) LOGGER_log("%s:%d:UUENCODE_decode_uu:DEBUG: Read line:\n%s",FL,buf);
				if (FFGET_feof(finf) != 0)
				{
					if (UUENCODE_DNORMAL) LOGGER_log("%s:%d:UUENCODE_decode_uu:WARNING: Short file (%s)\n",FL, fullpath);
					if (writebuffer != NULL) free(writebuffer);
					uuencode_error = UUENCODE_STATUS_SHORT_FILE;
					return -1;
				}

				// If we've reached the end of the UUencoding

				if (strncasecmp(buf,"end",3)==0)
				{
					if (UUENCODE_DNORMAL) LOGGER_log("%s:%d:UUENCODE_decode_uu:DEBUG: End of UUencoding detected\n",FL);
					break;
				}

				if ( !strpbrk(buf,"\r\n") )
				{
					LOGGER_log("%s:%d:UUENCODE_decode_uu:WARNING: Excessive length line\n",FL);
				}

				// The first char of the line indicates how many bytes are to be expected

				n = uudec[(int)*buf];


				// If the line is a -blank- then break out.

				if ((start_found == 0)&&((*buf == '\n')||(*buf == '\r'))) continue;
				else start_found =1 ;

				if ((start_found != 0)&&((n <= 0) || (*buf == '\n'))) break;

				// Calculate expected # of chars and pad if necessary

				expected = ((n+2)/3)<<2;
				buflen = strlen(buf) -1;
				for (i = buflen; i <= expected; i++) buf[i] = ' ';
				bp = &buf[1];

				// Decode input buffer to output file.

				while (n > 0)
				{
					// In order to reduce function call overheads, we've bought the UUDecoding
					// bit shifting routines into the UUDecode main decoding routines. This should
					// save us about 250,000 function calls per Mb.
					// UUENCODE_outdec(bp, outf, n);

					char c[3];
					int m = n;

					c[0] = uudec[(int)*bp] << 2 | uudec[(int)*(bp+1)] >> 4;
					c[1] = uudec[(int)*(bp+1)] << 4 | uudec[(int)*(bp+2)] >> 2;
					c[2] = uudec[(int)*(bp+2)] << 6 | uudec[(int)*(bp+3)];

					if (m > 3) m = 3;

					if ( wbcount >= UUENCODE_WRITE_BUFFER_LIMIT )
					{
						size_t bc;
						bc = fwrite(writebuffer, 1, wbcount, outf);
						if (bc != wbcount) {
							LOGGER_log("%s:%d:ERROR: Attempted to write %ld bytes, only wrote %ld\n", FL, wbcount, bc);
						}
						wbpos = writebuffer;
						wbcount = 0;
					}

					// Transfer the decoded data to the write buffer.
					// The reason why we use a loop, rather than just a set of if
					// statements is just for code-viewing simplicity.  It's a lot
					// easier to read than some nested chain of if's

					for (loop = 0; loop < m; loop++)
					{
						*wbpos = c[loop];
						wbpos++;
						wbcount++;
					}

					bp += 4;
					n -= 3;

				} // while (n > 0)

			} // While (1)

			if ((outfo)&&(wbcount > 0))
			{
				size_t bc;
				bc = fwrite(writebuffer, 1, wbcount, outf);
				if (bc != wbcount) {
					LOGGER_log("%s:%d:ERROR: Attempted to write %ld bytes, only wrote %ld\n", FL, wbcount, bc);
				}

			}


			if (outfo) fclose(outf);
			// Call our reporting function, else, if no function is defined, use the default
			//		standard call

			if ((UUENCODE_VERBOSE) && (output_filename_supplied == 0))
			{
				if (glb.filename_decoded_report == NULL)
				{
					LOGGER_log("Decoded: %s\n", fullpath);
				} else {
					glb.filename_decoded_report( fullpath, (glb.verbosity_contenttype>0?"uuencoded":NULL) );
				}
			}

			filecount++;

		} // If valid filename was found for UUdecode

		else
		{
			out_filename[0] = '\0';
			if (UUENCODE_DNORMAL) LOGGER_log("%s:%d:UUENCODE_decode_uu:DEBUG: No FILENAME was found in data...\n",FL);
		}

		if (UUENCODE_DNORMAL) LOGGER_log("%s:%d:UUENCODE_decode_uu:DEBUG: Segment completed\n",FL);

		// If this file was a result of the x-uuencode content encoding, then we need to exit out
		// as we're reading in the -stream-, and we dont want to carry on reading because we'll
		// end up just absorbing email data which we weren't supposed to.

		if ((f)&&( !decode_whole_file )) break;


	} // While !feof(inf)



	if (writebuffer) free(writebuffer);

	if (UUENCODE_DNORMAL) LOGGER_log("%s:%d:UUENCODE_decode_uu:DEBUG: Completed\n",FL);

	if (inf) fclose(inf);


	return filecount;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28e8, %rsp           # imm = 0x28E8
movl %r9d, %r12d
movl %r8d, 0x2c(%rsp)
movq %rcx, %r13
movq %rdx, %r14
movq %rsi, 0x58(%rsp)
movq %rdi, %r15
leaq 0x470(%rsp), %rdi
movl $0x400, %edx            # imm = 0x400
xorl %esi, %esi
callq 0x2170
testq %r13, %r13
je 0xd449
cmpb $0x0, (%r13)
sete 0x6(%rsp)
jmp 0xd44e
movb $0x1, 0x6(%rsp)
cmpl $0x0, 0x2152b(%rip)     # 0x2e980
jle 0xd477
leaq 0xa061(%rip), %rdi      # 0x174bf
leaq 0x9f64(%rip), %rsi      # 0x173c9
movl $0x189, %edx            # imm = 0x189
movq %r14, %rcx
movq %r13, %r8
xorl %eax, %eax
callq 0xc2a1
movl 0x21503(%rip), %eax     # 0x2e980
testq %r15, %r15
je 0xd4ab
testl %eax, %eax
jle 0xd58e
leaq 0xa196(%rip), %rdi      # 0x17627
leaq 0x9f31(%rip), %rsi      # 0x173c9
xorl %ebp, %ebp
movl $0x1a5, %edx            # imm = 0x1A5
xorl %eax, %eax
callq 0xc2a1
jmp 0xd590
testl %eax, %eax
jle 0xd4c9
leaq 0xa048(%rip), %rdi      # 0x174fe
leaq 0x9f0c(%rip), %rsi      # 0x173c9
movl $0x190, %edx            # imm = 0x190
xorl %eax, %eax
callq 0xc2a1
leaq 0x9b90(%rip), %rdx      # 0x17060
leaq 0x470(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
movq %r14, %rcx
xorl %eax, %eax
callq 0x2140
cmpl $0x0, 0x21492(%rip)     # 0x2e980
jle 0xd512
leaq 0xa05e(%rip), %rdi      # 0x17555
leaq 0x9ecb(%rip), %rsi      # 0x173c9
leaq 0x470(%rsp), %rcx
movl $0x195, %edx            # imm = 0x195
xorl %eax, %eax
callq 0xc2a1
leaq 0x7feb(%rip), %rsi      # 0x15504
leaq 0x470(%rsp), %rdi
callq 0x2350
testq %rax, %rax
movb 0x6(%rsp), %r14b
je 0xdcd6
movq %rax, %rbp
leaq 0x878(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x7573
movl 0x21450(%rip), %edi     # 0x2e9a0
callq 0x73dc
cmpl $0x0, 0x21424(%rip)     # 0x2e980
jle 0xdd68
leaq 0xa075(%rip), %rdi      # 0x175de
leaq 0x9e59(%rip), %rsi      # 0x173c9
leaq 0x878(%rsp), %rcx
movl $0x1a3, %edx            # imm = 0x1A3
movq %rcx, 0x20(%rsp)
movq %rbp, %r8
xorl %eax, %eax
callq 0xc2a1
jmp 0xd59a
xorl %ebp, %ebp
movq %r15, 0x20(%rsp)
movb 0x6(%rsp), %r14b
movl $0x1000, %edi           # imm = 0x1000
callq 0x22a0
movq %rax, 0x10(%rsp)
testq %rax, %rax
je 0xdcb0
movq %rbp, 0x38(%rsp)
cmpl $0x0, 0x213c2(%rip)     # 0x2e980
jle 0xd5e2
leaq 0xa103(%rip), %rdi      # 0x176ca
leaq 0x9dfb(%rip), %rsi      # 0x173c9
leaq 0x470(%rsp), %rcx
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0xc2a1
movslq 0x2c(%rsp), %rax
movq %rax, 0x40(%rsp)
movq %r15, 0x50(%rsp)
testq %r15, %r15
sete %al
testl %r12d, %r12d
setne %cl
orb %al, %cl
movb %cl, 0x7(%rsp)
leaq 0x70(%rsp), %rbx
leaq 0x9dba(%rip), %r12      # 0x173c9
movl $0x0, 0x28(%rsp)
movq %rbx, 0x18(%rsp)
xorl %ebp, %ebp
movq 0x20(%rsp), %r15
movq %r13, 0x48(%rsp)
movb %r14b, 0x6(%rsp)
movq %r15, %rdi
callq 0x7606
testl %eax, %eax
jne 0xdd26
movq %rbx, %rdi
movl $0x400, %esi            # imm = 0x400
movq %r15, %rdx
callq 0x76f2
testq %rax, %rax
je 0xd72f
cmpl $0x0, 0x21323(%rip)     # 0x2e980
jle 0xd678
leaq 0xa094(%rip), %rdi      # 0x176fa
movq %r12, %rsi
movl $0x1c8, %edx            # imm = 0x1C8
movq %rbx, %rcx
xorl %eax, %eax
callq 0xc2a1
movq %rbx, %rdi
leaq 0x9d06(%rip), %rsi      # 0x17388
pushq $0x5
popq %rdx
callq 0x22b0
testl %eax, %eax
sete %cl
movb 0x75(%rsp), %al
cmpb $0x3a, %al
setne %dl
andb %cl, %dl
cmpb $0x1, %dl
jne 0xd63d
movsbq %al, %rbx
callq 0x23f0
movq (%rax), %rax
testb $0x20, 0x1(%rax,%rbx,2)
leaq 0x70(%rsp), %rbx
je 0xd63d
cmpl $0x0, 0x212c2(%rip)     # 0x2e980
jle 0xd6d6
leaq 0xa060(%rip), %rdi      # 0x17727
movq %r12, %rsi
movl $0x1cf, %edx            # imm = 0x1CF
xorl %eax, %eax
callq 0xc2a1
leaq 0x60(%rsp), %rdi
movq %rbx, %rsi
leaq 0x7be1(%rip), %rdx      # 0x152c6
callq 0xbb88
movq %rax, %r15
cmpl $0x0, 0x2128c(%rip)     # 0x2e980
jle 0xd70f
leaq 0xa059(%rip), %rdi      # 0x17756
movq %r12, %rsi
movl $0x1d5, %edx            # imm = 0x1D5
movq %r15, %rcx
xorl %eax, %eax
callq 0xc2a1
movq %r13, %r14
testq %r15, %r15
je 0xd736
leaq 0x60(%rsp), %rdi
xorl %esi, %esi
leaq 0x7ba1(%rip), %rdx      # 0x152c6
callq 0xbb88
movq %rax, %r13
jmp 0xd739
xorl %eax, %eax
jmp 0xd7ee
xorl %r13d, %r13d
cmpl $0x0, 0x21240(%rip)     # 0x2e980
movq %r13, %r15
jle 0xd75e
leaq 0xa038(%rip), %rdi      # 0x17784
movq %r12, %rsi
movl $0x1d8, %edx            # imm = 0x1D8
movq %r15, %rcx
xorl %eax, %eax
callq 0xc2a1
testq %r15, %r15
je 0xd77b
leaq 0x60(%rsp), %rdi
xorl %esi, %esi
leaq 0x960c(%rip), %rdx      # 0x16d7d
callq 0xbb88
movq %rax, %r15
jmp 0xd77e
xorl %r15d, %r15d
cmpl $0x0, 0x211fb(%rip)     # 0x2e980
jle 0xd7a0
leaq 0xa02f(%rip), %rdi      # 0x177bd
movq %r12, %rsi
movl $0x1db, %edx            # imm = 0x1DB
movq %r15, %rcx
xorl %eax, %eax
callq 0xc2a1
testq %r15, %r15
cmovneq %r15, %r13
movq 0x50(%rsp), %rax
movq %r13, 0x18(%rsp)
orq %r13, %rax
je 0xddb2
cmpl $0x0, 0x211bf(%rip)     # 0x2e980
jle 0xd7de
leaq 0xa07c(%rip), %rdi      # 0x17846
movq %r12, %rsi
movl $0x1ec, %edx            # imm = 0x1EC
movq 0x18(%rsp), %rcx
xorl %eax, %eax
callq 0xc2a1
pushq $0x1
popq %rax
movq 0x20(%rsp), %r15
movq %r14, %r13
movb 0x6(%rsp), %r14b
testb %r14b, %r14b
jne 0xd825
cmpl $0x0, 0x21186(%rip)     # 0x2e980
movq %r13, 0x18(%rsp)
pushq $0x1
popq %rax
jle 0xd825
leaq 0xa06d(%rip), %rdi      # 0x17878
movq %r12, %rsi
movl $0x1fc, %edx            # imm = 0x1FC
movq %r13, %rcx
xorl %eax, %eax
callq 0xc2a1
movq %r13, 0x18(%rsp)
pushq $0x1
popq %rax
testl %eax, %eax
je 0xdb24
cmpq $0x0, 0x18(%rsp)
je 0xdb24
movl %r14d, %ebx
movq %r13, %r14
cmpl $0x0, 0x2113a(%rip)     # 0x2e980
movq 0x18(%rsp), %r13
jle 0xd866
leaq 0xa060(%rip), %rdi      # 0x178b4
movq %r12, %rsi
movl $0x207, %edx            # imm = 0x207
movq %r13, %rcx
xorl %eax, %eax
callq 0xc2a1
movq %r13, %rdi
movl 0x2c(%rsp), %esi
callq 0xdf02
testb %bl, %bl
leaq 0x470(%rsp), %rbx
je 0xd897
movq %r14, %rdi
movq 0x40(%rsp), %rsi
leaq 0x97d3(%rip), %rdx      # 0x17060
movq %r13, %rcx
xorl %eax, %eax
callq 0x2140
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdi
leaq 0x3b66(%rip), %rdx      # 0x1140c
movq 0x58(%rsp), %rcx
movq %r13, %r8
xorl %eax, %eax
callq 0x2140
cmpl $0x0, 0x210c4(%rip)     # 0x2e980
jle 0xd8d7
leaq 0xa035(%rip), %rdi      # 0x178fa
movq %r12, %rsi
movl $0x213, %edx            # imm = 0x213
movq %rbx, %rcx
xorl %eax, %eax
callq 0xc2a1
movq %rbx, %rdi
leaq 0xa04a(%rip), %rsi      # 0x1792b
callq 0x2350
movq %rax, 0x30(%rsp)
testq %rax, %rax
je 0xdd72
movq %r14, %r13
movl $0x0, 0x8(%rsp)
movq 0x10(%rsp), %rbx
leaq 0x70(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
movq %r15, %rdx
callq 0x76f2
cmpl $0xa, 0x21063(%rip)     # 0x2e980
jl 0xd93a
leaq 0xa043(%rip), %rdi      # 0x17969
movq %r12, %rsi
movl $0x22c, %edx            # imm = 0x22C
leaq 0x70(%rsp), %rcx
xorl %eax, %eax
callq 0xc2a1
movq %r15, %rdi
callq 0x7606
testl %eax, %eax
jne 0xdc6f
leaq 0x70(%rsp), %r12
movq %r12, %rdi
leaq 0xa071(%rip), %rsi      # 0x179ca
pushq $0x3
popq %rdx
callq 0x22b0
testl %eax, %eax
je 0xdb51
movq %r12, %rdi
leaq 0x68f4(%rip), %rsi      # 0x14267
callq 0x2300
testq %rax, %rax
leaq 0x9a47(%rip), %r12      # 0x173c9
jne 0xd99a
leaq 0xa07f(%rip), %rdi      # 0x17a0a
movq %r12, %rsi
movl $0x23f, %edx            # imm = 0x23F
xorl %eax, %eax
callq 0xc2a1
movsbq 0x70(%rsp), %rax
testl %ebp, %ebp
jne 0xd9ba
xorl %ebp, %ebp
cmpb $0xa, %al
je 0xd904
movzbl %al, %ecx
cmpl $0xd, %ecx
je 0xd904
cmpb $0xa, %al
je 0xdc67
leaq 0xa177(%rip), %rcx      # 0x17b40
movb (%rax,%rcx), %al
testb %al, %al
je 0xdc67
movzbl %al, %r12d
leal 0x2(%r12), %eax
xorl %edx, %edx
movw $0x3, %cx
divw %cx
movl %eax, %r13d
shll $0x2, %r13d
leaq 0x70(%rsp), %rdi
callq 0x2110
decl %eax
cltq
movzwl %r13w, %ecx
movl 0x8(%rsp), %r8d
cmpq %rcx, %rax
jg 0xda13
movb $0x20, 0x70(%rsp,%rax)
incq %rax
jmp 0xda04
leaq 0x71(%rsp), %r14
testl %r12d, %r12d
jle 0xdb06
movsbq (%r14), %rax
leaq 0xa114(%rip), %rsi      # 0x17b40
movb (%rax,%rsi), %al
shlb $0x2, %al
movsbq 0x1(%r14), %rcx
movb (%rcx,%rsi), %cl
movl %ecx, %edx
shrb $0x4, %dl
orb %al, %dl
movb %dl, 0xd(%rsp)
shlb $0x4, %cl
movsbq 0x2(%r14), %rax
movb (%rax,%rsi), %al
movl %eax, %edx
shrb $0x2, %dl
orb %cl, %dl
movb %dl, 0xe(%rsp)
shlb $0x6, %al
movsbq 0x3(%r14), %rcx
orb (%rcx,%rsi), %al
movb %al, 0xf(%rsp)
cmpl $0x3, %r12d
pushq $0x3
popq %r13
cmovbl %r12d, %r13d
cmpl $0xfa0, %r8d            # imm = 0xFA0
jl 0xdad2
movl %r8d, %ebp
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
pushq $0x1
popq %rsi
movq %rbp, %rdx
movq 0x30(%rsp), %rcx
movl %r8d, 0x8(%rsp)
callq 0x23a0
xorl %r15d, %r15d
cmpq %rbp, %rax
je 0xdad5
xorl %r15d, %r15d
leaq 0x9f92(%rip), %rdi      # 0x17a43
leaq 0x9911(%rip), %rsi      # 0x173c9
movl $0x26c, %edx            # imm = 0x26C
movl 0x8(%rsp), %ecx
movq %rax, %r8
xorl %eax, %eax
callq 0xc2a1
movq 0x10(%rsp), %rbx
jmp 0xdad5
movl %r8d, %r15d
movl %r13d, %ecx
xorl %eax, %eax
cmpq %rcx, %rax
jae 0xdaeb
movb 0xd(%rsp,%rax), %dl
movb %dl, (%rbx,%rax)
incq %rax
jmp 0xdada
addq $0x4, %r14
addl $-0x3, %r12d
addq %rax, %rbx
addl %eax, %r15d
movl %r15d, %r8d
movq 0x20(%rsp), %r15
jmp 0xda18
movl %r8d, 0x8(%rsp)
movq %r14, 0x18(%rsp)
pushq $0x1
popq %rbp
movq 0x48(%rsp), %r13
leaq 0x98aa(%rip), %r12      # 0x173c9
jmp 0xd904
movb $0x0, (%r13)
cmpl $0x0, 0x20e50(%rip)     # 0x2e980
jle 0xdc57
leaq 0x9f58(%rip), %rdi      # 0x17a95
movq %r12, %rsi
movl $0x2a5, %edx            # imm = 0x2A5
xorl %eax, %eax
callq 0xc2a1
jmp 0xdc38
cmpl $0x0, 0x20e28(%rip)     # 0x2e980
jle 0xdb7e
leaq 0x9e6d(%rip), %rdi      # 0x179ce
leaq 0x9861(%rip), %r12      # 0x173c9
movq %r12, %rsi
movl $0x239, %edx            # imm = 0x239
xorl %eax, %eax
callq 0xc2a1
leaq 0x70(%rsp), %rbx
jmp 0xdb8a
leaq 0x70(%rsp), %rbx
leaq 0x983f(%rip), %r12      # 0x173c9
movl 0x8(%rsp), %eax
testl %eax, %eax
jle 0xdbcc
movl %eax, %r14d
movq 0x10(%rsp), %rdi
pushq $0x1
popq %rsi
movq %r14, %rdx
movq 0x30(%rsp), %rcx
callq 0x23a0
movl 0x8(%rsp), %ecx
cmpq %r14, %rax
je 0xdbcc
leaq 0x9e89(%rip), %rdi      # 0x17a43
movq %r12, %rsi
movl $0x28a, %edx            # imm = 0x28A
movq %rax, %r8
xorl %eax, %eax
callq 0xc2a1
movq 0x30(%rsp), %rdi
callq 0x20f0
cmpl $0x0, 0x20dab(%rip)     # 0x2e988
setle %al
movb 0x6(%rsp), %r14b
movl %r14d, %ecx
xorb $0x1, %cl
orb %al, %cl
jne 0xdc34
movq 0x20db2(%rip), %rax     # 0x2e9a8
testq %rax, %rax
je 0xdc1e
cmpl $0x0, 0x20d8e(%rip)     # 0x2e990
movl $0x0, %esi
leaq 0x9e7d(%rip), %rcx      # 0x17a8b
cmovgq %rcx, %rsi
leaq 0x470(%rsp), %rdi
callq *%rax
jmp 0xdc34
leaq 0x9e59(%rip), %rdi      # 0x17a7e
leaq 0x470(%rsp), %rsi
xorl %eax, %eax
callq 0xc2a1
incl 0x28(%rsp)
cmpl $0x0, 0x20d41(%rip)     # 0x2e980
jle 0xdc57
leaq 0x9e8f(%rip), %rdi      # 0x17ad7
movq %r12, %rsi
movl $0x2a8, %edx            # imm = 0x2A8
xorl %eax, %eax
callq 0xc2a1
cmpb $0x0, 0x7(%rsp)
jne 0xd62d
jmp 0xdd26
pushq $0x1
popq %rbp
jmp 0xdb77
cmpl $0x0, 0x20d0a(%rip)     # 0x2e980
jle 0xdc9a
leaq 0x9d18(%rip), %rdi      # 0x17997
leaq 0x9743(%rip), %rsi      # 0x173c9
leaq 0x470(%rsp), %rcx
movl $0x22f, %edx            # imm = 0x22F
xorl %eax, %eax
callq 0xc2a1
movq 0x10(%rsp), %rdi
callq 0x2030
movl $0x64, 0x20d02(%rip)    # 0x2e9b0
jmp 0xdd11
leaq 0x99bf(%rip), %rdi      # 0x17676
leaq 0x970b(%rip), %rsi      # 0x173c9
movl $0x1ac, %edx            # imm = 0x1AC
xorl %eax, %eax
callq 0xc2a1
movl $0x66, 0x20cdc(%rip)    # 0x2e9b0
jmp 0xdd11
callq 0x2060
movl (%rax), %edi
callq 0x23c0
leaq 0x98ae(%rip), %rdi      # 0x17597
leaq 0x96d9(%rip), %rsi      # 0x173c9
leaq 0x470(%rsp), %rcx
movl $0x19a, %edx            # imm = 0x19A
movq %rax, %r8
xorl %eax, %eax
callq 0xc2a1
movl $0x65, 0x20c9f(%rip)    # 0x2e9b0
pushq $-0x1
popq %rax
addq $0x28e8, %rsp           # imm = 0x28E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x10(%rsp), %rdi
callq 0x2030
cmpl $0x0, 0x20c49(%rip)     # 0x2e980
jle 0xdd53
leaq 0x9dca(%rip), %rdi      # 0x17b0a
leaq 0x9682(%rip), %rsi      # 0x173c9
movl $0x2b7, %edx            # imm = 0x2B7
xorl %eax, %eax
callq 0xc2a1
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0xdd62
callq 0x20f0
movl 0x28(%rsp), %eax
jmp 0xdd14
movq %rbx, 0x20(%rsp)
jmp 0xd59a
callq 0x2060
movl (%rax), %edi
callq 0x23c0
leaq 0x9ba9(%rip), %rdi      # 0x1792e
leaq 0x963d(%rip), %rsi      # 0x173c9
leaq 0x470(%rsp), %rcx
movl $0x218, %edx            # imm = 0x218
movq %rax, %r8
xorl %eax, %eax
callq 0xc2a1
movq 0x10(%rsp), %rdi
callq 0x2030
jmp 0xdd07
leaq 0x9a31(%rip), %rdi      # 0x177ea
leaq 0x9609(%rip), %rsi      # 0x173c9
movl $0x1e5, %edx            # imm = 0x1E5
xorl %eax, %eax
callq 0xc2a1
movq 0x10(%rsp), %rdi
callq 0x2030
movq 0x38(%rsp), %rdi
callq 0x20f0
movl $0x67, 0x20bc6(%rip)    # 0x2e9b0
jmp 0xdd11
nop