// File: Eshaancoding[P]AutoDiff/src/Variable/eval.cpp
// Function: Variable::find_unique_id(std::vector<int, std::allocator<int>>*, std::vector<int, std::allocator<int>>*)
void Variable::find_unique_id (vector<int> *ID_ARRAY, vector<int> *input_map) {
    if (this->child[0] != NULL && child[1] != NULL) {
        if (this->child[1] != NULL) {
            this->child[0]->find_unique_id(ID_ARRAY, input_map);
            this->child[1]->find_unique_id(ID_ARRAY, input_map);
        } else {
            this->child[0]->find_unique_id(ID_ARRAY, input_map);
        }
    } else {
        if (this->operation == op::input) {
            // ID_ARRAY
            bool found = false;
            for (auto i : *ID_ARRAY) {
                if (i == this->id) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                ID_ARRAY->push_back(this->id);   
            }
            // input-map
            found = false;
            for (auto i : *input_map) {
                if (i == this->id) {
                    found = true;
                    break;
                }
            }
            if (!found) {
                input_map->push_back(this->id);
            }
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
cmpq $0x0, 0x10(%rax)
je 0x51cf
movq -0x68(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x51cf
movq -0x68(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x51b5
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x5150
movq -0x68(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x5150
jmp 0x51ca
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x5150
jmp 0x52db
movq -0x68(%rbp), %rax
cmpl $0x0, 0x8(%rax)
jne 0x52d9
movb $0x0, -0x19(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
callq 0x5390
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rdi
callq 0x53c0
movq %rax, -0x38(%rbp)
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x53f0
testb $0x1, %al
jne 0x5216
jmp 0x5243
leaq -0x30(%rbp), %rdi
callq 0x5430
movq -0x68(%rbp), %rcx
movl (%rax), %eax
movl %eax, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
cmpl 0x20(%rcx), %eax
jne 0x5236
movb $0x1, -0x19(%rbp)
jmp 0x5243
jmp 0x5238
leaq -0x30(%rbp), %rdi
callq 0x5450
jmp 0x5203
testb $0x1, -0x19(%rbp)
jne 0x525a
movq -0x68(%rbp), %rsi
movq -0x10(%rbp), %rdi
addq $0x20, %rsi
callq 0x5470
movb $0x0, -0x19(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
callq 0x5390
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rdi
callq 0x53c0
movq %rax, -0x58(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x53f0
testb $0x1, %al
jne 0x5293
jmp 0x52c0
leaq -0x50(%rbp), %rdi
callq 0x5430
movq -0x68(%rbp), %rcx
movl (%rax), %eax
movl %eax, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl 0x20(%rcx), %eax
jne 0x52b3
movb $0x1, -0x19(%rbp)
jmp 0x52c0
jmp 0x52b5
leaq -0x50(%rbp), %rdi
callq 0x5450
jmp 0x5280
testb $0x1, -0x19(%rbp)
jne 0x52d7
movq -0x68(%rbp), %rsi
movq -0x18(%rbp), %rdi
addq $0x20, %rsi
callq 0x5470
jmp 0x52d9
jmp 0x52db
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)