#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 */

/* Variables and functions */
int /*<<< orphan*/ ltr_int_cross_product(double *, double *, double *);
int ltr_int_dot_product(double *, double *);
int /*<<< orphan*/ ltr_int_make_vec(double *, double *, double *);
int /*<<< orphan*/ ltr_int_mul_vec(double *, int, double *);
int ltr_int_vec_size(double *);
void ltr_int_make_base(double vec1[3], double vec2[3], double res[3][3]) {
  double tmp1[3], tmp2[3];
  ltr_int_mul_vec(vec1, 1 / ltr_int_vec_size(vec1), res[0]);
  ltr_int_mul_vec(res[0], ltr_int_dot_product(vec2, res[0]), tmp1);
  ltr_int_make_vec(vec2, tmp1, tmp2);
  ltr_int_mul_vec(tmp2, 1 / ltr_int_vec_size(tmp2), res[1]);
  ltr_int_cross_product(res[0], res[1], res[2]);
}


x86 assembly (clang, -O0):
<ltr_int_make_base>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <ltr_int_vec_size@plt>
mov    -0x68(%rbp),%rdi
mov    %eax,%ecx
mov    $0x1,%eax
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x18(%rbp),%rdx
call   1070 <ltr_int_mul_vec@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <ltr_int_dot_product@plt>
mov    -0x60(%rbp),%rdi
mov    %eax,%esi
lea    -0x30(%rbp),%rdx
call   1070 <ltr_int_mul_vec@plt>
mov    -0x10(%rbp),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x50(%rbp),%rdx
call   1050 <ltr_int_make_vec@plt>
lea    -0x50(%rbp),%rax
mov    %rax,-0x58(%rbp)
lea    -0x50(%rbp),%rdi
call   1060 <ltr_int_vec_size@plt>
mov    -0x58(%rbp),%rdi
mov    %eax,%ecx
mov    $0x1,%eax
cltd
idiv   %ecx
mov    %eax,%esi
mov    -0x18(%rbp),%rdx
add    $0x18,%rdx
call   1070 <ltr_int_mul_vec@plt>
mov    -0x18(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x18,%rsi
mov    -0x18(%rbp),%rdx
add    $0x30,%rdx
call   1030 <ltr_int_cross_product@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ltr_int_make_base>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%rbp
call   1060 <ltr_int_vec_size@plt>
lea    0x1(%rax),%ecx
xor    %r15d,%r15d
cmp    $0x3,%ecx
cmovae %r15d,%eax
mov    %rbp,%rdi
mov    %eax,%esi
mov    %rbx,%rdx
call   1070 <ltr_int_mul_vec@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <ltr_int_dot_product@plt>
lea    0x20(%rsp),%r12
mov    %rbx,%rdi
mov    %eax,%esi
mov    %r12,%rdx
call   1070 <ltr_int_mul_vec@plt>
mov    %rsp,%r13
mov    %r14,%rdi
mov    %r12,%rsi
mov    %r13,%rdx
call   1050 <ltr_int_make_vec@plt>
mov    %r13,%rdi
call   1060 <ltr_int_vec_size@plt>
lea    0x1(%rax),%ecx
cmp    $0x3,%ecx
cmovb  %eax,%r15d
lea    0x18(%rbx),%rbp
mov    %r13,%rdi
mov    %r15d,%esi
mov    %rbp,%rdx
call   1070 <ltr_int_mul_vec@plt>
lea    0x30(%rbx),%rdx
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1030 <ltr_int_cross_product@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @ltr_int_make_base(double* %0, double* %1, [3 x double]* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca [3 x double]*
%7 = alloca [3 x double]
%8 = alloca [3 x double]
store double* %0, double** %4
store double* %1, double** %5
store [3 x double]* %2, [3 x double]** %6
%9 = load double*, double** %4
%10 = load double*, double** %4
%11 = call i32 @ltr_int_vec_size(double* %10)
%12 = sdiv i32 1, %11
%13 = load [3 x double]*, [3 x double]** %6
%14 = getelementptr inbounds [3 x double], [3 x double]* %13, i64 0
%15 = getelementptr inbounds [3 x double], [3 x double]* %14, i64 0, i64 0
%16 = call i32 @ltr_int_mul_vec(double* %9, i32 %12, double* %15)
%17 = load [3 x double]*, [3 x double]** %6
%18 = getelementptr inbounds [3 x double], [3 x double]* %17, i64 0
%19 = getelementptr inbounds [3 x double], [3 x double]* %18, i64 0, i64 0
%20 = load double*, double** %5
%21 = load [3 x double]*, [3 x double]** %6
%22 = getelementptr inbounds [3 x double], [3 x double]* %21, i64 0
%23 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 0
%24 = call i32 @ltr_int_dot_product(double* %20, double* %23)
%25 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%26 = call i32 @ltr_int_mul_vec(double* %19, i32 %24, double* %25)
%27 = load double*, double** %5
%28 = getelementptr inbounds [3 x double], [3 x double]* %7, i64 0, i64 0
%29 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%30 = call i32 @ltr_int_make_vec(double* %27, double* %28, double* %29)
%31 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%32 = getelementptr inbounds [3 x double], [3 x double]* %8, i64 0, i64 0
%33 = call i32 @ltr_int_vec_size(double* %32)
%34 = sdiv i32 1, %33
%35 = load [3 x double]*, [3 x double]** %6
%36 = getelementptr inbounds [3 x double], [3 x double]* %35, i64 1
%37 = getelementptr inbounds [3 x double], [3 x double]* %36, i64 0, i64 0
%38 = call i32 @ltr_int_mul_vec(double* %31, i32 %34, double* %37)
%39 = load [3 x double]*, [3 x double]** %6
%40 = getelementptr inbounds [3 x double], [3 x double]* %39, i64 0
%41 = getelementptr inbounds [3 x double], [3 x double]* %40, i64 0, i64 0
%42 = load [3 x double]*, [3 x double]** %6
%43 = getelementptr inbounds [3 x double], [3 x double]* %42, i64 1
%44 = getelementptr inbounds [3 x double], [3 x double]* %43, i64 0, i64 0
%45 = load [3 x double]*, [3 x double]** %6
%46 = getelementptr inbounds [3 x double], [3 x double]* %45, i64 2
%47 = getelementptr inbounds [3 x double], [3 x double]* %46, i64 0, i64 0
%48 = call i32 @ltr_int_cross_product(double* %41, double* %44, double* %47)
ret void
}

LLVM IR (-O2):
define void @ltr_int_make_base(double* %0, double* %1, [3 x double]* %2) {
%4 = alloca [3 x double]
%5 = alloca [3 x double]
%6 = bitcast [3 x double]* %4 to i8*
%7 = bitcast [3 x double]* %5 to i8*
%8 = tail call i32 @ltr_int_vec_size(double* %0)
%9 = add i32 %8, 1
%10 = icmp ult i32 %9, 3
%11 = select i1 %10, i32 %8, i32 0
%12 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 0, i64 0
%13 = tail call i32 @ltr_int_mul_vec(double* %0, i32 %11, double* %12)
%14 = tail call i32 @ltr_int_dot_product(double* %1, double* %12)
%15 = getelementptr inbounds [3 x double], [3 x double]* %4, i64 0, i64 0
%16 = call i32 @ltr_int_mul_vec(double* %12, i32 %14, double* %15)
%17 = getelementptr inbounds [3 x double], [3 x double]* %5, i64 0, i64 0
%18 = call i32 @ltr_int_make_vec(double* %1, double* %15, double* %17)
%19 = call i32 @ltr_int_vec_size(double* %17)
%20 = add i32 %19, 1
%21 = icmp ult i32 %20, 3
%22 = select i1 %21, i32 %19, i32 0
%23 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 1, i64 0
%24 = call i32 @ltr_int_mul_vec(double* %17, i32 %22, double* %23)
%25 = getelementptr inbounds [3 x double], [3 x double]* %2, i64 2, i64 0
%26 = call i32 @ltr_int_cross_product(double* %12, double* %23, double* %25)
ret void
}