// File: /workspace/github_c_makefile_star2_O3/QwazyWabbitWOS[P]lmctf60/g_func.c
// Function: SP_func_door_secret
void SP_func_door_secret (edict_t *ent)
{
	vec3_t	forward, right, up;
	float	side;
	float	width;
	float	length;

	ent->moveinfo.sound_start = gi.soundindex  ("doors/dr1_strt.wav");
	ent->moveinfo.sound_middle = gi.soundindex  ("doors/dr1_mid.wav");
	ent->moveinfo.sound_end = gi.soundindex  ("doors/dr1_end.wav");

	ent->movetype = MOVETYPE_PUSH;
	ent->solid = SOLID_BSP;
	gi.setmodel (ent, ent->model);

	ent->blocked = door_secret_blocked;
	ent->use = door_secret_use;

	if (!(ent->targetname) || (ent->spawnflags & SECRET_ALWAYS_SHOOT))
	{
		ent->health = 0;
		ent->takedamage = DAMAGE_YES;
		ent->die = door_secret_die;
	}

	if (!ent->dmg)
		ent->dmg = 2;

	if (!ent->wait)
		ent->wait = 5;

	ent->moveinfo.accel =
	ent->moveinfo.decel =
	ent->moveinfo.speed = 50;

	// calculate positions
	AngleVectors (ent->s.angles, forward, right, up);
	VectorClear (ent->s.angles);
	side = 1.0 - (ent->spawnflags & SECRET_1ST_LEFT);
	if (ent->spawnflags & SECRET_1ST_DOWN)
		width = fabsf(DotProduct(up, ent->size));
	else
		width = fabsf(DotProduct(right, ent->size));
	length = fabsf(DotProduct(forward, ent->size));
	length = fabsf(DotProduct(forward, ent->size));
	if (ent->spawnflags & SECRET_1ST_DOWN)
		VectorMA (ent->s.origin, -1 * width, up, ent->pos1);
	else
		VectorMA (ent->s.origin, side * width, right, ent->pos1);
	VectorMA (ent->pos1, length, forward, ent->pos2);

	if (ent->health)
	{
		ent->takedamage = DAMAGE_YES;
		ent->die = door_killed;
		ent->max_health = ent->health;
	}
	else if (ent->targetname && ent->message)
	{
		gi.soundindex ("misc/talk.wav");
		ent->touch = door_touch;
	}
	
	ent->classname = "func_door";

	gi.linkentity (ent);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movq 0x391ee(%rip), %rbp     # 0x68600
leaq 0x26985(%rip), %rdi     # 0x55d9e
callq *0x48(%rbp)
movl %eax, 0x368(%rbx)
leaq 0x26988(%rip), %rdi     # 0x55db1
callq *0x48(%rbp)
movl %eax, 0x36c(%rbx)
leaq 0x2698a(%rip), %rdi     # 0x55dc3
callq *0x48(%rbp)
movl %eax, 0x370(%rbx)
movl $0x2, 0x118(%rbx)
movl $0x3, 0x108(%rbx)
movq 0x120(%rbx), %rsi
movq %rbx, %rdi
callq *0x58(%rbp)
movq 0x3989e(%rip), %rax     # 0x68d08
movq %rax, 0x218(%rbx)
movq 0x391b8(%rip), %rax     # 0x68630
movq %rax, 0x228(%rbx)
cmpq $0x0, 0x158(%rbx)
je 0x2f492
testb $0x1, 0x140(%rbx)
je 0x2f4b4
movl $0x0, 0x254(%rbx)
movl $0x1, 0x27c(%rbx)
movq 0x390c3(%rip), %rax     # 0x68570
movq %rax, 0x238(%rbx)
cmpl $0x0, 0x280(%rbx)
jne 0x2f4c7
movl $0x2, 0x280(%rbx)
movss 0x2f8(%rbx), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x2f4e3
jp 0x2f4e3
movl $0x40a00000, 0x2f8(%rbx) # imm = 0x40A00000
movl $0x42480000, 0x37c(%rbx) # imm = 0x42480000
movsd 0x2680b(%rip), %xmm0    # 0x55d00
movsd %xmm0, 0x374(%rbx)
leaq 0x10(%rbx), %rdi
leaq 0x24(%rsp), %r15
leaq 0x18(%rsp), %r12
leaq 0xc(%rsp), %r13
movq %r15, %rsi
movq %r12, %rdx
movq %r13, %rcx
callq 0x183a0
movl $0x0, 0x18(%rbx)
movq $0x0, 0x10(%rbx)
movl 0x140(%rbx), %eax
leaq 0x4(%rbx), %rdi
leaq 0x1a8(%rbx), %r14
movss 0xfc(%rbx), %xmm1
movss 0x100(%rbx), %xmm2
testb $0x4, %al
cmoveq %r12, %r13
movss 0x104(%rbx), %xmm4
movss 0x4(%r13), %xmm0
mulss %xmm2, %xmm0
movss (%r13), %xmm3
mulss %xmm1, %xmm3
addss %xmm0, %xmm3
movss 0x8(%r13), %xmm0
mulss %xmm4, %xmm0
addss %xmm3, %xmm0
movaps 0x239b7(%rip), %xmm3    # 0x52f40
mulss 0x4(%r15), %xmm2
andps %xmm3, %xmm0
mulss (%r15), %xmm1
addss %xmm2, %xmm1
mulss 0x8(%r15), %xmm4
addss %xmm1, %xmm4
andps %xmm3, %xmm4
movaps %xmm4, 0x30(%rsp)
jne 0x2f5d7
andl $0x2, %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd 0x2674f(%rip), %xmm2    # 0x55d10
subsd %xmm1, %xmm2
xorps %xmm1, %xmm1
cvtsd2ss %xmm2, %xmm1
mulss %xmm1, %xmm0
leaq 0x18(%rsp), %rsi
jmp 0x2f5e3
xorps 0x266f2(%rip), %xmm0    # 0x55cd0
leaq 0xc(%rsp), %rsi
movq %r14, %rdx
callq 0x19760
leaq 0x1b4(%rbx), %rdx
leaq 0x24(%rsp), %rsi
movq %r14, %rdi
movaps 0x30(%rsp), %xmm0
callq 0x19760
movl 0x254(%rbx), %eax
testl %eax, %eax
je 0x2f652
movl $0x1, 0x27c(%rbx)
movq 0x38db9(%rip), %rcx     # 0x683d8
movq %rcx, 0x238(%rbx)
movl %eax, 0x258(%rbx)
leaq 0x2673f(%rip), %rax     # 0x55d72
movq %rax, 0x138(%rbx)
movq %rbx, %rdi
callq *0x90(%rbp)
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpq $0x0, 0x158(%rbx)
je 0x2f62c
cmpq $0x0, 0x130(%rbx)
je 0x2f62c
leaq 0x26768(%rip), %rdi     # 0x55dd5
callq *0x48(%rbp)
movq 0x398f1(%rip), %rax     # 0x68f68
movq %rax, 0x220(%rbx)
jmp 0x2f62c