// File: /workspace/github_c_makefile_star2_O1/fuldaros[P]akb_sources/cc/akb_cc.c
// Function: eval_shell
int eval_shell(char * text)
{
	int i;
	char * ptr;

	ptr = strchr(text, (int)'\n');
	if (!ptr)
		i = strlen(text);
	else
		i = ptr - text;
	ptr  = malloc(i + 1);
	shll = malloc(i + 1);
	opts = malloc(i + 1);
	if (!ptr || !shll || !opts)
		return -1;
	strncpy(ptr, text, i);
	ptr[i] = '\0';

	*opts = '\0';
	i = sscanf(ptr, " #!%s%s %c", shll, opts, opts);
	if (i < 1 || i > 2) {
		fprintf(stderr, "%s: invalid first line in script: %s\n", my_name, ptr);
		return -1;
	}
	free(ptr);

	shll = realloc(shll, strlen(shll) + 1);
	ptr  = strrchr(shll, (int)'/');
	if (*ptr == '/')
		ptr++;
	if (verbose) fprintf(stderr, "%s shll=%s\n", my_name, ptr);

	for(i=0; shellsDB[i].shll; i++) {
		if(!strcmp(ptr, shellsDB[i].shll)) {
			if (!inlo)
				inlo = strdup(shellsDB[i].inlo);
			if (!xecc)
				xecc = strdup(shellsDB[i].xecc);
			if (!lsto)
				lsto = strdup(shellsDB[i].lsto);
		}
	}
	if (!inlo || !xecc || !lsto) {
		fprintf(stderr, "%s Unknown shell (%s): specify [-i][-x][-l]\n", my_name, ptr);
		return -1;
	}
	if (verbose) fprintf(stderr, "%s [-i]=%s\n", my_name, inlo);
	if (verbose) fprintf(stderr, "%s [-x]=%s\n", my_name, xecc);
	if (verbose) fprintf(stderr, "%s [-l]=%s\n", my_name, lsto);

	opts = realloc(opts, strlen(opts) + 1);
	if (*opts && !strcmp(opts, lsto)) {
		fprintf(stderr, "%s opts=%s : Is equal to [-l]. Removing opts\n", my_name, opts);
		*opts = '\0';
	} else if (!strcmp(opts, "-")) {
		fprintf(stderr, "%s opts=%s : No real one. Removing opts\n", my_name, opts);
		*opts = '\0';
	}
	if (verbose) fprintf(stderr, "%s opts=%s\n", my_name, opts);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
movl $0xa, %esi
callq 0x40d0
testq %rax, %rax
je 0x4a47
movq %rax, %r12
subq %r15, %r12
jmp 0x4a52
movq %r15, %rdi
callq 0x40b0
movq %rax, %r12
shlq $0x20, %r12
movabsq $0x100000000, %rbx      # imm = 0x100000000
addq %r12, %rbx
sarq $0x20, %rbx
movq %rbx, %rdi
callq 0x4180
movq %rax, %r14
movq %rbx, %rdi
callq 0x4180
movq %rax, %r13
movq %rax, 0x699c(%rip)      # 0xb420
movq %rbx, %rdi
callq 0x4180
movq %rax, %rbp
movq %rax, 0x6992(%rip)      # 0xb428
testq %r14, %r14
sete %al
testq %r13, %r13
sete %cl
orb %al, %cl
testq %rbp, %rbp
sete %al
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
orb %cl, %al
jne 0x4c8c
sarq $0x20, %r12
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x4050
xorl %eax, %eax
movb %al, (%r14,%r12)
movb %al, (%rbp)
leaq 0x17fa(%rip), %rsi      # 0x62d3
movq %r14, %rdi
movq %r13, %rdx
movq %rbp, %rcx
movq %rbp, %r8
xorl %eax, %eax
callq 0x41a0
addl $-0x3, %eax
cmpl $-0x3, %eax
jbe 0x4c9d
movq %r14, %rdi
callq 0x4040
movq 0x6919(%rip), %r14      # 0xb420
movq %r14, %rdi
callq 0x40b0
leaq 0x1(%rax), %rsi
movq %r14, %rdi
callq 0x41c0
movq %rax, 0x68fe(%rip)      # 0xb420
movq %rax, %rdi
movl $0x2f, %esi
callq 0x40e0
xorl %r14d, %r14d
cmpb $0x2f, (%rax)
sete %r14b
addq %rax, %r14
cmpl $0x0, 0x68ed(%rip)      # 0xb430
jne 0x4cb0
movq 0x6600(%rip), %rsi      # 0xb150
testq %rsi, %rsi
je 0x4bd2
movq 0x68ec(%rip), %r15      # 0xb448
movq 0x68dd(%rip), %r12      # 0xb440
leaq 0x6606(%rip), %rbp      # 0xb170
movq 0x68c7(%rip), %r13      # 0xb438
movq %r14, %rdi
callq 0x4140
testl %eax, %eax
jne 0x4bc5
testq %r13, %r13
jne 0x4b95
movq -0x18(%rbp), %rdi
callq 0x4250
movq %rax, %r13
movq %rax, 0x68a3(%rip)      # 0xb438
testq %r12, %r12
jne 0x4bad
movq -0x8(%rbp), %rdi
callq 0x4250
movq %rax, %r12
movq %rax, 0x6893(%rip)      # 0xb440
testq %r15, %r15
jne 0x4bc5
movq -0x10(%rbp), %rdi
callq 0x4250
movq %rax, %r15
movq %rax, 0x6883(%rip)      # 0xb448
movq (%rbp), %rsi
addq $0x20, %rbp
testq %rsi, %rsi
jne 0x4b71
movq 0x685f(%rip), %rcx      # 0xb438
testq %rcx, %rcx
je 0x4cd7
cmpq $0x0, 0x6856(%rip)      # 0xb440
je 0x4cd7
cmpq $0x0, 0x6850(%rip)      # 0xb448
je 0x4cd7
cmpl $0x0, 0x682b(%rip)      # 0xb430
jne 0x4cfb
cmpl $0x0, 0x681e(%rip)      # 0xb430
jne 0x4d1f
cmpl $0x0, 0x6811(%rip)      # 0xb430
jne 0x4d29
movq 0x67fc(%rip), %rbx      # 0xb428
movq %rbx, %rdi
callq 0x40b0
leaq 0x1(%rax), %rsi
movq %rbx, %rdi
callq 0x41c0
movq %rax, %rbx
movq %rax, 0x67de(%rip)      # 0xb428
cmpb $0x0, (%rax)
je 0x4c66
movq 0x67f2(%rip), %rsi      # 0xb448
movq %rbx, %rdi
callq 0x4140
testl %eax, %eax
je 0x4d46
leaq 0x35f8(%rip), %rsi      # 0x8265
movq %rbx, %rdi
callq 0x4140
testl %eax, %eax
je 0x4d3d
xorl %ebx, %ebx
cmpl $0x0, 0x67aa(%rip)      # 0xb430
jne 0x4d33
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x6354(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x1630(%rip), %rsi      # 0x62de
jmp 0x4ce8
movq 0x6341(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x1643(%rip), %rsi      # 0x6304
leaq 0x1420(%rip), %rdx      # 0x60e8
movq %r14, %rcx
xorl %eax, %eax
callq 0x4150
jmp 0x4b49
movq 0x631a(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x1628(%rip), %rsi      # 0x6310
leaq 0x13f9(%rip), %rdx      # 0x60e8
movq %r14, %rcx
xorl %eax, %eax
callq 0x4150
jmp 0x4c8c
movq 0x62f6(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x1631(%rip), %rsi      # 0x633d
leaq 0x13d5(%rip), %rdx      # 0x60e8
xorl %eax, %eax
callq 0x4150
jmp 0x4c0b
callq 0x4290
jmp 0x4c18
callq 0x42b6
jmp 0x4c25
callq 0x430a
jmp 0x4c8c
leaq 0x164b(%rip), %rdi      # 0x638f
jmp 0x4d4d
leaq 0x1614(%rip), %rdi      # 0x6361
movq %rbx, %rsi
callq 0x42dc
jmp 0x4c7d