; LLVM IR from MIT-SPARK/Kimera-VIO :: third_party/triangle/src (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, float, float, float, float, float, 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.osub = type { ptr, i32 }

; Function Attrs: nounwind uwtable
declare dso_local ptr @poolalloc(ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local void @makesubseg(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8, !tbaa !5
  %6 = getelementptr inbounds %struct.mesh, ptr %5, i32 0, i32 1
  %7 = call ptr @poolalloc(ptr noundef %6)
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.osub, ptr %8, i32 0, i32 0
  store ptr %7, ptr %9, align 8, !tbaa !9
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.mesh, ptr %10, i32 0, i32 50
  %12 = load ptr, ptr %11, align 8, !tbaa !12
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.osub, ptr %13, i32 0, i32 0
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  %16 = getelementptr inbounds ptr, ptr %15, i64 0
  store ptr %12, ptr %16, align 8, !tbaa !5
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.mesh, ptr %17, i32 0, i32 50
  %19 = load ptr, ptr %18, align 8, !tbaa !12
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.osub, ptr %20, i32 0, i32 0
  %22 = load ptr, ptr %21, align 8, !tbaa !9
  %23 = getelementptr inbounds ptr, ptr %22, i64 1
  store ptr %19, ptr %23, align 8, !tbaa !5
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.osub, ptr %24, i32 0, i32 0
  %26 = load ptr, ptr %25, align 8, !tbaa !9
  %27 = getelementptr inbounds ptr, ptr %26, i64 2
  store ptr null, ptr %27, align 8, !tbaa !5
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.osub, ptr %28, i32 0, i32 0
  %30 = load ptr, ptr %29, align 8, !tbaa !9
  %31 = getelementptr inbounds ptr, ptr %30, i64 3
  store ptr null, ptr %31, align 8, !tbaa !5
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.osub, ptr %32, i32 0, i32 0
  %34 = load ptr, ptr %33, align 8, !tbaa !9
  %35 = getelementptr inbounds ptr, ptr %34, i64 4
  store ptr null, ptr %35, align 8, !tbaa !5
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.osub, ptr %36, i32 0, i32 0
  %38 = load ptr, ptr %37, align 8, !tbaa !9
  %39 = getelementptr inbounds ptr, ptr %38, i64 5
  store ptr null, ptr %39, align 8, !tbaa !5
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.mesh, ptr %40, i32 0, i32 48
  %42 = load ptr, ptr %41, align 8, !tbaa !18
  %43 = load ptr, ptr %4, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.osub, ptr %43, i32 0, i32 0
  %45 = load ptr, ptr %44, align 8, !tbaa !9
  %46 = getelementptr inbounds ptr, ptr %45, i64 6
  store ptr %42, ptr %46, align 8, !tbaa !5
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.mesh, ptr %47, i32 0, i32 48
  %49 = load ptr, ptr %48, align 8, !tbaa !18
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.osub, ptr %50, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8, !tbaa !9
  %53 = getelementptr inbounds ptr, ptr %52, i64 7
  store ptr %49, ptr %53, align 8, !tbaa !5
  %54 = load ptr, ptr %4, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.osub, ptr %54, i32 0, i32 0
  %56 = load ptr, ptr %55, align 8, !tbaa !9
  %57 = getelementptr inbounds ptr, ptr %56, i64 8
  store i32 0, ptr %57, align 4, !tbaa !19
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.osub, ptr %58, i32 0, i32 1
  store i32 0, ptr %59, align 8, !tbaa !20
  ret void
}

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


; 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: nounwind uwtable
declare dso_local ptr @poolalloc(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @makesubseg(ptr noundef %0, ptr nocapture noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 88
  %4 = tail call ptr @poolalloc(ptr noundef nonnull %3)
  store ptr %4, ptr %1, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 82856
  %6 = load ptr, ptr %5, align 8, !tbaa !11
  store ptr %6, ptr %4, align 8, !tbaa !17
  %7 = load ptr, ptr %1, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 8
  store ptr %6, ptr %8, align 8, !tbaa !17
  %9 = load ptr, ptr %1, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %9, i64 16
  store ptr null, ptr %10, align 8, !tbaa !17
  %11 = load ptr, ptr %1, align 8, !tbaa !5
  %12 = getelementptr inbounds i8, ptr %11, i64 24
  store ptr null, ptr %12, align 8, !tbaa !17
  %13 = load ptr, ptr %1, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %13, i64 32
  store ptr null, ptr %14, align 8, !tbaa !17
  %15 = load ptr, ptr %1, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %15, i64 40
  store ptr null, ptr %16, align 8, !tbaa !17
  %17 = getelementptr inbounds i8, ptr %0, i64 82840
  %18 = load ptr, ptr %17, align 8, !tbaa !18
  %19 = load ptr, ptr %1, align 8, !tbaa !5
  %20 = getelementptr inbounds i8, ptr %19, i64 48
  store ptr %18, ptr %20, align 8, !tbaa !17
  %21 = load ptr, ptr %1, align 8, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %21, i64 56
  store ptr %18, ptr %22, align 8, !tbaa !17
  %23 = load ptr, ptr %1, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %23, i64 64
  store i32 0, ptr %24, align 4, !tbaa !19
  %25 = getelementptr inbounds i8, ptr %1, i64 8
  store i32 0, ptr %25, align 8, !tbaa !20
  ret void
}

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


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