; LLVM IR from ETH3D/dataset-pipeline :: thirdparty/cork/cork/isct (triangle)

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

%struct.mesh = type { %struct.memorypool, %struct.memorypool, %struct.memorypool, %struct.memorypool, %struct.memorypool, %struct.memorypool, %struct.memorypool, %struct.memorypool, [4096 x ptr], [4096 x ptr], [4096 x i32], i32, ptr, double, double, double, double, double, i32, i32, i32, i32, i32, i32, i64, i32, i32, i32, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, i64, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %struct.otri }
%struct.memorypool = type { ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i64, i64, i32, i32 }
%struct.otri = type { ptr, i32 }

@minus1mod3 = external dso_local global [3 x i32], align 4

; 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 speculatable willreturn memory(none)
declare double @llvm.fmuladd.f64(double, double, double) #1

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

; Function Attrs: nounwind uwtable
define dso_local i32 @rightofhyperbola(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca double, align 8
  %11 = alloca double, align 8
  %12 = alloca double, align 8
  %13 = alloca double, align 8
  %14 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.mesh, ptr %15, i32 0, i32 42
  %17 = load i64, ptr %16, align 8, !tbaa !9
  %18 = add nsw i64 %17, 1
  store i64 %18, ptr %16, align 8, !tbaa !9
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.otri, ptr %19, i32 0, i32 0
  %21 = load ptr, ptr %20, align 8, !tbaa !16
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.otri, ptr %22, i32 0, i32 1
  %24 = load i32, ptr %23, align 8, !tbaa !17
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [3 x i32], ptr @minus1mod3, i64 0, i64 %25
  %27 = load i32, ptr %26, align 4, !tbaa !18
  %28 = add nsw i32 %27, 3
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds ptr, ptr %21, i64 %29
  %31 = load ptr, ptr %30, align 8, !tbaa !5
  store ptr %31, ptr %8, align 8, !tbaa !5
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.otri, ptr %32, i32 0, i32 0
  %34 = load ptr, ptr %33, align 8, !tbaa !16
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.otri, ptr %35, i32 0, i32 1
  %37 = load i32, ptr %36, align 8, !tbaa !17
  %38 = add nsw i32 %37, 3
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds ptr, ptr %34, i64 %39
  %41 = load ptr, ptr %40, align 8, !tbaa !5
  store ptr %41, ptr %9, align 8, !tbaa !5
  %42 = load ptr, ptr %8, align 8, !tbaa !5
  %43 = getelementptr inbounds double, ptr %42, i64 1
  %44 = load double, ptr %43, align 8, !tbaa !19
  %45 = load ptr, ptr %9, align 8, !tbaa !5
  %46 = getelementptr inbounds double, ptr %45, i64 1
  %47 = load double, ptr %46, align 8, !tbaa !19
  %48 = fcmp olt double %44, %47
  br i1 %48, label %65, label %49

49:                                               ; preds = %3
  %50 = load ptr, ptr %8, align 8, !tbaa !5
  %51 = getelementptr inbounds double, ptr %50, i64 1
  %52 = load double, ptr %51, align 8, !tbaa !19
  %53 = load ptr, ptr %9, align 8, !tbaa !5
  %54 = getelementptr inbounds double, ptr %53, i64 1
  %55 = load double, ptr %54, align 8, !tbaa !19
  %56 = fcmp oeq double %52, %55
  br i1 %56, label %57, label %75

57:                                               ; preds = %49
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  %59 = getelementptr inbounds double, ptr %58, i64 0
  %60 = load double, ptr %59, align 8, !tbaa !19
  %61 = load ptr, ptr %9, align 8, !tbaa !5
  %62 = getelementptr inbounds double, ptr %61, i64 0
  %63 = load double, ptr %62, align 8, !tbaa !19
  %64 = fcmp olt double %60, %63
  br i1 %64, label %65, label %75

65:                                               ; preds = %57, %3
  %66 = load ptr, ptr %7, align 8, !tbaa !5
  %67 = getelementptr inbounds double, ptr %66, i64 0
  %68 = load double, ptr %67, align 8, !tbaa !19
  %69 = load ptr, ptr %9, align 8, !tbaa !5
  %70 = getelementptr inbounds double, ptr %69, i64 0
  %71 = load double, ptr %70, align 8, !tbaa !19
  %72 = fcmp oge double %68, %71
  br i1 %72, label %73, label %74

73:                                               ; preds = %65
  store i32 1, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %132

74:                                               ; preds = %65
  br label %85

75:                                               ; preds = %57, %49
  %76 = load ptr, ptr %7, align 8, !tbaa !5
  %77 = getelementptr inbounds double, ptr %76, i64 0
  %78 = load double, ptr %77, align 8, !tbaa !19
  %79 = load ptr, ptr %8, align 8, !tbaa !5
  %80 = getelementptr inbounds double, ptr %79, i64 0
  %81 = load double, ptr %80, align 8, !tbaa !19
  %82 = fcmp ole double %78, %81
  br i1 %82, label %83, label %84

83:                                               ; preds = %75
  store i32 0, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %132

84:                                               ; preds = %75
  br label %85

85:                                               ; preds = %84, %74
  %86 = load ptr, ptr %8, align 8, !tbaa !5
  %87 = getelementptr inbounds double, ptr %86, i64 0
  %88 = load double, ptr %87, align 8, !tbaa !19
  %89 = load ptr, ptr %7, align 8, !tbaa !5
  %90 = getelementptr inbounds double, ptr %89, i64 0
  %91 = load double, ptr %90, align 8, !tbaa !19
  %92 = fsub double %88, %91
  store double %92, ptr %10, align 8, !tbaa !19
  %93 = load ptr, ptr %8, align 8, !tbaa !5
  %94 = getelementptr inbounds double, ptr %93, i64 1
  %95 = load double, ptr %94, align 8, !tbaa !19
  %96 = load ptr, ptr %7, align 8, !tbaa !5
  %97 = getelementptr inbounds double, ptr %96, i64 1
  %98 = load double, ptr %97, align 8, !tbaa !19
  %99 = fsub double %95, %98
  store double %99, ptr %11, align 8, !tbaa !19
  %100 = load ptr, ptr %9, align 8, !tbaa !5
  %101 = getelementptr inbounds double, ptr %100, i64 0
  %102 = load double, ptr %101, align 8, !tbaa !19
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  %104 = getelementptr inbounds double, ptr %103, i64 0
  %105 = load double, ptr %104, align 8, !tbaa !19
  %106 = fsub double %102, %105
  store double %106, ptr %12, align 8, !tbaa !19
  %107 = load ptr, ptr %9, align 8, !tbaa !5
  %108 = getelementptr inbounds double, ptr %107, i64 1
  %109 = load double, ptr %108, align 8, !tbaa !19
  %110 = load ptr, ptr %7, align 8, !tbaa !5
  %111 = getelementptr inbounds double, ptr %110, i64 1
  %112 = load double, ptr %111, align 8, !tbaa !19
  %113 = fsub double %109, %112
  store double %113, ptr %13, align 8, !tbaa !19
  %114 = load double, ptr %11, align 8, !tbaa !19
  %115 = load double, ptr %12, align 8, !tbaa !19
  %116 = load double, ptr %12, align 8, !tbaa !19
  %117 = load double, ptr %13, align 8, !tbaa !19
  %118 = load double, ptr %13, align 8, !tbaa !19
  %119 = fmul double %117, %118
  %120 = call double @llvm.fmuladd.f64(double %115, double %116, double %119)
  %121 = fmul double %114, %120
  %122 = load double, ptr %13, align 8, !tbaa !19
  %123 = load double, ptr %10, align 8, !tbaa !19
  %124 = load double, ptr %10, align 8, !tbaa !19
  %125 = load double, ptr %11, align 8, !tbaa !19
  %126 = load double, ptr %11, align 8, !tbaa !19
  %127 = fmul double %125, %126
  %128 = call double @llvm.fmuladd.f64(double %123, double %124, double %127)
  %129 = fmul double %122, %128
  %130 = fcmp ogt double %121, %129
  %131 = zext i1 %130 to i32
  store i32 %131, ptr %4, align 4
  store i32 1, ptr %14, align 4
  br label %132

132:                                              ; preds = %85, %83, %73
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %133 = load i32, ptr %4, align 4
  ret i32 %133
}

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, !13, i64 82808}
!10 = !{!"mesh", !11, i64 0, !11, i64 88, !11, i64 176, !11, i64 264, !11, i64 352, !11, i64 440, !11, i64 528, !11, i64 616, !7, i64 704, !7, i64 33472, !7, i64 66240, !12, i64 82624, !6, i64 82632, !14, i64 82640, !14, i64 82648, !14, i64 82656, !14, i64 82664, !14, i64 82672, !12, i64 82680, !12, i64 82684, !12, i64 82688, !12, i64 82692, !12, i64 82696, !12, i64 82700, !13, i64 82704, !12, i64 82712, !12, i64 82716, !12, i64 82720, !13, i64 82728, !12, i64 82736, !12, i64 82740, !12, i64 82744, !12, i64 82748, !12, i64 82752, !12, i64 82756, !12, i64 82760, !12, i64 82764, !12, i64 82768, !13, i64 82776, !13, i64 82784, !13, i64 82792, !13, i64 82800, !13, i64 82808, !13, i64 82816, !13, i64 82824, !6, i64 82832, !6, i64 82840, !6, i64 82848, !6, i64 82856, !6, i64 82864, !6, i64 82872, !6, i64 82880, !15, i64 82888}
!11 = !{!"memorypool", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !12, i64 48, !12, i64 52, !12, i64 56, !12, i64 60, !13, i64 64, !13, i64 72, !12, i64 80, !12, i64 84}
!12 = !{!"int", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!"otri", !6, i64 0, !12, i64 8}
!16 = !{!15, !6, i64 0}
!17 = !{!15, !12, i64 8}
!18 = !{!12, !12, i64 0}
!19 = !{!14, !14, 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"

@minus1mod3 = external dso_local local_unnamed_addr global [3 x i32], align 4

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: readwrite, inaccessiblemem: none) uwtable
define dso_local range(i32 0, 2) i32 @rightofhyperbola(ptr nocapture noundef %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2) local_unnamed_addr #0 {
  %4 = getelementptr inbounds i8, ptr %0, i64 82808
  %5 = load i64, ptr %4, align 8, !tbaa !5
  %6 = add nsw i64 %5, 1
  store i64 %6, ptr %4, align 8, !tbaa !5
  %7 = load ptr, ptr %1, align 8, !tbaa !15
  %8 = getelementptr inbounds i8, ptr %1, i64 8
  %9 = load i32, ptr %8, align 8, !tbaa !16
  %10 = sext i32 %9 to i64
  %11 = getelementptr inbounds [3 x i32], ptr @minus1mod3, i64 0, i64 %10
  %12 = load i32, ptr %11, align 4, !tbaa !17
  %13 = sext i32 %12 to i64
  %14 = getelementptr ptr, ptr %7, i64 %13
  %15 = getelementptr i8, ptr %14, i64 24
  %16 = load ptr, ptr %15, align 8, !tbaa !18
  %17 = getelementptr ptr, ptr %7, i64 %10
  %18 = getelementptr i8, ptr %17, i64 24
  %19 = load ptr, ptr %18, align 8, !tbaa !18
  %20 = getelementptr inbounds i8, ptr %16, i64 8
  %21 = load double, ptr %20, align 8, !tbaa !19
  %22 = getelementptr inbounds i8, ptr %19, i64 8
  %23 = load double, ptr %22, align 8, !tbaa !19
  %24 = fcmp olt double %21, %23
  br i1 %24, label %._crit_edge, label %25

._crit_edge:                                      ; preds = %3
  %.pre35 = load double, ptr %19, align 8, !tbaa !19
  br label %30

25:                                               ; preds = %3
  %26 = fcmp oeq double %21, %23
  %.pre = load double, ptr %16, align 8, !tbaa !19
  br i1 %26, label %27, label %36

27:                                               ; preds = %25
  %28 = load double, ptr %19, align 8, !tbaa !19
  %29 = fcmp olt double %.pre, %28
  br i1 %29, label %30, label %36

30:                                               ; preds = %._crit_edge, %27
  %31 = phi double [ %.pre35, %._crit_edge ], [ %28, %27 ]
  %32 = load double, ptr %2, align 8, !tbaa !19
  %33 = fcmp ult double %32, %31
  br i1 %33, label %._crit_edge36, label %62

._crit_edge36:                                    ; preds = %30
  %.pre37 = load double, ptr %16, align 8, !tbaa !19
  %34 = insertelement <2 x double> poison, double %.pre37, i64 0
  %35 = insertelement <2 x double> %34, double %31, i64 1
  br label %41

36:                                               ; preds = %27, %25
  %37 = load double, ptr %2, align 8, !tbaa !19
  %38 = fcmp ugt double %37, %.pre
  br i1 %38, label %._crit_edge38, label %62

._crit_edge38:                                    ; preds = %36
  %.pre39 = load double, ptr %19, align 8, !tbaa !19
  %39 = insertelement <2 x double> poison, double %.pre, i64 0
  %40 = insertelement <2 x double> %39, double %.pre39, i64 1
  br label %41

41:                                               ; preds = %._crit_edge38, %._crit_edge36
  %42 = phi double [ %32, %._crit_edge36 ], [ %37, %._crit_edge38 ]
  %43 = phi <2 x double> [ %35, %._crit_edge36 ], [ %40, %._crit_edge38 ]
  %44 = insertelement <2 x double> poison, double %42, i64 0
  %45 = shufflevector <2 x double> %44, <2 x double> poison, <2 x i32> zeroinitializer
  %46 = fsub <2 x double> %43, %45
  %47 = getelementptr inbounds i8, ptr %2, i64 8
  %48 = load double, ptr %47, align 8, !tbaa !19
  %49 = insertelement <2 x double> poison, double %23, i64 0
  %50 = insertelement <2 x double> %49, double %21, i64 1
  %51 = insertelement <2 x double> poison, double %48, i64 0
  %52 = shufflevector <2 x double> %51, <2 x double> poison, <2 x i32> zeroinitializer
  %53 = fsub <2 x double> %50, %52
  %54 = fmul <2 x double> %53, %53
  %55 = shufflevector <2 x double> %54, <2 x double> poison, <2 x i32> <i32 1, i32 0>
  %56 = tail call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %46, <2 x double> %46, <2 x double> %55)
  %57 = fmul <2 x double> %53, %56
  %58 = extractelement <2 x double> %57, i64 0
  %59 = extractelement <2 x double> %57, i64 1
  %60 = fcmp ogt double %59, %58
  %61 = zext i1 %60 to i32
  br label %62

62:                                               ; preds = %36, %30, %41
  %.0 = phi i32 [ %61, %41 ], [ 1, %30 ], [ 0, %36 ]
  ret i32 %.0
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare <2 x double> @llvm.fmuladd.v2f64(<2 x double>, <2 x double>, <2 x double>) #1

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(read, argmem: readwrite, inaccessiblemem: none) 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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, !12, i64 82808}
!6 = !{!"mesh", !7, i64 0, !7, i64 88, !7, i64 176, !7, i64 264, !7, i64 352, !7, i64 440, !7, i64 528, !7, i64 616, !9, i64 704, !9, i64 33472, !9, i64 66240, !11, i64 82624, !8, i64 82632, !13, i64 82640, !13, i64 82648, !13, i64 82656, !13, i64 82664, !13, i64 82672, !11, i64 82680, !11, i64 82684, !11, i64 82688, !11, i64 82692, !11, i64 82696, !11, i64 82700, !12, i64 82704, !11, i64 82712, !11, i64 82716, !11, i64 82720, !12, i64 82728, !11, i64 82736, !11, i64 82740, !11, i64 82744, !11, i64 82748, !11, i64 82752, !11, i64 82756, !11, i64 82760, !11, i64 82764, !11, i64 82768, !12, i64 82776, !12, i64 82784, !12, i64 82792, !12, i64 82800, !12, i64 82808, !12, i64 82816, !12, i64 82824, !8, i64 82832, !8, i64 82840, !8, i64 82848, !8, i64 82856, !8, i64 82864, !8, i64 82872, !8, i64 82880, !14, i64 82888}
!7 = !{!"memorypool", !8, i64 0, !8, i64 8, !8, i64 16, !8, i64 24, !8, i64 32, !8, i64 40, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !12, i64 64, !12, i64 72, !11, i64 80, !11, i64 84}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"long", !9, i64 0}
!13 = !{!"double", !9, i64 0}
!14 = !{!"otri", !8, i64 0, !11, i64 8}
!15 = !{!14, !8, i64 0}
!16 = !{!14, !11, i64 8}
!17 = !{!11, !11, i64 0}
!18 = !{!8, !8, i64 0}
!19 = !{!13, !13, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalDCEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass