// File: /workspace/github_cpp_makefile_star2_O2/acliusBackHome[P]kamaya/dist/ParseType.cpp
// Function: ParseType::get_struct(std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned long>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned long>>> const&, std::vector<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned long>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, unsigned long>>> const&)
ParseType ParseType::get_struct(const vector<pair<string, size_t> > &otherTypes,
                                const vector<pair<string, size_t> > &self_ptr) {
    if(id2type.empty()) {
        init();
    }
    size_t new_type_id = id2type.size();
    // 给新类型预分配位置
    // 这有个"特性": 如果重复调用此函数试图生成一模一样的结构体会被看成两个
    id2type.emplace_back(T_UNKNOWN);
    ParseType &res = id2type[new_type_id];
    res.base_type = T_UNKNOWN;
    res.type_id = (size_t) -1;
    res.lower_type = 0;
    res.fields = new map<string, size_t>();
    res.type_size = res.pointer_level = res.array_size = 0;
    auto &res_fields = *res.fields;
    for (const auto &field: otherTypes) {
        if (res_fields.find(field.first) == res_fields.end()) {
            (*res.fields)[field.first] = field.second;
            res.type_size += get_type(field.second).get_size();
        } else {
            return ParseType();
        }
    }
    for (const auto &self_ptr_field: self_ptr) {
        if (res_fields.find(self_ptr_field.first) == res_fields.end()) {
            ParseType ptr(T_UNKNOWN, new_type_id, nullptr, sizeof(void *), self_ptr_field.second, 0);
            res.type_size += ptr.type_size;
            (*res.fields)[self_ptr_field.first] = get_type_id(ptr);
        } else {
            return ParseType();
        }
    }
    type2id[res] = res.type_id = new_type_id;
    return res;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdx, -0x38(%rbp)
movq %rsi, %r13
movq %rdi, -0x30(%rbp)
movq 0x32649(%rip), %rax     # 0x542c8
movq 0x3264a(%rip), %rbx     # 0x542d0
cmpq %rbx, %rax
jne 0x21c9e
callq 0x21e7c
movq 0x32639(%rip), %rbx     # 0x542d0
movq 0x3262a(%rip), %rax     # 0x542c8
subq %rax, %rbx
pushq $0x38
popq %rcx
movq %rbx, %rax
cqto
idivq %rcx
movq %rax, -0x40(%rbp)
leaq -0x88(%rbp), %rsi
andl $0x0, (%rsi)
leaq 0x32607(%rip), %rdi     # 0x542c8
callq 0x22a0e
movq 0x325fb(%rip), %rax     # 0x542c8
leaq (%rax,%rbx), %r14
addq $0x20, %r14
andl $0x0, -0x20(%r14)
orq $-0x1, -0x8(%r14)
leaq (%rax,%rbx), %r15
andq $0x0, -0x18(%r14)
pushq $0x30
popq %rdi
callq 0x42a0
movq %rax, %r12
addq $0x8, %rax
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%r12)
movaps %xmm0, (%r12)
movq %rax, 0x18(%r12)
movq %rax, -0x48(%rbp)
movq %rax, 0x20(%r12)
andq $0x0, 0x28(%r12)
movq %r12, -0x10(%r14)
andq $0x0, 0x10(%r14)
movq %r14, -0x50(%rbp)
movups %xmm0, (%r14)
movq (%r13), %rbx
movq 0x8(%r13), %r14
cmpq %r14, %rbx
je 0x21d76
movq %r12, %rdi
movq %rbx, %rsi
callq 0x17536
cmpq -0x48(%rbp), %rax
jne 0x21e0c
movq 0x20(%rbx), %r13
movq 0x10(%r15), %rdi
movq %rbx, %rsi
callq 0x164c0
movq %r13, (%rax)
movq 0x20(%rbx), %rdi
callq 0x21a26
movq 0x20(%rax), %rax
addq %rax, 0x20(%r15)
addq $0x28, %rbx
jmp 0x21d32
movq -0x38(%rbp), %rax
movq (%rax), %r13
movq 0x8(%rax), %rax
movq %rax, -0x38(%rbp)
leaq -0x88(%rbp), %r14
cmpq -0x38(%rbp), %r13
je 0x21e29
movq %r12, %rdi
movq %r13, %rsi
callq 0x17536
cmpq -0x48(%rbp), %rax
jne 0x21e0c
movq 0x20(%r13), %rax
andq $0x0, -0x88(%rbp)
movq -0x40(%rbp), %rcx
movq %rcx, -0x80(%rbp)
andq $0x0, -0x78(%rbp)
movq $0x8, -0x68(%rbp)
movq %rax, -0x60(%rbp)
andq $0x0, -0x58(%rbp)
orq $-0x1, -0x70(%rbp)
movq -0x50(%rbp), %rax
addq $0x8, (%rax)
movq %r14, %rbx
movq %r14, %rdi
callq 0x21942
movq %rax, %r14
movq 0x10(%r15), %rdi
movq %r13, %rsi
callq 0x164c0
movq %r14, (%rax)
movq %rbx, %r14
movq %rbx, %rdi
callq 0x21c36
addq $0x28, %r13
jmp 0x21d8c
movq -0x30(%rbp), %rbx
andl $0x0, (%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rbx)
movups %xmm0, 0x8(%rbx)
movups %xmm0, 0x28(%rbx)
orq $-0x1, 0x18(%rbx)
jmp 0x21e52
movq -0x40(%rbp), %rbx
movq %rbx, 0x18(%r15)
leaq 0x32460(%rip), %rdi     # 0x54298
movq %r15, %rsi
callq 0x22a46
movq %rbx, (%rax)
movq -0x30(%rbp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x210f4
movq %rbx, %rax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x88(%rbp), %rdi
callq 0x21c36
movq %rbx, %rdi
callq 0x4500
nop