// File: romkatv[P]hcproxy/src/forwarder.cc
// Function: hcproxy::(anonymous namespace)::Buffer::WriteFrom(int)
IoStatus WriteFrom(int fd) {
    CHECK(pipe_[1] >= 0);
    CHECK(size_ >= 0);
    CHECK(size_ <= capacity_);
    if (size_ == capacity_) return IoStatus::kNoOp;
    ssize_t ret = splice(fd, nullptr, pipe_[1], nullptr, capacity_ - size_,
                         SPLICE_F_NONBLOCK | SPLICE_F_MOVE);
    if (ret < 0) {
      if (errno == EAGAIN) return IoStatus::kNoOp;
      CHECK(close(pipe_[1]) == 0) << Errno();
      pipe_[1] = -1;
      return IoStatus::kError;
    }
    if (ret == 0) {
      CHECK(close(pipe_[1]) == 0) << Errno();
      pipe_[1] = -1;
      return IoStatus::kEof;
    }
    size_ += ret;
    CHECK(size_ >= 0);
    CHECK(size_ <= capacity_);
    return IoStatus::kData;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x210, %rsp            # imm = 0x210
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x150(%rbp)
movl 0xc(%rax), %eax
movb $0x0, -0x39(%rbp)
cmpl $0x0, %eax
jl 0x3001b
jmp 0x30090
leaq 0xb4f5a(%rip), %rsi     # 0xe4f7c
leaq -0x38(%rbp), %rdi
movq %rdi, -0x160(%rbp)
movl $0x55, %edx
movl $0x3, %ecx
callq 0x194b0
movq -0x160(%rbp), %rdi
movb $0x1, -0x39(%rbp)
callq 0x194e0
movq %rax, %rdi
leaq 0xb4ffc(%rip), %rsi     # 0xe5052
callq 0x19590
movq %rax, -0x158(%rbp)
jmp 0x30064
movq -0x158(%rbp), %rdi
leaq 0xb9319(%rip), %rsi     # 0xe938b
callq 0x19450
movq %rax, -0x168(%rbp)
jmp 0x30080
movq -0x168(%rbp), %rsi
leaq -0x4d(%rbp), %rdi
callq 0x194f0
testb $0x1, -0x39(%rbp)
jne 0x30098
jmp 0x300bc
leaq -0x38(%rbp), %rdi
callq 0x19500
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
testb $0x1, -0x39(%rbp)
jne 0x30157
jmp 0x30160
movq -0x150(%rbp), %rax
movl 0x4(%rax), %eax
movb $0x0, -0x71(%rbp)
cmpl $0x0, %eax
jl 0x300d1
jmp 0x30146
leaq 0xb4ea4(%rip), %rsi     # 0xe4f7c
leaq -0x70(%rbp), %rdi
movq %rdi, -0x178(%rbp)
movl $0x56, %edx
movl $0x3, %ecx
callq 0x194b0
movq -0x178(%rbp), %rdi
movb $0x1, -0x71(%rbp)
callq 0x194e0
movq %rax, %rdi
leaq 0xb4f54(%rip), %rsi     # 0xe5060
callq 0x1c330
movq %rax, -0x170(%rbp)
jmp 0x3011a
movq -0x170(%rbp), %rdi
leaq 0xb9263(%rip), %rsi     # 0xe938b
callq 0x19450
movq %rax, -0x180(%rbp)
jmp 0x30136
movq -0x180(%rbp), %rsi
leaq -0x72(%rbp), %rdi
callq 0x194f0
testb $0x1, -0x71(%rbp)
jne 0x3014e
jmp 0x30180
leaq -0x70(%rbp), %rdi
callq 0x19500
leaq -0x38(%rbp), %rdi
callq 0x19500
jmp 0x306d6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
testb $0x1, -0x71(%rbp)
jne 0x3022e
jmp 0x30237
movq -0x150(%rbp), %rcx
movl 0x4(%rcx), %eax
movl (%rcx), %ecx
movb $0x0, -0x99(%rbp)
cmpl %ecx, %eax
jg 0x30199
jmp 0x30217
leaq 0xb4ddc(%rip), %rsi     # 0xe4f7c
leaq -0x98(%rbp), %rdi
movq %rdi, -0x190(%rbp)
movl $0x57, %edx
movl $0x3, %ecx
callq 0x194b0
movq -0x190(%rbp), %rdi
movb $0x1, -0x99(%rbp)
callq 0x194e0
movq %rax, %rdi
leaq 0xb4e91(%rip), %rsi     # 0xe506b
callq 0x1d970
movq %rax, -0x188(%rbp)
jmp 0x301e8
movq -0x188(%rbp), %rdi
leaq 0xb9195(%rip), %rsi     # 0xe938b
callq 0x19450
movq %rax, -0x198(%rbp)
jmp 0x30204
movq -0x198(%rbp), %rsi
leaq -0x9a(%rbp), %rdi
callq 0x194f0
testb $0x1, -0x99(%rbp)
jne 0x30222
jmp 0x30253
leaq -0x98(%rbp), %rdi
callq 0x19500
leaq -0x70(%rbp), %rdi
callq 0x19500
jmp 0x306d6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
testb $0x1, -0x99(%rbp)
jne 0x3026d
jmp 0x30279
movq -0x150(%rbp), %rcx
movl 0x4(%rcx), %eax
cmpl (%rcx), %eax
jne 0x3027e
movl $0x3, -0x4(%rbp)
jmp 0x306ca
leaq -0x98(%rbp), %rdi
callq 0x19500
jmp 0x306d6
movq -0x150(%rbp), %rcx
movl -0x14(%rbp), %edi
movl 0xc(%rcx), %edx
movl (%rcx), %eax
subl 0x4(%rcx), %eax
movslq %eax, %r8
xorl %eax, %eax
movl %eax, %ecx
movl $0x3, %r9d
movq %rcx, %rsi
callq 0x151d0
movq %rax, -0xa8(%rbp)
cmpq $0x0, -0xa8(%rbp)
jge 0x303e3
callq 0x15640
cmpl $0xb, (%rax)
jne 0x302d0
movl $0x3, -0x4(%rbp)
jmp 0x306ca
movq -0x150(%rbp), %rax
movl 0xc(%rax), %edi
callq 0x15140
movb $0x0, -0xc9(%rbp)
cmpl $0x0, %eax
jne 0x302f0
jmp 0x3038a
leaq 0xb4c85(%rip), %rsi     # 0xe4f7c
leaq -0xc8(%rbp), %rdi
movq %rdi, -0x1a8(%rbp)
movl $0x5d, %edx
movl $0x3, %ecx
callq 0x194b0
movq -0x1a8(%rbp), %rdi
movb $0x1, -0xc9(%rbp)
callq 0x194e0
movq %rax, %rdi
leaq 0xb4d4d(%rip), %rsi     # 0xe507e
callq 0x1c400
movq %rax, -0x1a0(%rbp)
jmp 0x3033f
movq -0x1a0(%rbp), %rdi
leaq 0xb903e(%rip), %rsi     # 0xe938b
callq 0x19450
movq %rax, -0x1b0(%rbp)
jmp 0x3035b
callq 0x1c0c0
jmp 0x30362
movq -0x1b0(%rbp), %rdi
callq 0x1c050
movq %rax, -0x1b8(%rbp)
jmp 0x30377
movq -0x1b8(%rbp), %rsi
leaq -0xcc(%rbp), %rdi
callq 0x194f0
testb $0x1, -0xc9(%rbp)
jne 0x30395
jmp 0x303b8
leaq -0xc8(%rbp), %rdi
callq 0x19500
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
testb $0x1, -0xc9(%rbp)
jne 0x303d2
jmp 0x303de
movq -0x150(%rbp), %rax
movl $0xffffffff, 0xc(%rax)  # imm = 0xFFFFFFFF
movl $0x2, -0x4(%rbp)
jmp 0x306ca
leaq -0xc8(%rbp), %rdi
callq 0x19500
jmp 0x306d6
cmpq $0x0, -0xa8(%rbp)
jne 0x30504
movq -0x150(%rbp), %rax
movl 0xc(%rax), %edi
callq 0x15140
movb $0x0, -0xf1(%rbp)
cmpl $0x0, %eax
jne 0x30411
jmp 0x304ab
leaq 0xb4b64(%rip), %rsi     # 0xe4f7c
leaq -0xf0(%rbp), %rdi
movq %rdi, -0x1c8(%rbp)
movl $0x62, %edx
movl $0x3, %ecx
callq 0x194b0
movq -0x1c8(%rbp), %rdi
movb $0x1, -0xf1(%rbp)
callq 0x194e0
movq %rax, %rdi
leaq 0xb4c2c(%rip), %rsi     # 0xe507e
callq 0x1c400
movq %rax, -0x1c0(%rbp)
jmp 0x30460
movq -0x1c0(%rbp), %rdi
leaq 0xb8f1d(%rip), %rsi     # 0xe938b
callq 0x19450
movq %rax, -0x1d0(%rbp)
jmp 0x3047c
callq 0x1c0c0
jmp 0x30483
movq -0x1d0(%rbp), %rdi
callq 0x1c050
movq %rax, -0x1d8(%rbp)
jmp 0x30498
movq -0x1d8(%rbp), %rsi
leaq -0xf4(%rbp), %rdi
callq 0x194f0
testb $0x1, -0xf1(%rbp)
jne 0x304b6
jmp 0x304d9
leaq -0xf0(%rbp), %rdi
callq 0x19500
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
testb $0x1, -0xf1(%rbp)
jne 0x304f3
jmp 0x304ff
movq -0x150(%rbp), %rax
movl $0xffffffff, 0xc(%rax)  # imm = 0xFFFFFFFF
movl $0x1, -0x4(%rbp)
jmp 0x306ca
leaq -0xf0(%rbp), %rdi
callq 0x19500
jmp 0x306d6
movq -0x150(%rbp), %rax
movq -0xa8(%rbp), %rdx
movslq 0x4(%rax), %rcx
addq %rdx, %rcx
movl %ecx, 0x4(%rax)
movl 0x4(%rax), %eax
movb $0x0, -0x119(%rbp)
cmpl $0x0, %eax
jl 0x3052d
jmp 0x305ab
leaq 0xb4a48(%rip), %rsi     # 0xe4f7c
leaq -0x118(%rbp), %rdi
movq %rdi, -0x1e8(%rbp)
movl $0x67, %edx
movl $0x3, %ecx
callq 0x194b0
movq -0x1e8(%rbp), %rdi
movb $0x1, -0x119(%rbp)
callq 0x194e0
movq %rax, %rdi
leaq 0xb4af2(%rip), %rsi     # 0xe5060
callq 0x1c330
movq %rax, -0x1e0(%rbp)
jmp 0x3057c
movq -0x1e0(%rbp), %rdi
leaq 0xb8e01(%rip), %rsi     # 0xe938b
callq 0x19450
movq %rax, -0x1f0(%rbp)
jmp 0x30598
movq -0x1f0(%rbp), %rsi
leaq -0x11a(%rbp), %rdi
callq 0x194f0
testb $0x1, -0x119(%rbp)
jne 0x305b6
jmp 0x305e0
leaq -0x118(%rbp), %rdi
callq 0x19500
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
testb $0x1, -0x119(%rbp)
jne 0x3068e
jmp 0x3069a
movq -0x150(%rbp), %rcx
movl 0x4(%rcx), %eax
movl (%rcx), %ecx
movb $0x0, -0x141(%rbp)
cmpl %ecx, %eax
jg 0x305f9
jmp 0x30677
leaq 0xb497c(%rip), %rsi     # 0xe4f7c
leaq -0x140(%rbp), %rdi
movq %rdi, -0x200(%rbp)
movl $0x68, %edx
movl $0x3, %ecx
callq 0x194b0
movq -0x200(%rbp), %rdi
movb $0x1, -0x141(%rbp)
callq 0x194e0
movq %rax, %rdi
leaq 0xb4a31(%rip), %rsi     # 0xe506b
callq 0x1d970
movq %rax, -0x1f8(%rbp)
jmp 0x30648
movq -0x1f8(%rbp), %rdi
leaq 0xb8d35(%rip), %rsi     # 0xe938b
callq 0x19450
movq %rax, -0x208(%rbp)
jmp 0x30664
movq -0x208(%rbp), %rsi
leaq -0x142(%rbp), %rdi
callq 0x194f0
testb $0x1, -0x141(%rbp)
jne 0x30682
jmp 0x306b3
leaq -0x140(%rbp), %rdi
callq 0x19500
leaq -0x118(%rbp), %rdi
callq 0x19500
jmp 0x306d6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
testb $0x1, -0x141(%rbp)
jne 0x306bc
jmp 0x306c8
movl $0x0, -0x4(%rbp)
jmp 0x306ca
leaq -0x140(%rbp), %rdi
callq 0x19500
jmp 0x306d6
movl -0x4(%rbp), %eax
addq $0x210, %rsp            # imm = 0x210
popq %rbp
retq
movq -0x48(%rbp), %rdi
callq 0xe1080
nop