// File: kram[P]kram/./src/vm/libraries/std/String.h
// Function: String::at(Value*, std::vector<Value*, std::allocator<Value*>>)
static Value* at(Value* self, std::vector<Value*> val) {
		std::string full_string = val[0]->getString();
		char* c_str = (char*) full_string.c_str();

		char* str_iterator = c_str;
		char* str_end = c_str + strlen(c_str) + 1;

		int length = utf8::distance(str_iterator, str_end);

		// Do not include NUL
		--length;

		int get_char_at = val[1]->getNumber();

		if (get_char_at >= length) {
			std::cout << "String::At() expects a number smaller than the lenght of the string\n";
			exit(0);
		}

		for (int i = 0; i < get_char_at; i++) {
			utf8::next(str_iterator, str_end);
		}

		auto res = utf8::next(str_iterator, str_end);
		return new Value(Type::STRING, utf8chr(res));

		std::cout << "String::At() failed\n";
		exit(0);

		return new Value(Type::NUL);
	}

// Assembly:
subq $0xd8, %rsp
movq %rsi, 0x20(%rsp)
movq %rdi, %rax
movq 0x20(%rsp), %rdi
movq %rdi, 0x28(%rsp)
movq %rax, 0xd0(%rsp)
movq %rdi, 0xc8(%rsp)
xorl %eax, %eax
movl %eax, %esi
callq 0x16fe0
movq (%rax), %rsi
leaq 0xa8(%rsp), %rdi
movq %rdi, 0x30(%rsp)
callq 0x1e9e0
movq 0x30(%rsp), %rdi
callq 0x3130
movq %rax, 0xa0(%rsp)
movq 0xa0(%rsp), %rax
movq %rax, 0x98(%rsp)
movq 0xa0(%rsp), %rdi
movq %rdi, 0x38(%rsp)
callq 0x3150
movq %rax, %rcx
movq 0x38(%rsp), %rax
leaq 0x1(%rax,%rcx), %rax
movq %rax, 0x90(%rsp)
movq 0x98(%rsp), %rdi
movq 0x90(%rsp), %rsi
callq 0x18c50
movq %rax, 0x40(%rsp)
jmp 0x18a9c
movq 0x28(%rsp), %rdi
movq 0x40(%rsp), %rax
movl %eax, 0x8c(%rsp)
movl 0x8c(%rsp), %eax
decl %eax
movl %eax, 0x8c(%rsp)
movl $0x1, %esi
callq 0x16fe0
movq (%rax), %rdi
callq 0x1ea10
movsd %xmm0, 0x18(%rsp)
jmp 0x18ad7
movsd 0x18(%rsp), %xmm0
cvttsd2si %xmm0, %eax
movl %eax, 0x78(%rsp)
movl 0x78(%rsp), %eax
cmpl 0x8c(%rsp), %eax
jl 0x18b24
movq 0x214df(%rip), %rdi     # 0x39fd8
leaq 0x12fb0(%rip), %rsi     # 0x2bab0
callq 0x32d0
jmp 0x18b07
xorl %edi, %edi
callq 0x3330
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x80(%rsp)
movl %eax, 0x7c(%rsp)
jmp 0x18c27
movl $0x0, 0x74(%rsp)
movl 0x74(%rsp), %eax
cmpl 0x78(%rsp), %eax
jge 0x18b5c
movq 0x90(%rsp), %rsi
leaq 0x98(%rsp), %rdi
callq 0x18ca0
jmp 0x18b4d
jmp 0x18b4f
movl 0x74(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x74(%rsp)
jmp 0x18b2c
movq 0x90(%rsp), %rsi
leaq 0x98(%rsp), %rdi
callq 0x18ca0
movl %eax, 0x14(%rsp)
jmp 0x18b77
movl 0x14(%rsp), %eax
movl %eax, 0x70(%rsp)
movl $0x10, %edi
callq 0x32e0
movq %rax, 0x8(%rsp)
jmp 0x18b90
movb $0x1, 0x4f(%rsp)
movl 0x70(%rsp), %esi
leaq 0x50(%rsp), %rdi
callq 0xff60
jmp 0x18ba5
movq 0x8(%rsp), %rdi
movl $0x1, %esi
leaq 0x50(%rsp), %rdx
callq 0x1df60
jmp 0x18bbb
movb $0x0, 0x4f(%rsp)
leaq 0x50(%rsp), %rdi
callq 0x31f0
leaq 0xa8(%rsp), %rdi
callq 0x31f0
movq 0x8(%rsp), %rax
addq $0xd8, %rsp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x80(%rsp)
movl %eax, 0x7c(%rsp)
jmp 0x18c12
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x80(%rsp)
movl %eax, 0x7c(%rsp)
leaq 0x50(%rsp), %rdi
callq 0x31f0
testb $0x1, 0x4f(%rsp)
jne 0x18c1b
jmp 0x18c25
movq 0x8(%rsp), %rdi
callq 0x32b0
jmp 0x18c27
leaq 0xa8(%rsp), %rdi
callq 0x31f0
movq 0x80(%rsp), %rdi
callq 0x3490
nopw %cs:(%rax,%rax)
nopl (%rax,%rax)