// File: /workspace/github_cpp_makefile_star2_O3/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 0x621b
movq %rdi, %r14
testq %rdi, %rdi
jne 0x628d
cmpb $0x0, 0x5e77e(%rip)     # 0x64974
jne 0x6204
movq 0x632a9(%rip), %rdi     # 0x694a8
callq 0x59a2
movq $0x0, 0x5e749(%rip) # 0x64958
movq 0x5e672(%rip), %r14     # 0x64888
jmp 0x631c
movq 0x5e80e(%rip), %rdi     # 0x64a30
shlq $0x17, %rdi
sarq $0x17, %rdi
addq $0xea0000, %rdi         # imm = 0xEA0000
callq 0x59a2
movabsq $0x1ffffffffff, %rax    # imm = 0x1FFFFFFFFFF
andq 0x5e7e9(%rip), %rax     # 0x64a30
cmpq $0x7801, %rax           # imm = 0x7801
jne 0x6260
movl $0xea8000, %edi         # imm = 0xEA8000
addq 0x5e5d5(%rip), %rdi     # 0x64830
callq 0x59a2
addq 0x631f9(%rip), %rbx     # 0x69460
movl $0x2200e, %edi          # imm = 0x2200E
callq 0x59a2
movq %rbx, %rdi
callq 0x59a2
movl $0x70d001, %edi         # imm = 0x70D001
callq 0x59a2
movl $0x700001, %edi         # imm = 0x700001
jmp 0x6409
cmpq $0x1, %r14
setne %al
cmpq $-0x2, %r14
setge %cl
testb %cl, %al
jne 0x6312
movq 0x5e78a(%rip), %rax     # 0x64a30
subq %rax, %rbx
movabsq $0x1ffffffffff, %rcx    # imm = 0x1FFFFFFFFFF
andq %rbx, %rcx
movabsq $0xfe0000000000, %r15   # imm = 0xFE0000000000
andq %rax, %r15
orq %rcx, %r15
callq 0x5ff3
movq %rax, %rbx
cmpq $0x1, %r14
jne 0x63ba
movq 0x64911(%rip), %r14     # 0x6abf0
testq %r14, %r14
jne 0x6306
movq 0x1e2b5(%rip), %rax     # 0x245a0
movq %rax, 0x5e73e(%rip)     # 0x64a30
movl $0x8c0000, %edi         # imm = 0x8C0000
callq 0x5c15
movq %rax, %r14
movq %rax, 0x648ea(%rip)     # 0x6abf0
addq $0xb8000, %r14          # imm = 0xB8000
jmp 0x63bd
cmpq $-0x1, %r14
je 0x6413
leaq 0x5e70d(%rip), %rdi     # 0x64a30
movq %r14, %rsi
callq 0x3c48
testq %rbx, %rbx
je 0x63b4
movq 0x5e6f5(%rip), %rax     # 0x64a30
movl %eax, %ecx
andl $0x7fff, %ecx           # imm = 0x7FFF
andl $0xffffff, %eax         # imm = 0xFFFFFF
shlq $0x18, %rax
leaq 0xa6ecd(%rip), %rdx     # 0xad220
movabsq $-0x7fff000001, %rsi    # imm = 0xFFFFFF8000FFFFFF
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
movq %r9, %rbx
movq %r10, (%rdx,%rdi,8)
andq $0x7fff, %rbx           # imm = 0x7FFF
jne 0x635d
movq %rbx, 0x5e67c(%rip)     # 0x64a30
popq %rbx
popq %r14
popq %r15
retq
negq %r14
movq %r15, 0x5e66c(%rip)     # 0x64a30
callq 0x5ff3
movq %rax, %r15
addq $0x805000, %rbx         # imm = 0x805000
movl $0xf00001, %edi         # imm = 0xF00001
callq 0x59a2
movq %rbx, %rdi
callq 0x59a2
movq %r14, %rdi
callq 0x59a2
addq $0x806000, %r15         # imm = 0x806000
movq %r15, %rdi
callq 0x59a2
movq %r14, %rdi
callq 0x59a2
movl $0xf08001, %edi         # imm = 0xF08001
popq %rbx
popq %r14
popq %r15
jmp 0x59a2
movl $0xea0000, %edi         # imm = 0xEA0000
addq 0x5e491(%rip), %rdi     # 0x648b0
callq 0x59a2
leaq 0x645a5(%rip), %r14     # 0x6a9d0
movq (%r14,%rbx,8), %rdi
testq %rdi, %rdi
jne 0x6457
leaq 0x1df45(%rip), %rax     # 0x24380
movq (%rax,%rbx,8), %rax
movq %rax, 0x5e5ea(%rip)     # 0x64a30
movl $0x8c0000, %edi         # imm = 0x8C0000
callq 0x5c15
movq %rax, %rdi
movq %rax, (%r14,%rbx,8)
addq $0xdc8000, %rdi         # imm = 0xDC8000
popq %rbx
popq %r14
popq %r15
jmp 0x5bb2