// File: /workspace/github_cpp_makefile_star2_O1/besm6[P]pascal-re/pascompl.cc
// Function: P0715(long, long)
void P0715(int64_t mode, int64_t arg)
{
    int64_t work, offset;
    if (mode == 0) {
        int64_t addr, insn, leftHalf;
        bool isLeft;
        padToLeft();
        curVal.i = moduleOffset;
L1:     addr = curVal.ii & 077777;
        leftHalf = (curVal.ii & halfWord) << 24;
        while (arg != 0) {
            if (4096 < arg)  {
                isLeft = true;
                arg = arg - 4096;
            } else isLeft = false;
            insn = objBuffer[arg];
            if (isLeft) {
                curVal.ii = insn & leftAddr;
                curVal.ii = curVal.ii >> 24;
                insn = (insn & ~leftAddr) | leftHalf;
            } else {
                curVal.ii = insn & 077777;
                insn = (insn & ~077777L) | addr;
            };
            objBuffer[arg] = insn;
            arg = curVal.i;
        };
        return;
    } else if (mode == 2) {
        form1Insn(KVTM+I14 + curVal.i);
        if (curVal.i == 074001)
            form1Insn(KUTM+I14 + FcstCnt);
        form3Insn(KITA+14, InsnTemp[ASN] + arg, KAOX+I7+1);
        form1Insn(KATX+I7+1);
        return;
    } else if ((mode == 1) or (mode < -2)) {
        arg = arg - curVal.i;
        // A trick: the integer exponent in arg should follow curVal;
        // forming the full word here.
        arg = (arg & 0x1FFFFFFFFFFL) | ((int64_t)curVal.i.exp << 41);
        offset = getFCSToffset();
        if (mode == 1)
            work = getHelperProc(68) + (-064200000); /* P/DA */
        else
            work = -mode;
        // Full-word assignment.
        curVal.ii = arg;
        arg = getFCSToffset();
        form3Insn(KATX+SP+1, KSUB+I8 + offset, work);
        form3Insn(KRSUB+I8 + arg, work, KXTA+SP+1);
        return;
    } else if (mode == -1) {
        form1Insn(KVTM+I14 + lineCnt);
        formAndAlign(getHelperProc(arg));
        return;
    };
    curVal.i = mode;
    goto L1;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
cmpq $0x2, %rdi
je 0x61c5
movq %rdi, %r14
testq %rdi, %rdi
jne 0x6237
cmpb $0x0, 0x5e7e4(%rip)     # 0x64984
jne 0x61ae
movq 0x6330f(%rip), %rdi     # 0x694b8
callq 0x5941
movq $0x0, 0x5e7af(%rip) # 0x64968
movq 0x5e6d8(%rip), %r14     # 0x64898
jmp 0x62c7
movq 0x5e874(%rip), %rdi     # 0x64a40
shlq $0x17, %rdi
sarq $0x17, %rdi
addq $0xea0000, %rdi         # imm = 0xEA0000
callq 0x5941
movabsq $0x1ffffffffff, %rax    # imm = 0x1FFFFFFFFFF
andq 0x5e84f(%rip), %rax     # 0x64a40
cmpq $0x7801, %rax           # imm = 0x7801
jne 0x620a
movl $0xea8000, %edi         # imm = 0xEA8000
addq 0x5e63b(%rip), %rdi     # 0x64840
callq 0x5941
addq 0x6325f(%rip), %rbx     # 0x69470
movl $0x2200e, %edi          # imm = 0x2200E
callq 0x5941
movq %rbx, %rdi
callq 0x5941
movl $0x70d001, %edi         # imm = 0x70D001
callq 0x5941
movl $0x700001, %edi         # imm = 0x700001
jmp 0x63b4
cmpq $0x1, %r14
setne %al
cmpq $-0x2, %r14
setge %cl
testb %cl, %al
jne 0x62bd
movq 0x5e7f0(%rip), %rax     # 0x64a40
subq %rax, %rbx
movabsq $0x1ffffffffff, %rcx    # imm = 0x1FFFFFFFFFF
andq %rbx, %rcx
movabsq $0xfe0000000000, %r15   # imm = 0xFE0000000000
andq %rax, %r15
orq %rcx, %r15
callq 0x5f9d
movq %rax, %rbx
cmpq $0x1, %r14
jne 0x6365
cmpq $0x0, 0x64976(%rip)     # 0x6ac00
jne 0x62ab
movq 0x1e31d(%rip), %rax     # 0x245b0
movq %rax, 0x5e7a6(%rip)     # 0x64a40
movl $0x8c0000, %edi         # imm = 0x8C0000
callq 0x5ba8
movq %rax, 0x64955(%rip)     # 0x6ac00
movl $0xb8000, %r14d         # imm = 0xB8000
addq 0x64948(%rip), %r14     # 0x6ac00
jmp 0x6368
cmpq $-0x1, %r14
je 0x63be
leaq 0x5e772(%rip), %rdi     # 0x64a40
movq %r14, %rsi
callq 0x3bf2
testq %rbx, %rbx
je 0x635f
movq 0x5e75a(%rip), %rax     # 0x64a40
movl %eax, %ecx
andl $0x7fff, %ecx           # imm = 0x7FFF
andl $0xffffff, %eax         # imm = 0xFFFFFF
shlq $0x18, %rax
leaq 0xa6f32(%rip), %rdx     # 0xad230
movabsq $-0x7fff000001, %rsi    # imm = 0xFFFFFF8000FFFFFF
leaq -0x1000(%rbx), %rdi
cmpq $0x1001, %rbx           # imm = 0x1001
cmovlq %rbx, %rdi
movq (%rdx,%rdi,8), %r8
movq $-0x8000, %r9           # imm = 0x8000
cmovgeq %rsi, %r9
movq %rcx, %r10
cmovgeq %rax, %r10
movq %r8, %r11
shrq $0x18, %r11
cmpq $0x1001, %rbx           # imm = 0x1001
cmovlq %r8, %r11
andq %r8, %r9
orq %r10, %r9
movq %r11, %rbx
movq %r9, (%rdx,%rdi,8)
andq $0x7fff, %rbx           # imm = 0x7FFF
jne 0x6308
movq %rbx, 0x5e6e1(%rip)     # 0x64a40
popq %rbx
popq %r14
popq %r15
retq
negq %r14
movq %r15, 0x5e6d1(%rip)     # 0x64a40
callq 0x5f9d
movq %rax, %r15
addq $0x805000, %rbx         # imm = 0x805000
movl $0xf00001, %edi         # imm = 0xF00001
callq 0x5941
movq %rbx, %rdi
callq 0x5941
movq %r14, %rdi
callq 0x5941
addq $0x806000, %r15         # imm = 0x806000
movq %r15, %rdi
callq 0x5941
movq %r14, %rdi
callq 0x5941
movl $0xf08001, %edi         # imm = 0xF08001
popq %rbx
popq %r14
popq %r15
jmp 0x5941
movl $0xea0000, %edi         # imm = 0xEA0000
addq 0x5e4f6(%rip), %rdi     # 0x648c0
callq 0x5941
movq %rbx, %rdi
callq 0x5cbc
movq %rax, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x5b45