// File: /workspace/github_c_makefile_star2_O0/FH0[P]tun_direct/lwip-2.1.2/src/core/pbuf.c
// Function: pbuf_fill_chksum
err_t
pbuf_fill_chksum(struct pbuf *p, u16_t start_offset, const void *dataptr,
                 u16_t len, u16_t *chksum)
{
  u32_t acc;
  u16_t copy_chksum;
  char *dst_ptr;
  LWIP_ASSERT("p != NULL", p != NULL);
  LWIP_ASSERT("dataptr != NULL", dataptr != NULL);
  LWIP_ASSERT("chksum != NULL", chksum != NULL);
  LWIP_ASSERT("len != 0", len != 0);

  if ((start_offset >= p->len) || (start_offset + len > p->len)) {
    return ERR_ARG;
  }

  dst_ptr = ((char *)p->payload) + start_offset;
  copy_chksum = LWIP_CHKSUM_COPY(dst_ptr, dataptr, len);
  if ((start_offset & 1) != 0) {
    copy_chksum = SWAP_BYTES_IN_WORD(copy_chksum);
  }
  acc = *chksum;
  acc += copy_chksum;
  *chksum = FOLD_U32T(acc);
  return ERR_OK;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movw %cx, %ax
movw %si, %cx
movq %rdi, -0x10(%rbp)
movw %cx, -0x12(%rbp)
movq %rdx, -0x20(%rbp)
movw %ax, -0x22(%rbp)
movq %r8, -0x30(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x8b1a
jmp 0x8aeb
leaq 0x1e7da(%rip), %rdi     # 0x272cc
leaq 0x1ee65(%rip), %rsi     # 0x2795e
movl $0x53c, %edx            # imm = 0x53C
leaq 0x1eda4(%rip), %rcx     # 0x278a9
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x8b1c
jmp 0x8b1e
cmpq $0x0, -0x20(%rbp)
jne 0x8b56
jmp 0x8b27
leaq 0x1e79e(%rip), %rdi     # 0x272cc
leaq 0x1f152(%rip), %rsi     # 0x27c87
movl $0x53d, %edx            # imm = 0x53D
leaq 0x1ed68(%rip), %rcx     # 0x278a9
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x8b58
jmp 0x8b5a
cmpq $0x0, -0x30(%rbp)
jne 0x8b92
jmp 0x8b63
leaq 0x1e762(%rip), %rdi     # 0x272cc
leaq 0x1f126(%rip), %rsi     # 0x27c97
movl $0x53e, %edx            # imm = 0x53E
leaq 0x1ed2c(%rip), %rcx     # 0x278a9
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x8b94
jmp 0x8b96
movzwl -0x22(%rbp), %eax
cmpl $0x0, %eax
jne 0x8bd0
jmp 0x8ba1
leaq 0x1e724(%rip), %rdi     # 0x272cc
leaq 0x1f0f7(%rip), %rsi     # 0x27ca6
movl $0x53f, %edx            # imm = 0x53F
leaq 0x1ecee(%rip), %rcx     # 0x278a9
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x8bd2
movzwl -0x12(%rbp), %eax
movq -0x10(%rbp), %rcx
movzwl 0x12(%rcx), %ecx
cmpl %ecx, %eax
jge 0x8bf8
movzwl -0x12(%rbp), %eax
movzwl -0x22(%rbp), %ecx
addl %ecx, %eax
movq -0x10(%rbp), %rcx
movzwl 0x12(%rcx), %ecx
cmpl %ecx, %eax
jle 0x8c01
movb $-0x10, -0x1(%rbp)
jmp 0x8c8e
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movzwl -0x12(%rbp), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rdi
movq -0x20(%rbp), %rsi
movzwl -0x22(%rbp), %edx
callq 0x26040
movw %ax, -0x36(%rbp)
movzwl -0x12(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x8c57
movzwl -0x36(%rbp), %eax
andl $0xff, %eax
shll $0x8, %eax
movzwl -0x36(%rbp), %ecx
andl $0xff00, %ecx           # imm = 0xFF00
sarl $0x8, %ecx
orl %ecx, %eax
movw %ax, -0x36(%rbp)
movq -0x30(%rbp), %rax
movzwl (%rax), %eax
movl %eax, -0x34(%rbp)
movzwl -0x36(%rbp), %eax
addl -0x34(%rbp), %eax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
shrl $0x10, %eax
movl %eax, %eax
movl -0x34(%rbp), %ecx
andq $0xffff, %rcx           # imm = 0xFFFF
addq %rcx, %rax
movw %ax, %cx
movq -0x30(%rbp), %rax
movw %cx, (%rax)
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)