// File: /workspace/github_c_makefile_star2_O1/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 0x16e10
movl %esi, %r14d
movq %rdi, %rbx
testl %esi, %esi
jle 0x16c8f
movsbl (%rbx), %eax
leal -0x30(%rax), %ecx
cmpb $0x9, %cl
ja 0x16c8f
cmpl $0x1, %r14d
jne 0x16c66
addl $-0x30, %eax
leaq 0x10cf3(%rip), %rcx     # 0x27950
leaq (%rcx,%rax,8), %rax
jmp 0x16dfe
movsbl 0x1(%rbx), %ecx
cmpl $0x30, %ecx
jl 0x16c8f
cmpb $0x3a, %cl
setge %dl
cmpl $0x2, %r14d
setne %sil
orb %dl, %sil
jne 0x16c8f
leal (%rax,%rax,4), %eax
leal (%rcx,%rax,2), %eax
addl $0xfffffdf0, %eax       # imm = 0xFFFFFDF0
jmp 0x16c56
xorl %r12d, %r12d
testl %r14d, %r14d
jle 0x16cc9
movl %r14d, %r13d
leal 0x1(%r14), %eax
leaq 0x9bfb(%rip), %rcx      # 0x208a0
movq %rbx, %rdx
addl %r12d, %r12d
movsbq (%rdx), %rsi
incq %rdx
addl (%rcx,%rsi,4), %r12d
decl %eax
cmpl $0x1, %eax
jg 0x16ca8
addq %rbx, %r13
andl $0x3ff, %r12d           # imm = 0x3FF
jmp 0x16ccc
movq %rbx, %r13
leaq 0x1604d(%rip), %rbp     # 0x2cd20
movq (%rbp,%r12,8), %rax
testq %rax, %rax
je 0x16d07
cmpl %r14d, 0x8(%rax)
jne 0x16d01
movq (%rax), %rcx
movq %rbx, %rdx
movb (%rdx), %sil
cmpb (%rcx), %sil
jne 0x16d01
incq %rcx
incq %rdx
cmpq %r13, %rdx
jne 0x16ce9
jmp 0x16dfe
movq 0x10(%rax), %rax
jmp 0x16cd8
movq 0x18012(%rip), %rax     # 0x2ed20
movslq %r14d, %rcx
addq %rcx, %rax
incq %rax
cmpq 0x1800a(%rip), %rax     # 0x2ed28
jb 0x16d7d
leal 0x7(%r14), %eax
andl $-0x8, %eax
movslq %eax, %rdx
leaq 0x1000(%rdx), %r15
leal 0x1000(%rdx), %eax
leaq 0x12a32(%rip), %rcx     # 0x29770
movq (%rcx), %rcx
movl %eax, (%rcx)
movq 0x8(%rcx), %rax
addq %rax, %rdx
addq $0x1000, %rdx           # imm = 0x1000
cmpq 0x10(%rcx), %rdx
jae 0x16d5d
movq %rdx, 0x8(%rcx)
jmp 0x16d6c
leaq 0x12a0c(%rip), %rsi     # 0x29770
movl %r15d, %edi
callq 0x17978
movq %rax, 0x17fad(%rip)     # 0x2ed20
addq %rax, %r15
movq %r15, 0x17fab(%rip)     # 0x2ed28
leaq 0x129ec(%rip), %rax     # 0x29770
movq (%rax), %rcx
movl $0x18, (%rcx)
movq 0x8(%rcx), %rax
leaq 0x18(%rax), %rdx
cmpq 0x10(%rcx), %rdx
jae 0x16da1
movq %rdx, 0x8(%rcx)
jmp 0x16db2
leaq 0x129c8(%rip), %rsi     # 0x29770
movl $0x18, %edi
callq 0x17978
movl %r14d, 0x8(%rax)
movq 0x17f63(%rip), %rcx     # 0x2ed20
movq %rcx, (%rax)
cmpq %rbx, %r13
jbe 0x16ddb
movb (%rbx), %dl
incq %rbx
movb %dl, (%rcx)
incq %rcx
cmpq %r13, %rbx
jne 0x16dc5
movq %rcx, 0x17f45(%rip)     # 0x2ed20
movq 0x17f3e(%rip), %rcx     # 0x2ed20
leaq 0x1(%rcx), %rdx
movq %rdx, 0x17f33(%rip)     # 0x2ed20
movb $0x0, (%rcx)
movq (%rbp,%r12,8), %rcx
movq %rcx, 0x10(%rax)
movq %rax, (%rbp,%r12,8)
movq (%rax), %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x9943(%rip), %rdi      # 0x2075a
leaq 0x9940(%rip), %rsi      # 0x2075e
leaq 0x9949(%rip), %rcx      # 0x2076e
movl $0x8e, %edx
callq 0x30d0