// File: /workspace/github_cpp_makefile_star2_O1/kram[P]kram/./src/parser/parser.cpp
// Function: Parser::keyword_if()
Instruction* Parser::keyword_if() {
	Instruction* ins = new Instruction(Ins::IF);

	ins->center = this->read_until(std::vector<lexer::Token>{
		lexer::Token::OPERATOR("{")
	});

	this->advance();
	ins->left = this->read_until(std::vector<lexer::Token>{
		lexer::Token::OPERATOR("}")
	});

	// Test if there is any "else" part
	this->advance();
	if (this->get_token()->sub != lexer::Type::KEYWORD_ELSE) {
		this->reverse();
		return ins;
	}

	this->advance();
	this->get_and_expect_token(lexer::Token::OPERATOR("{"));

	ins->right = this->read_until(std::vector<lexer::Token>{
		lexer::Token::OPERATOR("}")
	});

	return ins;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
movq %rdi, %r14
movl $0x80, %edi
callq 0x3260
movq %rax, %rbx
movl $0x5, (%rax)
addq $0x18, %rax
movq %rax, 0x8(%rbx)
xorl %eax, %eax
movq %rax, 0x10(%rbx)
movb $0x0, 0x18(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rbx)
movups %xmm0, 0x48(%rbx)
movups %xmm0, 0x58(%rbx)
movups %xmm0, 0x68(%rbx)
movq %rax, 0x78(%rbx)
movl $0x2, 0x30(%rbx)
leaq 0x110(%rsp), %r12
movq %r12, -0x10(%r12)
movw $0x7b, (%r12)
movq $0x1, -0x8(%r12)
leaq 0x30(%rsp), %rdi
leaq 0x100(%rsp), %rsi
callq 0x6d74
leaq 0x88(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0xf(%rsp), %rcx
movl $0x1, %edx
callq 0x11680
leaq 0x10(%rsp), %rdi
leaq 0x88(%rsp), %rdx
movq %r14, %rsi
callq 0xde4a
movq 0x68(%rbx), %rdi
movaps 0x10(%rsp), %xmm0
movq 0x20(%rsp), %rax
movq %rdi, 0x10(%rsp)
movups 0x70(%rbx), %xmm1
movups %xmm0, 0x68(%rbx)
movq %rax, 0x78(%rbx)
movups %xmm1, 0x18(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
testq %rdi, %rdi
je 0x106fb
callq 0x3230
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1070a
callq 0x3230
leaq 0x88(%rsp), %rdi
callq 0x116c2
leaq 0x48(%rsp), %r15
movq -0x10(%r15), %rdi
cmpq %r15, %rdi
je 0x1072a
callq 0x3230
movq 0x100(%rsp), %rdi
cmpq %r12, %rdi
je 0x1073c
callq 0x3230
cmpb $0x1, 0x20(%r14)
jne 0x10749
incl 0x18(%r14)
jmp 0x1074e
movb $0x1, 0x20(%r14)
leaq 0xf0(%rsp), %r12
movq %r12, -0x10(%r12)
movw $0x7d, (%r12)
movq $0x1, -0x8(%r12)
leaq 0x30(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x6d74
leaq 0x70(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0xf(%rsp), %rcx
movl $0x1, %edx
callq 0x11680
leaq 0x10(%rsp), %rdi
leaq 0x70(%rsp), %rdx
movq %r14, %rsi
callq 0xde4a
movq 0x38(%rbx), %rdi
movaps 0x10(%rsp), %xmm0
movq 0x20(%rsp), %rax
movq %rdi, 0x10(%rsp)
movups 0x40(%rbx), %xmm1
movups %xmm0, 0x38(%rbx)
movq %rax, 0x48(%rbx)
movups %xmm1, 0x18(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
testq %rdi, %rdi
je 0x107e7
callq 0x3230
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x107f6
callq 0x3230
leaq 0x70(%rsp), %rdi
callq 0x116c2
movq 0x38(%rsp), %rdi
cmpq %r15, %rdi
je 0x1080f
callq 0x3230
movq 0xe0(%rsp), %rdi
cmpq %r12, %rdi
je 0x10821
callq 0x3230
cmpb $0x1, 0x20(%r14)
jne 0x1082e
incl 0x18(%r14)
jmp 0x10833
movb $0x1, 0x20(%r14)
movslq 0x18(%r14), %rax
movq (%r14), %rcx
movq (%rcx,%rax,8), %rcx
cmpl $0xd, 0x4(%rcx)
jne 0x10853
cmpb $0x1, 0x20(%r14)
jne 0x1085e
incl %eax
movl %eax, 0x18(%r14)
jmp 0x10863
decl %eax
movl %eax, 0x18(%r14)
jmp 0x109a0
movb $0x1, 0x20(%r14)
leaq 0xd0(%rsp), %r12
movq %r12, -0x10(%r12)
movw $0x7b, (%r12)
movq $0x1, -0x8(%r12)
leaq 0x120(%rsp), %rdi
leaq 0xc0(%rsp), %rsi
callq 0x6d74
leaq 0x120(%rsp), %rsi
movq %r14, %rdi
callq 0xf232
leaq 0x138(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x108bb
callq 0x3230
movq 0xc0(%rsp), %rdi
cmpq %r12, %rdi
je 0x108cd
callq 0x3230
leaq 0xb0(%rsp), %r12
movq %r12, -0x10(%r12)
movw $0x7d, (%r12)
movq $0x1, -0x8(%r12)
leaq 0x30(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0x6d74
leaq 0x58(%rsp), %rdi
leaq 0x30(%rsp), %rsi
leaq 0xf(%rsp), %rcx
movl $0x1, %edx
callq 0x11680
leaq 0x10(%rsp), %rdi
leaq 0x58(%rsp), %rdx
movq %r14, %rsi
callq 0xde4a
movq 0x50(%rbx), %rdi
movaps 0x10(%rsp), %xmm0
movq 0x20(%rsp), %rax
movq %rdi, 0x10(%rsp)
movups 0x58(%rbx), %xmm1
movups %xmm0, 0x50(%rbx)
movq %rax, 0x60(%rbx)
movups %xmm1, 0x18(%rsp)
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
testq %rdi, %rdi
je 0x10966
callq 0x3230
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x10975
callq 0x3230
leaq 0x58(%rsp), %rdi
callq 0x116c2
movq 0x38(%rsp), %rdi
cmpq %r15, %rdi
je 0x1098e
callq 0x3230
movq 0xa0(%rsp), %rdi
cmpq %r12, %rdi
je 0x109a0
callq 0x3230
movq %rbx, %rax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x116c2
jmp 0x109c4
movq %rax, %rbx
movq 0x38(%rsp), %rdi
cmpq %r15, %rdi
je 0x109d8
callq 0x3230
jmp 0x109d8
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
jmp 0x10a72
movq %rax, %rbx
leaq 0x138(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x10a03
callq 0x3230
jmp 0x10a03
movq %rax, %rbx
movq 0xc0(%rsp), %rdi
jmp 0x10a72
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x116c2
jmp 0x10a1f
movq %rax, %rbx
movq 0x38(%rsp), %rdi
cmpq %r15, %rdi
je 0x10a33
callq 0x3230
jmp 0x10a33
movq %rax, %rbx
movq 0xe0(%rsp), %rdi
jmp 0x10a72
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x116c2
jmp 0x10a52
movq %rax, %rbx
leaq 0x48(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x10a6a
callq 0x3230
jmp 0x10a6a
movq %rax, %rbx
movq 0x100(%rsp), %rdi
cmpq %r12, %rdi
je 0x10a7c
callq 0x3230
movq %rbx, %rdi
callq 0x33c0