#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, double *);
int main() {
  double number, root;
  printf("Введите число: ");
  scanf("%lf", &number);
  root = number;
  while (root * root != number) {
    root = (root + (number / root)) / 2;
  }
  printf("Квадратный корень числа равен: %.3lf", root);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jne    1177 <main+0x57>
jp     1177 <main+0x57>
jmp    11a0 <main+0x80>
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
divsd  -0x18(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  0xe6e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1157 <main+0x37>
movsd  -0x18(%rbp),%xmm0
lea    0xe7c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee0(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeee(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
movsd  (%rsp),%xmm1
movapd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
ucomisd %xmm1,%xmm0
jne    1153 <main+0x33>
jnp    1186 <main+0x66>
movsd  0xea5(%rip),%xmm2
movapd %xmm1,%xmm3
nop
movapd %xmm1,%xmm0
divsd  %xmm3,%xmm0
addsd  %xmm3,%xmm0
mulsd  %xmm2,%xmm0
movapd %xmm0,%xmm3
mulsd  %xmm0,%xmm3
ucomisd %xmm1,%xmm3
movapd %xmm0,%xmm3
jne    1160 <main+0x40>
jp     1160 <main+0x40>
jmp    118a <main+0x6a>
movapd %xmm1,%xmm0
lea    0xe97(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [28 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D1\87\D0\B8\D1\81\D0\BB\D0\BE: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [63 x i8] c"\D0\9A\D0\B2\D0\B0\D0\B4\D1\80\D0\B0\D1\82\D0\BD\D1\8B\D0\B9 \D0\BA\D0\BE\D1\80\D0\B5\D0\BD\D1\8C \D1\87\D0\B8\D1\81\D0\BB\D0\B0 \D1\80\D0\B0\D0\B2\D0\B5\D0\BD: %.3lf\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%6 = load double, double* %2
store double %6, double* %3
br label %7
7: ; preds = %13, %0
%8 = load double, double* %3
%9 = load double, double* %3
%10 = fmul double %8, %9
%11 = load double, double* %2
%12 = fcmp une double %10, %11
br i1 %12, label %13, label %20
13: ; preds = %7
%14 = load double, double* %3
%15 = load double, double* %2
%16 = load double, double* %3
%17 = fdiv double %15, %16
%18 = fadd double %14, %17
%19 = fdiv double %18, 2.000000e+00
store double %19, double* %3
br label %7
20: ; preds = %7
%21 = load double, double* %3
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.2, i64 0, i64 0), double %21)
ret i32 0
}

LLVM IR (-O2):
@.str = [28 x i8] c"\D0\92\D0\B2\D0\B5\D0\B4\D0\B8\D1\82\D0\B5 \D1\87\D0\B8\D1\81\D0\BB\D0\BE: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [63 x i8] c"\D0\9A\D0\B2\D0\B0\D0\B4\D1\80\D0\B0\D1\82\D0\BD\D1\8B\D0\B9 \D0\BA\D0\BE\D1\80\D0\B5\D0\BD\D1\8C \D1\87\D0\B8\D1\81\D0\BB\D0\B0 \D1\80\D0\B0\D0\B2\D0\B5\D0\BD: %.3lf\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 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 = load double, double* %1
%6 = fmul double %5, %5
%7 = fcmp une double %6, %5
br i1 %7, label %8, label %15
8: ; preds = %0, %8
%9 = phi double [ %12, %8 ], [ %5, %0 ]
%10 = fdiv double %5, %9
%11 = fadd double %9, %10
%12 = fmul double %11, 5.000000e-01
%13 = fmul double %12, %12
%14 = fcmp une double %13, %5
br i1 %14, label %8, label %15
15: ; preds = %8, %0
%16 = phi double [ %5, %0 ], [ %12, %8 ]
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @.str.2, i64 0, i64 0), double %16)
ret i32 0
}