// File: /workspace/github_c_makefile_star2_O0/sc932[P]ALE/src/ALE.c
// Function: main
int main(int argc, char **argv){
	int c = 0, digit_optind = 0;
    int kmerLen = 4;
    char placementOut[256];
    samfile_t *placementBam = NULL;
    *placementOut = '\0';
    libraryParametersT *libParams = NULL;
    double outlierFraction = 0.02;
    int qOff = -1;
    int printAllAleOutput = 1;

    int doRealign = 0;
    // use BWA bwasw default matrix
    char defaultRealignOptions[] = DEFAULT_REALIGN_OPTIONS;
    int matchScore, mismatchPenalty, gapOpenPenalty, gapExtendPenalty, minSoftClip;
    FILE *snpPhaseFile = NULL;


    while(1) {
        int this_option_optind = optind ? optind : 1;
        int option_index = 0;
        c = getopt_long(argc, argv, "h",
                 long_options, &option_index);
        if (c == -1)
        	break;
        switch(c) {
        case 0:
        	// long options
        	if (strcmp(long_options[option_index].name, "kmer") == 0) {
                kmerLen = atoi(optarg);
                if(kmerLen > 20){
                    printf("--kmer option of %i not in range [2,20], set to default [4].\n", kmerLen);
                    kmerLen = 4;
                }
        	} else if (strcmp(long_options[option_index].name, "qOff") == 0) {
                qOff = atoi(optarg);
                if(qOff != 64 && qOff != 33 && qOff != 0){
                    printf("--qOff option of %i not in set [33,64], will be set to 33.\n", qOff);
                    qOff = 33;  // SAM/BAM specification is for ascii - 33.
                }
        	} else if (strcmp(long_options[option_index].name, "pl") == 0) {
                strcpy(placementOut, optarg);
        	} else if (strcmp(long_options[option_index].name, "pm") == 0) {
                libParams = malloc(sizeof(libraryParametersT));
                importLibraryParameters(libParams, optarg);
        	} else if (strcmp(long_options[option_index].name, "nout") == 0) {
                printAllAleOutput = 0;
                printf("Turned off per-base output\n");
        	} else if (strcmp(long_options[option_index].name, "minLL") == 0) {
            	setMinLogLike(atof(optarg));
            	printf("Set minLogLike to: %0.1f\n", getMinLogLike());
        	} else if (strcmp(long_options[option_index].name, "metagenome") == 0) {
            	setMetagenome();
            	printf("This dataset will be evaluated as a Metagenome\n");
        	} else if (strcmp(long_options[option_index].name, "realign") == 0) {
            	doRealign = 1;
            	char *swopts = defaultRealignOptions;
            	if (optarg) {
            		swopts = optarg;
            	}
            	// parse SW options...
            	if (5 != sscanf(swopts, "%d,%d,%d,%d,%d", &matchScore, &mismatchPenalty, &gapOpenPenalty, &gapExtendPenalty, &minSoftClip)) {
            		usage();
            		fprintf(stderr, "Could not parse %s as --realign parameter.  Expecting 5 integers.\n", optarg);
            		exit(1);
            	}
            	printf("This dataset will be realigned with Smith-Waterman letting ambiguous bases match %s\n", swopts);
        	} else if (strcmp(long_options[option_index].name, "SNPreport") == 0) {
        		snpPhaseFile = fopen(optarg, "w");
        		if (snpPhaseFile == NULL) {
        			fprintf(stderr, "Could not open '%s' for writing the SNPreport!\n", optarg);
        			exit(1);
        		}
        		printSNPhaseHeader(snpPhaseFile);
        		printf("Reporting SNP phasing into %s\n", optarg);
        	} else if (strcmp(long_options[option_index].name, "minQual") == 0) {
        		fprintf(stderr, "Using minimum quality score of %s\n", optarg);
        		setMinimumQuality( atoi(optarg) );
        		exit(0);
         	} else if (strcmp(long_options[option_index].name, "help") == 0) {
        		usage();
        		exit(0);
         	} else {
         		fprintf(stderr, "unknown option: %s\n", long_options[option_index].name);
         		usage();
         		exit(1);
         	}
        	break;
        case 'h':
        default:
        	usage();
        	exit(0);
        }
    }

    if (argc - optind < 3) {
        // the input was shorter than anticipated, print long options if -h specified
    	usage();
        return 0;
    }
    
    // input and output files
    char *bamFile = argv[optind], *assemblyFile = argv[optind+1], *aleFile = argv[optind+2];
    printf("BAM file: %s\n", bamFile);
    printf("Assembly fasta file: %s\n", assemblyFile);
    printf("ALE Output file: %s\n", aleFile);

    // attempt to open the bam input file
    samfile_t *ins = openSamOrBam(bamFile);
    
    printf("Reading in assembly...\n");
    assemblyT *theAssembly = loadAssembly(assemblyFile);
    if (!validateAssemblyIsSameAsAlignment(ins->header, theAssembly)) {
        printf("Error! Assembly fasta %s does not match alignment file %s!\n", assemblyFile, bamFile);
        exit(1);
    }
    
    if (*placementOut != '\0') {
        printf("Placement file: %s\n", placementOut);
        char mode[] = "wbu";
        if (placementOut[0] != '-' )
            mode[2] = '\0'; // compress bam if not part of a pipe
        placementBam = samopen(placementOut, mode, ins->header);
        if(placementBam == 0){
            printf("Error! Could not write to the placement BAM file: %s\n", placementOut);
            exit(1);
        }
    }

    printf("Reading in the map and computing statistics...\n");

    if(libParams != NULL){
      saveLibraryParameters(libParams, aleFile); // the ALE output file name
    }

    // calculate the insert mean/std if not given
    if(libParams == NULL){
        printf("Insert length and std not given, will be calculated from input map.\n");

        libParams = computeLibraryParameters(ins, outlierFraction, qOff);
        saveLibraryParameters(libParams, aleFile); // the ALE output file name

        // close and re-open bam file
        samclose(ins);
        ins = openSamOrBam(bamFile);
    }

    // set assembly avgReadSize to that of library (rounded to nearest int)
    theAssembly->avgReadSize = (double)libParams->avgReadSize;

    // place reads and compute statistics on the assembly
    printf("Computing read placements and depths\n");
    if (doRealign)
    	initRefNumForRealign(theAssembly, matchScore, mismatchPenalty, gapOpenPenalty, gapExtendPenalty, minSoftClip);
    computeReadPlacements(ins, theAssembly, libParams, placementBam, snpPhaseFile);
    if (doRealign)
    	destroyRefNumForRealign(theAssembly);
    if (snpPhaseFile != NULL) {
    	if (ftell(snpPhaseFile) > 0) {
    		fprintf(snpPhaseFile, "\n");
    	}
    	fclose(snpPhaseFile);
    	snpPhaseFile = NULL;
    }
    
    // compute statistics on assembly
    printf("Computing k-mer statistics...\n");
    computeKmerStats(theAssembly, kmerLen);
    printf("Done computing k-mer statistics.\n");
    
    printf("Computing depth statistics...\n");
    computeDepthStats(theAssembly, libParams);
    printf("Done computing depth statistics.\n");

    printf("Computing statistics on expected missing...\n");
    applyExpectedMissingLength(theAssembly);
    printf("Done computing statistics on expected missing.\n");
    
    FILE *out = fopen(aleFile, "w");
    if(out == NULL){
        printf("Error! Could not open output file: %s\n", aleFile);
    }
    writeToOutput(theAssembly, printAllAleOutput, out);
    fclose(out);
    
    printf("Output is in file: %s\n", aleFile);

    if (placementBam != NULL) {
        printf("Closing placement file\n");
        samclose(placementBam);
    }

    printf("Closing input file\n");
    samclose(ins);
    
    if (libParams != NULL)
        free(libParams);

    freeAssembly(theAssembly);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1d0, %rsp            # imm = 0x1D0
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x4, -0x1c(%rbp)
movq $0x0, -0x128(%rbp)
movb $0x0, -0x120(%rbp)
movq $0x0, -0x130(%rbp)
movsd 0x27795(%rip), %xmm0    # 0x2b008
movsd %xmm0, -0x138(%rbp)
movl $0xffffffff, -0x13c(%rbp) # imm = 0xFFFFFFFF
movl $0x1, -0x140(%rbp)
movl $0x0, -0x144(%rbp)
movq 0x27774(%rip), %rax     # 0x2b014
movq %rax, -0x14f(%rbp)
movw 0x2776e(%rip), %ax      # 0x2b01c
movw %ax, -0x147(%rbp)
movb 0x27763(%rip), %al      # 0x2b01e
movb %al, -0x145(%rbp)
movq $0x0, -0x170(%rbp)
movq 0x356fd(%rip), %rax     # 0x38fd0
cmpl $0x0, (%rax)
je 0x38e9
movq 0x356f1(%rip), %rax     # 0x38fd0
movl (%rax), %eax
movl %eax, -0x1bc(%rbp)
jmp 0x38f6
movl $0x1, %eax
movl %eax, -0x1bc(%rbp)
jmp 0x38f6
movl -0x1bc(%rbp), %eax
movl %eax, -0x174(%rbp)
movl $0x0, -0x178(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x27705(%rip), %rdx     # 0x2b01f
leaq 0x35a5f(%rip), %rcx     # 0x39380
leaq -0x178(%rbp), %r8
callq 0x31e0
movl %eax, -0x14(%rbp)
cmpl $-0x1, -0x14(%rbp)
jne 0x393b
jmp 0x3e4c
movl -0x14(%rbp), %eax
movl %eax, -0x1c0(%rbp)
testl %eax, %eax
je 0x395e
jmp 0x394a
movl -0x1c0(%rbp), %eax
subl $0x68, %eax
je 0x3e39
jmp 0x3e3b
movslq -0x178(%rbp), %rcx
leaq 0x35a14(%rip), %rax     # 0x39380
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdi
leaq 0x276a4(%rip), %rsi     # 0x2b021
callq 0x3330
cmpl $0x0, %eax
jne 0x39bc
movq 0x3564a(%rip), %rax     # 0x38fd8
movq (%rax), %rdi
callq 0x3570
movl %eax, -0x1c(%rbp)
cmpl $0x14, -0x1c(%rbp)
jle 0x39b7
movl -0x1c(%rbp), %esi
leaq 0x2767d(%rip), %rdi     # 0x2b026
movb $0x0, %al
callq 0x3200
movl $0x4, -0x1c(%rbp)
jmp 0x3e37
movslq -0x178(%rbp), %rcx
leaq 0x359b6(%rip), %rax     # 0x39380
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdi
leaq 0x27689(%rip), %rsi     # 0x2b064
callq 0x3330
cmpl $0x0, %eax
jne 0x3a38
movq 0x355ec(%rip), %rax     # 0x38fd8
movq (%rax), %rdi
callq 0x3570
movl %eax, -0x13c(%rbp)
cmpl $0x40, -0x13c(%rbp)
je 0x3a33
cmpl $0x21, -0x13c(%rbp)
je 0x3a33
cmpl $0x0, -0x13c(%rbp)
je 0x3a33
movl -0x13c(%rbp), %esi
leaq 0x27647(%rip), %rdi     # 0x2b069
movb $0x0, %al
callq 0x3200
movl $0x21, -0x13c(%rbp)
jmp 0x3e35
movslq -0x178(%rbp), %rcx
leaq 0x3593a(%rip), %rax     # 0x39380
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdi
leaq 0x2764e(%rip), %rsi     # 0x2b0a5
callq 0x3330
cmpl $0x0, %eax
jne 0x3a7c
leaq -0x120(%rbp), %rdi
movq 0x35569(%rip), %rax     # 0x38fd8
movq (%rax), %rsi
callq 0x30c0
jmp 0x3e33
movslq -0x178(%rbp), %rcx
leaq 0x358f6(%rip), %rax     # 0x39380
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdi
leaq 0x2760d(%rip), %rsi     # 0x2b0a8
callq 0x3330
cmpl $0x0, %eax
jne 0x3ad1
movl $0x3c0, %edi            # imm = 0x3C0
callq 0x3420
movq %rax, -0x130(%rbp)
movq -0x130(%rbp), %rdi
movq 0x35514(%rip), %rax     # 0x38fd8
movq (%rax), %rsi
callq 0xebe0
jmp 0x3e31
movslq -0x178(%rbp), %rcx
leaq 0x358a1(%rip), %rax     # 0x39380
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdi
leaq 0x275bb(%rip), %rsi     # 0x2b0ab
callq 0x3330
cmpl $0x0, %eax
jne 0x3b17
movl $0x0, -0x140(%rbp)
leaq 0x275a5(%rip), %rdi     # 0x2b0b0
movb $0x0, %al
callq 0x3200
jmp 0x3e2f
movslq -0x178(%rbp), %rcx
leaq 0x3585b(%rip), %rax     # 0x39380
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdi
leaq 0x27596(%rip), %rsi     # 0x2b0cc
callq 0x3330
cmpl $0x0, %eax
jne 0x3b6e
movq 0x35491(%rip), %rax     # 0x38fd8
movq (%rax), %rdi
callq 0x3160
callq 0xbdd0
movb $0x0, %al
callq 0xbdf0
leaq 0x27570(%rip), %rdi     # 0x2b0d2
movb $0x1, %al
callq 0x3200
jmp 0x3e2d
movslq -0x178(%rbp), %rcx
leaq 0x35804(%rip), %rax     # 0x39380
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdi
leaq 0x2755f(%rip), %rsi     # 0x2b0ec
callq 0x3330
cmpl $0x0, %eax
jne 0x3bb1
movb $0x0, %al
callq 0xbeb0
leaq 0x27552(%rip), %rdi     # 0x2b0f7
movb $0x0, %al
callq 0x3200
jmp 0x3e2b
movslq -0x178(%rbp), %rcx
leaq 0x357c1(%rip), %rax     # 0x39380
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdi
leaq 0x27557(%rip), %rsi     # 0x2b127
callq 0x3330
cmpl $0x0, %eax
jne 0x3ca6
movl $0x1, -0x144(%rbp)
leaq -0x14f(%rbp), %rax
movq %rax, -0x180(%rbp)
movq 0x353db(%rip), %rax     # 0x38fd8
cmpq $0x0, (%rax)
je 0x3c14
movq 0x353ce(%rip), %rax     # 0x38fd8
movq (%rax), %rax
movq %rax, -0x180(%rbp)
movq -0x180(%rbp), %rdi
leaq 0x2f201(%rip), %rsi     # 0x32e23
leaq -0x154(%rbp), %rdx
leaq -0x158(%rbp), %rcx
leaq -0x15c(%rbp), %r8
leaq -0x160(%rbp), %r9
leaq -0x164(%rbp), %rax
movq %rax, (%rsp)
movb $0x0, %al
callq 0x3450
movl %eax, %ecx
movl $0x5, %eax
cmpl %ecx, %eax
je 0x3c8c
callq 0x37d0
movq 0x35391(%rip), %rax     # 0x38ff8
movq (%rax), %rdi
movq 0x35367(%rip), %rax     # 0x38fd8
movq (%rax), %rdx
leaq 0x274b4(%rip), %rsi     # 0x2b12f
movb $0x0, %al
callq 0x3350
movl $0x1, %edi
callq 0x35b0
movq -0x180(%rbp), %rsi
leaq 0x274d8(%rip), %rdi     # 0x2b172
movb $0x0, %al
callq 0x3200
jmp 0x3e29
movslq -0x178(%rbp), %rcx
leaq 0x356cc(%rip), %rax     # 0x39380
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdi
leaq 0x27502(%rip), %rsi     # 0x2b1c7
callq 0x3330
cmpl $0x0, %eax
jne 0x3d4b
movq 0x35302(%rip), %rax     # 0x38fd8
movq (%rax), %rdi
leaq 0x274f1(%rip), %rsi     # 0x2b1d1
callq 0x3520
movq %rax, -0x170(%rbp)
cmpq $0x0, -0x170(%rbp)
jne 0x3d22
movq 0x352fb(%rip), %rax     # 0x38ff8
movq (%rax), %rdi
movq 0x352d1(%rip), %rax     # 0x38fd8
movq (%rax), %rdx
leaq 0x274c2(%rip), %rsi     # 0x2b1d3
movb $0x0, %al
callq 0x3350
movl $0x1, %edi
callq 0x35b0
movq -0x170(%rbp), %rdi
callq 0x74e0
movq 0x352a3(%rip), %rax     # 0x38fd8
movq (%rax), %rsi
leaq 0x274c4(%rip), %rdi     # 0x2b203
movb $0x0, %al
callq 0x3200
jmp 0x3e27
movslq -0x178(%rbp), %rcx
leaq 0x35627(%rip), %rax     # 0x39380
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdi
leaq 0x274b8(%rip), %rsi     # 0x2b222
callq 0x3330
cmpl $0x0, %eax
jne 0x3db3
movq 0x3527d(%rip), %rax     # 0x38ff8
movq (%rax), %rdi
movq 0x35253(%rip), %rax     # 0x38fd8
movq (%rax), %rdx
leaq 0x2749b(%rip), %rsi     # 0x2b22a
movb $0x0, %al
callq 0x3350
movq 0x3523b(%rip), %rax     # 0x38fd8
movq (%rax), %rdi
callq 0x3570
movl %eax, %edi
callq 0xbf50
xorl %edi, %edi
callq 0x35b0
movslq -0x178(%rbp), %rcx
leaq 0x355bf(%rip), %rax     # 0x39380
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdi
leaq 0x2747b(%rip), %rsi     # 0x2b24d
callq 0x3330
cmpl $0x0, %eax
jne 0x3de8
callq 0x37d0
xorl %edi, %edi
callq 0x35b0
movq 0x35209(%rip), %rax     # 0x38ff8
movq (%rax), %rdi
movslq -0x178(%rbp), %rcx
leaq 0x35580(%rip), %rax     # 0x39380
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rdx
leaq 0x27441(%rip), %rsi     # 0x2b252
movb $0x0, %al
callq 0x3350
callq 0x37d0
movl $0x1, %edi
callq 0x35b0
jmp 0x3e29
jmp 0x3e2b
jmp 0x3e2d
jmp 0x3e2f
jmp 0x3e31
jmp 0x3e33
jmp 0x3e35
jmp 0x3e37
jmp 0x3e47
jmp 0x3e3b
callq 0x37d0
xorl %edi, %edi
callq 0x35b0
jmp 0x38cc
movl -0x8(%rbp), %eax
movq 0x3517a(%rip), %rcx     # 0x38fd0
subl (%rcx), %eax
cmpl $0x3, %eax
jge 0x3e6e
callq 0x37d0
movl $0x0, -0x4(%rbp)
jmp 0x42e5
movq -0x10(%rbp), %rax
movq 0x35157(%rip), %rcx     # 0x38fd0
movslq (%rcx), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x188(%rbp)
movq -0x10(%rbp), %rax
movq 0x3513e(%rip), %rcx     # 0x38fd0
movl (%rcx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x190(%rbp)
movq -0x10(%rbp), %rax
movq 0x35120(%rip), %rcx     # 0x38fd0
movl (%rcx), %ecx
addl $0x2, %ecx
movslq %ecx, %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x198(%rbp)
movq -0x188(%rbp), %rsi
leaq 0x27457(%rip), %rdi     # 0x2b328
movb $0x0, %al
callq 0x3200
movq -0x190(%rbp), %rsi
leaq 0x27380(%rip), %rdi     # 0x2b266
movb $0x0, %al
callq 0x3200
movq -0x198(%rbp), %rsi
leaq 0x27384(%rip), %rdi     # 0x2b27f
movb $0x0, %al
callq 0x3200
movq -0x188(%rbp), %rdi
callq 0xead0
movq %rax, -0x1a0(%rbp)
leaq 0x27378(%rip), %rdi     # 0x2b294
movb $0x0, %al
callq 0x3200
movq -0x190(%rbp), %rdi
callq 0xe850
movq %rax, -0x1a8(%rbp)
movq -0x1a0(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x1a8(%rbp), %rsi
callq 0xd750
cmpl $0x0, %eax
jne 0x3f78
movq -0x190(%rbp), %rsi
movq -0x188(%rbp), %rdx
leaq 0x27345(%rip), %rdi     # 0x2b2ac
movb $0x0, %al
callq 0x3200
movl $0x1, %edi
callq 0x35b0
movsbl -0x120(%rbp), %eax
cmpl $0x0, %eax
je 0x400c
leaq -0x120(%rbp), %rsi
leaq 0x27352(%rip), %rdi     # 0x2b2e8
movb $0x0, %al
callq 0x3200
movl 0x27359(%rip), %eax     # 0x2b2fc
movl %eax, -0x1ac(%rbp)
movsbl -0x120(%rbp), %eax
cmpl $0x2d, %eax
je 0x3fbc
movb $0x0, -0x1aa(%rbp)
leaq -0x120(%rbp), %rdi
leaq -0x1ac(%rbp), %rsi
movq -0x1a0(%rbp), %rax
movq 0x10(%rax), %rdx
callq 0x1c430
movq %rax, -0x128(%rbp)
cmpq $0x0, -0x128(%rbp)
jne 0x400a
leaq -0x120(%rbp), %rsi
leaq 0x27307(%rip), %rdi     # 0x2b300
movb $0x0, %al
callq 0x3200
movl $0x1, %edi
callq 0x35b0
jmp 0x400c
leaq 0x27323(%rip), %rdi     # 0x2b336
movb $0x0, %al
callq 0x3200
cmpq $0x0, -0x130(%rbp)
je 0x4037
movq -0x130(%rbp), %rdi
movq -0x198(%rbp), %rsi
callq 0xef60
cmpq $0x0, -0x130(%rbp)
jne 0x40a2
leaq 0x2731e(%rip), %rdi     # 0x2b366
movb $0x0, %al
callq 0x3200
movq -0x1a0(%rbp), %rdi
movsd -0x138(%rbp), %xmm0
movl -0x13c(%rbp), %esi
callq 0xf240
movq %rax, -0x130(%rbp)
movq -0x130(%rbp), %rdi
movq -0x198(%rbp), %rsi
callq 0xef60
movq -0x1a0(%rbp), %rdi
callq 0x1cb00
movq -0x188(%rbp), %rdi
callq 0xead0
movq %rax, -0x1a0(%rbp)
movq -0x130(%rbp), %rax
cvtsi2sdq 0x380(%rax), %xmm0
movq -0x1a8(%rbp), %rax
movsd %xmm0, 0x98(%rax)
leaq 0x272e3(%rip), %rdi     # 0x2b3ab
movb $0x0, %al
callq 0x3200
cmpl $0x0, -0x144(%rbp)
je 0x4104
movq -0x1a8(%rbp), %rdi
movl -0x154(%rbp), %esi
movl -0x158(%rbp), %edx
movl -0x15c(%rbp), %ecx
movl -0x160(%rbp), %r8d
movl -0x164(%rbp), %r9d
callq 0xba50
movq -0x1a0(%rbp), %rdi
movq -0x1a8(%rbp), %rsi
movq -0x130(%rbp), %rdx
movq -0x128(%rbp), %rcx
movq -0x170(%rbp), %r8
callq 0xa1d0
cmpl $0x0, -0x144(%rbp)
je 0x4141
movq -0x1a8(%rbp), %rdi
callq 0xbd30
cmpq $0x0, -0x170(%rbp)
je 0x4189
movq -0x170(%rbp), %rdi
callq 0x3360
cmpq $0x0, %rax
jle 0x4172
movq -0x170(%rbp), %rdi
leaq 0x2ebc2(%rip), %rsi     # 0x32d2d
movb $0x0, %al
callq 0x3350
movq -0x170(%rbp), %rdi
callq 0x31c0
movq $0x0, -0x170(%rbp)
leaq 0x27241(%rip), %rdi     # 0x2b3d1
movb $0x0, %al
callq 0x3200
movq -0x1a8(%rbp), %rdi
movl -0x1c(%rbp), %esi
callq 0x5a90
leaq 0x27243(%rip), %rdi     # 0x2b3f0
movb $0x0, %al
callq 0x3200
leaq 0x27257(%rip), %rdi     # 0x2b412
movb $0x0, %al
callq 0x3200
movq -0x1a8(%rbp), %rdi
movq -0x130(%rbp), %rsi
callq 0x8140
leaq 0x27255(%rip), %rdi     # 0x2b431
movb $0x0, %al
callq 0x3200
leaq 0x27269(%rip), %rdi     # 0x2b453
movb $0x0, %al
callq 0x3200
movq -0x1a8(%rbp), %rdi
callq 0x7ec0
leaq 0x2727c(%rip), %rdi     # 0x2b480
movb $0x0, %al
callq 0x3200
movq -0x198(%rbp), %rdi
leaq 0x26fb8(%rip), %rsi     # 0x2b1d1
callq 0x3520
movq %rax, -0x1b8(%rbp)
cmpq $0x0, -0x1b8(%rbp)
jne 0x4244
movq -0x198(%rbp), %rsi
leaq 0x27273(%rip), %rdi     # 0x2b4b0
movb $0x0, %al
callq 0x3200
movq -0x1a8(%rbp), %rdi
movl -0x140(%rbp), %esi
movq -0x1b8(%rbp), %rdx
callq 0xe350
movq -0x1b8(%rbp), %rdi
callq 0x31c0
movq -0x198(%rbp), %rsi
leaq 0x27260(%rip), %rdi     # 0x2b4d7
movb $0x0, %al
callq 0x3200
cmpq $0x0, -0x128(%rbp)
je 0x42a2
leaq 0x2725f(%rip), %rdi     # 0x2b4ee
movb $0x0, %al
callq 0x3200
movq -0x128(%rbp), %rdi
callq 0x1cb00
leaq 0x2725d(%rip), %rdi     # 0x2b506
movb $0x0, %al
callq 0x3200
movq -0x1a0(%rbp), %rdi
callq 0x1cb00
cmpq $0x0, -0x130(%rbp)
je 0x42d2
movq -0x130(%rbp), %rdi
callq 0x3050
movq -0x1a8(%rbp), %rdi
callq 0xea50
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x1d0, %rsp            # imm = 0x1D0
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)