// File: /workspace/github_c_makefile_star2_O2/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 0x39870(%rip), %rbp     # 0x66600
leaq 0x24fe7(%rip), %rdi     # 0x51d7e
callq *0x48(%rbp)
movl %eax, 0x368(%rbx)
leaq 0x24fea(%rip), %rdi     # 0x51d91
callq *0x48(%rbp)
movl %eax, 0x36c(%rbx)
leaq 0x24fec(%rip), %rdi     # 0x51da3
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 0x39f20(%rip), %rax     # 0x66d08
movq %rax, 0x218(%rbx)
movq 0x3983a(%rip), %rax     # 0x66630
movq %rax, 0x228(%rbx)
cmpq $0x0, 0x158(%rbx)
je 0x2ce10
testb $0x1, 0x140(%rbx)
je 0x2ce2f
andl $0x0, 0x254(%rbx)
movl $0x1, 0x27c(%rbx)
movq 0x39748(%rip), %rax     # 0x66570
movq %rax, 0x238(%rbx)
cmpl $0x0, 0x280(%rbx)
jne 0x2ce42
movl $0x2, 0x280(%rbx)
movss 0x2f8(%rbx), %xmm0
xorps %xmm1, %xmm1
ucomiss %xmm1, %xmm0
jne 0x2ce5e
jp 0x2ce5e
movl $0x40a00000, 0x2f8(%rbx) # imm = 0x40A00000
movl $0x42480000, 0x37c(%rbx) # imm = 0x42480000
movsd 0x24e70(%rip), %xmm0    # 0x51ce0
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 0x183d0
andl $0x0, 0x18(%rbx)
andq $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 0x22042(%rip), %xmm3    # 0x4ef40
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 0x2cf46
andl $0x2, %eax
cvtsi2sd %eax, %xmm1
movsd 0x24dbd(%rip), %xmm2    # 0x51cf0
subsd %xmm1, %xmm2
cvtsd2ss %xmm2, %xmm1
mulss %xmm1, %xmm0
leaq 0x18(%rsp), %rsi
jmp 0x2cf52
xorps 0x24d63(%rip), %xmm0    # 0x51cb0
leaq 0xc(%rsp), %rsi
movq %r14, %rdx
callq 0x19940
leaq 0x1b4(%rbx), %rdx
leaq 0x24(%rsp), %rsi
movq %r14, %rdi
movaps 0x30(%rsp), %xmm0
callq 0x19940
movl 0x254(%rbx), %eax
testl %eax, %eax
je 0x2cfc1
movl $0x1, 0x27c(%rbx)
movq 0x3944a(%rip), %rcx     # 0x663d8
movq %rcx, 0x238(%rbx)
movl %eax, 0x258(%rbx)
leaq 0x24db0(%rip), %rax     # 0x51d52
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 0x2cf9b
cmpq $0x0, 0x130(%rbx)
je 0x2cf9b
leaq 0x24dd9(%rip), %rdi     # 0x51db5
callq *0x48(%rbp)
movq 0x39f82(%rip), %rax     # 0x66f68
movq %rax, 0x220(%rbx)
jmp 0x2cf9b