// File: /workspace/github_cpp_makefile_star2_O3/lorenatoscano[P]musify/src/linkedList.cpp
// Function: LinkedList::search(Song)
node* LinkedList::search(Song searchSong) {
  node* temp = head;

  while (temp != nullptr) {
    Song s = temp->data;

    // Compara os títulos e artistas desconsiderando maiúsculas
    if ( toLowercase(s.getTitle()) == toLowercase(searchSong.getTitle()) && 
        toLowercase(s.getArtist()) == toLowercase(searchSong.getArtist()) ) {
      // Retorna o ponteiro para o nó correspondente
      return temp; 
    }

    temp = temp->next;
  }
  // Caso não encontre, retorna nullptr
  return nullptr;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq (%rdi), %rbx
testq %rbx, %rbx
je 0x2c33
movq %rsi, %r14
leaq -0x78(%rbp), %r13
leaq -0x168(%rbp), %r12
leaq -0x88(%rbp), %r15
leaq -0x158(%rbp), %rax
movq %rax, -0x168(%rbp)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
movq %r12, %rdi
callq 0x377e
leaq -0x138(%rbp), %rax
movq %rax, -0x148(%rbp)
movq 0x20(%rbx), %rsi
movq 0x28(%rbx), %rdx
addq %rsi, %rdx
leaq -0x148(%rbp), %rdi
callq 0x377e
movq %r15, %rdi
movq %r12, %rsi
callq 0x99bc
leaq -0xa8(%rbp), %rdi
movq %r15, %rsi
callq 0x9a30
leaq -0x128(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x99bc
leaq -0x68(%rbp), %rdi
movq %r15, %rsi
callq 0x9a30
movq -0xa0(%rbp), %rdx
cmpq -0x60(%rbp), %rdx
jne 0x2ae2
testq %rdx, %rdx
je 0x2aea
movq -0x68(%rbp), %rsi
movq -0xa8(%rbp), %rdi
callq 0x2110
testl %eax, %eax
je 0x2aea
xorl %r15d, %r15d
jmp 0x2bbf
leaq -0x108(%rbp), %r15
movq %r15, %rdi
movq %r12, %rsi
callq 0x99e8
leaq -0x48(%rbp), %rdi
movq %r15, %rsi
callq 0x9a30
leaq -0xc8(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x99e8
leaq -0xe8(%rbp), %rdi
movq %r15, %rsi
callq 0x9a30
movq -0x40(%rbp), %rdx
cmpq -0xe0(%rbp), %rdx
jne 0x2b56
movq -0xe8(%rbp), %r13
testq %rdx, %rdx
je 0x2b62
movq -0x48(%rbp), %rdi
movq %r13, %rsi
callq 0x2110
testl %eax, %eax
sete %r15b
jmp 0x2b65
movq -0xe8(%rbp), %r13
xorl %r15d, %r15d
jmp 0x2b65
movb $0x1, %r15b
leaq -0xd8(%rbp), %rax
cmpq %rax, %r13
je 0x2b79
movq %r13, %rdi
callq 0x20e0
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x2b91
callq 0x20e0
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
leaq -0x78(%rbp), %r13
je 0x2ba7
callq 0x20e0
movq -0x108(%rbp), %rdi
leaq -0xf8(%rbp), %rax
cmpq %rax, %rdi
je 0x2bbf
callq 0x20e0
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x2bd1
callq 0x20e0
movq -0x128(%rbp), %rdi
leaq -0x118(%rbp), %rax
cmpq %rax, %rdi
je 0x2be9
callq 0x20e0
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x2c01
callq 0x20e0
movq -0x88(%rbp), %rdi
cmpq %r13, %rdi
je 0x2c12
callq 0x20e0
testb %r15b, %r15b
jne 0x2c37
movq 0x40(%rbx), %rbx
movq %r12, %rdi
callq 0x9986
testq %rbx, %rbx
leaq -0x88(%rbp), %r15
jne 0x2a3f
xorl %ebx, %ebx
jmp 0x2c43
leaq -0x168(%rbp), %rdi
callq 0x9986
movq %rbx, %rax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0xc8(%rbp), %rdi
leaq -0xb8(%rbp), %rax
cmpq %rax, %rdi
je 0x2c78
callq 0x20e0
jmp 0x2c78
movq %rax, %rbx
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x2c8f
callq 0x20e0
jmp 0x2c8f
movq %rax, %rbx
movq -0x108(%rbp), %rdi
leaq -0xf8(%rbp), %rax
cmpq %rax, %rdi
je 0x2cac
callq 0x20e0
jmp 0x2cac
movq %rax, %rbx
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x2cc3
callq 0x20e0
jmp 0x2cc3
movq %rax, %rbx
movq -0x128(%rbp), %rdi
leaq -0x118(%rbp), %rax
cmpq %rax, %rdi
je 0x2d02
callq 0x20e0
jmp 0x2d02
movq %rax, %rbx
jmp 0x2d1a
movq %rax, %rbx
movq -0x168(%rbp), %rdi
leaq -0x158(%rbp), %rax
cmpq %rax, %rdi
je 0x2d40
callq 0x20e0
jmp 0x2d40
movq %rax, %rbx
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x2d1a
callq 0x20e0
movq -0x88(%rbp), %rdi
leaq -0x78(%rbp), %rax
cmpq %rax, %rdi
je 0x2d34
callq 0x20e0
jmp 0x2d34
movq %rax, %rbx
leaq -0x168(%rbp), %rdi
callq 0x9986
movq %rbx, %rdi
callq 0x2170