// File: /workspace/github_cpp_makefile_star2_O3/st0ne[P]XReflectorPlus/dxrfd.cpp
// Function: playback(void*)
static void *playback(void *arg)
{
   struct rcd *temp_rcd = (struct rcd *)arg;
   struct sigaction act;
   unsigned short int j;
   unsigned short int i;
   struct timespec nanos;

   act.sa_handler = sigCatch;
   sigemptyset(&act.sa_mask);
   act.sa_flags = SA_RESTART;
   if (sigaction(SIGTERM, &act, 0) != 0)
   {
      traceit("sigaction-TERM failed, error=%d\n", errno);
      keep_running = false;
      pthread_exit(NULL);
   }
   if (sigaction(SIGINT, &act, 0) != 0)
   {
      traceit("sigaction-INT failed, error=%d\n", errno);
      keep_running = false;
      pthread_exit(NULL);
   }

   /* delay 5 seconds here */
   sleep(5);

   /***
   if (temp_rcd->recvlen == 56)
      traceit("playback started for user=%.8s, streamid %d,%d\n", 
            &(temp_rcd->data[0][42]), temp_rcd->data[0][12], temp_rcd->data[0][13]);
   else
      traceit("playback started for user=%.8s, streamid %d,%d\n",
            &(temp_rcd->data[0][44]), temp_rcd->data[0][14], temp_rcd->data[0][15]);
   ***/

   /* first packet is header */

   /*** MUST CHANGE rpt1 and rpt2 if temp_rcd->recvlen is 58 ***/
   for (j = 0; j < 5; j++)
      sendto(ref_sock, (char *)temp_rcd->data[0], temp_rcd->recvlen, 0,
             (struct sockaddr *)&(temp_rcd->sin),
             sizeof(struct sockaddr_in));

   /*** header sent ***/
   i = 1;
   
   while ((keep_running) && (i < temp_rcd->idx))
   {
      time(&(temp_rcd->ts));
      sendto(ref_sock, (char *)temp_rcd->data[i], 
             (temp_rcd->recvlen == 56)?27:29,   /*** ? 32 ***/
             0,(struct sockaddr *)&(temp_rcd->sin),
             sizeof(struct sockaddr_in));
      i ++;
      nanos.tv_sec = 0;
      nanos.tv_nsec = 17000000;
      nanosleep(&nanos,0);
   }

   /***
   if (temp_rcd->recvlen == 56)
      traceit("Finished playback for user=%.8s, streamid %d,%d\n",
            &(temp_rcd->data[0][42]), temp_rcd->data[0][12], temp_rcd->data[0][13]);
   else
      traceit("Finished playback for user=%.8s, streamid %d,%d\n",
            &(temp_rcd->data[0][44]), temp_rcd->data[0][14], temp_rcd->data[0][15]);
   ***/

   temp_rcd->locked = false;

   pthread_exit(NULL);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdi, %rbx
leaq -0x639a(%rip), %rax     # 0x30b9
leaq 0x18(%rsp), %r14
movq %rax, -0x8(%r14)
movq %r14, %rdi
callq 0x22c0
movl $0x10000000, 0x80(%r14) # imm = 0x10000000
leaq 0x10(%rsp), %rsi
movl $0xf, %edi
xorl %edx, %edx
callq 0x22d0
testl %eax, %eax
jne 0x955c
leaq 0x10(%rsp), %rsi
movl $0x2, %edi
xorl %edx, %edx
callq 0x22d0
testl %eax, %eax
jne 0x956c
movl $0x5, %edi
callq 0x2190
leaq 0x24(%rbx), %r15
leaq 0x10(%rbx), %r14
movw $0x5, %bp
movl 0x7d83(%rip), %edi      # 0x11240
movswq 0x20(%rbx), %rdx
movq %r15, %rsi
xorl %ecx, %ecx
movq %r14, %r8
movl $0x10, %r9d
callq 0x2060
decw %bp
jne 0x94b7
cmpb $0x0, 0xb5ef(%rip)      # 0x14ad0
jne 0x9557
leaq 0x8(%rbx), %r15
leaq 0x5e(%rbx), %r13
xorl %ebp, %ebp
movzwl 0x22(%rbx), %eax
incq %rbp
cmpq %rax, %rbp
jae 0x9557
leaq 0x3a(%r13), %r12
movq %r15, %rdi
callq 0x21d0
movl 0x7d35(%rip), %edi      # 0x11240
xorl %eax, %eax
cmpw $0x38, 0x20(%rbx)
setne %al
leaq 0x1b(,%rax,2), %rdx
movq %r13, %rsi
xorl %ecx, %ecx
movq %r14, %r8
movl $0x10, %r9d
callq 0x2060
movq $0x0, (%rsp)
movq $0x1036640, 0x8(%rsp)   # imm = 0x1036640
movq %rsp, %rdi
xorl %esi, %esi
callq 0x20d0
cmpb $0x1, 0xb57e(%rip)      # 0x14ad0
movq %r12, %r13
jne 0x94ed
movb $0x0, (%rbx)
jmp 0x9588
callq 0x2050
movl (%rax), %esi
leaq 0x2bf6(%rip), %rdi      # 0xc160
jmp 0x957a
callq 0x2050
movl (%rax), %esi
leaq 0x2c07(%rip), %rdi      # 0xc181
xorl %eax, %eax
callq 0x26fc
movb $0x1, 0xb548(%rip)      # 0x14ad0
xorl %edi, %edi
callq 0x2400