// File: /workspace/github_cpp_makefile_star2_O2/jstaursky[P]hutch/src/Sleigh/sleigh.cc
// Function: SleighBuilder::appendCrossBuild(OpTpl*, int)
void SleighBuilder::appendCrossBuild (OpTpl* bld, int4 secnum)

{ // Weave in the p-code section from an instruction at another address
    // bld-param(0) contains the address of the instruction
    // bld-param(1) contains the section number
    if (secnum >= 0)
        throw LowlevelError ("CROSSBUILD directive within a named section");
    secnum = bld->getIn (1)->getOffset ().getReal ();
    VarnodeTpl* vn = bld->getIn (0);
    AddrSpace* spc = vn->getSpace ().fixSpace (*walker);
    uintb addr = spc->wrapOffset (vn->getOffset ().fix (*walker));

    ParserWalker* tmp = walker;
    uintb olduniqueoffset = uniqueoffset;

    Address newaddr (spc, addr);
    setUniqueOffset (newaddr);
    const ParserContext* pos = discache->getParserContext (newaddr);
    if (pos->getParserState () != ParserContext::pcode)
        throw LowlevelError ("Could not obtain cached crossbuild instruction");

    ParserWalker newwalker (pos, tmp->getParserContext ());
    walker = &newwalker;

    walker->baseState ();
    Constructor* ct = walker->getConstructor ();
    ConstructTpl* construct = ct->getNamedTempl (secnum);
    if (construct == (ConstructTpl*)0)
        buildEmpty (ct, secnum);
    else
        build (construct, secnum);
    walker = tmp;
    uniqueoffset = olduniqueoffset;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xc0, %rsp
testl %edx, %edx
jns 0x63ca9
movq %rdi, %rbx
movq 0x10(%rsi), %rax
movq (%rax), %r15
movq 0x8(%rax), %rax
movl 0x30(%rax), %ebp
movq 0x10(%rdi), %rsi
movq %r15, %rdi
callq 0x4e940
movq %rax, %r14
addq $0x20, %r15
movq 0x10(%rbx), %rsi
movq %r15, %rdi
callq 0x4ea00
movq 0x28(%r14), %rcx
cmpq %rax, %rcx
jae 0x63c11
incq %rcx
cqto
idivq %rcx
movq %rdx, %rax
sarq $0x3f, %rax
andq %rcx, %rax
addq %rdx, %rax
movq 0x10(%rbx), %r15
movq 0x30(%rbx), %r12
leaq 0x10(%rsp), %rsi
movq %r14, (%rsi)
movq %rax, 0x8(%rsi)
andq 0x28(%rbx), %rax
shlq $0x4, %rax
movq %rax, 0x30(%rbx)
movq 0x38(%rbx), %rdi
callq 0x4e5a0
cmpl $0x2, (%rax)
jne 0x63cf4
movq (%r15), %rcx
leaq 0x20(%rsp), %rdx
movq %rax, (%rdx)
movq %rcx, 0x8(%rdx)
movq %rdx, 0x10(%rbx)
movq 0x98(%rax), %rax
movq %rax, 0x10(%rdx)
andq $0x0, 0x18(%rdx)
movq (%rax), %r14
movq %r14, %rdi
movl %ebp, %esi
callq 0x51920
movq %rbx, %rdi
testq %rax, %rax
je 0x63c87
movq %rax, %rsi
movl %ebp, %edx
callq 0x4d920
jmp 0x63c91
movq %r14, %rsi
movl %ebp, %edx
callq 0x50e00
movq %r15, 0x10(%rbx)
movq %r12, 0x30(%rbx)
addq $0xc0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
pushq $0x20
popq %rdi
callq 0x4e180
movq %rax, %rbx
leaq 0x23780(%rip), %rsi     # 0x8743b
leaq 0x20(%rsp), %rdi
leaq 0x10(%rsp), %rdx
callq 0x515e0
movb $0x1, %bpl
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x4ddf0
xorl %ebp, %ebp
movq 0x4b1bd(%rip), %rsi     # 0xaeea0
movq 0x4af4e(%rip), %rdx     # 0xaec38
movq %rbx, %rdi
callq 0x51630
jmp 0x63d3d
pushq $0x20
popq %rdi
callq 0x4e180
movq %rax, %rbx
leaq 0x23761(%rip), %rsi     # 0x87467
leaq 0x20(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x515e0
movb $0x1, %bpl
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x4ddf0
xorl %ebp, %ebp
movq 0x4b172(%rip), %rsi     # 0xaeea0
movq 0x4af03(%rip), %rdx     # 0xaec38
movq %rbx, %rdi
callq 0x51630
jmp 0x63d41
jmp 0x63d55
movq %rax, %r14
leaq 0x20(%rsp), %rdi
callq 0x4e020
testb %bpl, %bpl
jne 0x63d58
jmp 0x63d60
movq %rax, %r14
movq %rbx, %rdi
callq 0x4ea60
movq %r14, %rdi
callq 0x518c0