// File: pixlark[P]Badge/src/compiler.cc
// Function: Compiler::compile_stmt(Stmt*)
void compile_stmt(Stmt * stmt)
	{
		switch (stmt->kind) {
		case STMT_LET:
			compile_expr(stmt->let.right);
			push(BC::create(BC_LOAD_CONST,
							Value::raise(stmt->let.left),
							stmt->assoc));
			push(BC::create(BC_CREATE_BINDING,
							stmt->assoc));
			break;
		case STMT_SET: {
			compile_expr(stmt->set.right);
			// Deal with l-expr
			auto left = stmt->set.left;
			switch (left->kind) {
			case EXPR_VARIABLE:
				// Simple variable binding
				push(BC::create(BC_LOAD_CONST,
								Value::raise(left->variable),
								stmt->assoc));
				push(BC::create(BC_UPDATE_BINDING,
								stmt->assoc));
				break;
			case EXPR_FIELD:
				// Field of an object
				compile_expr(left->field.left);
				push(BC::create(BC_LOAD_CONST,
								Value::raise(left->field.right),
								stmt->assoc));
				push(BC::create(BC_UPDATE_FIELD,
								stmt->assoc));
				break;
			default:
				fatal_assoc(left->assoc, "Invalid l-expression");
			}
		} break;
		case STMT_RETURN:
			compile_expr(stmt->_return.expr);
			push(BC::create(BC_RETURN, stmt->assoc));
			break;
		case STMT_EXPR:
			compile_expr(stmt->expr);
			push(BC::create(BC_POP_AND_DISCARD, stmt->assoc));
			break;
		case STMT_BREAK:
			compile_expr(stmt->expr);
			push(BC::create(BC_BREAK_BODY, stmt->assoc));
			break;
		}
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x130(%rbp)
movq -0x10(%rbp), %rax
movl (%rax), %eax
movq %rax, -0x128(%rbp)
subq $0x4, %rax
ja 0x7f66
movq -0x128(%rbp), %rax
leaq 0x871d(%rip), %rcx      # 0x102f0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x130(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0xa650
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xbf40
movl %eax, -0x38(%rbp)
movq %rdx, -0x30(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %r8d
movl -0x38(%rbp), %edx
movq -0x30(%rbp), %rcx
leaq -0x28(%rbp), %rdi
movl $0x2, %esi
callq 0x7fd0
movq -0x130(%rbp), %rdi
leaq -0x28(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7f70
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edx
leaq -0x50(%rbp), %rdi
movl $0x4, %esi
callq 0xbf70
movq -0x130(%rbp), %rdi
leaq -0x50(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7f70
jmp 0x7f66
movq -0x130(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rsi
callq 0xa650
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x134(%rbp)
subl $0x3, %eax
je 0x7cd4
jmp 0x7cc0
movl -0x134(%rbp), %eax
subl $0xc, %eax
je 0x7d77
jmp 0x7e3d
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0xbf40
movl %eax, -0x80(%rbp)
movq %rdx, -0x78(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %r8d
movl -0x80(%rbp), %edx
movq -0x78(%rbp), %rcx
leaq -0x70(%rbp), %rdi
movl $0x2, %esi
callq 0x7fd0
movq -0x130(%rbp), %rdi
leaq -0x70(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7f70
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edx
leaq -0x98(%rbp), %rdi
movl $0x5, %esi
callq 0xbf70
movq -0x130(%rbp), %rdi
leaq -0x98(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7f70
jmp 0x7e52
movq -0x130(%rbp), %rdi
movq -0x58(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0xa650
movq -0x58(%rbp), %rax
movq 0x10(%rax), %rdi
callq 0xbf40
movl %eax, -0xc0(%rbp)
movq %rdx, -0xb8(%rbp)
movq -0x10(%rbp), %rax
movl 0x4(%rax), %r8d
movl -0xc0(%rbp), %edx
movq -0xb8(%rbp), %rcx
leaq -0xb0(%rbp), %rdi
movl $0x2, %esi
callq 0x7fd0
movq -0x130(%rbp), %rdi
leaq -0xb0(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7f70
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edx
leaq -0xd8(%rbp), %rdi
movl $0x20, %esi
callq 0xbf70
movq -0x130(%rbp), %rdi
leaq -0xd8(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7f70
jmp 0x7e52
movq -0x58(%rbp), %rax
movl 0x4(%rax), %edi
leaq 0x8df6(%rip), %rsi      # 0x10c41
movb $0x0, %al
callq 0x1f40
jmp 0x7f66
movq -0x130(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0xa650
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edx
leaq -0xf0(%rbp), %rdi
movl $0x14, %esi
callq 0xbf70
movq -0x130(%rbp), %rdi
leaq -0xf0(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7f70
jmp 0x7f66
movq -0x130(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0xa650
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edx
leaq -0x108(%rbp), %rdi
movl $0x1, %esi
callq 0xbf70
movq -0x130(%rbp), %rdi
leaq -0x108(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7f70
jmp 0x7f66
movq -0x130(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rsi
callq 0xa650
movq -0x10(%rbp), %rax
movl 0x4(%rax), %edx
leaq -0x120(%rbp), %rdi
movl $0x22, %esi
callq 0xbf70
movq -0x130(%rbp), %rdi
leaq -0x120(%rbp), %rax
movq (%rax), %rcx
movq %rcx, (%rsp)
movq 0x8(%rax), %rcx
movq %rcx, 0x8(%rsp)
movq 0x10(%rax), %rax
movq %rax, 0x10(%rsp)
callq 0x7f70
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq
nop