// File: /workspace/github_cpp_makefile_star2_O2/Eronana[P]strawberry/src/codedata.cpp
// Function: write_code_data(char const*, int, std::vector<int, std::allocator<int>>, std::vector<double, std::allocator<double>>, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>, std::vector<unsigned char, std::allocator<unsigned char>>)
bool write_code_data(const char *filename,int entry_point,vector<int> int_table_list,vector<FLOAT_TYPE> float_table_list,vector<string> string_table_list,vector<CODE> code)
{
    FILE *fp=fopen(filename,"wb");
    if(!fp)return false;
    CodeConfig config;
    config.magic=HEADER_MAGIC;
    config.int_table_size=int_table_list.size();
    config.float_table_size=float_table_list.size();
    config.string_table_size=string_table_list.size();
    config.string_raw_size=0;
    config.entry_point=entry_point;
    config.code_raw_size=code.size();
    for(int i=0;i<string_table_list.size();i++)config.string_raw_size+=string_table_list[i].length()+1;
    fwrite(&config,sizeof(config),1,fp);

    // int table
    fwrite(&int_table_list[0],sizeof(int_table_list[0]),int_table_list.size(),fp);
    // float table
    fwrite(&float_table_list[0],sizeof(float_table_list[0]),float_table_list.size(),fp);
    //string table
    for(int i=0;i<string_table_list.size();i++)
    {
        string &s=string_table_list[i];
        fwrite(s.c_str(),1,s.length()+1,fp);
    }
    //code
    fwrite(&code[0],sizeof(code[0]),code.size(),fp);
    fclose(fp);
    return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r9, %r14
movq %r8, %r15
movq %rcx, %r12
movq %rdx, %r13
movl %esi, %ebp
leaq 0x4643(%rip), %rsi      # 0x1e466
callq 0x62c0
movq %rax, %rbx
testq %rax, %rax
je 0x19f47
movl $0x414e5245, 0x8(%rsp)  # imm = 0x414E5245
movq 0x8(%r13), %rax
subq (%r13), %rax
sarq $0x2, %rax
movq %rax, 0x10(%rsp)
movq 0x8(%r12), %rax
subq (%r12), %rax
sarq $0x3, %rax
movq %rax, 0x18(%rsp)
movq (%r15), %rax
movq 0x8(%r15), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
movq %rcx, 0x20(%rsp)
movslq %ebp, %rdx
movq %rdx, 0x40(%rsp)
movq 0x8(%r14), %rdx
subq (%r14), %rdx
movq %rdx, 0x30(%rsp)
addq $0x8, %rax
xorl %edx, %edx
subq $0x1, %rcx
jb 0x19ea1
movq (%rax), %rsi
addq %rsi, %rdx
incq %rdx
addq $0x20, %rax
jmp 0x19e8c
leaq 0x8(%rsp), %rdi
movq %rdx, 0x20(%rdi)
pushq $0x40
popq %rsi
pushq $0x1
popq %rbp
movq %rbp, %rdx
movq %rbx, %rcx
callq 0x64c0
movq (%r13), %rdi
movq 0x8(%r13), %rdx
subq %rdi, %rdx
sarq $0x2, %rdx
pushq $0x4
popq %rsi
movq %rbx, %rcx
callq 0x64c0
movq (%r12), %rdi
movq 0x8(%r12), %rdx
subq %rdi, %rdx
sarq $0x3, %rdx
pushq $0x8
popq %r12
movq %r12, %rsi
movq %rbx, %rcx
callq 0x64c0
xorl %r13d, %r13d
movq (%r15), %rax
movq 0x8(%r15), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
cmpq %r13, %rcx
jbe 0x19f2a
movq -0x8(%rax,%r12), %rdi
movq (%rax,%r12), %rdx
incq %rdx
movq %rbp, %rsi
movq %rbx, %rcx
callq 0x64c0
incq %r13
addq $0x20, %r12
jmp 0x19ef7
movq (%r14), %rdi
movq 0x8(%r14), %rdx
subq %rdi, %rdx
pushq $0x1
popq %rsi
movq %rbx, %rcx
callq 0x64c0
movq %rbx, %rdi
callq 0x6220
testq %rbx, %rbx
setne %al
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq