#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int amountOfPoints(double);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, double);
double omp_get_wtime();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *);
int main() {
  FILE *output;
  double radius, start, end;
  printf("Введите радиус окрестности: ");
  scanf("%lf", &radius);
  start = omp_get_wtime();
  printf("Количество точек в заданной окрестности: %d\n",
         amountOfPoints(radius));
  end = omp_get_wtime();
  printf("Время выполнения программы: %lf\n", end - start);
  output = fopen("/home/user/Labs/Lab_8/MathC15/out.txt", "a");
  fprintf(output, "%lf\n", end - start);
  fclose(output);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xea1(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1070 <scanf@plt>
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1090 <amountOfPoints@plt>
mov    %eax,%esi
lea    0xe7d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x0,%al
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
lea    0xea9(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xed4(%rip),%rdi
lea    0xef3(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
lea    0xeaa(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xe84(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeab(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1070 <scanf@plt>
xor    %eax,%eax
call   1030 <omp_get_wtime@plt>
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1090 <amountOfPoints@plt>
lea    0xe87(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1030 <omp_get_wtime@plt>
subsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
lea    0xeb6(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xee1(%rip),%rdi
lea    0xf00(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
lea    0xec6(%rip),%rsi
mov    %rax,%rdi
movsd  (%rsp),%xmm0
call   1060 <fprintf@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [53 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D1\80\D0\B0\D0\B4\D0\B8\D1\83\D1\81 \D0\BE\D0\BA\D1\80\D0\B5\D1\81\D1\82\D0\BD\D0\BE\D1\81\D1\82\D0\B8: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [80 x i8] c"\D0\9A\D0\BE\D0\BB\D0\B8\D1\87\D0\B5\D1\81\D1\82\D0\B2\D0\BE \D1\82\D0\BE\D1\87\D0\B5\D0\BA \D0\B2 \D0\B7\D0\B0\D0\B4\D0\B0\D0\BD\D0\BD\D0\BE\D0\B9 \D0\BE\D0\BA\D1\80\D0\B5\D1\81\D1\82\D0\BD\D0\BE\D1\81\D1\82\D0\B8: %d\0A\00"
@.str.3 = [57 x i8] c"\D0\92\D1\80\D0\B5\D0\BC\D1\8F \D0\B2\D1\8B\D0\BF\D0\BE\D0\BB\D0\BD\D0\B5\D0\BD\D0\B8\D1\8F \D0\BF\D1\80\D0\BE\D0\B3\D1\80\D0\B0\D0\BC\D0\BC\D1\8B: %lf\0A\00"
@.str.4 = [38 x i8] c"/home/user/Labs/Lab_8/MathC15/out.txt\00"
@.str.5 = [2 x i8] c"a\00"
@.str.6 = [5 x i8] c"%lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%8 = call double (...) @omp_get_wtime()
store double %8, double* %4
%9 = load double, double* %3
%10 = call i32 @amountOfPoints(double %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.2, i64 0, i64 0), i32 %10)
%12 = call double (...) @omp_get_wtime()
store double %12, double* %5
%13 = load double, double* %5
%14 = load double, double* %4
%15 = fsub double %13, %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0), double %15)
%17 = call i32* @fopen(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %17, i32** %2
%18 = load i32*, i32** %2
%19 = load double, double* %5
%20 = load double, double* %4
%21 = fsub double %19, %20
%22 = call i32 @fprintf(i32* %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), double %21)
%23 = load i32*, i32** %2
%24 = call i32 @fclose(i32* %23)
ret i32 0
}

LLVM IR (-O2):
@.str = [53 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D1\80\D0\B0\D0\B4\D0\B8\D1\83\D1\81 \D0\BE\D0\BA\D1\80\D0\B5\D1\81\D1\82\D0\BD\D0\BE\D1\81\D1\82\D0\B8: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [80 x i8] c"\D0\9A\D0\BE\D0\BB\D0\B8\D1\87\D0\B5\D1\81\D1\82\D0\B2\D0\BE \D1\82\D0\BE\D1\87\D0\B5\D0\BA \D0\B2 \D0\B7\D0\B0\D0\B4\D0\B0\D0\BD\D0\BD\D0\BE\D0\B9 \D0\BE\D0\BA\D1\80\D0\B5\D1\81\D1\82\D0\BD\D0\BE\D1\81\D1\82\D0\B8: %d\0A\00"
@.str.3 = [57 x i8] c"\D0\92\D1\80\D0\B5\D0\BC\D1\8F \D0\B2\D1\8B\D0\BF\D0\BE\D0\BB\D0\BD\D0\B5\D0\BD\D0\B8\D1\8F \D0\BF\D1\80\D0\BE\D0\B3\D1\80\D0\B0\D0\BC\D0\BC\D1\8B: %lf\0A\00"
@.str.4 = [38 x i8] c"/home/user/Labs/Lab_8/MathC15/out.txt\00"
@.str.5 = [2 x i8] c"a\00"
@.str.6 = [5 x i8] c"%lf\0A\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%5 = call double (...) @omp_get_wtime()
%6 = load double, double* %1
%7 = call i32 @amountOfPoints(double %6)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([80 x i8], [80 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = call double (...) @omp_get_wtime()
%10 = fsub double %9, %5
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0), double %10)
%12 = call i32* @fopen(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%13 = call i32 @fprintf(i32* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), double %10)
%14 = call i32 @fclose(i32* %12)
ret i32 0
}