#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *, float *, float *);
int ej17() {
  struct vectorR3 {
    float x;
    float y;
    float z;
  };
  struct vectorR3 v1, v2, v3;
  printf("Ingrese las 3 componentes del vector 1 en orden \n");
  scanf("%f %f %f", &v1.x, &v1.y, &v1.z);
  printf("Ingrese las 3 componentes del vector 2 en orden \n");
  scanf("%f %f %f", &v2.x, &v2.y, &v2.z);
  v3.x = (v1.y * v2.z) - (v1.z * v2.y);
  v3.y = (v1.z * v2.x) - (v1.x * v2.z);
  v3.z = (v1.x * v2.y) - (v1.y * v2.x);
  printf("El vector resultado del producto vectorial es: (%f,%f,%f)\n", v3.x,
         v3.y, v3.z);
  return 0;
}


x86 assembly (clang, -O0):
<ej17>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x10(%rbp),%rsi
lea    -0x10(%rbp),%rdx
add    $0x4,%rdx
lea    -0x10(%rbp),%rcx
add    $0x8,%rcx
lea    0xee1(%rip),%rdi
call   1040 <scanf@plt>
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    -0x20(%rbp),%rdx
add    $0x4,%rdx
lea    -0x20(%rbp),%rcx
add    $0x8,%rcx
lea    0xeb3(%rip),%rdi
call   1040 <scanf@plt>
movss  -0xc(%rbp),%xmm0
movss  -0x18(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
mulss  -0x1c(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x20(%rbp),%xmm2
movss  -0x10(%rbp),%xmm1
mulss  -0x18(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x10(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm2
movss  -0xc(%rbp),%xmm1
mulss  -0x20(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x30(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x2c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
movss  -0x28(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
lea    0xe3d(%rip),%rdi
mov    $0x3,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ej17>:
push   %rbx
sub    $0x20,%rsp
lea    0xf08(%rip),%rdi
call   1030 <puts@plt>
lea    0x14(%rsp),%rdx
lea    0x18(%rsp),%rcx
lea    0xeae(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xf0f(%rip),%rdi
call   1030 <puts@plt>
lea    0x4(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0x10(%rsp),%xmm2
movss  0x14(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
movss  0x18(%rsp),%xmm3
movss  (%rsp),%xmm4
movss  0x4(%rsp),%xmm5
movaps %xmm0,%xmm6
mulss  %xmm1,%xmm6
mulss  %xmm2,%xmm1
mulss  %xmm5,%xmm2
mulss  %xmm3,%xmm5
subss  %xmm5,%xmm6
mulss  %xmm4,%xmm3
subss  %xmm1,%xmm3
mulss  %xmm0,%xmm4
subss  %xmm4,%xmm2
xorps  %xmm0,%xmm0
cvtss2sd %xmm6,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm3,%xmm1
cvtss2sd %xmm2,%xmm2
lea    0xe26(%rip),%rdi
mov    $0x3,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.vectorR3 = type { float, float, float }
@.str = [50 x i8] c"Ingrese las 3 componentes del vector 1 en orden \0A\00"
@.str.1 = [9 x i8] c"%f %f %f\00"
@.str.2 = [50 x i8] c"Ingrese las 3 componentes del vector 2 en orden \0A\00"
@.str.3 = [59 x i8] c"El vector resultado del producto vectorial es: (%f,%f,%f)\0A\00"
define i32 @ej17() {
%1 = alloca %struct.vectorR3
%2 = alloca %struct.vectorR3
%3 = alloca %struct.vectorR3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %1, i32 0, i32 0
%6 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %1, i32 0, i32 1
%7 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %1, i32 0, i32 2
%8 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %5, float* %6, float* %7)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.2, i64 0, i64 0))
%10 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %2, i32 0, i32 0
%11 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %2, i32 0, i32 1
%12 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %2, i32 0, i32 2
%13 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %10, float* %11, float* %12)
%14 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %1, i32 0, i32 1
%15 = load float, float* %14
%16 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %2, i32 0, i32 2
%17 = load float, float* %16
%18 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %1, i32 0, i32 2
%19 = load float, float* %18
%20 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %2, i32 0, i32 1
%21 = load float, float* %20
%22 = fmul float %19, %21
%23 = fneg float %22
%24 = call float @llvm.fmuladd.f32(float %15, float %17, float %23)
%25 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %3, i32 0, i32 0
store float %24, float* %25
%26 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %1, i32 0, i32 2
%27 = load float, float* %26
%28 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %2, i32 0, i32 0
%29 = load float, float* %28
%30 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %1, i32 0, i32 0
%31 = load float, float* %30
%32 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %2, i32 0, i32 2
%33 = load float, float* %32
%34 = fmul float %31, %33
%35 = fneg float %34
%36 = call float @llvm.fmuladd.f32(float %27, float %29, float %35)
%37 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %3, i32 0, i32 1
store float %36, float* %37
%38 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %1, i32 0, i32 0
%39 = load float, float* %38
%40 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %2, i32 0, i32 1
%41 = load float, float* %40
%42 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %1, i32 0, i32 1
%43 = load float, float* %42
%44 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %2, i32 0, i32 0
%45 = load float, float* %44
%46 = fmul float %43, %45
%47 = fneg float %46
%48 = call float @llvm.fmuladd.f32(float %39, float %41, float %47)
%49 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %3, i32 0, i32 2
store float %48, float* %49
%50 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %3, i32 0, i32 0
%51 = load float, float* %50
%52 = fpext float %51 to double
%53 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %3, i32 0, i32 1
%54 = load float, float* %53
%55 = fpext float %54 to double
%56 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %3, i32 0, i32 2
%57 = load float, float* %56
%58 = fpext float %57 to double
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0), double %52, double %55, double %58)
ret i32 0
}

LLVM IR (-O2):
%struct.vectorR3 = type { float, float, float }
@.str.1 = [9 x i8] c"%f %f %f\00"
@.str.3 = [59 x i8] c"El vector resultado del producto vectorial es: (%f,%f,%f)\0A\00"
@str = [49 x i8] c"Ingrese las 3 componentes del vector 1 en orden \00"
@str.4 = [49 x i8] c"Ingrese las 3 componentes del vector 2 en orden \00"
define i32 @ej17() {
%1 = alloca %struct.vectorR3
%2 = alloca %struct.vectorR3
%3 = bitcast %struct.vectorR3* %1 to i8*
%4 = bitcast %struct.vectorR3* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
%6 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %1, i64 0, i32 0
%7 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %1, i64 0, i32 1
%8 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %1, i64 0, i32 2
%9 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %6, float* %7, float* %8)
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.4, i64 0, i64 0))
%11 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %2, i64 0, i32 0
%12 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %2, i64 0, i32 1
%13 = getelementptr inbounds %struct.vectorR3, %struct.vectorR3* %2, i64 0, i32 2
%14 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), float* %11, float* %12, float* %13)
%15 = load float, float* %7
%16 = load float, float* %13
%17 = load float, float* %8
%18 = load float, float* %12
%19 = fneg float %17
%20 = fmul float %18, %19
%21 = call float @llvm.fmuladd.f32(float %15, float %16, float %20)
%22 = load float, float* %11
%23 = load float, float* %6
%24 = fneg float %23
%25 = fmul float %16, %24
%26 = call float @llvm.fmuladd.f32(float %17, float %22, float %25)
%27 = fneg float %15
%28 = fmul float %22, %27
%29 = call float @llvm.fmuladd.f32(float %23, float %18, float %28)
%30 = fpext float %21 to double
%31 = fpext float %26 to double
%32 = fpext float %29 to double
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0), double %30, double %31, double %32)
ret i32 0
}