// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
cmpq $0x0, -0x10(%rbp)
je 0x23848
jmp 0x23867
leaq 0xe747(%rip), %rdi      # 0x31f96
leaq 0xe744(%rip), %rsi      # 0x31f9a
movl $0x8e, %edx
leaq 0xe748(%rip), %rcx      # 0x31faa
callq 0x30c0
cmpl $0x0, -0x14(%rbp)
jle 0x23909
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x30, %eax
jl 0x23909
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x39, %eax
jg 0x23909
cmpl $0x1, -0x14(%rbp)
jne 0x238b4
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
subl $0x30, %eax
movslq %eax, %rcx
leaq 0x16719(%rip), %rax     # 0x39fc0
movq (%rax,%rcx,8), %rax
movq %rax, -0x8(%rbp)
jmp 0x23c39
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x30, %eax
jl 0x23905
movq -0x10(%rbp), %rax
movsbl 0x1(%rax), %eax
cmpl $0x39, %eax
jg 0x23905
cmpl $0x2, -0x14(%rbp)
jne 0x23905
movq -0x10(%rbp), %rax
movsbl (%rax), %eax
subl $0x30, %eax
imull $0xa, %eax, %eax
movq -0x10(%rbp), %rcx
movsbl 0x1(%rcx), %ecx
addl %ecx, %eax
subl $0x30, %eax
movslq %eax, %rcx
leaq 0x166c8(%rip), %rax     # 0x39fc0
movq (%rax,%rcx,8), %rax
movq %rax, -0x8(%rbp)
jmp 0x23c39
jmp 0x23907
jmp 0x23909
movl $0x0, -0x1c(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpl $0x0, -0x18(%rbp)
jle 0x23956
movl -0x1c(%rbp), %eax
shll %eax
movq -0x38(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x38(%rbp)
movsbl (%rcx), %ecx
movslq %ecx, %rdx
leaq 0x1699b(%rip), %rcx     # 0x3a2e0
addl (%rcx,%rdx,4), %eax
movl %eax, -0x1c(%rbp)
movl -0x18(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x2391e
movl -0x1c(%rbp), %eax
andl $0x3ff, %eax            # imm = 0x3FF
movl %eax, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movl %eax, %ecx
leaq 0x1b613(%rip), %rax     # 0x3ef80
movq (%rax,%rcx,8), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x239ee
movl -0x14(%rbp), %eax
movq -0x40(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x239de
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movsbl (%rax), %eax
movq -0x30(%rbp), %rcx
movq %rcx, %rdx
addq $0x1, %rdx
movq %rdx, -0x30(%rbp)
movsbl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x239dc
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
cmpq -0x38(%rbp), %rax
jne 0x239da
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0x23c39
jmp 0x2399b
jmp 0x239de
jmp 0x239e0
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x40(%rbp)
jmp 0x23975
movq 0x1d58b(%rip), %rax     # 0x40f80
movslq -0x14(%rbp), %rcx
addq %rcx, %rax
addq $0x1, %rax
cmpq 0x1d581(%rip), %rax     # 0x40f88
jb 0x23aef
movl -0x14(%rbp), %eax
addl $0x7, %eax
andl $-0x8, %eax
addl $0x1000, %eax           # imm = 0x1000
movl %eax, -0x44(%rbp)
movslq -0x44(%rbp), %rax
addq $0x7, %rax
andq $-0x8, %rax
movl %eax, %ecx
leaq 0x17c0d(%rip), %rax     # 0x3b640
movq (%rax), %rax
movl %ecx, (%rax)
leaq 0x17c01(%rip), %rax     # 0x3b640
movq (%rax), %rax
movq 0x8(%rax), %rax
leaq 0x17bf3(%rip), %rcx     # 0x3b640
movq (%rcx), %rcx
movslq (%rcx), %rcx
addq %rcx, %rax
leaq 0x17be3(%rip), %rcx     # 0x3b640
movq (%rcx), %rcx
cmpq 0x10(%rcx), %rax
jb 0x23a84
leaq 0x17bd3(%rip), %rax     # 0x3b640
movq (%rax), %rax
movl (%rax), %edi
leaq 0x17bc7(%rip), %rsi     # 0x3b640
callq 0x253d0
movq %rax, -0x50(%rbp)
jmp 0x23acf
leaq 0x17bb5(%rip), %rax     # 0x3b640
movq (%rax), %rax
movl (%rax), %edx
leaq 0x17ba9(%rip), %rax     # 0x3b640
movq (%rax), %rax
movq 0x8(%rax), %rcx
movslq %edx, %rdx
addq %rdx, %rcx
movq %rcx, 0x8(%rax)
leaq 0x17b91(%rip), %rax     # 0x3b640
movq (%rax), %rax
movq 0x8(%rax), %rax
leaq 0x17b83(%rip), %rcx     # 0x3b640
movq (%rcx), %rcx
movslq (%rcx), %rdx
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq %rax, 0x1d4a6(%rip)     # 0x40f80
movq 0x1d49f(%rip), %rax     # 0x40f80
movslq -0x44(%rbp), %rcx
addq %rcx, %rax
movq %rax, 0x1d499(%rip)     # 0x40f88
leaq 0x17b4a(%rip), %rax     # 0x3b640
movq (%rax), %rax
movl $0x18, (%rax)
leaq 0x17b3a(%rip), %rax     # 0x3b640
movq (%rax), %rax
movq 0x8(%rax), %rax
leaq 0x17b2c(%rip), %rcx     # 0x3b640
movq (%rcx), %rcx
movslq (%rcx), %rcx
addq %rcx, %rax
leaq 0x17b1c(%rip), %rcx     # 0x3b640
movq (%rcx), %rcx
cmpq 0x10(%rcx), %rax
jb 0x23b4b
leaq 0x17b0c(%rip), %rax     # 0x3b640
movq (%rax), %rax
movl (%rax), %edi
leaq 0x17b00(%rip), %rsi     # 0x3b640
callq 0x253d0
movq %rax, -0x58(%rbp)
jmp 0x23b96
leaq 0x17aee(%rip), %rax     # 0x3b640
movq (%rax), %rax
movl (%rax), %edx
leaq 0x17ae2(%rip), %rax     # 0x3b640
movq (%rax), %rax
movq 0x8(%rax), %rcx
movslq %edx, %rdx
addq %rdx, %rcx
movq %rcx, 0x8(%rax)
leaq 0x17aca(%rip), %rax     # 0x3b640
movq (%rax), %rax
movq 0x8(%rax), %rax
leaq 0x17abc(%rip), %rcx     # 0x3b640
movq (%rcx), %rcx
movslq (%rcx), %rdx
xorl %ecx, %ecx
subq %rdx, %rcx
addq %rcx, %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x40(%rbp)
movl -0x14(%rbp), %ecx
movq -0x40(%rbp), %rax
movl %ecx, 0x8(%rax)
movq 0x1d3d1(%rip), %rcx     # 0x40f80
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
cmpq -0x38(%rbp), %rax
jae 0x23bea
movq -0x10(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x10(%rbp)
movb (%rax), %cl
movq 0x1d3a8(%rip), %rax     # 0x40f80
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, 0x1d39a(%rip)     # 0x40f80
movb %cl, (%rax)
jmp 0x23bb6
movq 0x1d38f(%rip), %rax     # 0x40f80
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0x1d381(%rip)     # 0x40f80
movb $0x0, (%rax)
movl -0x1c(%rbp), %eax
movl %eax, %ecx
leaq 0x1b372(%rip), %rax     # 0x3ef80
movq (%rax,%rcx,8), %rcx
movq -0x40(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x40(%rbp), %rdx
movl -0x1c(%rbp), %eax
movl %eax, %ecx
leaq 0x1b356(%rip), %rax     # 0x3ef80
movq %rdx, (%rax,%rcx,8)
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)