// File: /workspace/github_cpp_makefile_star2_O2/buildsi[P]ldaudit-yaml/auditlib.cpp
// Function: la_objsearch
char * la_objsearch(const char *name, uintptr_t *cookie, unsigned int flag) {

  // Derive a human friendly flag name
  std::string flagName;
  std::string desc;
  switch(flag) {
    case LA_SER_ORIG:
      desc = "This is the original name that is being searched for (ELF NEEDED or filename)";
      flagName = "LA_SER_ORIG";
      break;
    case LA_SER_LIBPATH:
      flagName = "LA_SER_LIBPATH";
      desc = "name was created using a directory specified in LD_LIBRARY_PATH";
      break;
    case LA_SER_RUNPATH:
      flagName = "LA_SER_RUNPATH";
      desc = "name was created using a directory specified in an ELF DT_RPATH or DT_RUNPATH list.";
      break;
    case LA_SER_DEFAULT:
      flagName = "LA_SER_DEFAULT";
      desc = "name was found via a search of one of the default directories.";
      break;
    case LA_SER_CONFIG:
      flagName = "LA_SER_CONFIG";
      desc = "name was found via the ldconfig(8) cache (/etc/ld.so.cache).";
      break;
    case LA_SER_SECURE:
      desc = "name is specific to a secure object (unused on Linux).";
      flagName = "LA_SER_SECURE";
  }
  
  std::stringstream ss;
  ss << cookie;
   
  std::string output = "  - event: searching_for\n    function: la_objsearch\n    name: \"" + std::string(name) + "\"\n";
  output += "    initiated_by: " + ss.str() + "\n    flag: \"" + flagName + "\"\n    description: \"" + desc + "\"\n";
  doPrint(output);

  return (char*)name;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x2f0, %rsp            # imm = 0x2F0
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rsi, %r14
movq %rdi, %rbx
xorl %ecx, %ecx
leaq 0x78(%rsp), %rsi
movq %rsi, -0x10(%rsi)
andq $0x0, -0x8(%rsi)
movb %cl, (%rax)
movb %cl, (%rsi)
leal -0x1(%rdx), %eax
cmpl $0x7, %eax
ja 0x27fb
leaq 0x1835(%rip), %rcx      # 0x4000
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
leaq 0x68(%rsp), %r15
jmpq *%rax
leaq 0x18ef(%rip), %rsi      # 0x40cf
leaq 0x68(%rsp), %rdi
callq 0x22a0
leaq 0x8(%rsp), %r15
leaq 0x1927(%rip), %rsi      # 0x411d
jmp 0x2896
cmpl $0x40, %edx
je 0x2879
cmpl $0x80, %edx
jne 0x289e
leaq 0x1a61(%rip), %rsi      # 0x4274
leaq 0x68(%rsp), %rdi
callq 0x22a0
leaq 0x1a87(%rip), %rsi      # 0x42ab
leaq 0x8(%rsp), %r15
jmp 0x2896
leaq 0x19f7(%rip), %rsi      # 0x4229
leaq 0x8(%rsp), %rdi
callq 0x22a0
leaq 0x19f4(%rip), %rsi      # 0x4237
jmp 0x2896
leaq 0x18dd(%rip), %rsi      # 0x4129
leaq 0x8(%rsp), %rdi
callq 0x22a0
leaq 0x18db(%rip), %rsi      # 0x4138
jmp 0x2896
leaq 0x1912(%rip), %rsi      # 0x4178
leaq 0x8(%rsp), %rdi
callq 0x22a0
leaq 0x1910(%rip), %rsi      # 0x4187
jmp 0x2896
leaq 0x195b(%rip), %rsi      # 0x41db
leaq 0x8(%rsp), %rdi
callq 0x22a0
leaq 0x1959(%rip), %rsi      # 0x41ea
leaq 0x68(%rsp), %r15
movq %r15, %rdi
callq 0x22a0
leaq 0x168(%rsp), %rdi
callq 0x20b0
leaq 0x178(%rsp), %rdi
movq %r14, %rsi
callq 0x20e0
leaq 0x28(%rsp), %rdi
leaq 0x88(%rsp), %rdx
movq %rbx, %rsi
callq 0x2250
leaq 0x19e2(%rip), %rsi      # 0x42b9
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rdx
callq 0x2240
leaq 0x1a0c(%rip), %rdx      # 0x42f9
leaq 0xa8(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x2050
leaq 0x48(%rsp), %rdi
callq 0x20a0
leaq 0x28(%rsp), %rdi
callq 0x20a0
leaq 0x180(%rsp), %rsi
leaq 0xe8(%rsp), %rdi
callq 0x2220
leaq 0x178d(%rip), %rsi      # 0x40bc
leaq 0x108(%rsp), %rdi
leaq 0xe8(%rsp), %rdx
callq 0x2240
leaq 0x19b1(%rip), %rdx      # 0x42fc
leaq 0x128(%rsp), %rdi
leaq 0x108(%rsp), %rsi
callq 0x2050
leaq 0x148(%rsp), %rdi
leaq 0x128(%rsp), %rsi
leaq 0x8(%rsp), %rdx
callq 0x21e0
leaq 0x1988(%rip), %rdx      # 0x4309
leaq 0x88(%rsp), %rdi
leaq 0x148(%rsp), %rsi
callq 0x2050
leaq 0x28(%rsp), %rdi
leaq 0x88(%rsp), %rsi
leaq 0x68(%rsp), %rdx
callq 0x21e0
leaq 0x1945(%rip), %rdx      # 0x42f9
leaq 0x48(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x2050
leaq 0xa8(%rsp), %rdi
leaq 0x48(%rsp), %rsi
callq 0x22b0
leaq 0x48(%rsp), %rdi
callq 0x20a0
leaq 0x28(%rsp), %rdi
callq 0x20a0
leaq 0x88(%rsp), %rdi
callq 0x20a0
leaq 0x148(%rsp), %rdi
callq 0x20a0
leaq 0x128(%rsp), %rdi
callq 0x20a0
leaq 0x108(%rsp), %rdi
callq 0x20a0
leaq 0xe8(%rsp), %rdi
callq 0x20a0
leaq 0xc8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
callq 0x21a0
leaq 0xc8(%rsp), %rdi
callq 0x25c5
leaq 0xc8(%rsp), %rdi
callq 0x20a0
leaq 0xa8(%rsp), %rdi
callq 0x20a0
leaq 0x168(%rsp), %rdi
callq 0x20d0
leaq 0x68(%rsp), %rdi
callq 0x20a0
leaq 0x8(%rsp), %rdi
callq 0x20a0
movq %rbx, %rax
addq $0x2f0, %rsp            # imm = 0x2F0
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
jmp 0x2b0d
jmp 0x2b1e
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x20a0
jmp 0x2ab8
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x20a0
jmp 0x2ac7
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x20a0
jmp 0x2ad9
movq %rax, %rbx
leaq 0x148(%rsp), %rdi
callq 0x20a0
jmp 0x2aeb
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
callq 0x20a0
leaq 0x108(%rsp), %rdi
callq 0x20a0
leaq 0xe8(%rsp), %rdi
callq 0x20a0
jmp 0x2b21
movq %rax, %rbx
jmp 0x2af8
movq %rax, %rbx
jmp 0x2b05
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x20a0
leaq 0x168(%rsp), %rdi
callq 0x20d0
leaq 0x68(%rsp), %rdi
callq 0x20a0
leaq 0x8(%rsp), %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x2270
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x20a0
jmp 0x2b69
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
jmp 0x2b29
jmp 0x2b72
movq %rax, %rbx
jmp 0x2b2e
jmp 0x2b79
movq %rax, %rbx
jmp 0x2b3b