// File: /workspace/github_c_makefile_star2_O0/phluid61[P]hsf/src/token.c
// Function: SH_Token__init
SH_Token*
SH_Token__init(sh_char_t* value, size_t n, int* err) {
	SH_Token* obj;
	sh_char_t* ptr;
	sh_char_t  c;
	size_t m;

	__cascade(err, (SH_Token*)0);

	if (n < 1 || n > SH_TOKEN_LENGTH_MAX) {
		__raise(err, SH_E_TOKEN_TOO_LONG);
		return (SH_Token*)0;
	}

	c = *value;
	if (!LEGIT_START(c)) {
		__raise(err, SH_E_TOKEN_BAD_CHAR);
		return (SH_Token*)0;
	}

	ptr = value;
	m = 0;
	while (m < n) {
		c = *ptr;
		if (LEGIT(c)) {
			ptr++;
			m++;
		} else {
			__raise(err, SH_E_TOKEN_BAD_CHAR);
			return (SH_Token*)0;
		}
	}

	obj = (SH_Token*)malloc(sizeof(SH_Token));
	if ((SH_Token*)0 == obj) {
		__raise(err, SH_E_MALLOC_ERROR);
		return (SH_Token*)0;
	}

	obj->value = (sh_char_t*)malloc(sizeof(sh_char_t) * (m + 1));
	if ((sh_char_t*)0 == obj->value) {
		free(obj);
		__raise(err, SH_E_MALLOC_ERROR);
		return (SH_Token*)0;
	}

	memcpy((void*)obj->value, (const void*)value, m);
	obj->value[m] = SH_CHAR_C(0);
	obj->length = m;

	__clear(err);
	return obj;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
je 0x1163
movq -0x20(%rbp), %rcx
xorl %eax, %eax
cmpl (%rcx), %eax
je 0x1163
movq $0x0, -0x8(%rbp)
jmp 0x1391
cmpq $0x1, -0x18(%rbp)
jb 0x1174
cmpq $0x200, -0x18(%rbp)     # imm = 0x200
jbe 0x1193
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
je 0x1186
movq -0x20(%rbp), %rax
movl $0x140001, (%rax)       # imm = 0x140001
movq $0x0, -0x8(%rbp)
jmp 0x1391
movq -0x10(%rbp), %rax
movb (%rax), %al
movb %al, -0x31(%rbp)
movzbl -0x31(%rbp), %eax
cmpl $0x40, %eax
jl 0x11cd
movzbl -0x31(%rbp), %eax
subl $0x40, %eax
movl %eax, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movabsq $0x7fffffe07fffffe, %rcx # imm = 0x7FFFFFE07FFFFFE
andq %rcx, %rax
cmpq $0x0, %rax
jne 0x120f
jmp 0x11f0
movzbl -0x31(%rbp), %eax
movl %eax, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movabsq $0x40000000000, %rcx    # imm = 0x40000000000
andq %rcx, %rax
cmpq $0x0, %rax
jne 0x120f
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
je 0x1202
movq -0x20(%rbp), %rax
movl $0x140002, (%rax)       # imm = 0x140002
movq $0x0, -0x8(%rbp)
jmp 0x1391
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x18(%rbp), %rax
jae 0x12c8
movq -0x30(%rbp), %rax
movb (%rax), %al
movb %al, -0x31(%rbp)
movzbl -0x31(%rbp), %eax
cmpl $0x40, %eax
jl 0x1267
movzbl -0x31(%rbp), %eax
subl $0x40, %eax
movl %eax, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movabsq $0x57ffffffc7fffffe, %rcx # imm = 0x57FFFFFFC7FFFFFE
andq %rcx, %rax
cmpq $0x0, %rax
jne 0x128a
jmp 0x12a4
movzbl -0x31(%rbp), %eax
movl %eax, %eax
movl %eax, %ecx
movl $0x1, %eax
shlq %cl, %rax
movabsq $0x7ffecfa00000000, %rcx # imm = 0x7FFECFA00000000
andq %rcx, %rax
cmpq $0x0, %rax
je 0x12a4
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
jmp 0x12c3
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
je 0x12b6
movq -0x20(%rbp), %rax
movl $0x140002, (%rax)       # imm = 0x140002
movq $0x0, -0x8(%rbp)
jmp 0x1391
jmp 0x121f
movl $0x10, %edi
callq 0x1050
movq %rax, -0x28(%rbp)
xorl %eax, %eax
cmpq -0x28(%rbp), %rax
jne 0x12fd
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
je 0x12f0
movq -0x20(%rbp), %rax
movl $0x80000001, (%rax)     # imm = 0x80000001
movq $0x0, -0x8(%rbp)
jmp 0x1391
movq -0x40(%rbp), %rdi
addq $0x1, %rdi
shlq $0x0, %rdi
callq 0x1050
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rcx
xorl %eax, %eax
cmpq (%rcx), %rax
jne 0x1348
movq -0x28(%rbp), %rdi
callq 0x1030
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
je 0x133e
movq -0x20(%rbp), %rax
movl $0x80000001, (%rax)     # imm = 0x80000001
movq $0x0, -0x8(%rbp)
jmp 0x1391
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rsi
movq -0x40(%rbp), %rdx
callq 0x1040
movq -0x28(%rbp), %rax
movq (%rax), %rax
movq -0x40(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x40(%rbp), %rcx
movq -0x28(%rbp), %rax
movq %rcx, 0x8(%rax)
xorl %eax, %eax
cmpq -0x20(%rbp), %rax
je 0x1389
movq -0x20(%rbp), %rax
movl $0x0, (%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x40, %rsp
popq %rbp
retq
nopl (%rax,%rax)