// File: xukmin[P]rase/sensor-network.cc
// Function: SensorNetwork::IsConnectedWithChannels() const
bool SensorNetwork::IsConnectedWithChannels() const {
  assert(num_sensors() > 0);

  std::vector<bool> visited(num_sensors());
  int num_visited = 0;

  std::queue<int> queue;
  queue.push(0);  // Start from the base station.
  while (!queue.empty()) {
    int current = queue.front();
    queue.pop();
    const std::set<int>& neighbors = GetNeighbors(current);
    for (std::set<int>::const_iterator neighbor = neighbors.begin();
         neighbor != neighbors.end();
         ++neighbor) {
      if (!visited[*neighbor]) {
        queue.push(*neighbor);
        visited[*neighbor] = true;
        num_visited++;
      }
    }
  }

  return num_visited == num_sensors();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x140, %rsp            # imm = 0x140
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x87a0
cmpl $0x0, %eax
jle 0x7716
jmp 0x7735
leaq 0xcc1a(%rip), %rdi      # 0x14337
leaq 0xcadf(%rip), %rsi      # 0x14203
movl $0xa9, %edx
leaq 0xcc19(%rip), %rcx      # 0x14349
callq 0x3130
movq -0xe0(%rbp), %rdi
callq 0x87a0
cltq
movq %rax, -0xf0(%rbp)
leaq -0x31(%rbp), %rdi
movq %rdi, -0xe8(%rbp)
callq 0x87c0
movq -0xf0(%rbp), %rsi
movq -0xe8(%rbp), %rdx
leaq -0x30(%rbp), %rdi
callq 0x87e0
jmp 0x7773
leaq -0x31(%rbp), %rdi
callq 0x8820
movl $0x0, -0x48(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x8840
jmp 0x7791
movl $0x0, -0x9c(%rbp)
leaq -0x98(%rbp), %rdi
leaq -0x9c(%rbp), %rsi
callq 0x8870
jmp 0x77b0
jmp 0x77b2
leaq -0x98(%rbp), %rdi
callq 0x88a0
movb %al, -0xf1(%rbp)
jmp 0x77c6
movb -0xf1(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x77d7
jmp 0x79a9
leaq -0x98(%rbp), %rdi
callq 0x88c0
movq %rax, -0x100(%rbp)
jmp 0x77ec
movq -0x100(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xa0(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x88e0
jmp 0x7809
movq -0xe0(%rbp), %rdi
movl -0xa0(%rbp), %esi
callq 0x8900
movq %rax, -0x108(%rbp)
jmp 0x7824
movq -0x108(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x8480
movq %rax, -0xb0(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x84b0
movq %rax, -0xb8(%rbp)
leaq -0xb0(%rbp), %rdi
leaq -0xb8(%rbp), %rsi
callq 0x8930
testb $0x1, %al
jne 0x7874
jmp 0x79a4
leaq -0xb0(%rbp), %rdi
callq 0x89c0
movslq (%rax), %rsi
leaq -0x30(%rbp), %rdi
callq 0x8960
movq %rdx, -0x118(%rbp)
movq %rax, -0x110(%rbp)
jmp 0x789c
movq -0x118(%rbp), %rax
movq -0x110(%rbp), %rcx
movq %rcx, -0xc8(%rbp)
movq %rax, -0xc0(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x89e0
xorb $-0x1, %al
testb $0x1, %al
jne 0x78cf
jmp 0x7991
leaq -0xb0(%rbp), %rdi
callq 0x89c0
movq %rax, %rsi
leaq -0x98(%rbp), %rdi
callq 0x8a10
jmp 0x78ec
leaq -0xb0(%rbp), %rdi
callq 0x89c0
movslq (%rax), %rsi
leaq -0x30(%rbp), %rdi
callq 0x8960
movq %rdx, -0x128(%rbp)
movq %rax, -0x120(%rbp)
jmp 0x7914
movq -0x128(%rbp), %rax
movq -0x120(%rbp), %rcx
movq %rcx, -0xd8(%rbp)
movq %rax, -0xd0(%rbp)
leaq -0xd8(%rbp), %rdi
movl $0x1, %esi
callq 0x8a40
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x7991
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x31(%rbp), %rdi
callq 0x8820
jmp 0x7a0c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
jmp 0x7a03
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x40(%rbp)
movl %eax, -0x44(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x8ac0
jmp 0x7a03
jmp 0x7993
leaq -0xb0(%rbp), %rdi
callq 0x8a90
jmp 0x7845
jmp 0x77b2
movq -0xe0(%rbp), %rdi
movl -0x48(%rbp), %eax
movl %eax, -0x130(%rbp)
callq 0x87a0
movl %eax, -0x12c(%rbp)
jmp 0x79c6
movl -0x130(%rbp), %eax
movl -0x12c(%rbp), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x131(%rbp)
leaq -0x98(%rbp), %rdi
callq 0x8ac0
leaq -0x30(%rbp), %rdi
callq 0x8ae0
movb -0x131(%rbp), %al
andb $0x1, %al
addq $0x140, %rsp            # imm = 0x140
popq %rbp
retq
leaq -0x30(%rbp), %rdi
callq 0x8ae0
movq -0x40(%rbp), %rdi
callq 0x3340
nopw %cs:(%rax,%rax)