; 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 }
%struct.behavior = type { i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, double, double, double, double, [2048 x i8], [2048 x i8], [2048 x i8], [2048 x i8], [2048 x i8], [2048 x i8], [2048 x i8], [2048 x i8], [2048 x i8], [2048 x i8], [2048 x i8], [2048 x i8] }

@.str.984 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.985 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.986 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.987 = external hidden unnamed_addr constant [31 x i8], align 1

; 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

declare i32 @printf(ptr noundef, ...) #1

; Function Attrs: nounwind uwtable
declare dso_local void @initializetrisubpools(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @divconqdelaunay(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @incrementaldelaunay(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i64 @sweeplinedelaunay(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i64 @delaunay(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.mesh, ptr %8, i32 0, i32 27
  store i32 0, ptr %9, align 8, !tbaa !9
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  call void @initializetrisubpools(ptr noundef %10, ptr noundef %11)
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.behavior, ptr %12, i32 0, i32 28
  %14 = load i32, ptr %13, align 8, !tbaa !16
  %15 = icmp ne i32 %14, 0
  br i1 %15, label %35, label %16

16:                                               ; preds = %2
  %17 = call i32 (ptr, ...) @printf(ptr noundef @.str.984)
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.behavior, ptr %18, i32 0, i32 23
  %20 = load i32, ptr %19, align 4, !tbaa !18
  %21 = icmp ne i32 %20, 0
  br i1 %21, label %22, label %24

22:                                               ; preds = %16
  %23 = call i32 (ptr, ...) @printf(ptr noundef @.str.985)
  br label %34

24:                                               ; preds = %16
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.behavior, ptr %25, i32 0, i32 24
  %27 = load i32, ptr %26, align 8, !tbaa !19
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %29, label %31

29:                                               ; preds = %24
  %30 = call i32 (ptr, ...) @printf(ptr noundef @.str.986)
  br label %33

31:                                               ; preds = %24
  %32 = call i32 (ptr, ...) @printf(ptr noundef @.str.987)
  br label %33

33:                                               ; preds = %31, %29
  br label %34

34:                                               ; preds = %33, %22
  br label %35

35:                                               ; preds = %34, %2
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.behavior, ptr %36, i32 0, i32 23
  %38 = load i32, ptr %37, align 4, !tbaa !18
  %39 = icmp ne i32 %38, 0
  br i1 %39, label %40, label %44

40:                                               ; preds = %35
  %41 = load ptr, ptr %4, align 8, !tbaa !5
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = call i64 @incrementaldelaunay(ptr noundef %41, ptr noundef %42)
  store i64 %43, ptr %6, align 8, !tbaa !20
  br label %58

44:                                               ; preds = %35
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.behavior, ptr %45, i32 0, i32 24
  %47 = load i32, ptr %46, align 8, !tbaa !19
  %48 = icmp ne i32 %47, 0
  br i1 %48, label %49, label %53

49:                                               ; preds = %44
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = call i64 @sweeplinedelaunay(ptr noundef %50, ptr noundef %51)
  store i64 %52, ptr %6, align 8, !tbaa !20
  br label %57

53:                                               ; preds = %44
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  %56 = call i64 @divconqdelaunay(ptr noundef %54, ptr noundef %55)
  store i64 %56, ptr %6, align 8, !tbaa !20
  br label %57

57:                                               ; preds = %53, %49
  br label %58

58:                                               ; preds = %57, %40
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.mesh, ptr %59, i32 0, i32 0
  %61 = getelementptr inbounds %struct.memorypool, ptr %60, i32 0, i32 10
  %62 = load i64, ptr %61, align 8, !tbaa !21
  %63 = icmp eq i64 %62, 0
  br i1 %63, label %64, label %65

64:                                               ; preds = %58
  store i64 0, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %67

65:                                               ; preds = %58
  %66 = load i64, ptr %6, align 8, !tbaa !20
  store i64 %66, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %67

67:                                               ; preds = %65, %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %68 = load i64, ptr %3, align 8
  ret i64 %68
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 #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, !12, i64 82720}
!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 = !{!17, !12, i64 112}
!17 = !{!"behavior", !12, i64 0, !12, i64 4, !12, i64 8, !12, i64 12, !12, i64 16, !12, i64 20, !12, i64 24, !12, i64 28, !12, i64 32, !12, i64 36, !12, i64 40, !12, i64 44, !12, i64 48, !12, i64 52, !12, i64 56, !12, i64 60, !12, i64 64, !12, i64 68, !12, i64 72, !12, i64 76, !12, i64 80, !12, i64 84, !12, i64 88, !12, i64 92, !12, i64 96, !12, i64 100, !12, i64 104, !12, i64 108, !12, i64 112, !12, i64 116, !12, i64 120, !12, i64 124, !12, i64 128, !12, i64 132, !14, i64 136, !14, i64 144, !14, i64 152, !14, i64 160, !7, i64 168, !7, i64 2216, !7, i64 4264, !7, i64 6312, !7, i64 8360, !7, i64 10408, !7, i64 12456, !7, i64 14504, !7, i64 16552, !7, i64 18600, !7, i64 20648, !7, i64 22696}
!18 = !{!17, !12, i64 92}
!19 = !{!17, !12, i64 96}
!20 = !{!13, !13, i64 0}
!21 = !{!10, !13, i64 64}


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

@.str.984 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.985 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.986 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.987 = external hidden unnamed_addr constant [31 x i8], align 1

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @initializetrisubpools(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i64 @divconqdelaunay(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i64 @incrementaldelaunay(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local i64 @sweeplinedelaunay(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local i64 @delaunay(ptr noundef %0, ptr noundef %1) local_unnamed_addr #1 {
  %3 = getelementptr inbounds i8, ptr %0, i64 82720
  store i32 0, ptr %3, align 8, !tbaa !5
  tail call void @initializetrisubpools(ptr noundef %0, ptr noundef %1)
  %4 = getelementptr inbounds i8, ptr %1, i64 112
  %5 = load i32, ptr %4, align 8, !tbaa !15
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %6, label %14

6:                                                ; preds = %2
  %7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.984)
  %8 = getelementptr inbounds i8, ptr %1, i64 92
  %9 = load i32, ptr %8, align 4, !tbaa !17
  %.not17 = icmp eq i32 %9, 0
  br i1 %.not17, label %10, label %.sink.split

10:                                               ; preds = %6
  %11 = getelementptr inbounds i8, ptr %1, i64 96
  %12 = load i32, ptr %11, align 8, !tbaa !18
  %.not18 = icmp eq i32 %12, 0
  %.str.987..str.986 = select i1 %.not18, ptr @.str.987, ptr @.str.986
  br label %.sink.split

.sink.split:                                      ; preds = %10, %6
  %.str.985.sink = phi ptr [ @.str.985, %6 ], [ %.str.987..str.986, %10 ]
  %13 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) %.str.985.sink)
  br label %14

14:                                               ; preds = %.sink.split, %2
  %15 = getelementptr inbounds i8, ptr %1, i64 92
  %16 = load i32, ptr %15, align 4, !tbaa !17
  %.not19 = icmp eq i32 %16, 0
  br i1 %.not19, label %19, label %17

17:                                               ; preds = %14
  %18 = tail call i64 @incrementaldelaunay(ptr noundef nonnull %0, ptr noundef nonnull %1)
  br label %26

19:                                               ; preds = %14
  %20 = getelementptr inbounds i8, ptr %1, i64 96
  %21 = load i32, ptr %20, align 8, !tbaa !18
  %.not20 = icmp eq i32 %21, 0
  br i1 %.not20, label %24, label %22

22:                                               ; preds = %19
  %23 = tail call i64 @sweeplinedelaunay(ptr noundef nonnull %0, ptr noundef nonnull %1)
  br label %26

24:                                               ; preds = %19
  %25 = tail call i64 @divconqdelaunay(ptr noundef nonnull %0, ptr noundef nonnull %1)
  br label %26

26:                                               ; preds = %22, %24, %17
  %.0 = phi i64 [ %18, %17 ], [ %23, %22 ], [ %25, %24 ]
  %27 = getelementptr inbounds i8, ptr %0, i64 64
  %28 = load i64, ptr %27, align 8, !tbaa !19
  %29 = icmp eq i64 %28, 0
  %..0 = select i1 %29, i64 0, i64 %.0
  ret i64 %..0
}

attributes #0 = { nofree nounwind "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 = { 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" }

!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, !11, i64 82720}
!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 = !{!16, !11, i64 112}
!16 = !{!"behavior", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !11, i64 36, !11, i64 40, !11, i64 44, !11, i64 48, !11, i64 52, !11, i64 56, !11, i64 60, !11, i64 64, !11, i64 68, !11, i64 72, !11, i64 76, !11, i64 80, !11, i64 84, !11, i64 88, !11, i64 92, !11, i64 96, !11, i64 100, !11, i64 104, !11, i64 108, !11, i64 112, !11, i64 116, !11, i64 120, !11, i64 124, !11, i64 128, !11, i64 132, !13, i64 136, !13, i64 144, !13, i64 152, !13, i64 160, !9, i64 168, !9, i64 2216, !9, i64 4264, !9, i64 6312, !9, i64 8360, !9, i64 10408, !9, i64 12456, !9, i64 14504, !9, i64 16552, !9, i64 18600, !9, i64 20648, !9, i64 22696}
!17 = !{!16, !11, i64 92}
!18 = !{!16, !11, i64 96}
!19 = !{!6, !12, i64 64}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass