// File: /workspace/github_c_makefile_star2_O0/simh[P]simtools/crossassemblers/macro1/macro1.c
// Function: invokeMacro
int
invokeMacro(int index)
{
    struct macinv *mip;
    struct macdef *mdp;
    int jx;

    mdp = mac_defs[index];
    if (mdp == NULL || mdp->body[0] == '\0')
	return 0;

    /* Find arguments. */
    while (ISBLANK(line[lexstart]))
	next(0);

    mip = calloc(1, sizeof(struct macinv));
    if (!mip) {
	fprintf(stderr, "could not allocate memory for macro invocation\n");
	exit(1);
    }
    mip->defn = mdp;

    /* evaluate args, saving values in SYM_T entries in defn.
     * (cannot have recursive macros)
     */
    mdp->args[0].val = clc;		/* r is location at start */
    for( jx = 1; !ISDONE(line[lexstart]) && jx <= MAC_MAX_ARGS; ) {
	WORD32 val;

	next(0);
	if (ISDONE(line[lexstart]))
	    break;

	if (line[lexstart] == ',')
	    next(0);

	while( ISBLANK( line[lexstart] ))
	    next(0);

	if (ISDONE(line[lexstart]))
	    break;

	val = getExprs();

	/* ignore excess values silently? */
	if (jx <= mdp->nargs)
	    mdp->args[jx].val = val;
	jx++;
    } /* end for */

    /* XXX complain if too few actuals? -- nah */
    while (jx <= mdp->nargs)
	mdp->args[jx++].val = 0;

    strcpy(mip->mac_line, line);	/* save line */
    mip->mac_cc = cc;			/* save position in line */
    mip->mac_ptr = mdp->body;
    mip->prev = curmacro;		/* push the old entry */
    curmacro = mip;			/* step up to the plate! */
    return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x8(%rbp)
movslq -0x8(%rbp), %rcx
leaq 0x859a(%rip), %rax      # 0xc050
movq (%rax,%rcx,8), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x3ad5
movq -0x18(%rbp), %rax
movsbl 0x1fc(%rax), %eax
cmpl $0x0, %eax
jne 0x3ae1
movl $0x0, -0x4(%rbp)
jmp 0x3dfb
jmp 0x3ae3
movslq 0xa5c6(%rip), %rcx      # 0xe0b0
leaq 0xa55f(%rip), %rax      # 0xe050
movsbl (%rax,%rcx), %ecx
movb $0x1, %al
cmpl $0x20, %ecx
movb %al, -0x21(%rbp)
je 0x3b1a
movslq 0xa5aa(%rip), %rcx      # 0xe0b0
leaq 0xa543(%rip), %rax      # 0xe050
movsbl (%rax,%rcx), %eax
cmpl $0xc, %eax
sete %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
testb $0x1, %al
jne 0x3b23
jmp 0x3b2c
xorl %edi, %edi
callq 0x3e10
jmp 0x3ae3
movl $0x1, %edi
movl $0x80, %esi
callq 0x20e0
movq %rax, -0x10(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0x3b68
movq 0x74ab(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x4c72(%rip), %rsi      # 0x87c9
movb $0x0, %al
callq 0x2110
movl $0x1, %edi
callq 0x2190
movq -0x18(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x70(%rax)
movl 0xa53a(%rip), %ecx      # 0xe0b4
movq -0x18(%rbp), %rax
movl %ecx, 0x10(%rax)
movl $0x1, -0x1c(%rbp)
movslq 0xa521(%rip), %rcx      # 0xe0b0
leaq 0xa4ba(%rip), %rax      # 0xe050
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x2f, %ecx
movb %al, -0x22(%rbp)
je 0x3c02
movslq 0xa505(%rip), %rcx      # 0xe0b0
leaq 0xa49e(%rip), %rax      # 0xe050
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x0, %ecx
movb %al, -0x22(%rbp)
je 0x3c02
movslq 0xa4e9(%rip), %rcx      # 0xe0b0
leaq 0xa482(%rip), %rax      # 0xe050
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0xa, %ecx
movb %al, -0x22(%rbp)
je 0x3c02
movslq 0xa4cd(%rip), %rcx      # 0xe0b0
leaq 0xa466(%rip), %rax      # 0xe050
movsbl (%rax,%rcx), %ecx
xorl %eax, %eax
cmpl $0x9, %ecx
movb %al, -0x22(%rbp)
je 0x3c02
cmpl $0x14, -0x1c(%rbp)
setle %al
movb %al, -0x22(%rbp)
movb -0x22(%rbp), %al
testb $0x1, %al
jne 0x3c0e
jmp 0x3d77
xorl %edi, %edi
callq 0x3e10
movslq 0xa494(%rip), %rcx      # 0xe0b0
leaq 0xa42d(%rip), %rax      # 0xe050
movsbl (%rax,%rcx), %eax
cmpl $0x2f, %eax
je 0x3c71
movslq 0xa47d(%rip), %rcx      # 0xe0b0
leaq 0xa416(%rip), %rax      # 0xe050
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x3c71
movslq 0xa466(%rip), %rcx      # 0xe0b0
leaq 0xa3ff(%rip), %rax      # 0xe050
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
je 0x3c71
movslq 0xa44f(%rip), %rcx      # 0xe0b0
leaq 0xa3e8(%rip), %rax      # 0xe050
movsbl (%rax,%rcx), %eax
cmpl $0x9, %eax
jne 0x3c76
jmp 0x3d77
movslq 0xa433(%rip), %rcx      # 0xe0b0
leaq 0xa3cc(%rip), %rax      # 0xe050
movsbl (%rax,%rcx), %eax
cmpl $0x2c, %eax
jne 0x3c94
xorl %edi, %edi
callq 0x3e10
jmp 0x3c96
movslq 0xa413(%rip), %rcx      # 0xe0b0
leaq 0xa3ac(%rip), %rax      # 0xe050
movsbl (%rax,%rcx), %ecx
movb $0x1, %al
cmpl $0x20, %ecx
movb %al, -0x23(%rbp)
je 0x3ccd
movslq 0xa3f7(%rip), %rcx      # 0xe0b0
leaq 0xa390(%rip), %rax      # 0xe050
movsbl (%rax,%rcx), %eax
cmpl $0xc, %eax
sete %al
movb %al, -0x23(%rbp)
movb -0x23(%rbp), %al
testb $0x1, %al
jne 0x3cd6
jmp 0x3cdf
xorl %edi, %edi
callq 0x3e10
jmp 0x3c96
movslq 0xa3ca(%rip), %rcx      # 0xe0b0
leaq 0xa363(%rip), %rax      # 0xe050
movsbl (%rax,%rcx), %eax
cmpl $0x2f, %eax
je 0x3d3b
movslq 0xa3b3(%rip), %rcx      # 0xe0b0
leaq 0xa34c(%rip), %rax      # 0xe050
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x3d3b
movslq 0xa39c(%rip), %rcx      # 0xe0b0
leaq 0xa335(%rip), %rax      # 0xe050
movsbl (%rax,%rcx), %eax
cmpl $0xa, %eax
je 0x3d3b
movslq 0xa385(%rip), %rcx      # 0xe0b0
leaq 0xa31e(%rip), %rax      # 0xe050
movsbl (%rax,%rcx), %eax
cmpl $0x9, %eax
jne 0x3d3d
jmp 0x3d77
callq 0x3ff0
movl %eax, -0x20(%rbp)
movl -0x1c(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jg 0x3d69
movl -0x20(%rbp), %ecx
movq -0x18(%rbp), %rax
addq $0x4, %rax
movslq -0x1c(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movl %ecx, 0xc(%rax)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x3b88
jmp 0x3d79
movl -0x1c(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
jg 0x3daa
movq -0x18(%rbp), %rax
addq $0x4, %rax
movl -0x1c(%rbp), %ecx
movl %ecx, %edx
addl $0x1, %edx
movl %edx, -0x1c(%rbp)
movslq %ecx, %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl $0x0, 0xc(%rax)
jmp 0x3d79
movq -0x10(%rbp), %rdi
leaq 0xa29b(%rip), %rsi      # 0xe050
callq 0x2070
movl 0xa2f8(%rip), %ecx      # 0xe0b8
movq -0x10(%rbp), %rax
movl %ecx, 0x60(%rax)
movq -0x18(%rbp), %rcx
addq $0x1fc, %rcx            # imm = 0x1FC
movq -0x10(%rbp), %rax
movq %rcx, 0x68(%rax)
movq 0xa2df(%rip), %rcx      # 0xe0c0
movq -0x10(%rbp), %rax
movq %rcx, 0x78(%rax)
movq -0x10(%rbp), %rax
movq %rax, 0xa2cc(%rip)      # 0xe0c0
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)