// File: /workspace/github_cpp_makefile_star2_O3/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 0x36e2(%rip), %rbx      # 0x4fd8
leaq 0x1783(%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 0x36b0(%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 0x1d06
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x196c
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 0x1c2d
leaq (%rax,%r13,8), %rdi
movq 0x8(%rdi), %rsi
cmpq 0x10(%rdi), %rsi
je 0x19cb
movl %r15d, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rdi)
jmp 0x19d4
leaq -0x60(%rbp), %rdx
callq 0x1f24
movl -0x60(%rbp), %esi
movq %rbx, %rdi
callq 0x1110
movl $0x1, %edx
movq %rax, %rdi
leaq 0x1699(%rip), %rsi      # 0x3087
callq 0x10d0
decl %r12d
jne 0x1986
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 0x193b
movq -0x40(%rbp), %rcx
movq -0x38(%rbp), %rax
movq %rax, %rdx
subq %rcx, %rdx
sarq $0x3, %rdx
imulq %r12, %rdx
cmpq %rcx, %rax
je 0x1c57
movq %rdx, %rax
shrq %rax
movslq %eax, %rsi
cmpq %rsi, %rdx
jbe 0x1c59
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 0x1c59
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 0x3517(%rip), %rbx      # 0x4fd8
movq %rbx, %rdi
callq 0x1030
movq %rax, %rdi
callq 0x1060
movq %rax, %r14
leaq 0x15ae(%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 -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
cmpq %rax, %rcx
je 0x1c13
leaq 0x1560(%rip), %r15      # 0x3087
xorl %r14d, %r14d
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
imulq %r12, %rdx
cmpq %rax, %rcx
je 0x1c3e
leaq (%r14,%r14,2), %r13
xorl %r12d, %r12d
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x2, %rcx
cmpq %r12, %rcx
jbe 0x1bc0
cmpq %r14, %rdx
jbe 0x1c46
movq (%rax,%r13,8), %rcx
movq 0x8(%rax,%r13,8), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %r12, %rdx
jbe 0x1c43
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 0x1b48
jmp 0x1c3e
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
movq -0x40(%rbp), %rax
movq -0x38(%rbp), %rcx
movq %rcx, %rdx
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x5555555555555555, %r12 # imm = 0xAAAAAAAAAAAAAAAB
imulq %r12, %rdx
cmpq %r14, %rdx
ja 0x1b2a
leaq -0x40(%rbp), %rdi
callq 0x1ca4
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x13d0(%rip), %rdi      # 0x3004
movq %r14, %rsi
xorl %eax, %eax
callq 0x10e0
xorl %r14d, %r14d
jmp 0x1c46
movq %r12, %r14
leaq 0x13b7(%rip), %rdi      # 0x3004
movq %r14, %rsi
xorl %eax, %eax
callq 0x10e0
xorl %esi, %esi
leaq 0x13a4(%rip), %rdi      # 0x3004
xorl %eax, %eax
callq 0x10e0
jmp 0x1c8f
jmp 0x1c8f
movq %rax, %rbx
movq -0x60(%rbp), %rdi
testq %rdi, %rdi
je 0x1c92
movq -0x50(%rbp), %rsi
subq %rdi, %rsi
callq 0x10c0
jmp 0x1c92
jmp 0x1c8f
jmp 0x1c8f
jmp 0x1c8f
jmp 0x1c8f
jmp 0x1c8f
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x1ca4
movq %rbx, %rdi
callq 0x1120
nop