// File: pranavmodx[P]modlang/src/../header/builtins.hpp
// Function: Len(std::vector<Object*, std::allocator<Object*>>&)
Object *Len(std::vector<Object *> &objs)
{
	if (objs.size() != 1)
		return new Error("error: argument length (" + std::to_string(objs.size()) + ") not equal to parameter length (1)");

	Object *obj = objs[0];
	ObjectType type = obj->type();

	if (type == ERROR_OBJ)
		return obj;

	else if (type == STRING_OBJ)
		return new Integer(((String *)obj)->value.size());

	else if (type == ARRAY_OBJ)
		return new Integer(((Array *)obj)->elements.size());

	else if (type == HASHMAP_OBJ)
		return new Integer(((HashMap *)obj)->pairs.size());

	return new Error("error: unsupported object for len()");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x110, %rsp            # imm = 0x110
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rdi
callq 0x373f0
cmpq $0x1, %rax
je 0x2cf6a
movl $0x28, %edi
callq 0x52a0
movq %rax, -0xe0(%rbp)
movb $0x1, -0x7d(%rbp)
movq -0x10(%rbp), %rdi
callq 0x373f0
movq %rax, %rsi
leaq -0x70(%rbp), %rdi
callq 0x37410
jmp 0x2ce8e
leaq 0x18a84(%rip), %rsi     # 0x45919
leaq -0x50(%rbp), %rdi
leaq -0x70(%rbp), %rdx
callq 0x1bde0
jmp 0x2cea4
leaq 0x18a87(%rip), %rdx     # 0x45932
leaq -0x30(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x1bb10
jmp 0x2ceba
movq -0xe0(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x2b980
jmp 0x2cecc
movq -0xe0(%rbp), %rax
movb $0x0, -0x7d(%rbp)
movq %rax, -0x8(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x5518
leaq -0x50(%rbp), %rdi
callq 0x5518
leaq -0x70(%rbp), %rdi
callq 0x5518
jmp 0x2d279
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x2cf4c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x2cf43
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x2cf3a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x5518
leaq -0x50(%rbp), %rdi
callq 0x5518
leaq -0x70(%rbp), %rdi
callq 0x5518
testb $0x1, -0x7d(%rbp)
jne 0x2cf54
jmp 0x2cf65
movq -0xe0(%rbp), %rdi
movl $0x28, %esi
callq 0x52b0
jmp 0x2d286
movq -0x10(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x374f0
movq (%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rsi
movq (%rsi), %rax
leaq -0xa8(%rbp), %rdi
callq *(%rax)
leaq -0xa8(%rbp), %rdi
leaq 0x3a45e(%rip), %rsi     # 0x67400
callq 0x16920
testb $0x1, %al
jne 0x2cfad
jmp 0x2cfc7
movq -0x88(%rbp), %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0xac(%rbp)
jmp 0x2d25d
leaq -0xa8(%rbp), %rdi
leaq 0x3a28b(%rip), %rsi     # 0x67260
callq 0x16920
testb $0x1, %al
jne 0x2cfe3
jmp 0x2d063
movl $0x10, %edi
callq 0x52a0
movq %rax, -0xe8(%rbp)
jmp 0x2cff6
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x51d0
movq -0xe8(%rbp), %rdi
movl %eax, %esi
callq 0x37510
jmp 0x2d016
movq -0xe8(%rbp), %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0xac(%rbp)
jmp 0x2d25d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x2d26b
movq -0xe8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
movl $0x10, %esi
callq 0x52b0
jmp 0x2d26b
leaq -0xa8(%rbp), %rdi
leaq 0x3a22f(%rip), %rsi     # 0x672a0
callq 0x16920
testb $0x1, %al
jne 0x2d07c
jmp 0x2d0eb
movl $0x10, %edi
callq 0x52a0
movq %rax, -0xf0(%rbp)
jmp 0x2d08f
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x373f0
movq -0xf0(%rbp), %rdi
movl %eax, %esi
callq 0x37510
jmp 0x2d0af
movq -0xf0(%rbp), %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0xac(%rbp)
jmp 0x2d25d
movq -0xf0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
movl $0x10, %esi
callq 0x52b0
jmp 0x2d26b
leaq -0xa8(%rbp), %rdi
leaq 0x3a1c7(%rip), %rsi     # 0x672c0
callq 0x16920
testb $0x1, %al
jne 0x2d104
jmp 0x2d173
movl $0x10, %edi
callq 0x52a0
movq %rax, -0xf8(%rbp)
jmp 0x2d117
movq -0x88(%rbp), %rdi
addq $0x8, %rdi
callq 0x37560
movq -0xf8(%rbp), %rdi
movl %eax, %esi
callq 0x37510
jmp 0x2d137
movq -0xf8(%rbp), %rax
movq %rax, -0x8(%rbp)
movl $0x1, -0xac(%rbp)
jmp 0x2d25d
movq -0xf8(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
movl $0x10, %esi
callq 0x52b0
jmp 0x2d26b
jmp 0x2d175
jmp 0x2d177
jmp 0x2d179
movl $0x28, %edi
callq 0x52a0
movq %rax, -0x100(%rbp)
jmp 0x2d18c
movb $0x1, -0xd2(%rbp)
leaq -0xd1(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0x54a0
movq -0x108(%rbp), %rdx
leaq 0x187a2(%rip), %rsi     # 0x45956
leaq -0xd0(%rbp), %rdi
callq 0x134c0
jmp 0x2d1c2
movq -0x100(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
callq 0x2b980
jmp 0x2d1d7
movq -0x100(%rbp), %rax
movb $0x0, -0xd2(%rbp)
movq %rax, -0x8(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x5518
leaq -0xd1(%rbp), %rdi
callq 0x52f0
movl $0x1, -0xac(%rbp)
jmp 0x2d25d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0x2d233
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x5518
leaq -0xd1(%rbp), %rdi
callq 0x52f0
testb $0x1, -0xd2(%rbp)
jne 0x2d24a
jmp 0x2d25b
movq -0x100(%rbp), %rdi
movl $0x28, %esi
callq 0x52b0
jmp 0x2d26b
leaq -0xa8(%rbp), %rdi
callq 0x5518
jmp 0x2d279
leaq -0xa8(%rbp), %rdi
callq 0x5518
jmp 0x2d286
movq -0x8(%rbp), %rax
addq $0x110, %rsp            # imm = 0x110
popq %rbp
retq
movq -0x78(%rbp), %rdi
callq 0x5490
nop