// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
movl 0xc(%rdi), %eax
cmpl $0x2, %eax
je 0x4205
cmpl $0x1, %eax
je 0x41e5
testl %eax, %eax
jne 0x4353
movl 0x8(%rbx), %eax
cmpl $0x1, %eax
je 0x4253
testl %eax, %eax
jne 0x4353
movslq (%rbx), %rcx
leal -0x8(%rcx), %eax
roll $0x1d, %eax
cmpl $0x7, %eax
ja 0x42e4
leaq 0x6ebc(%rip), %rdi      # 0xb088
movslq (%rdi,%rax,4), %rax
addq %rdi, %rax
jmpq *%rax
movl 0x4(%rbx), %edi
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x4f13
movl (%rbx), %eax
cmpl $0x40, %eax
je 0x422c
cmpl $0x20, %eax
jne 0x435c
movl 0x4(%rbx), %edi
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x53f0
movl (%rbx), %eax
cmpl $0x10, %eax
je 0x423c
cmpl $0x8, %eax
jne 0x43b3
movl 0x4(%rbx), %edi
leaq 0x12ae(%rip), %rcx      # 0x54cd
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x5490
movl 0x4(%rbx), %edi
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x5408
movl 0x4(%rbx), %edi
leaq 0x1398(%rip), %rcx      # 0x55de
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x55a0
movl (%rbx), %eax
leal -0x8(%rax), %ecx
roll $0x1d, %ecx
cmpl $0x7, %ecx
ja 0x4302
leaq 0x6dfd(%rip), %rdi      # 0xb068
movslq (%rdi,%rcx,4), %rcx
addq %rdi, %rcx
jmpq *%rcx
movl 0x4(%rbx), %edi
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x5182
movl 0x4(%rbx), %edi
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x5050
movl 0x4(%rbx), %edi
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x52bf
movl 0x4(%rbx), %edi
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x4fb1
movl 0x4(%rbx), %edi
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x5220
movl 0x4(%rbx), %edi
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x50ee
movl 0x4(%rbx), %edi
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x535c
movq (%rsi), %rsi
movq %rsi, 0x8(%rsp)
movq %rsi, %rax
shrq %cl, %rax
testq %rax, %rax
jne 0x4466
movq %rdx, %rdi
movl %ecx, %edx
jmp 0x434e
movq (%rsi), %rdi
movq %rdi, 0x8(%rsp)
leal -0x1(%rax), %ecx
pushq $0x1
popq %rsi
shll %cl, %esi
movl %esi, %ecx
negl %ecx
movslq %ecx, %rcx
cmpq %rcx, %rdi
jl 0x440a
decl %esi
movslq %esi, %rcx
cmpq %rcx, %rdi
jg 0x440a
pushq $-0x1
popq %r8
movq %r8, %rsi
movl %eax, %ecx
shlq %cl, %rsi
notq %rsi
testq %rdi, %rdi
cmovnsq %r8, %rsi
andq %rdi, %rsi
movq %rdx, %rdi
movl %eax, %edx
callq 0x6284
addq $0x30, %rsp
popq %rbx
popq %r14
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0x3120
movq %rax, %r14
leaq 0x6e0b(%rip), %rsi      # 0xb179
leaq 0x6e17(%rip), %rdx      # 0xb18c
leaq 0x72bf(%rip), %rcx      # 0xb63b
leaq 0x10(%rsp), %rdi
callq 0x5420
movb $0x1, %bpl
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x3320
xorl %ebp, %ebp
movq 0xdc19(%rip), %rsi      # 0x11fb8
movq 0xdbfa(%rip), %rdx      # 0x11fa0
movq %r14, %rdi
callq 0x3390
jmp 0x44c0
pushq $0x10
popq %rdi
callq 0x3120
movq %rax, %r14
leaq 0x6db4(%rip), %rsi      # 0xb179
leaq 0x6dd8(%rip), %rdx      # 0xb1a4
leaq 0x7268(%rip), %rcx      # 0xb63b
leaq 0x10(%rsp), %rdi
callq 0x5611
movb $0x1, %bpl
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x3320
xorl %ebp, %ebp
movq 0xdbc2(%rip), %rsi      # 0x11fb8
movq 0xdba3(%rip), %rdx      # 0x11fa0
movq %r14, %rdi
callq 0x3390
jmp 0x44c0
pushq $0x10
popq %rdi
callq 0x3120
movq %rax, %r14
leaq 0x6d0f(%rip), %rsi      # 0xb12b
leaq 0x6d3b(%rip), %rcx      # 0xb15e
leaq 0x6d26(%rip), %r9       # 0xb150
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movq %rbx, %r8
callq 0x5371
movb $0x1, %bpl
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x3350
xorl %ebp, %ebp
movq 0xdb9b(%rip), %rsi      # 0x11ff0
movq 0xdb34(%rip), %rdx      # 0x11f90
movq %r14, %rdi
callq 0x3390
jmp 0x44c0
pushq $0x10
popq %rdi
callq 0x3120
movq %rax, %r14
leaq 0x6cb3(%rip), %rsi      # 0xb12b
leaq 0x6cb4(%rip), %rcx      # 0xb133
leaq 0x6cca(%rip), %r9       # 0xb150
leaq 0x10(%rsp), %rdi
leaq 0x8(%rsp), %rdx
movq %rbx, %r8
callq 0x5103
movb $0x1, %bpl
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x3350
xorl %ebp, %ebp
movq 0xdb3f(%rip), %rsi      # 0x11ff0
movq 0xdad8(%rip), %rdx      # 0x11f90
movq %r14, %rdi
callq 0x3390
jmp 0x44cc
jmp 0x44e0
jmp 0x44cc
jmp 0x44e0
jmp 0x44cc
jmp 0x44e0
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x3110
testb %bpl, %bpl
jne 0x44e3
jmp 0x44eb
movq %rax, %rbx
movq %r14, %rdi
callq 0x3180
movq %rbx, %rdi
callq 0x33b0