// File: /workspace/github_c_makefile_star2_O0/ComplexNetworks-DCC-FCUP[P]gtrieScanner/GraphTree.cpp
// Function: GraphTreeNode::equal(GraphTreeNode*, int, char*)
bool GraphTreeNode::equal(GraphTreeNode *gt, int pos, char *s) {
  if (zero == NULL && gt->zero!=NULL) return false;
  if (zero != NULL && gt->zero==NULL) return false;
  if (one  == NULL && gt->one !=NULL) return false;
  if (one  != NULL && gt->one ==NULL) return false;

  if (zero == NULL && one == NULL) {
    s[pos]=0;
    if (frequency != gt->frequency) 
      printf("NOT EQUAL TREE %s: %d != %d\n", s, frequency, gt->frequency);
    return (frequency == gt->frequency);
  } else {
    bool fzero, fone;
    fzero = fone = true;
    if (zero != NULL) {
      s[pos]='0';
      fzero = zero->equal(gt->zero, pos+1, s);
    }
    if (one != NULL) {
      s[pos]='1';
      fone = one->equal(gt->one, pos+1, s);
    }
    return fzero && fone;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq %rcx, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, 0x8(%rax)
jne 0x1956a
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x1956a
movb $0x0, -0x1(%rbp)
jmp 0x196c5
movq -0x38(%rbp), %rax
cmpq $0x0, 0x8(%rax)
je 0x19589
movq -0x18(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x19589
movb $0x0, -0x1(%rbp)
jmp 0x196c5
movq -0x38(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x195a8
movq -0x18(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x195a8
movb $0x0, -0x1(%rbp)
jmp 0x196c5
movq -0x38(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x195c7
movq -0x18(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x195c7
movb $0x0, -0x1(%rbp)
jmp 0x196c5
movq -0x38(%rbp), %rax
cmpq $0x0, 0x8(%rax)
jne 0x1962e
movq -0x38(%rbp), %rax
cmpq $0x0, 0x10(%rax)
jne 0x1962e
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
movb $0x0, (%rcx,%rdx)
movl (%rax), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
je 0x19615
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rsi
movl (%rax), %edx
movq -0x18(%rbp), %rax
movl (%rax), %ecx
leaq 0x7682(%rip), %rdi      # 0x20c90
movb $0x0, %al
callq 0x3060
movq -0x38(%rbp), %rax
movl (%rax), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
sete %al
andb $0x1, %al
movb %al, -0x1(%rbp)
jmp 0x196c5
movq -0x38(%rbp), %rax
movb $0x1, -0x2a(%rbp)
movb $0x1, -0x29(%rbp)
cmpq $0x0, 0x8(%rax)
je 0x19671
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
movb $0x30, (%rcx,%rdx)
movq 0x8(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rsi
movl -0x1c(%rbp), %edx
addl $0x1, %edx
movq -0x28(%rbp), %rcx
callq 0x19530
andb $0x1, %al
movb %al, -0x29(%rbp)
movq -0x38(%rbp), %rax
cmpq $0x0, 0x10(%rax)
je 0x196ac
movq -0x38(%rbp), %rax
movq -0x28(%rbp), %rcx
movslq -0x1c(%rbp), %rdx
movb $0x31, (%rcx,%rdx)
movq 0x10(%rax), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
movl -0x1c(%rbp), %edx
addl $0x1, %edx
movq -0x28(%rbp), %rcx
callq 0x19530
andb $0x1, %al
movb %al, -0x2a(%rbp)
xorl %eax, %eax
testb $0x1, -0x29(%rbp)
movb %al, -0x39(%rbp)
je 0x196bd
movb -0x2a(%rbp), %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
andb $0x1, %al
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x40, %rsp
popq %rbp
retq