// File: /workspace/github_c_makefile_star2_O0/Nico01[P]obj2asm/oprocess.c
// Function: enumerated
void enumerated(DAT_T *data_rec, DAT_T *next_rec, int inst_proc)
{
    int             length;
    int             result;
    dword   prev_offset;
    int             addition;
    int             dcheck;

    /*
    ** Process enumerated data within this record
    */
    length = data_rec->length;
    fseek( o_file, data_rec->file_pos+record_overused, L_SET );
    length = buff_init( length-record_overused );
    addition = 0;
    if ( next_rec ) {
        fseek( o_file, next_rec->file_pos, L_SET );
        addition = 0x10;      /* Longest instruction can be 0x10 bytes long */
        if ( addition > next_rec->length ) {
            addition = next_rec->length;
        }
        length += buff_add( addition );
    }
    while ( length > addition ) {
#ifdef DEBUG
        printf( "DIS-ASSEMBLY processing enumerated %08lX %04X %04X %04X %04X\n", 
                    data_rec, data_rec->offset, data_rec->length, length, 
                    inst_offset );
#endif
        if ( length < 0 ) {
            fmt_error( "Dis-assembly Record Over-run" );
        }

        prev_offset = inst_offset;

        dcheck = data_check( 0 );

        switch ( dcheck ) {
            case BAD:       result = proc_normal( inst_proc );      break;
            case LABEL:     result = proc_label();                  break;
            case FIXUP:     result = proc_fixup();                  break;
            case NORMAL:    result = proc_normal( inst_proc );      break;
        }

        length -= result;

        if ( (dword)result != inst_offset - prev_offset ) {
#ifdef DEBUG
            printf("Instruction Length was %ld, delta IP = %ld\n",
                                   (long)result, inst_offset - prev_offset );
#endif
            fmt_error("Dis-assembly Instruction Size Error");
        }

        if ( data_rec->offset + data_rec->length - length + addition 
                                                        != inst_offset ) {
            fmt_error("Dis-assembly Instruction Mis-alignment");
        }

        if ( buff_end - buff_cur != length ) {
#ifdef DEBUG
            printf("Buffer remaining: %04d Length remaining: %04d\n", 
                                            buff_end - buff_cur, length );
#endif
            fmt_error("Dis-assembly Internal Instruction Processing" );
        }
    }
    record_overused = addition - length;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movq -0x8(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x18(%rbp)
leaq 0xff24(%rip), %rax      # 0x20128
movq (%rax), %rdi
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rsi
movslq 0x1055a(%rip), %rax     # 0x20770
addq %rax, %rsi
xorl %edx, %edx
callq 0x9140
movl -0x18(%rbp), %edi
subl 0x10547(%rip), %edi     # 0x20770
callq 0x11960
movl %eax, -0x18(%rbp)
movl $0x0, -0x2c(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x10283
leaq 0xfee2(%rip), %rax      # 0x20128
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
xorl %edx, %edx
callq 0x9140
movl $0x10, -0x2c(%rbp)
movl -0x2c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jle 0x10275
movq -0x10(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x2c(%rbp)
movl -0x2c(%rbp), %edi
callq 0x119e0
addl -0x18(%rbp), %eax
movl %eax, -0x18(%rbp)
jmp 0x10285
movl -0x18(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jle 0x10395
cmpl $0x0, -0x18(%rbp)
jge 0x102a3
leaq 0x7b6e(%rip), %rdi      # 0x17e0c
callq 0x16e00
leaq 0x100be(%rip), %rax     # 0x20368
movq (%rax), %rax
movq %rax, -0x28(%rbp)
xorl %edi, %edi
callq 0xe580
movl %eax, -0x30(%rbp)
movl -0x30(%rbp), %eax
movq %rax, -0x38(%rbp)
subq $0x3, %rax
ja 0x10308
movq -0x38(%rbp), %rax
leaq 0x7a1d(%rip), %rcx      # 0x17cf0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl -0x14(%rbp), %edi
callq 0xf520
movl %eax, -0x1c(%rbp)
jmp 0x10308
callq 0xf180
movl %eax, -0x1c(%rbp)
jmp 0x10308
callq 0xf3a0
movl %eax, -0x1c(%rbp)
jmp 0x10308
movl -0x14(%rbp), %edi
callq 0xf520
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %ecx
movl -0x18(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x18(%rbp)
movslq -0x1c(%rbp), %rax
leaq 0x1004a(%rip), %rcx     # 0x20368
movq (%rcx), %rcx
subq -0x28(%rbp), %rcx
cmpq %rcx, %rax
je 0x10336
leaq 0x7af8(%rip), %rdi      # 0x17e29
callq 0x16e00
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
movq -0x8(%rbp), %rcx
addl 0x18(%rcx), %eax
subl -0x18(%rbp), %eax
addl -0x2c(%rbp), %eax
movl %eax, %eax
leaq 0x10015(%rip), %rcx     # 0x20368
cmpq (%rcx), %rax
je 0x10364
leaq 0x7aee(%rip), %rdi      # 0x17e4d
callq 0x16e00
leaq 0x11445(%rip), %rax     # 0x217b0
movq (%rax), %rax
leaq 0x11433(%rip), %rcx     # 0x217a8
movq (%rcx), %rcx
subq %rcx, %rax
movslq -0x18(%rbp), %rcx
cmpq %rcx, %rax
je 0x10390
leaq 0x7ae9(%rip), %rdi      # 0x17e74
callq 0x16e00
jmp 0x10285
movl -0x2c(%rbp), %eax
subl -0x18(%rbp), %eax
movl %eax, 0x103cf(%rip)     # 0x20770
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)