; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R3Shapes/R4Matrix.ll (ZNK8R4Matrix14HasTranslationEv)

; 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"

%class.R4Matrix = type { [4 x [4 x double]] }

@RN_EPSILON = external global double, align 8

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK8R4Matrix14HasTranslationEv(ptr noundef nonnull align 8 dereferenceable(128) %0) #0 align 2 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %4 = load ptr, ptr %3, align 8
  %5 = getelementptr inbounds %class.R4Matrix, ptr %4, i32 0, i32 0
  %6 = getelementptr inbounds [4 x [4 x double]], ptr %5, i64 0, i64 0
  %7 = getelementptr inbounds [4 x double], ptr %6, i64 0, i64 3
  %8 = load double, ptr %7, align 8, !tbaa !9
  %9 = load double, ptr @RN_EPSILON, align 8, !tbaa !9
  %10 = call noundef i32 @_Z11RNIsNotZerodd(double noundef %8, double noundef %9)
  %11 = icmp ne i32 %10, 0
  br i1 %11, label %12, label %13

12:                                               ; preds = %1
  store i32 1, ptr %2, align 4
  br label %32

13:                                               ; preds = %1
  %14 = getelementptr inbounds %class.R4Matrix, ptr %4, i32 0, i32 0
  %15 = getelementptr inbounds [4 x [4 x double]], ptr %14, i64 0, i64 1
  %16 = getelementptr inbounds [4 x double], ptr %15, i64 0, i64 3
  %17 = load double, ptr %16, align 8, !tbaa !9
  %18 = load double, ptr @RN_EPSILON, align 8, !tbaa !9
  %19 = call noundef i32 @_Z11RNIsNotZerodd(double noundef %17, double noundef %18)
  %20 = icmp ne i32 %19, 0
  br i1 %20, label %21, label %22

21:                                               ; preds = %13
  store i32 1, ptr %2, align 4
  br label %32

22:                                               ; preds = %13
  %23 = getelementptr inbounds %class.R4Matrix, ptr %4, i32 0, i32 0
  %24 = getelementptr inbounds [4 x [4 x double]], ptr %23, i64 0, i64 2
  %25 = getelementptr inbounds [4 x double], ptr %24, i64 0, i64 3
  %26 = load double, ptr %25, align 8, !tbaa !9
  %27 = load double, ptr @RN_EPSILON, align 8, !tbaa !9
  %28 = call noundef i32 @_Z11RNIsNotZerodd(double noundef %26, double noundef %27)
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %31

30:                                               ; preds = %22
  store i32 1, ptr %2, align 4
  br label %32

31:                                               ; preds = %22
  store i32 0, ptr %2, align 4
  br label %32

32:                                               ; preds = %31, %30, %21, %12
  %33 = load i32, ptr %2, align 4
  ret i32 %33
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z11RNIsNotZerodd(double noundef, double noundef) #1

attributes #0 = { mustprogress 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 #1 = { inlinehint mustprogress 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"double", !7, i64 0}


; 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"

@RN_EPSILON = external local_unnamed_addr global double, align 8

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 2) i32 @_ZNK8R4Matrix14HasTranslationEv(ptr nocapture noundef nonnull readonly align 8 dereferenceable(128) %0) local_unnamed_addr #0 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 24
  %3 = load double, ptr %2, align 8, !tbaa !5
  %4 = load double, ptr @RN_EPSILON, align 8, !tbaa !5
  %5 = tail call noundef i32 @_Z11RNIsNotZerodd(double noundef %3, double noundef %4)
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %6, label %16

6:                                                ; preds = %1
  %7 = getelementptr inbounds i8, ptr %0, i64 56
  %8 = load double, ptr %7, align 8, !tbaa !5
  %9 = load double, ptr @RN_EPSILON, align 8, !tbaa !5
  %10 = tail call noundef i32 @_Z11RNIsNotZerodd(double noundef %8, double noundef %9)
  %.not1 = icmp eq i32 %10, 0
  br i1 %.not1, label %11, label %16

11:                                               ; preds = %6
  %12 = getelementptr inbounds i8, ptr %0, i64 88
  %13 = load double, ptr %12, align 8, !tbaa !5
  %14 = load double, ptr @RN_EPSILON, align 8, !tbaa !5
  %15 = tail call noundef i32 @_Z11RNIsNotZerodd(double noundef %13, double noundef %14)
  %.not2 = icmp ne i32 %15, 0
  %. = zext i1 %.not2 to i32
  br label %16

16:                                               ; preds = %11, %6, %1
  %.0 = phi i32 [ 1, %1 ], [ 1, %6 ], [ %., %11 ]
  ret i32 %.0
}

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z11RNIsNotZerodd(double noundef, double noundef) local_unnamed_addr #1

attributes #0 = { mustprogress 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 #1 = { inlinehint mustprogress 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++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass