// File: /workspace/github_c_makefile_star2_O0/FH0[P]tun_direct/lwip-2.1.2/src/core/tcp.c
// Function: tcp_pcb_remove
void
tcp_pcb_remove(struct tcp_pcb **pcblist, struct tcp_pcb *pcb)
{
  LWIP_ASSERT("tcp_pcb_remove: invalid pcb", pcb != NULL);
  LWIP_ASSERT("tcp_pcb_remove: invalid pcblist", pcblist != NULL);

  TCP_RMV(pcblist, pcb);

  tcp_pcb_purge(pcb);

  /* if there is an outstanding delayed ACKs, send it */
  if ((pcb->state != TIME_WAIT) &&
      (pcb->state != LISTEN) &&
      (pcb->flags & TF_ACK_DELAY)) {
    tcp_ack_now(pcb);
    tcp_output(pcb);
  }

  if (pcb->state != LISTEN) {
    LWIP_ASSERT("unsent segments leaking", pcb->unsent == NULL);
    LWIP_ASSERT("unacked segments leaking", pcb->unacked == NULL);
#if TCP_QUEUE_OOSEQ
    LWIP_ASSERT("ooseq segments leaking", pcb->ooseq == NULL);
#endif /* TCP_QUEUE_OOSEQ */
  }

  pcb->state = CLOSED;
  /* reset the local port to prevent the pcb from being 'bound' */
  pcb->local_port = 0;

  LWIP_ASSERT("tcp_pcb_remove: tcp_pcbs_sane()", tcp_pcbs_sane());
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xba18
jmp 0xb9e9
leaq 0x1b8dc(%rip), %rdi     # 0x272cc
leaq 0x1c87c(%rip), %rsi     # 0x28273
movl $0x883, %edx            # imm = 0x883
leaq 0x1c368(%rip), %rcx     # 0x27d6b
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0xba1a
jmp 0xba1c
cmpq $0x0, -0x8(%rbp)
jne 0xba54
jmp 0xba25
leaq 0x1b8a0(%rip), %rdi     # 0x272cc
leaq 0x1c85c(%rip), %rsi     # 0x2828f
movl $0x884, %edx            # imm = 0x884
leaq 0x1c32c(%rip), %rcx     # 0x27d6b
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0xba56
jmp 0xba58
movq -0x8(%rbp), %rax
movq (%rax), %rax
cmpq -0x10(%rbp), %rax
jne 0xba79
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq 0x38(%rax), %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
jmp 0xbabd
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0xbabb
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
cmpq -0x10(%rbp), %rax
jne 0xbaab
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rcx
movq -0x18(%rbp), %rax
movq %rcx, 0x38(%rax)
jmp 0xbabb
jmp 0xbaad
movq -0x18(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x18(%rbp)
jmp 0xba84
jmp 0xbabd
movq -0x10(%rbp), %rax
movq $0x0, 0x38(%rax)
movq -0x10(%rbp), %rdi
callq 0xd2b0
movq -0x10(%rbp), %rax
cmpl $0xa, 0x48(%rax)
je 0xbb17
movq -0x10(%rbp), %rax
cmpl $0x1, 0x48(%rax)
je 0xbb17
movq -0x10(%rbp), %rax
movzwl 0x52(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xbb17
jmp 0xbaf8
movq -0x10(%rbp), %rax
movzwl 0x52(%rax), %eax
orl $0x2, %eax
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x52(%rax)
movq -0x10(%rbp), %rdi
callq 0x14b70
movq -0x10(%rbp), %rax
cmpl $0x1, 0x48(%rax)
je 0xbbf0
jmp 0xbb27
movq -0x10(%rbp), %rax
cmpq $0x0, 0xa8(%rax)
je 0xbb66
jmp 0xbb37
leaq 0x1b78e(%rip), %rdi     # 0x272cc
leaq 0x1c76a(%rip), %rsi     # 0x282af
movl $0x893, %edx            # imm = 0x893
leaq 0x1c21a(%rip), %rcx     # 0x27d6b
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0xbb68
jmp 0xbb6a
movq -0x10(%rbp), %rax
cmpq $0x0, 0xb0(%rax)
je 0xbba9
jmp 0xbb7a
leaq 0x1b74b(%rip), %rdi     # 0x272cc
leaq 0x1c73f(%rip), %rsi     # 0x282c7
movl $0x894, %edx            # imm = 0x894
leaq 0x1c1d7(%rip), %rcx     # 0x27d6b
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0xbbab
jmp 0xbbad
movq -0x10(%rbp), %rax
cmpq $0x0, 0xb8(%rax)
je 0xbbec
jmp 0xbbbd
leaq 0x1b708(%rip), %rdi     # 0x272cc
leaq 0x1c715(%rip), %rsi     # 0x282e0
movl $0x896, %edx            # imm = 0x896
leaq 0x1c194(%rip), %rcx     # 0x27d6b
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0xbbee
jmp 0xbbf0
movq -0x10(%rbp), %rax
movl $0x0, 0x48(%rax)
movq -0x10(%rbp), %rax
movw $0x0, 0x4e(%rax)
callq 0xe030
cmpw $0x0, %ax
jne 0xbc41
jmp 0xbc12
leaq 0x1b6b3(%rip), %rdi     # 0x272cc
leaq 0x1c6d7(%rip), %rsi     # 0x282f7
movl $0x89e, %edx            # imm = 0x89E
leaq 0x1c13f(%rip), %rcx     # 0x27d6b
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0xbc43
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)