// File: besm6[P]pascal-re/dtran.cc
// Function: Dtran::fill_lengths()
void fill_lengths() {
        head_len = memory[0] & 07777;
        sym_len = (memory[0] >> 12) & 07777;
        debug_len = (memory[0] >> 36);
        set_len = memory[1] & 077777;
        data_len = (memory[1] >> 15) & 077777;
        long_len = (memory[1] >> 30) & 077777;
        cmd_len = memory[2] & 077777;
        bss_len = (memory[2] >> 15) & 077777;
        if (bss_len != 0) {
            fprintf(stderr, "BSS section not supported yet\n");
            exit(1);
        }
        const_len = (memory[2] >> 30) & 077777;
        table_off = 3 + cmd_len + const_len + data_len + set_len;
        long_off = table_off + head_len + sym_len;
        debug_off = long_off + long_len;
        comment_off = debug_off + debug_len;
        printf(" %s:,NAME, NEW DTRAN\n",
               get_text_word(memory[table_off-0]).c_str());
        printf("C Commands: %o\n", cmd_len);
        printf("C Constants: %o\n", const_len);
        printf("C BSS: %o\n", bss_len);
        printf("C Memory size: %o\n", cmd_len+const_len+bss_len);
        printf("C Header: %o\n", head_len);
        printf("C Symbols: %o\n", sym_len);
        printf("C Long symbols: %o\n", long_len);
        printf("C Debug: %o\n", debug_len);
        printf("C Data: %o + set: %o\n", data_len, set_len);
        printf("C Actual length of the object file is %o\n",
               comment_off);
        if (nolabels) {
            printf(" /:,BSS,\n");
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq 0x48(%rax), %rcx
andq $0xfff, %rcx            # imm = 0xFFF
movl %ecx, (%rax)
movq 0x48(%rax), %rcx
shrq $0xc, %rcx
andq $0xfff, %rcx            # imm = 0xFFF
movl %ecx, 0x4(%rax)
movq 0x48(%rax), %rcx
shrq $0x24, %rcx
movl %ecx, 0x8(%rax)
movq 0x50(%rax), %rcx
andq $0x7fff, %rcx           # imm = 0x7FFF
movl %ecx, 0x10(%rax)
movq 0x50(%rax), %rcx
shrq $0xf, %rcx
andq $0x7fff, %rcx           # imm = 0x7FFF
movl %ecx, 0xc(%rax)
movq 0x50(%rax), %rcx
shrq $0x1e, %rcx
andq $0x7fff, %rcx           # imm = 0x7FFF
movl %ecx, 0x14(%rax)
movq 0x58(%rax), %rcx
andq $0x7fff, %rcx           # imm = 0x7FFF
movl %ecx, 0x18(%rax)
movq 0x58(%rax), %rcx
shrq $0xf, %rcx
andq $0x7fff, %rcx           # imm = 0x7FFF
movl %ecx, 0x1c(%rax)
cmpl $0x0, 0x1c(%rax)
je 0x4a38
movq 0x65bb(%rip), %rax      # 0xafd8
movq (%rax), %rdi
leaq 0x394e(%rip), %rsi      # 0x8375
movb $0x0, %al
callq 0x32e0
movl $0x1, %edi
callq 0x3250
movq -0x40(%rbp), %rsi
movq 0x58(%rsi), %rax
shrq $0x1e, %rax
andl $0x7fff, %eax           # imm = 0x7FFF
movl %eax, 0x20(%rsi)
movl 0x18(%rsi), %edx
movl 0x20(%rsi), %eax
addl %eax, %edx
movl 0xc(%rsi), %eax
movl 0x10(%rsi), %ecx
addl %eax, %edx
movl %ecx, %eax
movl %edx, %ecx
leal 0x3(%rax,%rcx), %eax
movl %eax, 0x24(%rsi)
movl 0x24(%rsi), %eax
movl (%rsi), %edx
movl 0x4(%rsi), %ecx
addl %edx, %eax
addl %ecx, %eax
movl %eax, 0x2c(%rsi)
movl 0x14(%rsi), %ecx
movl 0x2c(%rsi), %eax
addl %ecx, %eax
movl %eax, 0x28(%rsi)
movl 0x8(%rsi), %ecx
movl 0x28(%rsi), %eax
addl %ecx, %eax
movl %eax, 0x30(%rsi)
movl 0x24(%rsi), %eax
movq 0x48(%rsi,%rax,8), %rdx
leaq -0x28(%rbp), %rdi
movq %rdi, -0x48(%rbp)
callq 0x4d80
movq -0x48(%rbp), %rdi
callq 0x30c0
movq %rax, %rsi
leaq 0x38e0(%rip), %rdi      # 0x8394
xorl %eax, %eax
callq 0x3040
jmp 0x4abd
leaq -0x28(%rbp), %rdi
callq 0x3110
movq -0x40(%rbp), %rax
movl 0x18(%rax), %esi
leaq 0x38d6(%rip), %rdi      # 0x83aa
movb $0x0, %al
callq 0x3040
movq -0x40(%rbp), %rax
movl 0x20(%rax), %esi
leaq 0x38d1(%rip), %rdi      # 0x83ba
movb $0x0, %al
callq 0x3040
movq -0x40(%rbp), %rax
movl 0x1c(%rax), %esi
leaq 0x38cd(%rip), %rdi      # 0x83cb
movb $0x0, %al
callq 0x3040
movq -0x40(%rbp), %rax
movl 0x18(%rax), %esi
addl 0x20(%rax), %esi
addl 0x1c(%rax), %esi
leaq 0x38bd(%rip), %rdi      # 0x83d6
movb $0x0, %al
callq 0x3040
movq -0x40(%rbp), %rax
movl (%rax), %esi
leaq 0x38bc(%rip), %rdi      # 0x83e9
movb $0x0, %al
callq 0x3040
movq -0x40(%rbp), %rax
movl 0x4(%rax), %esi
leaq 0x38b5(%rip), %rdi      # 0x83f7
movb $0x0, %al
callq 0x3040
movq -0x40(%rbp), %rax
movl 0x14(%rax), %esi
leaq 0x38af(%rip), %rdi      # 0x8406
movb $0x0, %al
callq 0x3040
movq -0x40(%rbp), %rax
movl 0x8(%rax), %esi
leaq 0x38ae(%rip), %rdi      # 0x841a
movb $0x0, %al
callq 0x3040
movq -0x40(%rbp), %rax
movl 0xc(%rax), %esi
movl 0x10(%rax), %edx
leaq 0x38a3(%rip), %rdi      # 0x8427
movb $0x0, %al
callq 0x3040
movq -0x40(%rbp), %rax
movl 0x30(%rax), %esi
leaq 0x38a4(%rip), %rdi      # 0x843d
movb $0x0, %al
callq 0x3040
movq -0x40(%rbp), %rax
testb $0x1, 0x40(%rax)
je 0x4bd1
leaq 0x38b6(%rip), %rdi      # 0x8467
movb $0x0, %al
callq 0x3040
jmp 0x4bd1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x3110
jmp 0x4bd7
addq $0x50, %rsp
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x3370