#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 */
scalar_t__ fabsf(float);
float sqrtf(int);
void givensRotation_float(float *csVect, float a, float b) {
  float tau;
  float tmpVal;
  if (b == 0.0) {
    csVect[0] = 1.0;
    csVect[1] = 0.0;
  } else {
    if (fabsf(b) > fabsf(a)) {
      tau = (-a) / b;
      tmpVal = sqrtf(1 + (tau * tau));
      csVect[1] = 1 / tmpVal;
      csVect[0] = tau / tmpVal;
    } else {
      tau = (-b) / a;
      tmpVal = sqrtf(1 + (tau * tau));
      csVect[0] = 1 / tmpVal;
      csVect[1] = tau / tmpVal;
    }
  }
}


x86 assembly (clang, -O0):
<givensRotation_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  %xmm1,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1173 <givensRotation_float+0x53>
jp     1173 <givensRotation_float+0x53>
mov    -0x8(%rbp),%rax
movss  0xea2(%rip),%xmm0
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x4(%rax)
jmp    127d <givensRotation_float+0x15d>
movss  -0x10(%rbp),%xmm0
call   1030 <fabsf@plt>
mov    %rax,-0x20(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <fabsf@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
jle    120c <givensRotation_float+0xec>
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
divss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xe33(%rip),%xmm1
addss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
call   1040 <sqrtf@plt>
movss  %xmm0,-0x18(%rbp)
movss  0xe19(%rip),%xmm0
divss  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x14(%rbp),%xmm0
divss  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
jmp    1278 <givensRotation_float+0x158>
movss  -0x10(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
divss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  -0x14(%rbp),%xmm1
mulss  %xmm1,%xmm0
movss  0xdc2(%rip),%xmm1
addss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
call   1040 <sqrtf@plt>
movss  %xmm0,-0x18(%rbp)
movss  0xda8(%rip),%xmm0
divss  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x14(%rbp),%xmm0
divss  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
jmp    127d <givensRotation_float+0x15d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<givensRotation_float>:
push   %r14
push   %rbx
sub    $0x28,%rsp
movaps %xmm0,%xmm2
mov    %rdi,%rbx
xorps  %xmm0,%xmm0
ucomiss %xmm0,%xmm1
jne    1143 <givensRotation_float+0x23>
jp     1143 <givensRotation_float+0x23>
movq   $0x3f800000,(%rbx)
jmp    11f7 <givensRotation_float+0xd7>
movaps %xmm1,0x10(%rsp)
movaps %xmm1,%xmm0
movaps %xmm2,(%rsp)
call   1030 <fabsf@plt>
mov    %rax,%r14
movaps (%rsp),%xmm0
call   1030 <fabsf@plt>
cmp    %rax,%r14
jle    11ae <givensRotation_float+0x8e>
movaps (%rsp),%xmm0
xorps  0xe90(%rip),%xmm0
divss  0x10(%rsp),%xmm0
movaps %xmm0,(%rsp)
mulss  %xmm0,%xmm0
addss  0xe8a(%rip),%xmm0
cvttss2si %xmm0,%edi
call   1040 <sqrtf@plt>
movss  0xe79(%rip),%xmm1
divss  %xmm0,%xmm1
movss  %xmm1,0x4(%rbx)
movaps (%rsp),%xmm1
divss  %xmm0,%xmm1
movss  %xmm1,(%rbx)
jmp    11f7 <givensRotation_float+0xd7>
movaps 0x10(%rsp),%xmm0
xorps  0xe46(%rip),%xmm0
divss  (%rsp),%xmm0
movaps %xmm0,0x10(%rsp)
mulss  %xmm0,%xmm0
addss  0xe40(%rip),%xmm0
cvttss2si %xmm0,%edi
call   1040 <sqrtf@plt>
movss  0xe2f(%rip),%xmm1
divss  %xmm0,%xmm1
movss  %xmm1,(%rbx)
movaps 0x10(%rsp),%xmm1
divss  %xmm0,%xmm1
movss  %xmm1,0x4(%rbx)
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @givensRotation_float(float* %0, float %1, float %2) {
%4 = alloca float*
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float* %0, float** %4
store float %1, float* %5
store float %2, float* %6
%9 = load float, float* %6
%10 = fpext float %9 to double
%11 = fcmp oeq double %10, 0.000000e+00
br i1 %11, label %12, label %17
12: ; preds = %3
%13 = load float*, float** %4
%14 = getelementptr inbounds float, float* %13, i64 0
store float 1.000000e+00, float* %14
%15 = load float*, float** %4
%16 = getelementptr inbounds float, float* %15, i64 1
store float 0.000000e+00, float* %16
br label %62
17: ; preds = %3
%18 = load float, float* %6
%19 = call i64 @fabsf(float %18)
%20 = load float, float* %5
%21 = call i64 @fabsf(float %20)
%22 = icmp sgt i64 %19, %21
br i1 %22, label %23, label %42
23: ; preds = %17
%24 = load float, float* %5
%25 = fneg float %24
%26 = load float, float* %6
%27 = fdiv float %25, %26
store float %27, float* %7
%28 = load float, float* %7
%29 = load float, float* %7
%30 = call float @llvm.fmuladd.f32(float %28, float %29, float 1.000000e+00)
%31 = fptosi float %30 to i32
%32 = call float @sqrtf(i32 %31)
store float %32, float* %8
%33 = load float, float* %8
%34 = fdiv float 1.000000e+00, %33
%35 = load float*, float** %4
%36 = getelementptr inbounds float, float* %35, i64 1
store float %34, float* %36
%37 = load float, float* %7
%38 = load float, float* %8
%39 = fdiv float %37, %38
%40 = load float*, float** %4
%41 = getelementptr inbounds float, float* %40, i64 0
store float %39, float* %41
br label %61
42: ; preds = %17
%43 = load float, float* %6
%44 = fneg float %43
%45 = load float, float* %5
%46 = fdiv float %44, %45
store float %46, float* %7
%47 = load float, float* %7
%48 = load float, float* %7
%49 = call float @llvm.fmuladd.f32(float %47, float %48, float 1.000000e+00)
%50 = fptosi float %49 to i32
%51 = call float @sqrtf(i32 %50)
store float %51, float* %8
%52 = load float, float* %8
%53 = fdiv float 1.000000e+00, %52
%54 = load float*, float** %4
%55 = getelementptr inbounds float, float* %54, i64 0
store float %53, float* %55
%56 = load float, float* %7
%57 = load float, float* %8
%58 = fdiv float %56, %57
%59 = load float*, float** %4
%60 = getelementptr inbounds float, float* %59, i64 1
store float %58, float* %60
br label %61
61: ; preds = %42, %23
br label %62
62: ; preds = %61, %12
ret void
}

LLVM IR (-O2):
define void @givensRotation_float(float* nocapture writeonly %0, float %1, float %2) {
%4 = fcmp oeq float %2, 0.000000e+00
br i1 %4, label %5, label %7
5: ; preds = %3
store float 1.000000e+00, float* %0
%6 = getelementptr inbounds float, float* %0, i64 1
store float 0.000000e+00, float* %6
br label %29
7: ; preds = %3
%8 = tail call i64 @fabsf(float %2)
%9 = tail call i64 @fabsf(float %1)
%10 = icmp sgt i64 %8, %9
br i1 %10, label %11, label %20
11: ; preds = %7
%12 = fneg float %1
%13 = fdiv float %12, %2
%14 = tail call float @llvm.fmuladd.f32(float %13, float %13, float 1.000000e+00)
%15 = fptosi float %14 to i32
%16 = tail call float @sqrtf(i32 %15)
%17 = fdiv float 1.000000e+00, %16
%18 = getelementptr inbounds float, float* %0, i64 1
store float %17, float* %18
%19 = fdiv float %13, %16
store float %19, float* %0
br label %29
20: ; preds = %7
%21 = fneg float %2
%22 = fdiv float %21, %1
%23 = tail call float @llvm.fmuladd.f32(float %22, float %22, float 1.000000e+00)
%24 = fptosi float %23 to i32
%25 = tail call float @sqrtf(i32 %24)
%26 = fdiv float 1.000000e+00, %25
store float %26, float* %0
%27 = fdiv float %22, %25
%28 = getelementptr inbounds float, float* %0, i64 1
store float %27, float* %28
br label %29
29: ; preds = %11, %20, %5
ret void
}