// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x850, %rsp            # imm = 0x850
movl %edi, -0x4(%rbp)
movq $0x0, -0x10(%rbp)
movl $0x0, -0x1c(%rbp)
movl 0x477c1(%rip), %eax     # 0x7dcd4
movl %eax, -0x14(%rbp)
movq $0x0, -0x840(%rbp)
movb $0x1, %al
cmpq $0x0, 0x477b5(%rip)     # 0x7dce0
movb %al, -0x841(%rbp)
je 0x36549
movq 0x477a6(%rip), %rax     # 0x7dce0
cmpl $0x14b, (%rax)          # imm = 0x14B
setne %al
movb %al, -0x841(%rbp)
movb -0x841(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
movl %eax, -0x20(%rbp)
callq 0x35240
movl %eax, -0x18(%rbp)
callq 0x6370
movq (%rax), %rax
movslq -0x18(%rbp), %rcx
movzwl (%rax,%rcx,2), %ecx
andl $0x1000, %ecx           # imm = 0x1000
movb $0x1, %al
cmpl $0x0, %ecx
movb %al, -0x842(%rbp)
jne 0x365a3
cmpl $0x0, -0x20(%rbp)
je 0x36596
movb $0x1, %al
cmpl $0x2e, -0x18(%rbp)
movb %al, -0x842(%rbp)
je 0x365a3
cmpl $0x5f, -0x18(%rbp)
sete %al
movb %al, -0x842(%rbp)
movb -0x842(%rbp), %al
testb $0x1, %al
jne 0x365b2
jmp 0x36720
callq 0x35290
cmpl $0x5f, -0x18(%rbp)
jne 0x365c2
jmp 0x36713
cmpq $0x7ff, -0x840(%rbp) # imm = 0x7FF
jb 0x365fe
movq -0x840(%rbp), %rax
subq $0x1, %rax
movb $0x0, -0x830(%rbp,%rax)
leaq -0x830(%rbp), %rdx
movq 0x476dc(%rip), %rdi     # 0x7dccc
leaq 0x1d7e8(%rip), %rsi     # 0x53ddf
movb $0x0, %al
callq 0x1e110
cmpl $0x2e, -0x18(%rbp)
jne 0x36631
movl $0x1, -0x1c(%rbp)
movl -0x18(%rbp), %eax
movb %al, %cl
movq -0x840(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x840(%rbp)
movb %cl, -0x830(%rbp,%rax)
jmp 0x36711
cmpl $0xa, -0x4(%rbp)
jne 0x366b1
cmpl $0x65, -0x18(%rbp)
je 0x36643
cmpl $0x45, -0x18(%rbp)
jne 0x366b1
movl $0x1, -0x1c(%rbp)
movl -0x18(%rbp), %eax
movb %al, %cl
movq -0x840(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x840(%rbp)
movb %cl, -0x830(%rbp,%rax)
callq 0x35240
cmpl $0x2b, %eax
je 0x3667f
callq 0x35240
cmpl $0x2d, %eax
jne 0x366af
cmpq $0x7ff, -0x840(%rbp) # imm = 0x7FF
jae 0x366af
callq 0x35290
movb %al, %cl
movq -0x840(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x840(%rbp)
movb %cl, -0x830(%rbp,%rax)
jmp 0x3670f
movl -0x18(%rbp), %eax
movsbl %al, %edi
callq 0x361c0
cmpl $0x0, %eax
jl 0x366d1
movl -0x18(%rbp), %eax
movsbl %al, %edi
callq 0x361c0
cmpl -0x4(%rbp), %eax
jl 0x366ec
movl -0x18(%rbp), %edx
movl -0x4(%rbp), %ecx
movq 0x475ee(%rip), %rdi     # 0x7dccc
leaq 0x1d71d(%rip), %rsi     # 0x53e02
movb $0x0, %al
callq 0x1e110
movl -0x18(%rbp), %eax
movb %al, %cl
movq -0x840(%rbp), %rax
movq %rax, %rdx
addq $0x1, %rdx
movq %rdx, -0x840(%rbp)
movb %cl, -0x830(%rbp,%rax)
jmp 0x3670f
jmp 0x36711
jmp 0x36713
callq 0x35240
movl %eax, -0x18(%rbp)
jmp 0x3655f
movq -0x840(%rbp), %rax
movb $0x0, -0x830(%rbp,%rax)
cmpl $0x0, -0x1c(%rbp)
je 0x367e3
cmpl $0xa, -0x4(%rbp)
je 0x3675b
leaq -0x830(%rbp), %rdx
movq 0x4757f(%rip), %rdi     # 0x7dccc
leaq 0x1d6d4(%rip), %rsi     # 0x53e28
movb $0x0, %al
callq 0x1e110
movl $0x139, %edi            # imm = 0x139
callq 0x35250
movq %rax, -0x10(%rbp)
movq 0x47550(%rip), %rdi     # 0x7dcc0
movslq -0x14(%rbp), %rax
addq %rax, %rdi
movl 0x47557(%rip), %eax     # 0x7dcd4
subl -0x14(%rbp), %eax
movslq %eax, %rsi
callq 0x4a340
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
leaq -0x830(%rbp), %rdi
leaq -0x838(%rbp), %rsi
callq 0x60d0
movq -0x10(%rbp), %rax
movsd %xmm0, 0x28(%rax)
movq -0x838(%rbp), %rax
leaq -0x830(%rbp), %rcx
cmpq %rcx, %rax
jne 0x367de
leaq -0x830(%rbp), %rdx
movq 0x474fc(%rip), %rdi     # 0x7dccc
leaq 0x1d651(%rip), %rsi     # 0x53e28
movb $0x0, %al
callq 0x1e110
jmp 0x36982
movl $0x137, %edi            # imm = 0x137
callq 0x35250
movq %rax, -0x10(%rbp)
movq 0x474c8(%rip), %rdi     # 0x7dcc0
movslq -0x14(%rbp), %rax
addq %rax, %rdi
movl 0x474cf(%rip), %eax     # 0x7dcd4
subl -0x14(%rbp), %eax
movslq %eax, %rsi
callq 0x4a340
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
leaq -0x830(%rbp), %rdi
movl -0x4(%rbp), %edx
leaq -0x838(%rbp), %rsi
callq 0x6200
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x838(%rbp), %rax
leaq -0x830(%rbp), %rcx
cmpq %rcx, %rax
jne 0x3686b
leaq -0x830(%rbp), %rdx
movq 0x4746f(%rip), %rdi     # 0x7dccc
leaq 0x1d5eb(%rip), %rsi     # 0x53e4f
movb $0x0, %al
callq 0x1e110
movl $0x0, -0x24(%rbp)
callq 0x35240
addl $-0x42, %eax
movl %eax, %ecx
movq %rcx, -0x850(%rbp)
subl $0x33, %eax
ja 0x36963
movq -0x850(%rbp), %rax
leaq 0x1d14a(%rip), %rcx     # 0x539e4
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpl $0x1, -0x24(%rbp)
jne 0x368be
movq 0x4741c(%rip), %rdi     # 0x7dccc
leaq 0x1d5b8(%rip), %rsi     # 0x53e6f
movb $0x0, %al
callq 0x1e110
callq 0x35290
movl $0x1, -0x24(%rbp)
jmp 0x36872
callq 0x35290
cmpl $0x0, -0x24(%rbp)
je 0x368e4
movq -0x10(%rbp), %rax
movl $0xe, 0x20(%rax)
jmp 0x368ef
movq -0x10(%rbp), %rax
movl $0x8, 0x20(%rax)
jmp 0x36980
callq 0x35290
cmpl $0x0, -0x24(%rbp)
je 0x3690c
movq -0x10(%rbp), %rax
movl $0xd, 0x20(%rax)
jmp 0x36917
movq -0x10(%rbp), %rax
movl $0x7, 0x20(%rax)
jmp 0x36980
callq 0x35290
cmpl $0x0, -0x24(%rbp)
je 0x36931
movq -0x10(%rbp), %rax
movl $0xb, 0x20(%rax)
jmp 0x3693c
movq -0x10(%rbp), %rax
movl $0x5, 0x20(%rax)
jmp 0x36980
callq 0x35290
cmpl $0x0, -0x24(%rbp)
je 0x36956
movq -0x10(%rbp), %rax
movl $0xa, 0x20(%rax)
jmp 0x36961
movq -0x10(%rbp), %rax
movl $0x4, 0x20(%rax)
jmp 0x36980
cmpl $0x0, -0x24(%rbp)
je 0x3697e
movq 0x4735c(%rip), %rdi     # 0x7dccc
leaq 0x1d518(%rip), %rsi     # 0x53e8f
movb $0x0, %al
callq 0x1e110
jmp 0x36980
jmp 0x36982
movq -0x10(%rbp), %rax
addq $0x850, %rsp            # imm = 0x850
popq %rbp
retq
nop