// File: /workspace/github_cpp_makefile_star2_O2/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 0x5718
movq %rdi, %r14
testq %rdi, %rdi
jne 0x5785
callq 0x51a1
movq 0x5e175(%rip), %r14     # 0x63888
jmp 0x57f1
movq 0x5e311(%rip), %rdi     # 0x63a30
shlq $0x17, %rdi
sarq $0x17, %rdi
addq $0xea0000, %rdi         # imm = 0xEA0000
callq 0x4fcb
movabsq $0x1ffffffffff, %rax    # imm = 0x1FFFFFFFFFF
andq 0x5e2ec(%rip), %rax     # 0x63a30
cmpq $0x7801, %rax           # imm = 0x7801
jne 0x575d
movl $0xea8000, %edi         # imm = 0xEA8000
addq 0x5e0d8(%rip), %rdi     # 0x63830
callq 0x4fcb
addq 0x62cfc(%rip), %rbx     # 0x68460
movl $0x2200e, %edi          # imm = 0x2200E
movl $0x70d001, %edx         # imm = 0x70D001
movq %rbx, %rsi
callq 0x50f5
movl $0x700001, %edi         # imm = 0x700001
popq %rbx
popq %r14
popq %r15
jmp 0x4fcb
cmpq $0x1, %r14
setne %al
cmpq $-0x2, %r14
setge %cl
testb %cl, %al
jne 0x57e7
movq 0x5e292(%rip), %rax     # 0x63a30
subq %rax, %rbx
movabsq $0x1ffffffffff, %rcx    # imm = 0x1FFFFFFFFFF
andq %rbx, %rcx
movabsq $0xfe0000000000, %r15   # imm = 0xFE0000000000
andq %rax, %r15
orq %rcx, %r15
callq 0x554f
movq %rax, %rbx
cmpq $0x1, %r14
jne 0x588b
pushq $0x44
popq %rdi
callq 0x52d1
movq %rax, %r14
addq $-0xd10000, %r14        # imm = 0xFF2F0000
jmp 0x588e
cmpq $-0x1, %r14
je 0x58d0
leaq 0x5e238(%rip), %rdi     # 0x63a30
movq %r14, %rsi
callq 0x381c
movq 0x5e229(%rip), %rax     # 0x63a30
movl %eax, %ecx
andl $0x7fff, %ecx           # imm = 0x7FFF
andl $0xffffff, %eax         # imm = 0xFFFFFF
shlq $0x18, %rax
leaq 0xa6a01(%rip), %rdx     # 0xac220
movabsq $-0x7fff000001, %rsi    # imm = 0xFFFFFF8000FFFFFF
testq %rbx, %rbx
je 0x5885
leaq -0x1000(%rbx), %rdi
cmpq $0x1001, %rbx           # imm = 0x1001
cmovlq %rbx, %rdi
movq (%rdx,%rdi,8), %r8
movq %r8, %r9
shrq $0x18, %r9
cmpq $0x1001, %rbx           # imm = 0x1001
movq $-0x8000, %r10          # imm = 0x8000
cmovgeq %rsi, %r10
movq %rcx, %r11
cmovgeq %rax, %r11
cmovlq %r8, %r9
andq %r8, %r10
orq %r11, %r10
andl $0x7fff, %r9d           # imm = 0x7FFF
movq %r9, 0x5e1b4(%rip)      # 0x63a30
movq %r10, (%rdx,%rdi,8)
movq %r9, %rbx
jmp 0x5829
popq %rbx
popq %r14
popq %r15
retq
negq %r14
movq %r15, 0x5e19b(%rip)     # 0x63a30
callq 0x554f
movq %rax, %r15
addq $0x805000, %rbx         # imm = 0x805000
movl $0xf00001, %edi         # imm = 0xF00001
movq %rbx, %rsi
movq %r14, %rdx
callq 0x50f5
addq $0x806000, %r15         # imm = 0x806000
movl $0xf08001, %edx         # imm = 0xF08001
movq %r15, %rdi
movq %r14, %rsi
popq %rbx
popq %r14
popq %r15
jmp 0x50f5
movl $0xea0000, %edi         # imm = 0xEA0000
addq 0x5dfd4(%rip), %rdi     # 0x638b0
callq 0x4fcb
movq %rbx, %rdi
callq 0x52d1
movq %rax, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x51c4