#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 fabs(double);
double sqrt(double);
void sss(double fg[2], double cs[2]) {
  double r, d;
  if ((fabs(fg[0]) + fabs(fg[1])) < (1e-30)) {
    cs[0] = 1.0;
    cs[1] = 0.0;
    d = 0.0;
  } else {
    d = sqrt(fg[0] * fg[0] + fg[1] * fg[1]);
    if (fabs(fg[0]) > fabs(fg[1])) {
      d = fabs(d);
      if (fg[0] < 0.0)
        d = -d;
    }
    if (fabs(fg[1]) >= fabs(fg[0])) {
      d = fabs(d);
      if (fg[1] < 0.0)
        d = -d;
    }
    cs[0] = fg[0] / d;
    cs[1] = fg[1] / d;
  }
  r = 1.0;
  if (fabs(fg[0]) > fabs(fg[1]))
    r = cs[1];
  else if (fabs(cs[0]) > (1e-30))
    r = 1.0 / cs[0];
  fg[0] = d;
  fg[1] = r;
  return;
}


x86 assembly (clang, -O0):
<sss>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <fabs@plt>
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
call   1030 <fabs@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
add    %ecx,%eax
cvtsi2sd %eax,%xmm1
movsd  0xe9f(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1194 <sss+0x74>
mov    -0x10(%rbp),%rax
movsd  0xe91(%rip),%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    12df <sss+0x1bf>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <fabs@plt>
mov    %eax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
call   1030 <fabs@plt>
mov    %eax,%ecx
mov    -0x28(%rbp),%eax
cmp    %ecx,%eax
jle    123d <sss+0x11d>
movsd  -0x20(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
ucomisd (%rax),%xmm0
jbe    1238 <sss+0x118>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    123d <sss+0x11d>
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
call   1030 <fabs@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <fabs@plt>
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
cmp    %ecx,%eax
jl     12b3 <sss+0x193>
movsd  -0x20(%rbp),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
ucomisd 0x8(%rax),%xmm0
jbe    12ae <sss+0x18e>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    12b3 <sss+0x193>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
divsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
divsd  -0x20(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,0x8(%rax)
movsd  0xd21(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <fabs@plt>
mov    %eax,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
call   1030 <fabs@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
cmp    %ecx,%eax
jle    132a <sss+0x20a>
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1367 <sss+0x247>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  0xcbd(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1362 <sss+0x242>
mov    -0x10(%rbp),%rax
movsd  0xcaf(%rip),%xmm0
divsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1367 <sss+0x247>
movsd  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movsd  %xmm0,0x8(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sss>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  (%rdi),%xmm0
call   1030 <fabs@plt>
mov    %eax,%ebp
movsd  0x8(%rbx),%xmm0
call   1030 <fabs@plt>
add    %ebp,%eax
jle    116c <sss+0x4c>
movsd  (%rbx),%xmm0
movsd  0x8(%rbx),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     118b <sss+0x6b>
sqrtsd %xmm0,%xmm0
jmp    1190 <sss+0x70>
movabs $0x3ff0000000000000,%rax
mov    %rax,(%r14)
xorpd  %xmm0,%xmm0
xorpd  %xmm1,%xmm1
movapd %xmm1,(%rsp)
jmp    1235 <sss+0x115>
call   1040 <sqrt@plt>
movapd %xmm0,(%rsp)
movsd  (%rbx),%xmm0
call   1030 <fabs@plt>
mov    %eax,%ebp
movsd  0x8(%rbx),%xmm0
call   1030 <fabs@plt>
cmp    %eax,%ebp
jle    11d6 <sss+0xb6>
movapd (%rsp),%xmm0
call   1030 <fabs@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
xorpd  %xmm0,%xmm0
ucomisd (%rbx),%xmm0
jbe    11d1 <sss+0xb1>
xorpd  0xe2f(%rip),%xmm1
movapd %xmm1,(%rsp)
movsd  0x8(%rbx),%xmm0
call   1030 <fabs@plt>
mov    %eax,%ebp
movsd  (%rbx),%xmm0
call   1030 <fabs@plt>
cmp    %eax,%ebp
jge    11f6 <sss+0xd6>
movapd (%rsp),%xmm1
jmp    121a <sss+0xfa>
movapd (%rsp),%xmm0
call   1030 <fabs@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
xorpd  %xmm0,%xmm0
ucomisd 0x8(%rbx),%xmm0
jbe    121a <sss+0xfa>
xorpd  0xde6(%rip),%xmm1
movsd  (%rbx),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%r14)
movsd  0x8(%rbx),%xmm0
movapd %xmm1,(%rsp)
divsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%r14)
movsd  (%rbx),%xmm0
call   1030 <fabs@plt>
mov    %eax,%ebp
movsd  0x8(%rbx),%xmm0
call   1030 <fabs@plt>
cmp    %eax,%ebp
jle    125c <sss+0x13c>
movsd  0x8(%r14),%xmm0
jmp    1277 <sss+0x157>
movsd  (%r14),%xmm0
call   1030 <fabs@plt>
movsd  0xda2(%rip),%xmm0
test   %eax,%eax
jle    1277 <sss+0x157>
divsd  (%r14),%xmm0
movaps (%rsp),%xmm1
movsd  %xmm1,(%rbx)
movsd  %xmm0,0x8(%rbx)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @sss(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %0
%4 = tail call i32 @fabs(double %3)
%5 = getelementptr inbounds double, double* %0, i64 1
%6 = load double, double* %5
%7 = tail call i32 @fabs(double %6)
%8 = add nsw i32 %7, %4
%9 = icmp slt i32 %8, 1
br i1 %9, label %10, label %11
10: ; preds = %2
store double 1.000000e+00, double* %1
br label %49
11: ; preds = %2
%12 = load double, double* %0
%13 = load double, double* %5
%14 = fmul double %13, %13
%15 = tail call double @llvm.fmuladd.f64(double %12, double %12, double %14)
%16 = tail call double @sqrt(double %15)
%17 = load double, double* %0
%18 = tail call i32 @fabs(double %17)
%19 = load double, double* %5
%20 = tail call i32 @fabs(double %19)
%21 = icmp sgt i32 %18, %20
br i1 %21, label %22, label %29
22: ; preds = %11
%23 = tail call i32 @fabs(double %16)
%24 = sitofp i32 %23 to double
%25 = load double, double* %0
%26 = fcmp olt double %25, 0.000000e+00
br i1 %26, label %27, label %29
27: ; preds = %22
%28 = fneg double %24
br label %29
29: ; preds = %22, %27, %11
%30 = phi double [ %28, %27 ], [ %24, %22 ], [ %16, %11 ]
%31 = load double, double* %5
%32 = tail call i32 @fabs(double %31)
%33 = load double, double* %0
%34 = tail call i32 @fabs(double %33)
%35 = icmp slt i32 %32, %34
br i1 %35, label %43, label %36
36: ; preds = %29
%37 = tail call i32 @fabs(double %30)
%38 = sitofp i32 %37 to double
%39 = load double, double* %5
%40 = fcmp olt double %39, 0.000000e+00
br i1 %40, label %41, label %43
41: ; preds = %36
%42 = fneg double %38
br label %43
43: ; preds = %36, %41, %29
%44 = phi double [ %42, %41 ], [ %38, %36 ], [ %30, %29 ]
%45 = load double, double* %0
%46 = fdiv double %45, %44
store double %46, double* %1
%47 = load double, double* %5
%48 = fdiv double %47, %44
br label %49
49: ; preds = %43, %10
%50 = phi double [ %48, %43 ], [ 0.000000e+00, %10 ]
%51 = phi double [ %44, %43 ], [ 0.000000e+00, %10 ]
%52 = getelementptr inbounds double, double* %1, i64 1
store double %50, double* %52
%53 = load double, double* %0
%54 = tail call i32 @fabs(double %53)
%55 = load double, double* %5
%56 = tail call i32 @fabs(double %55)
%57 = icmp sgt i32 %54, %56
br i1 %57, label %58, label %61
58: ; preds = %49
%59 = getelementptr inbounds double, double* %1, i64 1
%60 = load double, double* %59
br label %68
61: ; preds = %49
%62 = load double, double* %1
%63 = tail call i32 @fabs(double %62)
%64 = icmp sgt i32 %63, 0
br i1 %64, label %65, label %68
65: ; preds = %61
%66 = load double, double* %1
%67 = fdiv double 1.000000e+00, %66
br label %68
68: ; preds = %61, %65, %58
%69 = phi double [ %60, %58 ], [ %67, %65 ], [ 1.000000e+00, %61 ]
store double %51, double* %0
store double %69, double* %5
ret void
}