// File: /workspace/github_c_makefile_star2_O0/QwazyWabbitWOS[P]lmctf60/g_func.c
// Function: SP_func_water
void SP_func_water (edict_t *self)
{
	vec3_t	abs_movedir;

	G_SetMovedir (self->s.angles, self->movedir);
	self->movetype = MOVETYPE_PUSH;
	self->solid = SOLID_BSP;
	gi.setmodel (self, self->model);

	switch (self->sounds)
	{
		default:
			break;

		case 1: // water
			self->moveinfo.sound_start = gi.soundindex  ("world/mov_watr.wav");
			self->moveinfo.sound_end = gi.soundindex  ("world/stp_watr.wav");
			break;

		case 2: // lava
			self->moveinfo.sound_start = gi.soundindex  ("world/mov_watr.wav");
			self->moveinfo.sound_end = gi.soundindex  ("world/stp_watr.wav");
			break;
	}

	// calculate second position
	VectorCopy (self->s.origin, self->pos1);
	abs_movedir[0] = fabs(self->movedir[0]);
	abs_movedir[1] = fabs(self->movedir[1]);
	abs_movedir[2] = fabs(self->movedir[2]);
	self->moveinfo.distance = abs_movedir[0] * self->size[0] + abs_movedir[1] * self->size[1] + abs_movedir[2] * self->size[2] - st.lip;
	VectorMA (self->pos1, self->moveinfo.distance, self->movedir, self->pos2);

	// if it starts open, switch the positions
	if (self->spawnflags & DOOR_START_OPEN)
	{
		VectorCopy (self->pos2, self->s.origin);
		VectorCopy (self->pos1, self->pos2);
		VectorCopy (self->s.origin, self->pos1);
	}

	VectorCopy (self->pos1, self->moveinfo.start_origin);
	VectorCopy (self->s.angles, self->moveinfo.start_angles);
	VectorCopy (self->pos2, self->moveinfo.end_origin);
	VectorCopy (self->s.angles, self->moveinfo.end_angles);

	self->moveinfo.state = STATE_BOTTOM;

	if (!self->speed)
		self->speed = 25;
	self->moveinfo.accel = self->moveinfo.decel = self->moveinfo.speed = self->speed;

	if (!self->wait)
		self->wait = -1;
	self->moveinfo.wait = self->wait;

	self->use = door_use;

	if (self->wait == -1)
		self->spawnflags |= DOOR_TOGGLE;

	self->classname = "func_door";

	gi.linkentity (self);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rsi
movq %rsi, %rdi
addq $0x10, %rdi
addq $0x19c, %rsi            # imm = 0x19C
callq 0x19870
movq -0x8(%rbp), %rax
movl $0x2, 0x118(%rax)
movq -0x8(%rbp), %rax
movl $0x3, 0x108(%rax)
movq 0x4af3a(%rip), %rax     # 0x82600
movq 0x58(%rax), %rax
movq -0x8(%rbp), %rdi
movq 0x120(%rdi), %rsi
callq *%rax
movq -0x8(%rbp), %rax
movl 0x28c(%rax), %eax
movl %eax, -0x18(%rbp)
subl $0x1, %eax
je 0x376f7
jmp 0x376eb
movl -0x18(%rbp), %eax
subl $0x2, %eax
je 0x37733
jmp 0x376f5
jmp 0x3776d
leaq 0x3b59c(%rip), %rdi     # 0x72c9a
movq 0x4aefb(%rip), %rax     # 0x82600
callq *0x48(%rax)
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x368(%rax)
leaq 0x3b592(%rip), %rdi     # 0x72cad
movq 0x4aede(%rip), %rax     # 0x82600
callq *0x48(%rax)
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x370(%rax)
jmp 0x3776d
leaq 0x3b560(%rip), %rdi     # 0x72c9a
movq 0x4aebf(%rip), %rax     # 0x82600
callq *0x48(%rax)
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x368(%rax)
leaq 0x3b556(%rip), %rdi     # 0x72cad
movq 0x4aea2(%rip), %rax     # 0x82600
callq *0x48(%rax)
movl %eax, %ecx
movq -0x8(%rbp), %rax
movl %ecx, 0x370(%rax)
movq -0x8(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x1a8(%rax)
movq -0x8(%rbp), %rax
movss 0x8(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x1ac(%rax)
movq -0x8(%rbp), %rax
movss 0xc(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x1b0(%rax)
movq -0x8(%rbp), %rax
movss 0x19c(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movaps 0x3b3dd(%rip), %xmm1    # 0x72ba0
pand %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x14(%rbp)
movq -0x8(%rbp), %rax
movss 0x1a0(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movaps 0x3b3b9(%rip), %xmm1    # 0x72ba0
pand %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0x10(%rbp)
movq -0x8(%rbp), %rax
movss 0x1a4(%rax), %xmm0
cvtss2sd %xmm0, %xmm0
movaps 0x3b395(%rip), %xmm1    # 0x72ba0
pand %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, -0xc(%rbp)
movss -0x14(%rbp), %xmm1
movq -0x8(%rbp), %rax
movss 0xfc(%rax), %xmm2
movss -0x10(%rbp), %xmm0
movq -0x8(%rbp), %rax
mulss 0x100(%rax), %xmm0
mulss %xmm2, %xmm1
addss %xmm0, %xmm1
movss -0xc(%rbp), %xmm0
movq -0x8(%rbp), %rax
movss 0x104(%rax), %xmm2
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movq 0x4ae06(%rip), %rax     # 0x82668
cvtsi2ssl 0x20(%rax), %xmm1
subss %xmm1, %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x380(%rax)
movq -0x8(%rbp), %rdi
addq $0x1a8, %rdi            # imm = 0x1A8
movq -0x8(%rbp), %rax
movss 0x380(%rax), %xmm0
movq -0x8(%rbp), %rsi
addq $0x19c, %rsi            # imm = 0x19C
movq -0x8(%rbp), %rdx
addq $0x1b4, %rdx            # imm = 0x1B4
callq 0x199c0
movq -0x8(%rbp), %rax
movl 0x140(%rax), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x37985
movq -0x8(%rbp), %rax
movss 0x1b4(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x4(%rax)
movq -0x8(%rbp), %rax
movss 0x1b8(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x8(%rax)
movq -0x8(%rbp), %rax
movss 0x1bc(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0xc(%rax)
movq -0x8(%rbp), %rax
movss 0x1a8(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x1b4(%rax)
movq -0x8(%rbp), %rax
movss 0x1ac(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x1b8(%rax)
movq -0x8(%rbp), %rax
movss 0x1b0(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x1bc(%rax)
movq -0x8(%rbp), %rax
movss 0x4(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x1a8(%rax)
movq -0x8(%rbp), %rax
movss 0x8(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x1ac(%rax)
movq -0x8(%rbp), %rax
movss 0xc(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x1b0(%rax)
movq -0x8(%rbp), %rax
movss 0x1a8(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x338(%rax)
movq -0x8(%rbp), %rax
movss 0x1ac(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x33c(%rax)
movq -0x8(%rbp), %rax
movss 0x1b0(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x340(%rax)
movq -0x8(%rbp), %rax
movss 0x10(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x344(%rax)
movq -0x8(%rbp), %rax
movss 0x14(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x348(%rax)
movq -0x8(%rbp), %rax
movss 0x18(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x34c(%rax)
movq -0x8(%rbp), %rax
movss 0x1b4(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x350(%rax)
movq -0x8(%rbp), %rax
movss 0x1b8(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x354(%rax)
movq -0x8(%rbp), %rax
movss 0x1bc(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x358(%rax)
movq -0x8(%rbp), %rax
movss 0x10(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x35c(%rax)
movq -0x8(%rbp), %rax
movss 0x14(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x360(%rax)
movq -0x8(%rbp), %rax
movss 0x18(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x364(%rax)
movq -0x8(%rbp), %rax
movl $0x1, 0x388(%rax)
movq -0x8(%rbp), %rax
movss 0x190(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x37acb
jp 0x37acb
movq -0x8(%rbp), %rax
movss 0x3b0b9(%rip), %xmm0    # 0x72b7c
movss %xmm0, 0x190(%rax)
movq -0x8(%rbp), %rax
movss 0x190(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x378(%rax)
movq -0x8(%rbp), %rax
movss %xmm0, 0x37c(%rax)
movq -0x8(%rbp), %rax
movss %xmm0, 0x374(%rax)
movq -0x8(%rbp), %rax
movss 0x2f8(%rax), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x37b25
jp 0x37b25
movq -0x8(%rbp), %rax
movss 0x3b06b(%rip), %xmm0    # 0x72b88
movss %xmm0, 0x2f8(%rax)
movq -0x8(%rbp), %rax
movss 0x2f8(%rax), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x384(%rax)
movq -0x8(%rbp), %rax
movq 0x4ae78(%rip), %rcx     # 0x829c0
movq %rcx, 0x228(%rax)
movq -0x8(%rbp), %rax
movss 0x2f8(%rax), %xmm0
movss 0x3b025(%rip), %xmm1    # 0x72b88
ucomiss %xmm1, %xmm0
jne 0x37b7d
jp 0x37b7d
movq -0x8(%rbp), %rax
movl 0x140(%rax), %ecx
orl $0x20, %ecx
movl %ecx, 0x140(%rax)
movq -0x8(%rbp), %rax
leaq 0x3b082(%rip), %rcx     # 0x72c0a
movq %rcx, 0x138(%rax)
movq 0x4aa6a(%rip), %rax     # 0x82600
movq 0x90(%rax), %rax
movq -0x8(%rbp), %rdi
callq *%rax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)