// File: /workspace/github_c_makefile_star2_O1/salextpuru[P]speccy-toochain/src/bin2tap/bin2tap.c
// Function: main
int main (int argc, char *argv[]) {

	int	inputlen;		/* inputlen - input file lenght*/

	FILE	*foutput, *finput;	/* foutput - output file descriptor */
					/* finput - input file description */
	int	foutname_i = 0;		/* foutname_i - index to name in argv field */
	char	foutname[255];		/* foutname - output file name */
	int	finname_i = 0;		/* finname_i - index to name in argv field */

	int	checksum;		/* checksum - TAP checksum */
	int	i, in_name, no;		/* general purpose variables */

	int	address = ADDRESS;	/* address - start address of binary file */
	int	basic = 0;		/* basic - indicator of BASIC loader */
	int	clear = CLEAR;		/* clear - CLEAR value for BASIC loader */
	int	run = RUN;		/* run - address where to start binary file */
	int	cb = 0, cp = 0, ci = 7;	/* cb, cp, ci - colors for border, paper and ink*/
	int	d80 = 0;		/* d80 - indicate D80 loader */
	int	hp = 0;			/* hp - add poke for header dissable */
	char	run_name[] = "run       "; /* run_name - alternative name of basic loader */

	char	loader_template[] = "\0\x0A\x16\0\xEAloader by bin2tap1.2\x0D\
\0\x14\x12\0\xE7\xB0\"\":\xDA\xB0\"\":\xD9\xB0\"\"\x0D\
\0\x1E\x0A\0\xFD\xB0\"\"\x0D\
\0\x28\x0F\0\xF4\xB0\"23739\",\xAF\"o\"\x0D\
\0\x32\x05\0\xEF\"\xAF\x0D\
\0\x3C\x0B\0\xF9\xC0\xB0\"\"\x0D";	/* loader - fiel for BASIC loader */

	char tap[49152+115], *loader;
	int tap_index = 0;

	loader = loader_template;
	for (i = 1; i<argc; i++) {
		if (!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
			usage();
			return 0;
		}
		if (!strcmp(argv[i], "-v") || !strcmp(argv[i], "--version")) {
			version();
			return 0;
		}
		if (!strcmp(argv[i], "-o")) {
			foutname_i = ++i;
			continue;
		}
		if (!strcmp(argv[i], "-a")) {
			if (str2int(argv[++i], &address)) {
				fprintf(stderr, "After -a must follow decadic address !\n");
				return 1;
			}
			if (address > 65535) {
				fprintf(stderr, "Maximum number after -a is 65535!\n");
				return 1;
			}
			continue;
		}
		if (!strcmp(argv[i], "-b")) {
			basic = 1;
			continue;
		}
		if (!strcmp(argv[i], "-c")) {
			if (str2int(argv[++i], &clear)) {
				fprintf(stderr, "After -c must follow decadic address !\n");
				return 1;
			}
			if (clear > 65535) {
				fprintf(stderr, "Maximum number after -c is 65535!\n");
				return 1;
			}
			continue;
		}
		if (!strcmp(argv[i], "-r")) {
			if (str2int(argv[++i], &run)) {
				fprintf(stderr, "After -r must follow decadic address !\n");
				return 1;
			}
			if (run > 65535) {
				fprintf(stderr, "Maximum number after -r is 65535!\n");
				return 1;
			}
			continue;
		}
		if (!strcmp(argv[i], "-cb")) {
			if (str2int(argv[++i], &cb)) {
				fprintf(stderr, "After -cb must follow decadic address !\n");
				return 1;
			}
			if (cb > 7) {
				fprintf(stderr, "Maximum number after -cb is 7!\n");
				return 1;
			}
			continue;
		}
		if (!strcmp(argv[i], "-cp")) {
			if (str2int(argv[++i], &cp)) {
				fprintf(stderr, "After -cp must follow decadic address !\n");
				return 1;
			}
			if (cp > 65535) {
				fprintf(stderr, "Maximum number after -cp is 7!\n");
				return 1;
			}
			continue;
		}
		if (!strcmp(argv[i], "-ci")) {
			if (str2int(argv[++i], &ci)) {
				fprintf(stderr, "After -ci must follow decadic address !\n");
				return 1;
			}
			if (ci > 65535) {
				fprintf(stderr, "Maximum number after -ci is 7!\n");
				return 1;
			}
			continue;
		}
		if (!strcmp(argv[i], "-d80")) {
			d80 = 1;
			continue;
		}
		if (!strcmp(argv[i], "-hp") || !strcmp(argv[i], "--header-poke")) {
			hp = 1;
			continue;
		}
		if (!strcmp(argv[i], "-soaz") || !strcmp(argv[i], "--soaz")) {
			printf("Yebo!\n");
			return 1;
		}
		if (!finname_i)
			finname_i = i;
		else {
			fprintf(stderr, "Input only one bin. file!\n");
			return 1;
		}
	}

	if (!finname_i) {
		printf("Enter input filename!\nTry `bin2tap --help` for help.\n");
		return 1;
	}

	if (!foutname_i) {
		strncpy(foutname, argv[finname_i], 255-5);
		foutname[254-5] = '\0';
		i = strlen(foutname);
		no = 0;
		i--;
		while ((no < 4) && (i-no > 0)) {
			if (foutname[i-no] == '.') {
				foutname[i-no] = '\0';
				break;
			}
			++no;
		}
		strcat (foutname, ".tap");
	}
	else {
		strncpy(foutname, argv[foutname_i], 254);
		foutname[254] = '\0';
	}

	finput = fopen(argv[finname_i], "rb");
	if (!finput) {
		printf("Input file open failed!\n");
		return 1;
	}

	foutput = fopen(foutname, "wb+");
	if (!foutput) {
		printf("Output file open failed!\n");
		return 1;
	}

	if (basic) {
		tap_index = 110+d80;
		i = 0;
		while ((*(foutname+i) != '.' && *(foutname+i) != '\0') && i<10) {
			*(tap+tap_index+i) = *(foutname+i);
			i++;
		}
		*(tap+14) = (86+d80+i+19*hp) % 256;
		*(tap+15) = (86+d80+i+19*hp) / 256; 

		tap_index = 0;

		*(tap+tap_index++) = 19;		/* tap lenght */
		*(tap+tap_index++) = 0;
		checksum = *(tap+tap_index++) = 0;	/* 00 - header, FF - data*/
		checksum ^= *(tap+tap_index++) = 0;
		if (d80) {
			for (i = 0; i < 10; i++)
				checksum ^= *(tap+tap_index++) = *(run_name+i);
		}
		else {
			in_name = 1;
			for (i = 0; i < 10; ++i) {			/* filename  */
				if (in_name && (foutname[i] == '.' || foutname[i] == '\0'))
					in_name = 0;
				if (in_name)
					checksum ^= *(tap+tap_index++) = foutname[i];
				else
					checksum ^= *(tap+tap_index++) = ' ';
			}
		}
		checksum ^= *(tap+tap_index++);		/* lenght of data block */
		checksum ^= *(tap+tap_index++);
		checksum ^= *(tap+tap_index++) = 10;	/* param1 - autostart of BASIC */
		checksum ^= *(tap+tap_index++) = 0;
		checksum ^= *(tap+tap_index++) = *(tap+14);	/* param2 - start of variables */
		checksum ^= *(tap+tap_index++) = *(tap+15);
		*(tap+tap_index++) = checksum;

		i = *(tap+15)*256 + *(tap+14) + 2;
		*(tap+tap_index++) = i % 256;
		*(tap+tap_index++) = i / 256;
		checksum = *(tap+tap_index++) = 255;

		l_copy (tap, loader, &tap_index, &checksum, 33);
		loader += 33;
		checksum ^= *(tap+tap_index++) = '0' + cb;
		l_copy (tap, loader, &tap_index, &checksum, 5);
		loader += 5;
		checksum ^= *(tap+tap_index++) = '0' + cp;
		l_copy (tap, loader, &tap_index, &checksum, 5);
		loader += 5;
		checksum ^= *(tap+tap_index++) = '0' + ci;
		l_copy (tap, loader, &tap_index, &checksum, 9);
		loader += 9;
		checksum ^= *(tap+tap_index++) = '0' + clear/10000;
		clear -= 10000 * (clear/10000);
		checksum ^= *(tap+tap_index++) = '0' + clear/1000;
		clear -= 1000 * (clear/1000);
		checksum ^= *(tap+tap_index++) = '0' + clear/100;
		clear -= 100 * (clear/100);
		checksum ^= *(tap+tap_index++) = '0' + clear/10;
		clear -= 10 * (clear/10);
		checksum ^= *(tap+tap_index++) = '0' + clear;
		l_copy (tap, loader, &tap_index, &checksum, 2);
		loader += 2;
		if (hp)
			l_copy (tap, loader, &tap_index, &checksum, 19);
		loader += 19;
		l_copy (tap, loader, &tap_index, &checksum, 5);
		loader += 5;
		checksum ^= *(tap+tap_index-2);
		checksum ^= *(tap+tap_index-3);
		if (d80)
			checksum ^= *(tap+tap_index++) = '*';
		checksum ^= *(tap+tap_index++) = '\"';
		i = 0;
		while (((no = foutname[i]) != '.' && no != '\0') && i<10) {
			checksum ^= *(tap+tap_index++) = no;
			i++;
		}
		checksum ^= *(tap+tap_index-d80-i-4) = (i+d80+5) % 256;	/* dlzka riadku */
		checksum ^= *(tap+tap_index-d80-i-3) = (i+d80+5) / 256;
		l_copy (tap, loader, &tap_index, &checksum, 11);
		loader += 11;
		checksum ^= *(tap+tap_index++) = '0' + run/10000;
		run -= 10000 * (run/10000);
		checksum ^= *(tap+tap_index++) = '0' + run/1000;
		run -= 1000 * (run/1000);
		checksum ^= *(tap+tap_index++) = '0' + run/100;
		run -= 100 * (run/100);
		checksum ^= *(tap+tap_index++) = '0' + run/10;
		run -= 10 * (run/10);
		checksum ^= *(tap+tap_index++) = '0' + run;
		l_copy (tap, loader, &tap_index, &checksum, 2);
		loader += 2;
		*(tap+tap_index++) = checksum;
	}
	*(tap+tap_index++) = 19;	/* bytes header len */
	*(tap+tap_index++) = 0;
	*(tap+tap_index++) = 0;		/* header */
	checksum = *(tap+tap_index++) = 3;		/* bytes file */
	in_name = 1;
	for (i = 0; i < 10; ++i) {	/* filename  */
		if (in_name && (foutname[i] == '.' || foutname[i] == '\0'))
			in_name = 0;
		if (in_name)
			checksum ^= *(tap+tap_index++) = foutname[i];
		else
			checksum ^= *(tap+tap_index++) = ' ';
	}
	inputlen = fread (tap+tap_index+10, 1, 49152, finput);
	if (!feof(finput))
		printf("Warning: File exceed 49151 limit!\n");
	checksum ^= *(tap+tap_index++) = inputlen % 256;
	checksum ^= *(tap+tap_index++) = inputlen / 256;
	checksum ^= *(tap+tap_index++) = address % 256;
	checksum ^= *(tap+tap_index++) = address / 256;
	checksum ^= *(tap+tap_index++) = 0;
	checksum ^= *(tap+tap_index++) = 32768 / 256;
	*(tap+tap_index++) = checksum;

	*(tap+tap_index++) = (inputlen + 2) % 256;
	*(tap+tap_index++) = (inputlen + 2) / 256;
	checksum = *(tap+tap_index++) = 255;
	for (i = 0; i < inputlen; i++)
		checksum ^= *(tap+tap_index++);
	*(tap+tap_index++) = checksum;

	inputlen = fwrite(tap, 1, tap_index, foutput);
	if (ferror(foutput)) {
		printf("Error in save file!\n");
		return 1;
	}
	fclose(finput);
	fclose(foutput);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc1c8, %rsp           # imm = 0xC1C8
movq %rsi, %rbx
movl %edi, 0x30(%rsp)
cmpl $0x2, %edi
jl 0x18b5
movl $0x7, %eax
movq %rax, 0x10(%rsp)
movl $0x1, %r14d
movq $0x0, 0x28(%rsp)
movl $0x8000, %eax           # imm = 0x8000
movq %rax, 0x48(%rsp)
movl $0x5fff, %ebp           # imm = 0x5FFF
movq $0x0, 0x20(%rsp)
movl $0x0, 0x3c(%rsp)
movl $0x0, 0x1c(%rsp)
movl $0x0, 0x40(%rsp)
movq $0x0, (%rsp)
movq $0x0, 0x8(%rsp)
movl $0x8000, %r12d          # imm = 0x8000
movslq %r14d, %r15
movq (%rbx,%r15,8), %r13
movq %r13, %rdi
leaq 0x1bb4(%rip), %rsi      # 0x300f
callq 0x1070
testl %eax, %eax
je 0x1937
movq %r13, %rdi
leaq 0x1ba0(%rip), %rsi      # 0x3012
callq 0x1070
testl %eax, %eax
je 0x1937
movq %r13, %rdi
leaq 0x1b90(%rip), %rsi      # 0x3019
callq 0x1070
testl %eax, %eax
je 0x194c
movq %r13, %rdi
leaq 0x1b7c(%rip), %rsi      # 0x301c
callq 0x1070
testl %eax, %eax
je 0x194c
movq %r13, %rdi
leaq 0x1b6f(%rip), %rsi      # 0x3026
callq 0x1070
testl %eax, %eax
je 0x15ed
movq %r13, %rdi
leaq 0x1b5b(%rip), %rsi      # 0x3029
callq 0x1070
testl %eax, %eax
je 0x15fa
movq %r13, %rdi
leaq 0x1b92(%rip), %rsi      # 0x3077
callq 0x1070
testl %eax, %eax
je 0x1631
movq %r13, %rdi
leaq 0x1b7e(%rip), %rsi      # 0x307a
callq 0x1070
testl %eax, %eax
je 0x163e
movq %r13, %rdi
leaq 0x1bb5(%rip), %rsi      # 0x30c8
callq 0x1070
testl %eax, %eax
je 0x169c
movq %r13, %rdi
leaq 0x1bec(%rip), %rsi      # 0x3116
callq 0x1070
testl %eax, %eax
je 0x16da
movq %r13, %rdi
leaq 0x1c22(%rip), %rsi      # 0x3163
callq 0x1070
testl %eax, %eax
je 0x1746
movq %r13, %rdi
leaq 0x1c58(%rip), %rsi      # 0x31b0
callq 0x1070
testl %eax, %eax
je 0x17b4
movq %r13, %rdi
leaq 0x1c8e(%rip), %rsi      # 0x31fd
callq 0x1070
testl %eax, %eax
je 0x182b
movq %r13, %rdi
leaq 0x1c7c(%rip), %rsi      # 0x3202
callq 0x1070
testl %eax, %eax
je 0x181f
movq %r13, %rdi
leaq 0x1c69(%rip), %rsi      # 0x3206
callq 0x1070
testl %eax, %eax
je 0x181f
movq %r13, %rdi
leaq 0x1c61(%rip), %rsi      # 0x3215
callq 0x1070
testl %eax, %eax
je 0x218e
movq %r13, %rdi
leaq 0x1c49(%rip), %rsi      # 0x3214
callq 0x1070
testl %eax, %eax
je 0x218e
cmpl $0x0, 0x1c(%rsp)
movl %r14d, 0x1c(%rsp)
je 0x187b
jmp 0x21e3
incl %r14d
movl %r14d, 0x40(%rsp)
jmp 0x187b
movq 0x8(%rbx,%r15,8), %rax
movb (%rax), %dl
testb %dl, %dl
je 0x167d
incq %rax
xorl %r12d, %r12d
addb $-0x30, %dl
cmpb $0xa, %dl
setb %cl
jae 0x1682
leal (%r12,%r12,4), %edx
movsbl -0x1(%rax), %esi
leal (%rsi,%rdx,2), %r12d
addl $-0x30, %r12d
movb (%rax), %dl
incq %rax
testb %dl, %dl
jne 0x160b
jmp 0x1682
movl $0x1, 0x3c(%rsp)
jmp 0x187b
movq 0x8(%rbx,%r15,8), %rax
movb (%rax), %dl
testb %dl, %dl
je 0x1729
incq %rax
xorl %ebp, %ebp
addb $-0x30, %dl
cmpb $0xa, %dl
setb %cl
jae 0x172d
leal (%rbp,%rbp,4), %edx
movsbl -0x1(%rax), %esi
leal (%rsi,%rdx,2), %ebp
addl $-0x30, %ebp
movb (%rax), %dl
incq %rax
testb %dl, %dl
jne 0x1652
jmp 0x172d
movb $0x1, %cl
xorl %r12d, %r12d
testb %cl, %cl
je 0x2180
cmpl $0x10000, %r12d         # imm = 0x10000
jl 0x1878
jmp 0x2187
movq 0x8(%rbx,%r15,8), %rax
movb (%rax), %dl
testb %dl, %dl
je 0x1792
incq %rax
xorl %esi, %esi
addb $-0x30, %dl
cmpb $0xa, %dl
setb %cl
jae 0x1796
leal (%rsi,%rsi,4), %edx
movsbl -0x1(%rax), %esi
leal (%rsi,%rdx,2), %esi
addl $-0x30, %esi
movb (%rax), %dl
incq %rax
testb %dl, %dl
jne 0x16b0
jmp 0x1796
movq 0x8(%rbx,%r15,8), %rax
movb (%rax), %dl
testb %dl, %dl
je 0x1800
incq %rax
movq $0x0, 0x8(%rsp)
addb $-0x30, %dl
cmpb $0xa, %dl
setb %cl
jae 0x180b
movq 0x8(%rsp), %rdx
leal (%rdx,%rdx,4), %edx
movsbl -0x1(%rax), %esi
leal (%rsi,%rdx,2), %edx
addl $-0x30, %edx
movq %rdx, 0x8(%rsp)
movb (%rax), %dl
incq %rax
testb %dl, %dl
jne 0x16f5
jmp 0x180b
movb $0x1, %cl
xorl %ebp, %ebp
testb %cl, %cl
je 0x2197
cmpl $0x10000, %ebp          # imm = 0x10000
jl 0x1878
jmp 0x219e
movq 0x8(%rbx,%r15,8), %rax
movb (%rax), %dl
testb %dl, %dl
je 0x1837
incq %rax
movq $0x0, (%rsp)
addb $-0x30, %dl
cmpb $0xa, %dl
setb %cl
jae 0x1841
movq (%rsp), %rdx
leal (%rdx,%rdx,4), %edx
movsbl -0x1(%rax), %esi
leal (%rsi,%rdx,2), %edx
addl $-0x30, %edx
movq %rdx, (%rsp)
movb (%rax), %dl
incq %rax
testb %dl, %dl
jne 0x1760
jmp 0x1841
movb $0x1, %cl
xorl %esi, %esi
testb %cl, %cl
je 0x21a5
cmpl $0x10000, %esi          # imm = 0x10000
jge 0x21ac
movq %rsi, 0x48(%rsp)
jmp 0x1878
movq 0x8(%rbx,%r15,8), %rax
movb (%rax), %dl
testb %dl, %dl
je 0x1857
incq %rax
movq $0x0, 0x10(%rsp)
addb $-0x30, %dl
cmpb $0xa, %dl
setb %cl
jae 0x1862
movq 0x10(%rsp), %rdx
leal (%rdx,%rdx,4), %edx
movsbl -0x1(%rax), %esi
leal (%rsi,%rdx,2), %edx
addl $-0x30, %edx
movq %rdx, 0x10(%rsp)
movb (%rax), %dl
incq %rax
testb %dl, %dl
jne 0x17cf
jmp 0x1862
movb $0x1, %cl
movq $0x0, 0x8(%rsp)
testb %cl, %cl
je 0x21b3
cmpl $0x8, 0x8(%rsp)
jl 0x1878
jmp 0x21ba
movl $0x1, %eax
movq %rax, 0x28(%rsp)
jmp 0x187b
movl $0x1, %eax
movq %rax, 0x20(%rsp)
jmp 0x187b
movb $0x1, %cl
movq $0x0, (%rsp)
testb %cl, %cl
je 0x21c1
cmpl $0x10000, (%rsp)        # imm = 0x10000
jl 0x1878
jmp 0x21c8
movb $0x1, %cl
movq $0x0, 0x10(%rsp)
testb %cl, %cl
je 0x21cf
cmpl $0x10000, 0x10(%rsp)    # imm = 0x10000
jge 0x21d9
incl %r14d
incl %r14d
cmpl 0x30(%rsp), %r14d
jl 0x144a
cmpl $0x0, 0x3c(%rsp)
sete %r13b
movq 0x8(%rsp), %rsi
addb $0x30, %sil
movq (%rsp), %rdx
addb $0x30, %dl
movq 0x10(%rsp), %rcx
addb $0x30, %cl
movl 0x40(%rsp), %edi
movl 0x1c(%rsp), %r8d
jmp 0x18eb
xorl %edi, %edi
movl $0x5fff, %ebp           # imm = 0x5FFF
movb $0x1, %r13b
movb $0x37, %cl
movb $0x30, %sil
movl $0x8000, %r12d          # imm = 0x8000
movb $0x30, %dl
xorl %r8d, %r8d
movq $0x0, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
movl $0x8000, %eax           # imm = 0x8000
movq %rax, 0x48(%rsp)
testl %r8d, %r8d
je 0x192b
movq %rsi, 0x8(%rsp)
movq %rdx, (%rsp)
movq %rcx, 0x10(%rsp)
movslq %r8d, %r15
testl %edi, %edi
je 0x195f
movslq %edi, %rax
movq (%rbx,%rax,8), %rsi
leaq 0x50(%rsp), %r14
movl $0xfe, %edx
movq %r14, %rdi
callq 0x1040
movb $0x0, 0xfe(%r14)
jmp 0x19ca
leaq 0x1be3(%rip), %rdi      # 0x3515
jmp 0x214d
leaq 0x1904(%rip), %rdi      # 0x3242
callq 0x1090
leaq 0x1927(%rip), %rdi      # 0x3271
jmp 0x1953
leaq 0x18ef(%rip), %rdi      # 0x3242
callq 0x1090
xorl %eax, %eax
jmp 0x2157
movq (%rbx,%r15,8), %rsi
leaq 0x50(%rsp), %r14
movl $0xfa, %edx
movq %r14, %rdi
callq 0x1040
movb $0x0, 0xf9(%r14)
movq %r14, %rdi
callq 0x1030
leal -0x1(%rax), %ecx
testl %ecx, %ecx
jle 0x19b3
addl $-0x2, %eax
cmpl $0x3, %eax
movl $0x3, %edx
cmovbl %eax, %edx
incl %edx
movl %ecx, %ecx
cmpb $0x2e, 0x50(%rsp,%rcx)
je 0x19ae
decl %ecx
decq %rdx
jne 0x199c
jmp 0x19b3
movb $0x0, 0x50(%rsp,%rcx)
leaq 0x50(%rsp), %rdi
callq 0x1030
movl $0x7061742e, 0x50(%rsp,%rax) # imm = 0x7061742E
movb $0x0, 0x54(%rsp,%rax)
movq (%rbx,%r15,8), %rdi
leaq 0x1866(%rip), %rsi      # 0x323b
callq 0x1060
movq %rax, 0x30(%rsp)
testq %rax, %rax
je 0x1abe
leaq 0x184f(%rip), %rsi      # 0x323e
leaq 0x50(%rsp), %r15
movq %r15, %rdi
callq 0x1060
movq %rax, 0x40(%rsp)
testq %rax, %rax
je 0x1aca
xorl %ecx, %ecx
testb %r13b, %r13b
jne 0x1f9a
movb 0x50(%rsp), %dl
xorl %ecx, %ecx
movq 0x20(%rsp), %rdi
movl %edi, %eax
cmpb $0x2e, %dl
movq 0x48(%rsp), %r13
movq 0x10(%rsp), %r10
movq (%rsp), %r11
movq 0x8(%rsp), %r9
je 0x1a60
leaq (%rsp,%rax), %rsi
addq $0x1be, %rsi            # imm = 0x1BE
xorl %ecx, %ecx
cmpq $0x9, %rcx
ja 0x1a60
testb %dl, %dl
je 0x1a60
movb %dl, (%rsi,%rcx)
movb 0x51(%rsp,%rcx), %dl
incq %rcx
cmpb $0x2e, %dl
jne 0x1a47
movq 0x28(%rsp), %rsi
leal (%rsi,%rsi,8), %edx
leal (%rsi,%rdx,2), %edx
addl %edi, %edx
leal (%rcx,%rdx), %esi
addl $0x56, %esi
addl %edx, %ecx
addl $0x155, %ecx            # imm = 0x155
testl %esi, %esi
cmovnsl %esi, %ecx
movb %sil, 0x15e(%rsp)
movb %ch, 0x15f(%rsp)
movl $0x13, 0x150(%rsp)
testl %edi, %edi
je 0x1ad6
movabsq $0x20202020206e7572, %rcx # imm = 0x20202020206E7572
movq %rcx, 0x154(%rsp)
movw $0x2020, 0x15c(%rsp)    # imm = 0x2020
movb $0x49, %cl
jmp 0x1b30
leaq 0x1a85(%rip), %rdi      # 0x354a
jmp 0x214d
leaq 0x1a91(%rip), %rdi      # 0x3562
jmp 0x214d
xorl %edx, %edx
movl $0x1, %esi
xorl %ecx, %ecx
movb $0x1, %dil
testl %esi, %esi
je 0x1b02
movzbl 0x50(%rsp,%rdx), %r8d
xorl %esi, %esi
cmpl $0x2e, %r8d
je 0x1b04
testl %r8d, %r8d
je 0x1b04
movl $0x1, %esi
xorl %edi, %edi
jmp 0x1b04
xorl %esi, %esi
testb %dil, %dil
je 0x1b18
movb $0x20, 0x154(%rsp,%rdx)
movl $0x20, %edi
jmp 0x1b25
movzbl 0x50(%rsp,%rdx), %edi
movb %dil, 0x154(%rsp,%rdx)
xorl %edi, %ecx
incq %rdx
cmpq $0xa, %rdx
jne 0x1adf
leaq 0x1a6(%rsp), %rdi
leaq 0x1b9(%rsp), %rsi
movb -0x5b(%rsi), %dl
movb -0x5a(%rsi), %r8b
movw $0xa, -0x59(%rsi)
movb %dl, -0x57(%rsi)
movb %r8b, -0x56(%rsi)
xorb %r8b, %dl
xorb %dl, %cl
xorb %dl, %cl
xorb $0xa, %cl
movb %cl, -0x55(%rsi)
movsbl -0x5a(%rsi), %ecx
shll $0x8, %ecx
movsbl -0x5b(%rsi), %edx
leal (%rdx,%rcx), %r8d
addl $0x2, %r8d
addl %edx, %ecx
addl $0x101, %ecx            # imm = 0x101
addl $0x2, %edx
testl %r8d, %r8d
cmovnsl %r8d, %ecx
movb %dl, -0x54(%rsi)
movb %ch, 0x166(%rsp)
movb $-0x1, -0x52(%rsi)
movaps 0x1a25(%rip), %xmm0     # 0x35c0
movups %xmm0, -0x51(%rsi)
movaps 0x1a2a(%rip), %xmm0     # 0x35d0
movups %xmm0, -0x41(%rsi)
movb $0x22, %cl
movb %cl, -0x31(%rsi)
movb %r9b, -0x30(%rsi)
xorb $0x62, %r9b
movzbl %r9b, %edx
movb %cl, -0x2b(%rsi)
movl $0xb0da3a22, -0x2f(%rsi) # imm = 0xB0DA3A22
xorl %r8d, %r8d
leaq 0x19f1(%rip), %rcx      # 0x35c0
movzbl 0x21(%r8,%rcx), %r9d
xorl %r9d, %edx
incq %r8
cmpl $0x5, %r8d
jne 0x1bcf
movb %r11b, 0x18f(%rsp)
movzbl %r11b, %r8d
xorl %r8d, %edx
movl $0xb0d93a22, 0x190(%rsp) # imm = 0xB0D93A22
movb $0x22, 0x194(%rsp)
xorl %r8d, %r8d
movzbl 0x26(%r8,%rcx), %r9d
xorl %r9d, %edx
incq %r8
cmpl $0x5, %r8d
jne 0x1c06
movb %r10b, 0x195(%rsp)
movzbl %r10b, %r8d
xorl %r8d, %edx
movabsq $-0x4f02fff5e1fff2de, %r8 # imm = 0xB0FD000A1E000D22
movq %r8, 0x196(%rsp)
movb $0x22, 0x19e(%rsp)
xorl %r8d, %r8d
movzbl 0x2b(%r8,%rcx), %r9d
xorl %r9d, %edx
incq %r8
cmpl $0x9, %r8d
jne 0x1c44
movslq %ebp, %r9
imulq $0x68db8bad, %r9, %r10  # imm = 0x68DB8BAD
movq %r10, %r8
shrq $0x3f, %r8
sarq $0x2c, %r10
addl %r8d, %r10d
leal 0x30(%r10), %r8d
movb %r8b, 0x19f(%rsp)
imull $0x2710, %r10d, %r10d   # imm = 0x2710
subl %r10d, %r9d
movslq %r9d, %r10
imulq $0x10624dd3, %r10, %r11 # imm = 0x10624DD3
movq %r11, %r9
shrq $0x3f, %r9
sarq $0x26, %r11
addl %r9d, %r11d
leal 0x30(%r11), %r9d
movb %r9b, 0x1a0(%rsp)
imull $0x3e8, %r11d, %r11d    # imm = 0x3E8
subl %r11d, %r10d
movslq %r10d, %r11
imulq $0x51eb851f, %r11, %rbx # imm = 0x51EB851F
movq %rbx, %r10
shrq $0x3f, %r10
sarq $0x25, %rbx
addl %r10d, %ebx
leal 0x30(%rbx), %r10d
movb %r10b, 0x1a1(%rsp)
imull $0x64, %ebx, %ebx
subl %ebx, %r11d
movslq %r11d, %r11
imulq $0x66666667, %r11, %rbx # imm = 0x66666667
movq %rbx, %r14
shrq $0x3f, %r14
sarq $0x22, %rbx
addl %r14d, %ebx
leal 0x30(%rbx), %ebp
movb %bpl, 0x1a2(%rsp)
addl %ebx, %ebx
leal (%rbx,%rbx,4), %ebx
subl %ebx, %r11d
addb $0x30, %r11b
movb %r11b, 0x1a3(%rsp)
movw $0xd22, 0x1a4(%rsp)     # imm = 0xD22
xorb %r8b, %r9b
xorb %r10b, %r9b
xorb %bpl, %r9b
xorb %r11b, %r9b
movzbl %r9b, %r8d
xorl %r8d, %edx
xorl $0x2f, %edx
cmpl $0x0, 0x28(%rsp)
je 0x1d77
movups 0x18b5(%rip), %xmm0     # 0x35f6
movups %xmm0, 0x1a6(%rsp)
movl $0xd226f22, 0x1b5(%rsp) # imm = 0xD226F22
xorl %edi, %edi
movq 0x20(%rsp), %r11
movzbl 0x36(%rdi,%rcx), %r8d
xorl %r8d, %edx
incq %rdi
cmpl $0x13, %edi
jne 0x1d5b
movl $0x69, %r8d
movq %rsi, %rdi
jmp 0x1d82
movl $0x56, %r8d
movq 0x20(%rsp), %r11
movb $-0x11, 0x4(%rdi)
movl $0x53200, (%rdi)        # imm = 0x53200
xorl %esi, %esi
movzbl 0x49(%rsi,%rcx), %edi
xorl %edi, %edx
incq %rsi
cmpl $0x5, %esi
jne 0x1d8e
movl %r8d, %esi
movb 0x152(%rsp,%rsi), %dil
xorb 0x153(%rsp,%rsi), %dil
addq $0x5, %rsi
movzbl %dil, %edi
xorl %edi, %edx
testl %r11d, %r11d
je 0x1dd1
addl $0x6, %r8d
movb $0x2a, 0x150(%rsp,%rsi)
xorl $0x2a, %edx
movl %r8d, %esi
movl %esi, %r8d
movb $0x22, 0x150(%rsp,%r8)
xorl $0x22, %edx
addl $0xb, %esi
leaq 0x150(%rsp), %r9
xorl %edi, %edi
movzbl (%r15), %r10d
testl %r10d, %r10d
je 0x1e20
cmpl $0x2e, %r10d
je 0x1e20
movb %r10b, 0x1(%r9,%r8)
xorl %r10d, %edx
decq %rdi
incq %r15
incq %r9
cmpq $-0xa, %rdi
jne 0x1ded
movl $0xa, %r8d
movl $0xa, %edi
jmp 0x1e2f
subl %edi, %r8d
incl %r8d
negq %rdi
movl %r8d, %esi
movq %rdi, %r8
leal (%r11,%rdi), %r9d
addl $0x5, %r9d
movslq %esi, %rsi
leaq (%rsp,%rsi), %r10
addq $0x150, %r10            # imm = 0x150
subq %rax, %r10
subq %r8, %r10
leal (%r11,%rdi), %eax
addl $0x104, %eax            # imm = 0x104
testl %r9d, %r9d
cmovnsl %r9d, %eax
movb %r9b, -0x4(%r10)
sarl $0x8, %eax
movb %al, -0x3(%r10)
xorl %r9d, %eax
movsbl %al, %eax
xorl %edx, %eax
movl %esi, %edx
movabsq $-0x6fff4c3fff250de, %rdi # imm = 0xF9000B3C000DAF22
movq %rdi, 0x150(%rsp,%rdx)
movl $0x22b0c0f9, 0x157(%rsp,%rdx) # imm = 0x22B0C0F9
addl $0xa, %esi
xorl %edi, %edi
movzbl 0x4e(%rdi,%rcx), %r8d
xorl %r8d, %eax
incq %rdi
cmpl $0xb, %edi
jne 0x1e92
leal 0xb(%rdx), %edi
movslq %r13d, %r8
imulq $0x68db8bad, %r8, %r9   # imm = 0x68DB8BAD
movq %r9, %rcx
shrq $0x3f, %rcx
sarq $0x2c, %r9
addl %ecx, %r9d
leal 0x30(%r9), %ecx
movslq %edi, %rdi
movb %cl, 0x150(%rsp,%rdi)
imull $0x2710, %r9d, %edi     # imm = 0x2710
subl %edi, %r8d
movslq %r8d, %r8
imulq $0x10624dd3, %r8, %r9   # imm = 0x10624DD3
movq %r9, %rdi
shrq $0x3f, %rdi
sarq $0x26, %r9
addl %edi, %r9d
leal 0x30(%r9), %edi
movslq %esi, %rsi
movb %dil, 0x152(%rsp,%rsi)
imull $0x3e8, %r9d, %r9d      # imm = 0x3E8
subl %r9d, %r8d
movslq %r8d, %r9
imulq $0x51eb851f, %r9, %r10  # imm = 0x51EB851F
movq %r10, %r8
shrq $0x3f, %r8
sarq $0x25, %r10
addl %r8d, %r10d
leal 0x30(%r10), %r8d
movb %r8b, 0x153(%rsp,%rsi)
imull $0x64, %r10d, %r10d
subl %r10d, %r9d
movslq %r9d, %r9
imulq $0x66666667, %r9, %r10  # imm = 0x66666667
movq %r10, %r11
shrq $0x3f, %r11
sarq $0x22, %r10
addl %r11d, %r10d
leal 0x30(%r10), %r11d
movb %r11b, 0x154(%rsp,%rsi)
addl %r10d, %r10d
leal (%r10,%r10,4), %r10d
subl %r10d, %r9d
addb $0x30, %r9b
movb %r9b, 0x155(%rsp,%rsi)
movw $0xd22, 0x160(%rsp,%rdx) # imm = 0xD22
xorb %cl, %dil
xorb %r8b, %dil
xorb %r11b, %dil
xorb %r9b, %dil
movzbl %dil, %ecx
xorl %ecx, %eax
leal 0x12(%rdx), %esi
xorb $0x2f, %al
leal 0x13(%rdx), %ecx
movslq %esi, %rdx
movb %al, 0x150(%rsp,%rdx)
movslq %ecx, %rax
movl $0x3000013, 0x150(%rsp,%rax) # imm = 0x3000013
movl %eax, %esi
leaq (%rsp,%rsi), %rbx
addq $0x150, %rbx            # imm = 0x150
movl $0x3, %ebp
movl $0x1, %eax
xorl %r14d, %r14d
movb $0x1, %cl
testl %eax, %eax
je 0x1fe2
movzbl 0x50(%rsp,%r14), %edx
xorl %eax, %eax
cmpl $0x2e, %edx
je 0x1fe4
testl %edx, %edx
je 0x1fe4
movl $0x1, %eax
xorl %ecx, %ecx
jmp 0x1fe4
xorl %eax, %eax
testb %cl, %cl
je 0x1ff5
movb $0x20, 0x4(%rbx,%r14)
movl $0x20, %ecx
jmp 0x2000
movzbl 0x50(%rsp,%r14), %ecx
movb %cl, 0x4(%rbx,%r14)
xorl %ecx, %ebp
incq %r14
cmpq $0xa, %r14
jne 0x1fc2
movq %rsi, 0x8(%rsp)
leaq (%r14,%rbx), %r15
addq $0xe, %r15
movl $0x1, %esi
movl $0xc000, %edx           # imm = 0xC000
movq %r15, %rdi
movq 0x30(%rsp), %rcx
callq 0x1080
movq %rax, (%rsp)
movl %eax, %r13d
movq 0x30(%rsp), %rdi
callq 0x10a0
testl %eax, %eax
jne 0x2050
leaq 0x1530(%rip), %rdi      # 0x357b
callq 0x1090
movl $0xff, %eax
leal (%rax,%r13), %ecx
testl %r13d, %r13d
cmovnsl %r13d, %ecx
sarl $0x8, %ecx
addl %r12d, %eax
testl %r12d, %r12d
cmovnsl %r12d, %eax
sarl $0x8, %eax
movq (%rsp), %r10
movl %r10d, %edi
xorl %r12d, %edi
xorl %eax, %edi
xorl %ebp, %edi
xorl %ecx, %edi
addb $-0x80, %dil
leal 0x2(%r13), %r8d
leal 0x101(%r13), %edx
testl %r8d, %r8d
cmovnsl %r8d, %edx
movq 0x8(%rsp), %r9
leaq (%r9,%r14), %rsi
movb %r10b, 0x4(%rbx,%r14)
movb %cl, 0x155(%rsp,%rsi)
movb %r12b, 0x156(%rsp,%rsi)
movb %al, 0x157(%rsp,%rsi)
movw $0x8000, 0x158(%rsp,%rsi) # imm = 0x8000
movb %dil, 0x15a(%rsp,%rsi)
movb %r8b, 0x15b(%rsp,%rsi)
movb %dh, 0x15c(%rsp,%rsi)
movb $-0x1, 0x15d(%rsp,%rsi)
testl %r13d, %r13d
jle 0x2107
movq %r10, %rdx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movzbl (%r15), %ecx
xorl %ecx, %eax
incq %r15
decl %r13d
jne 0x20f0
leal (%rdx,%r9), %ecx
addl $0x18, %ecx
jmp 0x2111
leaq (%r9,%r14), %rcx
addq $0xe, %rcx
movb $-0x1, %al
movslq %ecx, %rdx
incl %ecx
movb %al, 0x150(%rsp,%rdx)
movslq %ecx, %rdx
leaq 0x150(%rsp), %rdi
movl $0x1, %esi
movq 0x40(%rsp), %rbx
movq %rbx, %rcx
callq 0x10c0
movq %rbx, %rdi
callq 0x10b0
testl %eax, %eax
je 0x2169
leaq 0x1450(%rip), %rdi      # 0x359d
callq 0x1090
movl $0x1, %eax
addq $0xc1c8, %rsp           # imm = 0xC1C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x30(%rsp), %rdi
callq 0x1050
movq %rbx, %rdi
callq 0x1050
jmp 0x1958
callq 0x1214
jmp 0x2152
callq 0x1230
jmp 0x2152
leaq 0x141c(%rip), %rdi      # 0x35b1
jmp 0x214d
callq 0x11dc
jmp 0x2152
callq 0x11f8
jmp 0x2152
callq 0x11a4
jmp 0x2152
callq 0x11c0
jmp 0x2152
callq 0x116c
jmp 0x2152
callq 0x1188
jmp 0x2152
callq 0x1134
jmp 0x2152
callq 0x1150
jmp 0x2152
callq 0x10fc
jmp 0x2152
callq 0x1118
jmp 0x2152
callq 0x10e0
jmp 0x2152