LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/macros.c
// Function: free_args
static void free_args(
    ARG *arg)
{
    ARG            *next;

    while (arg) {
        next = arg->next;
        if (arg->label) {
            free(arg->label);
            arg->label = NULL;
        }
        if (arg->value) {
            free(arg->value);
            arg->value = NULL;
        }
        free(arg);
        arg = next;
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
testq %rbx, %rbx
je 0x81af
movq (%rbx), %r14
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0x8199
callq 0x2050
andq $0x0, 0x10(%rbx)
movq 0x18(%rbx), %rdi
callq 0x2050
movq %rbx, %rdi
callq 0x2050
movq %r14, %rbx
jmp 0x817e
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/macros.c
// Function: dump_all_macros
void dump_all_macros(
    void)
{
    MACRO          *mac;
    SYMBOL_ITER     iter;

    for (mac = (MACRO *) first_sym(&macro_st, &iter); mac != NULL; mac = (MACRO *) next_sym(&macro_st, &iter)) {
        dumpmacro(mac, lstfile);

        fprintf(lstfile, "\n\n");
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
leaq 0x154ec(%rip), %rbx     # 0x1d6b8
leaq 0x8(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x97be
leaq 0xf47d(%rip), %rbp      # 0x17660
leaq 0x7991(%rip), %r15      # 0xfb7b
pushq $0x2
popq %r12
pushq $0x1
popq %r13
testq %rax, %rax
je 0x8222
movq (%rbp), %rsi
movq %rax, %rdi
callq 0x79cd
movq (%rbp), %rcx
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x22d0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x9789
jmp 0x81f2
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/parse.c
// Function: skipdelim
char           *skipdelim(
    char *cp)
{
    cp = skipwhite(cp);
    if (*cp == ',')
        cp = skipwhite(cp + 1);
    return cp;
}

// Assembly:
pushq %rax
callq 0x8234
cmpb $0x2c, (%rax)
jne 0x8261
incq %rax
movq %rax, %rdi
popq %rax
jmp 0x8234
popq %rcx
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/parse.c
// Function: skipdelim_comma
char           *skipdelim_comma(
    char *cp,
    int  *comma)
{
    cp = skipwhite(cp);
    if ((*comma = (*cp == ','))) {
        cp = skipwhite(cp + 1);
    }
    return cp;
}

// Assembly:
pushq %rbx
movq %rsi, %rbx
callq 0x8234
xorl %ecx, %ecx
cmpb $0x2c, (%rax)
sete %cl
movl %ecx, (%rbx)
jne 0x8284
incq %rax
movq %rax, %rdi
popq %rbx
jmp 0x8234
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/parse.c
// Function: getstring
char           *getstring(
    char *cp,
    char **endp)
{
    int             len;
    int             start;
    char           *str;

    if (!brackrange(cp, &start, &len, endp)) {
        start = 0;
        len = strcspn(cp, " \t\n,;");
        if (endp)
            *endp = cp + len;
    }

    str = memcheck(malloc(len + 1));
    memcpy(str, cp + start, len);
    str[len] = 0;

    return str;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r15
movq %rdi, %rbx
movq %rsp, %rsi
leaq 0x4(%rsp), %rdx
movq %r15, %rcx
callq 0x8315
testl %eax, %eax
je 0x82b3
movl 0x4(%rsp), %r14d
movslq (%rsp), %r12
jmp 0x82d6
leaq 0x73a6(%rip), %rsi      # 0xf660
movq %rbx, %rdi
callq 0x2180
movq %rax, %r14
testq %r15, %r15
je 0x82d3
movslq %r14d, %rax
addq %rbx, %rax
movq %rax, (%r15)
xorl %r12d, %r12d
leal 0x1(%r14), %eax
movslq %eax, %rdi
callq 0x2230
movq %rax, %rdi
callq 0xcd2d
movq %rax, %r15
addq %r12, %rbx
movslq %r14d, %r14
movq %rax, %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x2220
movb $0x0, (%r15,%r14)
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/parse.c
// Function: brackrange
int brackrange(
    char *cp,
    int *start,
    int *length,
    char **endp)
{
    char            endstr[6];
    int             endlen;
    int             nest;
    int             len;

    switch (*cp) {
    case '^':
        endstr[0] = cp[1];
        strcpy(endstr + 1, "\n");
        *start = 2;
        endlen = 1;
        break;
    case '<':
        strcpy(endstr, "<>\n");
        endlen = 1;
        *start = 1;
        break;
    default:
        return FALSE;
    }

    cp += *start;

    len = 0;
    if (endstr[1] == '>') { /* <>\n */
        nest = 1;
        while (nest) {
            int             sublen;

            sublen = strcspn(cp + len, endstr);
            if (cp[len + sublen] == '<') {
                nest++;
                sublen++;  /* avoid infinite loop when sublen == 0 */
            } else {
                nest--;
                if (nest > 0 && cp[len + sublen] == '>')
                    sublen++;  /* avoid infinite loop when sublen == 0 */
            }
            len += sublen;
            if (sublen == 0)
                break;
        }
    } else {
        int             sublen;

        sublen = strcspn(cp + len, endstr);
        len += sublen;
    }

    *length = len;
    if (endp)
        *endp = cp + len + endlen;

    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %rbx
movq %rdx, %r15
movq %rdi, %r14
movzbl (%rdi), %ecx
cmpl $0x5e, %ecx
je 0x83c6
xorl %eax, %eax
cmpl $0x3c, %ecx
jne 0x8409
movq %r15, (%rsp)
movq %rbx, 0x8(%rsp)
pushq $0x1
popq %r15
leaq 0x10(%rsp), %r13
movl $0xa3e3c, (%r13)        # imm = 0xA3E3C
movl $0x1, (%rsi)
leaq 0x1(%r14), %rbp
xorl %r12d, %r12d
testl %r15d, %r15d
je 0x83b9
movslq %r12d, %rbx
leaq (%rbx,%rbp), %rdi
movq %r13, %rsi
callq 0x2180
addl %eax, %ebx
movslq %ebx, %rcx
movb (%rbp,%rcx), %cl
cmpb $0x3c, %cl
jne 0x8393
incl %r15d
incl %eax
jmp 0x83b2
cmpl $0x2, %r15d
leal -0x1(%r15), %edx
setge %sil
cmpb $0x3e, %cl
sete %cl
andb %sil, %cl
movzbl %cl, %ecx
addl %eax, %ecx
movl %edx, %r15d
movl %ecx, %eax
addl %eax, %r12d
testl %eax, %eax
jne 0x836a
movq 0x8(%rsp), %rbx
movq (%rsp), %r15
pushq $0x1
jmp 0x83ee
movb 0x1(%r14), %cl
leaq 0x10(%rsp), %rax
movb %cl, (%rax)
movw $0xa, 0x1(%rax)
movl $0x2, (%rsi)
leaq 0x2(%r14), %rdi
movq %rax, %rsi
callq 0x2180
movq %rax, %r12
pushq $0x2
popq %rcx
movl %r12d, (%r15)
pushq $0x1
popq %rax
testq %rbx, %rbx
je 0x8409
addq %rcx, %r14
movslq %r12d, %rcx
addq %r14, %rcx
incq %rcx
movq %rcx, (%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/parse.c
// Function: getstring_fn
char           *getstring_fn(
    char *cp,
    char **endp)
{
    char            endstr[4];
    int             len;
    char           *str;

    switch (*cp) {
    case '<':
    case ':':
        return NULL;
    }

    if (!ispunct((unsigned char)*cp)) {
        return NULL;
    }

    endstr[0] = *cp;
    endstr[1] = '\n';
    endstr[2] = '\0';
    cp++;

    len = strcspn(cp, endstr);

    if (endp)
        *endp = cp + len + 1;

    str = memcheck(malloc(len + 1));
    memcpy(str, cp, len);
    str[len] = 0;

    return str;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movzbl (%rdi), %r15d
xorl %r12d, %r12d
cmpl $0x3a, %r15d
je 0x84bb
cmpl $0x3c, %r15d
je 0x84bb
movq %rsi, %r14
movq %rdi, %rbx
callq 0x2300
movq (%rax), %rax
testb $0x4, (%rax,%r15,2)
jne 0x8455
xorl %r12d, %r12d
jmp 0x84bb
leaq 0x4(%rsp), %rsi
movb %r15b, (%rsi)
movw $0xa, 0x1(%rsi)
incq %rbx
movq %rbx, %rdi
callq 0x2180
movslq %eax, %r15
movq %rax, %rdi
shlq $0x20, %rdi
testq %r14, %r14
je 0x8487
leaq (%rbx,%r15), %rax
incq %rax
movq %rax, (%r14)
movabsq $0x100000000, %rax      # imm = 0x100000000
addq %rax, %rdi
sarq $0x20, %rdi
callq 0x2230
movq %rax, %rdi
callq 0xcd2d
movq %rax, %r12
movq %rax, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x2220
movb $0x0, (%r12,%r15)
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/parse.c
// Function: get_op
SYMBOL         *get_op(
    char *cp,
    char **endp)
{
    int             local;
    char           *label;
    SYMBOL         *op;

    cp = skipwhite(cp);
    if (EOL(*cp))
        return NULL;

    label = get_symbol(cp, &cp, &local);
    if (label == NULL)
        return NULL;                   /* No operation code. */

    cp = skipwhite(cp);
    if (*cp == ':') {                  /* A label definition? */
        cp++;
        if (*cp == ':')
            cp++;                      /* Skip it */
        free(label);
        label = get_symbol(cp, &cp, NULL);
        if (label == NULL)
            return NULL;
    }

    op = lookup_sym(label, &system_st);
    free(label);

    if (endp)
        *endp = cp;

    return op;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
callq 0x8234
movq %rax, (%rsp)
movzbl (%rax), %ecx
cmpq $0x3b, %rcx
ja 0x8508
movabsq $0x800000000000401, %rdx # imm = 0x800000000000401
btq %rcx, %rdx
jae 0x8508
xorl %r15d, %r15d
movq %r15, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rsp, %rsi
leaq 0xc(%rsp), %rdx
movq %rax, %rdi
callq 0x8597
testq %rax, %rax
je 0x84f8
movq %rax, %r14
movq (%rsp), %rdi
callq 0x8234
movq %rax, (%rsp)
cmpb $0x3a, (%rax)
jne 0x8568
leaq 0x1(%rax), %rcx
movq %rcx, (%rsp)
cmpb $0x3a, 0x1(%rax)
jne 0x8548
addq $0x2, %rax
movq %rax, (%rsp)
movq %r14, %rdi
callq 0x2050
movq %rsp, %rsi
movq (%rsi), %rdi
xorl %r15d, %r15d
xorl %edx, %edx
callq 0x8597
movq %rax, %r14
testq %rax, %rax
je 0x84fb
leaq 0x11119(%rip), %rsi     # 0x19688
movq %r14, %rdi
callq 0x974c
movq %rax, %r15
movq %r14, %rdi
callq 0x2050
testq %rbx, %rbx
je 0x84fb
movq (%rsp), %rax
movq %rax, (%rbx)
jmp 0x84fb
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/parse.c
// Function: parse_expr
EX_TREE        *parse_expr(
    char *cp,
    int undef)
{
    EX_TREE        *expr;
    EX_TREE        *value;

    expr = parse_binary(cp, 0, 0);     /* Parse into a tree */
    value = evaluate(expr, undef);     /* Perform the arithmetic */
    value->cp = expr->cp;              /* Pointer to end of text is part of
                                          the rootmost node  */
    free_tree(expr);                   /* Discard parse in favor of
                                          evaluation */

    return value;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
xorl %esi, %esi
xorl %edx, %edx
callq 0x8b7d
movq %rax, %r14
movq %rax, %rdi
movl %ebx, %esi
callq 0x6c38
movq %rax, %rbx
movq 0x8(%r14), %rax
movq %rax, 0x8(%rbx)
movq %r14, %rdi
callq 0x6add
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/parse.c
// Function: parse_unary_expr
EX_TREE        *parse_unary_expr(
    char *cp,
    int undef)
{
    EX_TREE        *expr;
    EX_TREE        *value;

    expr = parse_unary(cp);            /* Parse into a tree */
    value = evaluate(expr, undef);     /* Perform the arithmetic */
    value->cp = expr->cp;              /* Pointer to end of text is part of
                                          the rootmost node  */
    free_tree(expr);                   /* Discard parse in favor of
                                          evaluation */

    return value;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
callq 0x8c2a
movq %rax, %r14
movq %rax, %rdi
movl %ebx, %esi
callq 0x6c38
movq %rax, %rbx
movq 0x8(%r14), %rax
movq %rax, 0x8(%rbx)
movq %r14, %rdi
callq 0x6add
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/rept_irpc.c
// Function: rept_stream_gets
char           *rept_stream_gets(
    STREAM *str)
{
    REPT_STREAM    *rstr = (REPT_STREAM *) str;
    char           *cp;

    for (;;) {
        if ((cp = buffer_stream_gets(str)) != NULL)
            return cp;

        if (--rstr->count <= 0)
            return NULL;

        buffer_stream_rewind(str);
    }
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq %rbx, %rdi
callq 0xc911
testq %rax, %rax
jne 0x90d9
movl 0x30(%rbx), %ecx
leal -0x1(%rcx), %edx
movl %edx, 0x30(%rbx)
cmpl $0x2, %ecx
jl 0x90d9
movq %rbx, %rdi
callq 0xc98c
jmp 0x90b4
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/rept_irpc.c
// Function: expand_rept
STREAM         *expand_rept(
    STACK *stack,
    char *cp)
{
    EX_TREE        *value;
    BUFFER         *gb;
    REPT_STREAM    *rstr;
    int             levelmod;

    value = parse_expr(cp, 0);
    if (value->type != EX_LIT) {
        report(stack->top, ".REPT value must be constant\n");
        free_tree(value);
        return NULL;
    }

    gb = new_buffer();

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

    read_body(stack, gb, NULL, FALSE);

    list_level += levelmod;

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

        sprintf(name, "%s:%d->.REPT", stack->top->name, stack->top->line);
        buffer_stream_construct(&rstr->bstr, gb, name);
        free(name);
    }

    rstr->count = value->data.lit;
    rstr->bstr.stream.vtbl = &rept_stream_vtbl;
    rstr->savecond = last_cond;

    buffer_free(gb);
    free_tree(value);

    return &rstr->bstr.stream;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
xorl %ebp, %ebp
movq %rsi, %rdi
xorl %esi, %esi
callq 0x8a04
movq %rax, %rbx
cmpl $0x1, (%rax)
jne 0x91dd
callq 0xc798
movq %rax, %r14
leaq 0xc94f(%rip), %rax      # 0x15a74
cmpl $0x0, (%rax)
jne 0x9136
leaq 0xc94f(%rip), %rax      # 0x15a80
decl (%rax)
pushq $0x1
popq %rbp
movq %r15, %rdi
movq %r14, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x7863
leaq 0xc934(%rip), %rax      # 0x15a80
addl %ebp, (%rax)
pushq $0x38
popq %rdi
callq 0x2230
movq %rax, %rdi
callq 0xcd2d
movq %rax, %r12
movq (%r15), %rax
movq 0x8(%rax), %rdi
callq 0x20e0
leaq 0x20(%rax), %rdi
callq 0x2230
movq %rax, %rdi
callq 0xcd2d
movq %rax, %r13
movq (%r15), %rax
movq 0x8(%rax), %rdx
movl 0x10(%rax), %ecx
leaq 0x6511(%rip), %rsi      # 0xf6a3
movq %r13, %rdi
xorl %eax, %eax
callq 0x22b0
movq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0xc995
movq %r13, %rdi
callq 0x2050
movl 0x10(%rbx), %eax
movl %eax, 0x30(%r12)
leaq 0xc8df(%rip), %rax      # 0x15aa0
movq %rax, (%r12)
leaq 0xe2e4(%rip), %rax      # 0x174b0
movl (%rax), %eax
movl %eax, 0x34(%r12)
movq %r14, %rdi
callq 0xc802
jmp 0x91f1
movq (%r15), %rdi
leaq 0x649e(%rip), %rsi      # 0xf685
xorl %r12d, %r12d
xorl %eax, %eax
callq 0x7668
movq %rbx, %rdi
callq 0x6add
movq %r12, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/rept_irpc.c
// Function: irp_stream_gets
char           *irp_stream_gets(
    STREAM *str)
{
    IRP_STREAM     *istr = (IRP_STREAM *) str;
    char           *cp;
    BUFFER         *buf;
    ARG            *arg;

    for (;;) {
        if ((cp = buffer_stream_gets(str)) != NULL)
            return cp;

        cp = istr->items + istr->offset;

        if (!*cp)
            return NULL;               /* No more items.  EOF. */

        arg = new_arg();
        arg->next = NULL;
        arg->locsym = 0;
        arg->label = istr->label;
        arg->value = getstring_macarg(str, cp, &cp);
        cp = skipdelim(cp);
        istr->offset = (int) (cp - istr->items);

        buf = subst_args(istr->body, arg);

        free(arg->value);
        free(arg);
        buffer_stream_set_buffer(&istr->bstr, buf);
        buffer_free(buf);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq %rsp, %r14
movq %rbx, %rdi
callq 0xc911
testq %rax, %rax
jne 0x92b6
movq 0x38(%rbx), %rcx
movslq 0x40(%rbx), %rdx
leaq (%rcx,%rdx), %rsi
movq %rsi, (%rsp)
cmpb $0x0, (%rcx,%rdx)
je 0x92b6
callq 0x7ca7
movq %rax, %r15
andq $0x0, (%rax)
andl $0x0, 0x8(%rax)
movq 0x30(%rbx), %rax
movq %rax, 0x10(%r15)
movq (%rsp), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x7ea4
movq %rax, 0x18(%r15)
movq (%rsp), %rdi
callq 0x824a
movq %rax, (%rsp)
subl 0x38(%rbx), %eax
movl %eax, 0x40(%rbx)
movq 0x48(%rbx), %rdi
movq %r15, %rsi
callq 0x7cc9
movq %rax, %r12
movq 0x18(%r15), %rdi
callq 0x2050
movq %r15, %rdi
callq 0x2050
movq %rbx, %rdi
movq %r12, %rsi
callq 0xc9da
movq %r12, %rdi
callq 0xc802
jmp 0x9219
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/rept_irpc.c
// Function: irp_stream_delete
void irp_stream_delete(
    STREAM *str)
{
    IRP_STREAM     *istr = (IRP_STREAM *) str;

    pop_cond(istr->savecond);          /* complete unterminated
                                          conditionals */

    buffer_free(istr->body);
    free(istr->items);
    free(istr->label);
    buffer_stream_delete(str);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x50(%rdi), %edi
callq 0x6440
movq 0x48(%rbx), %rdi
callq 0xc802
movq 0x38(%rbx), %rdi
callq 0x2050
movq 0x30(%rbx), %rdi
callq 0x2050
movq %rbx, %rdi
popq %rbx
jmp 0xc976
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/rept_irpc.c
// Function: expand_irp
STREAM         *expand_irp(
    STACK *stack,
    char *cp)
{
    char           *label,
                   *items;
    BUFFER         *gb;
    int             levelmod = 0;
    IRP_STREAM     *str;

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

    cp = skipdelim(cp);

    items = getstring(cp, &cp);
    if (!items) {
        report(stack->top, "Illegal .IRP 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(IRP_STREAM))); {
        char           *name = memcheck(malloc(strlen(stack->top->name) + 32));

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

    str->bstr.stream.vtbl = &irp_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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rax
movq %rdi, %r14
movq %rsp, %rsi
movq %rax, (%rsi)
movq %rax, %rdi
xorl %edx, %edx
callq 0x8597
testq %rax, %rax
je 0x940c
movq %rax, %rbx
movq %rsp, %r15
movq (%r15), %rdi
callq 0x824a
movq %rax, (%r15)
movq %rax, %rdi
movq %r15, %rsi
callq 0x8286
testq %rax, %rax
je 0x9422
movq %rax, %r15
callq 0xc798
movq %rax, %r12
leaq 0xc721(%rip), %rax      # 0x15a74
xorl %ebp, %ebp
cmpl $0x0, (%rax)
jne 0x9366
leaq 0xc71f(%rip), %rax      # 0x15a80
decl (%rax)
pushq $0x1
popq %rbp
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x7863
leaq 0xc704(%rip), %rax      # 0x15a80
addl %ebp, (%rax)
pushq $0x58
popq %rdi
callq 0x2230
movq %rax, %rdi
callq 0xcd2d
movq %rax, %r13
movq (%r14), %rax
movq 0x8(%rax), %rdi
callq 0x20e0
leaq 0x20(%rax), %rdi
callq 0x2230
movq %rax, %rdi
callq 0xcd2d
movq %rax, %rbp
movq (%r14), %rax
movq 0x8(%rax), %rdx
movl 0x10(%rax), %ecx
leaq 0x6303(%rip), %rsi      # 0xf6c5
movq %rbp, %rdi
xorl %eax, %eax
callq 0x22b0
movq %r13, %rdi
xorl %esi, %esi
movq %rbp, %rdx
callq 0xc995
movq %rbp, %rdi
callq 0x2050
leaq 0xc6d0(%rip), %rax      # 0x15ab8
movq %rax, (%r13)
movq %r12, 0x48(%r13)
movq %r15, 0x38(%r13)
andl $0x0, 0x40(%r13)
movq %rbx, 0x30(%r13)
leaq 0xe0ac(%rip), %rax      # 0x174b0
movl (%rax), %eax
movl %eax, 0x50(%r13)
jmp 0x943e
movq (%r14), %rdi
leaq 0x629a(%rip), %rsi      # 0xf6b0
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x7668
jmp 0x943e
movq (%r14), %rdi
leaq 0x6284(%rip), %rsi      # 0xf6b0
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x7668
movq %rbx, %rdi
callq 0x2050
movq %r13, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/rept_irpc.c
// Function: irpc_stream_gets
char           *irpc_stream_gets(
    STREAM *str)
{
    IRPC_STREAM    *istr = (IRPC_STREAM *) str;
    char           *cp;
    BUFFER         *buf;
    ARG            *arg;

    for (;;) {
        if ((cp = buffer_stream_gets(str)) != NULL)
            return cp;

        cp = istr->items + istr->offset;

        if (!*cp)
            return NULL;               /* No more items.  EOF. */

        arg = new_arg();
        arg->next = NULL;
        arg->locsym = 0;
        arg->label = istr->label;
        arg->value = memcheck(malloc(2));
        arg->value[0] = *cp++;
        arg->value[1] = 0;
        istr->offset = (int) (cp - istr->items);

        buf = subst_args(istr->body, arg);

        free(arg->value);
        free(arg);
        buffer_stream_set_buffer(&istr->bstr, buf);
        buffer_free(buf);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
pushq $0x2
popq %r14
movq %rbx, %rdi
callq 0xc911
testq %rax, %rax
jne 0x9505
movq 0x38(%rbx), %r12
movslq 0x40(%rbx), %rcx
cmpb $0x0, (%r12,%rcx)
je 0x9505
addq %rcx, %r12
callq 0x7ca7
movq %rax, %r15
andq $0x0, (%rax)
andl $0x0, 0x8(%rax)
movq 0x30(%rbx), %rax
movq %rax, 0x10(%r15)
movq %r14, %rdi
callq 0x2230
movq %rax, %rdi
callq 0xcd2d
movq %rax, 0x18(%r15)
movb (%r12), %cl
movb %cl, (%rax)
movq 0x18(%r15), %rax
movb $0x0, 0x1(%rax)
movl 0x38(%rbx), %eax
subl %eax, %r12d
incl %r12d
movl %r12d, 0x40(%rbx)
movq 0x48(%rbx), %rdi
movq %r15, %rsi
callq 0x7cc9
movq %rax, %r12
movq 0x18(%r15), %rdi
callq 0x2050
movq %r15, %rdi
callq 0x2050
movq %rbx, %rdi
movq %r12, %rsi
callq 0xc9da
movq %r12, %rdi
callq 0xc802
jmp 0x945f
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rax
movq %rdi, %r14
movq %rsp, %rsi
movq %rax, (%rsi)
movq %rax, %rdi
xorl %edx, %edx
callq 0x8597
testq %rax, %rax
je 0x965b
movq %rax, %rbx
movq %rsp, %r15
movq (%r15), %rdi
callq 0x824a
movq %rax, (%r15)
movq %rax, %rdi
movq %r15, %rsi
callq 0x8286
testq %rax, %rax
je 0x9671
movq %rax, %r15
callq 0xc798
movq %rax, %r12
leaq 0xc4d2(%rip), %rax      # 0x15a74
xorl %ebp, %ebp
cmpl $0x0, (%rax)
jne 0x95b5
leaq 0xc4d0(%rip), %rax      # 0x15a80
decl (%rax)
pushq $0x1
popq %rbp
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
xorl %ecx, %ecx
callq 0x7863
leaq 0xc4b5(%rip), %rax      # 0x15a80
addl %ebp, (%rax)
pushq $0x58
popq %rdi
callq 0x2230
movq %rax, %rdi
callq 0xcd2d
movq %rax, %r13
movq (%r14), %rax
movq 0x8(%rax), %rdi
callq 0x20e0
leaq 0x20(%rax), %rdi
callq 0x2230
movq %rax, %rdi
callq 0xcd2d
movq %rax, %rbp
movq (%r14), %rax
movq 0x8(%rax), %rdx
movl 0x10(%rax), %ecx
leaq 0x60d6(%rip), %rsi      # 0xf6e7
movq %rbp, %rdi
xorl %eax, %eax
callq 0x22b0
movq %r13, %rdi
xorl %esi, %esi
movq %rbp, %rdx
callq 0xc995
movq %rbp, %rdi
callq 0x2050
leaq 0xc499(%rip), %rax      # 0x15ad0
movq %rax, (%r13)
movq %r12, 0x48(%r13)
movq %r15, 0x38(%r13)
andl $0x0, 0x40(%r13)
movq %rbx, 0x30(%r13)
leaq 0xde5d(%rip), %rax      # 0x174b0
movl (%rax), %eax
movl %eax, 0x50(%r13)
jmp 0x968d
movq (%r14), %rdi
leaq 0x606c(%rip), %rsi      # 0xf6d1
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x7668
jmp 0x968d
movq (%r14), %rdi
leaq 0x6056(%rip), %rsi      # 0xf6d1
xorl %r13d, %r13d
xorl %eax, %eax
callq 0x7668
movq %rbx, %rdi
callq 0x2050
movq %r13, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/symbols.c
// Function: hash_name
int hash_name(
    char *label)
{
    unsigned        accum = 0;

    while (*label)
        accum = (accum << 1) ^ *label++;

    accum %= HASH_SIZE;

    return accum;
}

// Assembly:
xorl %eax, %eax
movsbl (%rdi), %ecx
testl %ecx, %ecx
je 0x96b2
addl %eax, %eax
incq %rdi
xorl %ecx, %eax
jmp 0x96a2
movl $0x3ff, %ecx            # imm = 0x3FF
xorl %edx, %edx
divl %ecx
movl %edx, %eax
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/symbols.c
// Function: symflags
char           *symflags(
    SYMBOL *sym)
{
    static char     temp[8];
    char           *fp = temp;

    if (sym->flags & SYMBOLFLAG_GLOBAL)
        *fp++ = 'G';
    if (sym->flags & SYMBOLFLAG_PERMANENT)
        *fp++ = 'P';
    if (sym->flags & SYMBOLFLAG_DEFINITION)
        *fp++ = 'D';
    *fp = 0;
    return fp;
}

// Assembly:
movl 0x10(%rdi), %ecx
testb $0x2, %cl
jne 0x96cf
leaq 0xdfb7(%rip), %rax      # 0x17684
jmp 0x96dd
movb $0x47, 0xdfae(%rip)     # 0x17684
leaq 0xdfa8(%rip), %rax      # 0x17685
testb $0x1, %cl
je 0x96e8
movb $0x50, (%rax)
incq %rax
testb $0x8, %cl
je 0x96f3
movb $0x44, (%rax)
incq %rax
movb $0x0, (%rax)
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/symbols.c
// Function: remove_sym
void remove_sym(
    SYMBOL *sym,
    SYMBOL_TABLE *table)
{
    SYMBOL        **prevp,
                   *symp;
    int             hash;

    hash = hash_name(sym->label);
    prevp = &table->hash[hash];
    while (symp = *prevp, symp != NULL && symp != sym)
        prevp = &symp->next;

    if (symp)
        *prevp = sym->next;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x96a0
movl %eax, %eax
leaq (%r14,%rax,8), %rdx
movq %rdx, %rax
movq (%rdx), %rcx
testq %rcx, %rcx
je 0x9738
leaq 0x20(%rcx), %rdx
cmpq %rbx, %rcx
jne 0x9724
testq %rcx, %rcx
je 0x9744
movq 0x20(%rbx), %rcx
movq %rcx, (%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/symbols.c
// Function: lookup_sym
SYMBOL         *lookup_sym(
    char *label,
    SYMBOL_TABLE *table)
{
    unsigned        hash;
    SYMBOL         *sym;

    hash = hash_name(label);

    sym = table->hash[hash];
    while (sym && strcmp(sym->label, label) != 0)
        sym = sym->next;

    return sym;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
callq 0x96a0
movl %eax, %eax
leaq (%r14,%rax,8), %r14
movq (%r14), %r14
testq %r14, %r14
je 0x977e
movq (%r14), %rdi
movq %rbx, %rsi
callq 0x21d0
testl %eax, %eax
je 0x977e
addq $0x20, %r14
jmp 0x9761
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/symbols.c
// Function: next_sym
SYMBOL         *next_sym(
    SYMBOL_TABLE *table,
    SYMBOL_ITER *iter)
{
    if (iter->current)
        iter->current = iter->current->next;

    while (iter->current == NULL) {
        if (iter->subscript >= HASH_SIZE)
            return NULL;               /* No more symbols. */
        iter->current = table->hash[iter->subscript];
        iter->subscript++;
    }

    return iter->current;              /* Got a symbol. */
}

// Assembly:
movq 0x8(%rsi), %rax
testq %rax, %rax
je 0x979c
movq 0x20(%rax), %rax
movq %rax, 0x8(%rsi)
jmp 0x979e
xorl %eax, %eax
testq %rax, %rax
jne 0x97bd
movslq (%rsi), %rcx
cmpq $0x3fe, %rcx            # imm = 0x3FE
jg 0x97bd
movq (%rdi,%rcx,8), %rax
movq %rax, 0x8(%rsi)
incl %ecx
movl %ecx, (%rsi)
jmp 0x979e
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/symbols.c
// Function: add_sym
SYMBOL         *add_sym(
    char *labelraw,
    unsigned value,
    unsigned flags,
    SECTION *section,
    SYMBOL_TABLE *table)
{
    SYMBOL         *sym;
    char            label[SYMMAX_MAX + 1];      // big size

    if (isdigit((unsigned char)labelraw[0])) {
        // Don't truncate local labels
        strncpy(label, labelraw, SYMMAX_MAX);
        label[SYMMAX_MAX] = 0;
    } else {
        //JH: truncate symbol to SYMMAX
        strncpy(label, labelraw, symbol_len);
        label[symbol_len] = 0;
    }

    sym = lookup_sym(label, table);
    if (sym != NULL) {
        // A symbol registered as "undefined" can be changed.

        if ((sym->flags & SYMBOLFLAG_UNDEFINED) && !(flags & SYMBOLFLAG_UNDEFINED)) {
            sym->flags &= ~(SYMBOLFLAG_PERMANENT | SYMBOLFLAG_UNDEFINED);
        }

        /* Check for compatible definition */
        else if (sym->section == section && sym->value == value) {
            sym->flags |= flags;       /* Merge flags quietly */
            return sym;                /* 's okay */
        }

        if (!(sym->flags & SYMBOLFLAG_PERMANENT)) {
            /* permit redefinition */
            sym->value = value;
            sym->flags |= flags;
            sym->section = section;
            return sym;
        }

        return NULL;                   /* Bad symbol redefinition */
    }

    sym = new_sym(label);
    sym->flags = flags;
    sym->stmtno = stmtno;
    sym->section = section;
    sym->value = value;

    add_table(sym, table);

    return sym;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %r8, %r12
movq %rcx, %rbx
movl %edx, %ebp
movl %esi, %r14d
movq %rdi, %r15
callq 0x2300
movq (%rax), %rax
movzbl (%r15), %ecx
testb $0x8, 0x1(%rax,%rcx,2)
jne 0x983e
movslq 0xc2bf(%rip), %r13      # 0x15ae8
movq %rsp, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x2080
movb $0x0, (%rsp,%r13)
jmp 0x9854
movq %rsp, %r13
pushq $0x40
popq %rdx
movq %r13, %rdi
movq %r15, %rsi
callq 0x2080
movb $0x0, 0x40(%r13)
movq %rsp, %rdi
movq %r12, %rsi
callq 0x974c
testq %rax, %rax
je 0x9880
movq %rax, %r15
movl 0x10(%rax), %eax
testb $0x10, %bpl
jne 0x98cc
movl %eax, %ecx
andl $0x10, %ecx
je 0x98cc
andl $-0x12, %eax
movl %eax, 0x10(%r15)
jmp 0x98e0
pushq $0x28
popq %rdi
callq 0x2230
movq %rax, %rdi
callq 0xcd2d
movq %rax, %r15
movq %rsp, %rdi
callq 0x22e0
movq %rax, %rdi
callq 0xcd2d
movq %rax, (%r15)
movl %ebp, 0x10(%r15)
leaq 0xc2b3(%rip), %rax      # 0x15b64
movl (%rax), %eax
movl %eax, 0xc(%r15)
movq %rbx, 0x18(%r15)
movl %r14d, 0x8(%r15)
movq %r15, %rdi
movq %r12, %rsi
callq 0x97cb
jmp 0x98f7
cmpq %rbx, 0x18(%r15)
jne 0x98e0
cmpl %r14d, 0x8(%r15)
jne 0x98e0
orl %ebp, %eax
movl %eax, 0x10(%r15)
jmp 0x98f7
testb $0x1, %al
jne 0x98f4
movl %r14d, 0x8(%r15)
orl %ebp, %eax
movl %eax, 0x10(%r15)
movq %rbx, 0x18(%r15)
jmp 0x98f7
xorl %r15d, %r15d
movq %r15, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/symbols.c
// Function: sym_hist
void sym_hist(
    SYMBOL_TABLE *st,
    char *name)
{
    int             i;
    SYMBOL         *sym;

    fprintf(lstfile, "Histogram for symbol table %s\n", name);
    for (i = 0; i < 1023; i++) {
        fprintf(lstfile, "%4d: ", i);
        for (sym = st->hash[i]; sym != NULL; sym = sym->next)
            fputc('#', lstfile);
        fputc('\n', lstfile);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rdx
movq %rdi, %rbx
leaq 0xc6e5(%rip), %r13      # 0x17660
movq (%r13), %rdi
leaq 0x4b8c(%rip), %rsi      # 0xfb12
xorl %eax, %eax
callq 0x21e0
pushq $0xa
popq %rbp
pushq $0x23
popq %r15
xorl %r12d, %r12d
cmpq $0x3ff, %r12            # imm = 0x3FF
je 0xafdf
movq (%r13), %rdi
leaq 0x4b86(%rip), %rsi      # 0xfb31
movl %r12d, %edx
xorl %eax, %eax
callq 0x21e0
leaq (%rbx,%r12,8), %r14
movq (%r14), %r14
movq (%r13), %rsi
testq %r14, %r14
je 0xafd3
movl %r15d, %edi
callq 0x2170
addq $0x20, %r14
jmp 0xafb9
movl %ebp, %edi
callq 0x2170
incq %r12
jmp 0xaf97
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/symbols.c
// Function: list_section
void list_section(
    SECTION *sec)
{
    if (sec == NULL) {
        fprintf(lstfile, "(null)\n");
        return;
    }

    int flags = sec->flags;

    fprintf(lstfile, "%-6s  %06o    %03d   ",
        sec->label, sec->size & 0177777, sec->sector);
    fprintf(lstfile, "(%s,%s,%s,%s,%s,%s)\n",
        (flags & PSECT_RO)   ? "RO"  : "RW",
        (flags & PSECT_DATA) ? "D"   : "I",
        (flags & PSECT_GBL)  ? "GBL" : "LCL",
        (flags & PSECT_REL)  ? "REL" : "ABS",
        (flags & PSECT_COM)  ? "OVR" : "CON",
        (flags & PSECT_SAV)  ? "SAV" : "NOSAV");
}

// Assembly:
testq %rdi, %rdi
je 0xb398
pushq %rbp
pushq %rbx
pushq %rax
movl 0xc(%rdi), %ebp
leaq 0xc39a(%rip), %rbx      # 0x17660
movq (%rbx), %rax
movq (%rdi), %rdx
movzwl 0x14(%rdi), %ecx
movl 0x18(%rdi), %r8d
leaq 0x48ab(%rip), %rsi      # 0xfb86
movq %rax, %rdi
xorl %eax, %eax
callq 0x21e0
testb $0x10, %bpl
leaq 0x48c1(%rip), %rax      # 0xfbb1
leaq 0x4575(%rip), %rdx      # 0xf86c
cmoveq %rax, %rdx
testb %bpl, %bpl
leaq 0x47ce(%rip), %rax      # 0xfad3
leaq 0x47f5(%rip), %rcx      # 0xfb01
cmovnsq %rax, %rcx
movd %ebp, %xmm0
pshufd $0x0, %xmm0, %xmm0      # xmm0 = xmm0[0,0,0,0]
pand 0x43df(%rip), %xmm0     # 0xf700
pxor %xmm1, %xmm1
pcmpeqd %xmm0, %xmm1
movmskps %xmm1, %eax
leaq 0x3bab(%rip), %rsi      # 0xeede
leaq 0x3643(%rip), %r8       # 0xe97d
testb $0x8, %al
cmovneq %rsi, %r8
movq (%rbx), %rdi
leaq 0x3b7e(%rip), %rsi      # 0xeec8
leaq 0x3b7b(%rip), %r9       # 0xeecc
testb $0x4, %al
cmovneq %rsi, %r9
leaq 0x3b7c(%rip), %rsi      # 0xeeda
leaq 0x3b71(%rip), %r10      # 0xeed6
testb $0x2, %al
cmovneq %rsi, %r10
leaq 0x3b5e(%rip), %rsi      # 0xeed0
leaq 0x3b59(%rip), %r11      # 0xeed2
testb $0x1, %al
cmovneq %rsi, %r11
leaq 0x4816(%rip), %rsi      # 0xfb9c
xorl %eax, %eax
pushq %r11
pushq %r10
callq 0x21e0
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
leaq 0xc2c1(%rip), %rax      # 0x17660
movq (%rax), %rcx
leaq 0x47d5(%rip), %rdi      # 0xfb7e
pushq $0x7
popq %rsi
pushq $0x1
popq %rdx
jmp 0x22d0
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/mlb-rsx.c
// Function: mlb_close
void mlb_close(
    MLB *mlb)
{
    if (mlb) {
        int             i;

        if (mlb->directory) {
            for (i = 0; i < mlb->nentries; i++)
                if (mlb->directory[i].label)
                    free(mlb->directory[i].label);
            free(mlb->directory);
        }
        if (mlb->fp)
            fclose(mlb->fp);

        free(mlb);
    }
}

// Assembly:
testq %rdi, %rdi
je 0xb736
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpq $0x0, 0x8(%rdi)
je 0xb71c
xorl %r14d, %r14d
xorl %r15d, %r15d
movslq 0x10(%rbx), %rax
movq 0x8(%rbx), %rdi
cmpq %rax, %r15
jge 0xb717
movq (%rdi,%r14), %rdi
callq 0x2050
incq %r15
addq $0x18, %r14
jmp 0xb6f8
callq 0x2050
movq (%rbx), %rdi
testq %rdi, %rdi
je 0xb729
callq 0x20d0
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x2050
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/mlb-rsx.c
// Function: mlb_extract
void mlb_extract(
    MLB *mlb)
{
    int             i;
    FILE           *fp;
    BUFFER         *buf;

    for (i = 0; i < mlb->nentries; i++) {
        char            name[32];

        buf = mlb_entry(mlb, mlb->directory[i].label);
        if (buf != NULL) {
            char *suffix = mlb->is_objlib ? "OBJ" : "MAC";
            sprintf(name, "%s.%s", mlb->directory[i].label, suffix);
            fp = fopen(name, "w");
            int length = buf->length;
            fwrite(buf->buffer, 1, length, fp);
            fclose(fp);
            buffer_free(buf);
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
movq %rsp, %r15
xorl %r12d, %r12d
xorl %r13d, %r13d
movslq 0x10(%rbx), %rax
cmpq %rax, %r13
jge 0xb9c1
movq 0x8(%rbx), %rax
movq (%rax,%r12), %rsi
movq %rbx, %rdi
callq 0xb737
testq %rax, %rax
je 0xb9b5
movq %rax, %rbp
cmpl $0x0, 0x14(%rbx)
leaq 0x4318(%rip), %rcx      # 0xfc74
leaq 0x34cc(%rip), %rax      # 0xee2f
cmoveq %rax, %rcx
movq 0x8(%rbx), %rax
movq (%rax,%r12), %rdx
movq %r15, %rdi
leaq 0x42ff(%rip), %rsi      # 0xfc78
xorl %eax, %eax
callq 0x22b0
movq %r15, %rdi
leaq 0x280a(%rip), %rsi      # 0xe194
callq 0x2270
movq %rax, %r14
movslq 0xc(%rbp), %rdx
movq (%rbp), %rdi
pushq $0x1
popq %rsi
movq %rax, %rcx
callq 0x22d0
movq %r14, %rdi
callq 0x20d0
movq %rbp, %rdi
callq 0xc802
incq %r13
addq $0x18, %r12
jmp 0xb92c
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/object.c
// Function: gsd_flush
int gsd_flush(
    GSD * gsd)
{
    if (gsd->offset > 2) {
        if (!writerec(gsd->fp, gsd->buf, gsd->offset))
            return 0;
        gsd_init(gsd, gsd->fp);
    }
    return 1;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl 0x84(%rdi), %edx
pushq $0x1
popq %rbx
cmpl $0x3, %edx
jl 0xba1f
movq %rdi, %r14
movq (%rdi), %rdi
leaq 0x8(%r14), %rsi
callq 0xba29
testl %eax, %eax
je 0xba1d
movw $0x1, 0x8(%r14)
movl $0x2, 0x84(%r14)
jmp 0xba1f
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/object.c
// Function: gsd_write
static int gsd_write(
    GSD * gsd,
    char *name,
    int flags,
    int type,
    int value)
{
    char           *cp;
    unsigned        radtbl[2];

    if (gsd->offset > (int)sizeof(gsd->buf) - 8) {
        if (!gsd_flush(gsd))
            return 0;
    }

    rad50x2(name, radtbl);

    cp = gsd->buf + gsd->offset;
    *cp++ = radtbl[0] & 0xff;
    *cp++ = (radtbl[0] >> 8) & 0xff;
    *cp++ = radtbl[1] & 0xff;
    *cp++ = (radtbl[1] >> 8) & 0xff;

    *cp++ = flags;
    *cp++ = type;

    *cp++ = value & 0xff;
    *cp = (value >> 8) & 0xff;

    gsd->offset += 8;

    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %r13d
movl %ecx, %ebp
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %rbx
cmpl $0x73, 0x84(%rdi)
jl 0xbad5
movq %rbx, %rdi
callq 0xb9e4
testl %eax, %eax
je 0xbb2f
movq %rsp, %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0xd008
movslq 0x84(%rbx), %rax
movzwl (%r12), %ecx
movw %cx, 0x8(%rbx,%rax)
movl 0x4(%r12), %ecx
movb %cl, 0xa(%rbx,%rax)
movb %ch, 0xb(%rbx,%rax)
movb %r14b, 0xc(%rbx,%rax)
movb %bpl, 0xd(%rbx,%rax)
movl %r13d, %ecx
movb %cl, 0xe(%rbx,%rax)
movb %ch, 0xf(%rbx,%rax)
addl $0x8, 0x84(%rbx)
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
jmp 0xbb20
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/object.c
// Function: text_flush
int text_flush(
    TEXT_RLD *tr)
{
    if (tr->txt_offset > 4) {
        if (!writerec(tr->fp, tr->text, tr->txt_offset))
            return 0;
    }

    if (tr->rld_offset > 2) {
        if (!writerec(tr->fp, tr->rld, tr->rld_offset))
            return 0;
    }

    return 1;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movl 0x8c(%rdi), %edx
cmpl $0x5, %edx
jl 0xbbf2
movq (%rbx), %rdi
leaq 0x8(%rbx), %rsi
callq 0xba29
testl %eax, %eax
je 0xbc18
movl 0x110(%rbx), %edx
cmpl $0x3, %edx
jl 0xbc13
movq (%rbx), %rdi
addq $0x90, %rbx
movq %rbx, %rsi
callq 0xba29
testl %eax, %eax
je 0xbc18
pushq $0x1
popq %rax
jmp 0xbc1a
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/object.c
// Function: text_fit
static int text_fit(
    TEXT_RLD *tr,
    unsigned addr,
    int txtsize,
    int rldsize)
{
    if (tr->txt_offset + txtsize <= (int)sizeof(tr->text) &&
        tr->rld_offset + rldsize <= (int)sizeof(tr->rld) &&
        (txtsize == 0 || tr->txt_addr + tr->txt_offset - 4 == addr))
        return 1;                      /* All's well. */

    if (!text_flush(tr))
        return 0;
    text_init(tr, tr->fp, addr);

    return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %r14
movl 0x8c(%rdi), %eax
leal (%rax,%rdx), %esi
pushq $0x1
popq %rbx
cmpl $0x80, %esi
jg 0xbc9d
addl 0x110(%r14), %ecx
cmpl $0x80, %ecx
jg 0xbc9d
testl %edx, %edx
je 0xbcba
movl 0x88(%r14), %ecx
addl %ecx, %eax
addl $-0x4, %eax
cmpl %ebp, %eax
je 0xbcba
movq %r14, %rdi
callq 0xbbd3
testl %eax, %eax
je 0xbcb8
movq (%r14), %rsi
movq %r14, %rdi
movl %ebp, %edx
callq 0xbba0
jmp 0xbcba
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/object.c
// Function: text_internal_word
int text_internal_word(
    TEXT_RLD *tr,
    unsigned *addr,
    int size,
    unsigned word)
{
    if (!text_fit(tr, *addr, size, 4))
        return 0;

    text_word_i(tr, word, size);
    rld_code(tr, RLD_INT, *addr, size);
    rld_word(tr, word);

    *addr += size;

    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebp
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
movl (%rsi), %esi
pushq $0x4
popq %rcx
callq 0xbc5d
testl %eax, %eax
je 0xbd40
movq %r15, %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0xbcc1
movl (%r14), %edx
pushq $0x1
popq %r12
movq %r15, %rdi
movl %r12d, %esi
movl %ebx, %ecx
callq 0xbd4f
movq %r15, %rdi
movl %ebp, %esi
callq 0xbd6f
addl %ebx, (%r14)
jmp 0xbd43
xorl %r12d, %r12d
movl %r12d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/object.c
// Function: text_global_word
int text_global_word(
    TEXT_RLD *tr,
    unsigned *addr,
    int size,
    unsigned word,
    char *global)
{
    unsigned        radtbl[2];

    if (!text_fit(tr, *addr, size, 6))
        return 0;

    text_word_i(tr, word, size);
    rld_code(tr, RLD_GLOBAL, *addr, size);

    rad50x2(global, radtbl);
    rld_word(tr, radtbl[0]);
    rld_word(tr, radtbl[1]);

    *addr += size;

    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r12
movl %ecx, %ebp
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
movl (%rsi), %esi
pushq $0x6
popq %rcx
callq 0xbc5d
testl %eax, %eax
je 0xbe10
movq %r15, %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0xbcc1
movl (%r14), %edx
pushq $0x2
popq %rsi
movq %r15, %rdi
movl %ebx, %ecx
callq 0xbd4f
movq %rsp, %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0xd008
movl (%r13), %esi
movq %r15, %rdi
callq 0xbd6f
movl 0x4(%r13), %esi
movq %r15, %rdi
callq 0xbd6f
addl %ebx, (%r14)
pushq $0x1
popq %rax
jmp 0xbe12
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/object.c
// Function: text_displaced_word
int text_displaced_word(
    TEXT_RLD *tr,
    unsigned *addr,
    int size,
    unsigned word)
{
    if (!text_fit(tr, *addr, size, 4))
        return 0;

    text_word_i(tr, word, size);
    rld_code(tr, RLD_INT_DISP, *addr, size);
    rld_word(tr, word);

    *addr += size;

    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %ebp
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
movl (%rsi), %esi
pushq $0x4
popq %rcx
callq 0xbc5d
testl %eax, %eax
je 0xbe6e
movq %r15, %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0xbcc1
movl (%r14), %edx
pushq $0x3
popq %rsi
movq %r15, %rdi
movl %ebx, %ecx
callq 0xbd4f
movq %r15, %rdi
movl %ebp, %esi
callq 0xbd6f
addl %ebx, (%r14)
pushq $0x1
popq %rax
jmp 0xbe70
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/object.c
// Function: text_global_displaced_word
int text_global_displaced_word(
    TEXT_RLD *tr,
    unsigned *addr,
    int size,
    unsigned word,
    char *global)
{
    unsigned        radtbl[2];

    if (!text_fit(tr, *addr, size, 6))
        return 0;

    text_word_i(tr, word, size);
    rld_code(tr, RLD_GLOBAL_DISP, *addr, size);

    rad50x2(global, radtbl);
    rld_word(tr, radtbl[0]);
    rld_word(tr, radtbl[1]);

    *addr += size;

    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r12
movl %ecx, %ebp
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
movl (%rsi), %esi
pushq $0x6
popq %rcx
callq 0xbc5d
testl %eax, %eax
je 0xbeeb
movq %r15, %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0xbcc1
movl (%r14), %edx
pushq $0x4
popq %rsi
movq %r15, %rdi
movl %ebx, %ecx
callq 0xbd4f
movq %rsp, %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0xd008
movl (%r13), %esi
movq %r15, %rdi
callq 0xbd6f
movl 0x4(%r13), %esi
movq %r15, %rdi
callq 0xbd6f
addl %ebx, (%r14)
pushq $0x1
popq %rax
jmp 0xbeed
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/simh[P]simtools/crossassemblers/macro11/object.c
// Function: text_global_offset_word
int text_global_offset_word(
    TEXT_RLD *tr,
    unsigned *addr,
    int size,
    unsigned word,
    char *global)
{
    unsigned        radtbl[2];

    if (word == 0)
        return text_global_word(tr, addr, size, word, global);

    if (!text_fit(tr, *addr, size, 8))
        return 0;

    text_word_i(tr, word, size);

    rld_code(tr, RLD_GLOBAL_OFFSET, *addr, size);

    rad50x2(global, radtbl);
    rld_word(tr, radtbl[0]);
    rld_word(tr, radtbl[1]);
    rld_word(tr, word);

    *addr += size;

    return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %r8, %r12
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
testl %ecx, %ecx
je 0xbf80
movl %ecx, %ebp
movl (%r14), %esi
pushq $0x8
popq %rcx
movq %r15, %rdi
movl %ebx, %edx
callq 0xbc5d
testl %eax, %eax
je 0xbfa0
movq %r15, %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0xbcc1
movl (%r14), %edx
pushq $0x5
popq %rsi
movq %r15, %rdi
movl %ebx, %ecx
callq 0xbd4f
movq %rsp, %r13
movq %r12, %rdi
movq %r13, %rsi
callq 0xd008
movl (%r13), %esi
movq %r15, %rdi
callq 0xbd6f
movl 0x4(%r13), %esi
movq %r15, %rdi
callq 0xbd6f
movq %r15, %rdi
movl %ebp, %esi
callq 0xbd6f
addl %ebx, (%r14)
pushq $0x1
popq %rax
jmp 0xbfa2
movq %r15, %rdi
movq %r14, %rsi
movl %ebx, %edx
xorl %ecx, %ecx
movq %r12, %r8
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xbda0
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq