// File: /workspace/github_cpp_makefile_star2_O1/maramire[P]SP_PSO/main.cpp
// Function: main
int main(int argc, const char *argv[]) 
{


    /* Taking algorithm time performance! */
    auto t1 = chrono::high_resolution_clock::now(); 

    cout << "Start!"<<endl;
    
    /* Save items data */
    Item_vector items;

    /* Open Instance File */

    /* Define number of items to pack */
    int n_items = 0; 
    int strip_width = 0;
    int max_height = 0;

    string filepath = argv[1];
    cout << "-> Opening instances!"<<endl;
    openInstance(filepath, items, strip_width, max_height, n_items);

    
    unsigned int a = filepath.rfind('.');
    unsigned int b = filepath.rfind('/',a-1);
    string name = filepath.substr(b+1,a-b-1);
    
    

    cout << "-> Number of items: " << n_items << endl;
    cout << "-> Strip width: " << strip_width << endl;
    cout << "-> Upper bound computed: "  << max_height << endl;

    /* Swarm of particles */
    Swarm swarm;

    /* Initialize particles */
    for(int i=0; i<N_PARTICLES; i++){
        //unsigned seed = i+1;
        particle_init(n_items, swarm);

        /* Initialize strip */
        Strip s = {};
        s.height = max_height;
        s.width = strip_width;

        s.x_position = 0;
        s.y_position = 0;
    
        /* Evaluate each particle */
        HR(items,s,n_items,swarm[i]); 

        swarm[i].pbest = swarm[i].permutation;
        swarm[i].pbest_fitness = swarm[i].fitness;

    } 

    //showSwarm(swarm);

    /* Declare global best particle */

    Particle gbest;
    gbest.fitness = max_height;


    /* Select best position */
    sort(swarm.begin(), swarm.end(), compareByFitness);
    
    if (swarm[0].fitness < gbest.fitness)
    {
        gbest.fitness = swarm[0].fitness;
        gbest.permutation = swarm[0].permutation;
    }

    int iter = 0;
    float omega = 1.2;
    float c1 = 2.05;
    float c2 = 2.05;
    float omega_max = 1.2;
    float omega_min = 0.7;

    float velocity_max = (n_items)/2;
    float velocity_min = -(n_items)/2;
    float current_velocity = 0;


    random_device rd;
    mt19937 gen(rd());
    uniform_real_distribution<> dis(0, 1);//uniform distribution between 0 and 1

    while (iter<MAX_ITER)
    {

        iter++;
        //cout << gbest.fitness << endl;
        
        /* Update velocity and position with results */
        for (int p = 0; p < N_PARTICLES; p++)
        {
            vector<float> new_permutation(n_items);
            iota(begin(new_permutation), end(new_permutation), 1);

            for (int i = 0; i < swarm[p].permutation.size(); i++)
            {
            
                float r1 = dis(gen);
                float r2 = dis(gen);

                float pfactor = swarm[p].pbest[i] - swarm[p].permutation[i];
                float gfactor = gbest.permutation[i] - swarm[p].permutation[i];                

                current_velocity = omega*swarm[p].permutation[i] + r1*c1*pfactor + r2*c2*gfactor;

                if (current_velocity < velocity_min)
                {
                    current_velocity = velocity_min;

                }else if(current_velocity > velocity_max)
                {
                    current_velocity = velocity_max;
                }

                swarm[p].velocity[i] = current_velocity;
            
                new_permutation[i] = swarm[p].permutation[i] + swarm[p].velocity[i];
                
            }

            /* Discretize position */
            vector<float> assignments = new_permutation;
            sort(assignments.begin(),assignments.end());

            for (int i = 0; i < new_permutation.size(); i++)
            {
                for (int j = 0; j < assignments.size(); j++)
                {
                    if (new_permutation[j]==assignments[i])
                    {
                        swarm[p].permutation[i] = j+1;
                    }   
                }
            }

            /* Initialize strip */
            Strip s = {};
            s.height = max_height;
            s.width = strip_width;

            s.x_position = 0;
            s.y_position = 0;
        
            /* Evaluate particle */
            HR(items,s,n_items,swarm[p]); 

            if (swarm[p].fitness < swarm[p].pbest_fitness)
            {
                swarm[p].pbest = swarm[p].permutation;
                swarm[p].pbest_fitness = swarm[p].fitness;
            }
            
            if (swarm[p].pbest_fitness < gbest.fitness)
            {
                gbest.fitness = swarm[p].pbest_fitness;
                gbest.permutation = swarm[p].pbest;
            }

        }
        
        omega = (omega_max)-((omega_max-omega_min)/MAX_ITER)*iter;
    } 
    

    //showSwarm(swarm);
    //showRectangles(items);

    //showPermutation(gbest);

    Strip s = {};
    s.height = max_height;
    s.width = strip_width;

    s.x_position = 0;
    s.y_position = 0;

    HR(items,s,n_items,gbest); 
    cout << "-> Fitness of best solution: " << gbest.fitness << endl;
    
    //showRectangles(items);


    //cout << "-> End!" << endl;

    auto t2 = chrono::high_resolution_clock::now(); 
    chrono::duration<double> time_span = (t2 - t1);
    cout << "-> It took me " << time_span.count() << " seconds.";
    cout << endl;

/*     ofstream myfile;
    myfile.open ("Results/"+name+".csv", fstream::app);
    myfile << gbest.fitness << "," << time_span.count() << endl;
    myfile.close(); */


    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28a8, %rsp           # imm = 0x28A8
movq %rsi, %rbx
callq 0x2040
movq %rax, %r15
movq 0x6eef(%rip), %r14      # 0x9fd8
leaq 0x4044(%rip), %rsi      # 0x7134
movl $0x6, %edx
movq %r14, %rdi
callq 0x21b0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2170
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2100
xorps %xmm0, %xmm0
movaps %xmm0, -0xa0(%rbp)
movq $0x0, -0x90(%rbp)
xorl %eax, %eax
movl %eax, -0x44(%rbp)
movl %eax, -0x40(%rbp)
movl %eax, -0x3c(%rbp)
movq 0x8(%rbx), %rsi
leaq -0x178(%rbp), %rdi
leaq -0x1540(%rbp), %rdx
callq 0x4188
movq 0x6e76(%rip), %rbx      # 0x9fd8
leaq 0x3fd2(%rip), %rsi      # 0x713b
movl $0x15, %edx
movq %rbx, %rdi
callq 0x21b0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2170
movsbl %al, %esi
movq 0x6e44(%rip), %rdi      # 0x9fd8
callq 0x2030
movq %rax, %rdi
callq 0x2100
leaq -0x188(%rbp), %r14
movq %r14, -0x10(%r14)
movq -0x178(%rbp), %rsi
movq -0x170(%rbp), %rdx
addq %rsi, %rdx
leaq -0x198(%rbp), %rdi
callq 0x4326
leaq -0x198(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
leaq -0x40(%rbp), %rdx
leaq -0x3c(%rbp), %rcx
leaq -0x44(%rbp), %r8
callq 0x244a
movq -0x198(%rbp), %rdi
cmpq %r14, %rdi
je 0x3203
movq -0x188(%rbp), %rsi
incq %rsi
callq 0x2190
leaq -0x178(%rbp), %rbx
movq %rbx, %rdi
movl $0x2e, %esi
movq $-0x1, %rdx
callq 0x2280
movq %rax, %r14
leal -0x1(%rax), %edx
movq %rbx, %rdi
movl $0x2f, %esi
callq 0x2280
leal 0x1(%rax), %edx
notl %eax
addl %eax, %r14d
leaq -0x1b8(%rbp), %rdi
movq %rbx, %rsi
movq %r14, %rcx
callq 0x21a0
movq %r15, -0x138(%rbp)
movq 0x6d7f(%rip), %rdi      # 0x9fd8
leaq 0x3ef1(%rip), %rsi      # 0x7151
movl $0x14, %edx
callq 0x21b0
movl -0x44(%rbp), %r12d
movq 0x6d63(%rip), %rdi      # 0x9fd8
movl %r12d, %esi
callq 0x2250
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2170
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2100
movq 0x6d2a(%rip), %rdi      # 0x9fd8
leaq 0x3eb1(%rip), %rsi      # 0x7166
movl $0x10, %edx
callq 0x21b0
movl -0x40(%rbp), %esi
movq 0x6d0f(%rip), %rdi      # 0x9fd8
movl %esi, -0x30(%rbp)
callq 0x2250
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2170
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2100
movq 0x6cd6(%rip), %rdi      # 0x9fd8
leaq 0x3e6e(%rip), %rsi      # 0x7177
movl $0x19, %edx
callq 0x21b0
movl -0x3c(%rbp), %esi
movq 0x6cbb(%rip), %rdi      # 0x9fd8
movl %esi, -0x2c(%rbp)
callq 0x2250
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2170
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2100
movslq %r12d, %rax
movq %rax, -0x148(%rbp)
xorps %xmm0, %xmm0
leaq -0x60(%rbp), %r14
movaps %xmm0, (%r14)
movq $0x0, 0x10(%r14)
xorl %r15d, %r15d
leaq -0xa0(%rbp), %r13
leaq -0x1540(%rbp), %rbx
movl %r12d, %edi
movq %r14, %rsi
callq 0x2659
xorps %xmm0, %xmm0
movaps %xmm0, -0x1540(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x1540(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0x153c(%rbp)
movq $0x0, -0x1538(%rbp)
movq -0x60(%rbp), %rcx
addq %r15, %rcx
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2c2d
movq -0x60(%rbp), %rsi
leaq (%rsi,%r15), %rdi
addq $0x20, %rdi
addq %r15, %rsi
callq 0x3e30
movq -0x60(%rbp), %rax
movl 0x18(%rax,%r15), %ecx
movl %ecx, 0x38(%rax,%r15)
addq $0x58, %r15
cmpq $0xa50, %r15            # imm = 0xA50
jne 0x337d
xorps %xmm0, %xmm0
movaps %xmm0, -0x130(%rbp)
xorl %eax, %eax
movq %rax, -0x120(%rbp)
movaps %xmm0, -0x110(%rbp)
movq %rax, -0x100(%rbp)
movaps %xmm0, -0xf0(%rbp)
movq %rax, -0xe0(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0x118(%rbp)
movq -0x60(%rbp), %rbx
movq -0x58(%rbp), %r14
cmpq %r14, %rbx
je 0x347e
movq %r14, %rax
subq %rbx, %rax
sarq $0x3, %rax
movabsq $0x2e8ba2e8ba2e8ba3, %rcx # imm = 0x2E8BA2E8BA2E8BA3
imulq %rax, %rcx
bsrq %rcx, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
leaq -0x1026(%rip), %rcx     # 0x243b
movq %rbx, %rdi
movq %r14, %rsi
callq 0x5350
leaq -0x1038(%rip), %rdx     # 0x243b
movq %rbx, %rdi
movq %r14, %rsi
callq 0x54a0
movq -0x60(%rbp), %rsi
movl 0x18(%rsi), %eax
cmpl -0x118(%rbp), %eax
jge 0x349c
leaq -0x130(%rbp), %rdi
movl %eax, 0x18(%rdi)
callq 0x3e30
leaq -0x1540(%rbp), %rdi
callq 0x3ba6
leaq -0x1540(%rbp), %rdi
callq 0x21d0
movl %r12d, %ecx
shrl $0x1f, %ecx
addl %r12d, %ecx
sarl %ecx
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
movss %xmm0, -0x34(%rbp)
negl %ecx
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
movss %xmm0, -0x64(%rbp)
movl %eax, %eax
movq %rax, -0x28c8(%rbp)
movl $0x1, %ecx
movq %rax, %rdx
shrq $0x1e, %rdx
xorl %eax, %edx
imull $0x6c078965, %edx, %eax # imm = 0x6C078965
addl %ecx, %eax
movq %rax, -0x28c8(%rbp,%rcx,8)
incq %rcx
cmpq $0x270, %rcx            # imm = 0x270
jne 0x34e7
leaq -0x28c8(%rbp), %r13
movq $0x270, 0x1380(%r13) # imm = 0x270
movss 0x3b1a(%rip), %xmm0     # 0x7040
xorl %eax, %eax
leaq -0x80(%rbp), %r12
leaq -0xb8(%rbp), %rbx
movss %xmm0, -0x38(%rbp)
incl %eax
movq %rax, -0x140(%rbp)
xorl %r14d, %r14d
movq %r12, %rdi
movq -0x148(%rbp), %rsi
movq %rbx, %rdx
callq 0x41c6
movq -0x80(%rbp), %rax
movq -0x78(%rbp), %rcx
cmpq %rcx, %rax
je 0x357e
movl $0x1, %edx
xorps %xmm0, %xmm0
cvtsi2ss %edx, %xmm0
movss %xmm0, (%rax)
incl %edx
addq $0x4, %rax
cmpq %rcx, %rax
jne 0x3568
movq -0x60(%rbp), %rax
movq %r14, -0x150(%rbp)
imulq $0x58, %r14, %r14
movq 0x8(%rax,%r14), %rcx
cmpq (%rax,%r14), %rcx
je 0x3688
xorl %r15d, %r15d
movq %r13, %rdi
callq 0x6327
movsd %xmm0, -0x158(%rbp)
movq %r13, %rdi
callq 0x6327
xorpd %xmm1, %xmm1
movsd -0x158(%rbp), %xmm2
addsd %xmm1, %xmm2
addsd %xmm1, %xmm0
cvtsd2ss %xmm2, %xmm2
movq -0x60(%rbp), %rax
movq (%rax,%r14), %rcx
movq 0x20(%rax,%r14), %rdx
movl (%rdx,%r15,4), %edx
movl (%rcx,%r15,4), %ecx
subl %ecx, %edx
xorps %xmm3, %xmm3
cvtsi2ss %edx, %xmm3
xorps %xmm1, %xmm1
cvtsd2ss %xmm0, %xmm1
movq -0x130(%rbp), %rdx
movl (%rdx,%r15,4), %edx
subl %ecx, %edx
xorps %xmm4, %xmm4
cvtsi2ss %edx, %xmm4
xorps %xmm0, %xmm0
cvtsi2ss %ecx, %xmm0
movss 0x3a2d(%rip), %xmm5     # 0x7044
mulss %xmm5, %xmm2
mulss %xmm3, %xmm2
movss -0x38(%rbp), %xmm3
mulss %xmm0, %xmm3
addss %xmm2, %xmm3
mulss %xmm5, %xmm1
mulss %xmm4, %xmm1
addss %xmm3, %xmm1
movss -0x64(%rbp), %xmm2
ucomiss %xmm1, %xmm2
ja 0x3650
ucomiss -0x34(%rbp), %xmm1
movaps %xmm1, %xmm2
jbe 0x3650
movss -0x34(%rbp), %xmm2
addq %r14, %rax
movq 0x40(%rax), %rax
movss %xmm2, (%rax,%r15,4)
addss %xmm2, %xmm0
movq -0x80(%rbp), %rax
movss %xmm0, (%rax,%r15,4)
incq %r15
movq -0x60(%rbp), %rax
movq 0x8(%rax,%r14), %rcx
subq (%rax,%r14), %rcx
sarq $0x2, %rcx
cmpq %r15, %rcx
ja 0x359f
movq %rbx, %rdi
movq %r12, %rsi
callq 0x425a
movq %r12, %rbx
movq -0xb8(%rbp), %r15
movq -0xb0(%rbp), %r12
cmpq %r12, %r15
je 0x36d6
movq %r12, %rax
subq %r15, %rax
sarq $0x2, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0x6441
movq %r15, %rdi
movq %r12, %rsi
callq 0x652b
movq -0x80(%rbp), %rax
movq -0x78(%rbp), %rcx
subq %rax, %rcx
movq %rbx, %r12
leaq -0xb8(%rbp), %rbx
je 0x3759
sarq $0x2, %rcx
movq -0xb8(%rbp), %rdx
movq -0xb0(%rbp), %rsi
movq %rsi, %rdi
subq %rdx, %rdi
sarq $0x2, %rdi
cmpq $0x1, %rdi
adcq $0x0, %rdi
cmpq $0x1, %rcx
adcq $0x0, %rcx
xorl %r8d, %r8d
cmpq %rdx, %rsi
je 0x3751
movss (%rdx,%r8,4), %xmm0
movq -0x60(%rbp), %r9
addq %r14, %r9
xorl %r10d, %r10d
movss (%rax,%r10,4), %xmm1
ucomiss %xmm0, %xmm1
jne 0x3749
jp 0x3749
movq (%r9), %r11
leal 0x1(%r10), %r15d
movl %r15d, (%r11,%r8,4)
incq %r10
cmpq %r10, %rdi
jne 0x3731
incq %r8
cmpq %rcx, %r8
jne 0x371c
xorps %xmm0, %xmm0
movaps %xmm0, -0xd0(%rbp)
movl -0x2c(%rbp), %eax
movl %eax, -0xd0(%rbp)
movl -0x30(%rbp), %eax
movl %eax, -0xcc(%rbp)
movq $0x0, -0xc8(%rbp)
movq -0x60(%rbp), %rcx
addq %r14, %rcx
leaq -0xa0(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x2c2d
movq -0x60(%rbp), %rsi
movl 0x18(%rsi,%r14), %eax
cmpl 0x38(%rsi,%r14), %eax
jge 0x37c4
addq %r14, %rsi
leaq 0x20(%rsi), %rdi
callq 0x3e30
movq -0x60(%rbp), %rax
movl 0x18(%rax,%r14), %ecx
movl %ecx, 0x38(%rax,%r14)
movq -0x60(%rbp), %rsi
movl 0x38(%rsi,%r14), %eax
cmpl -0x118(%rbp), %eax
jge 0x37ee
addq %r14, %rsi
movl %eax, -0x118(%rbp)
addq $0x20, %rsi
leaq -0x130(%rbp), %rdi
callq 0x3e30
movq -0xb8(%rbp), %rdi
testq %rdi, %rdi
je 0x3809
movq -0xa8(%rbp), %rsi
subq %rdi, %rsi
callq 0x2190
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
movq -0x150(%rbp), %r14
je 0x3825
movq -0x70(%rbp), %rsi
subq %rdi, %rsi
callq 0x2190
incq %r14
cmpq $0x1e, %r14
jne 0x3544
movq -0x140(%rbp), %rax
xorps %xmm0, %xmm0
cvtsi2ss %eax, %xmm0
mulss 0x3800(%rip), %xmm0     # 0x7048
addss 0x37f0(%rip), %xmm0     # 0x7040
movss %xmm0, -0x38(%rbp)
cmpl $0x2bc, %eax            # imm = 0x2BC
jne 0x3538
xorps %xmm0, %xmm0
leaq -0x80(%rbp), %rsi
movaps %xmm0, (%rsi)
movl -0x2c(%rbp), %eax
movl %eax, (%rsi)
movl -0x30(%rbp), %eax
movl %eax, 0x4(%rsi)
movq $0x0, 0x8(%rsi)
leaq -0xa0(%rbp), %rdi
leaq -0x130(%rbp), %rcx
callq 0x2c2d
movq 0x6741(%rip), %rdi      # 0x9fd8
leaq 0x38f3(%rip), %rsi      # 0x7191
movl $0x1d, %edx
callq 0x21b0
movl -0x118(%rbp), %esi
movq 0x6723(%rip), %rdi      # 0x9fd8
callq 0x2250
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2170
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2100
callq 0x2040
movq %rax, %rbx
movq 0x66e5(%rip), %rdi      # 0x9fd8
leaq 0x38b5(%rip), %rsi      # 0x71af
movl $0xe, %edx
callq 0x21b0
movq -0x138(%rbp), %rax
subq %rax, %rbx
xorps %xmm0, %xmm0
cvtsi2sd %rbx, %xmm0
divsd 0x373a(%rip), %xmm0     # 0x7058
movq 0x66b3(%rip), %rbx      # 0x9fd8
movq %rbx, %rdi
callq 0x2200
leaq 0x388a(%rip), %rsi      # 0x71be
movl $0x9, %edx
movq %rax, %rdi
callq 0x21b0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2170
movsbl %al, %esi
movq 0x6679(%rip), %rdi      # 0x9fd8
callq 0x2030
movq %rax, %rdi
callq 0x2100
leaq -0x1540(%rbp), %rdi
callq 0x2160
movq -0xf0(%rbp), %rdi
testq %rdi, %rdi
je 0x3993
movq -0xe0(%rbp), %rsi
subq %rdi, %rsi
callq 0x2190
movq -0x110(%rbp), %rdi
testq %rdi, %rdi
je 0x39ae
movq -0x100(%rbp), %rsi
subq %rdi, %rsi
callq 0x2190
movq -0x130(%rbp), %rdi
testq %rdi, %rdi
je 0x39c9
movq -0x120(%rbp), %rsi
subq %rdi, %rsi
callq 0x2190
leaq -0x60(%rbp), %rdi
callq 0x42da
leaq -0x1a8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x39f1
movq -0x1a8(%rbp), %rsi
incq %rsi
callq 0x2190
leaq -0x168(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3a10
movq -0x168(%rbp), %rsi
incq %rsi
callq 0x2190
movq -0xa0(%rbp), %rdi
testq %rdi, %rdi
je 0x3a2b
movq -0x90(%rbp), %rsi
subq %rdi, %rsi
callq 0x2190
xorl %eax, %eax
addq $0x28a8, %rsp           # imm = 0x28A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3b9e
jmp 0x3a96
jmp 0x3a71
jmp 0x3a76
movq %rax, %rbx
movq -0x198(%rbp), %rdi
cmpq %r14, %rdi
je 0x3b5c
movq -0x188(%rbp), %rsi
jmp 0x3b54
movq %rax, %rbx
jmp 0x3b7b
movq %rax, %rbx
jmp 0x3ae3
movq %rax, %rbx
jmp 0x3b5c
jmp 0x3a96
jmp 0x3a96
movq %rax, %rbx
jmp 0x3b3d
jmp 0x3a8c
movq %rax, %rbx
jmp 0x3b34
jmp 0x3abf
movq %rax, %rbx
jmp 0x3ad7
jmp 0x3a9d
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
testq %rdi, %rdi
je 0x3ac2
movq -0xa8(%rbp), %rsi
subq %rdi, %rsi
callq 0x2190
jmp 0x3ac2
jmp 0x3abf
movq %rax, %rbx
movq -0x80(%rbp), %rdi
testq %rdi, %rdi
je 0x3ad7
movq -0x70(%rbp), %rsi
subq %rdi, %rsi
callq 0x2190
leaq -0x1540(%rbp), %rdi
callq 0x2160
movq -0xf0(%rbp), %rdi
testq %rdi, %rdi
je 0x3afe
movq -0xe0(%rbp), %rsi
subq %rdi, %rsi
callq 0x2190
movq -0x110(%rbp), %rdi
testq %rdi, %rdi
je 0x3b19
movq -0x100(%rbp), %rsi
subq %rdi, %rsi
callq 0x2190
movq -0x130(%rbp), %rdi
testq %rdi, %rdi
je 0x3b34
movq -0x120(%rbp), %rsi
subq %rdi, %rsi
callq 0x2190
leaq -0x60(%rbp), %rdi
callq 0x42da
leaq -0x1a8(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3b5c
movq -0x1a8(%rbp), %rsi
incq %rsi
callq 0x2190
leaq -0x168(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3b7b
movq -0x168(%rbp), %rsi
incq %rsi
callq 0x2190
movq -0xa0(%rbp), %rdi
testq %rdi, %rdi
je 0x3b96
movq -0x90(%rbp), %rsi
subq %rdi, %rsi
callq 0x2190
movq %rbx, %rdi
callq 0x2260
movq %rax, %rdi
callq 0x4318