// File: buildsi[P]ldaudit-yaml/auditlib.cpp
// Function: la_objopen
unsigned int la_objopen(struct link_map *map, Lmid_t lmid, uintptr_t *cookie) {
 
  std::string flagName;
  std::string linkType;
  switch(lmid) {
    case LM_ID_BASE:
      flagName = "LM_ID_BASE";
      linkType = "Link map is part of the initial namespace";
      break;
    case LM_ID_NEWLM:
      flagName = "LM_ID_NEWLM";
      linkType = "Link map is part of a new namespace requested via dlmopen(3).";
      break;
    default:
      flagName = "???";
      linkType = "Unknown";
  }

  std::stringstream ss;
  ss << cookie;
   
  std::string output = "  - event: object_loaded\n    name: \"" + std::string(map->l_name) + "\"\n    function: la_objopen\n    identifier: " + ss.str() + "\n    flag: " + flagName + "\n    description: " + linkType +"\n";
  doPrint(output);
  return LA_FLG_BINDTO | LA_FLG_BINDFROM;
}

// Assembly:
subq $0x378, %rsp            # imm = 0x378
movq %rdi, 0x370(%rsp)
movq %rsi, 0x368(%rsp)
movq %rdx, 0x360(%rsp)
leaq 0x340(%rsp), %rdi
callq 0x3310
leaq 0x320(%rsp), %rdi
callq 0x3310
movq 0x368(%rsp), %rax
movq %rax, 0x18(%rsp)
subq $-0x1, %rax
je 0x4661
jmp 0x460e
movq 0x18(%rsp), %rax
testq %rax, %rax
jne 0x468f
jmp 0x461a
leaq 0x2e09(%rip), %rsi      # 0x742a
leaq 0x340(%rsp), %rdi
callq 0x3300
jmp 0x4630
leaq 0x2dfe(%rip), %rsi      # 0x7435
leaq 0x320(%rsp), %rdi
callq 0x3300
jmp 0x4646
jmp 0x46bd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x318(%rsp)
movl %eax, 0x314(%rsp)
jmp 0x4acc
leaq 0x2df7(%rip), %rsi      # 0x745f
leaq 0x340(%rsp), %rdi
callq 0x3300
jmp 0x4677
leaq 0x2ded(%rip), %rsi      # 0x746b
leaq 0x320(%rsp), %rdi
callq 0x3300
jmp 0x468d
jmp 0x46bd
leaq 0x2d26(%rip), %rsi      # 0x73bc
leaq 0x340(%rsp), %rdi
callq 0x3300
jmp 0x46a5
leaq 0x2dfd(%rip), %rsi      # 0x74a9
leaq 0x320(%rsp), %rdi
callq 0x3300
jmp 0x46bb
jmp 0x46bd
leaq 0x188(%rsp), %rdi
callq 0x3160
jmp 0x46cc
leaq 0x198(%rsp), %rdi
movq 0x360(%rsp), %rsi
callq 0x31b0
jmp 0x46e3
movq 0x370(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
leaq 0x67(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x3420
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
leaq 0x68(%rsp), %rdi
callq 0x33f0
jmp 0x4719
leaq 0x2d91(%rip), %rsi      # 0x74b1
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %rdx
callq 0x33e0
jmp 0x4734
leaq 0x2d9b(%rip), %rdx      # 0x74d6
leaq 0xa8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x3090
jmp 0x4752
leaq 0x40(%rsp), %rdi
leaq 0x188(%rsp), %rsi
callq 0x3220
jmp 0x4766
leaq 0xc8(%rsp), %rdi
leaq 0xa8(%rsp), %rsi
leaq 0x40(%rsp), %rdx
callq 0x31e0
jmp 0x4782
leaq 0x2c82(%rip), %rdx      # 0x740b
leaq 0xe8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x3090
jmp 0x47a0
leaq 0x108(%rsp), %rdi
leaq 0xe8(%rsp), %rsi
leaq 0x340(%rsp), %rdx
callq 0x3380
jmp 0x47bf
leaq 0x2c51(%rip), %rdx      # 0x7417
leaq 0x128(%rsp), %rdi
leaq 0x108(%rsp), %rsi
callq 0x3090
jmp 0x47dd
leaq 0x148(%rsp), %rdi
leaq 0x128(%rsp), %rsi
leaq 0x320(%rsp), %rdx
callq 0x3380
jmp 0x47fc
leaq 0x2ad7(%rip), %rdx      # 0x72da
leaq 0x168(%rsp), %rdi
leaq 0x148(%rsp), %rsi
callq 0x3090
jmp 0x481a
leaq 0x148(%rsp), %rdi
callq 0x3130
leaq 0x128(%rsp), %rdi
callq 0x3130
leaq 0x108(%rsp), %rdi
callq 0x3130
leaq 0xe8(%rsp), %rdi
callq 0x3130
leaq 0xc8(%rsp), %rdi
callq 0x3130
leaq 0x40(%rsp), %rdi
callq 0x3130
leaq 0xa8(%rsp), %rdi
callq 0x3130
leaq 0x88(%rsp), %rdi
callq 0x3130
leaq 0x68(%rsp), %rdi
callq 0x3130
leaq 0x67(%rsp), %rdi
callq 0x3260
leaq 0x20(%rsp), %rdi
leaq 0x168(%rsp), %rsi
callq 0x30f0
jmp 0x48a7
leaq 0x20(%rsp), %rdi
callq 0x38f0
jmp 0x48b3
leaq 0x20(%rsp), %rdi
callq 0x3130
leaq 0x168(%rsp), %rdi
callq 0x3130
leaq 0x188(%rsp), %rdi
callq 0x31a0
leaq 0x320(%rsp), %rdi
callq 0x3130
leaq 0x340(%rsp), %rdi
callq 0x3130
movl $0x3, %eax
addq $0x378, %rsp            # imm = 0x378
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x318(%rsp)
movl %eax, 0x314(%rsp)
jmp 0x4abf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x318(%rsp)
movl %eax, 0x314(%rsp)
jmp 0x4a72
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x318(%rsp)
movl %eax, 0x314(%rsp)
jmp 0x4a68
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x318(%rsp)
movl %eax, 0x314(%rsp)
jmp 0x4a5b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x318(%rsp)
movl %eax, 0x314(%rsp)
jmp 0x4a4e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x318(%rsp)
movl %eax, 0x314(%rsp)
jmp 0x4a44
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x318(%rsp)
movl %eax, 0x314(%rsp)
jmp 0x4a37
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x318(%rsp)
movl %eax, 0x314(%rsp)
jmp 0x4a2a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x318(%rsp)
movl %eax, 0x314(%rsp)
jmp 0x4a1d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x318(%rsp)
movl %eax, 0x314(%rsp)
jmp 0x4a10
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x318(%rsp)
movl %eax, 0x314(%rsp)
leaq 0x148(%rsp), %rdi
callq 0x3130
leaq 0x128(%rsp), %rdi
callq 0x3130
leaq 0x108(%rsp), %rdi
callq 0x3130
leaq 0xe8(%rsp), %rdi
callq 0x3130
leaq 0xc8(%rsp), %rdi
callq 0x3130
leaq 0x40(%rsp), %rdi
callq 0x3130
leaq 0xa8(%rsp), %rdi
callq 0x3130
leaq 0x88(%rsp), %rdi
callq 0x3130
leaq 0x68(%rsp), %rdi
callq 0x3130
leaq 0x67(%rsp), %rdi
callq 0x3260
jmp 0x4abf
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x318(%rsp)
movl %eax, 0x314(%rsp)
jmp 0x4ab2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x318(%rsp)
movl %eax, 0x314(%rsp)
leaq 0x20(%rsp), %rdi
callq 0x3130
leaq 0x168(%rsp), %rdi
callq 0x3130
leaq 0x188(%rsp), %rdi
callq 0x31a0
leaq 0x320(%rsp), %rdi
callq 0x3130
leaq 0x340(%rsp), %rdi
callq 0x3130
movq 0x318(%rsp), %rdi
callq 0x3410
nopw %cs:(%rax,%rax)