// File: /workspace/github_cpp_makefile_star2_O3/mindbeast[P]rnes/bin/save.pb.cc
// Function: Rnes::ApuState::_InternalSerialize(unsigned char*, google::protobuf::io::EpsCopyOutputStream*) const
::PROTOBUF_NAMESPACE_ID::uint8* ApuState::_InternalSerialize(
    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:Rnes.ApuState)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  // repeated uint32 reg = 1;
  for (int i = 0, n = this->_internal_reg_size(); i < n; i++) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(1, this->_internal_reg(i), target);
  }

  cached_has_bits = _has_bits_[0];
  // optional uint32 sampleRate = 2;
  if (cached_has_bits & 0x00000010u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(2, this->_internal_samplerate(), target);
  }

  // optional uint32 fourFrameCount = 3;
  if (cached_has_bits & 0x00000020u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(3, this->_internal_fourframecount(), target);
  }

  // optional uint32 fiveFrameCount = 4;
  if (cached_has_bits & 0x00000040u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(4, this->_internal_fiveframecount(), target);
  }

  // optional uint32 frameDivider = 5;
  if (cached_has_bits & 0x00000080u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(5, this->_internal_framedivider(), target);
  }

  // optional uint32 step = 6;
  if (cached_has_bits & 0x00000100u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(6, this->_internal_step(), target);
  }

  // optional uint32 halfTimerDivider = 7;
  if (cached_has_bits & 0x00000200u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(7, this->_internal_halftimerdivider(), target);
  }

  // optional uint32 samplerDivider = 8;
  if (cached_has_bits & 0x00000400u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(8, this->_internal_samplerdivider(), target);
  }

  // optional float clksPerSample = 9;
  if (cached_has_bits & 0x00000800u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(9, this->_internal_clkspersample(), target);
  }

  // optional float currentSampleClk = 10;
  if (cached_has_bits & 0x00001000u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(10, this->_internal_currentsampleclk(), target);
  }

  // optional uint32 nextSampleCountdown = 11;
  if (cached_has_bits & 0x00002000u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteUInt32ToArray(11, this->_internal_nextsamplecountdown(), target);
  }

  // optional .Rnes.PulseState pulseA = 20;
  if (cached_has_bits & 0x00000001u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        20, _Internal::pulsea(this), target, stream);
  }

  // optional .Rnes.PulseState pulseB = 21;
  if (cached_has_bits & 0x00000002u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        21, _Internal::pulseb(this), target, stream);
  }

  // optional .Rnes.TriangleState triangle = 22;
  if (cached_has_bits & 0x00000004u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        22, _Internal::triangle(this), target, stream);
  }

  // optional .Rnes.NoiseState noise = 23;
  if (cached_has_bits & 0x00000008u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
      InternalWriteMessage(
        23, _Internal::noise(this), target, stream);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
  }
  // @@protoc_insertion_point(serialize_to_array_end:Rnes.ApuState)
  return target;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movl 0x18(%rdi), %r14d
testl %r14d, %r14d
movq %rdi, -0x30(%rbp)
jle 0x277bf
leaq 0x18(%rdi), %r12
xorl %r13d, %r13d
cmpq %r15, (%rbx)
jbe 0x277af
movq %r12, %rdi
movl %r13d, %esi
callq 0xa720
movl (%rax), %ecx
movb $0x8, (%r15)
cmpl $0x7f, %ecx
ja 0x27765
movb %cl, 0x1(%r15)
addq $0x2, %r15
jmp 0x277a5
movl %ecx, %eax
orb $-0x80, %al
movb %al, 0x1(%r15)
movl %ecx, %eax
shrl $0x7, %eax
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x27784
movb %al, 0x2(%r15)
addq $0x3, %r15
jmp 0x277a5
addq $0x3, %r15
movl %eax, %ecx
movl %ecx, %edx
orb $-0x80, %dl
movb %dl, -0x1(%r15)
shrl $0x7, %eax
incq %r15
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x27788
movb %al, -0x1(%r15)
incl %r13d
cmpl %r14d, %r13d
jne 0x27740
jmp 0x277bf
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa750
movq %rax, %r15
jmp 0x27745
movq -0x30(%rbp), %r14
movl 0x10(%r14), %r12d
testb $0x10, %r12b
je 0x2782d
cmpq %r15, (%rbx)
jbe 0x27d5b
movl 0x48(%r14), %ecx
movb $0x10, (%r15)
cmpl $0x7f, %ecx
ja 0x277ed
movb %cl, 0x1(%r15)
addq $0x2, %r15
jmp 0x2782d
movl %ecx, %eax
orb $-0x80, %al
movb %al, 0x1(%r15)
movl %ecx, %eax
shrl $0x7, %eax
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x2780c
movb %al, 0x2(%r15)
addq $0x3, %r15
jmp 0x2782d
addq $0x3, %r15
movl %eax, %ecx
movl %ecx, %edx
orb $-0x80, %dl
movb %dl, -0x1(%r15)
shrl $0x7, %eax
incq %r15
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x27810
movb %al, -0x1(%r15)
testb $0x20, %r12b
je 0x27893
cmpq %r15, (%rbx)
jbe 0x27d6e
movl 0x4c(%r14), %ecx
movb $0x18, (%r15)
cmpl $0x7f, %ecx
ja 0x27853
movb %cl, 0x1(%r15)
addq $0x2, %r15
jmp 0x27893
movl %ecx, %eax
orb $-0x80, %al
movb %al, 0x1(%r15)
movl %ecx, %eax
shrl $0x7, %eax
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x27872
movb %al, 0x2(%r15)
addq $0x3, %r15
jmp 0x27893
addq $0x3, %r15
movl %eax, %ecx
movl %ecx, %edx
orb $-0x80, %dl
movb %dl, -0x1(%r15)
shrl $0x7, %eax
incq %r15
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x27876
movb %al, -0x1(%r15)
testb $0x40, %r12b
je 0x278f9
cmpq %r15, (%rbx)
jbe 0x27d81
movl 0x50(%r14), %ecx
movb $0x20, (%r15)
cmpl $0x7f, %ecx
ja 0x278b9
movb %cl, 0x1(%r15)
addq $0x2, %r15
jmp 0x278f9
movl %ecx, %eax
orb $-0x80, %al
movb %al, 0x1(%r15)
movl %ecx, %eax
shrl $0x7, %eax
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x278d8
movb %al, 0x2(%r15)
addq $0x3, %r15
jmp 0x278f9
addq $0x3, %r15
movl %eax, %ecx
movl %ecx, %edx
orb $-0x80, %dl
movb %dl, -0x1(%r15)
shrl $0x7, %eax
incq %r15
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x278dc
movb %al, -0x1(%r15)
testb %r12b, %r12b
jns 0x2795e
cmpq %r15, (%rbx)
jbe 0x27d94
movl 0x54(%r14), %ecx
movb $0x28, (%r15)
cmpl $0x7f, %ecx
ja 0x2791e
movb %cl, 0x1(%r15)
addq $0x2, %r15
jmp 0x2795e
movl %ecx, %eax
orb $-0x80, %al
movb %al, 0x1(%r15)
movl %ecx, %eax
shrl $0x7, %eax
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x2793d
movb %al, 0x2(%r15)
addq $0x3, %r15
jmp 0x2795e
addq $0x3, %r15
movl %eax, %ecx
movl %ecx, %edx
orb $-0x80, %dl
movb %dl, -0x1(%r15)
shrl $0x7, %eax
incq %r15
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x27941
movb %al, -0x1(%r15)
btl $0x8, %r12d
jae 0x279c5
cmpq %r15, (%rbx)
jbe 0x27da7
movl 0x58(%r14), %ecx
movb $0x30, (%r15)
cmpl $0x7f, %ecx
ja 0x27985
movb %cl, 0x1(%r15)
addq $0x2, %r15
jmp 0x279c5
movl %ecx, %eax
orb $-0x80, %al
movb %al, 0x1(%r15)
movl %ecx, %eax
shrl $0x7, %eax
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x279a4
movb %al, 0x2(%r15)
addq $0x3, %r15
jmp 0x279c5
addq $0x3, %r15
movl %eax, %ecx
movl %ecx, %edx
orb $-0x80, %dl
movb %dl, -0x1(%r15)
shrl $0x7, %eax
incq %r15
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x279a8
movb %al, -0x1(%r15)
btl $0x9, %r12d
jae 0x27a2c
cmpq %r15, (%rbx)
jbe 0x27dba
movl 0x5c(%r14), %ecx
movb $0x38, (%r15)
cmpl $0x7f, %ecx
ja 0x279ec
movb %cl, 0x1(%r15)
addq $0x2, %r15
jmp 0x27a2c
movl %ecx, %eax
orb $-0x80, %al
movb %al, 0x1(%r15)
movl %ecx, %eax
shrl $0x7, %eax
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x27a0b
movb %al, 0x2(%r15)
addq $0x3, %r15
jmp 0x27a2c
addq $0x3, %r15
movl %eax, %ecx
movl %ecx, %edx
orb $-0x80, %dl
movb %dl, -0x1(%r15)
shrl $0x7, %eax
incq %r15
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x27a0f
movb %al, -0x1(%r15)
btl $0xa, %r12d
jae 0x27a93
cmpq %r15, (%rbx)
jbe 0x27dcd
movl 0x60(%r14), %ecx
movb $0x40, (%r15)
cmpl $0x7f, %ecx
ja 0x27a53
movb %cl, 0x1(%r15)
addq $0x2, %r15
jmp 0x27a93
movl %ecx, %eax
orb $-0x80, %al
movb %al, 0x1(%r15)
movl %ecx, %eax
shrl $0x7, %eax
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x27a72
movb %al, 0x2(%r15)
addq $0x3, %r15
jmp 0x27a93
addq $0x3, %r15
movl %eax, %ecx
movl %ecx, %edx
orb $-0x80, %dl
movb %dl, -0x1(%r15)
shrl $0x7, %eax
incq %r15
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x27a76
movb %al, -0x1(%r15)
btl $0xb, %r12d
jae 0x27ab3
cmpq %r15, (%rbx)
jbe 0x27de0
movl 0x64(%r14), %eax
movb $0x4d, (%r15)
movl %eax, 0x1(%r15)
addq $0x5, %r15
btl $0xc, %r12d
jae 0x27ad3
cmpq %r15, (%rbx)
jbe 0x27df3
movl 0x68(%r14), %eax
movb $0x55, (%r15)
movl %eax, 0x1(%r15)
addq $0x5, %r15
btl $0xd, %r12d
jae 0x27b3a
cmpq %r15, (%rbx)
jbe 0x27e06
movl 0x6c(%r14), %ecx
movb $0x58, (%r15)
cmpl $0x7f, %ecx
ja 0x27afa
movb %cl, 0x1(%r15)
addq $0x2, %r15
jmp 0x27b3a
movl %ecx, %eax
orb $-0x80, %al
movb %al, 0x1(%r15)
movl %ecx, %eax
shrl $0x7, %eax
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x27b19
movb %al, 0x2(%r15)
addq $0x3, %r15
jmp 0x27b3a
addq $0x3, %r15
movl %eax, %ecx
movl %ecx, %edx
orb $-0x80, %dl
movb %dl, -0x1(%r15)
shrl $0x7, %eax
incq %r15
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x27b1d
movb %al, -0x1(%r15)
testb $0x1, %r12b
je 0x27bb3
cmpq %r15, (%rbx)
jbe 0x27e19
movq 0x28(%r14), %rdi
movw $0x1a2, (%r15)          # imm = 0x1A2
movl 0x14(%rdi), %ecx
cmpl $0x7f, %ecx
ja 0x27b65
movb %cl, 0x2(%r15)
addq $0x3, %r15
jmp 0x27ba5
movl %ecx, %eax
orb $-0x80, %al
movb %al, 0x2(%r15)
movl %ecx, %eax
shrl $0x7, %eax
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x27b84
movb %al, 0x3(%r15)
addq $0x4, %r15
jmp 0x27ba5
addq $0x4, %r15
movl %eax, %ecx
movl %ecx, %edx
orb $-0x80, %dl
movb %dl, -0x1(%r15)
shrl $0x7, %eax
incq %r15
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x27b88
movb %al, -0x1(%r15)
movq %r15, %rsi
movq %rbx, %rdx
callq 0x24bf4
movq %rax, %r15
testb $0x2, %r12b
je 0x27c2c
cmpq %r15, (%rbx)
jbe 0x27e2c
movq 0x30(%r14), %rdi
movw $0x1aa, (%r15)          # imm = 0x1AA
movl 0x14(%rdi), %ecx
cmpl $0x7f, %ecx
ja 0x27bde
movb %cl, 0x2(%r15)
addq $0x3, %r15
jmp 0x27c1e
movl %ecx, %eax
orb $-0x80, %al
movb %al, 0x2(%r15)
movl %ecx, %eax
shrl $0x7, %eax
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x27bfd
movb %al, 0x3(%r15)
addq $0x4, %r15
jmp 0x27c1e
addq $0x4, %r15
movl %eax, %ecx
movl %ecx, %edx
orb $-0x80, %dl
movb %dl, -0x1(%r15)
shrl $0x7, %eax
incq %r15
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x27c01
movb %al, -0x1(%r15)
movq %r15, %rsi
movq %rbx, %rdx
callq 0x24bf4
movq %rax, %r15
testb $0x4, %r12b
je 0x27ca5
cmpq %r15, (%rbx)
jbe 0x27e3f
movq 0x38(%r14), %rdi
movw $0x1b2, (%r15)          # imm = 0x1B2
movl 0x14(%rdi), %ecx
cmpl $0x7f, %ecx
ja 0x27c57
movb %cl, 0x2(%r15)
addq $0x3, %r15
jmp 0x27c97
movl %ecx, %eax
orb $-0x80, %al
movb %al, 0x2(%r15)
movl %ecx, %eax
shrl $0x7, %eax
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x27c76
movb %al, 0x3(%r15)
addq $0x4, %r15
jmp 0x27c97
addq $0x4, %r15
movl %eax, %ecx
movl %ecx, %edx
orb $-0x80, %dl
movb %dl, -0x1(%r15)
shrl $0x7, %eax
incq %r15
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x27c7a
movb %al, -0x1(%r15)
movq %r15, %rsi
movq %rbx, %rdx
callq 0x258a2
movq %rax, %r15
testb $0x8, %r12b
je 0x27d1e
cmpq %r15, (%rbx)
jbe 0x27e52
movq 0x40(%r14), %rdi
movw $0x1ba, (%r15)          # imm = 0x1BA
movl 0x14(%rdi), %ecx
cmpl $0x7f, %ecx
ja 0x27cd0
movb %cl, 0x2(%r15)
addq $0x3, %r15
jmp 0x27d10
movl %ecx, %eax
orb $-0x80, %al
movb %al, 0x2(%r15)
movl %ecx, %eax
shrl $0x7, %eax
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x27cef
movb %al, 0x3(%r15)
addq $0x4, %r15
jmp 0x27d10
addq $0x4, %r15
movl %eax, %ecx
movl %ecx, %edx
orb $-0x80, %dl
movb %dl, -0x1(%r15)
shrl $0x7, %eax
incq %r15
cmpl $0x3fff, %ecx           # imm = 0x3FFF
ja 0x27cf3
movb %al, -0x1(%r15)
movq %r15, %rsi
movq %rbx, %rdx
callq 0x263cc
movq %rax, %r15
movq 0x8(%r14), %rdi
testb $0x1, %dil
jne 0x27d3a
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
andq $-0x2, %rdi
addq $0x8, %rdi
movq %r15, %rsi
movq %rbx, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xa230
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa750
movq %rax, %r15
jmp 0x277d6
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa750
movq %rax, %r15
jmp 0x2783c
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa750
movq %rax, %r15
jmp 0x278a2
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa750
movq %rax, %r15
jmp 0x27907
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa750
movq %rax, %r15
jmp 0x2796e
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa750
movq %rax, %r15
jmp 0x279d5
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa750
movq %rax, %r15
jmp 0x27a3c
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa750
movq %rax, %r15
jmp 0x27aa3
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa750
movq %rax, %r15
jmp 0x27ac3
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa750
movq %rax, %r15
jmp 0x27ae3
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa750
movq %rax, %r15
jmp 0x27b49
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa750
movq %rax, %r15
jmp 0x27bc2
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa750
movq %rax, %r15
jmp 0x27c3b
movq %rbx, %rdi
movq %r15, %rsi
callq 0xa750
movq %rax, %r15
jmp 0x27cb4
nop