#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 */
double atof(char *);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  double xa, xb, xc;
  double ya, yb, yc;
  double r1d, r2d, r3d;
  double x, y;
  double S, T;
  double y1, y2;
  char input[80];
  xa = 0;
  xb = 100;
  xc = 100;
  ya = 100;
  yb = 100;
  yc = 0;
  printf("\nDistance to R1: ");
  gets(input);
  r1d = atof(input);
  printf("\nDistance to R2: ");
  gets(input);
  r2d = atof(input);
  printf("\nDistance to R3: ");
  gets(input);
  r3d = atof(input);
  x = -(((-1600.0 + (r2d * r2d) - (r3d * r3d)) / 2.0) * 40) / 1600;
  y = -((-1600.0 + (r2d * r2d) - (r1d * r1d)) / 2.0) / 40;
  printf("\nPoint D: (%f,%f)\n", x, y);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xece(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xec1(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xeb4(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xea7(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xd0(%rbp),%rdi
call   1050 <gets@plt>
lea    -0xd0(%rbp),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x40(%rbp)
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xd0(%rbp),%rdi
call   1050 <gets@plt>
lea    -0xd0(%rbp),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x48(%rbp)
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xd0(%rbp),%rdi
call   1050 <gets@plt>
lea    -0xd0(%rbp),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x48(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xdf3(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xdb6(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xda2(%rip),%xmm1
mulsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xd97(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x48(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xd70(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xd33(%rip),%xmm1
divsd  %xmm1,%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xd08(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
lea    0xd4c(%rip),%rdi
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x60,%rsp
lea    0xef4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
call   1030 <atof@plt>
movsd  %xmm0,0x8(%rsp)
lea    0xedd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
call   1030 <atof@plt>
movsd  %xmm0,(%rsp)
lea    0xecc(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
call   1030 <atof@plt>
movsd  (%rsp),%xmm2
mulsd  %xmm2,%xmm2
addsd  0xe50(%rip),%xmm2
mulsd  %xmm0,%xmm0
movapd %xmm2,%xmm1
subsd  %xmm0,%xmm1
mulsd  0xe44(%rip),%xmm1
mulsd  0xe44(%rip),%xmm1
divsd  0xe44(%rip),%xmm1
movsd  0x8(%rsp),%xmm0
mulsd  %xmm0,%xmm0
subsd  %xmm0,%xmm2
mulsd  0xe36(%rip),%xmm2
divsd  0xe36(%rip),%xmm2
lea    0xe6d(%rip),%rdi
movapd %xmm1,%xmm0
movapd %xmm2,%xmm1
mov    $0x2,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"\0ADistance to R1: \00"
@.str.1 = [18 x i8] c"\0ADistance to R2: \00"
@.str.2 = [18 x i8] c"\0ADistance to R3: \00"
@.str.3 = [19 x i8] c"\0APoint D: (%f,%f)\0A\00"
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
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca [80 x i8]
store i32 0, i32* %1
store double 0.000000e+00, double* %2
store double 1.000000e+02, double* %3
store double 1.000000e+02, double* %4
store double 1.000000e+02, double* %5
store double 1.000000e+02, double* %6
store double 0.000000e+00, double* %7
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%19 = getelementptr inbounds [80 x i8], [80 x i8]* %17, i64 0, i64 0
%20 = call i32 @gets(i8* %19)
%21 = getelementptr inbounds [80 x i8], [80 x i8]* %17, i64 0, i64 0
%22 = call double @atof(i8* %21)
store double %22, double* %8
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%24 = getelementptr inbounds [80 x i8], [80 x i8]* %17, i64 0, i64 0
%25 = call i32 @gets(i8* %24)
%26 = getelementptr inbounds [80 x i8], [80 x i8]* %17, i64 0, i64 0
%27 = call double @atof(i8* %26)
store double %27, double* %9
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%29 = getelementptr inbounds [80 x i8], [80 x i8]* %17, i64 0, i64 0
%30 = call i32 @gets(i8* %29)
%31 = getelementptr inbounds [80 x i8], [80 x i8]* %17, i64 0, i64 0
%32 = call double @atof(i8* %31)
store double %32, double* %10
%33 = load double, double* %9
%34 = load double, double* %9
%35 = call double @llvm.fmuladd.f64(double %33, double %34, double -1.600000e+03)
%36 = load double, double* %10
%37 = load double, double* %10
%38 = fneg double %36
%39 = call double @llvm.fmuladd.f64(double %38, double %37, double %35)
%40 = fdiv double %39, 2.000000e+00
%41 = fmul double %40, 4.000000e+01
%42 = fneg double %41
%43 = fdiv double %42, 1.600000e+03
store double %43, double* %11
%44 = load double, double* %9
%45 = load double, double* %9
%46 = call double @llvm.fmuladd.f64(double %44, double %45, double -1.600000e+03)
%47 = load double, double* %8
%48 = load double, double* %8
%49 = fneg double %47
%50 = call double @llvm.fmuladd.f64(double %49, double %48, double %46)
%51 = fdiv double %50, 2.000000e+00
%52 = fneg double %51
%53 = fdiv double %52, 4.000000e+01
store double %53, double* %12
%54 = load double, double* %11
%55 = load double, double* %12
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), double %54, double %55)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"\0ADistance to R1: \00"
@.str.1 = [18 x i8] c"\0ADistance to R2: \00"
@.str.2 = [18 x i8] c"\0ADistance to R3: \00"
@.str.3 = [19 x i8] c"\0APoint D: (%f,%f)\0A\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = call double @atof(i8* %2)
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @gets(i8* %2)
%8 = call double @atof(i8* %2)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @gets(i8* %2)
%11 = call double @atof(i8* %2)
%12 = call double @llvm.fmuladd.f64(double %8, double %8, double -1.600000e+03)
%13 = fneg double %11
%14 = call double @llvm.fmuladd.f64(double %13, double %11, double %12)
%15 = fmul double %14, 5.000000e-01
%16 = fmul double %15, -4.000000e+01
%17 = fdiv double %16, 1.600000e+03
%18 = fneg double %5
%19 = call double @llvm.fmuladd.f64(double %18, double %5, double %12)
%20 = fmul double %19, -5.000000e-01
%21 = fdiv double %20, 4.000000e+01
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), double %17, double %21)
ret i32 0
}