// File: /workspace/github_cpp_makefile_star2_O3/giovannarosone[P]BCR_LCP_GSA/TransposeFasta.cpp
// Function: TransposeFasta::convertQS(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned long)
bool TransposeFasta::convertQS( const string& input, const string& output, dataTypeNChar ram )
{
	FILE* ifile;
	cerr << "\nTrasposeFasta convertQS: file " << input << " !" << endl;
	
	ifile = fopen(input.c_str(), "rb");

    if( ifile == NULL ) { 
		cerr << "TrasposeFasta convertQS: could not open file " << input << " !" << endl; 
	}


	vector <FILE*> outputFiles_;
	outputFiles_.resize(lengthRead);    //One for each symbol of the read.
    // create output files   (cyc qs files)
    for(dataTypelenSeq i=0;i<lengthRead;i++ )
    {
        std::stringstream fn;
        fn << output << "qs." << (int)i << ".txt";
        outputFiles_[i] = fopen( fn.str().c_str(),"w" );
        if (outputFiles_[i] == NULL) {
                std::cerr << "TrasposeFasta: could not open file "  <<  fn.str().c_str() << std::endl;
				exit (EXIT_FAILURE);
		}
        fclose(outputFiles_[i]);
    }

	//TO DO: CHECK THE CASE OF charsBuffered >= SIZEBUFFERcycFiles
	//if (nSeq > SIZEBUFFERcycFiles) {
	//	cerr << "Warning: Number of sequences is: " << (unsigned long)nSeq << " and SIZEBUFFERcycFiles (in TransposeFasta.h) is " << SIZEBUFFERcycFiles << endl;
	//}
	
	ram = ram * nSeq;   //ram used in BCR for vector 
	
	SIZEBUFFERcycFiles = ram / lengthRead;
	
	if ( SIZEBUFFERcycFiles > nSeq )   //number of columns
		SIZEBUFFERcycFiles = nSeq;
	else if ( SIZEBUFFERcycFiles < 1048576 )
		SIZEBUFFERcycFiles = 1048576;
	
	
	std::cerr << "TrasposeFasta.convertQS: init buf_ of size " << (unsigned long) lengthRead << " * " << SIZEBUFFERcycFiles << std::endl;
	
	vector<vector<uchar> > buf_;
	buf_.resize(lengthRead);    //For each symbol/column of the read
	for (dataTypelenSeq x = 0 ; x < lengthRead; x++)         //For each symbol/column of the read
		buf_[x].resize(SIZEBUFFERcycFiles);
	for (dataTypelenSeq x = 0 ; x < lengthRead; x++)         //For each symbol/column of the read
		for (dataTypeNChar y = 0 ; y < SIZEBUFFERcycFiles; y++)         //For each buffered symbol of the read
			buf_[x][y]=TERMINATE_CHAR_LEN;

	//char buf[SIZEBUFFERcycFiles];
    //for(dataTypeNChar i=0;i<SIZEBUFFERcycFiles;i++ )
//		buf[i] = '\0';	
	//fgets ( buf, SIZEBUFFERcycFiles, ifile );			//it starts with '>', we can ignore it
	
	std::ifstream infile(input.c_str());
	string bufChar;
	
	dataTypeNChar charsBuffered = 0;
    // looping through the input file, add the characters to the buffer, print buffer when it's full
//    unsigned int num_read = 0;
    dataTypeNChar num_write = 0;
	dataTypelenSeq tmpLen = 0;
    nSeq = 0;
	dataTypelenSeq sumLenCum = 0;

    /*while( !feof(ifile) )
    {
        if( charsBuffered-1 == SIZEBUFFERcycFiles)   //it is linked to the number of sequences
        {
            // write buffers to the files, clear buffers
            for(dataTypelenSeq i=0;i<lengthRead;i++ )  {       //For each symbol/column of the read   (for each string)
                std::stringstream fn;
                fn << output << "qs." << (int)i << ".txt";
				outputFiles_[i] = fopen( fn.str().c_str(),"a" );
				num_write = fwrite ( &buf_[i][0],sizeof(char),charsBuffered-1,outputFiles_[i] );
				assert( num_write == charsBuffered-1 );
				for(dataTypeNChar x=0; x<charsBuffered-1; x++ ) {
					//For each buffered symbol of the read (a symbol for each string)
					if (buf_[i][x] != TERMINATE_CHAR_LEN) {
						//freq[(unsigned int)(buf_[i][x])]=1;
						buf_[i][x] = TERMINATE_CHAR_LEN;
					}
				}
				fclose(outputFiles_[i]);
            }
			
	        //for (dataTypelenSeq x = 0 ; x < lengthRead; x++)         //For each symbol/column of the read
		    //    for (dataTypeNChar y = 0 ; y < BUFFERSIZE; y++)         //For each buffered symbol of the read
			//        buf_[x][y]=TERMINATE_CHAR_LEN;
			
            charsBuffered=1;
        }

        // process the input
        if( buf[0] != '>' )
        {
			dataTypelenSeq posit = 0 + sumLenCum;
			for(dataTypelenSeq i=posit; i < posit + tmpLen;i++) {
				buf_[i][charsBuffered-1] = buf[i-posit];
			}

            sumLenCum += tmpLen;

			#if verboseEncode==1
				cerr << "Partial Buf_ " << endl;
				for(dataTypelenSeq i=0;i<lengthRead;i++ ) {
					cerr << (int)i << " " ;
					for(dataTypeNChar x=0; x<charsBuffered; x++ )
						cerr << buf_[i][x] ;
					cerr << endl;
				}
			#endif
        }
		else  {
			if (nSeq % SIZEBUFFERcycFiles == 0)
				cerr << "New QS sequence - " << "Sequence N. " << (int)nSeq << std::endl;

			sumLenCum = 0;
		    // increase the number of sequences
			nSeq++;
			// increase the counter of chars buffered
			charsBuffered++;
		}
		for(dataTypelenSeq i=0;i<lengthRead;i++ )
			buf[i] = '\0';
		fgets ( buf, SIZEBUFFERcycFiles, ifile );
        if ((buf[strlen(buf)-2] == '\r') || (buf[strlen(buf)-2] == '\n'))
            buf[strlen(buf)-2] = '\0';
        else if ((buf[strlen(buf)-1] == '\r') || (buf[strlen(buf)-1] == '\n'))
            buf[strlen(buf)-1] = '\0';

		tmpLen = strlen(buf);          //tmpLen = strlen(buf)-1;
    }
	*/
	
	while (getline(infile, bufChar))  {
		if ((bufChar[bufChar.length()-2] == '\r') || (bufChar[bufChar.length()-2] == '\n'))
            bufChar[bufChar.length()-2] = '\0';
        else if ((bufChar[bufChar.length()-1] == '\r') || (bufChar[bufChar.length()-1] == '\n'))
            bufChar[bufChar.length()-1] = '\0';		
		
		tmpLen = bufChar.length();          //tmpLen = strlen(buf)-1;
		
		if ( (charsBuffered > 0) && ( charsBuffered-1 == SIZEBUFFERcycFiles))   //it is linked to the number of sequences
        {
			// write buffers to the files, clear buffers
            for(dataTypelenSeq i=0;i<lengthRead;i++ )  {       //For each symbol/column of the read   (for each string)
                std::stringstream fn;
                fn << output << "qs." << (int)i << ".txt";
				outputFiles_[i] = fopen( fn.str().c_str(),"a" );
				num_write = fwrite ( &buf_[i][0],sizeof(char),charsBuffered-1,outputFiles_[i] );
				assert( num_write == charsBuffered-1 );
				for(dataTypeNChar x=0; x<charsBuffered-1; x++ ) {
					//For each buffered symbol of the read (a symbol for each string)
					if (buf_[i][x] != TERMINATE_CHAR_LEN) {
						//freq[(unsigned int)(buf_[i][x])]++;   //=1
						buf_[i][x] = TERMINATE_CHAR_LEN;
					}
				}
				fclose(outputFiles_[i]);
            }
            charsBuffered=1;
        }

        // process the input
        if( bufChar[0] != '{' )   //no title
        {
			
			dataTypelenSeq posit = 0 + sumLenCum;
			for(dataTypelenSeq i=posit; i < posit + tmpLen;i++) {
				buf_[i][charsBuffered-1] = bufChar[i-posit];
			}

            sumLenCum += tmpLen;
			//cerr << "it is not title"<< " tmpLen " << (int)tmpLen << " sumLenCum " << (unsigned int)sumLenCum << endl;
			
 			/*#if verboseEncode==1
				cerr << "Partial Buf_ " << endl;
				for(dataTypelenSeq i=0;i<lengthRead;i++ ) {
					cerr << (int)i << " " ;
					for(dataTypeNChar x=0; x<charsBuffered; x++ )
						cerr << buf_[i][x] ;
					cerr << endl;
				}
			#endif */
        }
		else  {        //it is a title
            sumLenCum = 0;
		    // increase the number of sequences
			nSeq++;
			//cerr << "it is a title"<< nSeq << endl;
			// increase the counter of chars buffered
			charsBuffered++;
		}
		//for(dataTypelenSeq i=0;i<lengthRead;i++ )
		//	buf[i] = '\0';
		//fgets ( buf, BUFFER_SIZELEN, ifile );
        //if ((buf[strlen(buf)-2] == '\r') || (buf[strlen(buf)-2] == '\n'))
         //   buf[strlen(buf)-2] = '\0';
        //else if ((buf[strlen(buf)-1] == '\r') || (buf[strlen(buf)-1] == '\n'))
        //    buf[strlen(buf)-1] = '\0';

//        cerr << "buf: " << buf << "." << endl;
		
    }  //end-while
	
	

	/* 	#if verboseEncode==1
		cerr << "The last Buf_ " << endl;
		cerr << "Buf_ " << endl;
		for(dataTypelenSeq i=0;i<lengthRead;i++ ) {
			for(dataTypeNChar x=0; x<charsBuffered; x++ )
				cerr << buf_[i][x] ;
			cerr << endl;
		}
	#endif */

    // write the rest
    for(dataTypelenSeq i=0;i<lengthRead;i++ )
    {
        std::stringstream fn;
        fn << output << "qs." << (int)i << ".txt";
        outputFiles_[i] = fopen( fn.str().c_str(),"a" );
		num_write = fwrite ( &buf_[i][0],sizeof(char),charsBuffered,outputFiles_[i] );
		assert( num_write == charsBuffered );
		for(dataTypeNChar x=0; x<charsBuffered; x++ ) {
			if (buf_[i][x] != TERMINATE_CHAR_LEN) {
				//freq[(unsigned int)(buf_[i][x])]=1;
				buf_[i][x] = TERMINATE_CHAR_LEN;
			}
		}
        fclose( outputFiles_[i]);
    }

	cerr << "Number of quality score sequences reading/writing: " << nSeq << "\n";
	//cerr << "Number of characters reading/writing: " << lengthTexts << "\n";

    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x428, %rsp            # imm = 0x428
movq %rcx, 0x10(%rsp)
movq %rdx, 0x18(%rsp)
movq %rsi, %rbx
movq %rdi, %rbp
movq 0x76de(%rip), %r14      # 0x10ff0
leaq 0x3b0a(%rip), %rsi      # 0xd423
movl $0x1f, %edx
movq %r14, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x32d0
movq %rax, %r14
leaq 0x3b04(%rip), %rsi      # 0xd443
movl $0x2, %edx
movq %rax, %rdi
callq 0x32d0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3280
movsbl %al, %esi
movq %r14, %rdi
callq 0x3050
movq %rax, %rdi
callq 0x31e0
movq (%rbx), %rdi
leaq 0x2fd6(%rip), %rsi      # 0xc953
callq 0x32e0
testq %rax, %rax
jne 0x99ef
movq 0x7662(%rip), %r14      # 0x10ff0
leaq 0x3ab1(%rip), %rsi      # 0xd446
movl $0x2d, %edx
movq %r14, %rdi
callq 0x32d0
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq %r14, %rdi
callq 0x32d0
movq %rax, %r14
leaq 0x3a88(%rip), %rsi      # 0xd443
movl $0x2, %edx
movq %rax, %rdi
callq 0x32d0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3280
movsbl %al, %esi
movq %r14, %rdi
callq 0x3050
movq %rax, %rdi
callq 0x31e0
xorps %xmm0, %xmm0
leaq 0x20(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movzbl (%rbp), %esi
callq 0xa546
cmpb $0x0, (%rbp)
movq %rbp, 0x8(%rsp)
je 0x9b19
leaq 0xa8(%rsp), %r14
xorl %r12d, %r12d
leaq 0x220(%rsp), %r13
movq 0x7584(%rip), %rbp      # 0x10fb8
movq %r13, %rdi
callq 0x31f0
movq 0x18(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
leaq 0x230(%rsp), %rdi
callq 0x32d0
movq %rax, %r15
movl $0x3, %edx
movq %rax, %rdi
leaq 0x3a0d(%rip), %rsi      # 0xd474
callq 0x32d0
movq %r15, %rdi
movl %r12d, %esi
callq 0x3440
movl $0x4, %edx
movq %rax, %rdi
leaq 0x2ec8(%rip), %rsi      # 0xc94e
callq 0x32d0
leaq 0x98(%rsp), %rdi
leaq 0x238(%rsp), %rsi
callq 0x33c0
movq 0x98(%rsp), %rdi
leaq 0x3497(%rip), %rsi      # 0xcf46
callq 0x32e0
movq 0x20(%rsp), %rcx
movq %rax, (%rcx,%r12,8)
movq 0x98(%rsp), %rdi
cmpq %r14, %rdi
je 0x9acf
callq 0x3260
movq 0x20(%rsp), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0xa0c8
callq 0x32a0
movq %r13, %rdi
movq %rbp, %rsi
callq 0x3210
leaq 0x2a0(%rsp), %rdi
callq 0x30d0
incq %r12
movq 0x8(%rsp), %rax
movzbl (%rax), %esi
cmpq %rsi, %r12
jb 0x9a34
movq 0x8(%rsp), %rbp
jmp 0x9b1b
xorl %esi, %esi
movl 0x10(%rbp), %ecx
movq 0x10(%rsp), %rax
imulq %rcx, %rax
xorl %edx, %edx
divq %rsi
movq %rax, 0x820(%rbp)
cmpq %rcx, %rax
ja 0x9b45
movl $0x100000, %ecx         # imm = 0x100000
cmpq $0xfffff, %rax          # imm = 0xFFFFF
ja 0x9b4c
movq %rcx, 0x820(%rbp)
movq 0x749d(%rip), %rdi      # 0x10ff0
leaq 0x391e(%rip), %rsi      # 0xd478
movl $0x2b, %edx
callq 0x32d0
movzbl (%rbp), %esi
movq 0x7481(%rip), %rdi      # 0x10ff0
callq 0x31d0
movq %rax, %r15
leaq 0x2ce4(%rip), %rsi      # 0xc862
movl $0x3, %edx
movq %rax, %rdi
callq 0x32d0
movq 0x820(%rbp), %rsi
movq %r15, %rdi
callq 0x31d0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x3280
movsbl %al, %esi
movq %r15, %rdi
callq 0x3050
movq %rax, %rdi
callq 0x31e0
xorps %xmm0, %xmm0
leaq 0x40(%rsp), %rdi
movaps %xmm0, (%rdi)
movq $0x0, 0x10(%rdi)
movzbl (%rbp), %esi
callq 0xa578
cmpb $0x0, (%rbp)
je 0x9c5b
movq %rbx, %r15
xorl %ebx, %ebx
xorl %r14d, %r14d
movq 0x40(%rsp), %rdi
addq %rbx, %rdi
movq 0x820(%rbp), %rsi
callq 0xa5fa
incq %r14
movzbl (%rbp), %ecx
addq $0x18, %rbx
cmpq %rcx, %r14
jb 0x9bee
testb %cl, %cl
movq %r15, %rbx
je 0x9c5b
movq 0x820(%rbp), %rdx
xorl %eax, %eax
testq %rdx, %rdx
je 0x9c4e
leaq (%rax,%rax,2), %rcx
xorl %esi, %esi
movq 0x40(%rsp), %rdx
movq (%rdx,%rcx,8), %rdx
movb $-0x1, (%rdx,%rsi)
incq %rsi
movq 0x820(%rbp), %rdx
cmpq %rdx, %rsi
jb 0x9c2d
movb (%rbp), %cl
jmp 0x9c50
xorl %edx, %edx
incq %rax
movzbl %cl, %esi
cmpq %rsi, %rax
jb 0x9c22
movq (%rbx), %rsi
leaq 0x220(%rsp), %r14
movq %r14, %rdi
movl $0x8, %edx
callq 0x3490
leaq 0x68(%rsp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
movl $0x0, 0x10(%rbp)
xorl %r15d, %r15d
leaq 0x98(%rsp), %r12
xorl %ebx, %ebx
movq 0x220(%rsp), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x3280
movsbl %al, %edx
movq %r14, %rdi
leaq 0x58(%rsp), %rsi
callq 0x34a0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x9edd
movq 0x58(%rsp), %rcx
movq 0x60(%rsp), %rdx
leaq (%rcx,%rdx), %rax
addq $-0x2, %rax
movzbl (%rax), %esi
cmpl $0xa, %esi
je 0x9d0c
cmpl $0xd, %esi
je 0x9d0c
addq %rdx, %rcx
movzbl -0x1(%rcx), %edx
movq %rcx, %rax
decq %rax
cmpl $0xd, %edx
je 0x9d0c
cmpl $0xa, %edx
jne 0x9d0f
movb $0x0, (%rax)
movl 0x60(%rsp), %eax
movl %eax, 0x10(%rsp)
testq %r15, %r15
je 0x9e82
leaq -0x1(%r15), %r13
cmpq 0x820(%rbp), %r13
jne 0x9e85
movl $0x1, %r15d
cmpb $0x0, (%rbp)
je 0x9e85
xorl %ebp, %ebp
movq %r12, %rdi
callq 0x31f0
movq %r14, %r15
movq 0x18(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
leaq 0xa8(%rsp), %rdi
callq 0x32d0
movq %rax, %r14
movl $0x3, %edx
movq %rax, %rdi
leaq 0x36fb(%rip), %rsi      # 0xd474
callq 0x32d0
movq %r14, %rdi
movl %ebp, %esi
callq 0x3440
movl $0x4, %edx
movq %rax, %rdi
leaq 0x2bb7(%rip), %rsi      # 0xc94e
callq 0x32d0
leaq 0x78(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x33c0
movq 0x78(%rsp), %rdi
leaq 0x34c2(%rip), %rsi      # 0xd27c
callq 0x32e0
movq 0x20(%rsp), %rcx
movq %rax, (%rcx,%rbp,8)
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x9ddf
callq 0x3260
movq 0x40(%rsp), %rax
leaq (,%rbp,2), %r14
addq %rbp, %r14
movq (%rax,%r14,8), %rdi
movq 0x20(%rsp), %rax
movq (%rax,%rbp,8), %rcx
movl $0x1, %esi
movq %r13, %rdx
callq 0x34c0
cmpq %r13, %rax
jne 0xa0a9
testq %r13, %r13
je 0x9e34
xorl %eax, %eax
movq 0x40(%rsp), %rcx
movq (%rcx,%r14,8), %rcx
cmpb $-0x1, (%rcx,%rax)
je 0x9e2c
movb $-0x1, (%rcx,%rax)
incq %rax
cmpq %rax, %r13
jne 0x9e19
movq 0x20(%rsp), %rax
movq (%rax,%rbp,8), %rdi
callq 0x32a0
movq %r12, %rdi
movq 0x716c(%rip), %rsi      # 0x10fb8
callq 0x3210
leaq 0x118(%rsp), %rdi
callq 0x30d0
incq %rbp
movq 0x8(%rsp), %rax
movzbl (%rax), %eax
cmpq %rax, %rbp
movq %r15, %r14
movl $0x1, %r15d
jb 0x9d43
movq 0x8(%rsp), %rbp
jmp 0x9e85
xorl %r15d, %r15d
movq 0x58(%rsp), %rax
cmpb $0x7b, (%rax)
je 0x9ed2
movzbl %bl, %eax
movzbl 0x10(%rsp), %esi
leal (%rsi,%rax), %ecx
movl %eax, %edx
testl %esi, %esi
je 0x9ecb
subl %eax, %edx
movslq %edx, %rdx
movq 0x58(%rsp), %rsi
movb (%rsi,%rdx), %dl
movzbl %bl, %ebx
movq 0x40(%rsp), %rsi
leaq (%rbx,%rbx,2), %rdi
movq (%rsi,%rdi,8), %rsi
movb %dl, -0x1(%rsi,%r15)
incb %bl
movzbl %bl, %edx
cmpl %edx, %ecx
ja 0x9ea0
movl %ecx, %ebx
jmp 0x9c9b
incl 0x10(%rbp)
incq %r15
jmp 0x9c99
cmpb $0x0, (%rbp)
je 0xa01b
xorl %r12d, %r12d
leaq 0x98(%rsp), %r13
movq 0x70bf(%rip), %rbp      # 0x10fb8
movq %r13, %rdi
callq 0x31f0
movq 0x18(%rsp), %rax
movq (%rax), %rsi
movq 0x8(%rax), %rdx
leaq 0xa8(%rsp), %rdi
callq 0x32d0
movq %rax, %r14
movl $0x3, %edx
movq %rax, %rdi
leaq 0x3548(%rip), %rsi      # 0xd474
callq 0x32d0
movq %r14, %rdi
movl %r12d, %esi
callq 0x3440
movl $0x4, %edx
movq %rax, %rdi
leaq 0x2a03(%rip), %rsi      # 0xc94e
callq 0x32d0
leaq 0x78(%rsp), %rdi
leaq 0xb0(%rsp), %rsi
callq 0x33c0
movq 0x78(%rsp), %rdi
leaq 0x330e(%rip), %rsi      # 0xd27c
callq 0x32e0
movq 0x20(%rsp), %rcx
movq %rax, (%rcx,%r12,8)
movq 0x78(%rsp), %rdi
leaq 0x88(%rsp), %rax
cmpq %rax, %rdi
je 0x9f93
callq 0x3260
movq 0x40(%rsp), %rax
leaq (%r12,%r12,2), %rbx
movq (%rax,%rbx,8), %rdi
movq 0x20(%rsp), %rax
movq (%rax,%r12,8), %rcx
movl $0x1, %esi
movq %r15, %rdx
callq 0x34c0
cmpq %r15, %rax
jne 0xa128
testq %r15, %r15
je 0x9fe1
xorl %eax, %eax
movq 0x40(%rsp), %rcx
movq (%rcx,%rbx,8), %rcx
cmpb $-0x1, (%rcx,%rax)
je 0x9fd9
movb $-0x1, (%rcx,%rax)
incq %rax
cmpq %rax, %r15
jne 0x9fc6
movq 0x20(%rsp), %rax
movq (%rax,%r12,8), %rdi
callq 0x32a0
movq %r13, %rdi
movq %rbp, %rsi
callq 0x3210
leaq 0x118(%rsp), %rdi
callq 0x30d0
incq %r12
movq 0x8(%rsp), %rax
movzbl (%rax), %eax
cmpq %rax, %r12
jb 0x9ef9
movq 0x6fce(%rip), %rdi      # 0x10ff0
leaq 0x34c1(%rip), %rsi      # 0xd4ea
movl $0x33, %edx
callq 0x32d0
movq 0x8(%rsp), %rax
movl 0x10(%rax), %esi
movq 0x6fae(%rip), %rdi      # 0x10ff0
callq 0x31d0
leaq 0x29e8(%rip), %rsi      # 0xca36
movl $0x1, %edx
movq %rax, %rdi
callq 0x32d0
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0xa06f
callq 0x3260
leaq 0x220(%rsp), %rdi
callq 0x30a0
leaq 0x40(%rsp), %rdi
callq 0xa626
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0xa095
callq 0x3260
movb $0x1, %al
addq $0x428, %rsp            # imm = 0x428
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x31ce(%rip), %rdi      # 0xd27e
leaq 0x3089(%rip), %rsi      # 0xd140
leaq 0x33e6(%rip), %rcx      # 0xd4a4
movl $0x3b7, %edx            # imm = 0x3B7
callq 0x31a0
movq 0x6f21(%rip), %rdi      # 0x10ff0
leaq 0x3156(%rip), %rsi      # 0xd22c
movl $0x23, %edx
callq 0x32d0
leaq 0x98(%rsp), %rdi
leaq 0x238(%rsp), %rsi
callq 0x33c0
movq 0x98(%rsp), %rsi
movq 0x6eec(%rip), %rdi      # 0x10ff0
callq 0x3290
movq %rax, %rdi
callq 0x3140
leaq 0x98(%rsp), %rdi
callq 0x3130
movl $0x1, %edi
callq 0x3300
leaq 0x31c6(%rip), %rdi      # 0xd2f5
leaq 0x300a(%rip), %rsi      # 0xd140
leaq 0x3367(%rip), %rcx      # 0xd4a4
movl $0x401, %edx            # imm = 0x401
callq 0x31a0
jmp 0xa178
jmp 0xa178
jmp 0xa1a9
movq %rax, %rbx
movq 0x98(%rsp), %rdi
cmpq %r14, %rdi
je 0xa184
callq 0x3260
jmp 0xa184
jmp 0xa181
jmp 0xa16e
jmp 0xa181
jmp 0xa1a9
jmp 0xa1ae
movq %rax, %rbx
jmp 0xa1fd
jmp 0xa181
movq %rax, %rbx
jmp 0xa1f3
jmp 0xa1a9
jmp 0xa1ae
movq %rax, %rbx
movq 0x6e2d(%rip), %rsi      # 0x10fb8
leaq 0x220(%rsp), %rdi
callq 0x3210
leaq 0x2a0(%rsp), %rdi
callq 0x30d0
jmp 0xa1fd
jmp 0xa1ae
movq %rax, %rbx
jmp 0xa1d2
movq %rax, %rbx
movq 0x6e00(%rip), %rsi      # 0x10fb8
leaq 0x98(%rsp), %rdi
callq 0x3210
leaq 0x118(%rsp), %rdi
callq 0x30d0
movq 0x58(%rsp), %rdi
leaq 0x68(%rsp), %rax
cmpq %rax, %rdi
je 0xa1e6
callq 0x3260
leaq 0x220(%rsp), %rdi
callq 0x30a0
leaq 0x40(%rsp), %rdi
callq 0xa626
movq 0x20(%rsp), %rdi
testq %rdi, %rdi
je 0xa20c
callq 0x3260
movq %rbx, %rdi
callq 0x3460