// File: /workspace/github_c_makefile_star2_O3/oridb[P]mc/parse/tok.c
// Function: number
static Tok *
number(int base)
{
	Tok *t;
	int start;
	int c;
	int isfloat;
	int maybefloat;
	int unsignedval;
	/* because we allow '_' in numbers, and strtod/stroull don't, we
	 * need a buffer that holds the number without '_'.
	 */
	char buf[2048];
	char *endp;
	size_t nbuf;

	t = NULL;
	isfloat = 0;
	start = fidx;
	nbuf = 0;
	/* allow floating point literals only if the previous token was
	 * not a dot; this lets the user write "foo.1.2" to access nested
	 * tuple fields.
	 */
	maybefloat = !curtok || (curtok->type != Tdot);
	for (c = peek(); isxdigit(c) || (maybefloat && c == '.') || c == '_'; c = peek()) {
		next();
		if (c == '_')
			continue;
		if (nbuf >= sizeof buf - 1) {
			buf[nbuf - 1] = '\0';
			lfatal(curloc, "number %s... too long to represent", buf);
		}

		/* float radix */
		if (c == '.') {
			isfloat = 1;
			buf[nbuf++] = c;
		/* exponential notation */
		} else if (base == 10 && (c == 'e' || c == 'E')) {
			isfloat = 1;
			buf[nbuf++] = c;
			if ((peek() == '+' || peek() == '-') && nbuf < sizeof buf - 1)
				buf[nbuf++] = next();
		/* out of range */
		} else if (hexval(c) < 0 || hexval(c) >= base) {
			lfatal(curloc, "Integer digit '%c' outside of base %d", c, base);
		/* just a number */
		} else {
			buf[nbuf++] = c;
		}
	}
	buf[nbuf] = '\0';

	/* we only support base 10 floats */
	if (isfloat) {
		if (base != 10)
			lfatal(curloc, "%s is not a valid floating point value", buf);
		t = mktok(Tfloatlit);
		t->id = strdupn(&fbuf[start], fidx - start);
		t->fltval = strtod(buf, &endp);
		if (endp == buf)
			lfatal(curloc, "%s is not a valid floating point value", buf);
	} else {
		t = mktok(Tintlit);
		t->id = strdupn(&fbuf[start], fidx - start);
		t->intval = strtoull(buf, &endp, base);
		if (endp == buf)
			lfatal(curloc, "%s is not a valid integer value", buf);
			
		/* check suffixes:
		 *   u -> unsigned
		 *   l -> 64 bit
		 *   i -> 32 bit
		 *   w -> 16 bit
		 *   b -> 8 bit
		 */
		unsignedval = 0;
nextsuffix
:
		switch (peek()) {
		case 'u':
		case 'U':
			if (unsignedval == 1)
				lfatal(curloc, "Duplicate 'u' integer specifier");
			next();
			unsignedval = 1;
			goto nextsuffix;
		case 'l':
		case 'L':
			next();
			if (unsignedval)
				t->inttype = Tyuint64;
			else
				t->inttype = Tyint64;
			break;
		case 'i':
		case 'I':
			next();
			if (unsignedval)
				t->inttype = Tyuint32;
			else
				t->inttype = Tyint32;
			break;
		case 's':
		case 'S':
			next();
			if (unsignedval)
				t->inttype = Tyuint16;
			else
				t->inttype = Tyint16;
			break;
		case 'b':
		case 'B':
			next();
			if (unsignedval)
				t->inttype = Tyuint8;
			else
				t->inttype = Tyint8;
			break;
		default:
			if (unsignedval)
				lfatal(
						curloc, "Unrecognized character int type specifier after 'u'");
			break;
		}
	}

	return t;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x828, %rsp            # imm = 0x828
movl 0x3feab(%rip), %r15d    # 0x621b8
movq 0x3feb4(%rip), %rax     # 0x621c8
testq %rax, %rax
je 0x22326
cmpl $0x14b, (%rax)          # imm = 0x14B
setne 0xb(%rsp)
jmp 0x2232b
movb $0x1, 0xb(%rsp)
movl %edi, 0xc(%rsp)
movslq %r15d, %rcx
movl 0x3fe6f(%rip), %r12d    # 0x621a8
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl %r12d, %ecx
jge 0x2234e
movq 0x3fe56(%rip), %rax     # 0x621a0
movsbl (%rax,%rcx), %ebp
movq %rcx, 0x10(%rsp)
xorl %r13d, %r13d
callq 0x4390
movq %rax, %r14
xorl %ebx, %ebx
movl 0xc(%rsp), %ecx
movq (%r14), %rax
movslq %ebp, %rdx
testb $0x10, 0x1(%rax,%rdx,2)
jne 0x22386
cmpl $0x2e, %ebp
sete %al
cmpl $0x5f, %ebp
je 0x22386
andb 0xb(%rsp), %al
je 0x22492
movslq %r15d, %rax
incq %rax
movl %eax, 0x3fe26(%rip)     # 0x621b8
cmpl $0x5f, %ebp
je 0x223b7
cmpq $0x7ff, %rbx            # imm = 0x7FF
jae 0x226f0
cmpl $0x2e, %ebp
jne 0x223d4
movb $0x2e, 0x20(%rsp,%rbx)
incq %rbx
movl $0x1, %r13d
movl %eax, %r15d
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl %r12d, %r15d
jge 0x22364
movq 0x3fdd5(%rip), %rax     # 0x621a0
movslq %r15d, %rdx
movsbl (%rax,%rdx), %ebp
jmp 0x22364
cmpl $0xa, %ecx
jne 0x2241d
movl %ebp, %edx
andl $-0x21, %edx
cmpl $0x45, %edx
jne 0x2241d
leaq 0x1(%rbx), %r8
movb %bpl, 0x20(%rsp,%rbx)
movl $0x1, %r13d
cmpl %r12d, %eax
jge 0x22487
movq 0x3fd9e(%rip), %rdx     # 0x621a0
movb (%rdx,%rax), %dl
cmpb $0x2b, %dl
jne 0x22458
cmpq $0x7fe, %rbx            # imm = 0x7FE
jne 0x2246f
movl %eax, %r15d
movl $0x7ff, %ebx            # imm = 0x7FF
jmp 0x223ba
movsbl %bpl, %r15d
movl %r15d, %edi
callq 0x222b3
movl %r15d, %edi
callq 0x222b3
movl 0xc(%rsp), %ecx
cmpl %ecx, %eax
jge 0x2270f
movb %bpl, 0x20(%rsp,%rbx)
incq %rbx
movl 0x3fd6c(%rip), %r15d    # 0x621b8
movl 0x3fd55(%rip), %r12d    # 0x621a8
jmp 0x223ba
cmpb $0x2d, %dl
sete %sil
cmpq $0x7fe, %rbx            # imm = 0x7FE
setne %dil
testb %dil, %sil
je 0x22487
addl $0x2, %r15d
movl %r15d, 0x3fd3e(%rip)    # 0x621b8
movb %dl, 0x21(%rsp,%rbx)
addq $0x2, %rbx
jmp 0x223ba
movl %eax, %r15d
movq %r8, %rbx
jmp 0x223ba
movb $0x0, 0x20(%rsp,%rbx)
testl %r13d, %r13d
je 0x22518
cmpl $0xa, %ecx
jne 0x22505
movl $0x48, %edi
callq 0x2ce48
movq %rax, %r14
movl $0x139, (%rax)          # imm = 0x139
movq 0x3fcf5(%rip), %rax     # 0x621b0
movq %rax, 0x4(%r14)
movq 0x3fcda(%rip), %rdi     # 0x621a0
movq 0x10(%rsp), %rax
addq %rax, %rdi
movslq 0x3fce3(%rip), %rsi     # 0x621b8
subq %rax, %rsi
callq 0x2e06c
movq %rax, 0x10(%r14)
leaq 0x20(%rsp), %rbx
leaq 0x18(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x40f0
movsd %xmm0, 0x28(%r14)
cmpq %rbx, (%r15)
jne 0x226db
movq 0x3fca4(%rip), %rdi     # 0x621b0
leaq 0x155d2(%rip), %rsi     # 0x37ae5
jmp 0x22749
movl $0x48, %edi
movl %ecx, %ebx
callq 0x2ce48
movq %rax, %r14
movl $0x137, (%rax)          # imm = 0x137
movq 0x3fc7c(%rip), %rax     # 0x621b0
movq %rax, 0x4(%r14)
movq 0x3fc61(%rip), %rdi     # 0x621a0
movq 0x10(%rsp), %rax
addq %rax, %rdi
movslq 0x3fc6a(%rip), %rsi     # 0x621b8
subq %rax, %rsi
callq 0x2e06c
movq %rax, 0x10(%r14)
leaq 0x20(%rsp), %r15
leaq 0x18(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
movl %ebx, %edx
callq 0x4210
movq %rax, 0x18(%r14)
cmpq %r15, (%r12)
je 0x2273b
movslq 0x3fc22(%rip), %rsi     # 0x621a8
movslq 0x3fc2b(%rip), %rax     # 0x621b8
cmpl %esi, %eax
jge 0x226db
leal 0x1(%rax), %edi
movq 0x3fc01(%rip), %r8      # 0x621a0
addq %rax, %r8
subq %rax, %rsi
movb $0x1, %dl
xorl %ecx, %ecx
xorl %r10d, %r10d
movzbl (%r8,%rcx), %r9d
cmpl $0x61, %r9d
jg 0x225c8
cmpl $0x52, %r9d
jle 0x22622
cmpl $0x55, %r9d
je 0x225d8
jmp 0x226c3
cmpl $0x72, %r9d
jle 0x2260b
cmpl $0x75, %r9d
jne 0x226a4
testb $0x1, %r10b
jne 0x22726
leal (%rdi,%rcx), %edx
movl %edx, 0x3fbcd(%rip)     # 0x621b8
incq %rcx
movb $0x1, %r10b
xorl %edx, %edx
cmpq %rcx, %rsi
jne 0x225ac
movq 0x3fbb1(%rip), %rdi     # 0x621b0
leaq 0x15546(%rip), %rsi     # 0x37b4c
jmp 0x22734
cmpl $0x62, %r9d
je 0x22654
cmpl $0x69, %r9d
je 0x2266d
cmpl $0x6c, %r9d
je 0x22638
jmp 0x226c9
cmpl $0x42, %r9d
je 0x22654
cmpl $0x49, %r9d
je 0x2266d
cmpl $0x4c, %r9d
jne 0x226c9
addl %ecx, %eax
incl %eax
movl %eax, 0x3fb76(%rip)     # 0x621b8
testb $0x1, %dl
je 0x22686
movl $0x8, 0x20(%r14)
jmp 0x226db
addl %ecx, %eax
incl %eax
movl %eax, 0x3fb5a(%rip)     # 0x621b8
testb $0x1, %dl
je 0x22690
movl $0x4, 0x20(%r14)
jmp 0x226db
addl %ecx, %eax
incl %eax
movl %eax, 0x3fb41(%rip)     # 0x621b8
testb $0x1, %dl
je 0x2269a
movl $0x7, 0x20(%r14)
jmp 0x226db
movl $0xe, 0x20(%r14)
jmp 0x226db
movl $0xa, 0x20(%r14)
jmp 0x226db
movl $0xd, 0x20(%r14)
jmp 0x226db
cmpl $0x73, %r9d
jne 0x226c9
addl %ecx, %eax
incl %eax
movl %eax, 0x3fb04(%rip)     # 0x621b8
testb $0x1, %dl
je 0x226d3
movl $0x5, 0x20(%r14)
jmp 0x226db
cmpl $0x53, %r9d
je 0x226aa
testb $0x1, %dl
jne 0x226db
jmp 0x225f8
movl $0xb, 0x20(%r14)
movq %r14, %rax
addq $0x828, %rsp            # imm = 0x828
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x20(%rsp), %rdx
movb $0x0, -0x1(%rbx,%rdx)
movq 0x3faaf(%rip), %rdi     # 0x621b0
leaq 0x15394(%rip), %rsi     # 0x37a9c
xorl %eax, %eax
callq 0x139d2
movq 0x3fa9a(%rip), %rdi     # 0x621b0
leaq 0x153a2(%rip), %rsi     # 0x37abf
movl %ebp, %edx
xorl %eax, %eax
callq 0x139d2
movq 0x3fa83(%rip), %rdi     # 0x621b0
leaq 0x153f8(%rip), %rsi     # 0x37b2c
xorl %eax, %eax
callq 0x139d2
movq 0x3fa6e(%rip), %rdi     # 0x621b0
leaq 0x153c3(%rip), %rsi     # 0x37b0c
leaq 0x20(%rsp), %rdx
jmp 0x22708