// File: /workspace/github_c_makefile_star2_O1/WereCatf[P]Gonzales/gonzales.c
// Function: main
int main(int argc, char* argv[])
{
	uint8_t port, pin, value, quiet;

	if(argc <= 1 || strcmp(argv[1], "-h")==0 || strcmp(argv[1], "--help")==0){
		printf("Chippy Gonzales is a tool for directly manipulating the\n");
		printf("GPIO hardware-registers, including pull-ups/-downs, muxes\n");
		printf("and pin-states. This tool is only intended for those who\n");
		printf("know what they are doing and you can very much mess things\n");
		printf("with this.\n\n");
		printf("YOU ASSUME ALL RESPONSIBILITY FOR USE OF THIS TOOL.\n\n");
		printf("The tool accepts the following commands: readPin, readPull, readMux,\n");
		printf("writePin, writePull, writeMux, header1 and header2. All the\n");
		printf("read-commands follow the same format, ie. `gonzales command port pin`\n");
		printf("where port is a number ranging from 0 to 6 or a character from a to g,\n");
		printf("and pin is 0 to 31. Port 0 corresponds to port A, port 1 to port B\n");
		printf("and so on, and if given as a character, the character can be lowercase\n");
		printf("or uppercase. Example: `gonzales readPin d 25` to read pin PD25.\n\n");
		printf("The format for the write-commands is the same, except for the value\n");
		printf("given:\n");
		printf("`writePin [port] [pin] [low/LOW/high/HIGH/0/1]`\n");
		printf("`writeMux [port] [pin] [in/input/INPUT/out/output/OUTPUT/0-6]`\n");
		printf("  -- 0 means INPUT, 1 means OUTPUT and the rest depends on the pin,\n");
		printf("  and the command takes no human-readable input for those.\n");
		printf("`writePull [port] [pin] [up/UP/down/DOWN/disable/DISABLE/0/1/2]`\n");
		printf("  -- 0 means disable, 1 means pull-up, 2 means pull-down.\n\n");
		printf("The commands `header1` and `header2` do not take any parameters.\n");
		return 0;
	}

	quiet=0;
	if(strcmp(argv[1], "-q")==0 || strcmp(argv[1], "--quiet")==0) quiet=1;

	int error=initGpio();
	if(error==1){
		printf("Error opening /dev/mem!\n");
		return 1;
	} else if(error==2){
		printf("Error mmapping memory!\n");
		return 2;
	}

	if(argc < (4+quiet)){
		if(argc > (1+quiet) && strcmp(argv[1+quiet], "header1")==0){
			printf("      Mux  │ Pull │  Function   J13    Function  │ Pull │  Mux\n");
			printf("      ─────┼──────┼──────────────────────────────┼──────┼─────\n");
			printPair(0, 255, "GND", 0, 255, "CHG-IN");
			printPair(0, 255, "5V Out", 0, 255, "GND");
			printPair(0, 255, "3.3V Out", 0, 255, "Tempsense");
			printPair(0, 255, "1.8V Out", 0, 255, "BAT+");
			printPair(1, 16, NULL, 0, 255, "PWR-BTN");
			printPair(1, 15, NULL, 0, 255, "GND");
			printPair(0, 255, "Touch-X1", 0, 255, "Touch-X2");
			printPair(0, 255, "Touch-Y1", 0, 255, "Touch-Y2");
			printPair(3, 2, NULL, 1, 2, NULL);
			printPair(3, 4, NULL, 3, 3, NULL);
			printPair(3, 6, NULL, 3, 5, NULL);
			printPair(3, 10, NULL, 3, 7, NULL);
			printPair(3, 12, NULL, 3, 11, NULL);
			printPair(3, 14, NULL, 3, 13, NULL);
			printPair(3, 18, NULL, 3, 15, NULL);
			printPair(3, 20, NULL, 3, 19, NULL);
			printPair(3, 22, NULL, 3, 21, NULL);
			printPair(3, 24, NULL, 3, 23, NULL);
			printPair(3, 27, NULL, 3, 26, NULL);
			printPair(0, 255, "GND", 3, 25, NULL);
			printf("      ─────┼──────┼──────────────────────────────┼──────┼─────\n");
			printf("      Mux  │ Pull │  Function   J13    Function  │ Pull │  Mux\n");
			return 0;
		} else
		if(argc > (1+quiet) && strcmp(argv[1+quiet], "header2")==0){
			printf("      Mux  │ Pull │  Function   J14    Function  │ Pull │  Mux\n");
			printf("      ─────┼──────┼──────────────────────────────┼──────┼─────\n");
			printPair(0, 255, "GND", 0, 255, "5V-Out");
			printPair(6, 3, NULL, 0, 255, "Hphone-L");
			printPair(6, 4, NULL, 0, 255, "Hp-common");
			printPair(0, 255, "FEL", 0, 255, "Hphone-R");
			printPair(0, 255, "3.3V Out", 0, 255, "Mic-GND");
			printPair(0, 255, "LRADC", 0, 255, "Mic-in");
			printPair(0, 255, "XIO-P0", 0, 255, "XIO-P1");
			printPair(0, 255, "XIO-P2", 0, 255, "XIO-P3");
			printPair(0, 255, "XIO-P4", 0, 255, "XIO-P5");
			printPair(0, 255, "XIO-P6", 0, 255, "XIO-P7");
			printPair(0, 255, "GND", 0, 255, "GND");
			printPair(6, 1, NULL, 1, 3, NULL);
			printPair(1, 18, NULL, 1, 17, NULL);
			printPair(4, 0, NULL, 4, 1, NULL);
			printPair(4, 2, NULL, 4, 3, NULL);
			printPair(4, 4, NULL, 4, 5, NULL);
			printPair(4, 6, NULL, 4, 7, NULL);
			printPair(4, 8, NULL, 4, 9, NULL);
			printPair(4, 10, NULL, 4, 11, NULL);
			printPair(0, 255, "GND", 0, 255, "GND");
			printf("      ─────┼──────┼──────────────────────────────┼──────┼─────\n");
			printf("      Mux  │ Pull │  Function   J14    Function  │ Pull │  Mux\n");
			return 0;
		}
		printf("Too few parameters!\n");
		return 1;
	}

	port = 255;
	if(*argv[2+quiet] >= 'a' && *argv[2+quiet] <= 'g') port = *argv[2+quiet] - 'a';
	if(*argv[2+quiet] >= 'A' && *argv[2+quiet] <= 'G') port = *argv[2+quiet] - 'A';
	if(*argv[2+quiet] >= '0' && *argv[2+quiet] <= '6') port = *argv[2+quiet] - '0';

	pin = atoi(argv[3+quiet]);
	if(port > 6){
		printf("Port must be in the range of 0-6, or a-g!\n");
		return 1;
	}
	if(pin > 31){
		printf("Pin must be in the range of 0 to 31!\n");
		return 1;
	}

	if(strcmp(argv[1+quiet], "readPin")==0){
		printf("Port %c, pin %d: ", port+'A', pin);
		if(readPin(port, pin)) printf("HIGH\n");
		else printf("LOW\n");
	}
	else if(strcmp(argv[1+quiet], "readMux")==0){
		printf("Port %c, pin %d: ", port+'A', pin);
		value=readMux(port, pin);
		printf("%s\n", muxToString(port, pin, value));
	}
	else if(strcmp(argv[1+quiet], "readPull")==0){
		printf("Port %c, pin %d: ", port+'A', pin);
		switch(readPull(port, pin)){
			case 0:
				printf("pull-up/-down disabled.\n");
				break;
			case 1:
				printf("pull-up enabled.\n");
				break;
			case 2:
				printf("pull-down enabled.\n");
				break;
			default:
				printf("unknown status.\n");
				break;
		}
	}
	else if(strcmp(argv[1+quiet], "writePull")==0){
		if(argc < (5+quiet)){
			printf("Too few parameters!\n");
			return 1;
		}
		value = atoi(argv[4+quiet]);
		if(strcmp(argv[4+quiet], "up")==0 || strcmp(argv[4+quiet], "UP")==0) value=1;
		else if(strcmp(argv[4+quiet], "down")==0 || strcmp(argv[4+quiet], "DOWN")==0) value=2;
		else if(strcmp(argv[4+quiet], "disable")==0 || strcmp(argv[4+quiet], "disabled")==0
			|| strcmp(argv[4+quiet], "DISABLE")==0 || strcmp(argv[4+quiet], "DISABLED")==0) value=0;
		if(!quiet){
			printf("New setting for port %c, pin %d: ", port+'A', pin);
			switch(value){
				case 0:
					printf("pull-up/-down disabled.\n");
					break;
				case 1:
					printf("pull-up enabled.\n");
					break;
				case 2:
					printf("pull-down enabled.\n");
					break;
				default:
					printf("unknown status.\n");
					break;
			}
		}
		writePull(port, pin, value);
	}
	else if(strcmp(argv[1+quiet], "writePin")==0){
		if(argc < (5+quiet)){
			printf("Too few parameters!\n");
			return 1;
		}
		value = atoi(argv[4+quiet]);
		if(strcmp(argv[4+quiet], "high")==0 || strcmp(argv[4+quiet], "HIGH")==0) value=1;
		else if(strcmp(argv[4+quiet], "low")==0 || strcmp(argv[4+quiet], "LOW")==0) value=2;
		if(!quiet){
			printf("New setting for port %c, pin %d: ", port+'A', pin);
			switch(value){
				case 0:
					printf("LOW.\n");
					break;
				case 1:
					printf("HIGH.\n");
					break;
				default:
					printf("unknown value given.\n");
					return 1;
					break;
			}
		}
		writePin(port, pin, value);
	}
	else if(strcmp(argv[1+quiet], "writeMux")==0){
		if(argc < (5+quiet)){
			printf("Too few parameters!\n");
			return 1;
		}
		value = atoi(argv[4+quiet]);
		if(strcmp(argv[4+quiet], "input")==0 || strcmp(argv[4+quiet], "INPUT")==0
			|| strcmp(argv[4+quiet], "in")==0 || strcmp(argv[4+quiet], "IN")==0) value=0;
		else if(strcmp(argv[4+quiet], "output")==0 || strcmp(argv[4+quiet], "OUTPUT")==0
				|| strcmp(argv[4+quiet], "out")==0 || strcmp(argv[4+quiet], "OUT")==0) value=1;
		if(!quiet){
			printf("New setting for port %c, pin %d: ", port+'A', pin);
			switch(value){
				case 0:
					printf("INPUT.\n");
					break;
				case 1:
					printf("OUTPUT.\n");
					break;
				default:
					printf("altmux 0x%x.\n", value);
					break;
			}
		}
		writeMux(port, pin, value);
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
cmpl $0x2, %edi
jl 0x24ff
movq %rsi, %r15
movl %edi, %r12d
movq 0x8(%rsi), %rbx
leaq 0x1c5e(%rip), %rsi      # 0x4107
movq %rbx, %rdi
callq 0x2090
testl %eax, %eax
je 0x24ff
leaq 0x1c4e(%rip), %rsi      # 0x410a
movq %rbx, %rdi
callq 0x2090
testl %eax, %eax
je 0x24ff
leaq 0x1c42(%rip), %rsi      # 0x4111
movq %rbx, %rdi
callq 0x2090
testl %eax, %eax
je 0x261c
leaq 0x1c2e(%rip), %rsi      # 0x4114
movq %rbx, %rdi
callq 0x2090
testl %eax, %eax
je 0x261c
movb $0x1, %bl
xorl %ebp, %ebp
jmp 0x2621
leaq 0x201c(%rip), %rdi      # 0x4522
callq 0x2040
leaq 0x2048(%rip), %rdi      # 0x455a
callq 0x2040
leaq 0x2076(%rip), %rdi      # 0x4594
callq 0x2040
leaq 0x20a3(%rip), %rdi      # 0x45cd
callq 0x2040
leaq 0x20d2(%rip), %rdi      # 0x4608
callq 0x2040
leaq 0x20d2(%rip), %rdi      # 0x4614
callq 0x2040
leaq 0x20fb(%rip), %rdi      # 0x4649
callq 0x2040
leaq 0x2134(%rip), %rdi      # 0x468e
callq 0x2040
leaq 0x2164(%rip), %rdi      # 0x46ca
callq 0x2040
leaq 0x219e(%rip), %rdi      # 0x4710
callq 0x2040
leaq 0x21d9(%rip), %rdi      # 0x4757
callq 0x2040
leaq 0x2210(%rip), %rdi      # 0x479a
callq 0x2040
leaq 0x224b(%rip), %rdi      # 0x47e1
callq 0x2040
leaq 0x2281(%rip), %rdi      # 0x4823
callq 0x2040
leaq 0x22b9(%rip), %rdi      # 0x4867
callq 0x2040
leaq 0x22b4(%rip), %rdi      # 0x486e
callq 0x2040
leaq 0x22d8(%rip), %rdi      # 0x489e
callq 0x2040
leaq 0x230b(%rip), %rdi      # 0x48dd
callq 0x2040
leaq 0x2343(%rip), %rdi      # 0x4921
callq 0x2040
leaq 0x2372(%rip), %rdi      # 0x495c
callq 0x2040
leaq 0x23a7(%rip), %rdi      # 0x499d
callq 0x2040
leaq 0x23d6(%rip), %rdi      # 0x49d8
callq 0x2040
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %bpl
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x328f
cmpl $0x2, %eax
je 0x263e
cmpl $0x1, %eax
jne 0x2652
leaq 0x1ed1(%rip), %rdi      # 0x450a
jmp 0x2700
leaq 0x1eae(%rip), %rdi      # 0x44f3
callq 0x2040
movl $0x2, %r14d
jmp 0x260a
movzbl %bpl, %r13d
leal 0x4(%r13), %ebp
cmpl %r12d, %ebp
jle 0x26a5
incl %r13d
cmpl %r12d, %r13d
jge 0x269c
movl %r13d, %eax
movq (%r15,%rax,8), %rbx
leaq 0x1aa7(%rip), %rsi      # 0x411c
movq %rbx, %rdi
callq 0x2090
testl %eax, %eax
je 0x2891
leaq 0x1af3(%rip), %rsi      # 0x417f
movq %rbx, %rdi
callq 0x2090
testl %eax, %eax
je 0x2b2b
leaq 0x1cff(%rip), %rdi      # 0x43a2
jmp 0x2700
movl %r13d, %eax
movq 0x10(%r15,%rax,8), %rax
movb (%rax), %al
leal -0x61(%rax), %ecx
cmpb $0x7, %cl
movzbl %cl, %ecx
movl $0xff, %edx
cmovbl %ecx, %edx
leal -0x41(%rax), %ecx
cmpb $0x7, %cl
movzbl %cl, %ecx
cmovael %edx, %ecx
addb $-0x30, %al
cmpb $0x7, %al
movzbl %al, %r14d
cmovael %ecx, %r14d
movq 0x18(%r15,%r13,8), %rdi
callq 0x20b0
cmpb $0x7, %r14b
jb 0x26f1
leaq 0x1c89(%rip), %rdi      # 0x4378
jmp 0x2700
movzbl %al, %ecx
cmpl $0x20, %ecx
jb 0x2710
leaq 0x1c53(%rip), %rdi      # 0x4353
callq 0x2040
movl $0x1, %r14d
jmp 0x260a
movl %eax, 0x1c(%rsp)
movl %ecx, 0xc(%rsp)
movzbl %r14b, %r14d
movq 0x8(%r15,%r13,8), %rdi
leaq 0x1ad3(%rip), %rsi      # 0x41fb
movq %rdi, 0x20(%rsp)
callq 0x2090
testl %eax, %eax
je 0x2ddd
movq %r14, 0x10(%rsp)
leaq 0x1acf(%rip), %rsi      # 0x4215
movq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
je 0x2e28
leaq 0x1abb(%rip), %rsi      # 0x421d
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
je 0x2e67
leaq 0x1aad(%rip), %rsi      # 0x4226
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
je 0x2ec3
leaq 0x1af4(%rip), %rsi      # 0x4284
movq %r14, %rdi
callq 0x2090
testl %eax, %eax
je 0x2fa2
leaq 0x1aef(%rip), %rsi      # 0x4296
movq %r14, %rdi
callq 0x2090
xorl %r14d, %r14d
testl %eax, %eax
jne 0x260a
addl $0x5, %r13d
cmpl %r12d, %r13d
jg 0x269c
movl %ebp, %eax
movq (%r15,%rax,8), %r15
movq %r15, %rdi
callq 0x20b0
movl %eax, %r14d
leaq 0x1ac0(%rip), %rsi      # 0x429f
movq %r15, %rdi
callq 0x2090
testl %eax, %eax
je 0x308d
leaq 0x1aaf(%rip), %rsi      # 0x42a5
movq %r15, %rdi
callq 0x2090
testl %eax, %eax
je 0x308d
leaq 0x19b3(%rip), %rsi      # 0x41c0
movq %r15, %rdi
callq 0x2090
testl %eax, %eax
je 0x308d
leaq 0x1904(%rip), %rsi      # 0x4128
movq %r15, %rdi
callq 0x2090
testl %eax, %eax
je 0x308d
leaq 0x1a70(%rip), %rsi      # 0x42ab
movq %r15, %rdi
callq 0x2090
testl %eax, %eax
movq 0x10(%rsp), %r12
je 0x2889
leaq 0x1a5f(%rip), %rsi      # 0x42b2
movq %r15, %rdi
callq 0x2090
testl %eax, %eax
je 0x2889
leaq 0x1a53(%rip), %rsi      # 0x42b9
movq %r15, %rdi
callq 0x2090
testl %eax, %eax
je 0x2889
leaq 0x1a44(%rip), %rsi      # 0x42bd
movq %r15, %rdi
callq 0x2090
testl %eax, %eax
jne 0x3095
movb $0x1, %r14b
jmp 0x3095
leaq 0x1c14(%rip), %rbx      # 0x44ac
movq %rbx, %rdi
callq 0x2040
leaq 0x1b56(%rip), %r15      # 0x43fd
movq %r15, %rdi
callq 0x2040
leaq 0x18fc(%rip), %r12      # 0x41b2
leaq 0x1867(%rip), %r9       # 0x4124
xorl %r14d, %r14d
xorl %edi, %edi
movl $0xff, %esi
movq %r12, %rdx
xorl %ecx, %ecx
movl $0xff, %r8d
callq 0x21cc
leaq 0x184d(%rip), %rdx      # 0x412b
xorl %edi, %edi
movl $0xff, %esi
xorl %ecx, %ecx
movl $0xff, %r8d
movq %r12, %r9
callq 0x21cc
leaq 0x1836(%rip), %rdx      # 0x4132
leaq 0x1838(%rip), %r9       # 0x413b
xorl %edi, %edi
movl $0xff, %esi
xorl %ecx, %ecx
movl $0xff, %r8d
callq 0x21cc
leaq 0x1827(%rip), %rdx      # 0x4145
leaq 0x1829(%rip), %r9       # 0x414e
xorl %edi, %edi
movl $0xff, %esi
xorl %ecx, %ecx
movl $0xff, %r8d
callq 0x21cc
leaq 0x1813(%rip), %r9       # 0x4153
movl $0x1, %edi
movl $0x10, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movl $0xff, %r8d
callq 0x21cc
movl $0x1, %edi
movl $0xf, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movl $0xff, %r8d
movq %r12, %r9
callq 0x21cc
leaq 0x17df(%rip), %rdx      # 0x415b
leaq 0x17e1(%rip), %r9       # 0x4164
xorl %edi, %edi
movl $0xff, %esi
xorl %ecx, %ecx
movl $0xff, %r8d
callq 0x21cc
leaq 0x17cf(%rip), %rdx      # 0x416d
leaq 0x17d1(%rip), %r9       # 0x4176
xorl %edi, %edi
movl $0xff, %esi
xorl %ecx, %ecx
movl $0xff, %r8d
callq 0x21cc
movl $0x3, %edi
movl $0x2, %esi
xorl %edx, %edx
movl $0x1, %ecx
movl $0x2, %r8d
xorl %r9d, %r9d
callq 0x21cc
movl $0x3, %edi
movl $0x4, %esi
xorl %edx, %edx
movl $0x3, %ecx
movl $0x3, %r8d
xorl %r9d, %r9d
callq 0x21cc
movl $0x3, %edi
movl $0x6, %esi
xorl %edx, %edx
movl $0x3, %ecx
movl $0x5, %r8d
xorl %r9d, %r9d
callq 0x21cc
movl $0x3, %edi
movl $0xa, %esi
xorl %edx, %edx
movl $0x3, %ecx
movl $0x7, %r8d
xorl %r9d, %r9d
callq 0x21cc
movl $0x3, %edi
movl $0xc, %esi
xorl %edx, %edx
movl $0x3, %ecx
movl $0xb, %r8d
xorl %r9d, %r9d
callq 0x21cc
movl $0x3, %edi
movl $0xe, %esi
xorl %edx, %edx
movl $0x3, %ecx
movl $0xd, %r8d
xorl %r9d, %r9d
callq 0x21cc
movl $0x3, %edi
movl $0x12, %esi
xorl %edx, %edx
movl $0x3, %ecx
movl $0xf, %r8d
xorl %r9d, %r9d
callq 0x21cc
movl $0x3, %edi
movl $0x14, %esi
xorl %edx, %edx
movl $0x3, %ecx
movl $0x13, %r8d
xorl %r9d, %r9d
callq 0x21cc
movl $0x3, %edi
movl $0x16, %esi
xorl %edx, %edx
movl $0x3, %ecx
movl $0x15, %r8d
xorl %r9d, %r9d
callq 0x21cc
movl $0x3, %edi
movl $0x18, %esi
xorl %edx, %edx
movl $0x3, %ecx
movl $0x17, %r8d
xorl %r9d, %r9d
callq 0x21cc
movl $0x3, %edi
movl $0x1b, %esi
xorl %edx, %edx
movl $0x3, %ecx
movl $0x1a, %r8d
xorl %r9d, %r9d
callq 0x21cc
xorl %edi, %edi
movl $0xff, %esi
movq %r12, %rdx
movl $0x3, %ecx
movl $0x19, %r8d
xorl %r9d, %r9d
jmp 0x2dc3
leaq 0x1884(%rip), %rbx      # 0x43b6
movq %rbx, %rdi
callq 0x2040
leaq 0x18bc(%rip), %r15      # 0x43fd
movq %r15, %rdi
callq 0x2040
leaq 0x1662(%rip), %r12      # 0x41b2
leaq 0x1630(%rip), %r9       # 0x4187
xorl %r14d, %r14d
xorl %edi, %edi
movl $0xff, %esi
movq %r12, %rdx
xorl %ecx, %ecx
movl $0xff, %r8d
callq 0x21cc
leaq 0x1616(%rip), %r9       # 0x418e
movl $0x6, %edi
movl $0x3, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movl $0xff, %r8d
callq 0x21cc
leaq 0x15ff(%rip), %r9       # 0x4197
movl $0x6, %edi
movl $0x4, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movl $0xff, %r8d
callq 0x21cc
leaq 0x15e9(%rip), %rdx      # 0x41a1
leaq 0x15e6(%rip), %r9       # 0x41a5
xorl %edi, %edi
movl $0xff, %esi
xorl %ecx, %ecx
movl $0xff, %r8d
callq 0x21cc
leaq 0x1558(%rip), %rdx      # 0x4132
leaq 0x15cd(%rip), %r9       # 0x41ae
xorl %edi, %edi
movl $0xff, %esi
xorl %ecx, %ecx
movl $0xff, %r8d
callq 0x21cc
leaq 0x15ba(%rip), %rdx      # 0x41b6
leaq 0x15b9(%rip), %r9       # 0x41bc
xorl %edi, %edi
movl $0xff, %esi
xorl %ecx, %ecx
movl $0xff, %r8d
callq 0x21cc
leaq 0x15a5(%rip), %rdx      # 0x41c3
leaq 0x15a5(%rip), %r9       # 0x41ca
xorl %edi, %edi
movl $0xff, %esi
xorl %ecx, %ecx
movl $0xff, %r8d
callq 0x21cc
leaq 0x1591(%rip), %rdx      # 0x41d1
leaq 0x1591(%rip), %r9       # 0x41d8
xorl %edi, %edi
movl $0xff, %esi
xorl %ecx, %ecx
movl $0xff, %r8d
callq 0x21cc
leaq 0x157d(%rip), %rdx      # 0x41df
leaq 0x157d(%rip), %r9       # 0x41e6
xorl %edi, %edi
movl $0xff, %esi
xorl %ecx, %ecx
movl $0xff, %r8d
callq 0x21cc
leaq 0x1569(%rip), %rdx      # 0x41ed
leaq 0x1569(%rip), %r9       # 0x41f4
xorl %edi, %edi
movl $0xff, %esi
xorl %ecx, %ecx
movl $0xff, %r8d
callq 0x21cc
xorl %edi, %edi
movl $0xff, %esi
movq %r12, %rdx
xorl %ecx, %ecx
movl $0xff, %r8d
movq %r12, %r9
callq 0x21cc
movl $0x6, %edi
movl $0x1, %esi
xorl %edx, %edx
movl $0x1, %ecx
movl $0x3, %r8d
xorl %r9d, %r9d
callq 0x21cc
movl $0x1, %edi
movl $0x12, %esi
xorl %edx, %edx
movl $0x1, %ecx
movl $0x11, %r8d
xorl %r9d, %r9d
callq 0x21cc
movl $0x4, %edi
xorl %esi, %esi
xorl %edx, %edx
movl $0x4, %ecx
movl $0x1, %r8d
xorl %r9d, %r9d
callq 0x21cc
movl $0x4, %edi
movl $0x2, %esi
xorl %edx, %edx
movl $0x4, %ecx
movl $0x3, %r8d
xorl %r9d, %r9d
callq 0x21cc
movl $0x4, %edi
movl $0x4, %esi
xorl %edx, %edx
movl $0x4, %ecx
movl $0x5, %r8d
xorl %r9d, %r9d
callq 0x21cc
movl $0x4, %edi
movl $0x6, %esi
xorl %edx, %edx
movl $0x4, %ecx
movl $0x7, %r8d
xorl %r9d, %r9d
callq 0x21cc
movl $0x4, %edi
movl $0x8, %esi
xorl %edx, %edx
movl $0x4, %ecx
movl $0x9, %r8d
xorl %r9d, %r9d
callq 0x21cc
movl $0x4, %edi
movl $0xa, %esi
xorl %edx, %edx
movl $0x4, %ecx
movl $0xb, %r8d
xorl %r9d, %r9d
callq 0x21cc
xorl %edi, %edi
movl $0xff, %esi
movq %r12, %rdx
xorl %ecx, %ecx
movl $0xff, %r8d
movq %r12, %r9
callq 0x21cc
movq %r15, %rdi
callq 0x2040
movq %rbx, %rdi
callq 0x2040
jmp 0x260a
movq %r14, %r15
leal 0x41(%r14), %esi
leaq 0x1418(%rip), %rdi      # 0x4203
xorl %r14d, %r14d
movl 0xc(%rsp), %ebx
movl %ebx, %edx
xorl %eax, %eax
callq 0x2070
leaq 0x4cce(%rip), %rax      # 0x7ad0
movq (%rax), %rax
movl %r15d, %ecx
leaq 0x4caf(%rip), %rdx      # 0x7abe
movzbl (%rdx,%rcx), %ecx
movl (%rax,%rcx), %eax
btl %ebx, %eax
jae 0x2eb7
leaq 0x1528(%rip), %rdi      # 0x434e
jmp 0x2dd3
movq 0x10(%rsp), %rbx
leal 0x41(%rbx), %esi
leaq 0x13cc(%rip), %rdi      # 0x4203
xorl %r14d, %r14d
movl 0xc(%rsp), %ebp
movl %ebp, %edx
xorl %eax, %eax
callq 0x2070
movl %ebx, %edi
movl %ebp, %esi
callq 0x3304
movzbl %al, %edx
movzbl 0x1c(%rsp), %esi
movl %ebx, %edi
callq 0x31c8
movq %rax, %rdi
jmp 0x2dd3
movq 0x10(%rsp), %rbx
leal 0x41(%rbx), %esi
leaq 0x138d(%rip), %rdi      # 0x4203
xorl %r14d, %r14d
movl 0xc(%rsp), %ebp
movl %ebp, %edx
xorl %eax, %eax
callq 0x2070
movl %ebx, %edi
movl %ebp, %esi
callq 0x3362
cmpb $0x2, %al
je 0x3037
movzbl %al, %eax
cmpl $0x1, %eax
je 0x302b
testl %eax, %eax
jne 0x3043
leaq 0x1470(%rip), %rdi      # 0x4322
jmp 0x2602
leaq 0x148c(%rip), %rdi      # 0x434a
jmp 0x2dd3
addl $0x5, %r13d
cmpl %r12d, %r13d
jg 0x269c
movl %ebp, %eax
movq (%r15,%rax,8), %r15
movq %r15, %rdi
callq 0x20b0
movl %eax, %r14d
leaq 0x1348(%rip), %rsi      # 0x4230
movq %r15, %rdi
callq 0x2090
movb $0x1, %bpl
testl %eax, %eax
je 0x304f
leaq 0x1331(%rip), %rsi      # 0x4233
movq %r15, %rdi
callq 0x2090
testl %eax, %eax
movq 0x10(%rsp), %r12
je 0x3054
leaq 0x1318(%rip), %rsi      # 0x4236
movq %r15, %rdi
callq 0x2090
movb $0x2, %bpl
testl %eax, %eax
je 0x3054
leaq 0x1303(%rip), %rsi      # 0x423b
movq %r15, %rdi
callq 0x2090
testl %eax, %eax
je 0x3054
leaq 0x12f1(%rip), %rsi      # 0x4240
movq %r15, %rdi
callq 0x2090
testl %eax, %eax
je 0x2f9b
leaq 0x12e6(%rip), %rsi      # 0x4248
movq %r15, %rdi
callq 0x2090
testl %eax, %eax
je 0x2f9b
leaq 0x12dc(%rip), %rsi      # 0x4251
movq %r15, %rdi
callq 0x2090
testl %eax, %eax
je 0x2f9b
leaq 0x12d1(%rip), %rsi      # 0x4259
movq %r15, %rdi
callq 0x2090
movl %r14d, %ebp
testl %eax, %eax
jne 0x3054
xorl %ebp, %ebp
jmp 0x3054
addl $0x5, %r13d
cmpl %r12d, %r13d
jg 0x269c
movl %ebp, %eax
movq (%r15,%rax,8), %r15
movq %r15, %rdi
callq 0x20b0
movl %eax, %r14d
leaq 0x12c6(%rip), %rsi      # 0x428d
movq %r15, %rdi
callq 0x2090
movb $0x1, %bpl
testl %eax, %eax
je 0x30f7
leaq 0x136d(%rip), %rsi      # 0x434e
movq %r15, %rdi
callq 0x2090
testl %eax, %eax
movq 0x10(%rsp), %r12
je 0x30fc
leaq 0x1295(%rip), %rsi      # 0x4292
movq %r15, %rdi
callq 0x2090
testl %eax, %eax
je 0x3023
leaq 0x133a(%rip), %rsi      # 0x434a
movq %r15, %rdi
callq 0x2090
movl %r14d, %ebp
testl %eax, %eax
jne 0x30fc
movb $0x2, %bpl
jmp 0x30fc
leaq 0x12df(%rip), %rdi      # 0x4311
jmp 0x2602
leaq 0x12c0(%rip), %rdi      # 0x42fe
jmp 0x2dd3
leaq 0x12f0(%rip), %rdi      # 0x433a
jmp 0x2602
movq 0x10(%rsp), %r12
movzbl %bpl, %r14d
testb %bl, %bl
je 0x30e3
leal 0x41(%r12), %esi
leaq 0x11f6(%rip), %rdi      # 0x4262
movl 0xc(%rsp), %edx
xorl %eax, %eax
callq 0x2070
cmpb $0x2, %bpl
ja 0x30d7
leaq 0x19b0(%rip), %rax      # 0x4a34
movslq (%rax,%r14,4), %rdi
addq %rax, %rdi
jmp 0x30de
xorl %r14d, %r14d
movq 0x10(%rsp), %r12
movzbl %r14b, %r15d
testb %bl, %bl
je 0x31b4
leal 0x41(%r12), %esi
leaq 0x11b5(%rip), %rdi      # 0x4262
movl 0xc(%rsp), %edx
xorl %eax, %eax
callq 0x2070
cmpb $0x1, %r14b
je 0x3190
testl %r15d, %r15d
jne 0x319e
leaq 0x1205(%rip), %rdi      # 0x42d7
jmp 0x3197
leaq 0x125c(%rip), %rdi      # 0x433a
callq 0x2040
movl %r12d, %edi
movl 0xc(%rsp), %esi
movl %r14d, %edx
callq 0x3388
jmp 0x2607
movq 0x10(%rsp), %r12
testb %bl, %bl
je 0x313f
leal 0x41(%r12), %esi
leaq 0x1156(%rip), %rdi      # 0x4262
movl 0xc(%rsp), %edx
xorl %eax, %eax
callq 0x2070
testb %bpl, %bpl
je 0x312e
movzbl %bpl, %eax
cmpl $0x1, %eax
jne 0x3184
leaq 0x11b2(%rip), %rdi      # 0x42de
jmp 0x3135
leaq 0x11af(%rip), %rdi      # 0x42e4
callq 0x2040
movq 0x10(%rsp), %r12
leaq 0x498a(%rip), %rax      # 0x7ad0
movq (%rax), %rax
movl %r12d, %esi
leaq 0x496b(%rip), %rdi      # 0x7abe
movl $0x1, %edx
movl 0x1c(%rsp), %ecx
shll %cl, %edx
movl $0xfffffffe, %r8d       # imm = 0xFFFFFFFE
roll %cl, %r8d
movzbl (%rdi,%rsi), %ecx
andl %r8d, (%rax,%rcx)
xorl %r14d, %r14d
testb $0x1, %bpl
je 0x260a
orl %edx, (%rax,%rcx)
jmp 0x260a
leaq 0x115e(%rip), %rdi      # 0x42e9
jmp 0x2700
leaq 0x1138(%rip), %rdi      # 0x42cf
callq 0x2040
jmp 0x31af
leaq 0x111c(%rip), %rdi      # 0x42c1
movl %r15d, %esi
xorl %eax, %eax
callq 0x2070
movq 0x10(%rsp), %r12
movl %r12d, %edi
movl 0xc(%rsp), %esi
movl %r15d, %edx
callq 0x332e
jmp 0x2607