// File: /workspace/github_c_makefile_star2_O2/nimble-code[P]Modex/Src/xtract.c
// Function: modex_if
static void
modex_if(if_node *ifn, int tabs)
{	char oO[1024];
	int xtmp;
	char *efn = NULL;

	if (visu != 0 && ((efn = has_instrumented(ifn->cond, "")) != NULL))
	{	char MBuf[BigEnough];

		// move instrumented function call out of conditional test

		strcpy(MBuf, OutBuf);	// remember

		sprintf(OutBuf, "F: %s(", efn);
		modex_recur(keep_pars);
		strcat(OutBuf, ")");

		if (strcmp(efn, "pthread_create") == 0)
		{	handle_pthread_create(1);
		} else if (strcmp(efn, "pthread_mutex_init") == 0)
		{	char *z;
			z = strchr(OutBuf, '(');
			if (z)
			{	fprintf(fp, "\t\tc_code { spin_mutex_init%s; }\n", z);
			}
		} else if (strcmp(efn, "pthread_mutex_lock") == 0)
		{	char *z;
			z = strchr(OutBuf, '(');
			if (z)
			{	fprintf(fp, "\t\tc_code { spin_mutex_lock%s; }\n", z);
			}
		} else if (strcmp(efn, "pthread_mutex_unlock") == 0)
		{	char *z;
			z = strchr(OutBuf, '(');
			if (z)
			{	fprintf(fp, "\t\tc_code { spin_mutex_unlock%s; }\n", z);
			}
		}

		strcpy(OutBuf, MBuf);	// restore

		keep_root = 0;
		keep_pars = 0;
	}

	if (ifn->hdr.tok == QUESTMARK)		/* cond expr */
	{	vis_print("(");
		modex_recur(ifn->cond);
		if (use_c_code)			/* should be stmnt specific */
			vis_print(" ? ");	/* c-syntax */
		else
			vis_print(" -> ");	/* promela-syntax */
		modex_any(ifn->then_n, 0);
		vis_print(" : ");
		modex_any(ifn->else_n, 0);
		vis_print(")");
	} else
	{	xtmp = handle_cond(ifn->cond, ifn->then_n, ZN, oO, tabs, "if\n");
		switch (xtmp) {
		case 2:
			vis_indent(tabs, "\n\tfi;\n");
			break;
		case 1:
			handle_neg(ifn->cond, oO, "\n", ifn->else_n, tabs, "\n\tfi;\n");
			break;
		case 0:
			handle_shortcut(ifn->cond, oO, ifn->else_n, tabs);
			break;
	}	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1008, %rsp           # imm = 0x1008
movl %esi, %ebx
movq %rdi, %r14
leaq 0x2341d(%rip), %rax     # 0x369d8
cmpl $0x0, (%rax)
je 0x136f8
movq 0x30(%r14), %rdi
callq 0x13944
testq %rax, %rax
je 0x136f8
movq %rax, %r15
leaq 0x23da0(%rip), %r12     # 0x37380
movq %rsp, %rdi
movq %r12, %rsi
callq 0x40b0
leaq 0x108a6(%rip), %rsi     # 0x23e98
movq %r12, %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x42a0
movq 0x327fa(%rip), %rdi     # 0x45e00
callq 0x8cbf
movq %r12, %rdi
callq 0x4110
movw $0x29, (%rax,%r12)
leaq 0x1041e(%rip), %rsi     # 0x23a3f
movq %r15, %rdi
callq 0x41b0
testl %eax, %eax
je 0x1368a
leaq 0x1041a(%rip), %rsi     # 0x23a4e
movq %r15, %rdi
callq 0x41b0
testl %eax, %eax
je 0x13691
leaq 0x1041a(%rip), %rsi     # 0x23a61
movq %r15, %rdi
callq 0x41b0
testl %eax, %eax
je 0x136b5
leaq 0x1041a(%rip), %rsi     # 0x23a74
movq %r15, %rdi
callq 0x41b0
testl %eax, %eax
jne 0x136e1
leaq 0x23d13(%rip), %rdi     # 0x37380
pushq $0x28
popq %rsi
callq 0x4130
testq %rax, %rax
je 0x136e1
movq 0x23cef(%rip), %rdi     # 0x37370
leaq 0x10859(%rip), %rsi     # 0x23ee1
jmp 0x136d7
callq 0x1324b
jmp 0x136e1
leaq 0x23ce8(%rip), %rdi     # 0x37380
pushq $0x28
popq %rsi
callq 0x4130
testq %rax, %rax
je 0x136e1
movq 0x23cc4(%rip), %rdi     # 0x37370
leaq 0x107ec(%rip), %rsi     # 0x23e9f
jmp 0x136d7
leaq 0x23cc4(%rip), %rdi     # 0x37380
pushq $0x28
popq %rsi
callq 0x4130
testq %rax, %rax
je 0x136e1
movq 0x23ca0(%rip), %rdi     # 0x37370
leaq 0x107e9(%rip), %rsi     # 0x23ec0
movq %rax, %rdx
xorl %eax, %eax
callq 0x41c0
leaq 0x23c98(%rip), %rdi     # 0x37380
movq %rsp, %rsi
callq 0x40b0
andq $0x0, 0x32708(%rip)     # 0x45e00
cmpl $0x159, 0x18(%r14)      # imm = 0x159
jne 0x1376b
leaq 0x180c3(%rip), %rdi     # 0x2b7cc
callq 0x106f2
movq 0x30(%r14), %rdi
callq 0x8cbf
leaq 0x20ad6(%rip), %rax     # 0x341f4
cmpl $0x0, (%rax)
leaq 0x106e9(%rip), %rax     # 0x23e11
leaq 0x107d5(%rip), %rdi     # 0x23f04
cmoveq %rax, %rdi
callq 0x106f2
movq 0x38(%r14), %rdi
xorl %esi, %esi
callq 0x10939
leaq 0x107be(%rip), %rdi     # 0x23f08
callq 0x106f2
movq 0x40(%r14), %rdi
xorl %esi, %esi
callq 0x10939
leaq 0xef9b(%rip), %rdi      # 0x226fc
callq 0x106f2
jmp 0x137f2
movq 0x30(%r14), %rdi
movq 0x38(%r14), %rsi
leaq 0xffbc(%rip), %r9       # 0x23736
movq %rsp, %rcx
xorl %edx, %edx
movl %ebx, %r8d
callq 0x13a49
movq 0x30(%r14), %rdi
movq 0x40(%r14), %r14
testb $0x1, %al
je 0x137b1
leaq 0xeed0(%rip), %rdx      # 0x2266a
leaq 0x1076b(%rip), %r9      # 0x23f0c
movq %rsp, %rsi
movq %r14, %rcx
movl %ebx, %r8d
callq 0x13c71
jmp 0x137f2
movb $0x0, 0x23bc8(%rip)     # 0x37380
cmpb $0x0, (%rsp)
je 0x137f2
movq %rsp, %rsi
callq 0x13d10
cmpl $0x0, 0x2c32b(%rip)     # 0x3faf8
je 0x137e2
movb $0x0, 0x23baa(%rip)     # 0x37380
movq %r14, %rdi
movl %ebx, %esi
callq 0x10939
jmp 0x137f2
cmpl $0x0, 0x2c30b(%rip)     # 0x3faf4
je 0x13801
movb $0x0, 0x23b8e(%rip)     # 0x37380
addq $0x1008, %rsp           # imm = 0x1008
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0x10789(%rip), %rsi     # 0x23f91
movl %ebx, %edi
callq 0x1079f
movq %r14, %rdi
callq 0x10168
leaq 0xee4c(%rip), %rdi      # 0x2266a
callq 0xd07c
jmp 0x137d6