// File: /workspace/github_cpp_makefile_star2_O1/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 0x4c8e
cmpl $0x1, %eax
je 0x4c60
testl %eax, %eax
jne 0x4e87
movl 0x8(%r14), %eax
cmpl $0x1, %eax
je 0x4d20
testl %eax, %eax
jne 0x4e87
movslq (%r14), %rcx
leal -0x8(%rcx), %eax
roll $0x1d, %eax
cmpl $0x7, %eax
ja 0x4e11
leaq 0x7447(%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 0x5b9a
movl (%r14), %eax
cmpl $0x40, %eax
je 0x4cd1
cmpl $0x20, %eax
jne 0x4e92
cvtsi2ssq (%rsi), %xmm0
movl 0x4(%r14), %esi
movq %rsp, %rdi
movss %xmm0, (%rdi)
movq %rbx, %rdx
callq 0x67ed
jmp 0x4e87
movl (%r14), %eax
cmpl $0x10, %eax
je 0x4cf0
cmpl $0x8, %eax
jne 0x4ee7
movl (%rsi), %edi
movq %rsp, %r14
movq %r14, %rsi
callq 0x61b6
cmpq %rax, %r14
je 0x4e87
movq %rax, %r15
movsbl (%r14), %esi
movq %rbx, %rdi
callq 0x6e82
incq %r14
cmpq %r15, %r14
jne 0x4cb8
jmp 0x4e87
movl 0x4(%r14), %eax
cvtsi2sdq (%rsi), %xmm0
movq %rsp, %rdi
movsd %xmm0, (%rdi)
movl %eax, %esi
movq %rbx, %rdx
callq 0x6842
jmp 0x4e87
movq (%rsi), %rax
movq %rax, %rcx
shrq $0x10, %rcx
testw %cx, %cx
je 0x4d58
movl %eax, %ecx
shrl $0xa, %ecx
addl $0xffffd7c0, %ecx       # imm = 0xFFFFD7C0
leaq 0x4(%rsp), %r15
movw %cx, -0x4(%r15)
andl $0x3ff, %eax            # imm = 0x3FF
orl $0xdc00, %eax           # imm = 0xDC00
jmp 0x4d5d
movl (%r14), %edx
leal -0x8(%rdx), %eax
roll $0x1d, %eax
cmpl $0x7, %eax
ja 0x4e2f
leaq 0x732f(%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 0x5e5f
leaq 0x2(%rsp), %r15
movw %ax, -0x2(%r15)
movl 0x4(%r14), %ebp
movq %rsp, %r14
movq %r14, %rdi
movl %ebp, %esi
movq %rbx, %rdx
callq 0x64cd
addq $0x2, %r14
cmpq %r15, %r14
jne 0x4d69
jmp 0x4e87
movl 0x4(%r14), %edi
movq %rbx, %rdx
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5d02
movl 0x4(%r14), %edi
movq %rbx, %rdx
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5fc8
movl 0x4(%r14), %edi
movq %rbx, %rdx
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5c4b
movl 0x4(%r14), %edi
movq %rbx, %rdx
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x5f11
movl 0x4(%r14), %eax
movq (%rsi), %rcx
movq %rsp, %rdi
movq %rcx, (%rdi)
movl %eax, %esi
movq %rbx, %rdx
callq 0x655e
jmp 0x4e87
movl 0x4(%r14), %eax
movq (%rsi), %rcx
movq %rsp, %rdi
movq %rcx, (%rdi)
movl %eax, %esi
movq %rbx, %rdx
callq 0x672e
jmp 0x4e87
movq (%rsi), %rsi
movq %rsi, 0x20(%rsp)
movq %rsi, %rax
shrq %cl, %rax
testq %rax, %rax
jne 0x4f96
movq %rbx, %rdi
movl %ecx, %edx
jmp 0x4e82
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 0x4f3c
decl %esi
movslq %esi, %rcx
cmpq %rcx, %rax
jg 0x4f3c
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 0x6eec
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x3100
movq %rax, %r14
leaq 0x72d3(%rip), %rsi      # 0xc179
leaq 0x72df(%rip), %rdx      # 0xc18c
leaq 0x7787(%rip), %rcx      # 0xc63b
movq %rsp, %rdi
callq 0x6124
movb $0x1, %bpl
movq %rsp, %rsi
movq %r14, %rdi
callq 0x32e0
xorl %ebp, %ebp
movq 0xd0e5(%rip), %rsi      # 0x11fb8
movq 0xd0c6(%rip), %rdx      # 0x11fa0
movq %r14, %rdi
callq 0x3360
jmp 0x4fee
movl $0x10, %edi
callq 0x3100
movq %rax, %r14
leaq 0x727e(%rip), %rsi      # 0xc179
leaq 0x72a2(%rip), %rdx      # 0xc1a4
leaq 0x7732(%rip), %rcx      # 0xc63b
movq %rsp, %rdi
callq 0x628b
movb $0x1, %bpl
movq %rsp, %rsi
movq %r14, %rdi
callq 0x32e0
xorl %ebp, %ebp
movq 0xd090(%rip), %rsi      # 0x11fb8
movq 0xd071(%rip), %rdx      # 0x11fa0
movq %r14, %rdi
callq 0x3360
jmp 0x4fee
movl $0x10, %edi
callq 0x3100
movq %rax, %r15
leaq 0x71db(%rip), %rsi      # 0xc12b
leaq 0x7207(%rip), %rcx      # 0xc15e
leaq 0x71f2(%rip), %r9       # 0xc150
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
movq %r14, %r8
callq 0x607d
movb $0x1, %bpl
movq %rsp, %rsi
movq %r15, %rdi
callq 0x3310
xorl %ebp, %ebp
movq 0xd06b(%rip), %rsi      # 0x11ff0
movq 0xcffc(%rip), %rdx      # 0x11f88
movq %r15, %rdi
callq 0x3360
jmp 0x4fee
movl $0x10, %edi
callq 0x3100
movq %rax, %r15
leaq 0x7181(%rip), %rsi      # 0xc12b
leaq 0x7182(%rip), %rcx      # 0xc133
leaq 0x7198(%rip), %r9       # 0xc150
movq %rsp, %rdi
leaq 0x20(%rsp), %rdx
movq %r14, %r8
callq 0x5db8
movb $0x1, %bpl
movq %rsp, %rsi
movq %r15, %rdi
callq 0x3310
xorl %ebp, %ebp
movq 0xd011(%rip), %rsi      # 0x11ff0
movq 0xcfa2(%rip), %rdx      # 0x11f88
movq %r15, %rdi
callq 0x3360
jmp 0x4ff2
jmp 0x5012
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5018
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3210
jmp 0x5018
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0x5059
movq %r15, %rdi
jmp 0x5054
jmp 0x5026
jmp 0x5046
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x504c
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x3210
jmp 0x504c
movq %rax, %rbx
movb $0x1, %bpl
testb %bpl, %bpl
je 0x5059
movq %r14, %rdi
callq 0x3170
movq %rbx, %rdi
callq 0x3380