// File: /workspace/github_c_makefile_star2_O1/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 0x39ca6(%rip), %rbp     # 0x69600
leaq 0x27345(%rip), %rdi     # 0x56ca6
callq *0x48(%rbp)
movl %eax, 0x368(%rbx)
leaq 0x27348(%rip), %rdi     # 0x56cb9
callq *0x48(%rbp)
movl %eax, 0x36c(%rbx)
leaq 0x2734a(%rip), %rdi     # 0x56ccb
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 0x3a356(%rip), %rax     # 0x69d08
movq %rax, 0x218(%rbx)
movq 0x39c70(%rip), %rax     # 0x69630
movq %rax, 0x228(%rbx)
cmpq $0x0, 0x158(%rbx)
je 0x2f9da
testb $0x1, 0x140(%rbx)
je 0x2f9fc
movl $0x0, 0x254(%rbx)
movl $0x1, 0x27c(%rbx)
movq 0x39b7b(%rip), %rax     # 0x69570
movq %rax, 0x238(%rbx)
cmpl $0x0, 0x280(%rbx)
jne 0x2fa0f
movl $0x2, 0x280(%rbx)
movss 0x2f8(%rbx), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x2fa2b
jp 0x2fa2b
movl $0x40a00000, 0x2f8(%rbx) # imm = 0x40A00000
movl $0x42480000, 0x37c(%rbx) # imm = 0x42480000
movabsq $0x4248000042480000, %rax # imm = 0x4248000042480000
movq %rax, 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 0x2446e(%rip), %xmm3    # 0x53f40
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 0x2fb20
andl $0x2, %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd 0x270fe(%rip), %xmm2    # 0x56c08
subsd %xmm1, %xmm2
xorps %xmm1, %xmm1
cvtsd2ss %xmm2, %xmm1
mulss %xmm1, %xmm0
leaq 0x18(%rsp), %rsi
jmp 0x2fb2c
xorps 0x270e9(%rip), %xmm0    # 0x56c10
leaq 0xc(%rsp), %rsi
movq %r14, %rdx
callq 0x19770
leaq 0x1b4(%rbx), %rdx
leaq 0x24(%rsp), %rsi
movq %r14, %rdi
movaps 0x30(%rsp), %xmm0
callq 0x19770
movl 0x254(%rbx), %eax
testl %eax, %eax
je 0x2fb9b
movl $0x1, 0x27c(%rbx)
movq 0x39870(%rip), %rcx     # 0x693d8
movq %rcx, 0x238(%rbx)
movl %eax, 0x258(%rbx)
leaq 0x270fe(%rip), %rax     # 0x56c7a
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 0x2fb75
cmpq $0x0, 0x130(%rbx)
je 0x2fb75
leaq 0x27127(%rip), %rdi     # 0x56cdd
callq *0x48(%rbp)
movq 0x3a3a8(%rip), %rax     # 0x69f68
movq %rax, 0x220(%rbx)
jmp 0x2fb75