// File: /workspace/github_cpp_makefile_star2_O1/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 0x4257(%rip), %rsi      # 0x2149a
callq 0x62d0
movq %rax, %rbx
testq %rax, %rax
je 0x1d38f
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), %rsi
movq %rsi, %rcx
subq %rax, %rcx
sarq $0x5, %rcx
movq %rcx, 0x20(%rsp)
movq $0x0, 0x28(%rsp)
movslq %ebp, %rdx
movq %rdx, 0x40(%rsp)
movq 0x8(%r14), %rdi
subq (%r14), %rdi
xorl %edx, %edx
movq %rdi, 0x30(%rsp)
cmpq %rax, %rsi
je 0x1d2d7
cmpq $0x1, %rcx
adcq $0x0, %rcx
addq $0x8, %rax
movq (%rax), %rsi
addq %rsi, %rdx
incq %rdx
addq $0x20, %rax
decq %rcx
jne 0x1d2c5
leaq 0x8(%rsp), %rdi
movq %rdx, 0x20(%rdi)
movl $0x40, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x64b0
movq (%r13), %rdi
movq 0x8(%r13), %rdx
subq %rdi, %rdx
sarq $0x2, %rdx
movl $0x4, %esi
movq %rbx, %rcx
callq 0x64b0
movq (%r12), %rdi
movq 0x8(%r12), %rdx
subq %rdi, %rdx
sarq $0x3, %rdx
movl $0x8, %r12d
movl $0x8, %esi
movq %rbx, %rcx
callq 0x64b0
movq (%r15), %rax
cmpq %rax, 0x8(%r15)
je 0x1d370
xorl %r13d, %r13d
movq -0x8(%rax,%r12), %rdi
movq (%rax,%r12), %rdx
incq %rdx
movl $0x1, %esi
movq %rbx, %rcx
callq 0x64b0
incq %r13
movq (%r15), %rax
movq 0x8(%r15), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
addq $0x20, %r12
cmpq %r13, %rcx
ja 0x1d33d
movq (%r14), %rdi
movq 0x8(%r14), %rdx
subq %rdi, %rdx
movl $0x1, %esi
movq %rbx, %rcx
callq 0x64b0
movq %rbx, %rdi
callq 0x6210
testq %rbx, %rbx
setne %al
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq