// File: pranavmodx[P]modlang/src/parser.cpp
// Function: Parser::parseIntegerLiteral()
Expression *Parser::parseIntegerLiteral()
{
	IntegerLiteral *intLit = new IntegerLiteral();
	intLit->token = curToken;

	try
	{
		intLit->value = std::stoi(curToken.literal);
	}
	catch (const std::invalid_argument e)
	{
		errors.push_back("error: cannot parse " + curToken.literal + " to int");
		return nullptr;
	}
	catch (const std::out_of_range e)
	{
		errors.push_back("error: the integer " + curToken.literal + " is out of range");
		return nullptr;
	}

	return intLit;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xd8(%rbp)
movl $0x50, %edi
callq 0x52a0
movq %rax, %rdi
movq %rdi, %rax
movq %rax, -0xd0(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x10(%rdi)
movaps %xmm0, (%rdi)
callq 0x232d0
jmp 0x1f54e
movq -0xd8(%rbp), %rsi
movq -0xd0(%rbp), %rax
movq %rax, -0x18(%rbp)
addq $0x30, %rsi
movq -0x18(%rbp), %rdi
addq $0x8, %rdi
callq 0x22d00
movq -0xd8(%rbp), %rdi
addq $0x50, %rdi
xorl %eax, %eax
movl %eax, %esi
movl $0xa, %edx
callq 0x23330
movl %eax, -0xdc(%rbp)
jmp 0x1f592
movl -0xdc(%rbp), %ecx
movq -0x18(%rbp), %rax
movl %ecx, 0x48(%rax)
jmp 0x1f808
movq -0xd0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl $0x50, %esi
callq 0x52b0
jmp 0x1f81d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0xe0(%rbp)
movl $0x2, %ecx
cmpl %ecx, %eax
jne 0x1f6aa
movq -0x20(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0x5360
movq %rax, %rsi
leaq -0x88(%rbp), %rdi
callq 0x233b0
movq -0xf0(%rbp), %rdi
callq 0x5110
movq -0xd8(%rbp), %rdx
movq %rdx, %rax
addq $0xb0, %rax
movq %rax, -0xe8(%rbp)
addq $0x50, %rdx
leaq 0x26134(%rip), %rsi     # 0x45769
leaq -0xc8(%rbp), %rdi
callq 0x1bc80
jmp 0x1f643
leaq 0x26134(%rip), %rdx     # 0x4577e
leaq -0xa8(%rbp), %rdi
leaq -0xc8(%rbp), %rsi
callq 0x1bb10
jmp 0x1f65f
movq -0xe8(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
callq 0x22f40
jmp 0x1f674
leaq -0xa8(%rbp), %rdi
callq 0x5518
leaq -0xc8(%rbp), %rdi
callq 0x5518
movq $0x0, -0x8(%rbp)
leaq -0x88(%rbp), %rdi
callq 0x5450
callq 0x5440
jmp 0x1f810
movl -0xe0(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0x1f81d
movq -0x20(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x5360
movq %rax, %rsi
leaq -0x38(%rbp), %rdi
callq 0x23370
movq -0x100(%rbp), %rdi
callq 0x5110
movq -0xd8(%rbp), %rdx
movq %rdx, %rax
addq $0xb0, %rax
movq %rax, -0xf8(%rbp)
addq $0x50, %rdx
leaq 0x2603d(%rip), %rsi     # 0x45744
leaq -0x78(%rbp), %rdi
callq 0x1bc80
jmp 0x1f712
leaq 0x2603f(%rip), %rdx     # 0x45758
leaq -0x58(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x1bb10
jmp 0x1f728
movq -0xf8(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x22f40
jmp 0x1f73a
leaq -0x58(%rbp), %rdi
callq 0x5518
leaq -0x78(%rbp), %rdi
callq 0x5518
movq $0x0, -0x8(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x53b0
callq 0x5440
jmp 0x1f810
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x1f7a1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x1f798
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x5518
leaq -0x78(%rbp), %rdi
callq 0x5518
leaq -0x38(%rbp), %rdi
callq 0x53b0
callq 0x5440
jmp 0x1f7b1
jmp 0x1f81d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x1f7f3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
jmp 0x1f7e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x20(%rbp)
movl %eax, -0x24(%rbp)
leaq -0xa8(%rbp), %rdi
callq 0x5518
leaq -0xc8(%rbp), %rdi
callq 0x5518
leaq -0x88(%rbp), %rdi
callq 0x5450
callq 0x5440
jmp 0x1f806
jmp 0x1f81d
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0x20(%rbp), %rdi
callq 0x5490
movq %rax, %rdi
callq 0x13ae0
nop