#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 sqrt(float);
int main() {
  float x1, y1, x2, y2, distancia;
  printf("Ingresar x1: ");
  scanf("%f", &x1);
  printf("Ingresar y1: ");
  scanf("%f", &y1);
  printf("Punto (x1,y1): (%2.2f,%2.2f)\n", x1, y1);
  printf("Ingresar x2: ");
  scanf("%f", &x2);
  printf("Ingresar y2: ");
  scanf("%f", &y2);
  printf("Punto (x2,y2): (%2.2f,%2.2f)\n", x2, y2);
  distancia = ((x2 - x1) * (x2 - x1)) + ((y2 - y1) * (y2 - y1));
  distancia = sqrt(distancia);
  printf("Distancia entre los puntos (x1,y1) y (x2,y2): %2.4f\n", distancia);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9c(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe8b(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe5e(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe40(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x14(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe69(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x10(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
movss  -0x10(%rbp),%xmm2
subss  -0x8(%rbp),%xmm2
movss  -0x14(%rbp),%xmm1
subss  -0xc(%rbp),%xmm1
movss  -0x14(%rbp),%xmm3
subss  -0xc(%rbp),%xmm3
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
call   1050 <sqrt@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe28(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb4(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xea3(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  0x8(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe82(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
lea    0xe92(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xe85(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  (%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe67(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
movss  0x4(%rsp),%xmm0
subss  0xc(%rsp),%xmm0
movss  (%rsp),%xmm1
subss  0x8(%rsp),%xmm1
mulss  %xmm1,%xmm1
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     122a <main+0xea>
sqrtss %xmm0,%xmm0
jmp    122f <main+0xef>
call   1060 <sqrt@plt>
cvtss2sd %xmm0,%xmm0
lea    0xe3d(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Ingresar x1: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [14 x i8] c"Ingresar y1: \00"
@.str.3 = [30 x i8] c"Punto (x1,y1): (%2.2f,%2.2f)\0A\00"
@.str.4 = [14 x i8] c"Ingresar x2: \00"
@.str.5 = [14 x i8] c"Ingresar y2: \00"
@.str.6 = [30 x i8] c"Punto (x2,y2): (%2.2f,%2.2f)\0A\00"
@.str.7 = [53 x i8] c"Distancia entre los puntos (x1,y1) y (x2,y2): %2.4f\0A\00"
@.str.8 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%11 = load float, float* %2
%12 = fpext float %11 to double
%13 = load float, float* %3
%14 = fpext float %13 to double
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), double %12, double %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %5)
%20 = load float, float* %4
%21 = fpext float %20 to double
%22 = load float, float* %5
%23 = fpext float %22 to double
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), double %21, double %23)
%25 = load float, float* %4
%26 = load float, float* %2
%27 = fsub float %25, %26
%28 = load float, float* %4
%29 = load float, float* %2
%30 = fsub float %28, %29
%31 = load float, float* %5
%32 = load float, float* %3
%33 = fsub float %31, %32
%34 = load float, float* %5
%35 = load float, float* %3
%36 = fsub float %34, %35
%37 = fmul float %33, %36
%38 = call float @llvm.fmuladd.f32(float %27, float %30, float %37)
store float %38, float* %6
%39 = load float, float* %6
%40 = call float @sqrt(float %39)
store float %40, float* %6
%41 = load float, float* %6
%42 = fpext float %41 to double
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.7, i64 0, i64 0), double %42)
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Ingresar x1: \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [14 x i8] c"Ingresar y1: \00"
@.str.3 = [30 x i8] c"Punto (x1,y1): (%2.2f,%2.2f)\0A\00"
@.str.4 = [14 x i8] c"Ingresar x2: \00"
@.str.5 = [14 x i8] c"Ingresar y2: \00"
@.str.6 = [30 x i8] c"Punto (x2,y2): (%2.2f,%2.2f)\0A\00"
@.str.7 = [53 x i8] c"Distancia entre los puntos (x1,y1) y (x2,y2): %2.4f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = bitcast float* %1 to i8*
%6 = bitcast float* %2 to i8*
%7 = bitcast float* %3 to i8*
%8 = bitcast float* %4 to i8*
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%13 = load float, float* %1
%14 = fpext float %13 to double
%15 = load float, float* %2
%16 = fpext float %15 to double
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.3, i64 0, i64 0), double %14, double %16)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0))
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.5, i64 0, i64 0))
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%22 = load float, float* %3
%23 = fpext float %22 to double
%24 = load float, float* %4
%25 = fpext float %24 to double
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0), double %23, double %25)
%27 = load float, float* %3
%28 = load float, float* %1
%29 = fsub float %27, %28
%30 = load float, float* %4
%31 = load float, float* %2
%32 = fsub float %30, %31
%33 = fmul float %32, %32
%34 = call float @llvm.fmuladd.f32(float %29, float %29, float %33)
%35 = call float @sqrt(float %34)
%36 = fpext float %35 to double
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str.7, i64 0, i64 0), double %36)
%38 = call i32 @putchar(i32 10)
ret i32 0
}