// File: /workspace/github_c_makefile_star2_O0/FH0[P]tun_direct/lwip-2.1.2/src/core/pbuf.c
// Function: pbuf_add_header_impl
static u8_t
pbuf_add_header_impl(struct pbuf *p, size_t header_size_increment, u8_t force)
{
  u16_t type_internal;
  void *payload;
  u16_t increment_magnitude;

  LWIP_ASSERT("p != NULL", p != NULL);
  if ((p == NULL) || (header_size_increment > 0xFFFF)) {
    return 1;
  }
  if (header_size_increment == 0) {
    return 0;
  }

  increment_magnitude = (u16_t)header_size_increment;
  /* Do not allow tot_len to wrap as a result. */
  if ((u16_t)(increment_magnitude + p->tot_len) < increment_magnitude) {
    return 1;
  }

  type_internal = p->type_internal;

  /* pbuf types containing payloads? */
  if (type_internal & PBUF_TYPE_FLAG_STRUCT_DATA_CONTIGUOUS) {
    /* set new payload pointer */
    payload = (u8_t *)p->payload - header_size_increment;
    /* boundary check fails? */
    if ((u8_t *)payload < (u8_t *)p + SIZEOF_STRUCT_PBUF) {
      LWIP_DEBUGF( PBUF_DEBUG | LWIP_DBG_TRACE,
                   ("pbuf_add_header: failed as %p < %p (not enough space for new header size)\n",
                    (void *)payload, (void *)((u8_t *)p + SIZEOF_STRUCT_PBUF)));
      /* bail out unsuccessfully */
      return 1;
    }
    /* pbuf types referring to external payloads? */
  } else {
    /* hide a header in the payload? */
    if (force) {
      payload = (u8_t *)p->payload - header_size_increment;
    } else {
      /* cannot expand payload to front (yet!)
       * bail out unsuccessfully */
      return 1;
    }
  }
  LWIP_DEBUGF(PBUF_DEBUG | LWIP_DBG_TRACE, ("pbuf_add_header: old %p new %p (%"U16_F")\n",
              (void *)p->payload, (void *)payload, increment_magnitude));

  /* modify pbuf fields */
  p->payload = payload;
  p->len = (u16_t)(p->len + increment_magnitude);
  p->tot_len = (u16_t)(p->tot_len + increment_magnitude);


  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movb %dl, %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movb %al, -0x19(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x77fd
jmp 0x77ce
leaq 0x1faf7(%rip), %rdi     # 0x272cc
leaq 0x20182(%rip), %rsi     # 0x2795e
movl $0x1df, %edx            # imm = 0x1DF
leaq 0x200c1(%rip), %rcx     # 0x278a9
movb $0x0, %al
callq 0x20d0
xorl %eax, %eax
movl %eax, %edi
callq 0x21b0
callq 0x2040
jmp 0x77ff
cmpq $0x0, -0x10(%rbp)
je 0x7810
cmpq $0xffff, -0x18(%rbp)    # imm = 0xFFFF
jbe 0x7819
movb $0x1, -0x1(%rbp)
jmp 0x790a
cmpq $0x0, -0x18(%rbp)
jne 0x7829
movb $0x0, -0x1(%rbp)
jmp 0x790a
movq -0x18(%rbp), %rax
movw %ax, -0x2a(%rbp)
movzwl -0x2a(%rbp), %eax
movq -0x10(%rbp), %rcx
movzwl 0x10(%rcx), %ecx
addl %ecx, %eax
movzwl %ax, %eax
movzwl -0x2a(%rbp), %ecx
cmpl %ecx, %eax
jge 0x7853
movb $0x1, -0x1(%rbp)
jmp 0x790a
movq -0x10(%rbp), %rax
movzbl 0x14(%rax), %eax
movw %ax, -0x1c(%rbp)
movzwl -0x1c(%rbp), %eax
andl $0x80, %eax
cmpl $0x0, %eax
je 0x789f
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
xorl %ecx, %ecx
subq -0x18(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq -0x10(%rbp), %rcx
addq $0x18, %rcx
cmpq %rcx, %rax
jae 0x789d
jmp 0x7895
jmp 0x7897
movb $0x1, -0x1(%rbp)
jmp 0x790a
jmp 0x78c4
cmpb $0x0, -0x19(%rbp)
je 0x78bc
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
xorl %ecx, %ecx
subq -0x18(%rbp), %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
jmp 0x78c2
movb $0x1, -0x1(%rbp)
jmp 0x790a
jmp 0x78c4
jmp 0x78c6
jmp 0x78c8
movq -0x28(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movzwl 0x12(%rax), %eax
movzwl -0x2a(%rbp), %ecx
addl %ecx, %eax
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x12(%rax)
movq -0x10(%rbp), %rax
movzwl 0x10(%rax), %eax
movzwl -0x2a(%rbp), %ecx
addl %ecx, %eax
movw %ax, %cx
movq -0x10(%rbp), %rax
movw %cx, 0x10(%rax)
movb $0x0, -0x1(%rbp)
movb -0x1(%rbp), %al
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)