#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 */
scalar_t__ pow(float, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *, float *, float *, float *);
float sqrt(scalar_t__);
int main() {
  float x1, x2, y1, y2, length;
  printf("please input two points：x1 y1 x2 y2 \n");
  scanf("%f %f %f %f", &x1, &y1, &x2, &y2);
  length = sqrt(pow((y2 - y1), 2) + pow((x2 - x1), 2));
  printf("Their distance is：%f\n", length);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0xc(%rbp),%rcx
lea    -0x14(%rbp),%r8
call   1040 <scanf@plt>
movss  -0x14(%rbp),%xmm0
subss  -0x10(%rbp),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
mov    %rax,-0x20(%rbp)
movss  -0xc(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
mov    -0x20(%rbp),%rdi
add    %rax,%rdi
call   1060 <sqrt@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe6e(%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    $0x10,%rsp
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
lea    0xe98(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x4(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    %rsp,%r8
call   1050 <scanf@plt>
movss  (%rsp),%xmm0
subss  0x4(%rsp),%xmm0
mov    $0x2,%edi
call   1060 <pow@plt>
mov    %rax,%rbx
movss  0x8(%rsp),%xmm0
subss  0xc(%rsp),%xmm0
mov    $0x2,%edi
call   1060 <pow@plt>
add    %rax,%rbx
mov    %rbx,%rdi
call   1070 <sqrt@plt>
cvtss2sd %xmm0,%xmm0
lea    0xe49(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [40 x i8] c"please input two points\EF\BC\9Ax1 y1 x2 y2 \0A\00"
@.str.1 = [12 x i8] c"%f %f %f %f\00"
@.str.2 = [24 x i8] c"Their distance is\EF\BC\9A%f\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 ([40 x i8], [40 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), float* %2, float* %4, float* %3, float* %5)
%9 = load float, float* %5
%10 = load float, float* %4
%11 = fsub float %9, %10
%12 = call i64 @pow(float %11, i32 2)
%13 = load float, float* %3
%14 = load float, float* %2
%15 = fsub float %13, %14
%16 = call i64 @pow(float %15, i32 2)
%17 = add nsw i64 %12, %16
%18 = call float @sqrt(i64 %17)
store float %18, float* %6
%19 = load float, float* %6
%20 = fpext float %19 to double
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), double %20)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [12 x i8] c"%f %f %f %f\00"
@.str.2 = [24 x i8] c"Their distance is\EF\BC\9A%f\0A\00"
@str = [39 x i8] c"please input two points\EF\BC\9Ax1 y1 x2 y2 \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 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), float* %1, float* %3, float* %2, float* %4)
%11 = load float, float* %4
%12 = load float, float* %3
%13 = fsub float %11, %12
%14 = call i64 @pow(float %13, i32 2)
%15 = load float, float* %2
%16 = load float, float* %1
%17 = fsub float %15, %16
%18 = call i64 @pow(float %17, i32 2)
%19 = add nsw i64 %18, %14
%20 = call float @sqrt(i64 %19)
%21 = fpext float %20 to double
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), double %21)
ret i32 0
}