// File: /workspace/github_c_makefile_star2_O0/simh[P]simtools/crossassemblers/macro11/rept_irpc.c
// Function: expand_irpc
STREAM         *expand_irpc(
    STACK *stack,
    char *cp)
{
    char           *label,
                   *items;
    BUFFER         *gb;
    int             levelmod = 0;
    IRPC_STREAM    *str;

    label = get_symbol(cp, &cp, NULL);
    if (!label) {
        report(stack->top, "Illegal .IRPC syntax\n");
        return NULL;
    }

    cp = skipdelim(cp);

    items = getstring(cp, &cp);
    if (!items) {
        report(stack->top, "Illegal .IRPC syntax\n");
        free(label);
        return NULL;
    }

    gb = new_buffer();

    levelmod = 0;
    if (!list_md) {
        list_level--;
        levelmod++;
    }

    read_body(stack, gb, NULL, FALSE);

    list_level += levelmod;

    str = memcheck(malloc(sizeof(IRPC_STREAM))); {
        char           *name = memcheck(malloc(strlen(stack->top->name) + 32));

        sprintf(name, "%s:%d->.IRPC", stack->top->name, stack->top->line);
        buffer_stream_construct(&str->bstr, NULL, name);
        free(name);
    }

    str->bstr.stream.vtbl = &irpc_stream_vtbl;
    str->body = gb;
    str->items = items;
    str->offset = 0;
    str->label = label;
    str->savecond = last_cond;

    return &str->bstr.stream;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl $0x0, -0x34(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x18(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
callq 0xbf60
movq %rax, -0x20(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0xdcf5
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x7a8c(%rip), %rsi      # 0x1576d
movb $0x0, %al
callq 0xa890
movq $0x0, -0x8(%rbp)
jmp 0xde7b
movq -0x18(%rbp), %rdi
callq 0xba30
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0xbad0
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
jne 0xdd45
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x7a45(%rip), %rsi      # 0x1576d
movb $0x0, %al
callq 0xa890
movq -0x20(%rbp), %rdi
callq 0x2040
movq $0x0, -0x8(%rbp)
jmp 0xde7b
callq 0x12af0
movq %rax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
leaq 0xbd08(%rip), %rax      # 0x19a64
cmpl $0x0, (%rax)
jne 0xdd7f
leaq 0xbd08(%rip), %rax      # 0x19a70
movl (%rax), %ecx
addl $-0x1, %ecx
leaq 0xbcfc(%rip), %rax      # 0x19a70
movl %ecx, (%rax)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
movq -0x10(%rbp), %rdi
movq -0x30(%rbp), %rsi
xorl %eax, %eax
movl %eax, %edx
xorl %ecx, %ecx
callq 0xab10
movl -0x34(%rbp), %ecx
leaq 0xbcd4(%rip), %rax      # 0x19a70
addl (%rax), %ecx
leaq 0xbccb(%rip), %rax      # 0x19a70
movl %ecx, (%rax)
movl $0x58, %edi
callq 0x2220
movq %rax, %rdi
callq 0x136a0
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rdi
callq 0x20c0
movq %rax, %rdi
addq $0x20, %rdi
callq 0x2220
movq %rax, %rdi
callq 0x136a0
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq 0x8(%rax), %rdx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movl 0x10(%rax), %ecx
leaq 0x797e(%rip), %rsi      # 0x15783
movb $0x0, %al
callq 0x22a0
movq -0x40(%rbp), %rdi
movq -0x48(%rbp), %rdx
xorl %eax, %eax
movl %eax, %esi
callq 0x12f90
movq -0x48(%rbp), %rdi
callq 0x2040
movq -0x40(%rbp), %rax
leaq 0xbc8f(%rip), %rcx      # 0x19ac0
movq %rcx, (%rax)
movq -0x30(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x28(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x38(%rax)
movq -0x40(%rbp), %rax
movl $0x0, 0x40(%rax)
movq -0x20(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x30(%rax)
leaq 0xd666(%rip), %rax      # 0x1b4d0
movl (%rax), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x50(%rax)
movq -0x40(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop