; LLVM IR from HRI-EU/Rcs :: src/RcsCore (Rcs_Mat3d)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #1

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @Mat3d_isEqual(ptr noundef %0, ptr noundef %1, double noundef %2) #2 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca double, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store double %2, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 0, ptr %8, align 4, !tbaa !11
  br label %11

11:                                               ; preds = %49, %3
  %12 = load i32, ptr %8, align 4, !tbaa !11
  %13 = icmp ult i32 %12, 3
  br i1 %13, label %15, label %14

14:                                               ; preds = %11
  store i32 2, ptr %9, align 4
  br label %52

15:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store i32 0, ptr %10, align 4, !tbaa !11
  br label %16

16:                                               ; preds = %43, %15
  %17 = load i32, ptr %10, align 4, !tbaa !11
  %18 = icmp ult i32 %17, 3
  br i1 %18, label %20, label %19

19:                                               ; preds = %16
  store i32 5, ptr %9, align 4
  br label %46

20:                                               ; preds = %16
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = load i32, ptr %8, align 4, !tbaa !11
  %23 = zext i32 %22 to i64
  %24 = getelementptr inbounds [3 x double], ptr %21, i64 %23
  %25 = load i32, ptr %10, align 4, !tbaa !11
  %26 = zext i32 %25 to i64
  %27 = getelementptr inbounds [3 x double], ptr %24, i64 0, i64 %26
  %28 = load double, ptr %27, align 8, !tbaa !9
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = load i32, ptr %8, align 4, !tbaa !11
  %31 = zext i32 %30 to i64
  %32 = getelementptr inbounds [3 x double], ptr %29, i64 %31
  %33 = load i32, ptr %10, align 4, !tbaa !11
  %34 = zext i32 %33 to i64
  %35 = getelementptr inbounds [3 x double], ptr %32, i64 0, i64 %34
  %36 = load double, ptr %35, align 8, !tbaa !9
  %37 = fsub double %28, %36
  %38 = call double @llvm.fabs.f64(double %37)
  %39 = load double, ptr %7, align 8, !tbaa !9
  %40 = fcmp ogt double %38, %39
  br i1 %40, label %41, label %42

41:                                               ; preds = %20
  store i1 false, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %46

42:                                               ; preds = %20
  br label %43

43:                                               ; preds = %42
  %44 = load i32, ptr %10, align 4, !tbaa !11
  %45 = add i32 %44, 1
  store i32 %45, ptr %10, align 4, !tbaa !11
  br label %16, !llvm.loop !13

46:                                               ; preds = %41, %19
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  %47 = load i32, ptr %9, align 4
  switch i32 %47, label %52 [
    i32 5, label %48
  ]

48:                                               ; preds = %46
  br label %49

49:                                               ; preds = %48
  %50 = load i32, ptr %8, align 4, !tbaa !11
  %51 = add i32 %50, 1
  store i32 %51, ptr %8, align 4, !tbaa !11
  br label %11, !llvm.loop !15

52:                                               ; preds = %46, %14
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  %53 = load i32, ptr %9, align 4
  switch i32 %53, label %57 [
    i32 2, label %54
    i32 1, label %55
  ]

54:                                               ; preds = %52
  store i1 true, ptr %4, align 1
  br label %55

55:                                               ; preds = %54, %52
  %56 = load i1, ptr %4, align 1
  ret i1 %56

57:                                               ; preds = %52
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.fabs.f64(double) #0

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local noundef zeroext i1 @Mat3d_isEqual(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1, double noundef %2) local_unnamed_addr #1 {
.preheader:
  %3 = load double, ptr %0, align 8, !tbaa !5
  %4 = load double, ptr %1, align 8, !tbaa !5
  %5 = fsub double %3, %4
  %6 = tail call double @llvm.fabs.f64(double %5)
  %7 = fcmp ogt double %6, %2
  br i1 %7, label %.loopexit.loopexit, label %8

8:                                                ; preds = %.preheader
  %9 = getelementptr inbounds i8, ptr %0, i64 8
  %10 = load double, ptr %9, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %1, i64 8
  %12 = load double, ptr %11, align 8, !tbaa !5
  %13 = fsub double %10, %12
  %14 = tail call double @llvm.fabs.f64(double %13)
  %15 = fcmp ogt double %14, %2
  br i1 %15, label %.loopexit.loopexit, label %16

16:                                               ; preds = %8
  %17 = getelementptr inbounds i8, ptr %0, i64 16
  %18 = load double, ptr %17, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %1, i64 16
  %20 = load double, ptr %19, align 8, !tbaa !5
  %21 = fsub double %18, %20
  %22 = tail call double @llvm.fabs.f64(double %21)
  %23 = fcmp ogt double %22, %2
  br i1 %23, label %.loopexit.loopexit, label %.preheader.1

.preheader.1:                                     ; preds = %16
  %24 = getelementptr inbounds i8, ptr %0, i64 24
  %25 = load double, ptr %24, align 8, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %1, i64 24
  %27 = load double, ptr %26, align 8, !tbaa !5
  %28 = fsub double %25, %27
  %29 = tail call double @llvm.fabs.f64(double %28)
  %30 = fcmp ogt double %29, %2
  br i1 %30, label %.loopexit.loopexit, label %31

31:                                               ; preds = %.preheader.1
  %32 = getelementptr inbounds i8, ptr %0, i64 32
  %33 = load double, ptr %32, align 8, !tbaa !5
  %34 = getelementptr inbounds i8, ptr %1, i64 32
  %35 = load double, ptr %34, align 8, !tbaa !5
  %36 = fsub double %33, %35
  %37 = tail call double @llvm.fabs.f64(double %36)
  %38 = fcmp ogt double %37, %2
  br i1 %38, label %.loopexit.loopexit, label %39

39:                                               ; preds = %31
  %40 = getelementptr inbounds i8, ptr %0, i64 40
  %41 = load double, ptr %40, align 8, !tbaa !5
  %42 = getelementptr inbounds i8, ptr %1, i64 40
  %43 = load double, ptr %42, align 8, !tbaa !5
  %44 = fsub double %41, %43
  %45 = tail call double @llvm.fabs.f64(double %44)
  %46 = fcmp ogt double %45, %2
  br i1 %46, label %.loopexit.loopexit, label %.preheader.2

.preheader.2:                                     ; preds = %39
  %47 = getelementptr inbounds i8, ptr %0, i64 48
  %48 = load double, ptr %47, align 8, !tbaa !5
  %49 = getelementptr inbounds i8, ptr %1, i64 48
  %50 = load double, ptr %49, align 8, !tbaa !5
  %51 = fsub double %48, %50
  %52 = tail call double @llvm.fabs.f64(double %51)
  %53 = fcmp ogt double %52, %2
  br i1 %53, label %.loopexit.loopexit, label %54

54:                                               ; preds = %.preheader.2
  %55 = getelementptr inbounds i8, ptr %0, i64 56
  %56 = load double, ptr %55, align 8, !tbaa !5
  %57 = getelementptr inbounds i8, ptr %1, i64 56
  %58 = load double, ptr %57, align 8, !tbaa !5
  %59 = fsub double %56, %58
  %60 = tail call double @llvm.fabs.f64(double %59)
  %61 = fcmp ogt double %60, %2
  br i1 %61, label %.loopexit.loopexit, label %62

62:                                               ; preds = %54
  %63 = getelementptr inbounds i8, ptr %0, i64 64
  %64 = load double, ptr %63, align 8, !tbaa !5
  %65 = getelementptr inbounds i8, ptr %1, i64 64
  %66 = load double, ptr %65, align 8, !tbaa !5
  %67 = fsub double %64, %66
  %68 = tail call double @llvm.fabs.f64(double %67)
  %69 = fcmp ogt double %68, %2
  br i1 %69, label %.loopexit.loopexit, label %.loopexit

.loopexit.loopexit:                               ; preds = %62, %54, %.preheader.2, %39, %31, %.preheader.1, %16, %8, %.preheader
  br label %.loopexit

.loopexit:                                        ; preds = %62, %.loopexit.loopexit
  %70 = phi i1 [ false, %.loopexit.loopexit ], [ true, %62 ]
  ret i1 %70
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass