// File: /workspace/github_c_makefile_star2_O0/s3lase[P]v6shell/osh.c
// Function: gtrim
static char *
gtrim(UChar *ap)
{
	size_t siz;
	UChar buf[PATHMAX], c;
	UChar *a, *b, *nap;

	*buf = UCHAR(EOS);
	for (a = ap, b = buf; b < &buf[PATHMAX]; a++, b++) {
		switch (*a) {
		case EOS:
			*b = UCHAR(EOS);
			siz = (b - buf) + 1;
			nap = ap;
			if (siz > strlen((const char *)ap) + 1) {
				xfree(nap);
				nap = xmalloc(siz);
			}
			(void)memcpy(nap, buf, siz);
			return (char *)nap;
		case DQUOT:
		case SQUOT:
			c = *a++;
			while (*a != c && b < &buf[PATHMAX]) {
				switch (*a) {
				case EOS:
					goto gterr;
				case ASTERISK: case QUESTION:
				case LBRACKET: case RBRACKET: case HYPHEN:
				case DQUOT:    case SQUOT:    case BQUOT:
					*b = UCHAR(BQUOT);
					if (++b >= &buf[PATHMAX])
						goto gterr;
					break;
				}
				*b++ = *a++;
			}
			b--;
			continue;
		case BQUOT:
			switch (*++a) {
			case EOS:
				a--, b--;
				continue;
			case ASTERISK: case QUESTION:
			case LBRACKET: case RBRACKET: case HYPHEN:
			case DQUOT:    case SQUOT:    case BQUOT:
				*b = UCHAR(BQUOT);
				if (++b >= &buf[PATHMAX])
					goto gterr;
				break;
			}
			break;
		}
		*b = *a;
	}

gterr:
	err(-2, FMT2S, getmyname(), (gchar((const char *)ap) != NULL) ?
	    ERR_PATTOOLONG : strerror(ENAMETOOLONG));
	return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1070, %rsp           # imm = 0x1070
movq %rdi, -0x10(%rbp)
movb $0x0, -0x1020(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x1030(%rbp)
leaq -0x1020(%rbp), %rax
movq %rax, -0x1038(%rbp)
movq -0x1038(%rbp), %rax
leaq -0x1020(%rbp), %rcx
addq $0x1000, %rcx           # imm = 0x1000
cmpq %rcx, %rax
jae 0x6aa2
movq -0x1030(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x1044(%rbp)
testl %eax, %eax
je 0x67a9
jmp 0x6773
movl -0x1044(%rbp), %eax
subl $0x22, %eax
je 0x6841
jmp 0x6784
movl -0x1044(%rbp), %eax
subl $0x27, %eax
je 0x6841
jmp 0x6795
movl -0x1044(%rbp), %eax
subl $0x5c, %eax
je 0x6997
jmp 0x6a67
movq -0x1038(%rbp), %rax
movb $0x0, (%rax)
movq -0x1038(%rbp), %rax
leaq -0x1020(%rbp), %rcx
subq %rcx, %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x1040(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x1050(%rbp)
movq -0x10(%rbp), %rdi
callq 0x2130
movq %rax, %rcx
movq -0x1050(%rbp), %rax
addq $0x1, %rcx
cmpq %rcx, %rax
jbe 0x681a
movq -0x1040(%rbp), %rdi
callq 0x33f0
movq -0x18(%rbp), %rdi
callq 0x4ae0
movq %rax, -0x1040(%rbp)
movq -0x1040(%rbp), %rdi
leaq -0x1020(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x22a0
movq -0x1040(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x6b09
movq -0x1030(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x1030(%rbp)
movb (%rax), %al
movb %al, -0x1021(%rbp)
movq -0x1030(%rbp), %rax
movzbl (%rax), %ecx
movzbl -0x1021(%rbp), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0x1051(%rbp)
je 0x689c
movq -0x1038(%rbp), %rax
leaq -0x1020(%rbp), %rcx
addq $0x1000, %rcx           # imm = 0x1000
cmpq %rcx, %rax
setb %al
movb %al, -0x1051(%rbp)
movb -0x1051(%rbp), %al
testb $0x1, %al
jne 0x68ab
jmp 0x6980
movq -0x1030(%rbp), %rax
movzbl (%rax), %eax
movl %eax, -0x1058(%rbp)
testl %eax, %eax
je 0x6912
jmp 0x68c1
movl -0x1058(%rbp), %eax
subl $0x22, %eax
je 0x6917
jmp 0x68ce
movl -0x1058(%rbp), %eax
subl $0x27, %eax
je 0x6917
jmp 0x68db
movl -0x1058(%rbp), %eax
subl $0x2a, %eax
je 0x6917
jmp 0x68e8
movl -0x1058(%rbp), %eax
subl $0x2d, %eax
je 0x6917
jmp 0x68f5
movl -0x1058(%rbp), %eax
subl $0x3f, %eax
je 0x6917
jmp 0x6902
movl -0x1058(%rbp), %eax
addl $-0x5b, %eax
subl $0x3, %eax
jb 0x6917
jmp 0x694d
jmp 0x6aa4
movq -0x1038(%rbp), %rax
movb $0x5c, (%rax)
movq -0x1038(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1038(%rbp)
leaq -0x1020(%rbp), %rcx
addq $0x1000, %rcx           # imm = 0x1000
cmpq %rcx, %rax
jb 0x694b
jmp 0x6aa4
jmp 0x694d
movq -0x1030(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x1030(%rbp)
movb (%rax), %cl
movq -0x1038(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x1038(%rbp)
movb %cl, (%rax)
jmp 0x685e
movq -0x1038(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x1038(%rbp)
jmp 0x6a79
movq -0x1030(%rbp), %rax
movq %rax, %rcx
incq %rcx
movq %rcx, -0x1030(%rbp)
movzbl 0x1(%rax), %eax
movl %eax, -0x105c(%rbp)
testl %eax, %eax
je 0x6a0c
jmp 0x69bb
movl -0x105c(%rbp), %eax
subl $0x22, %eax
je 0x6a32
jmp 0x69c8
movl -0x105c(%rbp), %eax
subl $0x27, %eax
je 0x6a32
jmp 0x69d5
movl -0x105c(%rbp), %eax
subl $0x2a, %eax
je 0x6a32
jmp 0x69e2
movl -0x105c(%rbp), %eax
subl $0x2d, %eax
je 0x6a32
jmp 0x69ef
movl -0x105c(%rbp), %eax
subl $0x3f, %eax
je 0x6a32
jmp 0x69fc
movl -0x105c(%rbp), %eax
addl $-0x5b, %eax
subl $0x3, %eax
jb 0x6a32
jmp 0x6a65
movq -0x1030(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x1030(%rbp)
movq -0x1038(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x1038(%rbp)
jmp 0x6a79
movq -0x1038(%rbp), %rax
movb $0x5c, (%rax)
movq -0x1038(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1038(%rbp)
leaq -0x1020(%rbp), %rcx
addq $0x1000, %rcx           # imm = 0x1000
cmpq %rcx, %rax
jb 0x6a63
jmp 0x6aa4
jmp 0x6a65
jmp 0x6a67
movq -0x1030(%rbp), %rax
movb (%rax), %cl
movq -0x1038(%rbp), %rax
movb %cl, (%rax)
movq -0x1030(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1030(%rbp)
movq -0x1038(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x1038(%rbp)
jmp 0x673f
jmp 0x6aa4
callq 0x8df0
movq %rax, -0x1068(%rbp)
movq -0x10(%rbp), %rdi
callq 0x6600
cmpq $0x0, %rax
je 0x6acf
leaq 0x4d17(%rip), %rax      # 0xb7dd
movq %rax, -0x1070(%rbp)
jmp 0x6ae0
movl $0x24, %edi
callq 0x2380
movq %rax, -0x1070(%rbp)
movq -0x1068(%rbp), %rdx
movq -0x1070(%rbp), %rcx
movl $0xfffffffe, %edi       # imm = 0xFFFFFFFE
leaq 0x4ca7(%rip), %rsi      # 0xb7a1
movb $0x0, %al
callq 0x8af0
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x1070, %rsp           # imm = 0x1070
popq %rbp
retq
nopw %cs:(%rax,%rax)