// File: /workspace/github_c_makefile_star2_O2/Oric4ever[P]lcc65/6502/build/../src/string.c
// Function: stringn
char *stringn(char *str, int n) {
	int i;
	unsigned int h;
	char *s1, *s2, *end;
	struct string *p;

	assert(str);
	if (n > 0 && str[0] >= '0' && str[0] <= '9') {
		if (n == 1)
			return nums[str[0]-'0'];
		else if (str[1] >= '0' && str[1] <= '9' && n == 2)
			return nums[10*(str[0]-'0') + str[1]-'0'];
	}
	for (h = 0, i = n, end = str; i > 0; i--)
		h = (h<<1) + scatter[(int)*end++];
	h &= TABLESIZE-1;
	for (p = buckets[h]; p; p = p->link)
		if (n == p->len)
			for (s1 = str, s2 = p->str; *s1 == *s2++; )
				if (++s1 == end)
					return p->str;
	if (next + n + 1 >= strlimit) {
		int m = roundup(n, 8) + BUFSIZE;
		next = alloc(m);
		strlimit = next + m;
	}
	p = (struct string *) alloc(sizeof *p);
	p->len = n;
	for (p->str = next; str < end; )
		*next++ = *str++;
	*next++ = 0;
	p->link = buckets[h];
	buckets[h] = p;
	return p->str;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x1599b
movl %esi, %r14d
movq %rdi, %rbx
testl %esi, %esi
jle 0x15833
movsbl (%rbx), %eax
leal -0x30(%rax), %ecx
cmpb $0x9, %cl
ja 0x15833
cmpl $0x1, %r14d
jne 0x1580b
addl $-0x30, %eax
leaq 0x1214e(%rip), %rcx     # 0x27950
leaq (%rcx,%rax,8), %rax
jmp 0x15989
movsbl 0x1(%rbx), %ecx
cmpl $0x30, %ecx
jl 0x15833
cmpb $0x3a, %cl
setae %dl
cmpl $0x2, %r14d
setne %sil
orb %dl, %sil
jne 0x15833
imull $0xa, %eax, %eax
addl %ecx, %eax
addl $0xfffffdf0, %eax       # imm = 0xFFFFFDF0
jmp 0x157fb
xorl %ecx, %ecx
leaq 0x90e4(%rip), %rdx      # 0x1e920
movl %r14d, %esi
xorl %eax, %eax
testl %esi, %esi
jle 0x15856
addl %eax, %eax
movsbq (%rbx,%rcx), %rdi
addl (%rdx,%rdi,4), %eax
decl %esi
incq %rcx
jmp 0x15841
andl $0x3ff, %eax            # imm = 0x3FF
leaq 0x174be(%rip), %rdx     # 0x2cd20
leaq (%rdx,%rax,8), %r13
leaq (%rbx,%rcx), %rbp
movq %r13, %rax
movq (%rax), %rax
testq %rax, %rax
je 0x158a0
cmpl %r14d, 0x8(%rax)
jne 0x1589a
movq (%rax), %rdx
xorl %esi, %esi
movq %rcx, %rdi
movb (%rbx,%rsi), %r8b
cmpb (%rdx,%rsi), %r8b
jne 0x1589a
incq %rsi
decq %rdi
jne 0x15883
jmp 0x15989
addq $0x10, %rax
jmp 0x1586d
movq 0x19479(%rip), %rcx     # 0x2ed20
movslq %r14d, %rax
addq %rcx, %rax
incq %rax
leaq 0x13eb9(%rip), %r12     # 0x29770
movq (%r12), %rdx
cmpq 0x19466(%rip), %rax     # 0x2ed28
jb 0x15918
leal 0x7(%r14), %eax
andl $-0x8, %eax
cltq
leaq 0x1000(%rax), %r15
leal 0x1000(%rax), %ecx
movl %ecx, (%rdx)
movq 0x8(%rdx), %rcx
addq %rcx, %rax
addq $0x1000, %rax           # imm = 0x1000
cmpq 0x10(%rdx), %rax
jae 0x158f5
movq %rax, 0x8(%rdx)
jmp 0x15907
movl %r15d, %edi
movq %r12, %rsi
callq 0x16438
movq %rax, %rcx
movq (%r12), %rdx
movq %rcx, 0x19412(%rip)     # 0x2ed20
addq %rcx, %r15
movq %r15, 0x19410(%rip)     # 0x2ed28
movl $0x18, (%rdx)
movq 0x8(%rdx), %rax
leaq 0x18(%rax), %rsi
cmpq 0x10(%rdx), %rsi
jae 0x15932
movq %rsi, 0x8(%rdx)
jmp 0x15948
leaq 0x13e37(%rip), %rsi     # 0x29770
pushq $0x18
popq %rdi
callq 0x16438
movq 0x193d8(%rip), %rcx     # 0x2ed20
movl %r14d, 0x8(%rax)
movq %rcx, (%rax)
incq %rcx
cmpq %rbp, %rbx
jae 0x15968
movb (%rbx), %dl
incq %rbx
movq %rcx, 0x193bd(%rip)     # 0x2ed20
movb %dl, -0x1(%rcx)
jmp 0x1594f
movq 0x193b1(%rip), %rcx     # 0x2ed20
leaq 0x1(%rcx), %rdx
movq %rdx, 0x193a6(%rip)     # 0x2ed20
movb $0x0, (%rcx)
movq (%r13), %rcx
movq %rcx, 0x10(%rax)
movq %rax, (%r13)
movq (%rax), %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8e40(%rip), %rdi      # 0x1e7e2
leaq 0x8e3d(%rip), %rsi      # 0x1e7e6
leaq 0x8e46(%rip), %rcx      # 0x1e7f6
movl $0x8e, %edx
callq 0x30d0