#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 powerOfTen(int);
double my_sqrt(double a) {
  double z = a;
  double rst = 0.0;
  int max = 8;
  int i;
  double j = 1.0;
  for (i = max; i > 0; i--) {
    if (z - ((2 * rst) + (j * powerOfTen(i))) * (j * powerOfTen(i)) >= 0) {
      while (z - ((2 * rst) + (j * powerOfTen(i))) * (j * powerOfTen(i)) >= 0) {
        j++;
        if (j >= 10) {
          break;
        }
      }
      j--;
      z -= ((2 * rst) + (j * powerOfTen(i))) * (j * powerOfTen(i));
      rst += j * powerOfTen(i);
      j = 1.0;
    }
  }
  for (i = 0; i >= 0 - max; i--) {
    if (z - ((2 * rst) + (j * powerOfTen(i))) * (j * powerOfTen(i)) >= 0) {
      while (z - ((2 * rst) + (j * powerOfTen(i))) * (j * powerOfTen(i)) >= 0) {
        j++;
      }
      j--;
      z -= ((2 * rst) + (j * powerOfTen(i))) * (j * powerOfTen(i));
      rst += j * powerOfTen(i);
      j = 1.0;
    }
  }
  return rst;
}


x86 assembly (clang, -O0):
<my_sqrt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x8,-0x1c(%rbp)
movsd  0xebf(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jle    13ba <my_sqrt+0x2aa>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x20(%rbp),%edi
call   1030 <powerOfTen@plt>
movsd  -0x50(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x20(%rbp),%edi
call   1030 <powerOfTen@plt>
movsd  -0x40(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm1
movaps %xmm0,%xmm3
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm3,%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     13a7 <my_sqrt+0x297>
jmp    11f3 <my_sqrt+0xe3>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x20(%rbp),%edi
call   1030 <powerOfTen@plt>
movsd  -0x78(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x70(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x20(%rbp),%edi
call   1030 <powerOfTen@plt>
movsd  -0x68(%rbp),%xmm2
movsd  -0x60(%rbp),%xmm1
movaps %xmm0,%xmm3
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm3,%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     12be <my_sqrt+0x1ae>
movsd  0xd6d(%rip),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xd66(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     12b9 <my_sqrt+0x1a9>
jmp    12be <my_sqrt+0x1ae>
jmp    11f3 <my_sqrt+0xe3>
movsd  0xd42(%rip),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
mov    -0x20(%rbp),%edi
call   1030 <powerOfTen@plt>
movsd  -0xa0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x98(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x20(%rbp),%edi
call   1030 <powerOfTen@plt>
movsd  -0x90(%rbp),%xmm2
ff
movaps %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm2
movsd  -0x10(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x20(%rbp),%edi
call   1030 <powerOfTen@plt>
movaps %xmm0,%xmm2
movsd  -0x80(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xc5e(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    13ac <my_sqrt+0x29c>
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    114c <my_sqrt+0x3c>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
xor    %ecx,%ecx
sub    -0x1c(%rbp),%ecx
cmp    %ecx,%eax
jl     165b <my_sqrt+0x54b>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
mov    -0x20(%rbp),%edi
call   1030 <powerOfTen@plt>
movsd  -0xc8(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xc0(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
mov    -0x20(%rbp),%edi
call   1030 <powerOfTen@plt>
movsd  -0xb8(%rbp),%xmm2
ff
movsd  -0xb0(%rbp),%xmm1
ff
movaps %xmm0,%xmm3
movsd  -0xa8(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1648 <my_sqrt+0x538>
jmp    148c <my_sqrt+0x37c>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0xe8(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
mov    -0x20(%rbp),%edi
call   1030 <powerOfTen@plt>
movsd  -0xf0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xe8(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
mov    -0x20(%rbp),%edi
call   1030 <powerOfTen@plt>
movsd  -0xe0(%rbp),%xmm2
ff
movsd  -0xd8(%rbp),%xmm1
ff
movaps %xmm0,%xmm3
movsd  -0xd0(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1559 <my_sqrt+0x449>
movsd  0xab6(%rip),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    148c <my_sqrt+0x37c>
movsd  0xaa7(%rip),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x110(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x118(%rbp)
ff
mov    -0x20(%rbp),%edi
call   1030 <powerOfTen@plt>
movsd  -0x118(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x110(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x100(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x108(%rbp)
ff
mov    -0x20(%rbp),%edi
call   1030 <powerOfTen@plt>
movsd  -0x108(%rbp),%xmm2
ff
movaps %xmm0,%xmm1
movsd  -0x100(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm2
movsd  -0x10(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
mov    -0x20(%rbp),%edi
call   1030 <powerOfTen@plt>
movaps %xmm0,%xmm2
movsd  -0xf8(%rbp),%xmm0
ff
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0x9bd(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    164d <my_sqrt+0x53d>
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    13c1 <my_sqrt+0x2b1>
movsd  -0x18(%rbp),%xmm0
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_sqrt>:
push   %rbx
sub    $0x50,%rsp
xorpd  %xmm1,%xmm1
unpcklpd %xmm0,%xmm1
movapd %xmm1,0x30(%rsp)
mov    $0x8,%ebx
jmp    11b3 <my_sqrt+0xa3>
nopl   (%rax)
movapd %xmm0,0x20(%rsp)
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
mulsd  0x20(%rsp),%xmm0
movapd 0x10(%rsp),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
mulsd  0x20(%rsp),%xmm0
movapd %xmm0,(%rsp)
movapd 0x10(%rsp),%xmm0
xorpd  0xeed(%rip),%xmm0
movapd %xmm0,0x10(%rsp)
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
movapd 0x20(%rsp),%xmm1
unpcklpd 0x10(%rsp),%xmm1
unpcklpd (%rsp),%xmm0
mulpd  %xmm1,%xmm0
movapd 0x30(%rsp),%xmm1
addpd  %xmm0,%xmm1
movapd %xmm1,0x30(%rsp)
lea    -0x1(%rbx),%eax
cmp    $0x1,%ebx
mov    %eax,%ebx
jbe    14f8 <my_sqrt+0x3e8>
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
movapd 0x30(%rsp),%xmm1
addsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
movapd 0x30(%rsp),%xmm2
movapd %xmm2,%xmm3
unpckhpd %xmm2,%xmm3
mulsd  0x10(%rsp),%xmm0
movapd %xmm3,%xmm1
subsd  %xmm0,%xmm1
ucomisd 0xe57(%rip),%xmm1
jb     11a5 <my_sqrt+0x95>
mov    %ebx,%edi
movapd %xmm2,0x30(%rsp)
movapd %xmm3,0x20(%rsp)
call   1030 <powerOfTen@plt>
movapd 0x30(%rsp),%xmm1
addsd  %xmm1,%xmm1
movapd %xmm1,0x10(%rsp)
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
mulsd  (%rsp),%xmm0
movapd 0x20(%rsp),%xmm1
subsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jb     1130 <my_sqrt+0x20>
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
addsd  %xmm0,%xmm0
addsd  0x10(%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
addsd  %xmm0,%xmm0
mulsd  (%rsp),%xmm0
movapd 0x20(%rsp),%xmm1
subsd  %xmm0,%xmm1
ucomisd 0xdcd(%rip),%xmm1
movsd  0xd75(%rip),%xmm0
jb     1130 <my_sqrt+0x20>
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
movapd %xmm0,%xmm1
movsd  0xd64(%rip),%xmm0
mulsd  %xmm0,%xmm1
addsd  0x10(%rsp),%xmm1
movsd  %xmm1,(%rsp)
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
mulsd  0xd46(%rip),%xmm0
mulsd  (%rsp),%xmm0
movapd 0x20(%rsp),%xmm1
subsd  %xmm0,%xmm1
ucomisd 0xd77(%rip),%xmm1
movsd  0xd2f(%rip),%xmm0
jb     1130 <my_sqrt+0x20>
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
movapd %xmm0,%xmm1
movsd  0xd1e(%rip),%xmm0
mulsd  %xmm0,%xmm1
addsd  0x10(%rsp),%xmm1
movsd  %xmm1,(%rsp)
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
mulsd  0xd00(%rip),%xmm0
mulsd  (%rsp),%xmm0
movapd 0x20(%rsp),%xmm1
subsd  %xmm0,%xmm1
ucomisd 0xd21(%rip),%xmm1
movsd  0xcd1(%rip),%xmm0
jb     1130 <my_sqrt+0x20>
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
movapd %xmm0,%xmm1
movsd  0xcd0(%rip),%xmm0
mulsd  %xmm0,%xmm1
addsd  0x10(%rsp),%xmm1
movsd  %xmm1,(%rsp)
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
mulsd  0xcb2(%rip),%xmm0
mulsd  (%rsp),%xmm0
movapd 0x20(%rsp),%xmm1
subsd  %xmm0,%xmm1
ucomisd 0xccb(%rip),%xmm1
movsd  0xc8b(%rip),%xmm0
jb     1130 <my_sqrt+0x20>
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
movapd %xmm0,%xmm1
movsd  0xc82(%rip),%xmm0
mulsd  %xmm0,%xmm1
addsd  0x10(%rsp),%xmm1
movsd  %xmm1,(%rsp)
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
mulsd  0xc64(%rip),%xmm0
mulsd  (%rsp),%xmm0
movapd 0x20(%rsp),%xmm1
subsd  %xmm0,%xmm1
ucomisd 0xc75(%rip),%xmm1
movsd  0xc3d(%rip),%xmm0
jb     1130 <my_sqrt+0x20>
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
movapd %xmm0,%xmm1
movsd  0xc34(%rip),%xmm0
mulsd  %xmm0,%xmm1
addsd  0x10(%rsp),%xmm1
movsd  %xmm1,(%rsp)
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
mulsd  0xc16(%rip),%xmm0
mulsd  (%rsp),%xmm0
movapd 0x20(%rsp),%xmm1
subsd  %xmm0,%xmm1
ucomisd 0xc1f(%rip),%xmm1
movsd  0xbef(%rip),%xmm0
jb     1130 <my_sqrt+0x20>
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
movapd %xmm0,%xmm1
movsd  0xbe6(%rip),%xmm0
mulsd  %xmm0,%xmm1
addsd  0x10(%rsp),%xmm1
movsd  %xmm1,(%rsp)
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
movapd 0x20(%rsp),%xmm1
mulsd  0xbc2(%rip),%xmm0
mulsd  (%rsp),%xmm0
subsd  %xmm0,%xmm1
ucomisd 0xbc9(%rip),%xmm1
movsd  0xba1(%rip),%xmm0
jb     1130 <my_sqrt+0x20>
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
movapd %xmm0,%xmm1
movsd  0xb98(%rip),%xmm0
mulsd  %xmm0,%xmm1
addsd  0x10(%rsp),%xmm1
movsd  %xmm1,(%rsp)
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
mulsd  0xb7a(%rip),%xmm0
mulsd  (%rsp),%xmm0
movapd 0x20(%rsp),%xmm1
subsd  %xmm0,%xmm1
ucomisd 0xb73(%rip),%xmm1
movsd  0xb53(%rip),%xmm0
jb     1130 <my_sqrt+0x20>
movsd  0xb4d(%rip),%xmm0
jmp    1130 <my_sqrt+0x20>
xor    %ebx,%ebx
jmp    1588 <my_sqrt+0x478>
nop
addsd  0xb40(%rip),%xmm2
movapd %xmm2,0x10(%rsp)
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
mulsd  0x10(%rsp),%xmm0
movapd (%rsp),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,(%rsp)
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
mulsd  0x10(%rsp),%xmm0
movapd %xmm0,0x20(%rsp)
movapd (%rsp),%xmm0
xorpd  0xb17(%rip),%xmm0
movapd %xmm0,(%rsp)
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
movapd 0x10(%rsp),%xmm1
unpcklpd (%rsp),%xmm1
unpcklpd 0x20(%rsp),%xmm0
mulpd  %xmm1,%xmm0
movapd 0x30(%rsp),%xmm1
addpd  %xmm0,%xmm1
movapd %xmm1,0x30(%rsp)
lea    -0x1(%rbx),%eax
cmp    $0xfffffff8,%ebx
mov    %eax,%ebx
jle    169a <my_sqrt+0x58a>
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
movapd 0x30(%rsp),%xmm1
addsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,0x10(%rsp)
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
movapd 0x30(%rsp),%xmm2
movapd %xmm2,%xmm3
unpckhpd %xmm2,%xmm3
mulsd  0x10(%rsp),%xmm0
movapd %xmm3,%xmm1
subsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jb     157a <my_sqrt+0x46a>
mov    %ebx,%edi
movapd %xmm2,0x30(%rsp)
movapd %xmm3,0x40(%rsp)
call   1030 <powerOfTen@plt>
movapd 0x30(%rsp),%xmm1
addsd  %xmm1,%xmm1
movapd %xmm1,(%rsp)
addsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
mulsd  0x10(%rsp),%xmm0
movapd 0x40(%rsp),%xmm1
subsd  %xmm0,%xmm1
ucomisd 0xa35(%rip),%xmm1
movsd  0x9dd(%rip),%xmm0
movapd %xmm0,%xmm2
jb     1500 <my_sqrt+0x3f0>
movapd %xmm0,%xmm2
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
addsd  %xmm0,%xmm2
movapd %xmm2,0x10(%rsp)
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
mulsd  0x10(%rsp),%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
mov    %ebx,%edi
call   1030 <powerOfTen@plt>
movapd 0x10(%rsp),%xmm2
mulsd  %xmm2,%xmm0
mulsd  0x20(%rsp),%xmm0
movapd 0x40(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0x975(%rip),%xmm0
ucomisd 0x9bd(%rip),%xmm1
jae    1640 <my_sqrt+0x530>
jmp    1500 <my_sqrt+0x3f0>
movaps 0x30(%rsp),%xmm0
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @my_sqrt(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
store double %0, double* %2
%8 = load double, double* %2
store double %8, double* %3
store double 0.000000e+00, double* %4
store i32 8, i32* %5
store double 1.000000e+00, double* %7
%9 = load i32, i32* %5
store i32 %9, i32* %6
br label %10
10: ; preds = %73, %1
%11 = load i32, i32* %6
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %76
13: ; preds = %10
%14 = load double, double* %3
%15 = load double, double* %4
%16 = load double, double* %7
%17 = load i32, i32* %6
%18 = call double @powerOfTen(i32 %17)
%19 = fmul double %16, %18
%20 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %15, double %19)
%21 = load double, double* %7
%22 = load i32, i32* %6
%23 = call double @powerOfTen(i32 %22)
%24 = fmul double %21, %23
%25 = fneg double %20
%26 = call double @llvm.fmuladd.f64(double %25, double %24, double %14)
%27 = fcmp oge double %26, 0.000000e+00
br i1 %27, label %28, label %72
28: ; preds = %13
br label %29
29: ; preds = %50, %28
%30 = load double, double* %3
%31 = load double, double* %4
%32 = load double, double* %7
%33 = load i32, i32* %6
%34 = call double @powerOfTen(i32 %33)
%35 = fmul double %32, %34
%36 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %31, double %35)
%37 = load double, double* %7
%38 = load i32, i32* %6
%39 = call double @powerOfTen(i32 %38)
%40 = fmul double %37, %39
%41 = fneg double %36
%42 = call double @llvm.fmuladd.f64(double %41, double %40, double %30)
%43 = fcmp oge double %42, 0.000000e+00
br i1 %43, label %44, label %51
44: ; preds = %29
%45 = load double, double* %7
%46 = fadd double %45, 1.000000e+00
store double %46, double* %7
%47 = load double, double* %7
%48 = fcmp oge double %47, 1.000000e+01
br i1 %48, label %49, label %50
49: ; preds = %44
br label %51
50: ; preds = %44
br label %29
51: ; preds = %49, %29
%52 = load double, double* %7
%53 = fadd double %52, -1.000000e+00
store double %53, double* %7
%54 = load double, double* %4
%55 = load double, double* %7
%56 = load i32, i32* %6
%57 = call double @powerOfTen(i32 %56)
%58 = fmul double %55, %57
%59 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %54, double %58)
%60 = load double, double* %7
%61 = load i32, i32* %6
%62 = call double @powerOfTen(i32 %61)
%63 = fmul double %60, %62
%64 = load double, double* %3
%65 = fneg double %59
%66 = call double @llvm.fmuladd.f64(double %65, double %63, double %64)
store double %66, double* %3
%67 = load double, double* %7
%68 = load i32, i32* %6
%69 = call double @powerOfTen(i32 %68)
%70 = load double, double* %4
%71 = call double @llvm.fmuladd.f64(double %67, double %69, double %70)
store double %71, double* %4
store double 1.000000e+00, double* %7
br label %72
72: ; preds = %51, %13
br label %73
73: ; preds = %72
%74 = load i32, i32* %6
%75 = add nsw i32 %74, -1
store i32 %75, i32* %6
br label %10
76: ; preds = %10
store i32 0, i32* %6
br label %77
77: ; preds = %138, %76
%78 = load i32, i32* %6
%79 = load i32, i32* %5
%80 = sub nsw i32 0, %79
%81 = icmp sge i32 %78, %80
br i1 %81, label %82, label %141
82: ; preds = %77
%83 = load double, double* %3
%84 = load double, double* %4
%85 = load double, double* %7
%86 = load i32, i32* %6
%87 = call double @powerOfTen(i32 %86)
%88 = fmul double %85, %87
%89 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %84, double %88)
%90 = load double, double* %7
%91 = load i32, i32* %6
%92 = call double @powerOfTen(i32 %91)
%93 = fmul double %90, %92
%94 = fneg double %89
%95 = call double @llvm.fmuladd.f64(double %94, double %93, double %83)
%96 = fcmp oge double %95, 0.000000e+00
br i1 %96, label %97, label %137
97: ; preds = %82
br label %98
98: ; preds = %113, %97
%99 = load double, double* %3
%100 = load double, double* %4
%101 = load double, double* %7
%102 = load i32, i32* %6
%103 = call double @powerOfTen(i32 %102)
%104 = fmul double %101, %103
%105 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %100, double %104)
%106 = load double, double* %7
%107 = load i32, i32* %6
%108 = call double @powerOfTen(i32 %107)
%109 = fmul double %106, %108
%110 = fneg double %105
%111 = call double @llvm.fmuladd.f64(double %110, double %109, double %99)
%112 = fcmp oge double %111, 0.000000e+00
br i1 %112, label %113, label %116
113: ; preds = %98
%114 = load double, double* %7
%115 = fadd double %114, 1.000000e+00
store double %115, double* %7
br label %98
116: ; preds = %98
%117 = load double, double* %7
%118 = fadd double %117, -1.000000e+00
store double %118, double* %7
%119 = load double, double* %4
%120 = load double, double* %7
%121 = load i32, i32* %6
%122 = call double @powerOfTen(i32 %121)
%123 = fmul double %120, %122
%124 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %119, double %123)
%125 = load double, double* %7
%126 = load i32, i32* %6
%127 = call double @powerOfTen(i32 %126)
%128 = fmul double %125, %127
%129 = load double, double* %3
%130 = fneg double %124
%131 = call double @llvm.fmuladd.f64(double %130, double %128, double %129)
store double %131, double* %3
%132 = load double, double* %7
%133 = load i32, i32* %6
%134 = call double @powerOfTen(i32 %133)
%135 = load double, double* %4
%136 = call double @llvm.fmuladd.f64(double %132, double %134, double %135)
store double %136, double* %4
store double 1.000000e+00, double* %7
br label %137
137: ; preds = %116, %82
br label %138
138: ; preds = %137
%139 = load i32, i32* %6
%140 = add nsw i32 %139, -1
store i32 %140, i32* %6
br label %77
141: ; preds = %77
%142 = load double, double* %4
ret double %142
}

LLVM IR (-O2):
define double @my_sqrt(double %0) {
%2 = insertelement <2 x double> <double 0.000000e+00, double poison>, double %0, i64 1
br label %3
3: ; preds = %1, %108
%4 = phi i32 [ 8, %1 ], [ %110, %108 ]
%5 = phi <2 x double> [ %2, %1 ], [ %109, %108 ]
%6 = tail call double @powerOfTen(i32 %4)
%7 = extractelement <2 x double> %5, i64 0
%8 = tail call double @llvm.fmuladd.f64(double %7, double 2.000000e+00, double %6)
%9 = tail call double @powerOfTen(i32 %4)
%10 = fneg double %8
%11 = extractelement <2 x double> %5, i64 1
%12 = tail call double @llvm.fmuladd.f64(double %10, double %9, double %11)
%13 = fcmp ult double %12, 0.000000e+00
br i1 %13, label %108, label %14
14: ; preds = %3
%15 = tail call double @powerOfTen(i32 %4)
%16 = tail call double @llvm.fmuladd.f64(double %7, double 2.000000e+00, double %15)
%17 = tail call double @powerOfTen(i32 %4)
%18 = fneg double %16
%19 = tail call double @llvm.fmuladd.f64(double %18, double %17, double %11)
%20 = fcmp ult double %19, 0.000000e+00
br i1 %20, label %94, label %21
21: ; preds = %14
%22 = tail call double @powerOfTen(i32 %4)
%23 = fmul double %22, 2.000000e+00
%24 = tail call double @llvm.fmuladd.f64(double %7, double 2.000000e+00, double %23)
%25 = tail call double @powerOfTen(i32 %4)
%26 = fmul double %25, 2.000000e+00
%27 = fneg double %24
%28 = tail call double @llvm.fmuladd.f64(double %27, double %26, double %11)
%29 = fcmp ult double %28, 0.000000e+00
br i1 %29, label %94, label %30
30: ; preds = %21
%31 = tail call double @powerOfTen(i32 %4)
%32 = fmul double %31, 3.000000e+00
%33 = tail call double @llvm.fmuladd.f64(double %7, double 2.000000e+00, double %32)
%34 = tail call double @powerOfTen(i32 %4)
%35 = fmul double %34, 3.000000e+00
%36 = fneg double %33
%37 = tail call double @llvm.fmuladd.f64(double %36, double %35, double %11)
%38 = fcmp ult double %37, 0.000000e+00
br i1 %38, label %94, label %39
39: ; preds = %30
%40 = tail call double @powerOfTen(i32 %4)
%41 = fmul double %40, 4.000000e+00
%42 = tail call double @llvm.fmuladd.f64(double %7, double 2.000000e+00, double %41)
%43 = tail call double @powerOfTen(i32 %4)
%44 = fmul double %43, 4.000000e+00
%45 = fneg double %42
%46 = tail call double @llvm.fmuladd.f64(double %45, double %44, double %11)
%47 = fcmp ult double %46, 0.000000e+00
br i1 %47, label %94, label %48
48: ; preds = %39
%49 = tail call double @powerOfTen(i32 %4)
%50 = fmul double %49, 5.000000e+00
%51 = tail call double @llvm.fmuladd.f64(double %7, double 2.000000e+00, double %50)
%52 = tail call double @powerOfTen(i32 %4)
%53 = fmul double %52, 5.000000e+00
%54 = fneg double %51
%55 = tail call double @llvm.fmuladd.f64(double %54, double %53, double %11)
%56 = fcmp ult double %55, 0.000000e+00
br i1 %56, label %94, label %57
57: ; preds = %48
%58 = tail call double @powerOfTen(i32 %4)
%59 = fmul double %58, 6.000000e+00
%60 = tail call double @llvm.fmuladd.f64(double %7, double 2.000000e+00, double %59)
%61 = tail call double @powerOfTen(i32 %4)
%62 = fmul double %61, 6.000000e+00
%63 = fneg double %60
%64 = tail call double @llvm.fmuladd.f64(double %63, double %62, double %11)
%65 = fcmp ult double %64, 0.000000e+00
br i1 %65, label %94, label %66
66: ; preds = %57
%67 = tail call double @powerOfTen(i32 %4)
%68 = fmul double %67, 7.000000e+00
%69 = tail call double @llvm.fmuladd.f64(double %7, double 2.000000e+00, double %68)
%70 = tail call double @powerOfTen(i32 %4)
%71 = fmul double %70, 7.000000e+00
%72 = fneg double %69
%73 = tail call double @llvm.fmuladd.f64(double %72, double %71, double %11)
%74 = fcmp ult double %73, 0.000000e+00
br i1 %74, label %94, label %75
75: ; preds = %66
%76 = tail call double @powerOfTen(i32 %4)
%77 = fmul double %76, 8.000000e+00
%78 = tail call double @llvm.fmuladd.f64(double %7, double 2.000000e+00, double %77)
%79 = tail call double @powerOfTen(i32 %4)
%80 = fmul double %79, 8.000000e+00
%81 = fneg double %78
%82 = tail call double @llvm.fmuladd.f64(double %81, double %80, double %11)
%83 = fcmp ult double %82, 0.000000e+00
br i1 %83, label %94, label %84
84: ; preds = %75
%85 = tail call double @powerOfTen(i32 %4)
%86 = fmul double %85, 9.000000e+00
%87 = tail call double @llvm.fmuladd.f64(double %7, double 2.000000e+00, double %86)
%88 = tail call double @powerOfTen(i32 %4)
%89 = fmul double %88, 9.000000e+00
%90 = fneg double %87
%91 = tail call double @llvm.fmuladd.f64(double %90, double %89, double %11)
%92 = fcmp ult double %91, 0.000000e+00
br i1 %92, label %94, label %93
93: ; preds = %84
br label %94
94: ; preds = %93, %84, %75, %66, %57, %48, %39, %30, %21, %14
%95 = phi double [ 0.000000e+00, %14 ], [ 1.000000e+00, %21 ], [ 2.000000e+00, %30 ], [ 3.000000e+00, %39 ], [ 4.000000e+00, %48 ], [ 5.000000e+00, %57 ], [ 6.000000e+00, %66 ], [ 7.000000e+00, %75 ], [ 8.000000e+00, %84 ], [ 9.000000e+00, %93 ]
%96 = tail call double @powerOfTen(i32 %4)
%97 = fmul double %95, %96
%98 = tail call double @llvm.fmuladd.f64(double %7, double 2.000000e+00, double %97)
%99 = tail call double @powerOfTen(i32 %4)
%100 = fmul double %95, %99
%101 = fneg double %98
%102 = tail call double @powerOfTen(i32 %4)
%103 = insertelement <2 x double> poison, double %95, i64 0
%104 = insertelement <2 x double> %103, double %101, i64 1
%105 = insertelement <2 x double> poison, double %102, i64 0
%106 = insertelement <2 x double> %105, double %100, i64 1
%107 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %104, <2 x double> %106, <2 x double> %5)
br label %108
108: ; preds = %3, %94
%109 = phi <2 x double> [ %107, %94 ], [ %5, %3 ]
%110 = add nsw i32 %4, -1
%111 = icmp ugt i32 %4, 1
br i1 %111, label %3, label %112
112: ; preds = %108, %156
%113 = phi i32 [ %158, %156 ], [ 0, %108 ]
%114 = phi <2 x double> [ %157, %156 ], [ %109, %108 ]
%115 = tail call double @powerOfTen(i32 %113)
%116 = extractelement <2 x double> %114, i64 0
%117 = tail call double @llvm.fmuladd.f64(double %116, double 2.000000e+00, double %115)
%118 = tail call double @powerOfTen(i32 %113)
%119 = fneg double %117
%120 = extractelement <2 x double> %114, i64 1
%121 = tail call double @llvm.fmuladd.f64(double %119, double %118, double %120)
%122 = fcmp ult double %121, 0.000000e+00
br i1 %122, label %156, label %123
123: ; preds = %112
%124 = tail call double @powerOfTen(i32 %113)
%125 = tail call double @llvm.fmuladd.f64(double %116, double 2.000000e+00, double %124)
%126 = tail call double @powerOfTen(i32 %113)
%127 = fneg double %125
%128 = tail call double @llvm.fmuladd.f64(double %127, double %126, double %120)
%129 = fcmp ult double %128, 0.000000e+00
br i1 %129, label %141, label %130
130: ; preds = %123, %130
%131 = phi double [ %132, %130 ], [ 1.000000e+00, %123 ]
%132 = fadd double %131, 1.000000e+00
%133 = tail call double @powerOfTen(i32 %113)
%134 = fmul double %132, %133
%135 = tail call double @llvm.fmuladd.f64(double %116, double 2.000000e+00, double %134)
%136 = tail call double @powerOfTen(i32 %113)
%137 = fmul double %132, %136
%138 = fneg double %135
%139 = tail call double @llvm.fmuladd.f64(double %138, double %137, double %120)
%140 = fcmp ult double %139, 0.000000e+00
br i1 %140, label %141, label %130
141: ; preds = %130, %123
%142 = phi double [ 1.000000e+00, %123 ], [ %132, %130 ]
%143 = fadd double %142, -1.000000e+00
%144 = tail call double @powerOfTen(i32 %113)
%145 = fmul double %143, %144
%146 = tail call double @llvm.fmuladd.f64(double %116, double 2.000000e+00, double %145)
%147 = tail call double @powerOfTen(i32 %113)
%148 = fmul double %143, %147
%149 = fneg double %146
%150 = tail call double @powerOfTen(i32 %113)
%151 = insertelement <2 x double> poison, double %143, i64 0
%152 = insertelement <2 x double> %151, double %149, i64 1
%153 = insertelement <2 x double> poison, double %150, i64 0
%154 = insertelement <2 x double> %153, double %148, i64 1
%155 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %152, <2 x double> %154, <2 x double> %114)
br label %156
156: ; preds = %112, %141
%157 = phi <2 x double> [ %155, %141 ], [ %114, %112 ]
%158 = add nsw i32 %113, -1
%159 = icmp sgt i32 %113, -8
br i1 %159, label %112, label %160
160: ; preds = %156
%161 = extractelement <2 x double> %157, i64 0
ret double %161
}