// File: /workspace/github_cpp_makefile_star2_O1/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 $0x158, %rsp            # imm = 0x158
movq %rsi, -0x38(%rbp)
movq (%rdi), %r13
leaq -0x178(%rbp), %r15
leaq -0xd8(%rbp), %r14
leaq -0xb8(%rbp), %r12
leaq -0x138(%rbp), %rbx
testq %r13, %r13
je 0x2c5d
leaq -0x168(%rbp), %rax
movq %rax, -0x178(%rbp)
movq (%r13), %rsi
movq 0x8(%r13), %rdx
addq %rsi, %rdx
movq %r15, %rdi
callq 0x37d8
leaq -0x148(%rbp), %rax
movq %rax, -0x158(%rbp)
movq 0x20(%r13), %rsi
movq 0x28(%r13), %rdx
addq %rsi, %rdx
leaq -0x158(%rbp), %rdi
callq 0x37d8
movq %r14, %rdi
movq %r15, %rsi
callq 0x99fc
leaq -0x98(%rbp), %rdi
movq %r14, %rsi
callq 0x9a70
movq %r12, %rdi
movq -0x38(%rbp), %rsi
callq 0x99fc
leaq -0x78(%rbp), %rdi
movq %r12, %rsi
callq 0x9a70
movq -0x90(%rbp), %rdx
cmpq -0x70(%rbp), %rdx
jne 0x2af2
testq %rdx, %rdx
je 0x2af7
movq -0x78(%rbp), %rsi
movq -0x98(%rbp), %rdi
callq 0x2110
testl %eax, %eax
sete %r14b
jmp 0x2afa
xorl %r14d, %r14d
jmp 0x2afa
movb $0x1, %r14b
testb %r14b, %r14b
je 0x2b69
movq %rbx, %r12
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9a28
leaq -0x58(%rbp), %rdi
movq %r12, %rsi
callq 0x9a70
leaq -0xf8(%rbp), %r12
movq %r12, %rdi
movq -0x38(%rbp), %rsi
callq 0x9a28
leaq -0x118(%rbp), %rdi
movq %r12, %rsi
callq 0x9a70
movq -0x50(%rbp), %rdx
cmpq -0x110(%rbp), %rdx
jne 0x2b69
testq %rdx, %rdx
je 0x2c55
movq -0x118(%rbp), %rsi
movq -0x58(%rbp), %rdi
callq 0x2110
testl %eax, %eax
sete %r12b
jmp 0x2b6c
xorl %r12d, %r12d
testb %r14b, %r14b
je 0x2bcb
movq -0x118(%rbp), %rdi
leaq -0x108(%rbp), %rax
cmpq %rax, %rdi
je 0x2b89
callq 0x20e0
movq -0xf8(%rbp), %rdi
leaq -0xe8(%rbp), %rax
cmpq %rax, %rdi
je 0x2ba1
callq 0x20e0
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x2bb3
callq 0x20e0
movq -0x138(%rbp), %rdi
leaq -0x128(%rbp), %rax
cmpq %rax, %rdi
je 0x2bcb
callq 0x20e0
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x2bdd
callq 0x20e0
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0x2bf5
callq 0x20e0
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x2c0d
callq 0x20e0
movq -0xd8(%rbp), %rdi
leaq -0xc8(%rbp), %rax
cmpq %rax, %rdi
je 0x2c25
callq 0x20e0
testb %r12b, %r12b
je 0x2c30
movq %r13, -0x30(%rbp)
jmp 0x2c34
movq 0x40(%r13), %r13
movq %r15, %rdi
callq 0x99c6
testb %r12b, %r12b
leaq -0xd8(%rbp), %r14
leaq -0xb8(%rbp), %r12
je 0x2a47
jmp 0x2c65
movb $0x1, %r12b
jmp 0x2b6c
movq $0x0, -0x30(%rbp)
movq -0x30(%rbp), %rax
addq $0x158, %rsp            # imm = 0x158
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0xf8(%rbp), %rdi
leaq -0xe8(%rbp), %rax
cmpq %rax, %rdi
je 0x2c9b
callq 0x20e0
jmp 0x2c9b
movq %rax, %rbx
movq -0x58(%rbp), %rdi
leaq -0x48(%rbp), %rax
cmpq %rax, %rdi
je 0x2cb2
callq 0x20e0
jmp 0x2cb2
movq %rax, %rbx
movq -0x138(%rbp), %rdi
leaq -0x128(%rbp), %rax
cmpq %rax, %rdi
je 0x2ccf
callq 0x20e0
jmp 0x2ccf
movq %rax, %rbx
movq -0x78(%rbp), %rdi
leaq -0x68(%rbp), %rax
cmpq %rax, %rdi
je 0x2d12
callq 0x20e0
jmp 0x2d12
movq %rax, %rbx
jmp 0x2d5a
movq %rax, %rbx
jmp 0x2d2a
movq %rax, %rbx
movq -0x178(%rbp), %rdi
leaq -0x168(%rbp), %rax
cmpq %rax, %rdi
je 0x2d66
callq 0x20e0
jmp 0x2d66
movq %rax, %rbx
jmp 0x2d42
movq %rax, %rbx
movq -0xb8(%rbp), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0x2d2a
callq 0x20e0
movq -0x98(%rbp), %rdi
leaq -0x88(%rbp), %rax
cmpq %rax, %rdi
je 0x2d42
callq 0x20e0
movq -0xd8(%rbp), %rdi
leaq -0xc8(%rbp), %rax
cmpq %rax, %rdi
je 0x2d5a
callq 0x20e0
leaq -0x178(%rbp), %rdi
callq 0x99c6
movq %rbx, %rdi
callq 0x2170