// File: /workspace/github_c_makefile_star2_O3/Nico01[P]obj2asm/oprocess.c
// Function: iterated
void iterated(DAT_T *data_rec, DAT_T *next_rec)
{
    char            temp[20];
    word    length;
    word    length_used;
    PUB_T           *save_pub_rec;
    int             dup_only;
    int             dummy;
    dword   repeat;
    STRUC_T         *this_struc;

    length = data_rec->length;
    fseek( o_file, data_rec->file_pos, L_SET );
    length = buff_init( length );

    if ( data_check( 0 ) == LABEL ) {
        proc_label();
    }

    save_pub_rec = last_pub_rec;
    if ( last_pub_rec ) {
        if ( pass == 3 ) {
            if ( last_pub_rec->type == FAR ) {
                out_directive("=");
                out_operand("$");
            }
            if ( last_pub_rec->type == NEAR ) {
                out_endline();
            }
        }
    }

    /*
    ** Process iterated data with this record
    */
    strcpy( structure_form, "" );
    if ( data_rec->structure ) {
        /* Processing for structures */
        dup_only = FALSE;
    } else {
        if ( pass == 1 ) {
            dup_only = FALSE;       /* Give 1 chance (pass 1) at structuring */
        } else {
            dup_only = TRUE;
        }
    }

    dup_buff[0]   = '\0';
    strcpy( struc_buff, "<" );

    while ( length > 0 ) {
        length_used = 0;
        data_rec->size = proc_idb( 1, 1L, &dup_only, data_rec->extended,
                                           &length_used, &repeat );
        sprintf( temp, "(%ld,%1d)", repeat, size_to_type(data_rec->size) );
        strcat( structure_form, temp );
        length -= length_used;
        if ( length ) {
            strcat( dup_buff, "," );
            strcat( struc_buff, "," );
        }
    }

    if ( dup_only ) {
        if ( save_pub_rec ) {
            save_pub_rec->type = size_to_type( data_rec->size );
        }
        if ( pass == 3 ) {
            out_directive( size_to_opcode(data_rec->size, &dummy) );
            out_operand( dup_buff );
            out_endline();
        }
    } else {
        /*
        ** Its a structure!
        */
        strcat( struc_buff, ">" );

        if ( pass == 1 ) {
            data_rec->structure = struc_insert( structure_form );
        }

        this_struc = data_rec->structure;

        if ( save_pub_rec ) {
            save_pub_rec->structure = this_struc;
        }

        if ( pass == 3 ) {
            sprintf( temp, "struct_%d", this_struc->index );
            out_directive( temp );
            out_operand( struc_buff );
            out_endline();
        }
    }

    next_rec = next_rec;       /* Prevent unused variable warnings */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rcx
movl 0x18(%rdi), %ebp
leaq 0xefc2(%rip), %rax      # 0x1cf58
movq (%rax), %rdi
movq %rcx, 0x8(%rsp)
movq 0x10(%rcx), %rsi
xorl %edx, %edx
callq 0x9160
movl %ebp, %edi
callq 0xf3d3
movl %eax, %ebp
xorl %edi, %edi
callq 0xcd14
cmpl $0x1, %eax
jne 0xdfc3
callq 0xd687
leaq 0xf0c6(%rip), %rbx      # 0x1d090
movq (%rbx), %r12
leaq 0xef94(%rip), %r15      # 0x1cf68
testq %r12, %r12
je 0xe011
cmpl $0x3, (%r15)
jne 0xe011
movl 0x38(%r12), %eax
cmpl $0x2, %eax
jne 0xe007
leaq 0x560a(%rip), %rdi      # 0x135fa
callq 0xcb07
leaq 0x5c88(%rip), %rdi      # 0x13c84
callq 0xca45
movq (%rbx), %rax
movl 0x38(%rax), %eax
cmpl $0x1, %eax
jne 0xe011
callq 0xcaab
movb $0x0, 0xf508(%rip)      # 0x1d520
movq 0x8(%rsp), %rax
cmpq $0x0, 0x20(%rax)
jne 0xe02e
cmpl $0x1, (%r15)
jne 0xe180
movl $0x0, 0x4(%rsp)
xorl %eax, %eax
movb $0x0, 0xf281(%rip)      # 0x1d2c0
movw $0x3c, 0xf378(%rip)     # 0x1d3c0
testl %ebp, %ebp
je 0xe105
movq %r12, 0x18(%rsp)
leaq 0x30(%rsp), %r14
leaq 0xf25f(%rip), %r12      # 0x1d2c0
movw $0x2c, %bx
leaq 0xf354(%rip), %r13      # 0x1d3c0
movl $0x0, 0x14(%rsp)
movq 0x8(%rsp), %r15
movl 0x1c(%r15), %ecx
movl $0x1, %esi
movl $0x1, %edi
leaq 0x4(%rsp), %rdx
leaq 0x14(%rsp), %r8
leaq 0x20(%rsp), %r9
callq 0xd19e
movl %eax, 0xc(%r15)
movq 0x20(%rsp), %r15
movl %eax, %edi
callq 0xf644
movq %r14, %rdi
leaq 0x5ca1(%rip), %rsi      # 0x13d56
movq %r15, %rdx
movl %eax, %ecx
xorl %eax, %eax
callq 0x91b0
leaq 0xf458(%rip), %rdi      # 0x1d520
movq %r14, %rsi
callq 0x91a0
subl 0x14(%rsp), %ebp
je 0xe0f5
movq %r12, %rdi
callq 0x90b0
movw %bx, (%rax,%r12)
movq %r13, %rdi
callq 0x90b0
movw %bx, (%rax,%r13)
jmp 0xe06c
movl 0x4(%rsp), %eax
leaq 0xee68(%rip), %r15      # 0x1cf68
movq 0x18(%rsp), %r12
testl %eax, %eax
je 0xe14d
testq %r12, %r12
je 0xe120
movq 0x8(%rsp), %rax
movl 0xc(%rax), %edi
callq 0xf644
movl %eax, 0x38(%r12)
cmpl $0x3, (%r15)
jne 0xe1d9
movq 0x8(%rsp), %rax
movl 0xc(%rax), %edi
leaq 0x2c(%rsp), %rsi
callq 0xf69e
movq %rax, %rdi
callq 0xcb07
leaq 0xf175(%rip), %r14      # 0x1d2c0
jmp 0xe1cc
leaq 0xf26c(%rip), %r14      # 0x1d3c0
movq %r14, %rdi
callq 0x90b0
movw $0x3e, (%rax,%r14)
cmpl $0x1, (%r15)
jne 0xe192
leaq 0xf3b0(%rip), %rdi      # 0x1d520
callq 0xf71f
movq 0x8(%rsp), %rcx
movq %rax, 0x20(%rcx)
jmp 0xe19b
movl $0x1, 0x4(%rsp)
movl $0x1, %eax
jmp 0xe038
movq 0x8(%rsp), %rax
movq 0x20(%rax), %rax
testq %r12, %r12
je 0xe1a5
movq %rax, 0x48(%r12)
cmpl $0x3, (%r15)
jne 0xe1d9
movl 0x8(%rax), %edx
leaq 0x5bab(%rip), %rsi      # 0x13d60
leaq 0x30(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x91b0
movq %rbx, %rdi
callq 0xcb07
movq %r14, %rdi
callq 0xca45
callq 0xcaab
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq