// File: /workspace/github_cpp_makefile_star2_O2/st0ne[P]XReflectorPlus/dxrfd.cpp
// Function: open_users(char*)
static int open_users(char *filename)
{
   FILE *fp = NULL;
   char inbuf[512];
   char *p = NULL;
   
   char *gwy_ptr;
   char gwy[9];
   char *host_ptr;
   const char *delim = " \t";
   call_ip_type::iterator pos;

   fp = fopen(filename, "r");
   if (!fp)
   {
      traceit("Failed to open file %s\n", filename);
      return 1;
   }

   call_ip_map.clear();

   traceit("Reading from file: [%s]\n", filename);
   while (fgets(inbuf, 511, fp) != NULL)
   {
      inbuf[511] = '\0';
      p = strchr(inbuf, '\r');
      if (p)
         *p = '\0';
      p = strchr(inbuf, '\n');
      if (p)
         *p = '\0';

      gwy_ptr = strtok(inbuf, delim);
      host_ptr = strtok(NULL, delim);

      if (gwy_ptr && host_ptr)
      {
         if (strlen(gwy_ptr) <= 8)
         {
            memset(gwy, ' ', 9); gwy[8] = '\0';
            memcpy(gwy, gwy_ptr, strlen(gwy_ptr));
            call_ip_map[gwy] = host_ptr;
         }
      }
   }
   fclose(fp);

   for (pos = call_ip_map.begin(); pos != call_ip_map.end(); pos++)
      traceit("[%s],[%s]\n", pos->first.c_str(), pos->second.c_str());
   traceit("Loaded %d entries\n", call_ip_map.size());

   return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x248, %rsp            # imm = 0x248
leaq 0xcffc(%rip), %rdi      # 0x10440
leaq 0x7dcb(%rip), %rsi      # 0xb216
callq 0x22b0
testq %rax, %rax
je 0x35f2
movq %rax, %rbx
leaq 0xcebd(%rip), %rdi      # 0x10320
callq 0x9240
leaq 0x8007(%rip), %rdi      # 0xb476
leaq 0xcfca(%rip), %rsi      # 0x10440
xorl %eax, %eax
callq 0x274c
leaq 0x40(%rsp), %r15
pushq $0xa
popq %r12
leaq 0x7fe6(%rip), %r13      # 0xb473
movq %r15, %rdi
movl $0x1ff, %esi            # imm = 0x1FF
movq %rbx, %rdx
callq 0x23d0
testq %rax, %rax
je 0x3598
movb $0x0, 0x23f(%rsp)
movq %r15, %rdi
pushq $0xd
popq %rsi
callq 0x20f0
testq %rax, %rax
je 0x34c1
movb $0x0, (%rax)
movq %r15, %rdi
movl %r12d, %esi
callq 0x20f0
testq %rax, %rax
je 0x34d4
movb $0x0, (%rax)
movq %r15, %rdi
movq %r13, %rsi
callq 0x23c0
movq %rax, %rbp
xorl %edi, %edi
movq %r13, %rsi
callq 0x23c0
movq %rax, %r14
testq %rbp, %rbp
setne %al
testq %r14, %r14
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x348d
movq %rbp, %rdi
callq 0x2110
cmpq $0x8, %rax
ja 0x348d
movq %r13, %r15
movq %rbx, %r13
movl %r12d, %ebx
movabsq $0x2020202020202020, %rax # imm = 0x2020202020202020
movq %rax, 0x10(%rsp)
movb $0x0, 0x18(%rsp)
movq %rbp, %rdi
callq 0x2110
leaq 0x10(%rsp), %r12
movq %r12, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x21e0
leaq 0x20(%rsp), %rbp
movq %rbp, %rdi
movq %r12, %rsi
leaq 0xf(%rsp), %rdx
callq 0x9204
leaq 0xcdb8(%rip), %rdi      # 0x10320
movq %rbp, %rsi
callq 0x919e
movq %rax, %rdi
movq %r14, %rsi
callq 0x2470
leaq 0x20(%rsp), %rdi
callq 0x2130
movl %ebx, %r12d
movq %r13, %rbx
movq %r15, %r13
leaq 0x40(%rsp), %r15
jmp 0x348d
movq %rbx, %rdi
callq 0x2230
movq 0xcd91(%rip), %r14      # 0x10338
leaq 0xcd7a(%rip), %r15      # 0x10328
leaq 0x7eda(%rip), %rbx      # 0xb48f
cmpq %r15, %r14
je 0x35d9
movq 0x20(%r14), %rsi
movq 0x40(%r14), %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x274c
movq %r14, %rdi
callq 0x2190
movq %rax, %r14
jmp 0x35b5
movq 0xcd68(%rip), %rsi      # 0x10348
leaq 0x7eb3(%rip), %rdi      # 0xb49a
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x274c
jmp 0x360a
leaq 0x7c1f(%rip), %rdi      # 0xb218
leaq 0xce40(%rip), %rsi      # 0x10440
xorl %eax, %eax
callq 0x274c
pushq $0x1
popq %rbx
movl %ebx, %eax
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x2130
movq %rbx, %rdi
callq 0x2420