// File: hkbu-victor[P]SFastLDA/super_fast_final1_w.cpp
// Function: main
int main(int argc, char **argv){
  	char line[ 80 ];
    int n, i, j, docId, wordId, count;
    FILE *fr;

    parse_args(argc, argv);

    square_limit = -1;
    printf("\nFinal Sparse word-by-word: Opening and reading dataset file...\n");

    D = 0; W = 0; nTokens = 0;
    fr = fopen(dFile,"rt");
    if (fr == NULL){
       	printf("\n\nCannot find the UCI bag-of-words format input corpus file %s !!!\n\n\n", dFile);
       	exit(1);
    }
    fgets(line, 80, fr);
    sscanf(line, "%d", &D);
    fgets(line, 80, fr);
    sscanf(line, "%d", &W);
    fgets(line, 80, fr);

    int lineNo = 3;

    while (fgets(line, 80, fr) != NULL){
      	sscanf( line, "%d %d %d", &docId, &wordId, &count);
      	lineNo++;
      	nTokens += count;
      	if ((lineNo % 2000000) == 0)
			printf("first parse : processing line %d \n", lineNo);
    }
    printf("\nTotal documents: %d, Vocab Size : %d, Num. Tokens : %d\n", D, W, nTokens);

    //allocate memory
    d = (int *) calloc(nTokens, sizeof(int));
    w = (int *) calloc(nTokens, sizeof(int));
    z = (int *) calloc(nTokens, sizeof(int));
    doc_lens = (int *) calloc(D, sizeof(int));
    word_lens = (int *) calloc(W, sizeof(int));

    rewind(fr);

    fgets(line, 80, fr); fgets(line, 80, fr); fgets(line, 80, fr);
    lineNo = 3;
    n = 0;
    while (fgets(line, 80, fr) != NULL){
    	sscanf( line, "%d %d %d", &docId, &wordId, &count);
    	lineNo++;
    	doc_lens[ docId-1 ] += count;
    	word_lens[ wordId-1 ] += count;
    	for (i=0; i<count; i++){
    		d[n] = docId - 1;
    		w[n] = wordId - 1;
    		n++;
    	}
    	if ((lineNo % 1000000) == 0)
    		printf("second parse : processing line %d \n", lineNo);
    }
    fclose(fr);

    for (i=0; i<W; i++){
    	if (word_lens[i] > square_limit)
    		square_limit = word_lens[i];
    }

    printf( "Arguments:\n" );
    printf( "\tNumber of words      W = %d\n"    , W );
    printf( "\tNumber of docs       D = %d\n"    , D );
    printf( "\tNumber of topics     T = %d\n"    , T );
    printf( "\tNumber of iterations N = %d\n"    , NN );
    printf( "\tHyperparameter   ALPHA = %4.4f\n" , argALPHA );
    printf( "\tHyperparameter    BETA = %4.4f\n" , BETA );
    printf( "\tSeed number            = %d\n"    , SEED );
    printf( "\tNumber of tokens       = %d\n"    , nTokens );
    printf( "\tSquare Limit           = %d\n"    , square_limit);

    if (oFile != NULL){
    	printf("\n\tOutput file: %s.\n\n", oFile);
    }else{
    	printf("\n\tNo output file specified.\n\n");
    }


    ztot = new int[T]; std::fill_n(ztot, T, 0);
    ALPHA = new double[T]; std::fill_n(ALPHA, T, argALPHA);
    BETA_D_2_norm = new double[D];	//summation over topics of ALPHA*wi
    D_pair_count = new int[D]; std::fill_n(D_pair_count, D, 0);
    W_pair_count = new int[W]; std::fill_n(W_pair_count, W, 0);
    pivotal_topic_indexes = new int[T];
    pivotal_topic_values = new double[T];
    d_pivotal_topic_indexes = new int[T];
    d_pivotal_topic_values = new double[T];
    common_topic_pos = new int[T];
    ONE_OVER_Z = new double[T];
    square_increment = new long[square_limit];
    square_decrement = new long[square_limit];
    square_of = new long[square_limit];
    wi_array = new int[T];
    wi_index_to_pos = new int[T];

    wpIdx = new W_DoublePair*[W];
    wpVal = new int*[W];
    for (i=0; i<W; i++){
   		wpIdx[i] = new W_DoublePair[T];
    	wpVal[i] = new int[T];
    	for (j=0; j<T; j++){
    		wpIdx[i][j].index = -1;
    	}
		std::fill_n(wpVal[i], T, 0);
    }

    dpPair = new D_DoublePair*[D];
    for (i=0; i<D; i++){
    	if (doc_lens[i] < T){
        	dpPair[i] = new D_DoublePair[doc_lens[i]];
        	di_pair = dpPair[i];
    		for (j=0; j<doc_lens[i]; j++){
    			di_pair[j].index = -1;
    			di_pair[j].value = 0;
    		}
    	}else{
        	dpPair[i] = new D_DoublePair[T];
        	di_pair = dpPair[i];
    		for (j=0; j<T; j++){
    			di_pair[j].index = -1;
    			di_pair[j].value = 0;
    		}
    	}
    }

    std::fill_n(wi_index_to_pos, T, -1);

    GibbsSamplerLDA();

    if (oFile != NULL){
    	export_results(oFile);
    	printf("\nOutput file is written to %s", oFile);
    }

    printf("\nFinished !!!\n");
}

// Assembly:
subq $0xa8, %rsp
movl $0x0, 0xa4(%rsp)
movl %edi, 0xa0(%rsp)
movq %rsi, 0x98(%rsp)
movl 0xa0(%rsp), %edi
movq 0x98(%rsp), %rsi
callq 0x1340
movl $0xffffffff, 0x62cd(%rip) # imm = 0xFFFFFFFF
leaq 0x3550(%rip), %rdi      # 0x73a6
movb $0x0, %al
callq 0x1040
movl $0x0, 0x629d(%rip)      # 0xa104
movl $0x0, 0x6297(%rip)      # 0xa108
movl $0x0, 0x629d(%rip)      # 0xa118
movq 0x624e(%rip), %rdi      # 0xa0d0
leaq 0x355e(%rip), %rsi      # 0x73e7
callq 0x10e0
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x20(%rsp)
jne 0x3eba
movq 0x622e(%rip), %rsi      # 0xa0d0
leaq 0x3541(%rip), %rdi      # 0x73ea
movb $0x0, %al
callq 0x1040
movl $0x1, %edi
callq 0x10f0
leaq 0x40(%rsp), %rdi
movq 0x20(%rsp), %rdx
movl $0x50, %esi
callq 0x1140
leaq 0x40(%rsp), %rdi
leaq 0x355c(%rip), %rsi      # 0x7436
leaq 0x6223(%rip), %rdx      # 0xa104
movb $0x0, %al
callq 0x10c0
leaq 0x40(%rsp), %rdi
movq 0x20(%rsp), %rdx
movl $0x50, %esi
callq 0x1140
leaq 0x40(%rsp), %rdi
leaq 0x352e(%rip), %rsi      # 0x7436
leaq 0x61f9(%rip), %rdx      # 0xa108
movb $0x0, %al
callq 0x10c0
leaq 0x40(%rsp), %rdi
movq 0x20(%rsp), %rdx
movl $0x50, %esi
callq 0x1140
movl $0x3, 0x1c(%rsp)
leaq 0x40(%rsp), %rdi
movq 0x20(%rsp), %rdx
movl $0x50, %esi
callq 0x1140
cmpq $0x0, %rax
je 0x3fae
leaq 0x40(%rsp), %rdi
leaq 0x34d8(%rip), %rsi      # 0x7430
leaq 0x30(%rsp), %rdx
leaq 0x2c(%rsp), %rcx
leaq 0x28(%rsp), %r8
movb $0x0, %al
callq 0x10c0
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
movl 0x28(%rsp), %eax
addl 0x6195(%rip), %eax      # 0xa118
movl %eax, 0x618f(%rip)      # 0xa118
movl 0x1c(%rsp), %eax
movl $0x1e8480, %ecx         # imm = 0x1E8480
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x3fac
movl 0x1c(%rsp), %esi
leaq 0x3494(%rip), %rdi      # 0x7439
movb $0x0, %al
callq 0x1040
jmp 0x3f32
movl 0x6150(%rip), %esi      # 0xa104
movl 0x614e(%rip), %edx      # 0xa108
movl 0x6158(%rip), %ecx      # 0xa118
leaq 0x3495(%rip), %rdi      # 0x745c
movb $0x0, %al
callq 0x1040
movslq 0x6143(%rip), %rdi      # 0xa118
movl $0x4, %esi
callq 0x1070
movq %rax, 0x615a(%rip)      # 0xa140
movslq 0x612b(%rip), %rdi      # 0xa118
movl $0x4, %esi
callq 0x1070
movq %rax, 0x614a(%rip)      # 0xa148
movslq 0x6113(%rip), %rdi      # 0xa118
movl $0x4, %esi
callq 0x1070
movq %rax, 0x613a(%rip)      # 0xa150
movslq 0x60e7(%rip), %rdi      # 0xa104
movl $0x4, %esi
callq 0x1070
movq %rax, 0x612a(%rip)      # 0xa158
movslq 0x60d3(%rip), %rdi      # 0xa108
movl $0x4, %esi
callq 0x1070
movq %rax, 0x611a(%rip)      # 0xa160
movq 0x20(%rsp), %rdi
callq 0x1050
leaq 0x40(%rsp), %rdi
movq 0x20(%rsp), %rdx
movl $0x50, %esi
callq 0x1140
leaq 0x40(%rsp), %rdi
movq 0x20(%rsp), %rdx
movl $0x50, %esi
callq 0x1140
leaq 0x40(%rsp), %rdi
movq 0x20(%rsp), %rdx
movl $0x50, %esi
callq 0x1140
movl $0x3, 0x1c(%rsp)
movl $0x0, 0x3c(%rsp)
leaq 0x40(%rsp), %rdi
movq 0x20(%rsp), %rdx
movl $0x50, %esi
callq 0x1140
cmpq $0x0, %rax
je 0x419b
leaq 0x40(%rsp), %rdi
leaq 0x336a(%rip), %rsi      # 0x7430
leaq 0x30(%rsp), %rdx
leaq 0x2c(%rsp), %rcx
leaq 0x28(%rsp), %r8
movb $0x0, %al
callq 0x10c0
movl 0x1c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1c(%rsp)
movl 0x28(%rsp), %edx
movq 0x6066(%rip), %rax      # 0xa158
movl 0x30(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
addl (%rax,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
movl 0x28(%rsp), %edx
movq 0x6053(%rip), %rax      # 0xa160
movl 0x2c(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
addl (%rax,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
movl $0x0, 0x38(%rsp)
movl 0x38(%rsp), %eax
cmpl 0x28(%rsp), %eax
jge 0x4173
movl 0x30(%rsp), %edx
subl $0x1, %edx
movq 0x6003(%rip), %rax      # 0xa140
movslq 0x3c(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x2c(%rsp), %edx
subl $0x1, %edx
movq 0x5ff5(%rip), %rax      # 0xa148
movslq 0x3c(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x3c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x3c(%rsp)
movl 0x38(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x38(%rsp)
jmp 0x4125
movl 0x1c(%rsp), %eax
movl $0xf4240, %ecx          # imm = 0xF4240
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x4196
movl 0x1c(%rsp), %esi
leaq 0x3306(%rip), %rdi      # 0x7495
movb $0x0, %al
callq 0x1040
jmp 0x409c
movq 0x20(%rsp), %rdi
callq 0x10d0
movl $0x0, 0x38(%rsp)
movl 0x38(%rsp), %eax
cmpl 0x5f51(%rip), %eax      # 0xa108
jge 0x41f4
movq 0x5fa0(%rip), %rax      # 0xa160
movslq 0x38(%rsp), %rcx
movl (%rax,%rcx,4), %eax
cmpl 0x5f4e(%rip), %eax      # 0xa11c
jle 0x41e5
movq 0x5f89(%rip), %rax      # 0xa160
movslq 0x38(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x5f37(%rip)      # 0xa11c
jmp 0x41e7
movl 0x38(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x38(%rsp)
jmp 0x41ad
leaq 0x32be(%rip), %rdi      # 0x74b9
movb $0x0, %al
callq 0x1040
movl 0x5f00(%rip), %esi      # 0xa108
leaq 0x32b6(%rip), %rdi      # 0x74c5
movb $0x0, %al
callq 0x1040
movl 0x5ee8(%rip), %esi      # 0xa104
leaq 0x32c0(%rip), %rdi      # 0x74e3
movb $0x0, %al
callq 0x1040
movl 0x5ec8(%rip), %esi      # 0xa0f8
leaq 0x32ca(%rip), %rdi      # 0x7501
movb $0x0, %al
callq 0x1040
movl 0x5eb8(%rip), %esi      # 0xa0fc
leaq 0x32d4(%rip), %rdi      # 0x751f
movb $0x0, %al
callq 0x1040
movsd 0x5f1e(%rip), %xmm0     # 0xa178
leaq 0x32dc(%rip), %rdi      # 0x753d
movb $0x1, %al
callq 0x1040
movsd 0x5f10(%rip), %xmm0     # 0xa180
leaq 0x32e7(%rip), %rdi      # 0x755e
movb $0x1, %al
callq 0x1040
movl 0x5e7c(%rip), %esi      # 0xa100
leaq 0x32f4(%rip), %rdi      # 0x757f
movb $0x0, %al
callq 0x1040
movl 0x5e80(%rip), %esi      # 0xa118
leaq 0x32fe(%rip), %rdi      # 0x759d
movb $0x0, %al
callq 0x1040
movl 0x5e70(%rip), %esi      # 0xa11c
leaq 0x3308(%rip), %rdi      # 0x75bb
movb $0x0, %al
callq 0x1040
cmpq $0x0, 0x5e16(%rip)      # 0xa0d8
je 0x42db
movq 0x5e0d(%rip), %rsi      # 0xa0d8
leaq 0x3307(%rip), %rdi      # 0x75d9
movb $0x0, %al
callq 0x1040
jmp 0x42e9
leaq 0x330c(%rip), %rdi      # 0x75ee
movb $0x0, %al
callq 0x1040
movslq 0x5e08(%rip), %rax      # 0xa0f8
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x5e08(%rip)      # 0xa120
movq 0x5e01(%rip), %rdi      # 0xa120
movl 0x5dd3(%rip), %esi      # 0xa0f8
movl $0x0, 0x18(%rsp)
leaq 0x18(%rsp), %rdx
callq 0x4a20
movslq 0x5dba(%rip), %rax      # 0xa0f8
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x5e3a(%rip)      # 0xa1a0
movq 0x5e33(%rip), %rdi      # 0xa1a0
movl 0x5d85(%rip), %esi      # 0xa0f8
leaq 0x5dfe(%rip), %rdx      # 0xa178
callq 0x4ac0
movslq 0x5d7e(%rip), %rax      # 0xa104
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x5e12(%rip)      # 0xa1c0
movslq 0x5d4f(%rip), %rax      # 0xa104
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x5d8b(%rip)      # 0xa168
movq 0x5d84(%rip), %rdi      # 0xa168
movl 0x5d1a(%rip), %esi      # 0xa104
movl $0x0, 0x14(%rsp)
leaq 0x14(%rsp), %rdx
callq 0x4a20
movslq 0x5d05(%rip), %rax      # 0xa108
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x5d45(%rip)      # 0xa170
movq 0x5d3e(%rip), %rdi      # 0xa170
movl 0x5cd0(%rip), %esi      # 0xa108
movl $0x0, 0x10(%rsp)
leaq 0x10(%rsp), %rdx
callq 0x4a20
movslq 0x5ca7(%rip), %rax      # 0xa0f8
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x5caf(%rip)      # 0xa128
movslq 0x5c78(%rip), %rax      # 0xa0f8
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x5d00(%rip)      # 0xa1a8
movslq 0x5c49(%rip), %rax      # 0xa0f8
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x5c59(%rip)      # 0xa130
movslq 0x5c1a(%rip), %rax      # 0xa0f8
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x5caa(%rip)      # 0xa1b0
movslq 0x5beb(%rip), %rax      # 0xa0f8
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x5c03(%rip)      # 0xa138
movslq 0x5bbc(%rip), %rax      # 0xa0f8
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x5c54(%rip)      # 0xa1b8
movslq 0x5bb1(%rip), %rax      # 0xa11c
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x5b4d(%rip)      # 0xa0e0
movslq 0x5b82(%rip), %rax      # 0xa11c
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x5b26(%rip)      # 0xa0e8
movslq 0x5b53(%rip), %rax      # 0xa11c
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x5aff(%rip)      # 0xa0f0
movslq 0x5b00(%rip), %rax      # 0xa0f8
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x5bb8(%rip)      # 0xa1d8
movslq 0x5ad1(%rip), %rax      # 0xa0f8
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x5b91(%rip)      # 0xa1e0
movslq 0x5ab2(%rip), %rax      # 0xa108
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x5b92(%rip)      # 0xa210
movslq 0x5a83(%rip), %rax      # 0xa108
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x5b23(%rip)      # 0xa1d0
movl $0x0, 0x38(%rsp)
movl 0x38(%rsp), %eax
cmpl 0x5a49(%rip), %eax      # 0xa108
jge 0x47b0
movslq 0x5a2c(%rip), %rax      # 0xa0f8
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, %rdx
movq 0x5b19(%rip), %rax      # 0xa210
movslq 0x38(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movslq 0x59f1(%rip), %rax      # 0xa0f8
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, %rdx
movq 0x5a9e(%rip), %rax      # 0xa1d0
movslq 0x38(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
cmpl 0x59ab(%rip), %eax      # 0xa0f8
jge 0x4778
movq 0x5aba(%rip), %rax      # 0xa210
movslq 0x38(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x34(%rsp), %rcx
movl $0xffffffff, (%rax,%rcx,8) # imm = 0xFFFFFFFF
movl 0x34(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x34(%rsp)
jmp 0x4743
movq 0x5a51(%rip), %rax      # 0xa1d0
movslq 0x38(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movl 0x596a(%rip), %esi      # 0xa0f8
movl $0x0, 0xc(%rsp)
leaq 0xc(%rsp), %rdx
callq 0x4a20
movl 0x38(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x38(%rsp)
jmp 0x46b5
movslq 0x594d(%rip), %rax      # 0xa104
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x5a41(%rip)      # 0xa220
movl $0x0, 0x38(%rsp)
movl 0x38(%rsp), %eax
cmpl 0x5913(%rip), %eax      # 0xa104
jge 0x4971
movq 0x595a(%rip), %rax      # 0xa158
movslq 0x38(%rsp), %rcx
movl (%rax,%rcx,4), %eax
cmpl 0x58ec(%rip), %eax      # 0xa0f8
jge 0x48c3
movq 0x593f(%rip), %rax      # 0xa158
movslq 0x38(%rsp), %rcx
movslq (%rax,%rcx,4), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, %rdx
movq 0x59d3(%rip), %rax      # 0xa220
movslq 0x38(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x59c3(%rip), %rax      # 0xa220
movslq 0x38(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x59ab(%rip)      # 0xa218
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
movq 0x58d8(%rip), %rcx      # 0xa158
movslq 0x38(%rsp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x48be
movq 0x5987(%rip), %rax      # 0xa218
movslq 0x34(%rsp), %rcx
movl $0xffffffff, (%rax,%rcx,8) # imm = 0xFFFFFFFF
movq 0x5974(%rip), %rax      # 0xa218
movslq 0x34(%rsp), %rcx
movl $0x0, 0x4(%rax,%rcx,8)
movl 0x34(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x34(%rsp)
jmp 0x4875
jmp 0x495f
movslq 0x582e(%rip), %rax      # 0xa0f8
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, %rdx
movq 0x592b(%rip), %rax      # 0xa220
movslq 0x38(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x591b(%rip), %rax      # 0xa220
movslq 0x38(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x5903(%rip)      # 0xa218
movl $0x0, 0x34(%rsp)
movl 0x34(%rsp), %eax
cmpl 0x57d1(%rip), %eax      # 0xa0f8
jge 0x495d
movq 0x58e8(%rip), %rax      # 0xa218
movslq 0x34(%rsp), %rcx
movl $0xffffffff, (%rax,%rcx,8) # imm = 0xFFFFFFFF
movq 0x58d5(%rip), %rax      # 0xa218
movslq 0x34(%rsp), %rcx
movl $0x0, 0x4(%rax,%rcx,8)
movl 0x34(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x34(%rsp)
jmp 0x491d
jmp 0x495f
jmp 0x4961
movl 0x38(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x38(%rsp)
jmp 0x47e7
movq 0x5868(%rip), %rdi      # 0xa1e0
movl 0x577a(%rip), %esi      # 0xa0f8
movl $0xffffffff, 0x8(%rsp)  # imm = 0xFFFFFFFF
leaq 0x8(%rsp), %rdx
callq 0x4a20
callq 0x1ce0
cmpq $0x0, 0x573b(%rip)      # 0xa0d8
je 0x49c0
movq 0x5732(%rip), %rdi      # 0xa0d8
callq 0x15b0
movq 0x5726(%rip), %rsi      # 0xa0d8
leaq 0x2c53(%rip), %rdi      # 0x760c
movb $0x0, %al
callq 0x1040
leaq 0x2c63(%rip), %rdi      # 0x762a
movb $0x0, %al
callq 0x1040
movl 0xa4(%rsp), %eax
addq $0xa8, %rsp
retq
nopl (%rax)