// File: /workspace/github_c_makefile_star2_O0/s3lase[P]v6shell/osh.c
// Function: get_dolp
static const char *
get_dolp(int c)
{
	int n, r;
	const char *v;

	*dolbuf = EOS;
	switch (c) {
	case DOLLAR:
		r = snprintf(dolbuf,sizeof(dolbuf),"%05u",(unsigned)getmypid());
		v = (r < 0 || r >= (int)sizeof(dolbuf)) ? NULL : dolbuf;
		break;
	case '0': case '1': case '2': case '3': case '4':
	case '5': case '6': case '7': case '8': case '9':
		n = c - '0';
		if (IS_DIGIT(n, c) && n < dolc)
			v = (n > 0) ? dolv[n] : name;
		else
			v = dolbuf;
		break;
	case 'd':
		if ((v = getenv("OSHDIR")) == NULL)
			v = dolbuf;
		break;
	case 'e':
		if ((v = getenv("EXECSHELL")) == NULL)
			v = dolbuf;
		break;
	case 'h':
		if ((v = getenv("HOME")) == NULL)
			v = dolbuf;
		break;
	case 'm':
		if ((v = getenv("MANPATH")) == NULL)
			v = dolbuf;
		break;
	case HASH:
	case 'n':
		n = (dolc > 1) ? dolc - 1 : 0;
		r = snprintf(dolbuf, sizeof(dolbuf), "%u", (unsigned)n);
		v = (r < 0 || r >= (int)sizeof(dolbuf)) ? NULL : dolbuf;
		break;
	case 'p':
		if ((v = getenv("PATH")) == NULL)
			v = dolbuf;
		break;
	case 's':
		r = snprintf(dolbuf, sizeof(dolbuf), "%u", (unsigned)status);
		v = (r < 0 || r >= (int)sizeof(dolbuf)) ? NULL : dolbuf;
		break;
	case 't':
		v = tty;
		break;
	case 'u':
		v = user;
		break;
	case 'v':
		r = snprintf(dolbuf, sizeof(dolbuf), "%s", OSH_VERSION);
		v = (r < 0 || r >= (int)sizeof(dolbuf)) ? NULL : dolbuf;
		break;
	default:
		v = NULL;
	}
	return v;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl %edi, -0x4(%rbp)
movb $0x0, 0xc61e(%rip)      # 0x10ae0
movl -0x4(%rbp), %eax
addl $-0x23, %eax
movl %eax, %ecx
movq %rcx, -0x20(%rbp)
subl $0x53, %eax
ja 0x47ae
movq -0x20(%rbp), %rax
leaq 0x6e86(%rip), %rcx      # 0xb368
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
callq 0x8e20
movl %eax, %ecx
leaq 0xc5e7(%rip), %rdi      # 0x10ae0
movl $0x21, %esi
leaq 0x71f0(%rip), %rdx      # 0xb6f5
movb $0x0, %al
callq 0x2170
movl %eax, -0xc(%rbp)
movb $0x1, %al
cmpl $0x0, -0xc(%rbp)
movb %al, -0x21(%rbp)
jl 0x4524
cmpl $0x21, -0xc(%rbp)
setge %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %dl
leaq 0xc5b2(%rip), %rax      # 0x10ae0
xorl %ecx, %ecx
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, -0x18(%rbp)
jmp 0x47b6
movl -0x4(%rbp), %eax
subl $0x30, %eax
movl %eax, -0x8(%rbp)
cmpl $0x0, -0x8(%rbp)
jl 0x45ae
cmpl $0x9, -0x8(%rbp)
jg 0x45ae
movl -0x8(%rbp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
movslq %edx, %rcx
leaq 0x7190(%rip), %rax      # 0xb6fa
movsbl (%rax,%rcx), %eax
cmpl -0x4(%rbp), %eax
jne 0x45ae
movl -0x8(%rbp), %eax
cmpl 0x9cbc(%rip), %eax      # 0xe238
jge 0x45ae
cmpl $0x0, -0x8(%rbp)
jle 0x4599
movq 0x9ca5(%rip), %rax      # 0xe230
movslq -0x8(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
jmp 0x45a4
movq 0x9c88(%rip), %rax      # 0xe228
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x18(%rbp)
jmp 0x45b9
leaq 0xc52b(%rip), %rax      # 0x10ae0
movq %rax, -0x18(%rbp)
jmp 0x47b6
leaq 0x7140(%rip), %rdi      # 0xb705
callq 0x2030
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x45df
leaq 0xc505(%rip), %rax      # 0x10ae0
movq %rax, -0x18(%rbp)
jmp 0x47b6
leaq 0x7121(%rip), %rdi      # 0xb70c
callq 0x2030
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x4605
leaq 0xc4df(%rip), %rax      # 0x10ae0
movq %rax, -0x18(%rbp)
jmp 0x47b6
leaq 0x7105(%rip), %rdi      # 0xb716
callq 0x2030
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x462b
leaq 0xc4b9(%rip), %rax      # 0x10ae0
movq %rax, -0x18(%rbp)
jmp 0x47b6
leaq 0x70e4(%rip), %rdi      # 0xb71b
callq 0x2030
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x4651
leaq 0xc493(%rip), %rax      # 0x10ae0
movq %rax, -0x18(%rbp)
jmp 0x47b6
cmpl $0x1, 0x9bdb(%rip)      # 0xe238
jle 0x466d
movl 0x9bd3(%rip), %eax      # 0xe238
subl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0x4674
xorl %eax, %eax
movl %eax, -0x34(%rbp)
jmp 0x4674
movl -0x34(%rbp), %eax
movl %eax, -0x8(%rbp)
movl -0x8(%rbp), %ecx
leaq 0xc45c(%rip), %rdi      # 0x10ae0
movl $0x21, %esi
leaq 0x7262(%rip), %rdx      # 0xb8f2
movb $0x0, %al
callq 0x2170
movl %eax, -0xc(%rbp)
movb $0x1, %al
cmpl $0x0, -0xc(%rbp)
movb %al, -0x35(%rbp)
jl 0x46af
cmpl $0x21, -0xc(%rbp)
setge %al
movb %al, -0x35(%rbp)
movb -0x35(%rbp), %dl
leaq 0xc427(%rip), %rax      # 0x10ae0
xorl %ecx, %ecx
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, -0x18(%rbp)
jmp 0x47b6
leaq 0x704c(%rip), %rdi      # 0xb71e
callq 0x2030
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x46ec
leaq 0xc3f8(%rip), %rax      # 0x10ae0
movq %rax, -0x18(%rbp)
jmp 0x47b6
movl 0x9b71(%rip), %ecx      # 0xe268
leaq 0xc3e2(%rip), %rdi      # 0x10ae0
movl $0x21, %esi
leaq 0x71e8(%rip), %rdx      # 0xb8f2
movb $0x0, %al
callq 0x2170
movl %eax, -0xc(%rbp)
movb $0x1, %al
cmpl $0x0, -0xc(%rbp)
movb %al, -0x36(%rbp)
jl 0x4729
cmpl $0x21, -0xc(%rbp)
setge %al
movb %al, -0x36(%rbp)
movb -0x36(%rbp), %dl
leaq 0xc3ad(%rip), %rax      # 0x10ae0
xorl %ecx, %ecx
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, -0x18(%rbp)
jmp 0x47b6
movq 0x9b0f(%rip), %rax      # 0xe258
movq %rax, -0x18(%rbp)
jmp 0x47b6
movq 0x9b0a(%rip), %rax      # 0xe260
movq %rax, -0x18(%rbp)
jmp 0x47b6
leaq 0xc37d(%rip), %rdi      # 0x10ae0
movl $0x21, %esi
leaq 0x72e4(%rip), %rdx      # 0xba53
leaq 0x6fad(%rip), %rcx      # 0xb723
movb $0x0, %al
callq 0x2170
movl %eax, -0xc(%rbp)
movb $0x1, %al
cmpl $0x0, -0xc(%rbp)
movb %al, -0x37(%rbp)
jl 0x4795
cmpl $0x21, -0xc(%rbp)
setge %al
movb %al, -0x37(%rbp)
movb -0x37(%rbp), %dl
leaq 0xc341(%rip), %rax      # 0x10ae0
xorl %ecx, %ecx
testb $0x1, %dl
cmovneq %rcx, %rax
movq %rax, -0x18(%rbp)
jmp 0x47b6
movq $0x0, -0x18(%rbp)
movq -0x18(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq