// File: /workspace/github_cpp_makefile_star2_O1/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 0xe2f1(%rip), %rdi      # 0x11420
leaq 0x9134(%rip), %rsi      # 0xc26a
callq 0x2270
testq %rax, %rax
je 0x3336
movq %rax, %rbx
leaq 0xe1b2(%rip), %rdi      # 0x11300
callq 0xa2ae
leaq 0x9370(%rip), %rdi      # 0xc4ca
leaq 0xe2bf(%rip), %rsi      # 0x11420
xorl %eax, %eax
callq 0x26fc
leaq 0x40(%rsp), %rdi
movl $0x1ff, %esi            # imm = 0x1FF
movq %rbx, %rdx
callq 0x23a0
testq %rax, %rax
je 0x32d9
leaq 0x30(%rsp), %r12
leaq 0x40(%rsp), %r14
leaq 0x9333(%rip), %r15      # 0xc4c7
movq %rbx, 0x18(%rsp)
movb $0x0, 0x23f(%rsp)
movq %r14, %rdi
movl $0xd, %esi
callq 0x20e0
testq %rax, %rax
je 0x31b6
movb $0x0, (%rax)
movq %r14, %rdi
movl $0xa, %esi
callq 0x20e0
testq %rax, %rax
je 0x31cb
movb $0x0, (%rax)
movq %r14, %rdi
movq %r15, %rsi
callq 0x2390
movq %rax, %r13
xorl %edi, %edi
movq %r15, %rsi
callq 0x2390
movq %rax, %rbp
testq %r13, %r13
setne %al
testq %rbp, %rbp
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x32c0
movq %r13, %rdi
callq 0x2100
cmpq $0x8, %rax
ja 0x32c0
movabsq $0x2020202020202020, %rax # imm = 0x2020202020202020
movq %rax, 0x8(%rsp)
movb $0x0, 0x10(%rsp)
movq %r13, %rdi
callq 0x2100
movq %r12, %r15
leaq 0x8(%rsp), %r12
movq %r12, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x21b0
movq %r15, %rbx
movq %r15, 0x20(%rsp)
movq %r12, %rdi
callq 0x2100
leaq (%rsp,%rax), %rdx
addq $0x8, %rdx
leaq 0x20(%rsp), %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0xa632
leaq 0xe090(%rip), %rdi      # 0x11300
movq %r13, %rsi
callq 0xa1f4
movq %rax, %r13
movq 0x8(%rax), %r12
movq %rbp, %rdi
callq 0x2100
movq %r13, %rdi
xorl %esi, %esi
movq %r12, %rdx
movq %rbp, %rcx
movq %rax, %r8
callq 0x2370
movq 0x20(%rsp), %rdi
movq %rbx, %r12
cmpq %rbx, %rdi
je 0x32b4
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2230
leaq 0x920c(%rip), %r15      # 0xc4c7
movq 0x18(%rsp), %rbx
movq %r14, %rdi
movl $0x1ff, %esi            # imm = 0x1FF
movq %rbx, %rdx
callq 0x23a0
testq %rax, %rax
jne 0x3199
movq %rbx, %rdi
callq 0x2200
movq 0xe030(%rip), %rbx      # 0x11318
leaq 0xe019(%rip), %r15      # 0x11308
cmpq %r15, %rbx
je 0x331d
leaq 0x91e8(%rip), %r14      # 0xc4e3
movq 0x20(%rbx), %rsi
movq 0x40(%rbx), %rdx
movq %r14, %rdi
xorl %eax, %eax
callq 0x26fc
movq %rbx, %rdi
callq 0x2170
movq %rax, %rbx
cmpq %r15, %rax
jne 0x32fb
movq 0xe004(%rip), %rsi      # 0x11328
leaq 0x91c3(%rip), %rdi      # 0xc4ee
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x26fc
jmp 0x3350
leaq 0x8f2f(%rip), %rdi      # 0xc26c
leaq 0xe0dc(%rip), %rsi      # 0x11420
xorl %eax, %eax
callq 0x26fc
movl $0x1, %ebx
movl %ebx, %eax
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq 0x20(%rsp), %rdi
cmpq %rbx, %rdi
je 0x337e
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2230
movq %r14, %rdi
callq 0x23f0