// File: /workspace/github_c_makefile_star2_O1/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_process_refused_data
err_t
tcp_process_refused_data(struct tcp_pcb *pcb)
{
#if TCP_QUEUE_OOSEQ && LWIP_WND_SCALE
  struct pbuf *rest;
#endif /* TCP_QUEUE_OOSEQ && LWIP_WND_SCALE */

  LWIP_ERROR("tcp_process_refused_data: invalid pcb", pcb != NULL, return ERR_ARG);

#if TCP_QUEUE_OOSEQ && LWIP_WND_SCALE
  while (pcb->refused_data != NULL)
#endif /* TCP_QUEUE_OOSEQ && LWIP_WND_SCALE */
  {
    err_t err;
    u8_t refused_flags = pcb->refused_data->flags;
    /* set pcb->refused_data to NULL in case the callback frees it and then
       closes the pcb */
    struct pbuf *refused_data = pcb->refused_data;
#if TCP_QUEUE_OOSEQ && LWIP_WND_SCALE
    pbuf_split_64k(refused_data, &rest);
    pcb->refused_data = rest;
#else /* TCP_QUEUE_OOSEQ && LWIP_WND_SCALE */
    pcb->refused_data = NULL;
#endif /* TCP_QUEUE_OOSEQ && LWIP_WND_SCALE */
    /* Notify again application with data previously received. */
    LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: notify kept packet\n"));
    TCP_EVENT_RECV(pcb, refused_data, ERR_OK, err);
    if (err == ERR_OK) {
      /* did refused_data include a FIN? */
      if ((refused_flags & PBUF_FLAG_TCP_FIN)
#if TCP_QUEUE_OOSEQ && LWIP_WND_SCALE
          && (rest == NULL)
#endif /* TCP_QUEUE_OOSEQ && LWIP_WND_SCALE */
         ) {
        /* correct rcv_wnd as the application won't call tcp_recved()
           for the FIN's seqno */
        if (pcb->rcv_wnd != TCP_WND_MAX(pcb)) {
          pcb->rcv_wnd++;
        }
        TCP_EVENT_CLOSED(pcb, err);
        if (err == ERR_ABRT) {
          return ERR_ABRT;
        }
      }
    } else if (err == ERR_ABRT) {
      /* if err == ERR_ABRT, 'pcb' is already deallocated */
      /* Drop incoming packets because pcb is "full" (only if the incoming
         segment contains data). */
      LWIP_DEBUGF(TCP_INPUT_DEBUG, ("tcp_input: drop incoming packets, because pcb is \"full\"\n"));
      return ERR_ABRT;
    } else {
      /* data is still refused, pbuf is still valid (go on for ACK-only packets) */
#if TCP_QUEUE_OOSEQ && LWIP_WND_SCALE
      if (rest != NULL) {
        pbuf_cat(refused_data, rest);
      }
#endif /* TCP_QUEUE_OOSEQ && LWIP_WND_SCALE */
      pcb->refused_data = refused_data;
      return ERR_INPROGRESS;
    }
  }
  return ERR_OK;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
testq %rdi, %rdi
je 0x81c7
movq %rdi, %rbx
movq 0xc0(%rdi), %r14
movq 0xd8(%rdi), %rax
movb 0x15(%r14), %bpl
movq $0x0, 0xc0(%rdi)
testq %rax, %rax
je 0x8164
movq 0x40(%rbx), %rdi
movq %rbx, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
callq *%rax
jmp 0x8171
movq %rbx, %rsi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0x8217
cmpb $-0xd, %al
je 0x81c2
movzbl %al, %eax
testl %eax, %eax
jne 0x81b9
testb $0x20, %bpl
je 0x81b5
movzwl 0x60(%rbx), %eax
cmpl $0x8000, %eax           # imm = 0x8000
je 0x8193
incl %eax
movw %ax, 0x60(%rbx)
movq 0xd8(%rbx), %rax
testq %rax, %rax
je 0x81b5
movq 0x40(%rbx), %rdi
movq %rbx, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq *%rax
movl %eax, %ecx
movb $-0xd, %al
cmpb $-0xd, %cl
je 0x81c2
xorl %eax, %eax
jmp 0x81c2
movq %r14, 0xc0(%rbx)
movb $-0x5, %al
popq %rbx
popq %r14
popq %rbp
retq
leaq 0xd0fe(%rip), %rdi      # 0x152cc
leaq 0xde9b(%rip), %rsi      # 0x16070
leaq 0xdac3(%rip), %rcx      # 0x15c9f
movl $0x609, %edx            # imm = 0x609
xorl %eax, %eax
callq 0x20d0
xorl %edi, %edi
callq 0x21b0
callq 0x2050