// File: /workspace/github_cpp_makefile_star2_O2/amit-mittal[P]FTP/ftpClient.cpp
// Function: ftpClient::sendRequest()
int ftpClient::sendRequest(){
	string cmd = getInput();
	string responseData, responseControl;
	string str, response;
	FILE *pf;
	char input[5];	//For overwrite response
	char output[MAXBUFFSIZE];
	int pos = 0;

	if(cmd.substr(0, 4) == "!pwd"){
		cout << "Result is:\n";
		pf = popen(cmd.append(" 2>&1").substr(1).c_str(), "r");	//popen is used instead of system because we want to change pwd to !pwd
		if(!pf){
      			fputs("Error occurred while opening pipe for output, calling fork or allocating memory.\n", stderr);
			return(0);
		}
	
		while(fgets(output, MAXBUFFSIZE-1, pf)){
			str.append(output);
			if((pos = str.find("pwd", pos)) != string::npos){	//Search for pwd in the output and if present, replace with !pwd
				str.replace(pos, 3, "!pwd");
				pos += 2;			
			}
		}
		
		cout << str;
		if (pclose(pf) != 0){
			fputs("Incorrect use of !pwd \n", stderr);
			return(0);
		}
		
		if(DEBUG)
			cout << "!pwd successfully executed \n";
	} else if(cmd.substr(0, 3) == "!ls"){
		cout << "Result is\n";
		pf = popen(cmd.append(" 2>&1").substr(1).c_str(), "r");	
		if(!pf){
      			fputs("Error occurred while opening pipe for output, calling fork or allocating memory.\n", stderr);
			return(0);
		}
	
		while(fgets(output, MAXBUFFSIZE-1, pf)){
			str.append(output);
			if((pos = str.find("ls", pos)) != string::npos){	//Find occurrences of ls and replace them with !ls
				str.replace(pos, 2, "!ls");
				pos += 2;			
			}
		}
		
		cout << str << endl;
		if (pclose(pf) != 0){
			fputs("Incorrect use of !ls \n", stderr);
			return(0);
		}
		if(DEBUG)
			cout << "!ls successfully executed \n";
	} else if(cmd.substr(0, 3) == "!cd"){

		if(cmd.size() == 3){
			char *env = getenv("HOME");
			cout << "Changing directory to: "  << env << endl;
			chdir(env);
			cout << "Directory successfully changed. " << endl;
			return(0);
		}

		if(cmd.substr(3, 2) == " ~"){
			char *env = getenv("HOME");
			cmd.replace(4, 1, env);
		}
		cout << "Changing directory to: "  << cmd.substr(4) << endl;
		if(chdir(cmd.substr(4).c_str())){
			str = "Error occurred while changing directory using !cd\n!cd: ";
			str.append(cmd.substr(4)).append(": No such file or directory\n");
			cout << str;
		}
		else	cout << "Directory successfully changed. " << endl;
		if(DEBUG)
			cout << "!cd successfully executed \n";
	} else if(cmd == "quit"){
		cout << "Client process exiting ...\n";
		sendControl(cmd);
		d_socket.close();
		c_socket.close();
		exit(0);
	} else if(cmd.substr(0, 3) == "pwd"){
		sendControl(cmd);
		responseData = recvData();
		responseControl = recvControl(MAXBUFFSIZE);
		cout << responseData;
		cout << responseControl;
	} else if(cmd.substr(0, 2) == "ls"){
		sendControl(cmd);
		while(1){
			responseData = recvData();
			if(responseData.substr(responseData.size()-1) == " "){
				cout << responseData;
				break;
			}
			cout << responseData;
		}
		responseControl = recvControl(MAXBUFFSIZE);
		cout << responseControl;
	} else if(cmd.substr(0, 2) == "cd"){
		sendControl(cmd);
		responseControl = recvControl(MAXBUFFSIZE);
		cout << responseControl;
	} else if(cmd.substr(0, 3) == "put"){
		if(!fileExists(cmd.substr(4).c_str())){
			cout << cmd.substr(4) << ": No such file to put\n";
			return(0);
		}
		else if(access(cmd.substr(4).c_str(), R_OK) == -1){
			cout << "No permission to read the file\n";
			return(0);
		}
		sendControl(cmd);
		responseControl = recvControl(MAXBUFFSIZE);
		if(responseControl == "EXISTS"){	//Don't allow overwriting on the server
			cout << cmd.substr(4) << ": File already exists on the server. Cannot overwrite.\n";
			return(0);
		}
		if(isEmpty(cmd.substr(4))){
			sendControl("EMPTY");	//Empty File
			cout << "\nSize of file transferred : 0 B\n";
			cout << "File transfer to server successful  \n";
			cout << "File successfully received in server \n";
			return(0);
		}
		sendControl("NEF");	//Not Empty File (NEF)
		if(transferFile(cmd.substr(4)) < 0)
			cout << "\nError occurred while transferring file to server \n";
		else cout << "\nFile transfer to server successful \n";
		responseControl = recvControl(MAXBUFFSIZE);
		cout << responseControl;		
	} else if(cmd.substr(0, 3) == "get"){
		if(access("./", W_OK) == -1){
			cout << "No permission to write\n";
			return(0);
		}
		if(fileExists(cmd.substr(4).c_str())){
			cout << cmd.substr(4) << ": File already exists\nDo you want to overwrite? (y/n): ";
			while(1){
				fgets(input, 5, stdin);
				response = input;
				if(response == "n\n")
					return(0);
				else if(response == "y\n")
					break;
				else{
					cout << "Please enter either y or n : ";
					continue;
				}
			}
		}
		sendControl(cmd);
		responseControl = recvControl(MAXBUFFSIZE);
		if(responseControl == "DNE"){
			cout << cmd.substr(4) << ": No such file to get\n";
			return(0);
		}
		responseControl = recvControl(MAXBUFFSIZE);
		if(responseControl == "EMPTY"){
			FILE *fp = fopen(cmd.substr(4).c_str(), "w");
			fclose(fp);
			cout << "\nSize of file received : 0 B\n";
			cout << "File successfully received from server \n";
			cout << "File successfully sent from server \n";
			return 0;
		}
		if(receiveFile(cmd.substr(4)))
			cout << "\nError occurred while receiving file from server \n";
		else cout << "\nFile successfully received from server \n";
		responseControl = recvControl(MAXBUFFSIZE);
		cout << responseControl;
	} else if(cmd == "help"){
		printf("\nOptions available:\n1. !ls\n2. !cd\n3. !pwd\n4. ls\n5. cd\n6. pwd\n7. get\n8. put\n9. quit\n\n");
	} else if(cmd.size() == 0){
		return(0);
	} else {
		cout << "An invalid FTP Command. Type 'help'\n";
	}

	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x638, %rsp            # imm = 0x638
movq %rdi, %rsi
leaq -0x70(%rbp), %rbx
movq %rbx, %rdi
movq %rsi, -0x50(%rbp)
callq 0x3242
leaq -0xc0(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
leaq -0xa0(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
leaq -0x80(%rbp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %cl, (%rax)
movb %cl, (%rdx)
leaq -0x248(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq -0x48(%rbp), %rdi
pushq $0x4
popq %rcx
movq %rbx, %rsi
xorl %edx, %edx
callq 0x2230
leaq 0x1bfd(%rip), %rsi      # 0x5131
leaq -0x48(%rbp), %rbx
movq %rbx, %rdi
callq 0x46d5
movl %eax, %r14d
movq %rbx, %rdi
callq 0x2110
testb %r14b, %r14b
je 0x362f
movq 0x4a6d(%rip), %rdi      # 0x7fc8
leaq 0x1bd4(%rip), %rsi      # 0x5136
callq 0x2210
leaq 0x1bd4(%rip), %rsi      # 0x5142
leaq -0x70(%rbp), %rdi
callq 0x2410
leaq -0x48(%rbp), %rdi
pushq $0x1
popq %rdx
pushq $-0x1
popq %rcx
movq %rax, %rsi
callq 0x2230
leaq -0x48(%rbp), %r14
movq (%r14), %rdi
leaq 0x20c0(%rip), %rsi      # 0x5657
callq 0x20b0
movq %rax, %rbx
movq %r14, %rdi
callq 0x2110
testq %rbx, %rbx
je 0x3b2e
xorl %r13d, %r13d
leaq -0x660(%rbp), %r14
leaq -0x90(%rbp), %r15
leaq 0x1b6a(%rip), %r12      # 0x5132
movq %r14, %rdi
movl $0x3ff, %esi            # imm = 0x3FF
movq %rbx, %rdx
callq 0x2370
testq %rax, %rax
je 0x373f
movq %r15, %rdi
movq %r14, %rsi
callq 0x2410
movslq %r13d, %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0x2460
movq %rax, %r13
movq %rax, %rsi
shlq $0x20, %rsi
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
cmpq %rax, %rsi
je 0x35c8
sarq $0x20, %rsi
movq %r15, %rdi
pushq $0x3
popq %rdx
leaq 0x1b0d(%rip), %rcx      # 0x5131
callq 0x2150
addq $0x2, %r13
jmp 0x35c8
leaq -0x48(%rbp), %rdi
leaq -0x70(%rbp), %rsi
pushq $0x3
popq %rcx
xorl %edx, %edx
callq 0x2230
leaq 0x1b6a(%rip), %rsi      # 0x51b2
movq %rbx, %rdi
callq 0x46d5
movl %eax, %r14d
movq %rbx, %rdi
callq 0x2110
testb %r14b, %r14b
je 0x3778
movq 0x495d(%rip), %rdi      # 0x7fc8
leaq 0x1b44(%rip), %rsi      # 0x51b6
callq 0x2210
leaq 0x1ac4(%rip), %rsi      # 0x5142
leaq -0x70(%rbp), %rdi
callq 0x2410
leaq -0x48(%rbp), %rdi
pushq $0x1
popq %rdx
pushq $-0x1
popq %rcx
movq %rax, %rsi
callq 0x2230
leaq -0x48(%rbp), %r14
movq (%r14), %rdi
leaq 0x1fb0(%rip), %rsi      # 0x5657
callq 0x20b0
movq %rax, %rbx
movq %r14, %rdi
callq 0x2110
testq %rbx, %rbx
je 0x3b2e
xorl %r13d, %r13d
leaq -0x660(%rbp), %r14
leaq -0x90(%rbp), %r15
leaq 0x1adb(%rip), %r12      # 0x51b3
movq %r14, %rdi
movl $0x3ff, %esi            # imm = 0x3FF
movq %rbx, %rdx
callq 0x2370
testq %rax, %rax
je 0x3815
movq %r15, %rdi
movq %r14, %rsi
callq 0x2410
movslq %r13d, %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0x2460
movq %rax, %r13
movq %rax, %rsi
shlq $0x20, %rsi
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
cmpq %rax, %rsi
je 0x36d8
sarq $0x20, %rsi
movq %r15, %rdi
pushq $0x2
popq %rdx
leaq 0x1a7e(%rip), %rcx      # 0x51b2
callq 0x2150
addq $0x2, %r13
jmp 0x36d8
movq 0x4882(%rip), %rdi      # 0x7fc8
leaq -0x90(%rbp), %rsi
callq 0x21e0
movq %rbx, %rdi
callq 0x2300
testl %eax, %eax
je 0x3c12
movq 0x4867(%rip), %rax      # 0x7fd0
movq (%rax), %rsi
leaq 0x1a27(%rip), %rdi      # 0x519a
jmp 0x3b3f
leaq -0x48(%rbp), %rdi
leaq -0x70(%rbp), %rsi
pushq $0x3
popq %rcx
xorl %edx, %edx
callq 0x2230
leaq 0x1a47(%rip), %rsi      # 0x51d8
movq %rbx, %rdi
callq 0x46d5
movl %eax, %r14d
movq %rbx, %rdi
callq 0x2110
testb %r14b, %r14b
je 0x3856
cmpq $0x3, -0x68(%rbp)
jne 0x3938
leaq 0x1a1d(%rip), %rdi      # 0x51dc
callq 0x22a0
movq %rax, %rbx
movq 0x47fa(%rip), %rdi      # 0x7fc8
leaq 0x1a0c(%rip), %rsi      # 0x51e1
callq 0x2210
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2210
movq %rax, %rdi
callq 0x2120
movq %rbx, %rdi
callq 0x2320
movq 0x47cc(%rip), %rdi      # 0x7fc8
leaq 0x19f6(%rip), %rsi      # 0x51f9
callq 0x2210
movq %rax, %rdi
callq 0x2120
jmp 0x3c12
movq 0x47ac(%rip), %rdi      # 0x7fc8
leaq -0x90(%rbp), %rsi
callq 0x21e0
movq %rax, %rdi
callq 0x2120
movq %rbx, %rdi
callq 0x2300
testl %eax, %eax
je 0x3c12
movq 0x4789(%rip), %rax      # 0x7fd0
movq (%rax), %rsi
leaq 0x1970(%rip), %rdi      # 0x51c1
jmp 0x3b3f
leaq 0x1a15(%rip), %rsi      # 0x5272
leaq -0x70(%rbp), %rdi
callq 0x46d5
testb %al, %al
jne 0x428a
leaq -0x48(%rbp), %rdi
leaq -0x70(%rbp), %rsi
pushq $0x3
popq %rcx
xorl %edx, %edx
callq 0x2230
leaq 0x18ab(%rip), %rsi      # 0x5132
movq %rbx, %rdi
callq 0x46d5
movl %eax, %r14d
movq %rbx, %rdi
callq 0x2110
testb %r14b, %r14b
je 0x3a52
leaq -0x218(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x22e0
leaq -0x218(%rbp), %rsi
movq -0x50(%rbp), %r14
movq %r14, %rdi
callq 0x2be6
leaq -0x218(%rbp), %rdi
callq 0x2110
leaq -0x48(%rbp), %rdi
movq %r14, %rsi
callq 0x2c50
leaq -0xd0(%rbp), %rdi
movq %rbx, %rsi
callq 0x22b0
movq %rbx, %rdi
callq 0x2110
leaq -0x48(%rbp), %rdi
movq %r14, %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x2c76
leaq -0xb0(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x22b0
movq %rbx, %rdi
callq 0x2110
movq 0x46a1(%rip), %rdi      # 0x7fc8
leaq -0xd0(%rbp), %rsi
callq 0x21e0
jmp 0x3c03
leaq -0x48(%rbp), %rdi
leaq -0x70(%rbp), %rsi
pushq $0x3
popq %rdx
pushq $0x2
popq %rcx
callq 0x2230
leaq 0x18c8(%rip), %rsi      # 0x521a
movq %rbx, %rdi
callq 0x46d5
movl %eax, %r14d
movq %rbx, %rdi
callq 0x2110
testb %r14b, %r14b
je 0x3988
leaq 0x186b(%rip), %rdi      # 0x51dc
callq 0x22a0
leaq -0x70(%rbp), %rdi
pushq $0x4
popq %rsi
pushq $0x1
popq %rdx
movq %rax, %rcx
callq 0x2150
movq 0x4639(%rip), %rdi      # 0x7fc8
leaq 0x184b(%rip), %rsi      # 0x51e1
callq 0x2210
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
leaq -0x70(%rbp), %rsi
pushq $0x4
popq %rdx
pushq $-0x1
popq %rcx
callq 0x2230
leaq -0x48(%rbp), %rsi
movq %rbx, %rdi
callq 0x21e0
movq %rax, %rdi
callq 0x2120
leaq -0x48(%rbp), %rdi
callq 0x2110
leaq -0x48(%rbp), %rdi
leaq -0x70(%rbp), %rsi
pushq $0x4
popq %rdx
pushq $-0x1
popq %rcx
callq 0x2230
leaq -0x48(%rbp), %rbx
movq (%rbx), %rdi
callq 0x2320
movl %eax, %r14d
movq %rbx, %rdi
callq 0x2110
testl %r14d, %r14d
je 0x3c5f
leaq 0x1815(%rip), %rsi      # 0x521d
leaq -0x90(%rbp), %rdi
callq 0x2420
leaq -0x48(%rbp), %rdi
leaq -0x70(%rbp), %rsi
pushq $0x4
popq %rdx
pushq $-0x1
popq %rcx
callq 0x2230
leaq -0x90(%rbp), %r14
leaq -0x48(%rbp), %rsi
movq %r14, %rdi
callq 0x2440
leaq 0x1814(%rip), %rsi      # 0x5255
movq %rax, %rdi
callq 0x2410
leaq -0x48(%rbp), %rdi
jmp 0x3bfe
leaq -0x48(%rbp), %rdi
leaq -0x70(%rbp), %rsi
pushq $0x2
popq %rcx
xorl %edx, %edx
callq 0x2230
leaq 0x1748(%rip), %rsi      # 0x51b3
movq %rbx, %rdi
callq 0x46d5
movl %eax, %r14d
movq %rbx, %rdi
callq 0x2110
testb %r14b, %r14b
je 0x3b49
leaq -0x1f8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x22e0
leaq -0x1f8(%rbp), %rsi
movq -0x50(%rbp), %rdi
callq 0x2be6
leaq -0x1f8(%rbp), %rdi
callq 0x2110
leaq -0x48(%rbp), %r14
leaq -0xd0(%rbp), %r15
pushq $-0x1
popq %r12
leaq 0x174f(%rip), %r13      # 0x5218
movq %r14, %rdi
movq -0x50(%rbp), %rsi
callq 0x2c50
movq %r15, %rdi
movq %r14, %rsi
callq 0x22b0
movq %r14, %rdi
callq 0x2110
movq -0xc8(%rbp), %rdx
decq %rdx
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rcx
callq 0x2230
movq %r14, %rdi
movq %r13, %rsi
callq 0x46d5
movl %eax, %ebx
movq %r14, %rdi
callq 0x2110
testb %bl, %bl
jne 0x3bc0
movq 0x44a4(%rip), %rdi      # 0x7fc8
movq %r15, %rsi
callq 0x21e0
jmp 0x3ac9
movq 0x449b(%rip), %rax      # 0x7fd0
movq (%rax), %rsi
leaq 0x1609(%rip), %rdi      # 0x5148
callq 0x2260
jmp 0x3c12
leaq -0x48(%rbp), %rdi
leaq -0x70(%rbp), %rsi
pushq $0x2
popq %rcx
xorl %edx, %edx
callq 0x2230
leaq 0x1677(%rip), %rsi      # 0x51d9
movq %rbx, %rdi
callq 0x46d5
movl %eax, %r14d
movq %rbx, %rdi
callq 0x2110
testb %r14b, %r14b
je 0x3c7c
leaq -0x1d8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x22e0
leaq -0x1d8(%rbp), %rsi
movq -0x50(%rbp), %rbx
movq %rbx, %rdi
callq 0x2be6
leaq -0x1d8(%rbp), %rdi
callq 0x2110
leaq -0x48(%rbp), %rdi
movq %rbx, %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x2c76
jmp 0x3be5
movq 0x4401(%rip), %rdi      # 0x7fc8
leaq -0xd0(%rbp), %rsi
callq 0x21e0
leaq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x2c76
leaq -0xb0(%rbp), %r14
leaq -0x48(%rbp), %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x22b0
movq %rbx, %rdi
callq 0x2110
movq 0x43be(%rip), %rdi      # 0x7fc8
movq %r14, %rsi
callq 0x21e0
leaq -0x258(%rbp), %rdi
callq 0x2110
leaq -0x90(%rbp), %rdi
callq 0x2110
leaq -0xb0(%rbp), %rdi
callq 0x2110
leaq -0xd0(%rbp), %rdi
callq 0x2110
leaq -0x70(%rbp), %rdi
callq 0x2110
xorl %eax, %eax
addq $0x638, %rsp            # imm = 0x638
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x4362(%rip), %rdi      # 0x7fc8
leaq 0x158c(%rip), %rsi      # 0x51f9
callq 0x2210
movq %rax, %rdi
callq 0x2120
jmp 0x3c12
leaq -0x48(%rbp), %rdi
leaq -0x70(%rbp), %rsi
pushq $0x3
popq %rcx
xorl %edx, %edx
callq 0x2230
leaq 0x15fe(%rip), %rsi      # 0x5293
movq %rbx, %rdi
callq 0x46d5
movl %eax, %r14d
movq %rbx, %rdi
callq 0x2110
testb %r14b, %r14b
je 0x3dbf
leaq -0x48(%rbp), %rdi
leaq -0x70(%rbp), %rsi
pushq $0x4
popq %rdx
pushq $-0x1
popq %rcx
callq 0x2230
movq (%rbx), %rsi
callq 0x445a
movl %eax, %r14d
movq %rbx, %rdi
callq 0x2110
testl %r14d, %r14d
je 0x3f15
leaq -0x48(%rbp), %rdi
leaq -0x70(%rbp), %rsi
pushq $0x4
popq %rdx
pushq $-0x1
popq %rcx
callq 0x2230
movq (%rbx), %rdi
pushq $0x4
popq %rsi
callq 0x2390
movl %eax, %r14d
movq %rbx, %rdi
callq 0x2110
cmpl $-0x1, %r14d
je 0x3f63
leaq -0x1b8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x22e0
leaq -0x1b8(%rbp), %rsi
movq -0x50(%rbp), %rbx
movq %rbx, %rdi
callq 0x2be6
leaq -0x1b8(%rbp), %rdi
callq 0x2110
leaq -0x48(%rbp), %rdi
movq %rbx, %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x2c76
leaq -0xb0(%rbp), %r14
leaq -0x48(%rbp), %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x22b0
movq %rbx, %rdi
callq 0x2110
leaq 0x1556(%rip), %rsi      # 0x52ce
movq %r14, %rdi
callq 0x46d5
testb %al, %al
je 0x4024
leaq -0x48(%rbp), %rdi
leaq -0x70(%rbp), %rsi
pushq $0x4
popq %rdx
pushq $-0x1
popq %rcx
callq 0x2230
movq 0x4226(%rip), %rdi      # 0x7fc8
leaq -0x48(%rbp), %rsi
callq 0x21e0
leaq 0x1523(%rip), %rsi      # 0x52d5
movq %rax, %rdi
callq 0x2210
jmp 0x4016
leaq -0x48(%rbp), %rdi
leaq -0x70(%rbp), %rsi
pushq $0x3
popq %rcx
xorl %edx, %edx
callq 0x2230
leaq 0x15d3(%rip), %rsi      # 0x53ab
movq %rbx, %rdi
callq 0x46d5
movl %eax, %r14d
movq %rbx, %rdi
callq 0x2110
testb %r14b, %r14b
je 0x3ef0
leaq 0x15b4(%rip), %rdi      # 0x53af
pushq $0x2
popq %rsi
callq 0x2390
cmpl $-0x1, %eax
je 0x40be
leaq -0x48(%rbp), %rdi
leaq -0x70(%rbp), %rsi
pushq $0x4
popq %rdx
pushq $-0x1
popq %rcx
callq 0x2230
movq (%rbx), %rsi
callq 0x445a
movl %eax, %r14d
movq %rbx, %rdi
callq 0x2110
testl %r14d, %r14d
je 0x3f6f
leaq -0x48(%rbp), %rdi
leaq -0x70(%rbp), %rsi
pushq $0x4
popq %rdx
pushq $-0x1
popq %rcx
callq 0x2230
movq 0x4173(%rip), %rdi      # 0x7fc8
leaq -0x48(%rbp), %rsi
callq 0x21e0
leaq 0x1565(%rip), %rsi      # 0x53ca
movq %rax, %rdi
callq 0x2210
leaq -0x48(%rbp), %rdi
callq 0x2110
leaq -0xd5(%rbp), %rbx
leaq -0x258(%rbp), %r15
leaq 0x1577(%rip), %r12      # 0x5402
leaq 0x13dd(%rip), %r13      # 0x526f
leaq 0x156c(%rip), %r14      # 0x5405
movq 0x4120(%rip), %rax      # 0x7fc0
movq (%rax), %rdx
movq %rbx, %rdi
pushq $0x5
popq %rsi
callq 0x2370
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2420
movq %r15, %rdi
movq %r12, %rsi
callq 0x46d5
testb %al, %al
jne 0x3c12
movq %r15, %rdi
movq %r13, %rsi
callq 0x46d5
testb %al, %al
jne 0x3f6f
movq 0x40e2(%rip), %rdi      # 0x7fc8
movq %r14, %rsi
callq 0x2210
jmp 0x3e99
leaq 0x15e7(%rip), %rsi      # 0x54de
leaq -0x70(%rbp), %rdi
callq 0x46d5
testb %al, %al
je 0x3f4c
leaq 0x17a7(%rip), %rdi      # 0x56b2
callq 0x2350
jmp 0x3c12
leaq -0x48(%rbp), %rdi
leaq -0x70(%rbp), %rsi
pushq $0x4
popq %rdx
pushq $-0x1
popq %rcx
callq 0x2230
movq 0x4099(%rip), %rdi      # 0x7fc8
leaq -0x48(%rbp), %rsi
callq 0x21e0
leaq 0x1358(%rip), %rsi      # 0x5297
movq %rax, %rdi
callq 0x2210
jmp 0x4016
cmpq $0x0, -0x68(%rbp)
je 0x3c12
leaq 0x1585(%rip), %rsi      # 0x54e3
jmp 0x40c5
leaq 0x1344(%rip), %rsi      # 0x52ae
jmp 0x40c5
leaq -0x118(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x22e0
leaq -0x118(%rbp), %rsi
movq -0x50(%rbp), %rbx
movq %rbx, %rdi
callq 0x2be6
leaq -0x118(%rbp), %rdi
callq 0x2110
leaq -0x48(%rbp), %rdi
movq %rbx, %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x2c76
leaq -0xb0(%rbp), %rbx
leaq -0x48(%rbp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x22b0
movq %r14, %rdi
callq 0x2110
leaq 0x144f(%rip), %rsi      # 0x5423
movq %rbx, %rdi
callq 0x46d5
testb %al, %al
je 0x40d6
leaq -0x48(%rbp), %rdi
leaq -0x70(%rbp), %rsi
pushq $0x4
popq %rdx
pushq $-0x1
popq %rcx
callq 0x2230
movq 0x3fca(%rip), %rdi      # 0x7fc8
leaq -0x48(%rbp), %rsi
callq 0x21e0
leaq 0x1419(%rip), %rsi      # 0x5427
movq %rax, %rdi
callq 0x2210
leaq -0x48(%rbp), %rdi
callq 0x2110
jmp 0x3c12
leaq -0x198(%rbp), %rdi
leaq -0x70(%rbp), %rsi
pushq $0x4
popq %rdx
pushq $-0x1
popq %rcx
callq 0x2230
leaq -0x198(%rbp), %rsi
callq 0x4488
movl %eax, %ebx
leaq -0x198(%rbp), %rdi
callq 0x2110
testl %ebx, %ebx
je 0x4190
leaq 0x12aa(%rip), %rsi      # 0x530d
leaq -0x178(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0x20f0
leaq -0x178(%rbp), %rsi
movq -0x50(%rbp), %rdi
callq 0x2be6
leaq -0x178(%rbp), %rdi
callq 0x2110
movq 0x3f32(%rip), %rdi      # 0x7fc8
leaq 0x1276(%rip), %rsi      # 0x5313
callq 0x2210
movq 0x3f1f(%rip), %rdi      # 0x7fc8
leaq 0x1284(%rip), %rsi      # 0x5334
callq 0x2210
leaq 0x129e(%rip), %rsi      # 0x535a
jmp 0x40c5
leaq 0x12ed(%rip), %rsi      # 0x53b2
movq 0x3efc(%rip), %rdi      # 0x7fc8
callq 0x2210
jmp 0x3c12
leaq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x2c76
leaq -0xb0(%rbp), %r14
leaq -0x48(%rbp), %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x22b0
movq %rbx, %rdi
callq 0x2110
leaq 0x1200(%rip), %rsi      # 0x530d
movq %r14, %rdi
callq 0x46d5
testb %al, %al
je 0x421f
leaq -0x48(%rbp), %rdi
leaq -0x70(%rbp), %rsi
pushq $0x4
popq %rdx
pushq $-0x1
popq %rcx
callq 0x2230
movq (%rbx), %rdi
leaq 0xf82(%rip), %rsi       # 0x50bc
callq 0x2280
movq %rax, %r14
movq %rbx, %rdi
callq 0x2110
movq %r14, %rdi
callq 0x2220
movq 0x3e6f(%rip), %rdi      # 0x7fc8
leaq 0x12de(%rip), %rsi      # 0x543e
callq 0x2210
movq 0x3e5c(%rip), %rdi      # 0x7fc8
leaq 0x1342(%rip), %rsi      # 0x54b5
callq 0x2210
movq 0x3e49(%rip), %rdi      # 0x7fc8
leaq 0x12d6(%rip), %rsi      # 0x545c
callq 0x2210
jmp 0x3c12
leaq 0x11ea(%rip), %rsi      # 0x5381
leaq -0x158(%rbp), %rdi
leaq -0x48(%rbp), %rdx
callq 0x20f0
leaq -0x158(%rbp), %rsi
movq -0x50(%rbp), %rdi
callq 0x2be6
leaq -0x158(%rbp), %rdi
callq 0x2110
leaq -0x138(%rbp), %rdi
leaq -0x70(%rbp), %rsi
pushq $0x4
popq %rdx
pushq $-0x1
popq %rcx
callq 0x2230
leaq -0x138(%rbp), %rsi
movq -0x50(%rbp), %rdi
callq 0x2c92
leaq -0x138(%rbp), %rdi
callq 0x2110
movq 0x3dcc(%rip), %rdi      # 0x7fc8
leaq 0x1182(%rip), %rsi      # 0x5385
callq 0x2210
leaq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x2c76
jmp 0x3bec
leaq -0xf8(%rbp), %rdi
leaq -0x70(%rbp), %rsi
pushq $0x4
popq %rdx
pushq $-0x1
popq %rcx
callq 0x2230
leaq -0xf8(%rbp), %rsi
movq -0x50(%rbp), %rdi
callq 0x2eac
movl %eax, %ebx
leaq -0xf8(%rbp), %rdi
callq 0x2110
testl %ebx, %ebx
leaq 0x1258(%rip), %rax      # 0x54b4
leaq 0x121e(%rip), %rsi      # 0x5481
cmoveq %rax, %rsi
movq 0x3d5a(%rip), %rdi      # 0x7fc8
callq 0x2210
leaq -0x48(%rbp), %rdi
movq -0x50(%rbp), %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x2c76
jmp 0x3bec
movq 0x3d37(%rip), %rdi      # 0x7fc8
leaq 0xfdf(%rip), %rsi       # 0x5277
callq 0x2210
leaq -0x238(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x22e0
leaq -0x238(%rbp), %rsi
movq -0x50(%rbp), %rdi
callq 0x2be6
leaq -0x238(%rbp), %rdi
callq 0x2110
movq -0x50(%rbp), %rax
leaq 0xf0(%rax), %rdi
callq 0x2888
movq -0x50(%rbp), %rdi
callq 0x2888
xorl %edi, %edi
callq 0x2290
jmp 0x4415
movq %rax, %rbx
leaq -0xf8(%rbp), %rdi
jmp 0x43f6
jmp 0x4415
jmp 0x4415
movq %rax, %rbx
leaq -0x138(%rbp), %rdi
jmp 0x43f6
movq %rax, %rbx
leaq -0x158(%rbp), %rdi
jmp 0x43f6
jmp 0x4415
jmp 0x4415
jmp 0x4415
movq %rax, %rbx
leaq -0x178(%rbp), %rdi
jmp 0x43f6
jmp 0x4415
jmp 0x4415
movq %rax, %rbx
leaq -0x198(%rbp), %rdi
jmp 0x43f6
jmp 0x4415
jmp 0x4415
jmp 0x43ef
jmp 0x4415
movq %rax, %rbx
leaq -0x118(%rbp), %rdi
jmp 0x43f6
jmp 0x4415
jmp 0x4415
jmp 0x43ef
jmp 0x4415
jmp 0x43ef
movq %rax, %rbx
leaq -0x1b8(%rbp), %rdi
jmp 0x43f6
jmp 0x4415
jmp 0x43ef
jmp 0x4415
jmp 0x4415
jmp 0x4415
movq %rax, %rbx
leaq -0x1d8(%rbp), %rdi
jmp 0x43f6
jmp 0x4415
movq %rax, %rbx
leaq -0x238(%rbp), %rdi
jmp 0x43f6
jmp 0x4415
movq %rax, %rbx
leaq -0x1f8(%rbp), %rdi
jmp 0x43f6
jmp 0x4415
jmp 0x4415
jmp 0x4415
jmp 0x4415
jmp 0x4415
jmp 0x4415
jmp 0x4415
movq %rax, %rbx
leaq -0x218(%rbp), %rdi
jmp 0x43f6
jmp 0x4415
jmp 0x4415
jmp 0x4415
jmp 0x43ef
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x2110
jmp 0x4418
jmp 0x4415
jmp 0x4415
jmp 0x4415
jmp 0x4415
jmp 0x4415
jmp 0x4415
jmp 0x4415
jmp 0x4415
jmp 0x4415
jmp 0x4415
jmp 0x4415
jmp 0x4415
movq %rax, %rbx
leaq -0x258(%rbp), %rdi
callq 0x2110
leaq -0x90(%rbp), %rdi
callq 0x2110
leaq -0xb0(%rbp), %rdi
callq 0x2110
leaq -0xd0(%rbp), %rdi
callq 0x2110
leaq -0x70(%rbp), %rdi
callq 0x2110
movq %rbx, %rdi
callq 0x23d0
nop