// File: /workspace/github_cpp_makefile_star2_O3/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 0xe33d(%rip), %rdi      # 0x11420
leaq 0x91ac(%rip), %rsi      # 0xc296
callq 0x2270
testq %rax, %rax
je 0x32ea
movq %rax, %rbx
leaq 0xe1fe(%rip), %rdi      # 0x11300
callq 0xa214
leaq 0x93e8(%rip), %rdi      # 0xc4f6
leaq 0xe30b(%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 0x328d
leaq 0x30(%rsp), %r12
leaq 0x40(%rsp), %r14
leaq 0x93ab(%rip), %r15      # 0xc4f3
movq %rbx, 0x18(%rsp)
movb $0x0, 0x23f(%rsp)
movq %r14, %rdi
movl $0xd, %esi
callq 0x20e0
testq %rax, %rax
je 0x316a
movb $0x0, (%rax)
movq %r14, %rdi
movl $0xa, %esi
callq 0x20e0
testq %rax, %rax
je 0x317f
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 0x3274
movq %r13, %rdi
callq 0x2100
cmpq $0x8, %rax
ja 0x3274
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 0xa598
leaq 0xe0dc(%rip), %rdi      # 0x11300
movq %r13, %rsi
callq 0xa15a
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 0x3268
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2230
leaq 0x9284(%rip), %r15      # 0xc4f3
movq 0x18(%rsp), %rbx
movq %r14, %rdi
movl $0x1ff, %esi            # imm = 0x1FF
movq %rbx, %rdx
callq 0x23a0
testq %rax, %rax
jne 0x314d
movq %rbx, %rdi
callq 0x2200
movq 0xe07c(%rip), %rbx      # 0x11318
leaq 0xe065(%rip), %r15      # 0x11308
cmpq %r15, %rbx
je 0x32d1
leaq 0x9260(%rip), %r14      # 0xc50f
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 0x32af
movq 0xe050(%rip), %rsi      # 0x11328
leaq 0x923b(%rip), %rdi      # 0xc51a
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x26fc
jmp 0x3304
leaq 0x8fa7(%rip), %rdi      # 0xc298
leaq 0xe128(%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 0x3332
movq 0x30(%rsp), %rsi
incq %rsi
callq 0x2230
movq %r14, %rdi
callq 0x23f0