LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/craigbarstow[P]cmd-line-text-editor/document.cc
// Function: text_ed::copy_to_document(int, int, int)
bool text_ed::copy_to_document(int start, int end, int location) { // Copy the entire buffer to the document starting at line start.
  int buff_capacity=end-start+1;
  int i,j;
  for (i=location+1,j=0; j<buff_capacity; i++,j++) {
    document[i]=buffer[j]; //copy buffer contents to document
  }
  delete [] buffer;
  buffer = NULL; //set buffer pointer to null so destructor function works properly
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
subl %esi, %edx
movslq %ecx, %r14
movslq %edx, %r15
shlq $0x5, %r14
addq $0x20, %r14
xorl %r12d, %r12d
xorl %r13d, %r13d
cmpq %r15, %r13
jg 0x4d24
movq 0x8(%rbx), %rsi
addq %r12, %rsi
movq (%rbx), %rdi
addq %r14, %rdi
addq %r12, %rdi
callq 0x2110
incq %r13
addq $0x20, %r12
jmp 0x4d01
movq 0x8(%rbx), %r12
testq %r12, %r12
je 0x4d69
leaq -0x8(%r12), %r14
movq -0x8(%r12), %r15
testq %r15, %r15
je 0x4d56
addq $-0x20, %r12
movq %r15, %r13
shlq $0x5, %r13
leaq (%r12,%r13), %rdi
callq 0x20d0
addq $-0x20, %r13
jne 0x4d47
shlq $0x5, %r15
orq $0x8, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x2290
andq $0x0, 0x8(%rbx)
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/craigbarstow[P]cmd-line-text-editor/document.cc
// Function: text_ed::open_up(int, int)
bool text_ed::open_up(int start, int num_lines) { // Create num_lines empty lines following start.
 int space_left;
 int i;
 space_left = capacity-last_line;
 while (space_left <=num_lines) {
   expand_document();
   space_left = capacity - last_line;
 }
 for (i=last_line; i>start; i--) {
   document[i+num_lines] = document[i];
 }
 last_line += num_lines;
 return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %r15d
movq %rdi, %r14
movl 0x18(%r14), %eax
movslq 0x10(%r14), %r12
subl %r12d, %eax
cmpl %ebx, %eax
jg 0x4daf
movq %r14, %rdi
callq 0x4df8
jmp 0x4d96
movslq %r15d, %r15
movl %ebx, -0x2c(%rbp)
movslq %ebx, %r13
shlq $0x5, %r13
movq %r12, %rbx
shlq $0x5, %rbx
cmpq %r15, %r12
jle 0x4de0
movq (%r14), %rsi
addq %rbx, %rsi
leaq (%rsi,%r13), %rdi
callq 0x2110
decq %r12
addq $-0x20, %rbx
jmp 0x4dc3
movl -0x2c(%rbp), %eax
addl %eax, 0x10(%r14)
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/craigbarstow[P]cmd-line-text-editor/document.cc
// Function: text_ed::expand_document()
void text_ed::expand_document() { // Add more lines to the document array, e.g., double capacity.
 int i;
 capacity *= 2; //double document capacity
   string* temp = new string[capacity+1];
   for (i=0; i<capacity/2; i++) { //copy contents of document into temp
     temp[i]=document[i];
   }
   delete [] document; //delete contents of original document
   document = temp; //set document equal to temp contents of temp
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x18(%rdi), %eax
leal (%rax,%rax), %r14d
movl %r14d, 0x18(%rdi)
leal 0x1(,%rax,2), %ecx
movslq %ecx, %r15
movq %r15, %rcx
shlq $0x5, %rcx
orq $0x8, %rcx
testl %eax, %eax
pushq $-0x1
popq %rdi
cmovnsq %rcx, %rdi
callq 0x2030
movq %r15, (%rax)
leaq 0x8(%rax), %rcx
movq %rcx, -0x30(%rbp)
addq $0x18, %rax
movslq %r14d, %rcx
shlq $0x5, %rcx
orq $0x20, %rcx
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
addq $0x20, %rax
addq $-0x20, %rcx
jne 0x4e51
xorl %r15d, %r15d
pushq $0x2
popq %r12
xorl %r13d, %r13d
movl %r14d, %eax
cltd
idivl %r12d
cltq
movq (%rbx), %r14
cmpq %rax, %r13
jge 0x4ea2
addq %r15, %r14
movq -0x30(%rbp), %rax
leaq (%rax,%r15), %rdi
movq %r14, %rsi
callq 0x2110
incq %r13
movl 0x18(%rbx), %r14d
addq $0x20, %r15
jmp 0x4e71
testq %r14, %r14
je 0x4ee1
leaq -0x8(%r14), %r15
movq -0x8(%r14), %r12
testq %r12, %r12
je 0x4ece
addq $-0x20, %r14
movq %r12, %r13
shlq $0x5, %r13
leaq (%r14,%r13), %rdi
callq 0x20d0
addq $-0x20, %r13
jne 0x4ebf
shlq $0x5, %r12
orq $0x8, %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x2290
movq -0x30(%rbp), %rax
movq %rax, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/craigbarstow[P]cmd-line-text-editor/document.cc
// Function: text_ed::text_ed()
text_ed::text_ed() { //constructor function
 capacity = DEFCAP;
 last_line = 0;
 document = new string[capacity+1];
 buffer = NULL;
 buffer_size = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x20(%rdi), %r14
leaq 0x30(%rdi), %rax
movq %rax, 0x20(%rdi)
andq $0x0, 0x28(%rdi)
movb $0x0, 0x30(%rdi)
movl $0x5, 0x18(%rdi)
andl $0x0, 0x10(%rdi)
movl $0xc8, %edi
callq 0x2030
movq $0x6, (%rax)
pushq $0x18
popq %rcx
leaq (%rax,%rcx), %rdx
movq %rdx, -0x10(%rax,%rcx)
andq $0x0, -0x8(%rax,%rcx)
movb $0x0, (%rax,%rcx)
addq $0x20, %rcx
cmpq $0xd8, %rcx
jne 0x4f36
addq $0x8, %rax
movq %rax, (%rbx)
andq $0x0, 0x8(%rbx)
andl $0x0, 0x14(%rbx)
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
movq %r14, %rdi
callq 0x20d0
movq %rbx, %rdi
callq 0x2260
// File: /workspace/github_cpp_makefile_star2_O2/craigbarstow[P]cmd-line-text-editor/document.cc
// Function: text_ed::operator=(text_ed&)
text_ed& text_ed::operator=(text_ed& rhs) { //overloading assignment
 if ( this != &rhs ) {
   delete [] document;
   last_line = rhs.last_line;
   capacity = rhs.capacity;
   document = new string[capacity];
   for (int i=0; i<last_line; i++) {
     document[i] = rhs.document[i];
   }
 }
 return (*this);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpq %rsi, %rdi
je 0x50a0
movq %rsi, %r14
movq (%rbx), %r13
testq %r13, %r13
je 0x5020
leaq -0x8(%r13), %rax
movq %rax, -0x30(%rbp)
movq -0x8(%r13), %r15
testq %r15, %r15
je 0x500c
addq $-0x20, %r13
movq %r15, %r12
shlq $0x5, %r12
leaq (%r12,%r13), %rdi
callq 0x20d0
addq $-0x20, %r12
jne 0x4ffd
shlq $0x5, %r15
orq $0x8, %r15
movq -0x30(%rbp), %rdi
movq %r15, %rsi
callq 0x2290
movl 0x10(%r14), %r15d
movl %r15d, 0x10(%rbx)
movslq 0x18(%r14), %r13
movq %r13, %r12
shlq $0x5, %r12
leaq 0x8(%r12), %rax
testq %r13, %r13
movl %r13d, 0x18(%rbx)
pushq $-0x1
popq %rdi
cmovnsq %rax, %rdi
callq 0x2030
leaq 0x8(%rax), %rcx
movq %r13, (%rax)
testq %r13, %r13
je 0x5071
addq $0x18, %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
addq $0x20, %rax
addq $-0x20, %r12
jne 0x505b
movq %rcx, (%rbx)
xorl %r12d, %r12d
xorl %r13d, %r13d
movslq %r15d, %rax
cmpq %rax, %r13
jge 0x50a0
movq (%r14), %rsi
addq %r12, %rsi
movq (%rbx), %rdi
addq %r12, %rdi
callq 0x2110
incq %r13
movl 0x10(%rbx), %r15d
addq $0x20, %r12
jmp 0x507a
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/craigbarstow[P]cmd-line-text-editor/document.cc
// Function: text_ed::load_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool text_ed::load_file(string filename) { // Read the file and remember the name in current_file.
 string nextline;
 current_file = filename;
 last_line=0;
 ifstream form (filename.c_str());
 while (getline(form,nextline)) { //while lines can be retrieved, insert them into document array
   insert_line(nextline,last_line);
 }
 form.close();
 return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x250, %rsp            # imm = 0x250
leaq -0x30(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movq %rsi, %r14
movq %rdi, %rbx
movb $0x0, (%rax)
addq $0x20, %rdi
callq 0x2110
andl $0x0, 0x10(%rbx)
movq (%r14), %rsi
leaq -0x268(%rbp), %rdi
pushq $0x8
popq %rdx
callq 0x2280
leaq -0x268(%rbp), %r14
leaq -0x40(%rbp), %r15
leaq -0x60(%rbp), %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x2050
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x521e
movq %r12, %rdi
movq %r15, %rsi
callq 0x21e0
movl 0x10(%rbx), %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x5288
movq %r12, %rdi
callq 0x20d0
jmp 0x51e2
leaq -0x268(%rbp), %rdi
callq 0x2060
leaq -0x268(%rbp), %rdi
callq 0x2070
leaq -0x40(%rbp), %rdi
callq 0x20d0
movb $0x1, %al
addq $0x250, %rsp            # imm = 0x250
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5268
jmp 0x5255
movq %rax, %rbx
jmp 0x5277
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x20d0
jmp 0x526b
movq %rax, %rbx
leaq -0x268(%rbp), %rdi
callq 0x2070
leaq -0x40(%rbp), %rdi
callq 0x20d0
movq %rbx, %rdi
callq 0x2260
// File: /workspace/github_cpp_makefile_star2_O2/craigbarstow[P]cmd-line-text-editor/document.cc
// Function: text_ed::insert_line(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
bool text_ed::insert_line(string newline,int n) { // Insert newline as a new line following line n.
 open_up(n,1);
 document[n+1] = newline;
 if (n > last_line-1) {
   n=last_line+1;
     }
 return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
pushq $0x1
popq %rdx
movl %ebx, %esi
callq 0x4d80
movq (%r15), %rax
movslq %ebx, %rcx
shlq $0x5, %rcx
leaq (%rax,%rcx), %rdi
addq $0x20, %rdi
movq %r14, %rsi
callq 0x2110
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/craigbarstow[P]cmd-line-text-editor/document.cc
// Function: text_ed::save_file()
bool text_ed::save_file() { //function to check if saving to a given filename is possible and save it
 if (save_file(current_file)) { 
 return true;
 } else {
   return false;
 }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
leaq 0x20(%rdi), %rsi
leaq -0x30(%rbp), %r14
movq %r14, %rdi
callq 0x21e0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x531e
leaq -0x30(%rbp), %rdi
callq 0x20d0
movb $0x1, %al
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x20d0
movq %rbx, %rdi
callq 0x2260
nop
// File: /workspace/github_cpp_makefile_star2_O2/craigbarstow[P]cmd-line-text-editor/document.cc
// Function: text_ed::save_file(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool text_ed::save_file (string filename) { // Save the text under the new name; remember the new name in current_file.
 ofstream savefile;
 int i;
 savefile.open(filename.c_str());
 for (i=1; i<=last_line; i++) { //save each line from document arry to file
   savefile << document[i]; 
   savefile << endl;
 }
 savefile.close();
 return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x200, %rsp            # imm = 0x200
movq %rsi, %r14
movq %rdi, %rbx
leaq -0x220(%rbp), %r15
movq %r15, %rdi
callq 0x2240
movq (%r14), %rsi
pushq $0x10
popq %rdx
movq %r15, %rdi
callq 0x2040
pushq $0x1
popq %r15
pushq $0x20
popq %r12
leaq -0x220(%rbp), %r14
movslq 0x10(%rbx), %rax
cmpq %rax, %r15
jg 0x538a
movq (%rbx), %rsi
addq %r12, %rsi
movq %r14, %rdi
callq 0x2170
movq %r14, %rdi
callq 0x20f0
incq %r15
addq $0x20, %r12
jmp 0x5362
leaq -0x220(%rbp), %rdi
callq 0x21f0
leaq -0x220(%rbp), %rdi
callq 0x2200
movb $0x1, %al
addq $0x200, %rsp            # imm = 0x200
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x53b6
movq %rax, %rbx
leaq -0x220(%rbp), %rdi
callq 0x2200
movq %rbx, %rdi
callq 0x2260
nop
// File: /workspace/github_cpp_makefile_star2_O2/craigbarstow[P]cmd-line-text-editor/document.cc
// Function: text_ed::delete_lines(int, int)
bool text_ed::delete_lines(int start, int end) { // Delete lines from start position to end position.
  int i;
  int num_lines = end-start;
  for (i=start; i<=last_line; i++) { //delete lines from start to end positions
    document[i] = document[i+num_lines+1];
  }
  last_line = last_line-num_lines-1;
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %ebx
movq %rdi, %r14
movslq %edx, %r15
subl %esi, %ebx
movslq %esi, %r12
shlq $0x5, %r15
addq $0x20, %r15
movq %r12, %r13
shlq $0x5, %r13
movslq 0x10(%r14), %rax
cmpq %rax, %r12
jg 0x541d
movq (%r14), %rdi
leaq (%rdi,%r15), %rsi
addq %r13, %rdi
callq 0x2110
incq %r12
addq $0x20, %r15
addq $0x20, %r13
jmp 0x53f8
notl %ebx
addl %eax, %ebx
movl %ebx, 0x10(%r14)
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/craigbarstow[P]cmd-line-text-editor/document.cc
// Function: text_ed::get_line(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, int)
bool text_ed::get_line(string& dest, int n) { // Copy line n into dest.
  if (n>last_line) {
    return false;
  }
 dest = document[n];
 return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movl %edx, %ebx
movl 0x10(%rdi), %r14d
cmpl %edx, %r14d
jl 0x545d
movslq %ebx, %rax
shlq $0x5, %rax
addq (%rdi), %rax
movq %rsi, %rdi
movq %rax, %rsi
callq 0x2110
cmpl %ebx, %r14d
setge %al
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/craigbarstow[P]cmd-line-text-editor/document.cc
// Function: text_ed::copy_lines(int, int, int)
bool text_ed::copy_lines(int start, int end, int location) { //copy lines start through end to follow line location.
  int buff_capacity=end-start+1;
  copy_to_buffer(start,end);
  open_up(location, buff_capacity);
  copy_to_document(start,end,location);
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movl %edx, %r14d
movl %esi, %r15d
movq %rdi, %r12
movl %edx, %r13d
subl %esi, %r13d
incl %r13d
callq 0x4c30
movq %r12, %rdi
movl %ebx, %esi
movl %r13d, %edx
callq 0x4d80
movq %r12, %rdi
movl %r15d, %esi
movl %r14d, %edx
movl %ebx, %ecx
callq 0x4cda
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/craigbarstow[P]cmd-line-text-editor/document.cc
// Function: text_ed::move_lines(int, int, int)
bool text_ed::move_lines(int start, int end, int location) { //move lines between two given lines (start to end) to after the given line location
  if (location<start || location>end) { //make sure new line location isnt between the start and end selections
    copy_lines(start,end,location);
    delete_lines(start,end); //delete the original lines so there aren't duplicates
    return true;
  } else {
    cout << "Error. Make sure location given is not between the two lines selected." << endl;
    return false;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
cmpl %esi, %ecx
setl %al
cmpl %edx, %ecx
setg %bl
orb %al, %bl
cmpb $0x1, %bl
jne 0x54f8
movl %edx, %r14d
movl %esi, %r15d
movq %rdi, %r12
callq 0x5468
movq %r12, %rdi
movl %r15d, %esi
movl %r14d, %edx
callq 0x53ce
jmp 0x5513
movq 0x3ac9(%rip), %rdi      # 0x8fc8
leaq 0xf8c(%rip), %rsi       # 0x6492
callq 0x2190
movq %rax, %rdi
callq 0x20f0
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/craigbarstow[P]cmd-line-text-editor/document.cc
// Function: text_ed::replace(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int, int)
bool text_ed::replace(string oldstr, string newstr, int start, int end) { //replace old word with new word between given lines (start to end)
  int i, j;
  for (i=start; i<=end; i++) { //for each line in the given area
    for(j=0;j<document[i].length(); j++){ //for character in string
      if(document[i].substr(j,oldstr.length())==oldstr){ //if substring found starting at the character position
	document[i].replace(j,oldstr.length(),newstr); //replace old string with new string
      }
    }
  }
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, -0x48(%rbp)
movq %rsi, %r14
movq %rdi, -0x30(%rbp)
movslq %ecx, %r15
movslq %r8d, %rax
movq %rax, -0x38(%rbp)
leaq -0x68(%rbp), %r12
cmpq -0x38(%rbp), %r15
jg 0x55ba
movq %r15, -0x40(%rbp)
shlq $0x5, %r15
xorl %r13d, %r13d
movq -0x30(%rbp), %rax
movq (%rax), %rsi
cmpq %r13, 0x8(%rsi,%r15)
jbe 0x55b1
addq %r15, %rsi
movq 0x8(%r14), %rcx
movq %r12, %rdi
movq %r13, %rdx
callq 0x21a0
movq %r12, %rdi
movq %r14, %rsi
callq 0x55cb
movl %eax, %ebx
movq %r12, %rdi
callq 0x20d0
testb %bl, %bl
je 0x55ac
movq -0x30(%rbp), %rax
movq (%rax), %rdi
addq %r15, %rdi
movq 0x8(%r14), %rdx
movq %r13, %rsi
movq -0x48(%rbp), %rcx
callq 0x2090
incq %r13
jmp 0x5559
movq -0x40(%rbp), %r15
incq %r15
jmp 0x5548
movb $0x1, %al
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/tdv[P]boss/boss/src/class_factory/class_factory.cpp
// Function: Boss::ClassFactory::FinalizeConstruct()
void ClassFactory::FinalizeConstruct()
  {
    Locator = Boss::Private::GetServiceLocator();
    if (Locator.Get() && Locator->AddService(Service::Locator::Id::ClassFactoryService, GetThisIBase()))
      throw ClassFactoryException("Failed to put ClassFactory into ServiceLocator");
    
    //CleanerThread.reset(new std::thread(&ClassFactory::Clean, this));
  }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rsp, %rdi
callq 0x7b740
leaq 0xd0(%rbx), %r14
movq %r14, %rdi
callq 0x79490
movq %rsp, %rdi
movq (%rdi), %rax
movq %rax, (%r14)
andq $0x0, (%rdi)
callq 0x7cab0
movq (%r14), %r14
testq %r14, %r14
je 0x7f48e
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x10(%rax)
movq (%r14), %rcx
movq %r14, %rdi
movl $0x16d1a76d, %esi       # imm = 0x16D1A76D
movq %rax, %rdx
callq *0x30(%rcx)
testl %eax, %eax
jne 0x7f496
addq $0x8, %rsp
popq %rbx
popq %r14
retq
pushq $0x10
popq %rdi
callq 0x7a7a0
movq %rax, %rbx
leaq 0xa4b68(%rip), %rsi     # 0x124010
movq %rax, %rdi
callq 0x79ae0
movq 0xe18a1(%rip), %rsi     # 0x160d58
movq 0xe0dba(%rip), %rdx     # 0x160278
movq %rbx, %rdi
callq 0x7add0
movq %rax, %r14
movq %rbx, %rdi
callq 0x793d0
jmp 0x7f4de
movq %rax, %r14
movq %rsp, %rdi
callq 0x7cab0
movq %r14, %rdi
callq 0x120e20
// File: /workspace/github_cpp_makefile_star2_O2/tdv[P]boss/boss/src/class_factory/class_factory.cpp
// Function: Boss::ClassFactory::BeforeRelease()
void ClassFactory::BeforeRelease()
  {
    std::lock_guard<std::recursive_mutex> Lock(Mtx);
    IsRunCleaner = false;
    //CleanerThread->join();
    CleanerThread.reset();
    Registry.Release();
    for (auto &i : Modules)
    {
      try
      {
        assert(!i.second->GetModule().GetRefCount() && "Module has not null reference counter.");
      }
      catch (...)
      {
        assert(false && "Failed to get module reference counter.");
      }
    }
    if (Locator.Get())
      Locator->DelService(Service::Locator::Id::ClassFactoryService);
  }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
leaq 0x20(%rdi), %rbx
movq %rbx, %rdi
callq 0x7b4a0
movb $0x0, 0xb8(%r14)
leaq 0xc0(%r14), %rdi
xorl %esi, %esi
callq 0x7c620
leaq 0xc8(%r14), %rdi
callq 0x7c8c0
leaq 0x90(%r14), %r15
movq (%r15), %r15
testq %r15, %r15
je 0x7f555
movq 0x10(%r15), %rdi
addq $0x8, %rdi
callq 0x7a830
testl %eax, %eax
je 0x7f523
leaq 0xa4afc(%rip), %rdi     # 0x12403f
leaq 0xa4b46(%rip), %rsi     # 0x124090
leaq 0xa4b68(%rip), %rcx     # 0x1240b9
pushq $0x5d
jmp 0x7f5ab
movq 0xd0(%r14), %rdi
testq %rdi, %rdi
je 0x7f56c
movq (%rdi), %rax
movl $0x16d1a76d, %esi       # imm = 0x16D1A76D
callq *0x38(%rax)
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x7c6c0
movq %rax, %r14
movq %rbx, %rdi
callq 0x7c6c0
movq %r14, %rdi
callq 0x120e20
movq %rax, %rdi
callq 0x79500
leaq 0xa4b47(%rip), %rdi     # 0x1240e2
leaq 0xa4aee(%rip), %rsi     # 0x124090
leaq 0xa4b10(%rip), %rcx     # 0x1240b9
pushq $0x61
popq %rdx
callq 0x79ab0
nop
// File: /workspace/github_cpp_makefile_star2_O2/tdv[P]boss/boss/src/class_factory/class_factory.cpp
// Function: Boss::ClassFactory::SetRegistry(Boss::IServiceRegistry*)
RetCode BOSS_CALL ClassFactory::SetRegistry(IServiceRegistry *registry)
  {
    try
    {
      std::lock_guard<std::recursive_mutex> Lock(Mtx);
      Registry = registry;
    }
    catch (...)
    {
      return Status::Fail;
    }
    return Status::Ok;
  }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x20(%rdi), %rbx
movq %rbx, %rdi
callq 0x7b4a0
addq $0xc8, %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x7c670
movq %rbx, %rdi
callq 0x7c6c0
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x7c6c0
jmp 0x7f9d5
movq %rax, %r14
movq %r14, %rdi
callq 0x79500
callq 0x7b420
pushq $0x2
popq %rax
jmp 0x7f9bf
nop
// File: /workspace/github_cpp_makefile_star2_O2/tdv[P]boss/boss/include/plugin/module_holder.h
// Function: Boss::ModuleHolder::GetRefCount() const
UInt const GetRefCount() const
    {
      typedef RetCode (*PFNBossGetRefCount)(UInt *);
      auto *BossGetRefCount = Dll.GetProc<PFNBossGetRefCount>("BossGetRefCount");
      UInt RefCount = 0;
      if (BossGetRefCount(&RefCount) != Status::Ok)
        throw ModuleHolderException("Failed to call BossGetRefCount.");
      return RefCount;
    }

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0xa44c8(%rip), %rsi     # 0x124115
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x7aad0
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x7b480
movq %rax, %rbx
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x796f0
andl $0x0, (%r14)
leaq 0x8(%rsp), %rdi
callq *%rbx
testl %eax, %eax
jne 0x7fc94
movl 0x8(%rsp), %eax
addq $0x28, %rsp
popq %rbx
popq %r14
retq
pushq $0x10
popq %rdi
callq 0x7a7a0
movq %rax, %r14
leaq 0xa447f(%rip), %rsi     # 0x124125
movq %rax, %rdi
callq 0x79080
movq 0xe0d03(%rip), %rsi     # 0x1609b8
movq 0xe05bc(%rip), %rdx     # 0x160278
movq %r14, %rdi
callq 0x7add0
movq %rax, %rbx
movq %r14, %rdi
callq 0x793d0
jmp 0x7fce3
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x796f0
jmp 0x7fce3
movq %rax, %rbx
movq %rbx, %rdi
callq 0x120e20
nop
// File: /workspace/github_cpp_makefile_star2_O2/tdv[P]boss/boss/src/class_factory/class_factory.cpp
// Function: Boss::ClassFactory::ModuleHolderEx::ModuleHolderEx(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
ModuleHolderEx(std::string const &path)
      : Module(std::move(DllHolder(path)))
    {
      auto Locator = Private::GetServiceLocator();
      if (Locator.Get())
      {
        Module.SetServiceLocator(Locator.Get());
        LocatorExists = false;
      }
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %r14
movb $0x0, (%rdi)
leaq 0x8(%rdi), %rbx
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0x7c480
movq (%r15), %rax
movq %rax, 0x8(%r14)
andq $0x0, (%r15)
movq %r15, %rdi
callq 0x79a80
leaq 0x8(%rsp), %rdi
callq 0x7b740
movq 0x8(%rsp), %rsi
testq %rsi, %rsi
je 0x80f1f
movq %rbx, %rdi
callq 0x7c2d0
movb $0x0, (%r14)
leaq 0x8(%rsp), %rdi
callq 0x7cab0
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x7cab0
jmp 0x80f45
movq %rax, %r14
movq %rbx, %rdi
callq 0x79a80
movq %r14, %rdi
callq 0x120e20
nop
// File: /workspace/github_cpp_makefile_star2_O2/tetsuok[P]kernel-pa/kernel_pa.cc
// Function: kernel::(anonymous namespace)::Usage(char const*)
[[noreturn]] void Usage(const char* name) {
  cerr << "usage: " << name << " [-C FLOAT] [-d INT] [-t INT] [-o FILE] FILE\n"
      "-C hyperparameter passive-aggressive. C should be positive. (default: " << kC << ")\n"
      "-d the degree of polynomial kernel (supported: d = 1, 2, 3, and 4) (deafult: " << kKernelDegree << ")\n"
      "-t the number of iterations (default: " << kNumIter << ")\n"
      "-o model filename (default " << kModel << ")\n";
  exit(1);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x58b5(%rip), %rdi      # 0x7ff0
leaq 0x2926(%rip), %rsi      # 0x5068
callq 0x2160
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2160
leaq 0x2917(%rip), %rsi      # 0x5070
movq %rax, %rdi
callq 0x2160
movsd 0x289f(%rip), %xmm0     # 0x5008
movq %rax, %rdi
callq 0x22c0
leaq 0x296c(%rip), %rsi      # 0x50e4
movq %rax, %rdi
callq 0x2160
pushq $0x2
popq %rsi
movq %rax, %rdi
callq 0x2280
leaq 0x29a2(%rip), %rsi      # 0x5134
movq %rax, %rdi
callq 0x2160
pushq $0x3
popq %rsi
movq %rax, %rdi
callq 0x2280
leaq 0x29b1(%rip), %rsi      # 0x515d
movq %rax, %rdi
callq 0x2160
leaq 0x2855(%rip), %rsi      # 0x5010
movq %rax, %rdi
callq 0x2160
leaq 0x29b1(%rip), %rsi      # 0x517b
movq %rax, %rdi
callq 0x2160
pushq $0x1
popq %rdi
callq 0x21a0
// File: /workspace/github_cpp_makefile_star2_O2/davmac314[P]dinit/src/dinit.cc
// Function: sigquit_cb(dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>&)
static void sigquit_cb(eventloop_t &eloop) noexcept
{
    // This performs an immediate shutdown, without service rollback.
    close_control_socket();
    execl(shutdown_exec.c_str(), shutdown_exec.c_str(), "--system", (char *) 0);
    log(loglevel_t::ERROR, error_exec_sd, strerror(errno));
    sync(); // since a hard poweroff might be required at this point...
}

// Assembly:
pushq %rax
callq 0xa88d
leaq 0x23c33(%rip), %rdi     # 0x2df4a
leaq 0x22eb7(%rip), %rdx     # 0x2d1d5
movq %rdi, %rsi
xorl %ecx, %ecx
xorl %eax, %eax
callq 0x8740
callq 0x8040
movl (%rax), %edi
callq 0x81c0
movq %rsp, %rdi
movq %rax, (%rdi)
callq 0xa8d4
popq %rax
jmp 0x85b0
// File: /workspace/github_cpp_makefile_star2_O2/davmac314[P]dinit/src/dinit.cc
// Function: control_socket_ready()
static void control_socket_ready() noexcept
{
    if (!control_socket_open || socket_ready_fd < 0) {
        return;
    }
    write(socket_ready_fd, control_socket_path, strlen(control_socket_path) + 1);
    // Once done with, close it (but leave stdout/stderr alone)
    if (socket_ready_fd > 2) {
        close(socket_ready_fd);
    }
    // Ensure that we don't try to issue readiness again:
    socket_ready_fd = -1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl 0x3ada6(%rip), %ebx     # 0x455e0
testl %ebx, %ebx
setns %al
andb 0x3b4de(%rip), %al      # 0x45d23
cmpb $0x1, %al
jne 0xa87d
movq 0x3ad98(%rip), %r14     # 0x455e8
movq %r14, %rdi
callq 0x8220
leaq 0x1(%rax), %rdx
movl %ebx, %edi
movq %r14, %rsi
callq 0x81d0
movl 0x3ad74(%rip), %edi     # 0x455e0
cmpl $0x3, %edi
jl 0xa876
callq 0x8b50
orl $-0x1, 0x3ad63(%rip)    # 0x455e0
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rdi
callq 0xaebb
// File: /workspace/github_cpp_makefile_star2_O2/davmac314[P]dinit/src/dinit.cc
// Function: close_control_socket()
static void close_control_socket() noexcept
{
    if (control_socket_open) {
        int fd = control_socket_io.get_watched_fd();
        control_socket_io.deregister(event_loop);
        close(fd);
        
        // Unlink the socket:
        unlink(control_socket_path);

        control_socket_open = false;
    }
}

// Assembly:
pushq %rbx
cmpb $0x1, 0x3b48e(%rip)     # 0x45d23
jne 0xa8ca
movl 0x3b3e7(%rip), %ebx     # 0x45c84
leaq 0x3b3c4(%rip), %rdi     # 0x45c68
leaq 0x3b185(%rip), %rsi     # 0x45a30
callq 0xd002
movl %ebx, %edi
callq 0x8b50
movq 0x3ad2a(%rip), %rdi     # 0x455e8
callq 0x8250
movb $0x0, 0x3b459(%rip)     # 0x45d23
popq %rbx
retq
movq %rax, %rdi
callq 0xaebb
// File: /workspace/github_cpp_makefile_star2_O2/davmac314[P]dinit/src/dinit.cc
// Function: rootfs_is_rw()
void rootfs_is_rw() noexcept
{
    open_control_socket(true);
    control_socket_ready();
    if (!log_is_syslog && !external_log_open) {
        // Try (again) to open log file if we couldn't do so earlier.
        setup_external_log();
    }
    if (!did_log_boot) {
        did_log_boot = log_boot();
    }
}

// Assembly:
pushq %rax
pushq $0x1
popq %rdi
callq 0xa347
callq 0xa830
cmpb $0x1, 0x3b40d(%rip)     # 0x45d12
jne 0xa915
cmpb $0x0, 0x3b28a(%rip)     # 0x45b98
jne 0xa915
callq 0xa657
cmpb $0x0, 0x3b405(%rip)     # 0x45d21
jne 0xa929
callq 0xaf50
movb %al, 0x3b3f8(%rip)      # 0x45d21
popq %rax
retq
movq %rax, %rdi
callq 0xaebb
// File: /workspace/github_cpp_makefile_star2_O2/davmac314[P]dinit/src/../dasynq/include/dasynq.h
// Function: dasynq::v2::dprivate::timer_impl<dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>, process_restart_timer>::dispatch(void*)
void dispatch(void *loop_ptr) noexcept override
    {
        EventLoop &loop = *static_cast<EventLoop *>(loop_ptr);
        loop_access::get_base_lock(loop).unlock();

        auto intervals_report = this->intervals;
        this->intervals = 0;
        auto rearm_type = static_cast<Derived *>(this)->timer_expiry(loop, intervals_report);

        loop_access::get_base_lock(loop).lock();

        if (rearm_type != rearm::REMOVED) {

            this->active = false;
            if (this->deleteme) {
                // We don't want a watch that is marked "deleteme" to re-arm itself.
                rearm_type = rearm::REMOVE;
            }

            loop_access::process_timer_rearm(loop, this, rearm_type);

            post_dispatch(loop, this, rearm_type);
        }
    }

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movl 0x48(%rdi), %edx
andl $0x0, 0x48(%rdi)
callq 0x20e4c
cmpl $0x4, %eax
jne 0x231a2
popq %rbx
popq %r14
popq %rbp
retq
movb 0xc(%rbx), %cl
movl %ecx, %edx
andb $-0x2, %dl
movb %dl, 0xc(%rbx)
testb $0x2, %cl
pushq $0x3
popq %rbp
cmovel %eax, %ebp
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0xc596
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
popq %rbx
popq %r14
popq %rbp
jmp 0xb616
movq %rax, %rdi
callq 0xaebb
// File: /workspace/github_cpp_makefile_star2_O2/davmac314[P]dinit/src/../dasynq/include/dasynq.h
// Function: dasynq::v2::dprivate::signal_watcher_impl<dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>, (anonymous namespace)::callback_signal_handler>::dispatch(void*)
void dispatch(void *loop_ptr) noexcept override
    {
        EventLoop &loop = *static_cast<EventLoop *>(loop_ptr);
        loop_access::get_base_lock(loop).unlock();

        auto rearm_type = static_cast<Derived *>(this)->received(loop, this->siginfo.get_signo(), this->siginfo);

        loop_access::get_base_lock(loop).lock();

        if (rearm_type != rearm::REMOVED) {

            this->active = false;
            if (this->deleteme) {
                // We don't want a watch that is marked "deleteme" to re-arm itself.
                rearm_type = rearm::REMOVE;
            }

            loop_access::process_signal_rearm(loop, this, rearm_type);

            post_dispatch(loop, this, rearm_type);
        }
    }

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq *0xa0(%rbx)
movb 0xc(%rbx), %al
movl %eax, %ecx
andb $-0x2, %cl
movb %cl, 0xc(%rbx)
andb $0x2, %al
shrb %al
movzbl %al, %eax
leal (%rax,%rax,2), %ebp
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
callq 0xca5c
movq %r14, %rdi
movq %rbx, %rsi
movl %ebp, %edx
popq %rbx
popq %r14
popq %rbp
jmp 0xb616
movq %rax, %rdi
callq 0xaebb
// File: /workspace/github_cpp_makefile_star2_O2/davmac314[P]dinit/src/../dasynq/include/dasynq.h
// Function: dasynq::v2::dprivate::signal_watcher<dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>>::add_watch(dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>&, int, int)
inline void add_watch(event_loop_t &eloop, int signo, int prio = DEFAULT_PRIORITY)
    {
        base_watcher::init();
        this->priority = prio;
        this->siginfo.set_signo(signo);
        eloop.register_signal(this, signo);
    }

// Assembly:
movq %rdi, %rax
andb $-0x20, 0xc(%rdi)
movl %ecx, 0x18(%rdi)
movl %edx, 0x20(%rdi)
movq %rsi, %rdi
movq %rax, %rsi
jmp 0xdf0e
// File: /workspace/github_cpp_makefile_star2_O2/davmac314[P]dinit/src/includes/service.h
// Function: log_service_load_failure(service_description_exc&)
inline void log_service_load_failure(service_description_exc &exc)
{
    if (exc.input_pos.get_line_num() != (unsigned)-1) {
        if (exc.setting_name == nullptr) {
            log(loglevel_t::ERROR, "Error in service description for '", exc.service_name,
                    "' (file ", exc.input_pos.get_file_name(), ", line ", exc.input_pos.get_line_num(), "): ",
                    exc.exc_description);
        }
        else {
            log(loglevel_t::ERROR, "Error in service description for '", exc.service_name, "': setting '", exc.setting_name, "' "
                    "(file ", exc.input_pos.get_file_name(), ", line ", exc.input_pos.get_line_num(), "): ",
                    exc.exc_description);
        }
    }
    else {
        // If no line number, setting name must be present
        log(loglevel_t::ERROR, "Error in service description for '", exc.service_name, "' setting '", exc.setting_name, "': ",
                exc.exc_description);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x40(%rdi), %eax
cmpl $-0x1, %eax
je 0xae37
leaq 0x48(%rbx), %r15
leaq 0x20(%rbx), %r14
cmpq $0x0, 0x68(%rbx)
je 0xae81
movq %rsp, %r12
movl %eax, (%r12)
leaq 0x22da3(%rip), %rsi     # 0x2dbb3
pushq $0x3
popq %rdi
callq 0x28e0a
movq %rbx, %rdi
callq 0xac6e
leaq 0x22dc0(%rip), %rdi     # 0x2dbe7
callq 0x28f17
movq 0x68(%rbx), %rdi
callq 0x28f17
jmp 0xaea1
leaq 0x20(%rbx), %r14
leaq 0x22d71(%rip), %rsi     # 0x2dbb3
pushq $0x3
popq %rdi
callq 0x28e0a
movq %rbx, %rdi
callq 0xac6e
leaq 0x22d9b(%rip), %rdi     # 0x2dbf4
callq 0x28f17
movq 0x68(%rbx), %rdi
callq 0x28f17
leaq 0x22d92(%rip), %rdi     # 0x2dc00
movq %r14, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xace5
leaq 0x4(%rsp), %r12
movl %eax, (%r12)
leaq 0x22d22(%rip), %rsi     # 0x2dbb3
pushq $0x3
popq %rdi
callq 0x28e0a
movq %rbx, %rdi
callq 0xac6e
movq %r15, %rdi
movq %r12, %rsi
movq %r14, %rdx
callq 0xac76
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/davmac314[P]dinit/src/includes/dinit-utmp.h
// Function: log_boot()
inline bool log_boot()
{
    struct utmpx record;
    memset(&record, 0, sizeof(record));
    record.ut_type = BOOT_TIME;

    set_current_time(&record);

    // On FreeBSD, putxline will update all appropriate databases. On Linux, it only updates
    // the utmp database: we need to update the wtmp database explicitly:
#if USE_UPDWTMPX
    updwtmpx(_PATH_WTMPX, &record);
#endif

#if CLEAR_UTMP_ON_BOOT
    truncate(_PATH_UTMPX, 0);
#endif

    setutxent();
    bool success = (pututxline(&record) != NULL);
    endutxent();

    return success;
}

// Assembly:
pushq %rbx
subq $0x180, %rsp            # imm = 0x180
movq %rsp, %rbx
movl $0x180, %edx            # imm = 0x180
movq %rbx, %rdi
xorl %esi, %esi
callq 0x8350
movw $0x2, (%rbx)
movq %rbx, %rdi
callq 0xcfd5
leaq 0x22d39(%rip), %rdi     # 0x2dcb7
movq %rbx, %rsi
callq 0x89b0
leaq 0x22d38(%rip), %rdi     # 0x2dcc5
xorl %esi, %esi
callq 0x87f0
callq 0x8270
movq %rbx, %rdi
callq 0x80a0
testq %rax, %rax
setne %bl
callq 0x80f0
movl %ebx, %eax
addq $0x180, %rsp            # imm = 0x180
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/davmac314[P]dinit/src/../dasynq/include/dasynq.h
// Function: dasynq::v2::dprivate::bidi_fd_watcher<dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>>::add_watch(dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>&, int, int, int, int)
void add_watch(event_loop_t &eloop, int fd, int flags, int inprio = DEFAULT_PRIORITY, int outprio = DEFAULT_PRIORITY)
    {
        base_watcher::init();
        this->out_watcher.base_watcher::init();
        this->watch_fd = fd;
        this->watch_flags = flags | dprivate::multi_watch;
        this->read_removed = false;
        this->write_removed = false;
        this->priority = inprio;
        this->set_priority(this->out_watcher, outprio);
        eloop.register_fd(this, fd, flags, true);
    }

// Assembly:
movq %rdi, %rax
andb $-0x20, 0xc(%rdi)
andb $-0x20, 0x34(%rdi)
movq %rsi, %rdi
movl %edx, 0x1c(%rax)
movl %ecx, %esi
orl $0x4, %esi
movl %esi, 0x20(%rax)
andb $-0x4, 0x48(%rax)
movl %r8d, 0x18(%rax)
movl %r9d, 0x40(%rax)
pushq $0x1
popq %r8
movq %rax, %rsi
jmp 0xc06c
nop
// File: /workspace/github_cpp_makefile_star2_O2/davmac314[P]dinit/src/../dasynq/include/dasynq.h
// Function: dasynq::v2::dprivate::bidi_fd_watcher_impl<dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>, control_conn_watcher>::dispatch(void*)
void dispatch(void *loop_ptr) noexcept override
    {
        EventLoop &loop = *static_cast<EventLoop *>(loop_ptr);
        this->emulate_enabled = false;
        loop_access::get_base_lock(loop).unlock();

        auto rearm_type = static_cast<Derived *>(this)->read_ready(loop, this->watch_fd);

        loop_access::get_base_lock(loop).lock();

        if (rearm_type != rearm::REMOVED) {
            this->event_flags &= ~IN_EVENTS;
            this->active = false;
            if (this->deleteme) {
                // We don't want a watch that is marked "deleteme" to re-arm itself.
                rearm_type = rearm::REMOVE;
            }

            rearm_type = loop_access::process_primary_rearm(loop, this, rearm_type);

            auto &outwatcher = bidi_fd_watcher<EventLoop>::out_watcher;
            post_dispatch(loop, this, &outwatcher, rearm_type);
        }
    }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
andb $-0x9, 0xc(%rdi)
movl 0x1c(%rdi), %edx
callq 0xb88e
cmpl $0x4, %eax
je 0xb7fd
andb $-0x2, 0x24(%rbx)
movb 0xc(%rbx), %cl
movl %ecx, %edx
andb $-0x2, %dl
movb %dl, 0xc(%rbx)
testb $0x2, %cl
pushq $0x3
popq %rdx
cmovel %eax, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0xbe44
leaq 0x28(%rbx), %rdx
movq %r14, %rdi
movq %rbx, %rsi
movl %eax, %ecx
callq 0xb896
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rdi
callq 0xaebb
nop
// File: /workspace/github_cpp_makefile_star2_O2/davmac314[P]dinit/src/../dasynq/include/dasynq.h
// Function: dasynq::v2::dprivate::bidi_fd_watcher_impl<dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>, control_conn_watcher>::dispatch_second(void*)
void dispatch_second(void *loop_ptr) noexcept override
    {
        auto &outwatcher = bidi_fd_watcher<EventLoop>::out_watcher;

        EventLoop &loop = *static_cast<EventLoop *>(loop_ptr);
        loop_access::get_base_lock(loop).unlock();

        auto rearm_type = static_cast<Derived *>(this)->write_ready(loop, this->watch_fd);

        loop_access::get_base_lock(loop).lock();

        if (rearm_type != rearm::REMOVED) {
            this->event_flags &= ~OUT_EVENTS;
            outwatcher.active = false;
            if (outwatcher.deleteme) {
                // We don't want a watch that is marked "deleteme" to re-arm itself.
                rearm_type = rearm::REMOVE;
            }

            rearm_type = loop_access::process_secondary_rearm(loop, this, &outwatcher, rearm_type);

            if (rearm_type == rearm::REQUEUE) {
                post_dispatch(loop, &outwatcher, rearm_type);
            }
            else {
                post_dispatch(loop, this, &outwatcher, rearm_type);
            }
        }
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl 0x1c(%rdi), %edx
callq 0xbf62
cmpl $0x4, %eax
je 0xb878
leaq 0x28(%r14), %r15
andb $-0x3, 0x24(%r14)
movb 0x34(%r14), %cl
movl %ecx, %edx
andb $-0x2, %dl
movb %dl, 0x34(%r14)
testb $0x2, %cl
pushq $0x3
popq %rcx
cmovel %eax, %ecx
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0xbf6a
cmpl $0x5, %eax
jne 0xb868
movq %rbx, %rdi
movq %r15, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0xbaa8
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
movl %eax, %ecx
callq 0xb896
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rdi
callq 0xaebb
// File: /workspace/github_cpp_makefile_star2_O2/davmac314[P]dinit/src/../dasynq/include/dasynq.h
// Function: void dasynq::v2::dprivate::post_dispatch<dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>>(dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>&, dasynq::v2::dprivate::bidi_fd_watcher<dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>>*, dasynq::v2::dprivate::base_watcher*, dasynq::rearm)
void post_dispatch(Loop &loop, bidi_fd_watcher<Loop> *bdfd_watcher,
            base_watcher *out_watcher, rearm rearm_type)
    {
        base_watcher *watcher = (base_watcher *)bdfd_watcher;
        if (rearm_type == rearm::REMOVE) {
            loop_access::get_base_lock(loop).unlock();
            loop_access::release_watcher(loop, watcher);
            loop_access::release_watcher(loop, out_watcher);
            watcher->watch_removed();
            loop_access::get_base_lock(loop).lock();
        }
        else if (rearm_type == rearm::REQUEUE) {
            loop_access::requeue_watcher(loop, watcher);
        }
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r15
cmpl $0x5, %ecx
je 0xb8d7
cmpl $0x3, %ecx
jne 0xb8e7
movq %rdx, %r14
leaq 0x10(%rbx), %rsi
movq %r15, %rdi
callq 0xbf34
addq $0x10, %r14
movq %r15, %rdi
movq %r14, %rsi
callq 0xbf34
movq (%rbx), %rax
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmpq *0x20(%rax)
movq %r15, %rdi
movq %rbx, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0xbaa8
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/davmac314[P]dinit/src/includes/control.h
// Function: control_conn_cb(dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>*, control_conn_watcher*, int)
inline dasynq::rearm control_conn_cb(eventloop_t * loop, control_conn_watcher * watcher, int revents)
{
    // Get the address of the containing control_connt_t object:
    _Pragma ("GCC diagnostic push")
    _Pragma ("GCC diagnostic ignored \"-Winvalid-offsetof\"")
    uintptr_t cc_addr = reinterpret_cast<uintptr_t>(watcher) - offsetof(control_conn_t, iob);
    control_conn_t *conn = reinterpret_cast<control_conn_t *>(cc_addr);
    _Pragma ("GCC diagnostic pop")

    if (revents & dasynq::IN_EVENTS) {
        if (conn->data_ready()) {
            delete conn;
            return dasynq::rearm::REMOVED;
        }
    }
    if (revents & dasynq::OUT_EVENTS) {
        if (conn->send_data()) {
            delete conn;
            return dasynq::rearm::REMOVED;
        }
    }
    
    // Accept more commands unless the output buffer high water mark is exceeded
    int watch_flags = 0;
    if (!conn->bad_conn_close && conn->outbuf_size < OUTBUF_LIMIT) {
        watch_flags |= dasynq::IN_EVENTS;
    }
    if (!conn->outbuf.empty() || conn->bad_conn_close) {
        watch_flags |= dasynq::OUT_EVENTS;
    }
    watcher->set_watches(watch_flags);

    return dasynq::rearm::NOOP;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rsi, %rbx
leaq -0x10(%rsi), %r14
testb $0x1, %bpl
je 0xb928
movq %r14, %rdi
callq 0x25ac0
testb %al, %al
jne 0xb93a
testb $0x2, %bpl
je 0xb947
movq %r14, %rdi
callq 0x25b92
testb %al, %al
je 0xb947
movq (%r14), %rax
movq %r14, %rdi
callq *0x18(%rax)
pushq $0x4
jmp 0xb97e
xorl %esi, %esi
cmpb $0x0, 0x78(%r14)
jne 0xb971
xorl %esi, %esi
cmpl $0x4000, 0x508(%r14) # imm = 0x4000
setb %sil
leaq 0x4f0(%r14), %rax
cmpq %rax, 0x4f0(%r14)
je 0xb974
orl $0x2, %esi
movq %rbx, %rdi
callq 0xb984
pushq $0x2
popq %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/davmac314[P]dinit/src/../dasynq/include/dasynq.h
// Function: dasynq::v2::dprivate::bidi_fd_watcher<dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>>::set_watches(dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>&, int)
void set_watches(event_loop_t &eloop, int new_flags) noexcept
    {
        std::lock_guard<mutex_t> guard(eloop.get_base_lock());
        bool use_emulation = this->emulatefd || this->out_watcher.emulatefd;
        if (use_emulation || EventLoop::loop_traits_t::has_separate_rw_fd_watches) {
            set_watch_enabled(eloop, true, (new_flags & IN_EVENTS) != 0);
            set_watch_enabled(eloop, false, (new_flags & OUT_EVENTS) != 0);
        }
        else {
            this->watch_flags = (this->watch_flags & ~IO_EVENTS) | new_flags;
            eloop.set_fd_enabled_nolock((dprivate::base_watcher *) this, this->watch_fd, this->watch_flags & IO_EVENTS, true);
        }
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r14
movb 0x34(%rdi), %al
orb 0xc(%rdi), %al
testb $0x4, %al
je 0xb9d3
movl %ebx, %ecx
andl $0x1, %ecx
pushq $0x1
popq %rdx
movq %r14, %rdi
movq %r15, %rsi
callq 0xb9fc
andl $0x2, %ebx
shrl %ebx
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
movl %ebx, %ecx
popq %rbx
popq %r14
popq %r15
jmp 0xb9fc
movl 0x1c(%r14), %esi
movl 0x20(%r14), %eax
andl $-0x4, %eax
orl %ebx, %eax
movl %eax, 0x20(%r14)
andl $0x3, %ebx
orl $0x8, %ebx
movq %r15, %rdi
movq %r14, %rdx
movl %ebx, %ecx
popq %rbx
popq %r14
popq %r15
jmp 0xbdde
// File: /workspace/github_cpp_makefile_star2_O2/davmac314[P]dinit/src/../dasynq/include/dasynq.h
// Function: dasynq::v2::dprivate::bidi_fd_watcher<dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>>::set_watch_enabled(dasynq::v2::event_loop<dasynq::null_mutex, dasynq::v2::default_traits<dasynq::null_mutex>>&, bool, bool)
void set_watch_enabled(EventLoop &eloop, bool in, bool b)
    {
        int events = in ? IN_EVENTS : OUT_EVENTS;
        auto orig_flags = this->watch_flags;
        
        if (b) {
            this->watch_flags |= events;
        }
        else {
            this->watch_flags &= ~events;
        }

        dprivate::base_watcher * watcher = in ? this : &this->out_watcher;

        if (! watcher->emulatefd) {
            if (EventLoop::loop_traits_t::has_separate_rw_fd_watches) {
                eloop.set_fd_enabled_nolock(this, this->watch_fd, events | ONE_SHOT, b);
            }
            else {
                eloop.set_fd_enabled_nolock(this, this->watch_fd,
                        (this->watch_flags & IO_EVENTS) | ONE_SHOT,
                        (this->watch_flags & IO_EVENTS) != 0);
            }
        }
        else {
            // emulation: if enabling a previously disabled watcher, must queue now:
            if (b && (orig_flags != this->watch_flags)) {
                this->watch_flags = orig_flags;
                loop_access::requeue_watcher(eloop, watcher);
            }
        }

        if (! b) {
            eloop.dequeue_watcher(watcher);
        }
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %ecx, %ebx
movq %rdi, %rax
pushq $0x2
popq %rdi
subl %edx, %edi
movl 0x20(%rax), %ecx
movl %edi, %r8d
notl %r8d
andl %ecx, %r8d
orl %ecx, %edi
testl %ebx, %ebx
cmovel %r8d, %edi
movq %rsi, %r14
movl %edi, 0x20(%rax)
leaq 0x28(%rax), %r15
testl %edx, %edx
cmovneq %rax, %r15
testb $0x4, 0xc(%r15)
jne 0xba55
movl 0x1c(%rax), %edx
andl $0x3, %edi
leal 0x8(%rdi), %ecx
xorl %r8d, %r8d
testl %edi, %edi
setne %r8b
movq %r14, %rdi
movq %rax, %rsi
callq 0xba8a
jmp 0xba6f
cmpl %edi, %ecx
setne %dl
andb %bl, %dl
cmpb $0x1, %dl
jne 0xba6f
movl %ecx, 0x20(%rax)
movq %r14, %rdi
movq %r15, %rsi
callq 0xbaa8
testb %bl, %bl
je 0xba79
popq %rbx
popq %r14
popq %r15
retq
movq %r14, %rdi
movq %r15, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0xbc92
nop