#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 EXIT_SUCCESS;
scalar_t__ pow(double, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *, double *);
double sqrt(scalar_t__);
int main(void) {
  double p1_x, p1_y, p2_x, p2_y, p3_x, p3_y;
  printf("Enter x and y for p1: ");
  scanf(" %lf %lf", &p1_x, &p1_y);
  printf("Enter x and y for p2: ");
  scanf(" %lf %lf", &p2_x, &p2_y);
  printf("Enter x and y for p3: ");
  scanf(" %lf %lf", &p3_x, &p3_y);
  double length_p12 = sqrt(pow(p1_x - p2_x, 2) + pow(p1_y - p2_y, 2));
  double length_p13 = sqrt(pow(p1_x - p3_x, 2) + pow(p1_y - p3_y, 2));
  double length_p23 = sqrt(pow(p2_x - p3_x, 2) + pow(p2_y - p3_y, 2));
  double circumference = length_p12 + length_p13 + length_p23;
  printf("p1 = (%.2f, %.2f), p2 = (%.2f, %.2f), p3 = (%.2f, %.2f)\nlength_p12: "
         "%.2f\nlength_p13: %.2f\nlength_p23: %.2f\nCircumference: %.2f\n",
         p1_x, p1_y, p2_x, p2_y, p3_x, p3_y, length_p12, length_p13, length_p23,
         circumference);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb0(%rip),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <scanf@plt>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8e(%rip),%rdi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1040 <scanf@plt>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe6c(%rip),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x38(%rbp),%rdx
call   1040 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
mov    %rax,-0x70(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
mov    -0x70(%rbp),%rdi
add    %rax,%rdi
call   1060 <sqrt@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
mov    %rax,-0x68(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
mov    -0x68(%rbp),%rdi
add    %rax,%rdi
call   1060 <sqrt@plt>
movsd  %xmm0,-0x48(%rbp)
movsd  -0x20(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
mov    %rax,-0x60(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
mov    -0x60(%rbp),%rdi
add    %rax,%rdi
call   1060 <sqrt@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm4
movsd  -0x38(%rbp),%xmm5
movsd  -0x40(%rbp),%xmm6
movsd  -0x48(%rbp),%xmm7
movsd  -0x50(%rbp),%xmm9
movsd  -0x58(%rbp),%xmm8
lea    0xd90(%rip),%rdi
movsd  %xmm9,(%rsp)
movsd  %xmm8,0x8(%rsp)
mov    $0x8,%al
call   1030 <printf@plt>
mov    0x2d07(%rip),%rax
mov    (%rax),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
lea    0xeb4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xebd(%rip),%rbx
lea    0x38(%rsp),%rsi
lea    0x30(%rsp),%rdx
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xead(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x28(%rsp),%rsi
lea    0x20(%rsp),%rdx
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xea4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x18(%rsp),%rsi
lea    0x10(%rsp),%rdx
mov    %rbx,%rdi
call   1040 <scanf@plt>
movsd  0x38(%rsp),%xmm0
subsd  0x28(%rsp),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
mov    %rax,%rbx
movsd  0x30(%rsp),%xmm0
subsd  0x20(%rsp),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
add    %rax,%rbx
mov    %rbx,%rdi
call   1060 <sqrt@plt>
movsd  %xmm0,0x48(%rsp)
movsd  0x38(%rsp),%xmm0
subsd  0x18(%rsp),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
mov    %rax,%rbx
movsd  0x30(%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
add    %rax,%rbx
mov    %rbx,%rdi
call   1060 <sqrt@plt>
movsd  %xmm0,0x40(%rsp)
movsd  0x28(%rsp),%xmm0
subsd  0x18(%rsp),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
mov    %rax,%rbx
movsd  0x20(%rsp),%xmm0
subsd  0x10(%rsp),%xmm0
mov    $0x2,%edi
call   1050 <pow@plt>
add    %rax,%rbx
mov    %rbx,%rdi
call   1060 <sqrt@plt>
movsd  0x48(%rsp),%xmm6
movapd %xmm6,%xmm9
movsd  0x40(%rsp),%xmm7
addsd  %xmm7,%xmm9
addsd  %xmm0,%xmm9
movsd  0x38(%rsp),%xmm8
movsd  0x30(%rsp),%xmm1
movsd  0x28(%rsp),%xmm2
movsd  0x20(%rsp),%xmm3
movsd  0x18(%rsp),%xmm4
movsd  0x10(%rsp),%xmm5
movsd  %xmm9,0x8(%rsp)
movsd  %xmm0,(%rsp)
lea    0xd95(%rip),%rdi
movaps %xmm8,%xmm0
mov    $0x8,%al
call   1030 <printf@plt>
mov    0x2d15(%rip),%rax
mov    (%rax),%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Enter x and y for p1: \00"
@.str.1 = [9 x i8] c" %lf %lf\00"
@.str.2 = [23 x i8] c"Enter x and y for p2: \00"
@.str.3 = [23 x i8] c"Enter x and y for p3: \00"
@.str.4 = [128 x i8] c"p1 = (%.2f, %.2f), p2 = (%.2f, %.2f), p3 = (%.2f, %.2f)\0Alength_p12: %.2f\0Alength_p13: %.2f\0Alength_p23: %.2f\0ACircumference: %.2f\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
store i32 0, i32* %1
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double* %2, double* %3)
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double* %4, double* %5)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double* %6, double* %7)
%18 = load double, double* %2
%19 = load double, double* %4
%20 = fsub double %18, %19
%21 = call i64 @pow(double %20, i32 2)
%22 = load double, double* %3
%23 = load double, double* %5
%24 = fsub double %22, %23
%25 = call i64 @pow(double %24, i32 2)
%26 = add nsw i64 %21, %25
%27 = call double @sqrt(i64 %26)
store double %27, double* %8
%28 = load double, double* %2
%29 = load double, double* %6
%30 = fsub double %28, %29
%31 = call i64 @pow(double %30, i32 2)
%32 = load double, double* %3
%33 = load double, double* %7
%34 = fsub double %32, %33
%35 = call i64 @pow(double %34, i32 2)
%36 = add nsw i64 %31, %35
%37 = call double @sqrt(i64 %36)
store double %37, double* %9
%38 = load double, double* %4
%39 = load double, double* %6
%40 = fsub double %38, %39
%41 = call i64 @pow(double %40, i32 2)
%42 = load double, double* %5
%43 = load double, double* %7
%44 = fsub double %42, %43
%45 = call i64 @pow(double %44, i32 2)
%46 = add nsw i64 %41, %45
%47 = call double @sqrt(i64 %46)
store double %47, double* %10
%48 = load double, double* %8
%49 = load double, double* %9
%50 = fadd double %48, %49
%51 = load double, double* %10
%52 = fadd double %50, %51
store double %52, double* %11
%53 = load double, double* %2
%54 = load double, double* %3
%55 = load double, double* %4
%56 = load double, double* %5
%57 = load double, double* %6
%58 = load double, double* %7
%59 = load double, double* %8
%60 = load double, double* %9
%61 = load double, double* %10
%62 = load double, double* %11
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @.str.4, i64 0, i64 0), double %53, double %54, double %55, double %56, double %57, double %58, double %59, double %60, double %61, double %62)
%64 = load i32, i32* @EXIT_SUCCESS
ret i32 %64
}

LLVM IR (-O2):
@.str = [23 x i8] c"Enter x and y for p1: \00"
@.str.1 = [9 x i8] c" %lf %lf\00"
@.str.2 = [23 x i8] c"Enter x and y for p2: \00"
@.str.3 = [23 x i8] c"Enter x and y for p3: \00"
@.str.4 = [128 x i8] c"p1 = (%.2f, %.2f), p2 = (%.2f, %.2f), p3 = (%.2f, %.2f)\0Alength_p12: %.2f\0Alength_p13: %.2f\0Alength_p23: %.2f\0ACircumference: %.2f\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = bitcast double* %1 to i8*
%8 = bitcast double* %2 to i8*
%9 = bitcast double* %3 to i8*
%10 = bitcast double* %4 to i8*
%11 = bitcast double* %5 to i8*
%12 = bitcast double* %6 to i8*
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double* %1, double* %2)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double* %3, double* %4)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), double* %5, double* %6)
%19 = load double, double* %1
%20 = load double, double* %3
%21 = fsub double %19, %20
%22 = call i64 @pow(double %21, i32 2)
%23 = load double, double* %2
%24 = load double, double* %4
%25 = fsub double %23, %24
%26 = call i64 @pow(double %25, i32 2)
%27 = add nsw i64 %26, %22
%28 = call double @sqrt(i64 %27)
%29 = load double, double* %1
%30 = load double, double* %5
%31 = fsub double %29, %30
%32 = call i64 @pow(double %31, i32 2)
%33 = load double, double* %2
%34 = load double, double* %6
%35 = fsub double %33, %34
%36 = call i64 @pow(double %35, i32 2)
%37 = add nsw i64 %36, %32
%38 = call double @sqrt(i64 %37)
%39 = load double, double* %3
%40 = load double, double* %5
%41 = fsub double %39, %40
%42 = call i64 @pow(double %41, i32 2)
%43 = load double, double* %4
%44 = load double, double* %6
%45 = fsub double %43, %44
%46 = call i64 @pow(double %45, i32 2)
%47 = add nsw i64 %46, %42
%48 = call double @sqrt(i64 %47)
%49 = fadd double %28, %38
%50 = fadd double %49, %48
%51 = load double, double* %1
%52 = load double, double* %2
%53 = load double, double* %3
%54 = load double, double* %4
%55 = load double, double* %5
%56 = load double, double* %6
%57 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([128 x i8], [128 x i8]* @.str.4, i64 0, i64 0), double %51, double %52, double %53, double %54, double %55, double %56, double %28, double %38, double %48, double %50)
%58 = load i32, i32* @EXIT_SUCCESS
ret i32 %58
}