// File: /workspace/github_cpp_makefile_star2_O1/st0ne[P]XReflectorPlus/dxrfd.cpp
// Function: open_blocks(char*)
static int open_blocks(char *filename)
{
   FILE *fp = NULL;
   char inbuf[512];
   char *p = NULL;
   blocks_type::iterator pos;
   short int i;

   char *call_ptr;
   char call[9];
   const char *delim = " \t";

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

   blocks.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';

      call_ptr = strtok(inbuf, delim);
      if (call_ptr)
      {
         if (strlen(call_ptr) <= 8)
         {
            memset(call, ' ', 9); call[8] = '\0';
            memcpy(call, call_ptr, strlen(call_ptr));

            for (i = 0; i < CALL_SIZE; i++)
            {
               if (call[i] == '_')
                  call[i] = ' ';
            }

            blocks.insert(call);
         }
      }
   }
   fclose(fp);

   traceit("BEGIN listing blocked callsigns...%d calls blocked\n", blocks.size());
   for (pos = blocks.begin(); pos != blocks.end(); pos++)
      traceit("--->[%s]\n", pos->c_str());
   traceit("END listing blocked callsigns\n");

   return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x238, %rsp            # imm = 0x238
leaq 0xf092(%rip), %rdi      # 0x12430
leaq 0x8ec5(%rip), %rsi      # 0xc26a
callq 0x2270
testq %rax, %rax
je 0x3566
movq %rax, %rbx
leaq 0xdf73(%rip), %rdi      # 0x11330
callq 0xa6c2
leaq 0x9101(%rip), %rdi      # 0xc4ca
leaq 0xf060(%rip), %rsi      # 0x12430
xorl %eax, %eax
callq 0x26fc
leaq 0x30(%rsp), %rdi
movl $0x1ff, %esi            # imm = 0x1FF
movq %rbx, %rdx
callq 0x23a0
testq %rax, %rax
je 0x34ff
leaq 0x30(%rsp), %r14
leaq 0x90c9(%rip), %r15      # 0xc4c7
movq %rsp, %r12
leaq 0x10(%rsp), %r13
movb $0x0, 0x22f(%rsp)
movq %r14, %rdi
movl $0xd, %esi
callq 0x20e0
testq %rax, %rax
je 0x3423
movb $0x0, (%rax)
movq %r14, %rdi
movl $0xa, %esi
callq 0x20e0
testq %rax, %rax
je 0x3438
movb $0x0, (%rax)
movq %r14, %rdi
movq %r15, %rsi
callq 0x2390
testq %rax, %rax
je 0x34e6
movq %rax, %rbp
movq %rax, %rdi
callq 0x2100
cmpq $0x8, %rax
ja 0x34e6
movabsq $0x2020202020202020, %rax # imm = 0x2020202020202020
movq %rax, (%rsp)
movb $0x0, 0x8(%rsp)
movq %rbp, %rdi
callq 0x2100
movq %r12, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x21b0
xorl %eax, %eax
leaq 0x20(%rsp), %rbp
cmpb $0x5f, (%rsp,%rax)
jne 0x349b
movb $0x20, (%rsp,%rax)
incq %rax
cmpq $0x8, %rax
jne 0x3491
movq %rbp, 0x10(%rsp)
movq %r12, %rdi
callq 0x2100
leaq (%rsp,%rax), %rdx
movq %r13, %rdi
movq %r12, %rsi
callq 0xa632
leaq 0xde69(%rip), %rdi      # 0x11330
movq %r13, %rsi
callq 0xa6f0
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x34e6
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2230
movq %r14, %rdi
movl $0x1ff, %esi            # imm = 0x1FF
movq %rbx, %rdx
callq 0x23a0
testq %rax, %rax
jne 0x3406
movq %rbx, %rdi
callq 0x2200
movq 0xde4a(%rip), %rsi      # 0x11358
leaq 0x9016(%rip), %rdi      # 0xc52b
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x26fc
movq 0xde23(%rip), %r14      # 0x11348
leaq 0xde0c(%rip), %r12      # 0x11338
cmpq %r12, %r14
je 0x3556
leaq 0x9027(%rip), %r15      # 0xc55f
movq 0x20(%r14), %rsi
movq %r15, %rdi
xorl %eax, %eax
callq 0x26fc
movq %r14, %rdi
callq 0x2260
movq %rax, %r14
cmpq %r12, %rax
jne 0x3538
leaq 0x900c(%rip), %rdi      # 0xc569
xorl %eax, %eax
callq 0x26fc
jmp 0x3580
leaq 0x8cff(%rip), %rdi      # 0xc26c
leaq 0xeebc(%rip), %rsi      # 0x12430
xorl %eax, %eax
callq 0x26fc
movl $0x1, %ebx
movl %ebx, %eax
addq $0x238, %rsp            # imm = 0x238
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %rbp, %rdi
je 0x35ae
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2230
movq %rbx, %rdi
callq 0x23f0