// File: /workspace/github_c_makefile_star2_O0/FH0[P]tun_direct/lwip-2.1.2/src/core/udp.c
// Function: udp_sendto_chksum
err_t
udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip,
                  u16_t dst_port, u8_t have_chksum, u16_t chksum)
{
#endif /* TUN2SOCKS */
#endif /* LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP */
  struct netif *netif;

  LWIP_ERROR("udp_sendto: invalid pcb", pcb != NULL, return ERR_ARG);
  LWIP_ERROR("udp_sendto: invalid pbuf", p != NULL, return ERR_ARG);
  LWIP_ERROR("udp_sendto: invalid dst_ip", dst_ip != NULL, return ERR_ARG);

  if (!IP_ADDR_PCB_VERSION_MATCH(pcb, dst_ip)) {
    return ERR_VAL;
  }

  LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_TRACE, ("udp_send\n"));

  if (pcb->netif_idx != NETIF_NO_INDEX) {
    netif = netif_get_by_index(pcb->netif_idx);
  } else {
#if LWIP_MULTICAST_TX_OPTIONS
    netif = NULL;
    if (ip_addr_ismulticast(dst_ip)) {
      /* For IPv6, the interface to use for packets with a multicast destination
       * is specified using an interface index. The same approach may be used for
       * IPv4 as well, in which case it overrides the IPv4 multicast override
       * address below. Here we have to look up the netif by going through the
       * list, but by doing so we skip a route lookup. If the interface index has
       * gone stale, we fall through and do the regular route lookup after all. */
      if (pcb->mcast_ifindex != NETIF_NO_INDEX) {
        netif = netif_get_by_index(pcb->mcast_ifindex);
      }
#if LWIP_IPV4
      else
#if LWIP_IPV6
        if (IP_IS_V4(dst_ip))
#endif /* LWIP_IPV6 */
        {
          /* IPv4 does not use source-based routing by default, so we use an
             administratively selected interface for multicast by default.
             However, this can be overridden by setting an interface address
             in pcb->mcast_ip4 that is used for routing. If this routing lookup
             fails, we try regular routing as though no override was set. */
          if (!ip4_addr_isany_val(pcb->mcast_ip4) &&
              !ip4_addr_cmp(&pcb->mcast_ip4, IP4_ADDR_BROADCAST)) {
            netif = ip4_route_src(ip_2_ip4(&pcb->local_ip), &pcb->mcast_ip4);
          }
        }
#endif /* LWIP_IPV4 */
    }

    if (netif == NULL)
#endif /* LWIP_MULTICAST_TX_OPTIONS */
    {
      /* find the outgoing network interface for this packet */
      netif = ip_route(&pcb->local_ip, dst_ip);
    }
  }

  /* no outgoing network interface could be found? */
  if (netif == NULL) {
    LWIP_DEBUGF(UDP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, ("udp_send: No route to "));
    ip_addr_debug_print(UDP_DEBUG | LWIP_DBG_LEVEL_SERIOUS, dst_ip);
    LWIP_DEBUGF(UDP_DEBUG, ("\n"));
    UDP_STATS_INC(udp.rterr);
    return ERR_RTE;
  }
#if LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP
#if TUN2SOCKS
  return udp_sendto_if_chksum(pcb, p, dst_ip, dst_port, netif, have_chksum, chksum, src_ip, src_port);
#else
  return udp_sendto_if_chksum(pcb, p, dst_ip, dst_port, netif, have_chksum, chksum);
#endif /* TUN2SOCKS */
#else /* LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP */
#if TUN2SOCKS
  return udp_sendto_if(pcb, p, dst_ip, dst_port, netif, src_ip, src_port);
#else
  return udp_sendto_if(pcb, p, dst_ip, dst_port, netif);
#endif /* TUN2SOCKS */
#endif /* LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP */
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movl %r8d, -0x48(%rbp)
movl %ecx, %eax
movl -0x48(%rbp), %ecx
movl %eax, -0x44(%rbp)
movq %rdx, %rax
movl -0x44(%rbp), %edx
movq %rax, -0x40(%rbp)
movq %rsi, %rax
movq -0x40(%rbp), %rsi
movq %rax, -0x38(%rbp)
movq %rdi, %r8
movq -0x38(%rbp), %rdi
movw %r9w, %ax
movw 0x18(%rbp), %r9w
movq 0x10(%rbp), %r9
movq %r8, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movw %dx, -0x22(%rbp)
movb %cl, -0x23(%rbp)
movw %ax, -0x26(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x1770c
jmp 0x176dd
leaq 0xfbe8(%rip), %rdi      # 0x272cc
leaq 0x11d1b(%rip), %rsi     # 0x29406
movl $0x246, %edx            # imm = 0x246
leaq 0x11c59(%rip), %rcx     # 0x29350
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x1770e
jmp 0x17710
cmpq $0x0, -0x18(%rbp)
jne 0x17748
jmp 0x17719
leaq 0xfbac(%rip), %rdi      # 0x272cc
leaq 0x11cf7(%rip), %rsi     # 0x2941e
movl $0x247, %edx            # imm = 0x247
leaq 0x11c1d(%rip), %rcx     # 0x29350
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x1774a
jmp 0x1774c
cmpq $0x0, -0x20(%rbp)
jne 0x17784
jmp 0x17755
leaq 0xfb70(%rip), %rdi      # 0x272cc
leaq 0x11cd4(%rip), %rsi     # 0x29437
movl $0x248, %edx            # imm = 0x248
leaq 0x11be1(%rip), %rcx     # 0x29350
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x17786
movq -0x10(%rbp), %rax
movzbl 0x14(%rax), %eax
cmpl $0x2e, %eax
je 0x177b0
movq -0x10(%rbp), %rax
movzbl 0x14(%rax), %eax
movq -0x20(%rbp), %rcx
movzbl 0x14(%rcx), %ecx
cmpl %ecx, %eax
je 0x177b0
movb $-0x6, -0x1(%rbp)
jmp 0x1788e
jmp 0x177b2
jmp 0x177b4
movq -0x10(%rbp), %rax
movzbl 0x30(%rax), %eax
cmpl $0x0, %eax
je 0x177d4
movq -0x10(%rbp), %rax
movzbl 0x30(%rax), %edi
callq 0x6cf0
movq %rax, -0x30(%rbp)
jmp 0x17810
cmpq $0x0, -0x20(%rbp)
je 0x177fb
movq -0x20(%rbp), %rax
movzbl 0x14(%rax), %eax
cmpl $0x6, %eax
jne 0x177fb
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x1c270
movq %rax, -0x50(%rbp)
jmp 0x17808
movq -0x20(%rbp), %rdi
callq 0x196c0
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x17849
jmp 0x17819
jmp 0x1781b
jmp 0x1781d
cmpq $0x0, -0x20(%rbp)
je 0x17837
movq -0x20(%rbp), %rax
movzbl 0x14(%rax), %eax
cmpl $0x6, %eax
jne 0x17837
jmp 0x17833
jmp 0x17835
jmp 0x1783d
jmp 0x17839
jmp 0x1783b
jmp 0x1783d
jmp 0x1783f
jmp 0x17841
jmp 0x17843
movb $-0x4, -0x1(%rbp)
jmp 0x1788e
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x20(%rbp), %rdx
movw -0x22(%rbp), %cx
movq -0x30(%rbp), %r8
movb -0x23(%rbp), %r9b
movw -0x26(%rbp), %r10w
movq 0x10(%rbp), %rax
movzwl %cx, %ecx
movzbl %r9b, %r9d
movzwl %r10w, %r10d
movl %r10d, (%rsp)
movq %rax, 0x8(%rsp)
movzwl 0x18(%rbp), %eax
movl %eax, 0x10(%rsp)
callq 0x178a0
movb %al, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x70, %rsp
popq %rbp
retq
nopw (%rax,%rax)