// File: xjrueda[P]fixprime/src/Message.cpp
// Function: fprime::Message::toFix[abi:cxx11]()
string Message::toFix() {
        string strHeader, strBody, strTrailer, strDummy;

        unsigned int bodyLength = 0;
        unsigned int dummy = 0;
        bool isBody = false;

        header->stringify(strDummy, isBody, bodyLength);
        body->stringify(strBody, isBody, bodyLength);
        header->getChild(9)->setValue(boost::lexical_cast<string>(bodyLength));
        header->stringify(strHeader, isBody, dummy);
        trailer->stringify(strTrailer, isBody, dummy);

        //calculate checksum
        fprime::FixParser fparser;
        unsigned int checkSum = fparser.checkSum(strHeader + strBody + strTrailer);
        
        stringstream ssCheckSum;
        ssCheckSum << std::setw (3) << std::setfill('0')<< checkSum;
        trailer->getChild(10)->setValue(ssCheckSum.str());
        isBody = false;
        strTrailer.clear();
        trailer->stringify(strTrailer, isBody, dummy);
        return strHeader + strBody + strTrailer;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x390, %rsp            # imm = 0x390
movq %rdi, -0x348(%rbp)
movq %rdi, %rax
movq %rax, -0x340(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x338(%rbp)
leaq -0x30(%rbp), %rdi
callq 0xa0780
leaq -0x50(%rbp), %rdi
callq 0xa0780
leaq -0x70(%rbp), %rdi
callq 0xa0780
leaq -0x90(%rbp), %rdi
movq %rdi, -0x330(%rbp)
callq 0xa0780
movq -0x338(%rbp), %rdi
movl $0x0, -0x94(%rbp)
movl $0x0, -0x98(%rbp)
movb $0x0, -0x99(%rbp)
addq $0x8, %rdi
callq 0x98080
movq -0x330(%rbp), %rsi
movq %rax, %rdi
leaq -0x99(%rbp), %rdx
leaq -0x94(%rbp), %rcx
callq 0x97470
jmp 0xca027
movq -0x338(%rbp), %rdi
addq $0x18, %rdi
callq 0x98080
movq %rax, %rdi
leaq -0x50(%rbp), %rsi
leaq -0x99(%rbp), %rdx
leaq -0x94(%rbp), %rcx
callq 0x97470
jmp 0xca053
movq -0x338(%rbp), %rdi
addq $0x8, %rdi
callq 0x98080
movq %rax, %rsi
leaq -0xc0(%rbp), %rdi
movl $0x9, %edx
callq 0x9e5d0
jmp 0xca079
leaq -0xc0(%rbp), %rdi
callq 0x98080
movq %rax, -0x350(%rbp)
leaq -0xe0(%rbp), %rdi
leaq -0x94(%rbp), %rsi
callq 0x9a9f0
jmp 0xca0a1
movq -0x350(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x9a780
jmp 0xca0b6
leaq -0xe0(%rbp), %rdi
callq 0xa4f00
leaq -0xc0(%rbp), %rdi
callq 0x997e0
movq -0x338(%rbp), %rdi
addq $0x8, %rdi
callq 0x98080
movq %rax, %rdi
leaq -0x30(%rbp), %rsi
leaq -0x99(%rbp), %rdx
leaq -0x98(%rbp), %rcx
callq 0x97470
jmp 0xca0fa
movq -0x338(%rbp), %rdi
addq $0x28, %rdi
callq 0x98080
movq %rax, %rdi
leaq -0x70(%rbp), %rsi
leaq -0x99(%rbp), %rdx
leaq -0x98(%rbp), %rcx
callq 0x97470
jmp 0xca126
leaq -0x100(%rbp), %rdi
callq 0x99da0
jmp 0xca134
leaq -0x148(%rbp), %rdi
leaq -0x30(%rbp), %rsi
leaq -0x50(%rbp), %rdx
callq 0xa48b0
jmp 0xca14a
leaq -0x128(%rbp), %rdi
leaq -0x148(%rbp), %rsi
leaq -0x70(%rbp), %rdx
callq 0xa15c0
jmp 0xca163
leaq -0x100(%rbp), %rdi
leaq -0x128(%rbp), %rsi
callq 0x9f4a0
movb %al, -0x351(%rbp)
jmp 0xca17e
movb -0x351(%rbp), %al
movzbl %al, %eax
movl %eax, -0x358(%rbp)
leaq -0x128(%rbp), %rdi
callq 0xa4f00
leaq -0x148(%rbp), %rdi
callq 0xa4f00
movl -0x358(%rbp), %eax
movl %eax, -0x104(%rbp)
leaq -0x2d0(%rbp), %rdi
callq 0x9b940
jmp 0xca1bf
leaq -0x2c0(%rbp), %rax
movq %rax, -0x368(%rbp)
movl $0x3, %edi
callq 0xa4b60
movl %eax, -0x35c(%rbp)
jmp 0xca1df
movq -0x368(%rbp), %rdi
movl -0x35c(%rbp), %eax
movl %eax, -0x2d4(%rbp)
movl -0x2d4(%rbp), %esi
callq 0x9ecb0
movq %rax, -0x370(%rbp)
jmp 0xca206
movl $0x30, %edi
callq 0x9f4b0
movb %al, -0x371(%rbp)
jmp 0xca218
movq -0x370(%rbp), %rdi
movb -0x371(%rbp), %al
movb %al, -0x2d5(%rbp)
movzbl -0x2d5(%rbp), %esi
callq 0xa1cb0
movq %rax, -0x380(%rbp)
jmp 0xca240
movq -0x380(%rbp), %rdi
movl -0x104(%rbp), %esi
callq 0xa0150
jmp 0xca254
movq -0x338(%rbp), %rdi
addq $0x28, %rdi
callq 0x98080
movq %rax, %rsi
leaq -0x2e8(%rbp), %rdi
movl $0xa, %edx
callq 0x9e5d0
jmp 0xca27a
leaq -0x2e8(%rbp), %rdi
callq 0x98080
movq %rax, -0x388(%rbp)
leaq -0x308(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
callq 0x9da80
jmp 0xca2a2
movq -0x388(%rbp), %rdi
leaq -0x308(%rbp), %rsi
callq 0x9a780
jmp 0xca2b7
leaq -0x308(%rbp), %rdi
callq 0xa4f00
leaq -0x2e8(%rbp), %rdi
callq 0x997e0
movb $0x0, -0x99(%rbp)
leaq -0x70(%rbp), %rdi
movq %rdi, -0x390(%rbp)
callq 0x9fdc0
movq -0x338(%rbp), %rdi
addq $0x28, %rdi
callq 0x98080
movq -0x390(%rbp), %rsi
movq %rax, %rdi
leaq -0x99(%rbp), %rdx
leaq -0x98(%rbp), %rcx
callq 0x97470
jmp 0xca315
leaq -0x328(%rbp), %rdi
leaq -0x30(%rbp), %rsi
leaq -0x50(%rbp), %rdx
callq 0xa48b0
jmp 0xca32b
movq -0x348(%rbp), %rdi
leaq -0x328(%rbp), %rsi
leaq -0x70(%rbp), %rdx
callq 0xa15c0
jmp 0xca344
leaq -0x328(%rbp), %rdi
callq 0xa4f00
leaq -0x2d0(%rbp), %rdi
callq 0x9bca0
leaq -0x100(%rbp), %rdi
callq 0x9e660
leaq -0x90(%rbp), %rdi
callq 0xa4f00
leaq -0x70(%rbp), %rdi
callq 0xa4f00
leaq -0x50(%rbp), %rdi
callq 0xa4f00
leaq -0x30(%rbp), %rdi
callq 0xa4f00
movq -0x340(%rbp), %rax
addq $0x390, %rsp            # imm = 0x390
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xca4da
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xca3e8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0xe0(%rbp), %rdi
callq 0xa4f00
leaq -0xc0(%rbp), %rdi
callq 0x997e0
jmp 0xca4da
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xca4ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xca442
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x128(%rbp), %rdi
callq 0xa4f00
leaq -0x148(%rbp), %rdi
callq 0xa4f00
jmp 0xca4ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xca4c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
jmp 0xca496
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x308(%rbp), %rdi
callq 0xa4f00
leaq -0x2e8(%rbp), %rdi
callq 0x997e0
jmp 0xca4c2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xa8(%rbp)
movl %eax, -0xac(%rbp)
leaq -0x328(%rbp), %rdi
callq 0xa4f00
leaq -0x2d0(%rbp), %rdi
callq 0x9bca0
leaq -0x100(%rbp), %rdi
callq 0x9e660
leaq -0x90(%rbp), %rdi
callq 0xa4f00
leaq -0x70(%rbp), %rdi
callq 0xa4f00
leaq -0x50(%rbp), %rdi
callq 0xa4f00
leaq -0x30(%rbp), %rdi
callq 0xa4f00
movq -0xa8(%rbp), %rdi
callq 0xa3520
nopl (%rax)