// File: /workspace/github_cpp_makefile_star2_O3/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 0x22427
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 0x23e3c(%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 0xfa27(%rip), %xmm0     # 0x31ce8
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 0xf9f0(%rip), %xmm0     # 0x31ce8
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 0xf9c1(%rip), %xmm1     # 0x31cec
addss %xmm1, %xmm0
callq 0x3240
xorps %xmm1, %xmm1
cvtsi2ss %r12d, %xmm1
movss %xmm1, (%rsp)
mulss %xmm1, %xmm0
movss 0xf9a3(%rip), %xmm1     # 0x31cf0
mulss %xmm1, %xmm0
addss 0x10(%rsp), %xmm0
cvttss2si %xmm0, %ebp
movss 0x8(%rbx), %xmm0
addss 0xf984(%rip), %xmm0     # 0x31cec
callq 0x32a0
mulss (%rsp), %xmm0
mulss 0xf976(%rip), %xmm0     # 0x31cf0
addss 0x20(%rsp), %xmm0
cvttss2si %xmm0, %edx
movq %r14, %rdi
movl %ebp, %esi
movq %r15, %rcx
callq 0xbe76
movss 0x8(%rbx), %xmm0
movss 0xf956(%rip), %xmm1     # 0x31cf4
addss %xmm1, %xmm0
callq 0x3240
mulss (%rsp), %xmm0
mulss 0xf93c(%rip), %xmm0     # 0x31cf0
addss 0x10(%rsp), %xmm0
cvttss2si %xmm0, %ebp
movss 0x8(%rbx), %xmm0
addss 0xf929(%rip), %xmm0     # 0x31cf4
callq 0x32a0
mulss (%rsp), %xmm0
mulss 0xf913(%rip), %xmm0     # 0x31cf0
addss 0x20(%rsp), %xmm0
cvttss2si %xmm0, %edx
movq %r14, %rdi
movl %ebp, %esi
movq %r15, %rcx
callq 0xbe76
incl %r12d
cmpl $0x5, %r12d
jne 0x2231e
movl 0xc(%rbx), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0xc(%rbx)
cmpl $0xc7, %eax
jle 0x2241b
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2204a
addq $0x50, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq