// File: /workspace/github_cpp_makefile_star2_O3/evincarofautumn[P]protodata/./write.h
// Function: void write_integer<long>(Interpreter::State const&, long const&, Stream&)
void write_integer
  (const Interpreter::State& state, const T& input, Stream& output) {
  const auto& endianness = state.endianness;
  switch (state.format) {
  case Term::INTEGER:
    switch (state.signedness) {
    case Term::UNSIGNED:
      switch (state.width) {
      case 8:
        write_integer_value<uint8_t>(endianness, input, output);
        break;
      case 16:
        write_integer_value<uint16_t>(endianness, input, output);
        break;
      case 32:
        write_integer_value<uint32_t>(endianness, input, output);
        break;
      case 64:
        write_integer_value<uint64_t>(endianness, input, output);
        break;
      default:
        {
          const uint64_t buffer(input);
          if (buffer & ~((1 << state.width) - 1))
            throw std::runtime_error(join("Value (", buffer,
              ") exceeds range of unsigned ", state.width, "-bit integer."));
          output.write(buffer, state.width);
        }
      }
      break;
    case Term::SIGNED:
      switch (state.width) {
      case 8:
        write_integer_value<int8_t>(endianness, input, output);
        break;
      case 16:
        write_integer_value<int16_t>(endianness, input, output);
        break;
      case 32:
        write_integer_value<int32_t>(endianness, input, output);
        break;
      case 64:
        write_integer_value<int64_t>(endianness, input, output);
        break;
      default:
        {
          const int64_t promoted(input);
          if (promoted < -(1 << (state.width - 1))
            || promoted > (1 << (state.width - 1)) - 1)
            throw std::runtime_error(join("Value (", promoted,
              ") exceeds range of signed ", state.width, "-bit integer."));
          uint64_t buffer;
          if (promoted < 0) {
            buffer = -promoted;
            buffer = (~buffer + 1) & ((1ull << state.width) - 1);
          } else {
            buffer = promoted;
          }
          output.write(buffer, state.width);
        }
      }
      break;
    }
    break;
  case Term::FLOAT:
    switch (state.width) {
    case 32:
      write_float_value<float>(endianness, input, output);
      break;
    case 64:
      write_float_value<double>(endianness, input, output);
      break;
    default:
      IMPOSSIBLE("invalid float bit width");
    }
    break;
  case Term::UNICODE:
    switch (state.width) {
    case 8:
      write_unicode_value<uint8_t>(endianness, input, output, utf8::append);
      break;
    case 16:
      write_unicode_value<uint16_t>(endianness, input, output, utf8::append16);
      break;
    default:
      IMPOSSIBLE("invalid Unicode bit width");
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdx, %rbx
movq %rdi, %r14
movl 0xc(%rdi), %eax
cmpl $0x2, %eax
je 0x4aee
cmpl $0x1, %eax
je 0x4ac0
testl %eax, %eax
jne 0x4ce8
movl 0x8(%r14), %eax
cmpl $0x1, %eax
je 0x4b80
testl %eax, %eax
jne 0x4ce8
movslq (%r14), %rcx
leal -0x8(%rcx), %eax
roll $0x1d, %eax
cmpl $0x7, %eax
ja 0x4c72
leaq 0x75e7(%rip), %rdx      # 0xc088
movslq (%rdx,%rax,4), %rax
addq %rdx, %rax
jmpq *%rax
movl 0x4(%r14), %edi
movq %rbx, %rdx
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x59f8
movl (%r14), %eax
cmpl $0x40, %eax
je 0x4b31
cmpl $0x20, %eax
jne 0x4cf3
cvtsi2ssq (%rsi), %xmm0
movl 0x4(%r14), %esi
movq %rsp, %rdi
movss %xmm0, (%rdi)
movq %rbx, %rdx
callq 0x663f
jmp 0x4ce8
movl (%r14), %eax
cmpl $0x10, %eax
je 0x4b50
cmpl $0x8, %eax
jne 0x4d48
movl (%rsi), %edi
movq %rsp, %r14
movq %r14, %rsi
callq 0x6002
cmpq %rax, %r14
je 0x4ce8
movq %rax, %r15
movsbl (%r14), %esi
movq %rbx, %rdi
callq 0x6cc0
incq %r14
cmpq %r15, %r14
jne 0x4b18
jmp 0x4ce8
movl 0x4(%r14), %eax
cvtsi2sdq (%rsi), %xmm0
movq %rsp, %rdi
movsd %xmm0, (%rdi)
movl %eax, %esi
movq %rbx, %rdx
callq 0x6694
jmp 0x4ce8
movq (%rsi), %rax
movq %rax, %rcx
shrq $0x10, %rcx
testw %cx, %cx
je 0x4bb8
movl %eax, %ecx
shrl $0xa, %ecx
addl $0xffffd7c0, %ecx       # imm = 0xFFFFD7C0
andl $0x3ff, %eax            # imm = 0x3FF
orl $0xdc00, %eax           # imm = 0xDC00
leaq 0x4(%rsp), %r15
movw %ax, -0x2(%r15)
jmp 0x4bbf
movl (%r14), %edx
leal -0x8(%rdx), %eax
roll $0x1d, %eax
cmpl $0x7, %eax
ja 0x4c90
leaq 0x74cf(%rip), %rcx      # 0xc068
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0x4(%r14), %edi
movq %rbx, %rdx
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5cb4
leaq 0x2(%rsp), %r15
movl %eax, %ecx
movl 0x4(%r14), %ebp
movq %rsp, %r14
movw %cx, (%r14)
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x6319
addq $0x2, %r14
cmpq %r15, %r14
jne 0x4bca
jmp 0x4ce8
movl 0x4(%r14), %edi
movq %rbx, %rdx
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5b5a
movl 0x4(%r14), %edi
movq %rbx, %rdx
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5e17
movl 0x4(%r14), %edi
movq %rbx, %rdx
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5aa6
movl 0x4(%r14), %edi
movq %rbx, %rdx
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5d63
movl 0x4(%r14), %eax
movq (%rsi), %rcx
movq %rsp, %rdi
movq %rcx, (%rdi)
movl %eax, %esi
movq %rbx, %rdx
callq 0x63ad
jmp 0x4ce8
movl 0x4(%r14), %eax
movq (%rsi), %rcx
movq %rsp, %rdi
movq %rcx, (%rdi)
movl %eax, %esi
movq %rbx, %rdx
callq 0x6580
jmp 0x4ce8
movq (%rsi), %rsi
movq %rsi, 0x20(%rsp)
movq %rsi, %rax
shrq %cl, %rax
testq %rax, %rax
jne 0x4df7
movq %rbx, %rdi
movl %ecx, %edx
jmp 0x4ce3
movq (%rsi), %rax
movq %rax, 0x20(%rsp)
leal -0x1(%rdx), %ecx
movl $0x1, %esi
shll %cl, %esi
movl %esi, %ecx
negl %ecx
movslq %ecx, %rcx
cmpq %rcx, %rax
jl 0x4d9d
decl %esi
movslq %esi, %rcx
cmpq %rcx, %rax
jg 0x4d9d
movq $-0x1, %rdi
movq $-0x1, %rsi
movl %edx, %ecx
shlq %cl, %rsi
notq %rsi
testq %rax, %rax
cmovnsq %rdi, %rsi
andq %rax, %rsi
movq %rbx, %rdi
callq 0x6d2a
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x3100
movq %rax, %r14
leaq 0x7472(%rip), %rsi      # 0xc179
leaq 0x747e(%rip), %rdx      # 0xc18c
leaq 0x7923(%rip), %rcx      # 0xc638
movq %rsp, %rdi
callq 0x5f70
movb $0x1, %bpl
movq %rsp, %rsi
movq %r14, %rdi
callq 0x32e0
xorl %ebp, %ebp
movq 0xd284(%rip), %rsi      # 0x11fb8
movq 0xd265(%rip), %rdx      # 0x11fa0
movq %r14, %rdi
callq 0x3360
jmp 0x4e4f
movl $0x10, %edi
callq 0x3100
movq %rax, %r14
leaq 0x741d(%rip), %rsi      # 0xc179
leaq 0x7441(%rip), %rdx      # 0xc1a4
leaq 0x78ce(%rip), %rcx      # 0xc638
movq %rsp, %rdi
callq 0x60d7
movb $0x1, %bpl
movq %rsp, %rsi
movq %r14, %rdi
callq 0x32e0
xorl %ebp, %ebp
movq 0xd22f(%rip), %rsi      # 0x11fb8
movq 0xd210(%rip), %rdx      # 0x11fa0
movq %r14, %rdi
callq 0x3360
jmp 0x4e4f
movl $0x10, %edi
callq 0x3100
movq %rax, %r15
leaq 0x737a(%rip), %rsi      # 0xc12b
leaq 0x73a6(%rip), %rcx      # 0xc15e
leaq 0x7391(%rip), %r9       # 0xc150
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
movq %r14, %r8
callq 0x5ec9
movb $0x1, %bpl
movq %rsp, %rsi
movq %r15, %rdi
callq 0x3310
xorl %ebp, %ebp
movq 0xd20a(%rip), %rsi      # 0x11ff0
movq 0xd19b(%rip), %rdx      # 0x11f88
movq %r15, %rdi
callq 0x3360
jmp 0x4e4f
movl $0x10, %edi
callq 0x3100
movq %rax, %r15
leaq 0x7320(%rip), %rsi      # 0xc12b
leaq 0x7321(%rip), %rcx      # 0xc133
leaq 0x7337(%rip), %r9       # 0xc150
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
movq %r14, %r8
callq 0x5c0d
movb $0x1, %bpl
movq %rsp, %rsi
movq %r15, %rdi
callq 0x3310
xorl %ebp, %ebp
movq 0xd1b0(%rip), %rsi      # 0x11ff0
movq 0xd141(%rip), %rdx      # 0x11f88
movq %r15, %rdi
callq 0x3360
jmp 0x4e53
jmp 0x4e78
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4e71
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3210
testb %bpl, %bpl
jne 0x4e7b
jmp 0x4eb4
movq %rax, %rbx
movq %r15, %rdi
jmp 0x4eaf
jmp 0x4e84
jmp 0x4ea9
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4ea2
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3210
testb %bpl, %bpl
jne 0x4eac
jmp 0x4eb4
movq %rax, %rbx
movq %r14, %rdi
callq 0x3170
movq %rbx, %rdi
callq 0x3380