#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*/ fabs(double);
double svd_dmax(int /*<<< orphan*/, int /*<<< orphan*/);
double svd_dmin(int /*<<< orphan*/, int /*<<< orphan*/);
double svd_pythag(double a, double b) {
  double p, r, s, t, u, temp;
  p = svd_dmax(fabs(a), fabs(b));
  if (p != 0.0) {
    temp = svd_dmin(fabs(a), fabs(b)) / p;
    r = temp * temp;
    t = 4.0 + r;
    while (t != 4.0) {
      s = r / t;
      u = 1.0 + 2.0 * s;
      p *= u;
      temp = s / u;
      r *= temp * temp;
      t = 4.0 + r;
    }
  }
  return (p);
}


x86 assembly (clang, -O0):
<svd_pythag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1050 <fabs@plt>
mov    %eax,-0x44(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <fabs@plt>
mov    -0x44(%rbp),%edi
mov    %eax,%esi
call   1030 <svd_dmax@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1185 <svd_pythag+0x55>
jp     1185 <svd_pythag+0x55>
jmp    126a <svd_pythag+0x13a>
movsd  -0x8(%rbp),%xmm0
call   1050 <fabs@plt>
mov    %eax,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <fabs@plt>
mov    -0x48(%rbp),%edi
mov    %eax,%esi
call   1040 <svd_dmin@plt>
divsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe39(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  0xe22(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    11f3 <svd_pythag+0xc3>
jp     11f3 <svd_pythag+0xc3>
jmp    1265 <svd_pythag+0x135>
movsd  -0x20(%rbp),%xmm0
divsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xdf5(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x28(%rbp),%xmm0
divsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xdaa(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    11d1 <svd_pythag+0xa1>
jmp    126a <svd_pythag+0x13a>
movsd  -0x18(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<svd_pythag>:
push   %rbx
sub    $0x10,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,(%rsp)
call   1050 <fabs@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
call   1050 <fabs@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1030 <svd_dmax@plt>
movapd %xmm0,%xmm5
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm5
jne    116f <svd_pythag+0x3f>
jnp    1204 <svd_pythag+0xd4>
movsd  (%rsp),%xmm0
movsd  %xmm5,(%rsp)
call   1050 <fabs@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
call   1050 <fabs@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1040 <svd_dmin@plt>
movsd  (%rsp),%xmm5
divsd  %xmm5,%xmm0
mulsd  %xmm0,%xmm0
movsd  0xe57(%rip),%xmm1
movapd %xmm0,%xmm3
addsd  %xmm1,%xmm3
ucomisd %xmm1,%xmm3
jne    11b9 <svd_pythag+0x89>
jnp    1204 <svd_pythag+0xd4>
movsd  0xe47(%rip),%xmm2
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movapd %xmm0,%xmm4
divsd  %xmm3,%xmm4
movapd %xmm4,%xmm3
addsd  %xmm4,%xmm3
addsd  %xmm2,%xmm3
mulsd  %xmm3,%xmm5
divsd  %xmm3,%xmm4
mulsd  %xmm4,%xmm4
mulsd  %xmm4,%xmm0
movapd %xmm0,%xmm3
addsd  %xmm1,%xmm3
ucomisd %xmm1,%xmm3
jne    11d0 <svd_pythag+0xa0>
jp     11d0 <svd_pythag+0xa0>
movapd %xmm5,%xmm0
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define double @svd_pythag(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store double %0, double* %3
store double %1, double* %4
%11 = load double, double* %3
%12 = call i32 @fabs(double %11)
%13 = load double, double* %4
%14 = call i32 @fabs(double %13)
%15 = call double @svd_dmax(i32 %12, i32 %14)
store double %15, double* %5
%16 = load double, double* %5
%17 = fcmp une double %16, 0.000000e+00
br i1 %17, label %18, label %54
18: ; preds = %2
%19 = load double, double* %3
%20 = call i32 @fabs(double %19)
%21 = load double, double* %4
%22 = call i32 @fabs(double %21)
%23 = call double @svd_dmin(i32 %20, i32 %22)
%24 = load double, double* %5
%25 = fdiv double %23, %24
store double %25, double* %10
%26 = load double, double* %10
%27 = load double, double* %10
%28 = fmul double %26, %27
store double %28, double* %6
%29 = load double, double* %6
%30 = fadd double 4.000000e+00, %29
store double %30, double* %8
br label %31
31: ; preds = %34, %18
%32 = load double, double* %8
%33 = fcmp une double %32, 4.000000e+00
br i1 %33, label %34, label %53
34: ; preds = %31
%35 = load double, double* %6
%36 = load double, double* %8
%37 = fdiv double %35, %36
store double %37, double* %7
%38 = load double, double* %7
%39 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %38, double 1.000000e+00)
store double %39, double* %9
%40 = load double, double* %9
%41 = load double, double* %5
%42 = fmul double %41, %40
store double %42, double* %5
%43 = load double, double* %7
%44 = load double, double* %9
%45 = fdiv double %43, %44
store double %45, double* %10
%46 = load double, double* %10
%47 = load double, double* %10
%48 = fmul double %46, %47
%49 = load double, double* %6
%50 = fmul double %49, %48
store double %50, double* %6
%51 = load double, double* %6
%52 = fadd double 4.000000e+00, %51
store double %52, double* %8
br label %31
53: ; preds = %31
br label %54
54: ; preds = %53, %2
%55 = load double, double* %5
ret double %55
}

LLVM IR (-O2):
define double @svd_pythag(double %0, double %1) {
%3 = tail call i32 @fabs(double %0)
%4 = tail call i32 @fabs(double %1)
%5 = tail call double @svd_dmax(i32 %3, i32 %4)
%6 = fcmp une double %5, 0.000000e+00
br i1 %6, label %7, label %27
7: ; preds = %2
%8 = tail call i32 @fabs(double %0)
%9 = tail call i32 @fabs(double %1)
%10 = tail call double @svd_dmin(i32 %8, i32 %9)
%11 = fdiv double %10, %5
%12 = fmul double %11, %11
%13 = fadd double %12, 4.000000e+00
%14 = fcmp une double %13, 4.000000e+00
br i1 %14, label %15, label %27
15: ; preds = %7, %15
%16 = phi double [ %25, %15 ], [ %13, %7 ]
%17 = phi double [ %21, %15 ], [ %5, %7 ]
%18 = phi double [ %24, %15 ], [ %12, %7 ]
%19 = fdiv double %18, %16
%20 = tail call double @llvm.fmuladd.f64(double %19, double 2.000000e+00, double 1.000000e+00)
%21 = fmul double %17, %20
%22 = fdiv double %19, %20
%23 = fmul double %22, %22
%24 = fmul double %18, %23
%25 = fadd double %24, 4.000000e+00
%26 = fcmp une double %25, 4.000000e+00
br i1 %26, label %15, label %27
27: ; preds = %15, %7, %2
%28 = phi double [ %5, %2 ], [ %5, %7 ], [ %21, %15 ]
ret double %28
}