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

    parse_args(argc, argv);

    //square_limit = 10000000;
    square_limit = 0;
    printf("\nSFastLDA doc-by-doc: Opening and reading dataset file...\n");
    printf("*******************************************************\n");

    D = 0; W = 0; nTokens = 0; max_doc = 0; max_word = 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 (docId > max_doc) max_doc = docId;
      	if (wordId > max_word) max_word = wordId;
      	if ((docId <= 0)||(wordId<=0)||(count<=0)){
      		printf("***********************************");
      		return -1;
      	}
      	if ((lineNo % 2000000) == 0)
			printf("reading input data (first pass) : processing line %d \n", lineNo);
    }
    printf("\nTotal documents: %d, Vocab Size : %d, Num. Tokens : %d\n", D, W, nTokens);
    printf("\nTotal documents: %d, Vocab Size : %d, Num. Tokens : %d\n", max_doc, max_word, nTokens);

    //allocate memory
    d = (int *) calloc(nTokens, sizeof(int));
    w = (int *) calloc(nTokens, sizeof(int));
    //victor z = (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 % 2000000) == 0)
    		printf("reading input data (second pass)  : 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("Square limit: %d\n", square_limit);
    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 );
    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);
    ALPHA_W_2_norm = new double[W];	//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];
    w_pivotal_topic_indexes = new int[T];
    w_pivotal_topic_values = new double[T];
    common_topic_indexes = 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];
    ALPHA_square = new double[T];
    di_array = new int[T];

    dpIdx = new DoublePair*[D];
    //victor dpVal = new int*[D];
    dpVal = new int*[D];
    for (i=0; i<D; i++){
    	if (doc_lens[i] < T){
    		dpIdx[i] = new DoublePair[doc_lens[i]];
    		//victor dpVal[i] = new int[doc_lens[i]];
    		dpVal[i] = new int[doc_lens[i]];
    		for (j=0; j<doc_lens[i]; j++){
    			dpIdx[i][j].index = -1;
    		}
    		std::fill_n(dpVal[i], doc_lens[i], 0);
    	}else{
    		dpIdx[i] = new DoublePair[T];
    		//victor dpVal[i] = new int[T];
    		dpVal[i] = new int[T];
    		for (j=0; j<T; j++){
    			dpIdx[i][j].index = -1;
    		}
			std::fill_n(dpVal[i], T, 0);
    	}
    }

    //victor wpIdx = new int*[W];
    wpIdx = new int*[W];
    wpVal = new int*[W];
    for (i=0; i<W; i++){
    	if (word_lens[i] < T){
    		//victor
    		wpIdx[i] = new int[word_lens[i]];
    		std::fill_n(wpIdx[i], word_lens[i], -1);
    	}else{
    		//victor
    		wpIdx[i] = new int[T];
    		std::fill_n(wpIdx[i], T, -1);
    	}
    	wpVal[i] = new int[T];
    	std::fill_n(wpVal[i], T, 0);
    }


    GibbsSamplerLDA();

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

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

// Assembly:
subq $0xb8, %rsp
movl $0x0, 0xb4(%rsp)
movl %edi, 0xb0(%rsp)
movq %rsi, 0xa8(%rsp)
movl 0xb0(%rsp), %edi
movq 0xa8(%rsp), %rsi
callq 0x1340
movl $0x0, 0x552d(%rip)      # 0x911c
leaq 0x27a6(%rip), %rdi      # 0x639c
movb $0x0, %al
callq 0x1040
leaq 0x27d3(%rip), %rdi      # 0x63d7
movb $0x0, %al
callq 0x1040
movl $0x0, 0x54ef(%rip)      # 0x9104
movl $0x0, 0x54e9(%rip)      # 0x9108
movl $0x0, 0x54ef(%rip)      # 0x9118
movl $0x0, 0x34(%rsp)
movl $0x0, 0x30(%rsp)
movq 0x5490(%rip), %rdi      # 0x90d0
leaq 0x27c9(%rip), %rsi      # 0x6410
callq 0x10e0
movq %rax, 0x28(%rsp)
cmpq $0x0, 0x28(%rsp)
jne 0x3c78
movq 0x5470(%rip), %rsi      # 0x90d0
leaq 0x27ac(%rip), %rdi      # 0x6413
movb $0x0, %al
callq 0x1040
movl $0x1, %edi
callq 0x10f0
leaq 0x50(%rsp), %rdi
movq 0x28(%rsp), %rdx
movl $0x50, %esi
callq 0x1140
leaq 0x50(%rsp), %rdi
leaq 0x27c7(%rip), %rsi      # 0x645f
leaq 0x5465(%rip), %rdx      # 0x9104
movb $0x0, %al
callq 0x10c0
leaq 0x50(%rsp), %rdi
movq 0x28(%rsp), %rdx
movl $0x50, %esi
callq 0x1140
leaq 0x50(%rsp), %rdi
leaq 0x2799(%rip), %rsi      # 0x645f
leaq 0x543b(%rip), %rdx      # 0x9108
movb $0x0, %al
callq 0x10c0
leaq 0x50(%rsp), %rdi
movq 0x28(%rsp), %rdx
movl $0x50, %esi
callq 0x1140
movl $0x3, 0x24(%rsp)
leaq 0x50(%rsp), %rdi
movq 0x28(%rsp), %rdx
movl $0x50, %esi
callq 0x1140
cmpq $0x0, %rax
je 0x3dca
leaq 0x50(%rsp), %rdi
leaq 0x273f(%rip), %rsi      # 0x6459
leaq 0x40(%rsp), %rdx
leaq 0x3c(%rsp), %rcx
leaq 0x38(%rsp), %r8
movb $0x0, %al
callq 0x10c0
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
movl 0x38(%rsp), %eax
addl 0x53d3(%rip), %eax      # 0x9118
movl %eax, 0x53cd(%rip)      # 0x9118
movl 0x40(%rsp), %eax
cmpl 0x34(%rsp), %eax
jle 0x3d5d
movl 0x40(%rsp), %eax
movl %eax, 0x34(%rsp)
movl 0x3c(%rsp), %eax
cmpl 0x30(%rsp), %eax
jle 0x3d6f
movl 0x3c(%rsp), %eax
movl %eax, 0x30(%rsp)
cmpl $0x0, 0x40(%rsp)
jle 0x3d84
cmpl $0x0, 0x3c(%rsp)
jle 0x3d84
cmpl $0x0, 0x38(%rsp)
jg 0x3da2
leaq 0x26d7(%rip), %rdi      # 0x6462
movb $0x0, %al
callq 0x1040
movl $0xffffffff, 0xb4(%rsp) # imm = 0xFFFFFFFF
jmp 0x4921
movl 0x24(%rsp), %eax
movl $0x1e8480, %ecx         # imm = 0x1E8480
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x3dc5
movl 0x24(%rsp), %esi
leaq 0x26c8(%rip), %rdi      # 0x6486
movb $0x0, %al
callq 0x1040
jmp 0x3cf0
movl 0x5334(%rip), %esi      # 0x9104
movl 0x5332(%rip), %edx      # 0x9108
movl 0x533c(%rip), %ecx      # 0x9118
leaq 0x26da(%rip), %rdi      # 0x64bd
movb $0x0, %al
callq 0x1040
movl 0x34(%rsp), %esi
movl 0x30(%rsp), %edx
movl 0x5320(%rip), %ecx      # 0x9118
leaq 0x26be(%rip), %rdi      # 0x64bd
movb $0x0, %al
callq 0x1040
movslq 0x530b(%rip), %rdi      # 0x9118
movl $0x4, %esi
callq 0x1070
movq %rax, 0x5322(%rip)      # 0x9140
movslq 0x52f3(%rip), %rdi      # 0x9118
movl $0x4, %esi
callq 0x1070
movq %rax, 0x5312(%rip)      # 0x9148
movslq 0x52db(%rip), %rdi      # 0x9118
movl $0x4, %esi
callq 0x1070
movq %rax, 0x5312(%rip)      # 0x9160
movslq 0x52af(%rip), %rdi      # 0x9104
movl $0x4, %esi
callq 0x1070
movq %rax, 0x52ea(%rip)      # 0x9150
movslq 0x529b(%rip), %rdi      # 0x9108
movl $0x4, %esi
callq 0x1070
movq %rax, 0x52da(%rip)      # 0x9158
movq 0x28(%rsp), %rdi
callq 0x1050
leaq 0x50(%rsp), %rdi
movq 0x28(%rsp), %rdx
movl $0x50, %esi
callq 0x1140
leaq 0x50(%rsp), %rdi
movq 0x28(%rsp), %rdx
movl $0x50, %esi
callq 0x1140
leaq 0x50(%rsp), %rdi
movq 0x28(%rsp), %rdx
movl $0x50, %esi
callq 0x1140
movl $0x3, 0x24(%rsp)
movl $0x0, 0x4c(%rsp)
leaq 0x50(%rsp), %rdi
movq 0x28(%rsp), %rdx
movl $0x50, %esi
callq 0x1140
cmpq $0x0, %rax
je 0x3fd3
leaq 0x50(%rsp), %rdi
leaq 0x255b(%rip), %rsi      # 0x6459
leaq 0x40(%rsp), %rdx
leaq 0x3c(%rsp), %rcx
leaq 0x38(%rsp), %r8
movb $0x0, %al
callq 0x10c0
movl 0x24(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x24(%rsp)
movl 0x38(%rsp), %edx
movq 0x5226(%rip), %rax      # 0x9150
movl 0x40(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
addl (%rax,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
movl 0x38(%rsp), %edx
movq 0x5213(%rip), %rax      # 0x9158
movl 0x3c(%rsp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
addl (%rax,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
movl $0x0, 0x48(%rsp)
movl 0x48(%rsp), %eax
cmpl 0x38(%rsp), %eax
jge 0x3fab
movl 0x40(%rsp), %edx
subl $0x1, %edx
movq 0x51cb(%rip), %rax      # 0x9140
movslq 0x4c(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x3c(%rsp), %edx
subl $0x1, %edx
movq 0x51bd(%rip), %rax      # 0x9148
movslq 0x4c(%rsp), %rcx
movl %edx, (%rax,%rcx,4)
movl 0x4c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x4c(%rsp)
movl 0x48(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
jmp 0x3f5d
movl 0x24(%rsp), %eax
movl $0x1e8480, %ecx         # imm = 0x1E8480
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x3fce
movl 0x24(%rsp), %esi
leaq 0x252f(%rip), %rdi      # 0x64f6
movb $0x0, %al
callq 0x1040
jmp 0x3ed4
movq 0x28(%rsp), %rdi
callq 0x10d0
movl $0x0, 0x48(%rsp)
movl 0x48(%rsp), %eax
cmpl 0x5119(%rip), %eax      # 0x9108
jge 0x402c
movq 0x5160(%rip), %rax      # 0x9158
movslq 0x48(%rsp), %rcx
movl (%rax,%rcx,4), %eax
cmpl 0x5116(%rip), %eax      # 0x911c
jle 0x401d
movq 0x5149(%rip), %rax      # 0x9158
movslq 0x48(%rsp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, 0x50ff(%rip)      # 0x911c
jmp 0x401f
movl 0x48(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
jmp 0x3fe5
movl 0x50ea(%rip), %esi      # 0x911c
leaq 0x24f6(%rip), %rdi      # 0x652f
movb $0x0, %al
callq 0x1040
leaq 0x24fa(%rip), %rdi      # 0x6541
movb $0x0, %al
callq 0x1040
movl 0x50b4(%rip), %esi      # 0x9108
leaq 0x24f2(%rip), %rdi      # 0x654d
movb $0x0, %al
callq 0x1040
movl 0x509c(%rip), %esi      # 0x9104
leaq 0x24fc(%rip), %rdi      # 0x656b
movb $0x0, %al
callq 0x1040
movl 0x507c(%rip), %esi      # 0x90f8
leaq 0x2506(%rip), %rdi      # 0x6589
movb $0x0, %al
callq 0x1040
movl 0x506c(%rip), %esi      # 0x90fc
leaq 0x2510(%rip), %rdi      # 0x65a7
movb $0x0, %al
callq 0x1040
movsd 0x50d2(%rip), %xmm0     # 0x9178
leaq 0x2518(%rip), %rdi      # 0x65c5
movb $0x1, %al
callq 0x1040
movsd 0x50c4(%rip), %xmm0     # 0x9180
leaq 0x2523(%rip), %rdi      # 0x65e6
movb $0x1, %al
callq 0x1040
movl 0x5030(%rip), %esi      # 0x9100
leaq 0x2530(%rip), %rdi      # 0x6607
movb $0x0, %al
callq 0x1040
movl 0x5034(%rip), %esi      # 0x9118
leaq 0x253a(%rip), %rdi      # 0x6625
movb $0x0, %al
callq 0x1040
cmpq $0x0, 0x4fde(%rip)      # 0x90d8
je 0x4113
movq 0x4fd5(%rip), %rsi      # 0x90d8
leaq 0x2539(%rip), %rdi      # 0x6643
movb $0x0, %al
callq 0x1040
jmp 0x4121
leaq 0x253e(%rip), %rdi      # 0x6658
movb $0x0, %al
callq 0x1040
movslq 0x4fd0(%rip), %rax      # 0x90f8
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x4fd0(%rip)      # 0x9120
movq 0x4fc9(%rip), %rdi      # 0x9120
movl 0x4f9b(%rip), %esi      # 0x90f8
movl $0x0, 0x20(%rsp)
leaq 0x20(%rsp), %rdx
callq 0x4930
movslq 0x4f82(%rip), %rax      # 0x90f8
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x5002(%rip)      # 0x91a0
movq 0x4ffb(%rip), %rdi      # 0x91a0
movl 0x4f4d(%rip), %esi      # 0x90f8
leaq 0x4fc6(%rip), %rdx      # 0x9178
callq 0x49d0
movslq 0x4f4a(%rip), %rax      # 0x9108
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x4fe2(%rip)      # 0x91c8
movslq 0x4f17(%rip), %rax      # 0x9104
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x4f53(%rip)      # 0x9168
movq 0x4f4c(%rip), %rdi      # 0x9168
movl 0x4ee2(%rip), %esi      # 0x9104
movl $0x0, 0x1c(%rsp)
leaq 0x1c(%rsp), %rdx
callq 0x4930
movslq 0x4ecd(%rip), %rax      # 0x9108
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x4f0d(%rip)      # 0x9170
movq 0x4f06(%rip), %rdi      # 0x9170
movl 0x4e98(%rip), %esi      # 0x9108
movl $0x0, 0x18(%rsp)
leaq 0x18(%rsp), %rdx
callq 0x4930
movslq 0x4e6f(%rip), %rax      # 0x90f8
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x4e77(%rip)      # 0x9128
movslq 0x4e40(%rip), %rax      # 0x90f8
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x4ed0(%rip)      # 0x91b0
movslq 0x4e11(%rip), %rax      # 0x90f8
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x4e21(%rip)      # 0x9130
movslq 0x4de2(%rip), %rax      # 0x90f8
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x4e7a(%rip)      # 0x91b8
movslq 0x4db3(%rip), %rax      # 0x90f8
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x4dcb(%rip)      # 0x9138
movslq 0x4d84(%rip), %rax      # 0x90f8
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x4e24(%rip)      # 0x91c0
movslq 0x4d79(%rip), %rax      # 0x911c
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x4d15(%rip)      # 0x90e0
movslq 0x4d4a(%rip), %rax      # 0x911c
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x4cee(%rip)      # 0x90e8
movslq 0x4d1b(%rip), %rax      # 0x911c
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x4cc7(%rip)      # 0x90f0
movslq 0x4cc8(%rip), %rax      # 0x90f8
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x4d50(%rip)      # 0x91a8
movslq 0x4c99(%rip), %rax      # 0x90f8
movl $0x4, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x4d79(%rip)      # 0x9200
movslq 0x4c76(%rip), %rax      # 0x9104
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x4d8a(%rip)      # 0x9240
movslq 0x4c47(%rip), %rax      # 0x9104
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x4d13(%rip)      # 0x91f8
movl $0x0, 0x48(%rsp)
movl 0x48(%rsp), %eax
cmpl 0x4c0d(%rip), %eax      # 0x9104
jge 0x4709
movq 0x4c4c(%rip), %rax      # 0x9150
movslq 0x48(%rsp), %rcx
movl (%rax,%rcx,4), %eax
cmpl 0x4be6(%rip), %eax      # 0x90f8
jge 0x461c
movq 0x4c31(%rip), %rax      # 0x9150
movslq 0x48(%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 0x4ced(%rip), %rax      # 0x9240
movslq 0x48(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x4bed(%rip), %rax      # 0x9150
movslq 0x48(%rsp), %rcx
movslq (%rax,%rcx,4), %rax
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 0x4c61(%rip), %rax      # 0x91f8
movslq 0x48(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movl $0x0, 0x44(%rsp)
movl 0x44(%rsp), %eax
movq 0x4b9d(%rip), %rcx      # 0x9150
movslq 0x48(%rsp), %rdx
cmpl (%rcx,%rdx,4), %eax
jge 0x45e6
movq 0x4c7c(%rip), %rax      # 0x9240
movslq 0x48(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x44(%rsp), %rcx
movl $0xffffffff, (%rax,%rcx,8) # imm = 0xFFFFFFFF
movl 0x44(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x44(%rsp)
jmp 0x45a8
movq 0x4c0b(%rip), %rax      # 0x91f8
movslq 0x48(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x4b53(%rip), %rax      # 0x9150
movslq 0x48(%rsp), %rcx
movl (%rax,%rcx,4), %esi
movl $0x0, 0x14(%rsp)
leaq 0x14(%rsp), %rdx
callq 0x4930
jmp 0x46f7
movslq 0x4ad5(%rip), %rax      # 0x90f8
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 0x4bf2(%rip), %rax      # 0x9240
movslq 0x48(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movslq 0x4a9a(%rip), %rax      # 0x90f8
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 0x4b6f(%rip), %rax      # 0x91f8
movslq 0x48(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movl $0x0, 0x44(%rsp)
movl 0x44(%rsp), %eax
cmpl 0x4a54(%rip), %eax      # 0x90f8
jge 0x46cf
movq 0x4b93(%rip), %rax      # 0x9240
movslq 0x48(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movslq 0x44(%rsp), %rcx
movl $0xffffffff, (%rax,%rcx,8) # imm = 0xFFFFFFFF
movl 0x44(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x44(%rsp)
jmp 0x469a
movq 0x4b22(%rip), %rax      # 0x91f8
movslq 0x48(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movl 0x4a13(%rip), %esi      # 0x90f8
movl $0x0, 0x10(%rsp)
leaq 0x10(%rsp), %rdx
callq 0x4930
jmp 0x46f9
movl 0x48(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
jmp 0x44ed
movslq 0x49f8(%rip), %rax      # 0x9108
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x4ab8(%rip)      # 0x91f0
movslq 0x49c9(%rip), %rax      # 0x9108
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x1030
movq %rax, 0x4a81(%rip)      # 0x91e8
movl $0x0, 0x48(%rsp)
movl 0x48(%rsp), %eax
cmpl 0x498f(%rip), %eax      # 0x9108
jge 0x48e3
movq 0x49d2(%rip), %rax      # 0x9158
movslq 0x48(%rsp), %rcx
movl (%rax,%rcx,4), %eax
cmpl 0x4964(%rip), %eax      # 0x90f8
jge 0x480d
movq 0x49bb(%rip), %rax      # 0x9158
movslq 0x48(%rsp), %rcx
movslq (%rax,%rcx,4), %rax
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 0x4a1f(%rip), %rax      # 0x91f0
movslq 0x48(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x4a0f(%rip), %rax      # 0x91f0
movslq 0x48(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movq 0x4967(%rip), %rax      # 0x9158
movslq 0x48(%rsp), %rcx
movl (%rax,%rcx,4), %esi
movl $0xffffffff, 0xc(%rsp)  # imm = 0xFFFFFFFF
leaq 0xc(%rsp), %rdx
callq 0x4930
jmp 0x4870
movslq 0x48e4(%rip), %rax      # 0x90f8
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 0x49b1(%rip), %rax      # 0x91f0
movslq 0x48(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x49a1(%rip), %rax      # 0x91f0
movslq 0x48(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movl 0x489a(%rip), %esi      # 0x90f8
movl $0xffffffff, 0x8(%rsp)  # imm = 0xFFFFFFFF
leaq 0x8(%rsp), %rdx
callq 0x4930
movslq 0x4881(%rip), %rax      # 0x90f8
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 0x4946(%rip), %rax      # 0x91e8
movslq 0x48(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x4936(%rip), %rax      # 0x91e8
movslq 0x48(%rsp), %rcx
movq (%rax,%rcx,8), %rdi
movl 0x4837(%rip), %esi      # 0x90f8
movl $0x0, 0x4(%rsp)
leaq 0x4(%rsp), %rdx
callq 0x4930
movl 0x48(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x48(%rsp)
jmp 0x476f
callq 0x1c70
cmpq $0x0, 0x47e8(%rip)      # 0x90d8
je 0x4913
movq 0x47df(%rip), %rdi      # 0x90d8
callq 0x3af0
movq 0x47d3(%rip), %rsi      # 0x90d8
leaq 0x1d6a(%rip), %rdi      # 0x6676
movb $0x0, %al
callq 0x1040
leaq 0x1d7a(%rip), %rdi      # 0x6694
movb $0x0, %al
callq 0x1040
movl 0xb4(%rsp), %eax
addq $0xb8, %rsp
retq