// File: /workspace/github_c_makefile_star2_O2/nimble-code[P]Modex/Src/xtract.c
// Function: do_ccode
char *
do_ccode(int lno)
{	char *tag, *p, *lst = "";
	int i = 0, nn, mm;

	if (strncmp(OutBuf, "C: ", strlen("C: ")) == 0)
	{	i = strlen("C: ");
		tag = "c_expr { ";

		if (strstr(OutBuf, ND_CHOICE)
		||  strcmp(&OutBuf[i], "1") == 0)
		{	p = "true";
			goto sc;
		}
	} else if (strncmp(OutBuf, "case ", strlen("case ")) == 0)
	{	i = strlen("case ");
		tag = "c_expr { ";

		if (strstr(OutBuf, ND_CHOICE))
		{	p = "true";
			goto sc;
		}
	} else if (strncmp(OutBuf, "R: ", 3) == 0)
	{	p = "goto Return";

		if (strlen(OutBuf) > strlen("R: return"))
		{	if (extended)
			{	char *z, more[4096];

				for (z = &OutBuf[strlen("R: return")]; *z; z++)
				{	if (*z == ' ' || *z == '\t')
						continue;
					else
						break;
				}
				/*
				   if there are multiple instantiations of this proctype/function,
				   then we want to make sure that the return value that is
				   written into a global temporary var cannot change until it is
				   picked up by the caller -- so we use a lck_fctname_ret that the
				   caller resets to zero when the value has been retrieved.
				   assumes there is only one possible return value of type long
				   should instead:
					find the var reference - determine its type and
					declare the global res_%s accordingly
				 */
				sprintf(more, "\tatomic { !lck_p_%s_ret -> lck_p_%s_ret = 1 };\n\t",
					fct_name, fct_name);
				vis_direct(more);
				if (strlen(z) > 0)
				{
#if 0
					sprintf(more, "c_code { now.res_p_%s = (long) %s; }; ",
						fct_name, z);
#else
					sprintf(more, "c_code { now.res_p_%s = (%s) %s; }; ",
						fct_name, fct_type, z);
#endif
					vis_direct(more);
				}
			} else if (!show_deps && Warnings)
			{	fprintf(stderr, "%s: line %3d, warning, args on"
					" return not preserved: ", progname, lno);
				fprintf(stderr, " %s\n", rm_decor(OutBuf));
			}
			extra_comment = 1;
		}
		goto sc;
	} else  if (OutBuf[1] == ':' && OutBuf[2] == ' '
		&& (OutBuf[0] == 'A' || OutBuf[0] == 'F'))
	{	i = strlen("A: ");

		if (strncmp(&OutBuf[i], "assert(", strlen("assert(")) == 0
		&&   strcmp(&OutBuf[strlen(OutBuf)-1], ")") == 0)
		{	int nx = strlen(OutBuf)-1;
			OutBuf[nx] = '\0';
			mm =  strlen("F: assert(");
			nn =  strlen("c_code [] { ; };") + strlen(&OutBuf[mm]) + 1;
			p = (char *) e_malloc(nn * sizeof(char));
			sprintf(p, "c_code [%s] { ; }", &OutBuf[mm]);

			OutBuf[nx] = ')';
			goto sc;
		}

		if (strncmp(&OutBuf[i], "printf(", strlen("printf(")) == 0)
		{	nn =  strlen(&OutBuf[i]) + 1 + strlen("c_code { P") + strlen(" } ");
			p = (char *) e_malloc(nn * sizeof(char));
			sprintf(p, "c_code { P%s;", &OutBuf[i+1]);	/* map to Printf */
			strcat(p, " }");
			/* fprintf(stderr, "p length %d nn %d, p=%s\n", strlen(p), nn, p); */
			goto sc;
		}
		goto same;
	} else if (strncmp(OutBuf, "D: ", 3) == 0)
	{	p = "comment"; /* no locals in c_code fragments */
		goto sc;
	} else
	{	i = 0;
same:		if (strlen(PreBuf) > 0)
		{	tag = (char *) e_malloc(strlen("c_code [] { ")+strlen(PreBuf)+1);
			sprintf(tag, "c_code [%s] { ", PreBuf);
		} else
			tag = "c_code { ";
		lst = ";";
	}
	p = form_c_tag(tag, i, lst);
sc:
	return p;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1000, %rsp           # imm = 0x1000
movl %edi, %ebp
leaq 0x27aa1(%rip), %rdi     # 0x37380
leaq 0x125ee(%rip), %rsi     # 0x21ed4
pushq $0x3
popq %rdx
callq 0x4250
leaq 0x27a8b(%rip), %rdi     # 0x37380
testl %eax, %eax
je 0xf9bf
leaq 0x125bc(%rip), %rsi     # 0x21ec0
pushq $0x5
popq %rdx
callq 0x4250
testl %eax, %eax
je 0xf9f7
leaq 0x27a65(%rip), %r14     # 0x37380
leaq 0x130c3(%rip), %rsi     # 0x229e5
pushq $0x3
popq %rdx
movq %r14, %rdi
callq 0x4250
testl %eax, %eax
je 0xfa82
cmpb $0x3a, 0x27a45(%rip)    # 0x37381
jne 0xfa1f
cmpb $0x20, 0x27a39(%rip)    # 0x37382
jne 0xfa1f
movzbl 0x27a2a(%rip), %eax     # 0x37380
cmpl $0x46, %eax
je 0xf964
cmpl $0x41, %eax
jne 0xfa1f
leaq 0x27a18(%rip), %rdi     # 0x37383
leaq 0x13cc4(%rip), %rsi     # 0x23636
pushq $0x7
popq %rdx
callq 0x4250
testl %eax, %eax
jne 0xf999
movq %r14, %rdi
callq 0x4110
cmpb $0x29, -0x1(%rax,%r14)
jne 0xf999
cmpb $0x0, (%rax,%r14)
je 0xfbe0
leaq 0x279e3(%rip), %rdi     # 0x37383
leaq 0x13195(%rip), %rsi     # 0x22b3c
pushq $0x7
popq %rdx
callq 0x4250
testl %eax, %eax
je 0xfb6a
pushq $0x3
popq %rbx
jmp 0xfa3f
leaq 0x13f74(%rip), %rsi     # 0x2393a
callq 0x42d0
leaq 0x12506(%rip), %rbx     # 0x21ed8
testq %rax, %rax
jne 0xfbcd
cmpw $0x31, 0x279a0(%rip)    # 0x37383
je 0xfbcd
leaq 0x13098(%rip), %r15     # 0x22a88
pushq $0x3
jmp 0xfad2
leaq 0x27982(%rip), %rdi     # 0x37380
leaq 0x13f35(%rip), %rsi     # 0x2393a
callq 0x42d0
testq %rax, %rax
je 0xfac9
leaq 0x124be(%rip), %rbx     # 0x21ed8
jmp 0xfbcd
leaq 0x2795a(%rip), %rdi     # 0x37380
leaq 0x1454c(%rip), %rsi     # 0x23f79
pushq $0x3
popq %rdx
callq 0x4250
xorl %ebx, %ebx
testl %eax, %eax
je 0xfadc
leaq 0x2d09a(%rip), %rdi     # 0x3cae0
callq 0x4110
leaq 0x14524(%rip), %r14     # 0x23f76
testq %rax, %rax
je 0xfae8
addl $0xd, %eax
movl %eax, %edi
callq 0x4739
movq %rax, %r15
leaq 0x130e3(%rip), %rsi     # 0x22b52
leaq 0x2d06a(%rip), %rdx     # 0x3cae0
movq %rax, %rdi
xorl %eax, %eax
callq 0x42a0
jmp 0xfaef
leaq 0x278f7(%rip), %rdi     # 0x37380
callq 0x4110
leaq 0x12ffd(%rip), %rbx     # 0x22a92
cmpq $0xa, %rax
jb 0xfbcd
leaq 0x271ee(%rip), %rax     # 0x36c94
cmpl $0x0, (%rax)
je 0xfbae
leaq 0x278d3(%rip), %r14     # 0x37389
movzbl (%r14), %eax
cmpl $0x20, %eax
je 0xfac4
cmpl $0x9, %eax
jne 0xfb0b
incq %r14
jmp 0xfab6
leaq 0x12fb8(%rip), %r15     # 0x22a88
pushq $0x5
popq %rbx
leaq 0x144b7(%rip), %r14     # 0x23f91
jmp 0xfaef
leaq 0x17a0b(%rip), %rbx     # 0x274ee
jmp 0xfbcd
leaq 0x13072(%rip), %r15     # 0x22b61
movq %r15, %rdi
movl %ebx, %esi
movq %r14, %rdx
addq $0x1000, %rsp           # imm = 0x1000
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0xf760
leaq 0x12f8c(%rip), %rsi     # 0x22a9e
leaq 0x24877(%rip), %rcx     # 0x34390
movq %rsp, %r15
movq %r15, %rdi
movq %rcx, %rdx
xorl %eax, %eax
callq 0x42a0
movq %r15, %rdi
callq 0xd07c
cmpb $0x0, (%r14)
je 0xfbc6
leaq 0x12f8d(%rip), %rsi     # 0x22acf
leaq 0x24847(%rip), %rdx     # 0x34390
leaq 0x24c40(%rip), %rcx     # 0x34790
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %r8
xorl %eax, %eax
callq 0x42a0
movq %r15, %rdi
callq 0xd07c
jmp 0xfbc6
leaq 0x27812(%rip), %rdi     # 0x37383
callq 0x4110
leal 0xe(%rax), %edi
callq 0x4739
movq %rax, %rbx
leaq 0x12fbc(%rip), %rsi     # 0x22b44
leaq 0x277f5(%rip), %rdx     # 0x37384
movq %rax, %rdi
xorl %eax, %eax
callq 0x42a0
movq %rbx, %rdi
callq 0x4110
movw $0x7d20, (%rbx,%rax)    # imm = 0x7D20
movb $0x0, 0x2(%rbx,%rax)
jmp 0xfbcd
leaq 0x26ebb(%rip), %rax     # 0x36a70
cmpl $0x0, (%rax)
jne 0xfbc6
leaq 0x26ebf(%rip), %rax     # 0x36a80
cmpl $0x0, (%rax)
jne 0xfc20
movb $0x1, 0x2cf03(%rip)     # 0x3cad0
movq %rbx, %rax
addq $0x1000, %rsp           # imm = 0x1000
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
decq %rax
movslq %eax, %r12
movb $0x0, (%r12,%r14)
leaq 0x27798(%rip), %r15     # 0x3738a
movq %r15, %rdi
callq 0x4110
leal 0x11(%rax), %edi
callq 0x4739
movq %rax, %rbx
leaq 0x12f1e(%rip), %rsi     # 0x22b2a
movq %rax, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x42a0
movb $0x29, (%r12,%r14)
jmp 0xfbcd
movq 0x243d1(%rip), %r14     # 0x33ff8
movq (%r14), %rdi
leaq 0x2456f(%rip), %rax     # 0x341a0
movq (%rax), %rdx
leaq 0x12eb9(%rip), %rsi     # 0x22af4
movl %ebp, %ecx
xorl %eax, %eax
callq 0x41c0
movq (%r14), %r14
leaq 0x27732(%rip), %rdi     # 0x37380
callq 0xa50a
leaq 0x1052a(%rip), %rsi     # 0x20184
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x41c0
jmp 0xfbc6