#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef double GLfloat;
typedef double GLdouble;

/* Variables and functions */
int /*<<< orphan*/ crossProduct(double *, double *, double *);
int /*<<< orphan*/ glMultMatrixf(double *);
int /*<<< orphan*/ glTranslatef(double, double, double);
int /*<<< orphan*/ normalize(double *);
void myLookAt(GLdouble eyeX, GLdouble eyeY, GLdouble eyeZ, GLdouble centerX,
              GLdouble centerY, GLdouble centerZ, GLdouble upX, GLdouble upY,
              GLdouble upZ) {
  GLdouble center[3] = {centerX, centerY, centerZ};
  GLdouble eye[3] = {eyeX, eyeY, eyeZ};
  GLdouble up[3] = {upX, upY, upZ};
  GLdouble n[3], u[3], v[3];
  n[0] = eye[0] - center[0];
  n[1] = eye[1] - center[1];
  n[2] = eye[2] - center[2];
  normalize(n);
  crossProduct(up, n, u);
  normalize(u);
  crossProduct(n, u, v);
  normalize(v);
  GLfloat rotate[16] = {u[0], v[0], n[0], 0.0, u[1], v[1], n[1], 0.0,
                        u[2], v[2], n[2], 0.0, 0.0,  0.0,  0.0,  1.0};
  glMultMatrixf(rotate);
  glTranslatef(eyeX, eyeY, eyeZ);
}


x86 assembly (clang, -O0):
<myLookAt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x180,%rsp
movsd  0x10(%rbp),%xmm8
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  %xmm6,-0x38(%rbp)
movsd  %xmm7,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  0x10(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
subsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
subsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
subsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
lea    -0xc0(%rbp),%rdi
call   1040 <normalize@plt>
lea    -0xa0(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
lea    -0xe0(%rbp),%rdx
call   1030 <crossProduct@plt>
lea    -0xe0(%rbp),%rdi
call   1040 <normalize@plt>
lea    -0xc0(%rbp),%rdi
lea    -0xe0(%rbp),%rsi
lea    -0x100(%rbp),%rdx
call   1030 <crossProduct@plt>
lea    -0x100(%rbp),%rdi
call   1040 <normalize@plt>
movsd  -0xe0(%rbp),%xmm0
ff
movsd  %xmm0,-0x180(%rbp)
ff
movsd  -0x100(%rbp),%xmm0
ff
movsd  %xmm0,-0x178(%rbp)
ff
movsd  -0xc0(%rbp),%xmm0
ff
movsd  %xmm0,-0x170(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x168(%rbp)
ff
movsd  -0xd8(%rbp),%xmm0
ff
movsd  %xmm0,-0x160(%rbp)
ff
movsd  -0xf8(%rbp),%xmm0
ff
movsd  %xmm0,-0x158(%rbp)
ff
movsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,-0x150(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x148(%rbp)
ff
movsd  -0xd0(%rbp),%xmm0
ff
movsd  %xmm0,-0x140(%rbp)
ff
movsd  -0xf0(%rbp),%xmm0
ff
movsd  %xmm0,-0x138(%rbp)
ff
movsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0x130(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x128(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x120(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x118(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x110(%rbp)
ff
movsd  0xcbc(%rip),%xmm0
movsd  %xmm0,-0x108(%rbp)
ff
lea    -0x180(%rbp),%rdi
call   1050 <glMultMatrixf@plt>
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
call   1060 <glTranslatef@plt>
add    $0x180,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myLookAt>:
push   %r15
push   %r14
push   %rbx
sub    $0x120,%rsp
movsd  %xmm2,0x18(%rsp)
movapd %xmm1,0x90(%rsp)
movapd %xmm0,0x80(%rsp)
movsd  0x140(%rsp),%xmm8
movsd  %xmm6,0x60(%rsp)
movsd  %xmm7,0x68(%rsp)
movsd  %xmm8,0x70(%rsp)
movapd %xmm0,%xmm6
unpcklpd %xmm1,%xmm6
unpcklpd %xmm4,%xmm3
subpd  %xmm3,%xmm6
movapd %xmm6,(%rsp)
movapd %xmm2,%xmm0
subsd  %xmm5,%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %rsp,%r14
mov    %r14,%rdi
call   1040 <normalize@plt>
lea    0x60(%rsp),%rdi
lea    0x40(%rsp),%rbx
mov    %r14,%rsi
mov    %rbx,%rdx
call   1030 <crossProduct@plt>
mov    %rbx,%rdi
call   1040 <normalize@plt>
lea    0x20(%rsp),%r15
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1030 <crossProduct@plt>
mov    %r15,%rdi
call   1040 <normalize@plt>
movsd  0x40(%rsp),%xmm0
movsd  0x48(%rsp),%xmm1
movsd  %xmm0,0xa0(%rsp)
movsd  0x20(%rsp),%xmm0
movsd  0x28(%rsp),%xmm2
movsd  %xmm0,0xa8(%rsp)
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm3
movsd  %xmm0,0xb0(%rsp)
movq   $0x0,0xb8(%rsp)
movsd  %xmm1,0xc0(%rsp)
movsd  %xmm2,0xc8(%rsp)
movsd  %xmm3,0xd0(%rsp)
movq   $0x0,0xd8(%rsp)
movsd  0x50(%rsp),%xmm0
movsd  %xmm0,0xe0(%rsp)
movsd  0x30(%rsp),%xmm0
movsd  %xmm0,0xe8(%rsp)
movsd  0x10(%rsp),%xmm0
movsd  %xmm0,0xf0(%rsp)
xorps  %xmm0,%xmm0
movups %xmm0,0x108(%rsp)
movups %xmm0,0xf8(%rsp)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x118(%rsp)
lea    0xa0(%rsp),%rdi
call   1050 <glMultMatrixf@plt>
movaps 0x80(%rsp),%xmm0
movaps 0x90(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
call   1060 <glTranslatef@plt>
add    $0x120,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @myLookAt(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8) {
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca [3 x double]
%20 = alloca [3 x double]
%21 = alloca [3 x double]
%22 = alloca [3 x double]
%23 = alloca [3 x double]
%24 = alloca [3 x double]
%25 = alloca [16 x double]
store double %0, double* %10
store double %1, double* %11
store double %2, double* %12
store double %3, double* %13
store double %4, double* %14
store double %5, double* %15
store double %6, double* %16
store double %7, double* %17
store double %8, double* %18
%26 = getelementptr inbounds [3 x double], [3 x double]* %19, i64 0, i64 0
%27 = load double, double* %13
store double %27, double* %26
%28 = getelementptr inbounds double, double* %26, i64 1
%29 = load double, double* %14
store double %29, double* %28
%30 = getelementptr inbounds double, double* %28, i64 1
%31 = load double, double* %15
store double %31, double* %30
%32 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 0
%33 = load double, double* %10
store double %33, double* %32
%34 = getelementptr inbounds double, double* %32, i64 1
%35 = load double, double* %11
store double %35, double* %34
%36 = getelementptr inbounds double, double* %34, i64 1
%37 = load double, double* %12
store double %37, double* %36
%38 = getelementptr inbounds [3 x double], [3 x double]* %21, i64 0, i64 0
%39 = load double, double* %16
store double %39, double* %38
%40 = getelementptr inbounds double, double* %38, i64 1
%41 = load double, double* %17
store double %41, double* %40
%42 = getelementptr inbounds double, double* %40, i64 1
%43 = load double, double* %18
store double %43, double* %42
%44 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 0
%45 = load double, double* %44
%46 = getelementptr inbounds [3 x double], [3 x double]* %19, i64 0, i64 0
%47 = load double, double* %46
%48 = fsub double %45, %47
%49 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 0
store double %48, double* %49
%50 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 1
%51 = load double, double* %50
%52 = getelementptr inbounds [3 x double], [3 x double]* %19, i64 0, i64 1
%53 = load double, double* %52
%54 = fsub double %51, %53
%55 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 1
store double %54, double* %55
%56 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 2
%57 = load double, double* %56
%58 = getelementptr inbounds [3 x double], [3 x double]* %19, i64 0, i64 2
%59 = load double, double* %58
%60 = fsub double %57, %59
%61 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 2
store double %60, double* %61
%62 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 0
%63 = call i32 @normalize(double* %62)
%64 = getelementptr inbounds [3 x double], [3 x double]* %21, i64 0, i64 0
%65 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 0
%66 = getelementptr inbounds [3 x double], [3 x double]* %23, i64 0, i64 0
%67 = call i32 @crossProduct(double* %64, double* %65, double* %66)
%68 = getelementptr inbounds [3 x double], [3 x double]* %23, i64 0, i64 0
%69 = call i32 @normalize(double* %68)
%70 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 0
%71 = getelementptr inbounds [3 x double], [3 x double]* %23, i64 0, i64 0
%72 = getelementptr inbounds [3 x double], [3 x double]* %24, i64 0, i64 0
%73 = call i32 @crossProduct(double* %70, double* %71, double* %72)
%74 = getelementptr inbounds [3 x double], [3 x double]* %24, i64 0, i64 0
%75 = call i32 @normalize(double* %74)
%76 = getelementptr inbounds [16 x double], [16 x double]* %25, i64 0, i64 0
%77 = getelementptr inbounds [3 x double], [3 x double]* %23, i64 0, i64 0
%78 = load double, double* %77
store double %78, double* %76
%79 = getelementptr inbounds double, double* %76, i64 1
%80 = getelementptr inbounds [3 x double], [3 x double]* %24, i64 0, i64 0
%81 = load double, double* %80
store double %81, double* %79
%82 = getelementptr inbounds double, double* %79, i64 1
%83 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 0
%84 = load double, double* %83
store double %84, double* %82
%85 = getelementptr inbounds double, double* %82, i64 1
store double 0.000000e+00, double* %85
%86 = getelementptr inbounds double, double* %85, i64 1
%87 = getelementptr inbounds [3 x double], [3 x double]* %23, i64 0, i64 1
%88 = load double, double* %87
store double %88, double* %86
%89 = getelementptr inbounds double, double* %86, i64 1
%90 = getelementptr inbounds [3 x double], [3 x double]* %24, i64 0, i64 1
%91 = load double, double* %90
store double %91, double* %89
%92 = getelementptr inbounds double, double* %89, i64 1
%93 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 1
%94 = load double, double* %93
store double %94, double* %92
%95 = getelementptr inbounds double, double* %92, i64 1
store double 0.000000e+00, double* %95
%96 = getelementptr inbounds double, double* %95, i64 1
%97 = getelementptr inbounds [3 x double], [3 x double]* %23, i64 0, i64 2
%98 = load double, double* %97
store double %98, double* %96
%99 = getelementptr inbounds double, double* %96, i64 1
%100 = getelementptr inbounds [3 x double], [3 x double]* %24, i64 0, i64 2
%101 = load double, double* %100
store double %101, double* %99
%102 = getelementptr inbounds double, double* %99, i64 1
%103 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 2
%104 = load double, double* %103
store double %104, double* %102
%105 = getelementptr inbounds double, double* %102, i64 1
store double 0.000000e+00, double* %105
%106 = getelementptr inbounds double, double* %105, i64 1
store double 0.000000e+00, double* %106
%107 = getelementptr inbounds double, double* %106, i64 1
store double 0.000000e+00, double* %107
%108 = getelementptr inbounds double, double* %107, i64 1
store double 0.000000e+00, double* %108
%109 = getelementptr inbounds double, double* %108, i64 1
store double 1.000000e+00, double* %109
%110 = getelementptr inbounds [16 x double], [16 x double]* %25, i64 0, i64 0
%111 = call i32 @glMultMatrixf(double* %110)
%112 = load double, double* %10
%113 = load double, double* %11
%114 = load double, double* %12
%115 = call i32 @glTranslatef(double %112, double %113, double %114)
ret void
}

LLVM IR (-O2):
define void @myLookAt(double %0, double %1, double %2, double %3, double %4, double %5, double %6, double %7, double %8) {
%10 = alloca [3 x double]
%11 = alloca [3 x double]
%12 = alloca [3 x double]
%13 = alloca [3 x double]
%14 = alloca [16 x double]
%15 = bitcast [3 x double]* %10 to i8*
%16 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 0
store double %6, double* %16
%17 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 1
store double %7, double* %17
%18 = getelementptr inbounds [3 x double], [3 x double]* %10, i64 0, i64 2
store double %8, double* %18
%19 = bitcast [3 x double]* %11 to i8*
%20 = bitcast [3 x double]* %12 to i8*
%21 = bitcast [3 x double]* %13 to i8*
%22 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 0
%23 = insertelement <2 x double> poison, double %0, i64 0
%24 = insertelement <2 x double> %23, double %1, i64 1
%25 = insertelement <2 x double> poison, double %3, i64 0
%26 = insertelement <2 x double> %25, double %4, i64 1
%27 = fsub <2 x double> %24, %26
%28 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 1
%29 = bitcast [3 x double]* %11 to <2 x double>*
store <2 x double> %27, <2 x double>* %29
%30 = fsub double %2, %5
%31 = getelementptr inbounds [3 x double], [3 x double]* %11, i64 0, i64 2
store double %30, double* %31
%32 = call i32 @normalize(double* %22)
%33 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 0, i64 0
%34 = call i32 @crossProduct(double* %16, double* %22, double* %33)
%35 = call i32 @normalize(double* %33)
%36 = getelementptr inbounds [3 x double], [3 x double]* %13, i64 0, i64 0
%37 = call i32 @crossProduct(double* %22, double* %33, double* %36)
%38 = call i32 @normalize(double* %36)
%39 = bitcast [16 x double]* %14 to i8*
%40 = getelementptr inbounds [16 x double], [16 x double]* %14, i64 0, i64 0
%41 = load double, double* %33
store double %41, double* %40
%42 = getelementptr inbounds [16 x double], [16 x double]* %14, i64 0, i64 1
%43 = load double, double* %36
store double %43, double* %42
%44 = getelementptr inbounds [16 x double], [16 x double]* %14, i64 0, i64 2
%45 = load double, double* %22
store double %45, double* %44
%46 = getelementptr inbounds [16 x double], [16 x double]* %14, i64 0, i64 3
store double 0.000000e+00, double* %46
%47 = getelementptr inbounds [16 x double], [16 x double]* %14, i64 0, i64 4
%48 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 0, i64 1
%49 = load double, double* %48
store double %49, double* %47
%50 = getelementptr inbounds [16 x double], [16 x double]* %14, i64 0, i64 5
%51 = getelementptr inbounds [3 x double], [3 x double]* %13, i64 0, i64 1
%52 = load double, double* %51
store double %52, double* %50
%53 = getelementptr inbounds [16 x double], [16 x double]* %14, i64 0, i64 6
%54 = load double, double* %28
store double %54, double* %53
%55 = getelementptr inbounds [16 x double], [16 x double]* %14, i64 0, i64 7
store double 0.000000e+00, double* %55
%56 = getelementptr inbounds [16 x double], [16 x double]* %14, i64 0, i64 8
%57 = getelementptr inbounds [3 x double], [3 x double]* %12, i64 0, i64 2
%58 = load double, double* %57
store double %58, double* %56
%59 = getelementptr inbounds [16 x double], [16 x double]* %14, i64 0, i64 9
%60 = getelementptr inbounds [3 x double], [3 x double]* %13, i64 0, i64 2
%61 = load double, double* %60
store double %61, double* %59
%62 = getelementptr inbounds [16 x double], [16 x double]* %14, i64 0, i64 10
%63 = load double, double* %31
store double %63, double* %62
%64 = getelementptr inbounds [16 x double], [16 x double]* %14, i64 0, i64 11
%65 = getelementptr inbounds [16 x double], [16 x double]* %14, i64 0, i64 15
%66 = bitcast double* %64 to i8*
store double 1.000000e+00, double* %65
%67 = call i32 @glMultMatrixf(double* %40)
%68 = call i32 @glTranslatef(double %0, double %1, double %2)
ret void
}