// File: /workspace/github_c_makefile_star2_O0/k0n10pl4tr[P]minimal_crafter/./linmath.h
// Function: mat4x4_look_at
LINMATH_H_FUNC void mat4x4_look_at(mat4x4 m, vec3 eye, vec3 center, vec3 up)
{
	/* Adapted from Android's OpenGL Matrix.java.                        */
	/* See the OpenGL GLUT documentation for gluLookAt for a description */
	/* of the algorithm. We implement it in a straightforward way:       */

	/* TODO: The negation of of can be spared by swapping the order of
	 *       operands in the following cross products in the right way. */
	vec3 f;
	vec3_sub(f, center, eye);	
	vec3_norm(f, f);	
	
	vec3 s;
	vec3_mul_cross(s, f, up);
	vec3_norm(s, s);

	vec3 t;
	vec3_mul_cross(t, s, f);

	m[0][0] =  s[0];
	m[0][1] =  t[0];
	m[0][2] = -f[0];
	m[0][3] =   0.f;

	m[1][0] =  s[1];
	m[1][1] =  t[1];
	m[1][2] = -f[1];
	m[1][3] =   0.f;

	m[2][0] =  s[2];
	m[2][1] =  t[2];
	m[2][2] = -f[2];
	m[2][3] =   0.f;

	m[3][0] =  0.f;
	m[3][1] =  0.f;
	m[3][2] =  0.f;
	m[3][3] =  1.f;

	mat4x4_translate_in_place(m, -eye[0], -eye[1], -eye[2]);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
leaq -0x2c(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x10(%rbp), %rdx
callq 0x7380
leaq -0x2c(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
callq 0x73e0
leaq -0x38(%rbp), %rdi
leaq -0x2c(%rbp), %rsi
movq -0x20(%rbp), %rdx
callq 0x7430
leaq -0x38(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x73e0
leaq -0x44(%rbp), %rdi
leaq -0x38(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
callq 0x7430
movss -0x38(%rbp), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, (%rax)
movss -0x44(%rbp), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x4(%rax)
movss -0x2c(%rbp), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x8(%rax)
movq -0x8(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0xc(%rax)
movss -0x34(%rbp), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x10(%rax)
movss -0x40(%rbp), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x14(%rax)
movss -0x28(%rbp), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x18(%rax)
movq -0x8(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x1c(%rax)
movss -0x30(%rbp), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x20(%rax)
movss -0x3c(%rbp), %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x24(%rax)
movss -0x24(%rbp), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movq -0x8(%rbp), %rax
movss %xmm0, 0x28(%rax)
movq -0x8(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x2c(%rax)
movq -0x8(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x30(%rax)
movq -0x8(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x34(%rax)
movq -0x8(%rbp), %rax
xorps %xmm0, %xmm0
movss %xmm0, 0x38(%rax)
movq -0x8(%rbp), %rax
movss 0x3987(%rip), %xmm0     # 0xaca4
movss %xmm0, 0x3c(%rax)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movss (%rax), %xmm0
movd %xmm0, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm0
movq -0x10(%rbp), %rax
movss 0x4(%rax), %xmm1
movd %xmm1, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm1
movq -0x10(%rbp), %rax
movss 0x8(%rax), %xmm2
movd %xmm2, %eax
xorl $0x80000000, %eax       # imm = 0x80000000
movd %eax, %xmm2
callq 0x7510
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)