#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 */
float d_sign(float, float);
float sqrt(float);
int g1(float *a, float *b, float *cterm, float *sterm, float *sig) {
  float d;
  float xr, yr;
  if (((*a) >= 0 ? (*a) : -(*a)) > ((*b) >= 0 ? (*b) : -(*b))) {
    xr = *b / *a;
    d = xr;
    yr = sqrt(d * d + 1.);
    d = 1. / yr;
    *cterm = d_sign(d, *a);
    *sterm = *cterm * xr;
    *sig = ((*a) >= 0 ? (*a) : -(*a)) * yr;
    return 0;
  }
  if (*b != 0.) {
    xr = *a / *b;
    d = xr;
    yr = sqrt(d * d + 1.);
    d = 1. / yr;
    *sterm = d_sign(d, *b);
    *cterm = *sterm * xr;
    *sig = ((*b) >= 0 ? (*b) : -(*b)) * yr;
    return 0;
  }
  *sig = 0.;
  *cterm = 0.;
  *sterm = 1.;
  return 0;
}


x86 assembly (clang, -O0):
<g1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1162 <g1+0x42>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x40(%rbp)
jmp    117c <g1+0x5c>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x40(%rbp)
movss  -0x40(%rbp),%xmm0
movss  %xmm0,-0x44(%rbp)
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     11ac <g1+0x8c>
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x48(%rbp)
jmp    11c6 <g1+0xa6>
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x48(%rbp)
movss  -0x44(%rbp),%xmm0
movss  -0x48(%rbp),%xmm1
ucomiss %xmm1,%xmm0
jbe    12cb <g1+0x1ab>
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
divss  (%rax),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x38(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x34(%rbp),%xmm0
mulss  -0x34(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdfa(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1040 <sqrt@plt>
movss  %xmm0,-0x3c(%rbp)
movss  -0x3c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xdd7(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x34(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm1
call   1030 <d_sign@plt>
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm0
mulss  -0x38(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1293 <g1+0x173>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x4c(%rbp)
jmp    12ad <g1+0x18d>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  -0x4c(%rbp),%xmm0
mulss  -0x3c(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movss  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    140e <g1+0x2ee>
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    12ef <g1+0x1cf>
jp     12ef <g1+0x1cf>
jmp    13e1 <g1+0x2c1>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x18(%rbp),%rax
divss  (%rax),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x38(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x34(%rbp),%xmm0
mulss  -0x34(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xce4(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1040 <sqrt@plt>
movss  %xmm0,-0x3c(%rbp)
movss  -0x3c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xcc1(%rip),%xmm0
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x34(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm1
call   1030 <d_sign@plt>
mov    -0x28(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movss  (%rax),%xmm0
mulss  -0x38(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     13a9 <g1+0x289>
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x50(%rbp)
jmp    13c3 <g1+0x2a3>
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm0,-0x50(%rbp)
movss  -0x50(%rbp),%xmm0
mulss  -0x3c(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movss  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    140e <g1+0x2ee>
mov    -0x30(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
movss  0xbfd(%rip),%xmm0
movss  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g1>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %r8,%r14
mov    %rcx,%r15
mov    %rdx,%r12
movss  (%rdi),%xmm4
movaps 0xebf(%rip),%xmm0
movaps %xmm4,%xmm2
xorps  %xmm0,%xmm2
xorps  %xmm1,%xmm1
xorps  %xmm3,%xmm3
cmpnless %xmm4,%xmm3
andps  %xmm3,%xmm2
andnps %xmm4,%xmm3
orps   %xmm2,%xmm3
movss  (%rsi),%xmm5
xorps  %xmm5,%xmm0
xorps  %xmm2,%xmm2
cmpnless %xmm5,%xmm2
andps  %xmm2,%xmm0
andnps %xmm5,%xmm2
orps   %xmm0,%xmm2
ucomiss %xmm2,%xmm3
jbe    11a1 <g1+0x81>
mov    %rdi,%rbx
divss  %xmm4,%xmm5
movaps %xmm5,%xmm0
mulss  %xmm5,%xmm0
addss  0xe82(%rip),%xmm0
ucomiss %xmm1,%xmm0
movaps %xmm5,0x10(%rsp)
jb     11d4 <g1+0xb4>
xorps  %xmm1,%xmm1
sqrtss %xmm0,%xmm1
jmp    11dc <g1+0xbc>
ucomiss %xmm1,%xmm5
jne    11a8 <g1+0x88>
jnp    1211 <g1+0xf1>
mov    %rsi,%r13
divss  %xmm5,%xmm4
movaps %xmm4,0x10(%rsp)
movaps %xmm4,%xmm0
mulss  %xmm4,%xmm0
addss  0xe4d(%rip),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     1229 <g1+0x109>
xorps  %xmm1,%xmm1
sqrtss %xmm0,%xmm1
jmp    1231 <g1+0x111>
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movss  %xmm1,0xc(%rsp)
movss  0xe26(%rip),%xmm0
divss  %xmm1,%xmm0
movss  (%rbx),%xmm1
call   1030 <d_sign@plt>
movss  %xmm0,(%r12)
movaps 0x10(%rsp),%xmm1
mulss  %xmm0,%xmm1
movss  %xmm1,(%r15)
movss  (%rbx),%xmm0
jmp    1268 <g1+0x148>
movl   $0x0,(%r14)
movl   $0x0,(%r12)
movl   $0x3f800000,(%r15)
jmp    128e <g1+0x16e>
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movss  %xmm1,0xc(%rsp)
movss  0xdd1(%rip),%xmm0
divss  %xmm1,%xmm0
movss  0x0(%r13),%xmm1
call   1030 <d_sign@plt>
movss  %xmm0,(%r15)
movaps 0x10(%rsp),%xmm1
mulss  %xmm0,%xmm1
movss  %xmm1,(%r12)
movss  0x0(%r13),%xmm0
movaps 0xd91(%rip),%xmm1
xorps  %xmm0,%xmm1
xorps  %xmm2,%xmm2
cmpnless %xmm0,%xmm2
andps  %xmm2,%xmm1
andnps %xmm0,%xmm2
orps   %xmm1,%xmm2
mulss  0xc(%rsp),%xmm2
movss  %xmm2,(%r14)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @g1(float* nocapture %0, float* nocapture %1, float* nocapture writeonly %2, float* nocapture writeonly %3, float* nocapture writeonly %4) {
%6 = load float, float* %0
%7 = fcmp ult float %6, 0.000000e+00
%8 = fneg float %6
%9 = select i1 %7, float %8, float %6
%10 = load float, float* %1
%11 = fcmp ult float %10, 0.000000e+00
%12 = fneg float %10
%13 = select i1 %11, float %12, float %10
%14 = fcmp ogt float %9, %13
br i1 %14, label %15, label %29
15: ; preds = %5
%16 = fdiv float %10, %6
%17 = fmul float %16, %16
%18 = fadd float %17, 1.000000e+00
%19 = tail call float @sqrt(float %18)
%20 = fdiv float 1.000000e+00, %19
%21 = load float, float* %0
%22 = tail call float @d_sign(float %20, float %21)
store float %22, float* %2
%23 = fmul float %16, %22
store float %23, float* %3
%24 = load float, float* %0
%25 = fcmp ult float %24, 0.000000e+00
%26 = fneg float %24
%27 = select i1 %25, float %26, float %24
%28 = fmul float %19, %27
store float %28, float* %4
br label %46
29: ; preds = %5
%30 = fcmp une float %10, 0.000000e+00
br i1 %30, label %31, label %45
31: ; preds = %29
%32 = fdiv float %6, %10
%33 = fmul float %32, %32
%34 = fadd float %33, 1.000000e+00
%35 = tail call float @sqrt(float %34)
%36 = fdiv float 1.000000e+00, %35
%37 = load float, float* %1
%38 = tail call float @d_sign(float %36, float %37)
store float %38, float* %3
%39 = fmul float %32, %38
store float %39, float* %2
%40 = load float, float* %1
%41 = fcmp ult float %40, 0.000000e+00
%42 = fneg float %40
%43 = select i1 %41, float %42, float %40
%44 = fmul float %35, %43
store float %44, float* %4
br label %46
45: ; preds = %29
store float 0.000000e+00, float* %4
store float 0.000000e+00, float* %2
store float 1.000000e+00, float* %3
br label %46
46: ; preds = %45, %31, %15
ret i32 0
}