// File: robertomaldonado[P]HypercubeTopologyRouting/transformations.cpp
// Function: int_to_bin_vector(int, int)
std::vector<bool> int_to_bin_vector(int bit_size, int node){

    int tmp_count = 0;
    std::vector<bool> node_bits;
    std::string output_str = "";
    // output_str += std::to_string(node) + "(";
    //Keep adding the bits based on the parity of bits
    while(node != 0){
        if( (node % 2) == 0 ){
            node_bits.push_back(0); node = floor(node/2);
        }else{
            node_bits.push_back(1); node = floor(node/2);
        }
    }
    //Push into the vector of node_bits
    tmp_count = node_bits.size();
    while(  tmp_count < bit_size ){
        node_bits.push_back(0);
        tmp_count++;
    }
    //Add the bits to the output string
    for(int i = node_bits.size()-1; i >= 0; i--)
        output_str += std::to_string(node_bits[i]);

    return node_bits;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x98(%rbp)
movq %rdi, %rax
movq %rax, -0x90(%rbp)
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movl %edx, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movb $0x0, -0x15(%rbp)
callq 0x9120
leaq -0x39(%rbp), %rdi
movq %rdi, -0x88(%rbp)
callq 0x22a0
movq -0x88(%rbp), %rdx
leaq 0x228f(%rip), %rsi      # 0xb0c3
leaq -0x38(%rbp), %rdi
callq 0x2200
jmp 0x8e3f
leaq -0x39(%rbp), %rdi
callq 0x21e0
cmpl $0x0, -0x10(%rbp)
je 0x8f0b
movl -0x10(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x8ec9
movq -0x98(%rbp), %rdi
xorl %esi, %esi
callq 0x92b0
jmp 0x8e72
movl -0x10(%rbp), %edi
movl %edi, %eax
shrl $0x1f, %eax
addl %eax, %edi
sarl %edi
callq 0x9380
movsd %xmm0, -0xa0(%rbp)
jmp 0x8e8d
movsd -0xa0(%rbp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x10(%rbp)
jmp 0x8f06
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x39(%rbp), %rdi
callq 0x21e0
jmp 0x901d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x8ff6
movq -0x98(%rbp), %rdi
movl $0x1, %esi
callq 0x92b0
jmp 0x8edc
movl -0x10(%rbp), %edi
movl %edi, %eax
shrl $0x1f, %eax
addl %eax, %edi
sarl %edi
callq 0x9380
movsd %xmm0, -0xa8(%rbp)
jmp 0x8ef7
movsd -0xa8(%rbp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, -0x10(%rbp)
jmp 0x8e48
movq -0x98(%rbp), %rdi
callq 0x3ac0
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x8f3d
movq -0x98(%rbp), %rdi
xorl %esi, %esi
callq 0x92b0
jmp 0x8f32
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x8f1a
movq -0x98(%rbp), %rdi
callq 0x3ac0
subq $0x1, %rax
movl %eax, -0x50(%rbp)
cmpl $0x0, -0x50(%rbp)
jl 0x8fe1
movq -0x98(%rbp), %rdi
movslq -0x50(%rbp), %rsi
callq 0x3b40
movq %rdx, -0xb8(%rbp)
movq %rax, -0xb0(%rbp)
jmp 0x8f7a
movq -0xb8(%rbp), %rax
movq -0xb0(%rbp), %rcx
movq %rcx, -0x80(%rbp)
movq %rax, -0x78(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x3ba0
movzbl %al, %esi
leaq -0x70(%rbp), %rdi
callq 0x9190
jmp 0x8fa7
leaq -0x38(%rbp), %rdi
leaq -0x70(%rbp), %rsi
callq 0x21f0
jmp 0x8fb6
leaq -0x70(%rbp), %rdi
callq 0x2120
movl -0x50(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x8f50
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x2120
jmp 0x8ff6
movb $0x1, -0x15(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x2120
testb $0x1, -0x15(%rbp)
jne 0x900d
jmp 0x9001
leaq -0x38(%rbp), %rdi
callq 0x2120
jmp 0x901d
movq -0x98(%rbp), %rdi
callq 0x3db0
movq -0x90(%rbp), %rax
addq $0xc0, %rsp
popq %rbp
retq
movq -0x98(%rbp), %rdi
callq 0x3db0
movq -0x48(%rbp), %rdi
callq 0x2290
nopw %cs:(%rax,%rax)
nopl (%rax)