// File: /workspace/github_c_makefile_star2_O2/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
pushq $0xa
popq %rsi
callq 0x40d0
testq %rax, %rax
je 0x4518
movq %rax, %r12
subq %r15, %r12
jmp 0x4523
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, 0x6ecb(%rip)      # 0xb420
movq %rbx, %rdi
callq 0x4170
movq %rax, %rbp
movq %rax, 0x6ec1(%rip)      # 0xb428
testq %r14, %r14
sete %al
testq %r13, %r13
sete %cl
orb %al, %cl
testq %rbp, %rbp
sete %al
pushq $-0x1
popq %rbx
orb %cl, %al
jne 0x471e
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 0x1d4b(%rip), %rsi      # 0x62f3
movq %r14, %rdi
movq %r13, %rdx
movq %rbp, %rcx
movq %rbp, %r8
xorl %eax, %eax
callq 0x4190
addl $-0x3, %eax
cmpl $-0x3, %eax
jbe 0x472f
movq %r14, %rdi
callq 0x4040
movq 0x6e4a(%rip), %r14      # 0xb420
movq %r14, %rdi
callq 0x40b0
leaq 0x1(%rax), %rsi
movq %r14, %rdi
callq 0x41b0
movq %rax, 0x6e2f(%rip)      # 0xb420
pushq $0x2f
popq %rsi
movq %rax, %rdi
callq 0x40e0
xorl %r14d, %r14d
cmpb $0x2f, (%rax)
sete %r14b
addq %rax, %r14
cmpl $0x0, 0x6e20(%rip)      # 0xb430
jne 0x4742
movq 0x6e1b(%rip), %r15      # 0xb438
movq 0x6e1c(%rip), %r13      # 0xb440
leaq 0x6b3d(%rip), %rbp      # 0xb168
movq 0x6e16(%rip), %r12      # 0xb448
movq -0x18(%rbp), %rsi
testq %rsi, %rsi
je 0x4695
movq %r14, %rdi
callq 0x4130
testl %eax, %eax
jne 0x468f
testq %r15, %r15
jne 0x465f
movq -0x10(%rbp), %rdi
callq 0x4240
movq %rax, %r15
movq %rax, 0x6dd9(%rip)      # 0xb438
testq %r13, %r13
jne 0x4677
movq (%rbp), %rdi
callq 0x4240
movq %rax, %r13
movq %rax, 0x6dc9(%rip)      # 0xb440
testq %r12, %r12
jne 0x468f
movq -0x8(%rbp), %rdi
callq 0x4240
movq %rax, %r12
movq %rax, 0x6db9(%rip)      # 0xb448
addq $0x20, %rbp
jmp 0x4632
testq %r15, %r15
je 0x4769
testq %r13, %r13
je 0x4769
testq %r12, %r12
je 0x4769
cmpl $0x0, 0x6d79(%rip)      # 0xb430
jne 0x4786
movq 0x6d64(%rip), %rbx      # 0xb428
movq %rbx, %rdi
callq 0x40b0
leaq 0x1(%rax), %rsi
movq %rbx, %rdi
callq 0x41b0
movq %rax, %r14
movq %rax, 0x6d46(%rip)      # 0xb428
movb (%rax), %bl
testb %bl, %bl
je 0x470f
movq 0x6d59(%rip), %rsi      # 0xb448
movq %r14, %rdi
callq 0x4130
testl %eax, %eax
je 0x482e
cmpb $0x2d, %bl
jne 0x470f
cmpb $0x0, 0x1(%r14)
je 0x4837
xorl %ebx, %ebx
cmpl $0x0, 0x6d18(%rip)      # 0xb430
jne 0x4805
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x68c2(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x1bbe(%rip), %rsi      # 0x62fe
jmp 0x477a
movq 0x68af(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x1bd1(%rip), %rsi      # 0x6324
leaq 0x19ae(%rip), %rdx      # 0x6108
movq %r14, %rcx
xorl %eax, %eax
callq 0x4140
jmp 0x4616
movq 0x6888(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x1bb6(%rip), %rsi      # 0x6330
leaq 0x1987(%rip), %rdx      # 0x6108
jmp 0x481f
movq 0x686b(%rip), %rbx      # 0xaff8
movq (%rbx), %rdi
leaq 0x1bc6(%rip), %rsi      # 0x635d
leaq 0x196a(%rip), %rdx      # 0x6108
movq %r15, %rcx
xorl %eax, %eax
callq 0x4140
cmpl $0x0, 0x6c81(%rip)      # 0xb430
je 0x46bd
movq (%rbx), %rdi
movq 0x6c81(%rip), %rcx      # 0xb440
leaq 0x1ba3(%rip), %rsi      # 0x6369
leaq 0x193b(%rip), %rdx      # 0x6108
xorl %eax, %eax
callq 0x4140
cmpl $0x0, 0x6c55(%rip)      # 0xb430
je 0x46bd
movq (%rbx), %rdi
movq 0x6c5d(%rip), %rcx      # 0xb448
leaq 0x1b83(%rip), %rsi      # 0x6375
leaq 0x190f(%rip), %rdx      # 0x6108
xorl %eax, %eax
callq 0x4140
jmp 0x46bd
movq 0x67ec(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x1bc2(%rip), %rsi      # 0x63d8
leaq 0x18eb(%rip), %rdx      # 0x6108
xorl %ebx, %ebx
movq %r14, %rcx
xorl %eax, %eax
callq 0x4140
jmp 0x471e
leaq 0x1b4c(%rip), %rsi      # 0x6381
jmp 0x483e
leaq 0x1b71(%rip), %rsi      # 0x63af
movq 0x67b3(%rip), %rax      # 0xaff8
movq (%rax), %rdi
leaq 0x18b9(%rip), %rdx      # 0x6108
movq %r14, %rcx
xorl %eax, %eax
callq 0x4140
movq 0x6bc8(%rip), %r14      # 0xb428
movb $0x0, (%r14)
jmp 0x470f