LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: tomfunkhouser[P]gaps/pkgs/R3Shapes/R3MeshProperty.cpp
// Function: gaps::R3MeshProperty::ReadPoints(char const*)
int R3MeshProperty::
ReadPoints(const char *filename)
{
  // Open file
  FILE *fp = fopen(filename, "r");
  if (!fp) {
    RNFail("Unable to open ASCII file: %s\n", filename);
    return 0;
  }

  // Create property name
  SetName("Points");

  // Initialize all values to zero
  Clear(0);

  // Assign value 1 to vertices in pid file
  int vertex_index;
  while (fscanf(fp, "%d", &vertex_index) == (unsigned int) 1) {
    if ((vertex_index > 0) && (vertex_index < mesh->NVertices())) {
      SetVertexValue(vertex_index, 1);
    }
  }

  // Close file
  fclose(fp);

  // Return success
  return 1;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %rdi
leaq 0x12ca8f(%rip), %rsi    # 0x19d8e3
callq 0x22bf0
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
jne 0x70e86
movq 0x20(%rsp), %rsi
leaq 0x1276d9(%rip), %rdi    # 0x19854b
movb $0x0, %al
callq 0xfbc30
movl $0x0, 0x34(%rsp)
jmp 0x70f11
movq 0x8(%rsp), %rdi
leaq 0x1276d8(%rip), %rsi    # 0x19856a
callq 0x6f500
movq 0x8(%rsp), %rdi
xorps %xmm0, %xmm0
callq 0x6e1d0
movq 0x18(%rsp), %rdi
leaq 0x12c6aa(%rip), %rsi    # 0x19d55a
leaq 0x14(%rsp), %rdx
movb $0x0, %al
callq 0x23350
cmpl $0x1, %eax
jne 0x70eff
cmpl $0x0, 0x14(%rsp)
jle 0x70efd
movq 0x8(%rsp), %rax
movl 0x14(%rsp), %ecx
movl %ecx, 0x4(%rsp)
movq (%rax), %rdi
callq 0x2abd0
movl %eax, %ecx
movl 0x4(%rsp), %eax
cmpl %ecx, %eax
jge 0x70efd
movq 0x8(%rsp), %rdi
movl 0x14(%rsp), %esi
movsd 0x125170(%rip), %xmm0   # 0x196068
callq 0x6f210
jmp 0x70ea4
movq 0x18(%rsp), %rdi
callq 0x229c0
movl $0x1, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopw (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Shapes/R3MeshProperty.cpp
// Function: gaps::R3MeshProperty::Write(char const*) const
int R3MeshProperty::
Write(const char *filename) const
{
  // Parse input filename extension
  const char *extension;
  if (!(extension = strrchr(filename, '.'))) {
    printf("Filename %s has no extension (e.g., .arff)\n", filename);
    return 0;
  }

  // Write file of appropriate type
  if (!strcmp(extension, ".arff")) return WriteARFF(filename);
  else if (!strcmp(extension, ".txt")) return WriteValues(filename);
  else if (!strcmp(extension, ".val")) return WriteValues(filename);
  else if (!strcmp(extension, ".dat")) return WriteValues(filename);

  // None of the extensions matched
  RNFail("Unable to write file %s (unrecognized extension: %s)\n", filename, extension);
  return 0;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
movq 0x18(%rsp), %rax
movq %rax, (%rsp)
movq 0x10(%rsp), %rdi
movl $0x2e, %esi
callq 0x22b00
movq %rax, 0x8(%rsp)
cmpq $0x0, %rax
jne 0x70f71
movq 0x10(%rsp), %rsi
leaq 0x126f8a(%rip), %rdi    # 0x197ee7
movb $0x0, %al
callq 0x22090
movl $0x0, 0x24(%rsp)
jmp 0x71042
movq 0x8(%rsp), %rdi
leaq 0x126f96(%rip), %rsi    # 0x197f13
callq 0x22ea0
cmpl $0x0, %eax
jne 0x70f9e
movq (%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x71050
movl %eax, 0x24(%rsp)
jmp 0x71042
movq 0x8(%rsp), %rdi
leaq 0x125773(%rip), %rsi    # 0x19671d
callq 0x22ea0
cmpl $0x0, %eax
jne 0x70fc8
movq (%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x711e0
movl %eax, 0x24(%rsp)
jmp 0x71042
movq 0x8(%rsp), %rdi
leaq 0x12731d(%rip), %rsi    # 0x1982f1
callq 0x22ea0
cmpl $0x0, %eax
jne 0x70ff2
movq (%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x711e0
movl %eax, 0x24(%rsp)
jmp 0x71042
movq 0x8(%rsp), %rdi
leaq 0x1272f8(%rip), %rsi    # 0x1982f6
callq 0x22ea0
cmpl $0x0, %eax
jne 0x7101c
movq (%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x711e0
movl %eax, 0x24(%rsp)
jmp 0x71042
jmp 0x7101e
jmp 0x71020
jmp 0x71022
movq 0x10(%rsp), %rsi
movq 0x8(%rsp), %rdx
leaq 0x12573f(%rip), %rdi    # 0x196772
movb $0x0, %al
callq 0xfbc30
movl $0x0, 0x24(%rsp)
movl 0x24(%rsp), %eax
addq $0x28, %rsp
retq
nopl (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Shapes/R3MeshProperty.cpp
// Function: gaps::R3MeshProperty::WriteARFF(char const*) const
int R3MeshProperty::
WriteARFF(const char *filename) const
{
  // Open file
  FILE *fp = fopen(filename, "w");
  if (!fp) {
    RNFail("Unable to open ARFF file: %s\n", filename);
    return 0;
  }

  // Write header
  const char *mesh_name = (mesh->Name()) ? mesh->Name() : "Mesh";
  fprintf(fp, "@relation %s\n\n", mesh_name);

  // Write names
  const char *property_name = (Name()) ? Name() : "Property";
  fprintf(fp, "@attribute %s real\n", property_name);

  // Write values
  fprintf(fp, "\n@data\n\n");
  for (int i = 0; i < mesh->NVertices(); i++) {
    fprintf(fp, "%g\n", VertexValue(i));
  }

  // Close file
  fclose(fp);

  // Return success
  return 1;
}

// Assembly:
subq $0x68, %rsp
movq %rdi, 0x58(%rsp)
movq %rsi, 0x50(%rsp)
movq 0x58(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x50(%rsp), %rdi
leaq 0x128b4a(%rip), %rsi    # 0x199bbe
callq 0x22bf0
movq %rax, 0x48(%rsp)
cmpq $0x0, 0x48(%rsp)
jne 0x710a6
movq 0x50(%rsp), %rsi
leaq 0x126e96(%rip), %rdi    # 0x197f28
movb $0x0, %al
callq 0xfbc30
movl $0x0, 0x64(%rsp)
jmp 0x711d2
movq 0x28(%rsp), %rax
movq (%rax), %rdi
callq 0x6c200
cmpq $0x0, %rax
je 0x710cd
movq 0x28(%rsp), %rax
movq (%rax), %rdi
callq 0x6c200
movq %rax, 0x20(%rsp)
jmp 0x710db
leaq 0x12749d(%rip), %rax    # 0x198571
movq %rax, 0x20(%rsp)
jmp 0x710db
movq 0x20(%rsp), %rax
movq %rax, 0x40(%rsp)
movq 0x48(%rsp), %rdi
movq 0x40(%rsp), %rdx
leaq 0x127205(%rip), %rsi    # 0x1982fb
movb $0x0, %al
callq 0x22f10
movq 0x28(%rsp), %rdi
callq 0x2adf0
cmpq $0x0, %rax
je 0x7111e
movq 0x28(%rsp), %rdi
callq 0x2adf0
movq %rax, 0x18(%rsp)
jmp 0x7112c
leaq 0x1457b8(%rip), %rax    # 0x1b68dd
movq %rax, 0x18(%rsp)
jmp 0x7112c
movq 0x18(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x48(%rsp), %rdi
movq 0x38(%rsp), %rdx
leaq 0x1271c3(%rip), %rsi    # 0x19830a
movb $0x0, %al
callq 0x22f10
movq 0x48(%rsp), %rdi
leaq 0x1271c4(%rip), %rsi    # 0x19831e
movb $0x0, %al
callq 0x22f10
movl $0x0, 0x34(%rsp)
movq 0x28(%rsp), %rax
movl 0x34(%rsp), %ecx
movl %ecx, 0x14(%rsp)
movq (%rax), %rdi
callq 0x2abd0
movl %eax, %ecx
movl 0x14(%rsp), %eax
cmpl %ecx, %eax
jge 0x711c0
movq 0x28(%rsp), %rdi
movq 0x48(%rsp), %rax
movq %rax, 0x8(%rsp)
movl 0x34(%rsp), %esi
callq 0x2b0a0
movq 0x8(%rsp), %rdi
leaq 0x126840(%rip), %rsi    # 0x1979ec
movb $0x1, %al
callq 0x22f10
movl 0x34(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x34(%rsp)
jmp 0x71169
movq 0x48(%rsp), %rdi
callq 0x229c0
movl $0x1, 0x64(%rsp)
movl 0x64(%rsp), %eax
addq $0x68, %rsp
retq
nopl (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Shapes/R3MeshProperty.cpp
// Function: gaps::R3MeshProperty::WriteValues(char const*) const
int R3MeshProperty::
WriteValues(const char *filename) const
{
  // Open file
  FILE *fp = fopen(filename, "w");
  if (!fp) {
    RNFail("Unable to open values file: %s\n", filename);
    return 0;
  }

  // Write values
  for (int i = 0; i < mesh->NVertices(); i++) {
    fprintf(fp, "%g\n", values[i]);
  }

  // Close file
  fclose(fp);

  // Return success
  return 1;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movq 0x28(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %rdi
leaq 0x1289ba(%rip), %rsi    # 0x199bbe
callq 0x22bf0
movq %rax, 0x18(%rsp)
cmpq $0x0, 0x18(%rsp)
jne 0x71233
movq 0x20(%rsp), %rsi
leaq 0x127272(%rip), %rdi    # 0x198494
movb $0x0, %al
callq 0xfbc30
movl $0x0, 0x34(%rsp)
jmp 0x712a2
movl $0x0, 0x14(%rsp)
movq 0x8(%rsp), %rax
movl 0x14(%rsp), %ecx
movl %ecx, 0x4(%rsp)
movq (%rax), %rdi
callq 0x2abd0
movl %eax, %ecx
movl 0x4(%rsp), %eax
cmpl %ecx, %eax
jge 0x71290
movq 0x8(%rsp), %rax
movq 0x18(%rsp), %rdi
movq 0x410(%rax), %rax
movslq 0x14(%rsp), %rcx
movsd (%rax,%rcx,8), %xmm0
leaq 0x126770(%rip), %rsi    # 0x1979ec
movb $0x1, %al
callq 0x22f10
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x7123b
movq 0x18(%rsp), %rdi
callq 0x229c0
movl $0x1, 0x34(%rsp)
movl 0x34(%rsp), %eax
addq $0x38, %rsp
retq
nopl (%rax,%rax)
// File: tomfunkhouser[P]gaps/pkgs/R3Shapes/./R3Mesh.h
// Function: gaps::R3Mesh::VertexOnVertex(gaps::R3MeshVertex const*, int) const
inline R3MeshVertex *R3Mesh:: 
VertexOnVertex(const R3MeshVertex *v, int k) const
{
  // Returns kth vertex adjacent to vertex (adjacent vertices are not sorted!)
  R3MeshEdge *e = EdgeOnVertex(v, k);
  if (e) return VertexAcrossEdge(e, v);
  else return NULL;
}

// Assembly:
subq $0x38, %rsp
movq %rdi, 0x28(%rsp)
movq %rsi, 0x20(%rsp)
movl %edx, 0x1c(%rsp)
movq 0x28(%rsp), %rdi
movq %rdi, 0x8(%rsp)
movq 0x20(%rsp), %rsi
movl 0x1c(%rsp), %edx
callq 0x6c100
movq %rax, 0x10(%rsp)
cmpq $0x0, 0x10(%rsp)
je 0x71512
movq 0x8(%rsp), %rdi
movq 0x10(%rsp), %rsi
movq 0x20(%rsp), %rdx
callq 0x712f0
movq %rax, 0x30(%rsp)
jmp 0x7151b
movq $0x0, 0x30(%rsp)
movq 0x30(%rsp), %rax
addq $0x38, %rsp
retq
nopw %cs:(%rax,%rax)
nop
// File: biotomas[P]ipasir/app/genipasat/genipasat.c
// Function: die
static void die (const char * fmt, ...) {
  va_list ap;
  fflush (stderr);
  printf ("*** genipasat: ");
  va_start (ap, fmt);
  vprintf (fmt, ap);
  va_end (ap);
  fputc ('\n', stdout);
  fflush (stdout);
  exit (1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
testb %al, %al
je 0x1995
movaps %xmm0, -0xa0(%rbp)
movaps %xmm1, -0x90(%rbp)
movaps %xmm2, -0x80(%rbp)
movaps %xmm3, -0x70(%rbp)
movaps %xmm4, -0x60(%rbp)
movaps %xmm5, -0x50(%rbp)
movaps %xmm6, -0x40(%rbp)
movaps %xmm7, -0x30(%rbp)
movq %r9, -0xa8(%rbp)
movq %r8, -0xb0(%rbp)
movq %rcx, -0xb8(%rbp)
movq %rdx, -0xc0(%rbp)
movq %rsi, -0xc8(%rbp)
movq %rdi, -0x8(%rbp)
movq 0x1f635(%rip), %rax     # 0x20ff8
movq (%rax), %rdi
callq 0x1140
leaq 0x1891c(%rip), %rdi     # 0x1a2ee
movb $0x0, %al
callq 0x10a0
leaq -0x20(%rbp), %rax
leaq -0xd0(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x8, (%rax)
movq -0x8(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x1150
leaq -0x20(%rbp), %rax
movq 0x1f5bb(%rip), %rax     # 0x20fd0
movq (%rax), %rsi
movl $0xa, %edi
callq 0x10f0
movq 0x1f5a7(%rip), %rax     # 0x20fd0
movq (%rax), %rdi
callq 0x1140
movl $0x1, %edi
callq 0x11c0
nopl (%rax,%rax)
// File: biotomas[P]ipasir/app/genipasat/genipasat.c
// Function: msg
static void msg (const char * fmt, ...) {
  va_list ap;
  fflush (stderr);
  printf ("c [genipasat] ");
  va_start (ap, fmt);
  vprintf (fmt, ap);
  va_end (ap);
  fputc ('\n', stdout);
  fflush (stdout);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xe0, %rsp
testb %al, %al
je 0x1a75
movaps %xmm0, -0xa0(%rbp)
movaps %xmm1, -0x90(%rbp)
movaps %xmm2, -0x80(%rbp)
movaps %xmm3, -0x70(%rbp)
movaps %xmm4, -0x60(%rbp)
movaps %xmm5, -0x50(%rbp)
movaps %xmm6, -0x40(%rbp)
movaps %xmm7, -0x30(%rbp)
movq %r9, -0xa8(%rbp)
movq %r8, -0xb0(%rbp)
movq %rcx, -0xb8(%rbp)
movq %rdx, -0xc0(%rbp)
movq %rsi, -0xc8(%rbp)
movq %rdi, -0x8(%rbp)
movq 0x1f555(%rip), %rax     # 0x20ff8
movq (%rax), %rdi
callq 0x1140
leaq 0x1884c(%rip), %rdi     # 0x1a2fe
xorl %eax, %eax
callq 0x10a0
leaq -0xd0(%rbp), %rax
movq %rax, -0x10(%rbp)
leaq 0x10(%rbp), %rax
movq %rax, -0x18(%rbp)
movl $0x30, -0x1c(%rbp)
movl $0x8, -0x20(%rbp)
movq -0x8(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x1150
movq 0x1f4e2(%rip), %rax     # 0x20fd0
movq %rax, -0xd8(%rbp)
movq (%rax), %rsi
movl $0xa, %edi
callq 0x10f0
movq -0xd8(%rbp), %rax
movq (%rax), %rdi
callq 0x1140
addq $0xe0, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: biotomas[P]ipasir/app/genipasat/genipasat.c
// Function: pipeit
static FILE * pipeit (const char * name, const char * fmt) {
  char * cmd = malloc (strlen (name) + strlen (fmt) + 20);
  FILE * res;
  sprintf (cmd, fmt, name);
  res = popen (cmd, "r");
  free (cmd);
  return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
callq 0x1090
movq %rax, -0x28(%rbp)
movq -0x10(%rbp), %rdi
callq 0x1090
movq -0x28(%rbp), %rdi
addq %rax, %rdi
addq $0x14, %rdi
callq 0x1130
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x8(%rbp), %rdx
movb $0x0, %al
callq 0x11b0
movq -0x18(%rbp), %rdi
leaq 0x1b1f0(%rip), %rsi     # 0x1ce08
callq 0x1170
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x1040
movq -0x20(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: biotomas[P]ipasir/app/genipasat/genipasat.c
// Function: perr
static void perr (const char * fmt, ...) {
  va_list ap;
  fflush (stderr);
  printf ("*** genipasat: parse error in '%s' line '%d': ", name, lineno);
  va_start (ap, fmt);
  vprintf (fmt, ap);
  va_end (ap);
  fputc ('\n', stdout);
  fflush (stdout);
  exit (1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
testb %al, %al
je 0x1cb5
movaps %xmm0, -0xa0(%rbp)
movaps %xmm1, -0x90(%rbp)
movaps %xmm2, -0x80(%rbp)
movaps %xmm3, -0x70(%rbp)
movaps %xmm4, -0x60(%rbp)
movaps %xmm5, -0x50(%rbp)
movaps %xmm6, -0x40(%rbp)
movaps %xmm7, -0x30(%rbp)
movq %r9, -0xa8(%rbp)
movq %r8, -0xb0(%rbp)
movq %rcx, -0xb8(%rbp)
movq %rdx, -0xc0(%rbp)
movq %rsi, -0xc8(%rbp)
movq %rdi, -0x8(%rbp)
movq 0x1f315(%rip), %rax     # 0x20ff8
movq (%rax), %rdi
callq 0x1140
movq 0x1f436(%rip), %rsi     # 0x21128
movl 0x1f418(%rip), %edx     # 0x21110
leaq 0x1860e(%rip), %rdi     # 0x1a30d
movb $0x0, %al
callq 0x10a0
leaq -0x20(%rbp), %rax
leaq -0xd0(%rbp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movl $0x30, 0x4(%rax)
movl $0x8, (%rax)
movq -0x8(%rbp), %rdi
leaq -0x20(%rbp), %rsi
callq 0x1150
leaq -0x20(%rbp), %rax
movq 0x1f28e(%rip), %rax     # 0x20fd0
movq (%rax), %rsi
movl $0xa, %edi
callq 0x10f0
movq 0x1f27a(%rip), %rax     # 0x20fd0
movq (%rax), %rdi
callq 0x1140
movl $0x1, %edi
callq 0x11c0
nopl (%rax,%rax)
// File: biotomas[P]ipasir/app/genipasat/genipasat.c
// Function: getime
static double getime (void) {
  struct rusage u;
  double res;
  if (getrusage (RUSAGE_SELF, &u)) return 0;
  res = u.ru_utime.tv_sec + 1e-6 * u.ru_utime.tv_usec;
  res += u.ru_stime.tv_sec + 1e-6 * u.ru_stime.tv_usec;
  return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
xorl %edi, %edi
leaq -0x98(%rbp), %rsi
callq 0x1190
cmpl $0x0, %eax
je 0x1d98
xorps %xmm0, %xmm0
movsd %xmm0, -0x8(%rbp)
jmp 0x1dfe
cvtsi2sdq -0x98(%rbp), %xmm1
cvtsi2sdq -0x90(%rbp), %xmm0
movsd 0x18256(%rip), %xmm2    # 0x1a008
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0xa0(%rbp)
cvtsi2sdq -0x88(%rbp), %xmm1
cvtsi2sdq -0x80(%rbp), %xmm0
movsd 0x1822f(%rip), %xmm2    # 0x1a008
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
addsd -0xa0(%rbp), %xmm0
movsd %xmm0, -0xa0(%rbp)
movsd -0xa0(%rbp), %xmm0
movsd %xmm0, -0x8(%rbp)
movsd -0x8(%rbp), %xmm0
addq $0xa0, %rsp
popq %rbp
retq
nopl (%rax)
// File: xuchanglong[P]SimpleReactorImplemention-comments/reactor_server_test.cc
// Function: main
int main(int argc, char **argv)
{
    if (argc < 3) {
        fprintf(stderr, "usage: %s ip port\n", argv[0]);
        return EXIT_FAILURE;
    }

    /**
     * 命令行参数，第1个是 IP ，第2个是 port 。
     * （1）启动服务器。
    */
    TimeServer server(argv[1], atoi(argv[2]));
    if (!server.Start()) {
        fprintf(stderr, "start server failed\n");
        return EXIT_FAILURE;
    }
    fprintf(stderr, "server started!\n");

    heap_timer *printtask = new heap_timer(5);
    printtask->cb_func = printHelloworld;

    fprintf(stderr, "register a task which will be run is five seconds!\n");
    g_reactor.RegisterTimerTask(printtask);

    /**
     * （3）向 Reactor 中注册事件处理器：server 。
    */
    g_reactor.RegisterHandler(&server, reactor::kReadEvent);

    while (true) {
        /**
         * （4）监控并分发事件到各个事件处理器。
        */
        g_reactor.HandleEvents();
    }
    return EXIT_SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x3, -0x8(%rbp)
jge 0x36da
movq 0x8912(%rip), %rax      # 0xbfc8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
leaq 0x4974(%rip), %rsi      # 0x803b
movb $0x0, %al
callq 0x3330
movl $0x1, -0x4(%rbp)
jmp 0x3854
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rcx
movq %rcx, -0x78(%rbp)
movq 0x10(%rax), %rdi
callq 0x3360
movq -0x78(%rbp), %rsi
movzwl %ax, %edx
leaq -0x48(%rbp), %rdi
movq %rdi, -0x70(%rbp)
callq 0x3870
movq -0x70(%rbp), %rdi
callq 0x3920
movb %al, -0x61(%rbp)
jmp 0x3711
movb -0x61(%rbp), %al
testb $0x1, %al
jne 0x3758
jmp 0x371a
movq 0x88a7(%rip), %rax      # 0xbfc8
movq (%rax), %rdi
leaq 0x4923(%rip), %rsi      # 0x804e
movb $0x0, %al
callq 0x3330
movl $0x1, -0x4(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x3ad0
jmp 0x3854
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
jmp 0x3849
movq 0x8869(%rip), %rax      # 0xbfc8
movq (%rax), %rdi
leaq 0x48fa(%rip), %rsi      # 0x8063
xorl %eax, %eax
callq 0x3330
movl $0x18, %edi
callq 0x3250
movq %rax, -0x80(%rbp)
jmp 0x3780
movq -0x80(%rbp), %rdi
movl $0x5, %esi
callq 0x3a10
jmp 0x3790
movq -0x80(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
leaq -0x143(%rip), %rcx      # 0x3660
movq %rcx, 0x8(%rax)
movq 0x881a(%rip), %rax      # 0xbfc8
movq (%rax), %rdi
leaq 0x48bc(%rip), %rsi      # 0x8074
xorl %eax, %eax
callq 0x3330
callq 0x3a50
movq %rax, -0x88(%rbp)
jmp 0x37cd
movq -0x88(%rbp), %rax
movq (%rax), %rdi
movq -0x60(%rbp), %rsi
callq 0x6aa0
jmp 0x37e2
callq 0x3a50
movq %rax, -0x90(%rbp)
jmp 0x37f0
movq -0x90(%rbp), %rax
movq (%rax), %rdi
leaq -0x48(%rbp), %rsi
movl $0x1, %edx
callq 0x6870
jmp 0x380a
jmp 0x380c
jmp 0x380e
callq 0x3a50
movq %rax, -0x98(%rbp)
jmp 0x381c
movq -0x98(%rbp), %rax
movq (%rax), %rdi
callq 0x69f0
jmp 0x382d
jmp 0x380c
movq -0x80(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
movl $0x18, %esi
callq 0x3270
leaq -0x48(%rbp), %rdi
callq 0x3ad0
jmp 0x3860
movl -0x4(%rbp), %eax
addq $0xa0, %rsp
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x3390
nopl (%rax)
// File: xuchanglong[P]SimpleReactorImplemention-comments/./eventhandler/timeserver.hpp
// Function: TimeServer::Start()
bool Start()
    {
        m_handle = socket(AF_INET, SOCK_STREAM, 0);
        if (!IsValidHandle(m_handle)) {
            ReportSocketError("socket");
            return false;
        }

        struct sockaddr_in addr;
        addr.sin_family = AF_INET;
        addr.sin_port = htons(m_port);
        addr.sin_addr.s_addr = inet_addr(m_ip.c_str());
        if (bind(m_handle, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
            ReportSocketError("bind");
            return false;
        }

        if (listen(m_handle, 10) < 0) {
            ReportSocketError("listen");
            return false;
        }
        return true;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x30a0
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0x8(%rax)
movl 0x8(%rax), %edi
callq 0x35f0
testb $0x1, %al
jne 0x396f
leaq 0x4817(%rip), %rdi      # 0x8178
callq 0x3610
movb $0x0, -0x1(%rbp)
jmp 0x39f8
movq -0x28(%rbp), %rax
movw $0x2, -0x20(%rbp)
movzwl 0x30(%rax), %edi
callq 0x3050
movq -0x28(%rbp), %rdi
movw %ax, -0x1e(%rbp)
addq $0x10, %rdi
callq 0x3110
movq %rax, %rdi
callq 0x3260
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, -0x1c(%rbp)
movl 0x8(%rax), %edi
leaq -0x20(%rbp), %rsi
movl $0x10, %edx
callq 0x3060
cmpl $0x0, %eax
jge 0x39cc
leaq 0x47be(%rip), %rdi      # 0x817f
callq 0x3610
movb $0x0, -0x1(%rbp)
jmp 0x39f8
movq -0x28(%rbp), %rax
movl 0x8(%rax), %edi
movl $0xa, %esi
callq 0x32d0
cmpl $0x0, %eax
jge 0x39f4
leaq 0x479b(%rip), %rdi      # 0x8184
callq 0x3610
movb $0x0, -0x1(%rbp)
jmp 0x39f8
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: xuchanglong[P]SimpleReactorImplemention-comments/./eventhandler/timeserver.hpp
// Function: TimeServer::HandleRead()
virtual void HandleRead()
    {
        struct sockaddr addr;
        socklen_t addrlen = sizeof(addr);
        reactor::handle_t handle = accept(m_handle, &addr, &addrlen);
        if (!IsValidHandle(handle)) {
            ReportSocketError("accept");
        } else {
            /**
             * 对该新连接注册读写事件。
            */
            RequestHandler *handler = new RequestHandler(handle);
            if (g_reactor.RegisterHandler(handler, reactor::kReadEvent) != 0) {
                fprintf(stderr, "error: register handler failed\n");
                delete handler;
            }
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl $0x10, -0x1c(%rbp)
movl 0x8(%rax), %edi
leaq -0x18(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
callq 0x30c0
movl %eax, -0x20(%rbp)
movl -0x20(%rbp), %edi
callq 0x35f0
testb $0x1, %al
jne 0x3c77
leaq 0x4465(%rip), %rdi      # 0x80d2
callq 0x3610
jmp 0x3d08
movl $0x10, %edi
callq 0x3250
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0x40(%rbp)
movl -0x20(%rbp), %esi
callq 0x4010
jmp 0x3c95
movq -0x40(%rbp), %rax
movq %rax, -0x28(%rbp)
callq 0x3a50
movq (%rax), %rdi
movq -0x28(%rbp), %rsi
movl $0x1, %edx
callq 0x6870
cmpl $0x0, %eax
je 0x3d06
movq 0x8309(%rip), %rax      # 0xbfc8
movq (%rax), %rdi
leaq 0x4410(%rip), %rsi      # 0x80d9
movb $0x0, %al
callq 0x3330
movq -0x28(%rbp), %rax
movq %rax, -0x48(%rbp)
cmpq $0x0, %rax
je 0x3ce8
movq -0x48(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x3d06
movq -0x40(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
movl $0x10, %esi
callq 0x3270
jmp 0x3d0e
jmp 0x3d08
addq $0x50, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x3390
nopw (%rax,%rax)
// File: xuchanglong[P]SimpleReactorImplemention-comments/./eventhandler/timeserver.hpp
// Function: RequestHandler::HandleRead()
virtual void HandleRead()
    {
        memset(g_read_buffer, 0, sizeof(g_read_buffer));
        int len = recv(m_handle, g_read_buffer, BUFFERSIZE, 0);
        if (len > 0) {
            if (strncasecmp("time", g_read_buffer, 4) == 0) {
                g_reactor.RegisterHandler(this, reactor::kWriteEvent);
            } else if (strncasecmp("exit", g_read_buffer, 4) == 0) {
                close(m_handle);
                g_reactor.RemoveHandler(this);
                delete this;
            } else {
                fprintf(stderr, "Invalid request: %s", g_read_buffer);
                close(m_handle);
                g_reactor.RemoveHandler(this);
                delete this;
            }
        } else {
            ReportSocketError("recv");
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
leaq 0x8155(%rip), %rdi      # 0xc230
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x3170
movq -0x18(%rbp), %rax
movl 0x8(%rax), %edi
leaq 0x813b(%rip), %rsi      # 0xc230
movl $0x400, %edx            # imm = 0x400
xorl %ecx, %ecx
callq 0x30d0
movl %eax, -0xc(%rbp)
cmpl $0x0, -0xc(%rbp)
jle 0x41ec
leaq 0x3fe4(%rip), %rdi      # 0x80f9
leaq 0x8114(%rip), %rsi      # 0xc230
movl $0x4, %edx
callq 0x3300
cmpl $0x0, %eax
jne 0x4146
callq 0x3a50
movq -0x18(%rbp), %rsi
movq (%rax), %rdi
movl $0x2, %edx
callq 0x6870
jmp 0x41ea
leaq 0x3fb1(%rip), %rdi      # 0x80fe
leaq 0x80dc(%rip), %rsi      # 0xc230
movl $0x4, %edx
callq 0x3300
cmpl $0x0, %eax
jne 0x4196
movq -0x18(%rbp), %rax
movl 0x8(%rax), %edi
callq 0x33d0
callq 0x3a50
movq -0x18(%rbp), %rsi
movq (%rax), %rdi
callq 0x6950
movq -0x18(%rbp), %rax
cmpq $0x0, %rax
je 0x4194
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x41e8
movq 0x7e2b(%rip), %rax      # 0xbfc8
movq (%rax), %rdi
leaq 0x3f5c(%rip), %rsi      # 0x8103
leaq 0x8082(%rip), %rdx      # 0xc230
movb $0x0, %al
callq 0x3330
movq -0x18(%rbp), %rax
movl 0x8(%rax), %edi
callq 0x33d0
callq 0x3a50
movq -0x18(%rbp), %rsi
movq (%rax), %rdi
callq 0x6950
movq -0x18(%rbp), %rax
cmpq $0x0, %rax
je 0x41e6
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x41e8
jmp 0x41ea
jmp 0x41f8
leaq 0x3f24(%rip), %rdi      # 0x8117
callq 0x3610
addq $0x20, %rsp
popq %rbp
retq
nop
// File: xuchanglong[P]SimpleReactorImplemention-comments/./eventhandler/timeserver.hpp
// Function: RequestHandler::HandleWrite()
virtual void HandleWrite()
    {
        struct tm *ttime;
        char now[64];
        time_t tt;

        memset(now, 0, 64);
        tt = time(nullptr);
        ttime = localtime(&tt);
        strftime(now, 64, "%Y-%m-%d %H:%M:%S", ttime);

        memset(g_write_buffer, 0, sizeof(g_write_buffer));
        int len = sprintf(g_write_buffer, "current time: %s\r\n", now);
        len = send(m_handle, g_write_buffer, len, 0);
        if (len > 0) {
            fprintf(stderr, "send response to client, fd=%d\n", (int)m_handle);
            g_reactor.RegisterHandler(this, reactor::kReadEvent);
        } else {
            ReportSocketError("send");
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq -0x50(%rbp), %rdi
xorl %esi, %esi
movl $0x40, %edx
callq 0x3170
xorl %eax, %eax
movl %eax, %edi
callq 0x3240
movq %rax, -0x58(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x31e0
movq %rax, -0x10(%rbp)
leaq -0x50(%rbp), %rdi
movq -0x10(%rbp), %rcx
movl $0x40, %esi
leaq 0x3eca(%rip), %rdx      # 0x811c
callq 0x3210
leaq 0x83d2(%rip), %rdi      # 0xc630
xorl %esi, %esi
movl $0x400, %edx            # imm = 0x400
callq 0x3170
leaq -0x50(%rbp), %rdx
leaq 0x83bb(%rip), %rdi      # 0xc630
leaq 0x3eb2(%rip), %rsi      # 0x812e
movb $0x0, %al
callq 0x3090
movl %eax, %ecx
movq -0x68(%rbp), %rax
movl %ecx, -0x5c(%rbp)
movl 0x8(%rax), %edi
movslq -0x5c(%rbp), %rdx
leaq 0x8396(%rip), %rsi      # 0xc630
xorl %ecx, %ecx
callq 0x3150
movl %eax, -0x5c(%rbp)
cmpl $0x0, -0x5c(%rbp)
jle 0x42e1
movq -0x68(%rbp), %rax
movq 0x7d13(%rip), %rcx      # 0xbfc8
movq (%rcx), %rdi
movl 0x8(%rax), %edx
leaq 0x3e7f(%rip), %rsi      # 0x8141
movb $0x0, %al
callq 0x3330
callq 0x3a50
movq -0x68(%rbp), %rsi
movq (%rax), %rdi
movl $0x1, %edx
callq 0x6870
jmp 0x42ed
leaq 0x3e79(%rip), %rdi      # 0x8161
callq 0x3610
addq $0x70, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nopl (%rax)
// File: xuchanglong[P]SimpleReactorImplemention-comments/./eventhandler/timeserver.hpp
// Function: RequestHandler::HandleError()
virtual void HandleError()
    {
        fprintf(stderr, "client %d closed\n", m_handle);
        close(m_handle);
        g_reactor.RemoveHandler(this);
        delete this;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x10, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x10(%rbp)
movq 0x7cad(%rip), %rcx      # 0xbfc8
movq (%rcx), %rdi
movl 0x8(%rax), %edx
leaq 0x3e3e(%rip), %rsi      # 0x8166
movb $0x0, %al
callq 0x3330
movq -0x10(%rbp), %rax
movl 0x8(%rax), %edi
callq 0x33d0
callq 0x3a50
movq -0x10(%rbp), %rsi
movq (%rax), %rdi
callq 0x6950
movq -0x10(%rbp), %rax
cmpq $0x0, %rax
je 0x4360
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
callq *0x8(%rax)
addq $0x10, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: xuchanglong[P]SimpleReactorImplemention-comments/eventDemultiplexer/event_demultiplexer.cc
// Function: reactor::EpollDemultiplexer::RequestEvent(int, unsigned int)
int EpollDemultiplexer::RequestEvent(handle_t handle, event_t evt)
{
    epoll_event ep_evt;
    ep_evt.data.fd = handle;
    ep_evt.events = 0;

    if (evt & kReadEvent) {
        ep_evt.events |= EPOLLIN;
    }
    if (evt & kWriteEvent) {
        ep_evt.events |= EPOLLOUT;
    }
    ep_evt.events |= EPOLLONESHOT;

    if (epoll_ctl(m_epoll_fd, EPOLL_CTL_MOD, handle, &ep_evt) != 0) {
        if (errno == ENOENT) {
            if (epoll_ctl(m_epoll_fd, EPOLL_CTL_ADD, handle, &ep_evt) != 0) {
                return -errno;
            }
            ++m_fd_num;
        }
    }
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl -0x18(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x474b
movl -0x24(%rbp), %eax
orl $0x1, %eax
movl %eax, -0x24(%rbp)
movl -0x18(%rbp), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x475f
movl -0x24(%rbp), %eax
orl $0x4, %eax
movl %eax, -0x24(%rbp)
movq -0x30(%rbp), %rax
movl -0x24(%rbp), %ecx
orl $0x40000000, %ecx       # imm = 0x40000000
movl %ecx, -0x24(%rbp)
movl 0x8(%rax), %edi
movl -0x14(%rbp), %edx
movl $0x3, %esi
leaq -0x24(%rbp), %rcx
callq 0x3320
cmpl $0x0, %eax
je 0x47cf
callq 0x3040
cmpl $0x2, (%rax)
jne 0x47cd
movq -0x30(%rbp), %rax
movl 0x8(%rax), %edi
movl -0x14(%rbp), %edx
movl $0x1, %esi
leaq -0x24(%rbp), %rcx
callq 0x3320
cmpl $0x0, %eax
je 0x47c0
callq 0x3040
movq %rax, %rcx
xorl %eax, %eax
subl (%rcx), %eax
movl %eax, -0x4(%rbp)
jmp 0x47d6
movq -0x30(%rbp), %rax
movl 0xc(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0xc(%rax)
jmp 0x47cf
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop
// File: xuchanglong[P]SimpleReactorImplemention-comments/eventDemultiplexer/event_demultiplexer.cc
// Function: reactor::EpollDemultiplexer::UnrequestEvent(int)
int EpollDemultiplexer::UnrequestEvent(handle_t handle)
{
    epoll_event ep_evt;
    if (epoll_ctl(m_epoll_fd, EPOLL_CTL_DEL, handle, &ep_evt) != 0) {
        return -errno;
    }
    --m_fd_num;
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movl 0x8(%rax), %edi
movl -0x14(%rbp), %edx
movl $0x2, %esi
leaq -0x20(%rbp), %rcx
callq 0x3320
cmpl $0x0, %eax
je 0x4821
callq 0x3040
movq %rax, %rcx
xorl %eax, %eax
subl (%rcx), %eax
movl %eax, -0x4(%rbp)
jmp 0x4835
movq -0x28(%rbp), %rax
movl 0xc(%rax), %ecx
addl $-0x1, %ecx
movl %ecx, 0xc(%rax)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nop
// File: xuchanglong[P]SimpleReactorImplemention-comments/./other/timeheap.hpp
// Function: time_heap::tick()
void tick()
    {
        heap_timer *tmp = array[0];
        time_t cur = time(nullptr);
        while (!empty()) {
            if (!tmp) {
                break;
            }
            if (tmp->expire > cur) {
                break;
            }
            if (array[0]->cb_func) {
                array[0]->cb_func(array[0]->user_data);
            }
            pop_timer();
            tmp = array[0];
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq (%rax), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x3240
movq %rax, -0x18(%rbp)
movq -0x20(%rbp), %rdi
callq 0x4bf0
xorb $-0x1, %al
testb $0x1, %al
jne 0x4b0c
jmp 0x4b68
cmpq $0x0, -0x10(%rbp)
jne 0x4b15
jmp 0x4b68
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpq -0x18(%rbp), %rax
jle 0x4b24
jmp 0x4b68
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
cmpq $0x0, 0x8(%rax)
je 0x4b4f
movq -0x20(%rbp), %rcx
movq (%rcx), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq (%rcx), %rcx
movq (%rcx), %rcx
movq 0x10(%rcx), %rdi
callq *%rax
movq -0x20(%rbp), %rdi
callq 0x4c10
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
jmp 0x4afb
addq $0x20, %rsp
popq %rbp
retq
nop
// File: xuchanglong[P]SimpleReactorImplemention-comments/./other/timeheap.hpp
// Function: time_heap::pop_timer()
void pop_timer()
    {
        if (empty()) {
            return;
        }
        if (array[0]) {
            delete array[0];
            cur_size--;
            if (cur_size == 0) {
                // 若最小堆数据为空，则不进行重新排布。
                array[0] = nullptr;
            } else {
                array[0] = array[cur_size];
                percolate_down(0);
            }
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x10(%rbp)
callq 0x4bf0
testb $0x1, %al
jne 0x4c2f
jmp 0x4c31
jmp 0x4ca7
movq -0x10(%rbp), %rax
movq (%rax), %rax
cmpq $0x0, (%rax)
je 0x4ca7
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
je 0x4c60
movq -0x18(%rbp), %rdi
movl $0x18, %esi
callq 0x3270
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x10(%rax)
cmpq $0x0, 0x10(%rax)
jne 0x4c87
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq $0x0, (%rax)
jmp 0x4ca5
movq -0x10(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rdi), %rcx
movq (%rax,%rcx,8), %rcx
movq (%rdi), %rax
movq %rcx, (%rax)
xorl %eax, %eax
movl %eax, %esi
callq 0x4cb0
jmp 0x4ca7
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: xuchanglong[P]SimpleReactorImplemention-comments/./other/timeheap.hpp
// Function: time_heap::percolate_down(unsigned long)
void percolate_down(size_t hole)
    {
        heap_timer *temp = array[hole];
        size_t child = 0;
        for (; ((hole * 2 + 1) <= (cur_size - 1)); hole = child) {
            child = hole * 2 + 1;
            if ((child < (cur_size - 1)) && (array[child + 1]->expire < array[child]->expire)) {
                ++child;
            }
            if (array[child]->expire < temp->expire) {
                array[hole] = array[child];
            } else {
                break;
            }
        }
        array[hole] = temp;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x18(%rbp)
movq $0x0, -0x20(%rbp)
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
shlq %rax
addq $0x1, %rax
movq 0x10(%rcx), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
ja 0x4d96
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
shlq %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq 0x10(%rcx), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0x4d4e
movq -0x28(%rbp), %rcx
movq (%rcx), %rax
movq -0x20(%rbp), %rdx
movq 0x8(%rax,%rdx,8), %rax
movq (%rax), %rax
movq (%rcx), %rcx
movq -0x20(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
cmpq (%rcx), %rax
jge 0x4d4e
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
cmpq (%rcx), %rax
jge 0x4d85
movq -0x28(%rbp), %rax
movq (%rax), %rcx
movq -0x20(%rbp), %rdx
movq (%rcx,%rdx,8), %rdx
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x4d87
jmp 0x4d96
jmp 0x4d89
movq -0x20(%rbp), %rax
movq %rax, -0x10(%rbp)
jmp 0x4cdb
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rdx
movq (%rax), %rax
movq -0x10(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
popq %rbp
retq
nopl (%rax,%rax)
// File: xuchanglong[P]SimpleReactorImplemention-comments/reactor/reactor.cc
// Function: reactor::ReactorImplementation::RegisterHandler(reactor::EventHandler*, unsigned int)
int ReactorImplementation::RegisterHandler(EventHandler *handler, event_t evt)
{
    if (handler == nullptr) {
        return -1;
    }
    handle_t handle = handler->GetHandle();
    std::map<handle_t, EventHandler *>::iterator it = m_handlers.find(handle);
    if (it == m_handlers.end()) {
        m_handlers[handle] = handler;
    }
    return m_demultiplexer->RequestEvent(handle, evt);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x68cb
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6947
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movq -0x38(%rbp), %rdi
movl %eax, -0x20(%rbp)
addq $0x8, %rdi
leaq -0x20(%rbp), %rsi
callq 0x4990
movq -0x38(%rbp), %rdi
movq %rax, -0x28(%rbp)
addq $0x8, %rdi
callq 0x49c0
movq %rax, -0x30(%rbp)
leaq -0x28(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x56f0
testb $0x1, %al
jne 0x6911
jmp 0x6931
movq -0x38(%rbp), %rdi
movq -0x18(%rbp), %rax
movq %rax, -0x40(%rbp)
addq $0x8, %rdi
leaq -0x20(%rbp), %rsi
callq 0x49f0
movq -0x40(%rbp), %rcx
movq %rcx, (%rax)
movq -0x38(%rbp), %rax
movq (%rax), %rdi
movl -0x20(%rbp), %esi
movl -0x1c(%rbp), %edx
movq (%rdi), %rax
callq *0x18(%rax)
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
// File: xuchanglong[P]SimpleReactorImplemention-comments/reactor/reactor.cc
// Function: reactor::ReactorImplementation::RemoveHandler(reactor::EventHandler*)
int ReactorImplementation::RemoveHandler(EventHandler *handler)
{
    if (handler == nullptr) {
        return -1;
    }

    handle_t handle = handler->GetHandle();
    m_handlers.erase(handle);
    return m_demultiplexer->UnrequestEvent(handle);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x69a8
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x69d9
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movq -0x28(%rbp), %rdi
movl %eax, -0x1c(%rbp)
addq $0x8, %rdi
leaq -0x1c(%rbp), %rsi
callq 0x6d50
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movl -0x1c(%rbp), %esi
movq (%rdi), %rax
callq *0x20(%rax)
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: xuchanglong[P]SimpleReactorImplemention-comments/reactor/reactor.cc
// Function: reactor::ReactorImplementation::HandleEvents()
void ReactorImplementation::HandleEvents()
{
    int timeout = 0;
    if (m_eventtimer->top() == nullptr) {
        timeout = 0;
    } else {
        timeout = ((m_eventtimer->top())->expire - time(nullptr)) * 1000;
    }
    m_demultiplexer->WaitEvents(&m_handlers, timeout, m_eventtimer);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movl $0x0, -0xc(%rbp)
movq 0x38(%rax), %rdi
callq 0x6d80
cmpq $0x0, %rax
jne 0x6a43
movl $0x0, -0xc(%rbp)
jmp 0x6a74
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rdi
callq 0x6d80
movq (%rax), %rax
movq %rax, -0x20(%rbp)
xorl %eax, %eax
movl %eax, %edi
callq 0x3240
movq %rax, %rcx
movq -0x20(%rbp), %rax
subq %rcx, %rax
imulq $0x3e8, %rax, %rax      # imm = 0x3E8
movl %eax, -0xc(%rbp)
movq -0x18(%rbp), %rax
movq (%rax), %rdi
movq %rax, %rsi
addq $0x8, %rsi
movl -0xc(%rbp), %edx
movq 0x38(%rax), %rcx
movq (%rdi), %rax
callq *0x10(%rax)
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
// File: xuchanglong[P]SimpleReactorImplemention-comments/reactor/reactor.cc
// Function: reactor::ReactorImplementation::RegisterTimerTask(heap_timer*)
int ReactorImplementation::RegisterTimerTask(heap_timer *timerevent)
{
    if (timerevent == nullptr) {
        return -1;
    }
    m_eventtimer->add_timer(timerevent);
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x6af8
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6b10
movq -0x20(%rbp), %rax
movq 0x38(%rax), %rdi
movq -0x18(%rbp), %rsi
callq 0x6dd0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)
// File: xuchanglong[P]SimpleReactorImplemention-comments/./other/timeheap.hpp
// Function: time_heap::time_heap(unsigned long)
time_heap(size_t cap)
        : capacity(cap)
        , cur_size(0)
    {
        array = new heap_timer *[capacity];
        if (array == nullptr) {
            throw std::exception();
        }
        for (size_t i = 0; i < capacity; ++i) {
            array[i] = nullptr;
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq $0x0, 0x10(%rax)
movq 0x8(%rax), %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
cmpq $0x0, (%rax)
jne 0x6cea
movl $0x8, %edi
callq 0x3140
movq %rax, %rdi
movq %rdi, -0x28(%rbp)
callq 0x6fb0
movq -0x28(%rbp), %rdi
movq 0x52fa(%rip), %rsi      # 0xbfd8
movq 0x530b(%rip), %rdx      # 0xbff0
callq 0x3380
movq $0x0, -0x18(%rbp)
movq -0x20(%rbp), %rcx
movq -0x18(%rbp), %rax
cmpq 0x8(%rcx), %rax
jae 0x6d21
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x6cf2
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: xuchanglong[P]SimpleReactorImplemention-comments/./other/timeheap.hpp
// Function: time_heap::add_timer(heap_timer*)
int add_timer(heap_timer *timer)
    {
        if (timer == nullptr) {
            return -1;
        }
        if (cur_size >= capacity) {
            resize();
        }
        int hole = cur_size++;
        int parent = 0;
        for (; hole > 0; hole = parent) {
            parent = (hole - 1) / 2;
            if (array[parent]->expire <= timer->expire) {
                break;
            }
            array[hole] = array[parent];
        }
        array[hole] = timer;
        return 0;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x6dfb
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x6ea1
movq -0x28(%rbp), %rcx
movq 0x10(%rcx), %rax
cmpq 0x8(%rcx), %rax
jb 0x6e12
movq -0x28(%rbp), %rdi
callq 0x70c0
movq -0x28(%rbp), %rcx
movq 0x10(%rcx), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x10(%rcx)
movl %eax, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
cmpl $0x0, -0x1c(%rbp)
jle 0x6e87
movl -0x1c(%rbp), %eax
subl $0x1, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x28(%rbp), %rax
movl %ecx, -0x20(%rbp)
movq (%rax), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
cmpq (%rcx), %rax
jg 0x6e65
jmp 0x6e87
movq -0x28(%rbp), %rax
movq (%rax), %rcx
movslq -0x20(%rbp), %rdx
movq (%rcx,%rdx,8), %rdx
movq (%rax), %rax
movslq -0x1c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x20(%rbp), %eax
movl %eax, -0x1c(%rbp)
jmp 0x6e2f
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rdx
movq (%rax), %rax
movslq -0x1c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: xuchanglong[P]SimpleReactorImplemention-comments/./other/timeheap.hpp
// Function: time_heap::resize()
void resize()
    {
        heap_timer **temp = new heap_timer *[2 * capacity];
        for (size_t i = 0; i < 2 * capacity; ++i) {
            temp[i] = nullptr;
        }
        if (!temp) {
            throw std::exception();
        }
        capacity = 2 * capacity;
        for (size_t i = 0; i < cur_size; ++i) {
            temp[i] = array[i];
        }
        delete[] array;
        array = temp;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq 0x8(%rax), %rax
shlq %rax
movl $0x8, %ecx
mulq %rcx
movq %rax, %rdi
seto %cl
movq $-0x1, %rax
testb $0x1, %cl
cmovneq %rax, %rdi
callq 0x3030
movq %rax, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rax
movq 0x8(%rcx), %rcx
shlq %rcx
cmpq %rcx, %rax
jae 0x713a
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x7108
cmpq $0x0, -0x10(%rbp)
jne 0x716e
movl $0x8, %edi
callq 0x3140
movq %rax, %rdi
movq %rdi, -0x30(%rbp)
callq 0x6fb0
movq -0x30(%rbp), %rdi
movq 0x4e76(%rip), %rsi      # 0xbfd8
movq 0x4e87(%rip), %rdx      # 0xbff0
callq 0x3380
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rcx
shlq %rcx
movq %rcx, 0x8(%rax)
movq $0x0, -0x20(%rbp)
movq -0x28(%rbp), %rcx
movq -0x20(%rbp), %rax
cmpq 0x10(%rcx), %rax
jae 0x71bc
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
movq -0x10(%rbp), %rax
movq -0x20(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x7185
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, %rax
je 0x71d6
movq -0x38(%rbp), %rdi
callq 0x3310
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
movq %rcx, (%rax)
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)
// File: rvthak[P]Makefile-Maker/input.cpp
// Function: InputManager(int, char const**, Makefile&)
void InputManager(int argc, char const **argv, Makefile &mk){

	// No parameters
	if(argc==1){ printf(" (i) > No arguments given using defaults..\n"); return; }
	
	// Only one parameter => use it as a name
	else if(argc==2){ 
		if( argv[1][0]!='-' ){
			printf(" (i) > Only one argument given. Using '%s' as a Name\n", argv[1]);
			mk.setName(argv[1]);
			return;
		}
	}

	// More than one parameter
	int count=1; // Start from 2nd argument
	argc=argc-1; // Use argc as a total counter

	while(count<=argc){
		// HandleParameter changes count for ease
		if( HandleParameter(count, argc, argv, mk)!=0 ){ exit(1); } 
	}

	// Compilation Parameter read mode
	if(mk.getCompParam()){ mk.readCompParam(); }

	// Execution Parameter read mode
	if(mk.getExecParam()){ mk.readExecParam(); }

	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
cmpl $0x1, -0x4(%rbp)
jne 0x25fc
leaq 0x3a14(%rip), %rdi      # 0x6004
movb $0x0, %al
callq 0x2050
jmp 0x272c
cmpl $0x2, -0x4(%rbp)
jne 0x26ba
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x26b8
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
leaq 0x3a07(%rip), %rdi      # 0x6030
xorl %eax, %eax
callq 0x2050
movq -0x18(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x60(%rbp)
leaq -0x39(%rbp), %rdi
movq %rdi, -0x58(%rbp)
callq 0x2370
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rdx
leaq -0x38(%rbp), %rdi
callq 0x3ba0
jmp 0x2664
movq -0x68(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x4620
jmp 0x2673
leaq -0x38(%rbp), %rdi
callq 0x2110
leaq -0x39(%rbp), %rdi
callq 0x2210
jmp 0x272c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x26ad
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x2110
leaq -0x39(%rbp), %rdi
callq 0x2210
jmp 0x2732
jmp 0x26ba
jmp 0x26bc
movl $0x1, -0x50(%rbp)
movl -0x4(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x4(%rbp)
movl -0x50(%rbp), %eax
cmpl -0x4(%rbp), %eax
jg 0x26fa
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
leaq -0x50(%rbp), %rdi
leaq -0x4(%rbp), %rsi
callq 0x2740
cmpl $0x0, %eax
je 0x26f8
movl $0x1, %edi
callq 0x2260
jmp 0x26cc
movq -0x18(%rbp), %rdi
callq 0x4500
testb $0x1, %al
jne 0x2709
jmp 0x2712
movq -0x18(%rbp), %rdi
callq 0x4b10
movq -0x18(%rbp), %rdi
callq 0x4520
testb $0x1, %al
jne 0x2721
jmp 0x272a
movq -0x18(%rbp), %rdi
callq 0x4b70
jmp 0x272c
addq $0x70, %rsp
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0x2360
nopl (%rax,%rax)