// File: 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 %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x0, -0x8(%rbp)
jne 0x8a3f
callq 0x7ef0
movq 0x77611(%rip), %rsi     # 0x7ff48
leaq 0x777b2(%rip), %rdi     # 0x800f0
callq 0x4ad0
movq 0x777a6(%rip), %rax     # 0x800f0
andq $0x7fff, %rax           # imm = 0x7FFF
movq %rax, -0x28(%rbp)
movq 0x77795(%rip), %rax     # 0x800f0
andq $0xffffff, %rax         # imm = 0xFFFFFF
shlq $0x18, %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x8a3a
movl $0x1000, %eax           # imm = 0x1000
cmpq -0x10(%rbp), %rax
jge 0x8993
movb $0x1, -0x39(%rbp)
movq -0x10(%rbp), %rax
subq $0x1000, %rax           # imm = 0x1000
movq %rax, -0x10(%rbp)
jmp 0x8997
movb $0x0, -0x39(%rbp)
movq -0x10(%rbp), %rcx
leaq 0xbff3e(%rip), %rax     # 0xc88e0
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
testb $0x1, -0x39(%rbp)
je 0x89ef
movabsq $0x7fff000000, %rax     # imm = 0x7FFF000000
andq -0x30(%rbp), %rax
movq %rax, 0x7772b(%rip)     # 0x800f0
movq 0x77724(%rip), %rax     # 0x800f0
sarq $0x18, %rax
movq %rax, 0x77719(%rip)     # 0x800f0
movabsq $-0x7fff000001, %rax    # imm = 0xFFFFFF8000FFFFFF
andq -0x30(%rbp), %rax
orq -0x38(%rbp), %rax
movq %rax, -0x30(%rbp)
jmp 0x8a12
movq -0x30(%rbp), %rax
andq $0x7fff, %rax           # imm = 0x7FFF
movq %rax, 0x776f0(%rip)     # 0x800f0
movq -0x30(%rbp), %rax
andq $-0x8000, %rax          # imm = 0x8000
orq -0x28(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdx
movq -0x10(%rbp), %rcx
leaq 0xbfebf(%rip), %rax     # 0xc88e0
movq %rdx, (%rax,%rcx,8)
leaq 0x776c4(%rip), %rdi     # 0x800f0
callq 0x1dfb0
movq %rax, -0x10(%rbp)
jmp 0x8969
jmp 0x8bcf
cmpq $0x2, -0x8(%rbp)
jne 0x8ab1
leaq 0x776a3(%rip), %rdi     # 0x800f0
callq 0x1dfb0
movq %rax, %rdi
addq $0xea0000, %rdi         # imm = 0xEA0000
callq 0x7c20
leaq 0x77688(%rip), %rdi     # 0x800f0
callq 0x1dfb0
cmpq $0x7801, %rax           # imm = 0x7801
jne 0x8a88
movq 0x77474(%rip), %rdi     # 0x7fef0
addq $0xea8000, %rdi         # imm = 0xEA8000
callq 0x7c20
movq 0x7c091(%rip), %rsi     # 0x84b20
addq -0x10(%rbp), %rsi
movl $0x2200e, %edi          # imm = 0x2200E
movl $0x70d001, %edx         # imm = 0x70D001
callq 0x7dd0
movl $0x700001, %edi         # imm = 0x700001
callq 0x7c20
jmp 0x8bcf
cmpq $0x1, -0x8(%rbp)
je 0x8ac3
cmpq $-0x2, -0x8(%rbp)
jge 0x8b87
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
leaq 0x7761e(%rip), %rdi     # 0x800f0
callq 0x1dfb0
movq %rax, %rcx
movq -0x48(%rbp), %rax
subq %rcx, %rax
movq %rax, -0x10(%rbp)
movabsq $0x1ffffffffff, %rax    # imm = 0x1FFFFFFFFFF
andq -0x10(%rbp), %rax
movq 0x775f6(%rip), %rcx     # 0x800f0
shrq $0x29, %rcx
andq $0x7f, %rcx
movl %ecx, %ecx
shlq $0x29, %rcx
orq %rcx, %rax
movq %rax, -0x10(%rbp)
callq 0x8580
movq %rax, -0x20(%rbp)
cmpq $0x1, -0x8(%rbp)
jne 0x8b35
movl $0x44, %edi
callq 0x80d0
addq $-0xd10000, %rax        # imm = 0xFF2F0000
movq %rax, -0x18(%rbp)
jmp 0x8b3f
xorl %eax, %eax
subq -0x8(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, 0x775a6(%rip)     # 0x800f0
callq 0x8580
movq %rax, -0x10(%rbp)
movq -0x20(%rbp), %rsi
addq $0x805000, %rsi         # imm = 0x805000
movq -0x18(%rbp), %rdx
movl $0xf00001, %edi         # imm = 0xF00001
callq 0x7dd0
movq -0x10(%rbp), %rdi
addq $0x806000, %rdi         # imm = 0x806000
movq -0x18(%rbp), %rsi
movl $0xf08001, %edx         # imm = 0xF08001
callq 0x7dd0
jmp 0x8bcf
cmpq $-0x1, -0x8(%rbp)
jne 0x8bb4
movq 0x773db(%rip), %rdi     # 0x7ff70
addq $0xea0000, %rdi         # imm = 0xEA0000
callq 0x7c20
movq -0x10(%rbp), %rdi
callq 0x80d0
movq %rax, %rdi
callq 0x7f20
jmp 0x8bcf
jmp 0x8bb6
jmp 0x8bb8
jmp 0x8bba
movq -0x8(%rbp), %rsi
leaq 0x7752b(%rip), %rdi     # 0x800f0
callq 0x4ad0
jmp 0x8943
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)