// File: /workspace/github_cpp_makefile_star2_O1/hansfilipelo[P]floodfill/src/main.cpp
// Function: main
int main(int argc, char* argv[])
{
    vector< vector<int> > map;
    srand(0);
    int size = 100;

    cout << "Before: " << endl;
    // Generate random map between 1-10
    for (int i = 0; i < size; i++){
        map.push_back(vector<int>());
        for(int j = 0; j < size; j++){
            int tmp = i/10;
            map.at(i).push_back(tmp);
            cout << tmp << " ";
        }
        cout << endl;
    }
    
    int middle = map.size()/2;
    Utils::flood_fill(&map, map.size()/2, map.at(0).size()/2, map.at(middle).at(middle), -1);

    cout << endl << "After: " << endl;

    for (int i = 0; i < map.size(); i++){
        for (int j = 0; j < map.at(0).size(); j++ ){
            cout << map.at(i).at(j) << " ";
        }
        cout << endl;
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movq $0x0, -0x30(%rbp)
xorl %edi, %edi
callq 0x1090
movq 0x36c2(%rip), %rbx      # 0x4fd8
leaq 0x1763(%rip), %rsi      # 0x3080
movl $0x8, %edx
movq %rbx, %rdi
callq 0x10d0
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x10a0
movsbl %al, %esi
movq 0x3690(%rip), %rbx      # 0x4fd8
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1060
xorl %r14d, %r14d
xorps %xmm0, %xmm0
movaps %xmm0, -0x60(%rbp)
movq $0x0, -0x50(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x1d1e
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x198c
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x10c0
movl %r14d, %r15d
movl $0xcccccccd, %eax       # imm = 0xCCCCCCCD
imulq %rax, %r15
shrq $0x23, %r15
movl $0x64, %r12d
leaq (%r14,%r14,2), %r13
movl %r15d, -0x60(%rbp)
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
cmpq %r14, %rdx
jbe 0x1c4c
leaq (%rax,%r13,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x19eb
movl %r15d, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x19f4
leaq -0x60(%rbp), %rdx
callq 0x1f3c
movl -0x60(%rbp), %esi
movq %rbx, %rdi
callq 0x1110
movl $0x1, %edx
movq %rax, %rdi
leaq 0x1679(%rip), %rsi      # 0x3087
callq 0x10d0
decl %r12d
jne 0x19a6
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1060
incq %r14
cmpq $0x64, %r14
movabsq $-0x5555555555555555, %r12 # imm = 0xAAAAAAAAAAAAAAAB
jne 0x195b
movq -0x40(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rax, %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
imulq %r12, %rdx
cmpq %rcx, %rax
je 0x1c76
movq %rdx, %rax
shrq %rax
movslq %eax, %rsi
cmpq %rsi, %rdx
jbe 0x1c78
leaq (%rsi,%rsi,2), %rdx
movq (%rcx,%rdx,8), %rdi
movq 0x8(%rcx,%rdx,8), %rdx
subq %rdi, %rdx
sarq $0x2, %rdx
cmpq %rsi, %rdx
jbe 0x1c78
movq 0x8(%rcx), %rdx
subq (%rcx), %rdx
shrq $0x3, %rdx
movl (%rdi,%rsi,4), %ecx
leaq -0x40(%rbp), %rdi
movl %eax, %esi
movl $0xffffffff, %r8d       # imm = 0xFFFFFFFF
callq 0x12dc
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x10a0
movsbl %al, %esi
movq 0x34f7(%rip), %rbx      # 0x4fd8
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1060
movq %rax, %r14
leaq 0x158e(%rip), %rsi      # 0x3089
movl $0x7, %edx
movq %rax, %rdi
callq 0x10d0
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x10a0
movsbl %al, %esi
movq %r14, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1060
movq -0x38(%rbp), %rax
cmpq -0x40(%rbp), %rax
je 0x1c32
leaq 0x1543(%rip), %r15      # 0x3087
xorl %r14d, %r14d
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
imulq %r12, %rdx
cmpq %rax, %rcx
je 0x1c5d
leaq (%r14,%r14,2), %r13
xorl %r12d, %r12d
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x2, %rcx
cmpq %r12, %rcx
jbe 0x1be5
cmpq %r14, %rdx
jbe 0x1c65
movq (%rax,%r13,8), %rcx
movq 0x8(%rax,%r13,8), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %r12, %rdx
jbe 0x1c62
movl (%rcx,%r12,4), %esi
movq %rbx, %rdi
callq 0x1110
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x10d0
incq %r12
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %rsi # imm = 0xAAAAAAAAAAAAAAAB
imulq %rsi, %rdx
cmpq %rax, %rcx
jne 0x1b6d
jmp 0x1c5d
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x10a0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1060
movq -0x38(%rbp), %rax
subq -0x40(%rbp), %rax
incq %r14
sarq $0x3, %rax
movabsq $-0x5555555555555555, %r12 # imm = 0xAAAAAAAAAAAAAAAB
imulq %r12, %rax
cmpq %r14, %rax
ja 0x1b47
leaq -0x40(%rbp), %rdi
callq 0x1cc2
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x13b1(%rip), %rdi      # 0x3004
movq %r14, %rsi
xorl %eax, %eax
callq 0x10e0
xorl %r14d, %r14d
jmp 0x1c65
movq %r12, %r14
leaq 0x1398(%rip), %rdi      # 0x3004
movq %r14, %rsi
xorl %eax, %eax
callq 0x10e0
xorl %esi, %esi
leaq 0x1385(%rip), %rdi      # 0x3004
xorl %eax, %eax
callq 0x10e0
jmp 0x1cae
jmp 0x1cae
movq %rax, %rbx
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x1cb1
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x10c0
jmp 0x1cb1
jmp 0x1cae
jmp 0x1cae
jmp 0x1cae
jmp 0x1cae
jmp 0x1cae
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x1cc2
movq %rbx, %rdi
callq 0x1120