#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, float);
int main(void) {
  int n = 4091721929;
  float x = 2.0;
  int p = (int)(n / 2);
  while (p * p > n)
    p = (int)(p / 2);
  if (p * p == n) {
    printf("根号%u = %.6f\n", n, p);
    return 0;
  }
  x = p;
  for (int i = 0; i < 10; i++) {
    x = (x + n / x) / 2;
  }
  printf("根号%u = %.6f\n", n, x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xf3e2b8c9,-0x8(%rbp)
movss  0xed2(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1164 <main+0x54>
mov    -0x10(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
jmp    1141 <main+0x31>
mov    -0x10(%rbp),%eax
imul   -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1194 <main+0x84>
mov    -0x8(%rbp),%esi
cvtsi2ssl -0x10(%rbp),%xmm0
lea    0xe81(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11fc <main+0xec>
cvtsi2ssl -0x10(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    11e1 <main+0xd1>
movss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
divss  -0xc(%rbp),%xmm1
addss  %xmm1,%xmm0
movss  0xe36(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11a5 <main+0x95>
mov    -0x8(%rbp),%esi
movss  -0xc(%rbp),%xmm0
lea    0xe14(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeec(%rip),%rdi
movss  0xee0(%rip),%xmm0
mov    $0xf3e2b8c9,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"\E6\A0\B9\E5\8F\B7%u = %.6f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 -203245367, i32* %2
store float 2.000000e+00, float* %3
%6 = load i32, i32* %2
%7 = sdiv i32 %6, 2
store i32 %7, i32* %4
br label %8
8: ; preds = %14, %0
%9 = load i32, i32* %4
%10 = load i32, i32* %4
%11 = mul nsw i32 %9, %10
%12 = load i32, i32* %2
%13 = icmp sgt i32 %11, %12
br i1 %13, label %14, label %17
14: ; preds = %8
%15 = load i32, i32* %4
%16 = sdiv i32 %15, 2
store i32 %16, i32* %4
br label %8
17: ; preds = %8
%18 = load i32, i32* %4
%19 = load i32, i32* %4
%20 = mul nsw i32 %18, %19
%21 = load i32, i32* %2
%22 = icmp eq i32 %20, %21
br i1 %22, label %23, label %28
23: ; preds = %17
%24 = load i32, i32* %2
%25 = load i32, i32* %4
%26 = sitofp i32 %25 to float
%27 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %24, float %26)
store i32 0, i32* %1
br label %49
28: ; preds = %17
%29 = load i32, i32* %4
%30 = sitofp i32 %29 to float
store float %30, float* %3
store i32 0, i32* %5
br label %31
31: ; preds = %42, %28
%32 = load i32, i32* %5
%33 = icmp slt i32 %32, 10
br i1 %33, label %34, label %45
34: ; preds = %31
%35 = load float, float* %3
%36 = load i32, i32* %2
%37 = sitofp i32 %36 to float
%38 = load float, float* %3
%39 = fdiv float %37, %38
%40 = fadd float %35, %39
%41 = fdiv float %40, 2.000000e+00
store float %41, float* %3
br label %42
42: ; preds = %34
%43 = load i32, i32* %5
%44 = add nsw i32 %43, 1
store i32 %44, i32* %5
br label %31
45: ; preds = %31
%46 = load i32, i32* %2
%47 = load float, float* %3
%48 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %46, float %47)
store i32 0, i32* %1
br label %49
49: ; preds = %45, %23
%50 = load i32, i32* %1
ret i32 %50
}

LLVM IR (-O2):
@.str = [17 x i8] c"\E6\A0\B9\E5\8F\B7%u = %.6f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 -203245367, float 0xC0F80FD4C0000000)
ret i32 0
}