// File: /workspace/github_c_makefile_star2_O2/bloomsource[P]dns_update/util.c
// Function: write_log_hex
int write_log_hex( char* buf, int buflen )
{
  FILE *fp;
  int i,g,k;
  unsigned char *abuf,*hbuf;


  if ( ( fp = fopen(log_file,"a+")) == NULL) return(-1);

  hbuf = (unsigned char *)buf;
  abuf = (unsigned char *)buf;
  fprintf( fp, "  *** hex message(begin) ***\n" );
  fprintf( fp, "-----------|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|------------------\n" );
  for( i = 0, g = buflen/16; i < g; i++ )
  {
    fprintf( fp, "M(%6.6d)=< ", i*16 );
    for( k = 0; k < 16; k ++) fprintf( fp, "%02x ", *hbuf++ );
        fprintf( fp, "> " );
    for( k = 0; k < 16; k++, abuf++)
        fprintf( fp, "%c", (*abuf>32) ? ((*abuf<128) ? *abuf : '*') : '.');
    fprintf( fp, "\n" );
  }
  if( (i = buflen%16) > 0)
  {
    fprintf( fp, "M(%6.6d)=< ", buflen-buflen%16 );
    for( k = 0; k < i;  k++) fprintf( fp, "%02x ", *hbuf++);
    for( k = i; k < 16; k++) fprintf( fp, "   ");
        fprintf( fp, "> ");
    for( k = 0; k < i; k++, abuf++)
        fprintf( fp, "%c",(*abuf>32) ? ((*abuf<128) ? *abuf : '*') : '.');
    fprintf( fp, "\n");
  }
  fprintf( fp, "-----------|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|--|------------------\n");
  fprintf( fp, "  *** hex message(end) ***\n");
  fflush( fp );
  fclose( fp );
  return(0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, %r14d
movq %rdi, %rbp
leaq 0x97aa(%rip), %rdi      # 0xf1c0
leaq 0x19da(%rip), %rsi      # 0x73f7
callq 0x2230
testq %rax, %rax
je 0x5c37
movq %rax, %rbx
leaq 0x19c5(%rip), %rdi      # 0x73fa
pushq $0x1d
popq %rsi
pushq $0x1
popq %r15
movq %r15, %rdx
movq %rax, %rcx
callq 0x2270
leaq 0x19ca(%rip), %rdi      # 0x7418
pushq $0x4f
popq %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x2270
pushq $0x10
popq %rcx
movl %r14d, 0xc(%rsp)
movl %r14d, %eax
cltd
idivl %ecx
movl %edx, %r12d
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
movl %eax, 0x10(%rsp)
pushq $0x2e
popq %r13
leaq 0x19f1(%rip), %r15      # 0x7474
xorl %edx, %edx
movq %rbp, %r14
movl %r12d, 0x8(%rsp)
cmpl 0x10(%rsp), %edx
je 0x5b34
movl %edx, 0x14(%rsp)
shll $0x4, %edx
movq %rbx, %rdi
leaq 0x19c0(%rip), %rsi      # 0x7468
xorl %eax, %eax
callq 0x21a0
xorl %r12d, %r12d
cmpl $0x10, %r12d
je 0x5acf
movzbl (%r14,%r12), %edx
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x21a0
incq %r12
jmp 0x5ab2
leaq 0x19a4(%rip), %rdi      # 0x747a
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x2270
addq %r12, %r14
xorl %r12d, %r12d
cmpl $0x10, %r12d
je 0x5b16
movzbl (%rbp,%r12), %eax
testb %al, %al
movl %eax, %ecx
pushq $0x2a
popq %rdx
cmovsl %edx, %ecx
cmpb $0x21, %al
cmovbl %r13d, %ecx
movzbl %cl, %edi
movq %rbx, %rsi
callq 0x2150
incq %r12
jmp 0x5aea
pushq $0xa
popq %rdi
movq %rbx, %rsi
callq 0x2150
movl 0x14(%rsp), %edx
incl %edx
addq %r12, %rbp
movl 0x8(%rsp), %r12d
jmp 0x5a8d
testl %r12d, %r12d
jle 0x5bf5
movl 0xc(%rsp), %edx
subl %r12d, %edx
leaq 0x191d(%rip), %rsi      # 0x7468
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21a0
movl %r12d, %r15d
xorl %r12d, %r12d
cmpl %r12d, %r15d
je 0x5b7b
movzbl (%r14,%r12), %edx
movq %rbx, %rdi
leaq 0x1905(%rip), %rsi      # 0x7474
xorl %eax, %eax
callq 0x21a0
incq %r12
jmp 0x5b5b
movl 0x8(%rsp), %r12d
addl $-0x10, %r12d
pushq $0x1
popq %r14
testl %r12d, %r12d
je 0x5ba7
leaq 0x18e9(%rip), %rdi      # 0x747d
pushq $0x3
popq %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x2270
incl %r12d
jmp 0x5b88
leaq 0x18cc(%rip), %rdi      # 0x747a
pushq $0x2
popq %rsi
pushq $0x1
popq %rdx
movq %rbx, %rcx
callq 0x2270
xorl %r14d, %r14d
cmpl %r14d, %r15d
je 0x5bea
movzbl (%rbp,%r14), %eax
testb %al, %al
movl %eax, %ecx
pushq $0x2a
popq %rdx
cmovsl %edx, %ecx
cmpb $0x21, %al
cmovbl %r13d, %ecx
movzbl %cl, %edi
movq %rbx, %rsi
callq 0x2150
incq %r14
jmp 0x5bbf
pushq $0xa
popq %rdi
movq %rbx, %rsi
callq 0x2150
leaq 0x181c(%rip), %rdi      # 0x7418
pushq $0x4f
popq %rsi
pushq $0x1
popq %r14
movq %r14, %rdx
movq %rbx, %rcx
callq 0x2270
leaq 0x186c(%rip), %rdi      # 0x7481
pushq $0x1b
popq %rsi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x2270
movq %rbx, %rdi
callq 0x21d0
movq %rbx, %rdi
callq 0x20e0
xorl %eax, %eax
jmp 0x5c3a
pushq $-0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq