// File: /workspace/github_cpp_makefile_star2_O1/Alcaro[P]bridges/game.cpp
// Function: (anonymous namespace)::birds::draw(image&, image const&, int)
void draw(image& out, const image& birdsmap, int tileset)
	{
		if (tileset == 2) return; // no birds in the snow region
		
		image bird;
		int animframe = frame/10 & 1;
		bird.init_ref_sub(birdsmap, animframe*8, tileset*6, 8, 6);
		
		int x = xmid + cosf(angle)*spd*frame;
		int y = ymid + sinf(angle)*spd*frame;
		
		for (int n=0;n<5;n++)
		{
			out.insert(x + cosf(angle + flock_angle_rad)*n*flock_dist, y + sinf(angle + flock_angle_rad)*n*flock_dist, bird);
			out.insert(x + cosf(angle - flock_angle_rad)*n*flock_dist, y + sinf(angle - flock_angle_rad)*n*flock_dist, bird);
		}
		
		frame++;
		
		//if outside the screen and distance increasing, reset them
		if (frame > 800/spd)
			reset(false);
	}

// Assembly:
cmpl $0x2, %edx
je 0x227c3
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x50, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movslq 0xc(%rdi), %rax
imulq $0x66666667, %rax, %rax # imm = 0x66666667
movq %rax, %rcx
shrq $0x3f, %rcx
shrq $0x22, %rax
addl %ecx, %eax
shll $0x3, %eax
andl $0x8, %eax
leaq 0x23aa0(%rip), %rsi     # 0x460a0
movl 0x8(%rsi), %ecx
movl 0xc(%rsi), %edi
imull %edi, %edx
leaq 0x38(%rsp), %r15
movl %ecx, 0x8(%r15)
movl %edi, 0xc(%r15)
addl %ecx, %ecx
movl $0x157fff8, %edi        # imm = 0x157FFF8
shrl %cl, %edi
andl $0x3, %edi
incl %edi
imull %eax, %edi
leal (%rdx,%rdx,2), %eax
leal (%rdi,%rax,2), %eax
addq 0x10(%rsi), %rax
movq %rax, 0x10(%r15)
movabsq $0x600000008, %rax      # imm = 0x600000008
movq %rax, (%r15)
movss (%rbx), %xmm0
movss %xmm0, (%rsp)
movss 0x8(%rbx), %xmm0
callq 0x3240
mulss 0xf5eb(%rip), %xmm0     # 0x31c48
cvtsi2ssl 0xc(%rbx), %xmm1
mulss %xmm0, %xmm1
addss (%rsp), %xmm1
movaps %xmm1, (%rsp)
movss 0x4(%rbx), %xmm0
movss %xmm0, 0x10(%rsp)
movss 0x8(%rbx), %xmm0
callq 0x32a0
xorps %xmm1, %xmm1
cvtsi2ssl 0xc(%rbx), %xmm1
mulss 0xf5b4(%rip), %xmm0     # 0x31c48
mulss %xmm0, %xmm1
addss 0x10(%rsp), %xmm1
cvttps2dq (%rsp), %xmm0
cvtdq2ps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
cvttps2dq %xmm1, %xmm0
cvtdq2ps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
xorl %r12d, %r12d
movss 0x8(%rbx), %xmm0
movss 0xf585(%rip), %xmm1     # 0x31c4c
addss %xmm1, %xmm0
callq 0x3240
xorps %xmm1, %xmm1
cvtsi2ss %r12d, %xmm1
movss %xmm1, (%rsp)
mulss %xmm1, %xmm0
movss 0xf567(%rip), %xmm1     # 0x31c50
mulss %xmm1, %xmm0
addss 0x10(%rsp), %xmm0
cvttss2si %xmm0, %ebp
movss 0x8(%rbx), %xmm0
addss 0xf548(%rip), %xmm0     # 0x31c4c
callq 0x32a0
mulss (%rsp), %xmm0
mulss 0xf53a(%rip), %xmm0     # 0x31c50
addss 0x20(%rsp), %xmm0
cvttss2si %xmm0, %edx
movq %r14, %rdi
movl %ebp, %esi
movq %r15, %rcx
callq 0xbb06
movss 0x8(%rbx), %xmm0
movss 0xf51a(%rip), %xmm1     # 0x31c54
addss %xmm1, %xmm0
callq 0x3240
mulss (%rsp), %xmm0
mulss 0xf500(%rip), %xmm0     # 0x31c50
addss 0x10(%rsp), %xmm0
cvttss2si %xmm0, %ebp
movss 0x8(%rbx), %xmm0
addss 0xf4ed(%rip), %xmm0     # 0x31c54
callq 0x32a0
mulss (%rsp), %xmm0
mulss 0xf4d7(%rip), %xmm0     # 0x31c50
addss 0x20(%rsp), %xmm0
cvttss2si %xmm0, %edx
movq %r14, %rdi
movl %ebp, %esi
movq %r15, %rcx
callq 0xbb06
incl %r12d
cmpl $0x5, %r12d
jne 0x226ba
movl 0xc(%rbx), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0xc(%rbx)
cmpl $0xc7, %eax
jle 0x227b7
movq %rbx, %rdi
xorl %esi, %esi
callq 0x223ec
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq