// File: /workspace/github_c_makefile_star2_O3/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 0x4a4b
movq %rax, %r12
subq %r15, %r12
jmp 0x4a56
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 0x4170
movq %rax, %r14
movq %rbx, %rdi
callq 0x4170
movq %rax, %r13
movq %rax, 0x6998(%rip)      # 0xb420
movq %rbx, %rdi
callq 0x4170
movq %rax, %rbp
movq %rax, 0x698e(%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 0x4c5b
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 0x1836(%rip), %rsi      # 0x6313
movq %r14, %rdi
movq %r13, %rdx
movq %rbp, %rcx
movq %rbp, %r8
xorl %eax, %eax
callq 0x4190
addl $-0x3, %eax
cmpl $-0x3, %eax
jbe 0x4c6c
movq %r14, %rdi
callq 0x4040
movq 0x6915(%rip), %r14      # 0xb420
movq %r14, %rdi
callq 0x40b0
leaq 0x1(%rax), %rsi
movq %r14, %rdi
callq 0x41b0
movq %rax, 0x68fa(%rip)      # 0xb420
movq %rax, %rdi
movl $0x2f, %esi
callq 0x40e0
xorl %r14d, %r14d
cmpb $0x2f, (%rax)
sete %r14b
addq %rax, %r14
cmpl $0x0, 0x68e9(%rip)      # 0xb430
jne 0x4c7f
movq 0x68e4(%rip), %r15      # 0xb438
movq 0x68e5(%rip), %r13      # 0xb440
movq 0x68e6(%rip), %r12      # 0xb448
movq 0x65e7(%rip), %rsi      # 0xb150
testq %rsi, %rsi
je 0x4bd6
leaq 0x65fb(%rip), %rbp      # 0xb170
movq %r14, %rdi
callq 0x4130
testl %eax, %eax
jne 0x4bc9
testq %r15, %r15
jne 0x4b99
movq -0x18(%rbp), %rdi
callq 0x4240
movq %rax, %r15
movq %rax, 0x689f(%rip)      # 0xb438
testq %r13, %r13
jne 0x4bb1
movq -0x8(%rbp), %rdi
callq 0x4240
movq %rax, %r13
movq %rax, 0x688f(%rip)      # 0xb440
testq %r12, %r12
jne 0x4bc9
movq -0x10(%rbp), %rdi
callq 0x4240
movq %rax, %r12
movq %rax, 0x687f(%rip)      # 0xb448
movq (%rbp), %rsi
addq $0x20, %rbp
testq %rsi, %rsi
jne 0x4b75
testq %r15, %r15
je 0x4ca6
testq %r13, %r13
je 0x4ca6
testq %r12, %r12
je 0x4ca6
cmpl $0x0, 0x6838(%rip)      # 0xb430
jne 0x4cc0
movq 0x6823(%rip), %rbx      # 0xb428
movq %rbx, %rdi
callq 0x40b0
leaq 0x1(%rax), %rsi
movq %rbx, %rdi
callq 0x41b0
movq %rax, %r14
movq %rax, 0x6805(%rip)      # 0xb428
movb (%rax), %bl
testb %bl, %bl
je 0x4c50
movq 0x6818(%rip), %rsi      # 0xb448
movq %r14, %rdi
callq 0x4130
testl %eax, %eax
je 0x4cf6
cmpb $0x2d, %bl
jne 0x4c50
cmpb $0x0, 0x1(%r14)
je 0x4cff
xorl %ebx, %ebx
cmpl $0x0, 0x67d7(%rip)      # 0xb430
jne 0x4ccd
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x6385(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x16a1(%rip), %rsi      # 0x631e
jmp 0x4cb7
movq 0x6372(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x16b4(%rip), %rsi      # 0x6344
leaq 0x1491(%rip), %rdx      # 0x6128
movq %r14, %rcx
xorl %eax, %eax
callq 0x4140
jmp 0x4b4d
movq 0x634b(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x1699(%rip), %rsi      # 0x6350
leaq 0x146a(%rip), %rdx      # 0x6128
jmp 0x4ce7
movq %r15, %rdi
callq 0x4280
jmp 0x4bfe
movq 0x6324(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x171a(%rip), %rsi      # 0x63f8
leaq 0x1443(%rip), %rdx      # 0x6128
xorl %ebx, %ebx
movq %r14, %rcx
xorl %eax, %eax
callq 0x4140
jmp 0x4c5b
leaq 0x16a4(%rip), %rsi      # 0x63a1
jmp 0x4d06
leaq 0x16c9(%rip), %rsi      # 0x63cf
movq 0x62eb(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x1411(%rip), %rdx      # 0x6128
movq %r14, %rcx
xorl %eax, %eax
callq 0x4140
movq 0x6700(%rip), %r14      # 0xb428
movb $0x0, (%r14)
jmp 0x4c50