#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*/ getch();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
main() {
  int x1, x2, y1, y2, a, d;
  float slope = 0.0f;
  float b = 0.0f;
  printf("x1 = ");
  scanf("%d", &x1);
  printf("y1 = ");
  scanf("%d", &y1);
  printf("x2 = ");
  scanf("%d", &x2);
  printf("y2 = ");
  scanf("%d", &y2);
  printf("Calculating Equation of (%d,%d) (%d,%d) ...", x1, y1, x2, y2);
  printf("\n-----------Answer-----------");
  a = (y1 - y2);
  d = (x1 - x2);
  slope = (float)a / (float)d;
  b = y1 - (slope * x1);
  printf("\ny = (%.3f)x + (%.3f)", slope, b);
  printf("\ny = %d/%d x + %.3f", a, d, b);
  printf("\nSlope = %d/%d or %.3f", a, d, slope);
  printf("\nb = %d-(%.2f*%d) = %.3f", y1, slope, x1, b);
  getch();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea9(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8b(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe84(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe6d(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe6c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe4f(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
cvtsi2ssl -0x14(%rbp),%xmm0
cvtsi2ssl -0x18(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm1
movss  -0x1c(%rbp),%xmm0
cvtsi2ssl -0x4(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x20(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe15(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe0e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe05(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
movss  -0x1c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x4(%rbp),%edx
movss  -0x20(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xdf6(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <getch@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
lea    0xec3(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xebb(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xeaa(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xe95(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xe80(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    0x14(%rsp),%ecx
mov    0x10(%rsp),%r8d
lea    0xe5a(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe78(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rsp),%ebx
cvtsi2ss %ebx,%xmm4
mov    0xc(%rsp),%ebp
cvtsi2ss %ebp,%xmm1
sub    0x10(%rsp),%ebx
sub    0x14(%rsp),%ebp
cvtsi2ss %ebx,%xmm2
cvtsi2ss %ebp,%xmm3
divss  %xmm3,%xmm2
mulss  %xmm2,%xmm1
subss  %xmm1,%xmm4
cvtss2sd %xmm2,%xmm0
movsd  %xmm0,0x18(%rsp)
xorps  %xmm1,%xmm1
cvtss2sd %xmm4,%xmm1
movsd  %xmm1,0x20(%rsp)
lea    0xe45(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
lea    0xe4d(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
movsd  0x20(%rsp),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe49(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
movsd  0x18(%rsp),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x8(%rsp),%esi
mov    0xc(%rsp),%edx
lea    0xe40(%rip),%rdi
movsd  0x18(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
mov    $0x2,%al
call   1030 <printf@plt>
xor    %eax,%eax
call   1050 <getch@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"x1 = \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c"y1 = \00"
@.str.3 = [6 x i8] c"x2 = \00"
@.str.4 = [6 x i8] c"y2 = \00"
@.str.5 = [44 x i8] c"Calculating Equation of (%d,%d) (%d,%d) ...\00"
@.str.6 = [30 x i8] c"\0A-----------Answer-----------\00"
@.str.7 = [22 x i8] c"\0Ay = (%.3f)x + (%.3f)\00"
@.str.8 = [20 x i8] c"\0Ay = %d/%d x + %.3f\00"
@.str.9 = [23 x i8] c"\0ASlope = %d/%d or %.3f\00"
@.str.10 = [25 x i8] c"\0Ab = %d-(%.2f*%d) = %.3f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
%8 = alloca float
store float 0.000000e+00, float* %7
store float 0.000000e+00, float* %8
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 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), i32* %1)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 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), i32* %3)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%17 = load i32, i32* %1
%18 = load i32, i32* %3
%19 = load i32, i32* %2
%20 = load i32, i32* %4
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0), i32 %17, i32 %18, i32 %19, i32 %20)
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = sub nsw i32 %23, %24
store i32 %25, i32* %5
%26 = load i32, i32* %1
%27 = load i32, i32* %2
%28 = sub nsw i32 %26, %27
store i32 %28, i32* %6
%29 = load i32, i32* %5
%30 = sitofp i32 %29 to float
%31 = load i32, i32* %6
%32 = sitofp i32 %31 to float
%33 = fdiv float %30, %32
store float %33, float* %7
%34 = load i32, i32* %3
%35 = sitofp i32 %34 to float
%36 = load float, float* %7
%37 = load i32, i32* %1
%38 = sitofp i32 %37 to float
%39 = fneg float %36
%40 = call float @llvm.fmuladd.f32(float %39, float %38, float %35)
store float %40, float* %8
%41 = load float, float* %7
%42 = fpext float %41 to double
%43 = load float, float* %8
%44 = fpext float %43 to double
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), double %42, double %44)
%46 = load i32, i32* %5
%47 = load i32, i32* %6
%48 = load float, float* %8
%49 = fpext float %48 to double
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i32 %46, i32 %47, double %49)
%51 = load i32, i32* %5
%52 = load i32, i32* %6
%53 = load float, float* %7
%54 = fpext float %53 to double
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i32 %51, i32 %52, double %54)
%56 = load i32, i32* %3
%57 = load float, float* %7
%58 = fpext float %57 to double
%59 = load i32, i32* %1
%60 = load float, float* %8
%61 = fpext float %60 to double
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0), i32 %56, double %58, i32 %59, double %61)
%63 = call i32 (...) @getch()
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"x1 = \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c"y1 = \00"
@.str.3 = [6 x i8] c"x2 = \00"
@.str.4 = [6 x i8] c"y2 = \00"
@.str.5 = [44 x i8] c"Calculating Equation of (%d,%d) (%d,%d) ...\00"
@.str.6 = [30 x i8] c"\0A-----------Answer-----------\00"
@.str.7 = [22 x i8] c"\0Ay = (%.3f)x + (%.3f)\00"
@.str.8 = [20 x i8] c"\0Ay = %d/%d x + %.3f\00"
@.str.9 = [23 x i8] c"\0ASlope = %d/%d or %.3f\00"
@.str.10 = [25 x i8] c"\0Ab = %d-(%.2f*%d) = %.3f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 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), i32* %1)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 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), i32* %3)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%17 = load i32, i32* %1
%18 = load i32, i32* %3
%19 = load i32, i32* %2
%20 = load i32, i32* %4
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0), i32 %17, i32 %18, i32 %19, i32 %20)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.6, i64 0, i64 0))
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = sub nsw i32 %23, %24
%26 = load i32, i32* %1
%27 = load i32, i32* %2
%28 = sub nsw i32 %26, %27
%29 = sitofp i32 %25 to float
%30 = sitofp i32 %28 to float
%31 = fdiv float %29, %30
%32 = sitofp i32 %23 to float
%33 = sitofp i32 %26 to float
%34 = fneg float %31
%35 = call float @llvm.fmuladd.f32(float %34, float %33, float %32)
%36 = fpext float %31 to double
%37 = fpext float %35 to double
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), double %36, double %37)
%39 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.8, i64 0, i64 0), i32 %25, i32 %28, double %37)
%40 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i32 %25, i32 %28, double %36)
%41 = load i32, i32* %3
%42 = load i32, i32* %1
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.10, i64 0, i64 0), i32 %41, double %36, i32 %42, double %37)
%44 = call i32 (...) @getch()
ret i32 0
}