#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 *);
float sqrt(float);
int main() {
  float X1, Y1, Z1, X2, Y2, Z2, dist;
  printf("Vamos calcular a distânia de dois pontos no R3\n");
  printf("Digite as coordenadas do primeiro ponto\n");
  scanf("%f"
        "%f"
        "%f",
        &X1, &Y1, &Z1);
  printf("Digite as coordenadas do segundo ponto\n");
  scanf("%f"
        "%f"
        "%f",
        &X2, &Y2, &Z2);
  dist = sqrt((X2 - X1) * (X2 - X1) + (Y2 - Y1) * (Y2 - Y1) +
              (Z2 - Z1) * (Z2 - Z1));
  printf("A distância entre os pontos e de %f", dist);
  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    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef8(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
lea    0xee7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x1c(%rbp),%rcx
call   1040 <scanf@plt>
movss  -0x14(%rbp),%xmm1
subss  -0x8(%rbp),%xmm1
movss  -0x14(%rbp),%xmm2
subss  -0x8(%rbp),%xmm2
movss  -0x18(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  -0x18(%rbp),%xmm3
subss  -0xc(%rbp),%xmm3
mulss  %xmm3,%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0x1c(%rbp),%xmm0
subss  -0x10(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm2
subss  -0x10(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1050 <sqrt@plt>
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe86(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
lea    0xee0(%rip),%rdi
call   1030 <puts@plt>
lea    0xf04(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9c(%rip),%rbx
lea    0x1c(%rsp),%rsi
lea    0x18(%rsp),%rdx
lea    0x14(%rsp),%rcx
mov    %rbx,%rdi
call   1050 <scanf@plt>
lea    0xf02(%rip),%rdi
call   1030 <puts@plt>
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %rbx,%rdi
call   1050 <scanf@plt>
movss  0x10(%rsp),%xmm1
subss  0x1c(%rsp),%xmm1
movss  0xc(%rsp),%xmm0
subss  0x18(%rsp),%xmm0
mulss  %xmm0,%xmm0
mulss  %xmm1,%xmm1
addss  %xmm0,%xmm1
movss  0x8(%rsp),%xmm0
subss  0x14(%rsp),%xmm0
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     11e4 <main+0xa4>
sqrtss %xmm0,%xmm0
jmp    11e9 <main+0xa9>
call   1060 <sqrt@plt>
cvtss2sd %xmm0,%xmm0
lea    0xe13(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [49 x i8] c"Vamos calcular a dist\C3\A2nia de dois pontos no R3\0A\00"
@.str.1 = [41 x i8] c"Digite as coordenadas do primeiro ponto\0A\00"
@.str.2 = [7 x i8] c"%f%f%f\00"
@.str.3 = [40 x i8] c"Digite as coordenadas do segundo ponto\0A\00"
@.str.4 = [37 x i8] c"A dist\C3\A2ncia entre os pontos e de %f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store i32 0, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), float* %2, float* %3, float* %4)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.3, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), float* %5, float* %6, float* %7)
%14 = load float, float* %5
%15 = load float, float* %2
%16 = fsub float %14, %15
%17 = load float, float* %5
%18 = load float, float* %2
%19 = fsub float %17, %18
%20 = load float, float* %6
%21 = load float, float* %3
%22 = fsub float %20, %21
%23 = load float, float* %6
%24 = load float, float* %3
%25 = fsub float %23, %24
%26 = fmul float %22, %25
%27 = call float @llvm.fmuladd.f32(float %16, float %19, float %26)
%28 = load float, float* %7
%29 = load float, float* %4
%30 = fsub float %28, %29
%31 = load float, float* %7
%32 = load float, float* %4
%33 = fsub float %31, %32
%34 = call float @llvm.fmuladd.f32(float %30, float %33, float %27)
%35 = call float @sqrt(float %34)
store float %35, float* %8
%36 = load float, float* %8
%37 = fpext float %36 to double
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), double %37)
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [7 x i8] c"%f%f%f\00"
@.str.4 = [37 x i8] c"A dist\C3\A2ncia entre os pontos e de %f\00"
@str = [48 x i8] c"Vamos calcular a dist\C3\A2nia de dois pontos no R3\00"
@str.5 = [40 x i8] c"Digite as coordenadas do primeiro ponto\00"
@str.6 = [39 x i8] c"Digite as coordenadas do segundo ponto\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = bitcast float* %1 to i8*
%8 = bitcast float* %2 to i8*
%9 = bitcast float* %3 to i8*
%10 = bitcast float* %4 to i8*
%11 = bitcast float* %5 to i8*
%12 = bitcast float* %6 to i8*
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str, i64 0, i64 0))
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str.5, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), float* %1, float* %2, float* %3)
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.6, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), float* %4, float* %5, float* %6)
%18 = load float, float* %4
%19 = load float, float* %1
%20 = fsub float %18, %19
%21 = load float, float* %5
%22 = load float, float* %2
%23 = fsub float %21, %22
%24 = fmul float %23, %23
%25 = call float @llvm.fmuladd.f32(float %20, float %20, float %24)
%26 = load float, float* %6
%27 = load float, float* %3
%28 = fsub float %26, %27
%29 = call float @llvm.fmuladd.f32(float %28, float %28, float %25)
%30 = call float @sqrt(float %29)
%31 = fpext float %30 to double
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.4, i64 0, i64 0), double %31)
ret i32 0
}