// File: Alcaro[P]bridges/game.cpp
// Function: (anonymous namespace)::game_impl::game_load(int, bool)
void game_load(int id, bool use_kb)
	{
		map_id = id;
		if (id < 30)
		{
			map.init(game_maps[id]);
			tileset = id/10;
		}
		else
		{
			gamemap::genparams p = game_params(id);
#ifdef ARLIB_THREAD
			if (gamegen_next[id-100])
			{
				gamemap::generator::unpack(p, gamegen_next[id-100], map);
				gamegen_next[id-100] = 0;
			}
			else // this can only happen if player enters a map, leaves, and reenters, within half a second (or savefile is corrupt)
			     // getting a generator delay is suboptimal, but unavoidable, and no human can click that fast
#endif
				map.generate(p);
			map.reset();
			
			tileset = id-100;
		}
		
		popup_id = pop_none;
		popup_frame = 0;
		if (id == 0) popup_id = pop_tutor1;
		if (id == 5) popup_id = pop_lv6p1;
		if (id == 10) popup_id = pop_lv11;
		if (id >= 100 && !seen_random_tutorial)
		{
			seen_random_tutorial = true;
			popup_id = pop_tutorrandom1;
		}
		
		birdfg.reset(false);
		
		game_kb_state = use_kb ? 1 : 0;
		game_kb_x = 0;
		game_kb_y = 0;
		
		recent_change = true;
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movb %dl, %al
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
andb $0x1, %al
movb %al, -0xd(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movl -0xc(%rbp), %ecx
movl %ecx, 0x24a70(%rax)
cmpl $0x1e, -0xc(%rbp)
jge 0x4d272
movq -0x48(%rbp), %rdi
addq $0x68, %rdi
movslq -0xc(%rbp), %rcx
leaq 0x33660(%rip), %rax     # 0x808b0
movq (%rax,%rcx,8), %rsi
callq 0x4e9f0
movl -0xc(%rbp), %eax
movl $0xa, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movq -0x48(%rbp), %rax
movl %ecx, 0x48(%rax)
jmp 0x4d30a
movq -0x48(%rbp), %rsi
movl -0xc(%rbp), %edx
leaq -0x40(%rbp), %rdi
callq 0x4c810
movq -0x48(%rbp), %rax
movl -0xc(%rbp), %ecx
subl $0x64, %ecx
movslq %ecx, %rcx
cmpq $0x0, 0x24a80(%rax,%rcx,8)
je 0x4d2d6
movq -0x48(%rbp), %rdx
movl -0xc(%rbp), %eax
subl $0x64, %eax
cltq
movq 0x24a80(%rdx,%rax,8), %rsi
addq $0x68, %rdx
leaq -0x40(%rbp), %rdi
callq 0x52560
movq -0x48(%rbp), %rax
movl -0xc(%rbp), %ecx
subl $0x64, %ecx
movslq %ecx, %rcx
movq $0x0, 0x24a80(%rax,%rcx,8)
jmp 0x4d2e7
movq -0x48(%rbp), %rdi
addq $0x68, %rdi
leaq -0x40(%rbp), %rsi
callq 0x4e870
movq -0x48(%rbp), %rdi
addq $0x68, %rdi
callq 0x4f3c0
movq -0x48(%rbp), %rax
movl -0xc(%rbp), %ecx
subl $0x64, %ecx
movl %ecx, 0x48(%rax)
leaq -0x40(%rbp), %rdi
callq 0x4e710
movq -0x48(%rbp), %rax
movl $0x0, 0x24ac4(%rax)
movl $0x0, 0x24ac8(%rax)
cmpl $0x0, -0xc(%rbp)
jne 0x4d336
movq -0x48(%rbp), %rax
movl $0x3, 0x24ac4(%rax)
cmpl $0x5, -0xc(%rbp)
jne 0x4d34a
movq -0x48(%rbp), %rax
movl $0x7, 0x24ac4(%rax)
cmpl $0xa, -0xc(%rbp)
jne 0x4d35e
movq -0x48(%rbp), %rax
movl $0x9, 0x24ac4(%rax)
cmpl $0x64, -0xc(%rbp)
jl 0x4d386
movq -0x48(%rbp), %rax
testb $0x1, 0x24acd(%rax)
jne 0x4d386
movq -0x48(%rbp), %rax
movb $0x1, 0x24acd(%rax)
movl $0xd, 0x24ac4(%rax)
movq -0x48(%rbp), %rdi
addq $0x50, %rdi
xorl %esi, %esi
callq 0x4c910
movq -0x48(%rbp), %rax
movb -0xd(%rbp), %sil
xorl %ecx, %ecx
movl $0x1, %edx
testb $0x1, %sil
cmovnel %edx, %ecx
movb %cl, 0x24ac1(%rax)
movl $0x0, 0x24ab8(%rax)
movl $0x0, 0x24abc(%rax)
movb $0x1, 0x21(%rax)
addq $0x50, %rsp
popq %rbp
retq
nop