; 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.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, float, float, float, float }
%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 }

@plus1mod3 = external dso_local global [3 x i32], align 4
@minus1mod3 = external dso_local global [3 x i32], align 4
@.str.65 = external hidden unnamed_addr constant [29 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

declare i32 @printf(ptr noundef, ...) #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
declare dso_local void @triangledealloc(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i64 @removeghosts(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %struct.otri, align 8
  %8 = alloca %struct.otri, align 8
  %9 = alloca %struct.otri, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i64, align 8
  %12 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 16, 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
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.behavior, ptr %13, i32 0, i32 29
  %15 = load i32, ptr %14, align 4, !tbaa !9
  %16 = icmp ne i32 %15, 0
  br i1 %16, label %17, label %19

17:                                               ; preds = %3
  %18 = call i32 (ptr, ...) @printf(ptr noundef @.str.65)
  br label %19

19:                                               ; preds = %17, %3
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.otri, ptr %20, i32 0, i32 0
  %22 = load ptr, ptr %21, align 8, !tbaa !13
  %23 = getelementptr inbounds %struct.otri, ptr %7, i32 0, i32 0
  store ptr %22, ptr %23, align 8, !tbaa !13
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.otri, ptr %24, i32 0, i32 1
  %26 = load i32, ptr %25, align 8, !tbaa !15
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [3 x i32], ptr @minus1mod3, i64 0, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !16
  %30 = getelementptr inbounds %struct.otri, ptr %7, i32 0, i32 1
  store i32 %29, ptr %30, align 8, !tbaa !15
  %31 = getelementptr inbounds %struct.otri, ptr %7, i32 0, i32 0
  %32 = load ptr, ptr %31, align 8, !tbaa !13
  %33 = getelementptr inbounds %struct.otri, ptr %7, i32 0, i32 1
  %34 = load i32, ptr %33, align 8, !tbaa !15
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds ptr, ptr %32, i64 %35
  %37 = load ptr, ptr %36, align 8, !tbaa !5
  store ptr %37, ptr %12, align 8, !tbaa !5
  %38 = load ptr, ptr %12, align 8, !tbaa !5
  %39 = ptrtoint ptr %38 to i64
  %40 = and i64 %39, 3
  %41 = trunc i64 %40 to i32
  %42 = getelementptr inbounds %struct.otri, ptr %7, i32 0, i32 1
  store i32 %41, ptr %42, align 8, !tbaa !15
  %43 = load ptr, ptr %12, align 8, !tbaa !5
  %44 = ptrtoint ptr %43 to i64
  %45 = getelementptr inbounds %struct.otri, ptr %7, i32 0, i32 1
  %46 = load i32, ptr %45, align 8, !tbaa !15
  %47 = sext i32 %46 to i64
  %48 = xor i64 %44, %47
  %49 = inttoptr i64 %48 to ptr
  %50 = getelementptr inbounds %struct.otri, ptr %7, i32 0, i32 0
  store ptr %49, ptr %50, align 8, !tbaa !13
  %51 = getelementptr inbounds %struct.otri, ptr %7, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8, !tbaa !13
  %53 = ptrtoint ptr %52 to i64
  %54 = getelementptr inbounds %struct.otri, ptr %7, i32 0, i32 1
  %55 = load i32, ptr %54, align 8, !tbaa !15
  %56 = sext i32 %55 to i64
  %57 = or i64 %53, %56
  %58 = inttoptr i64 %57 to ptr
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.mesh, ptr %59, i32 0, i32 48
  %61 = load ptr, ptr %60, align 8, !tbaa !17
  %62 = getelementptr inbounds ptr, ptr %61, i64 0
  store ptr %58, ptr %62, align 8, !tbaa !5
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.otri, ptr %63, i32 0, i32 0
  %65 = load ptr, ptr %64, align 8, !tbaa !13
  %66 = getelementptr inbounds %struct.otri, ptr %8, i32 0, i32 0
  store ptr %65, ptr %66, align 8, !tbaa !13
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.otri, ptr %67, i32 0, i32 1
  %69 = load i32, ptr %68, align 8, !tbaa !15
  %70 = getelementptr inbounds %struct.otri, ptr %8, i32 0, i32 1
  store i32 %69, ptr %70, align 8, !tbaa !15
  store i64 0, ptr %11, align 8, !tbaa !21
  br label %71

71:                                               ; preds = %196, %19
  %72 = load i64, ptr %11, align 8, !tbaa !21
  %73 = add nsw i64 %72, 1
  store i64 %73, ptr %11, align 8, !tbaa !21
  %74 = getelementptr inbounds %struct.otri, ptr %8, i32 0, i32 0
  %75 = load ptr, ptr %74, align 8, !tbaa !13
  %76 = getelementptr inbounds %struct.otri, ptr %9, i32 0, i32 0
  store ptr %75, ptr %76, align 8, !tbaa !13
  %77 = getelementptr inbounds %struct.otri, ptr %8, i32 0, i32 1
  %78 = load i32, ptr %77, align 8, !tbaa !15
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [3 x i32], ptr @plus1mod3, i64 0, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !16
  %82 = getelementptr inbounds %struct.otri, ptr %9, i32 0, i32 1
  store i32 %81, ptr %82, align 8, !tbaa !15
  %83 = getelementptr inbounds %struct.otri, ptr %8, i32 0, i32 1
  %84 = load i32, ptr %83, align 8, !tbaa !15
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [3 x i32], ptr @minus1mod3, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !16
  %88 = getelementptr inbounds %struct.otri, ptr %8, i32 0, i32 1
  store i32 %87, ptr %88, align 8, !tbaa !15
  %89 = getelementptr inbounds %struct.otri, ptr %8, i32 0, i32 0
  %90 = load ptr, ptr %89, align 8, !tbaa !13
  %91 = getelementptr inbounds %struct.otri, ptr %8, i32 0, i32 1
  %92 = load i32, ptr %91, align 8, !tbaa !15
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds ptr, ptr %90, i64 %93
  %95 = load ptr, ptr %94, align 8, !tbaa !5
  store ptr %95, ptr %12, align 8, !tbaa !5
  %96 = load ptr, ptr %12, align 8, !tbaa !5
  %97 = ptrtoint ptr %96 to i64
  %98 = and i64 %97, 3
  %99 = trunc i64 %98 to i32
  %100 = getelementptr inbounds %struct.otri, ptr %8, i32 0, i32 1
  store i32 %99, ptr %100, align 8, !tbaa !15
  %101 = load ptr, ptr %12, align 8, !tbaa !5
  %102 = ptrtoint ptr %101 to i64
  %103 = getelementptr inbounds %struct.otri, ptr %8, i32 0, i32 1
  %104 = load i32, ptr %103, align 8, !tbaa !15
  %105 = sext i32 %104 to i64
  %106 = xor i64 %102, %105
  %107 = inttoptr i64 %106 to ptr
  %108 = getelementptr inbounds %struct.otri, ptr %8, i32 0, i32 0
  store ptr %107, ptr %108, align 8, !tbaa !13
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.behavior, ptr %109, i32 0, i32 0
  %111 = load i32, ptr %110, align 4, !tbaa !22
  %112 = icmp ne i32 %111, 0
  br i1 %112, label %149, label %113

113:                                              ; preds = %71
  %114 = getelementptr inbounds %struct.otri, ptr %8, i32 0, i32 0
  %115 = load ptr, ptr %114, align 8, !tbaa !13
  %116 = load ptr, ptr %4, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.mesh, ptr %116, i32 0, i32 48
  %118 = load ptr, ptr %117, align 8, !tbaa !17
  %119 = icmp ne ptr %115, %118
  br i1 %119, label %120, label %148

120:                                              ; preds = %113
  %121 = getelementptr inbounds %struct.otri, ptr %8, i32 0, i32 0
  %122 = load ptr, ptr %121, align 8, !tbaa !13
  %123 = getelementptr inbounds %struct.otri, ptr %8, i32 0, i32 1
  %124 = load i32, ptr %123, align 8, !tbaa !15
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [3 x i32], ptr @plus1mod3, i64 0, i64 %125
  %127 = load i32, ptr %126, align 4, !tbaa !16
  %128 = add nsw i32 %127, 3
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds ptr, ptr %122, i64 %129
  %131 = load ptr, ptr %130, align 8, !tbaa !5
  store ptr %131, ptr %10, align 8, !tbaa !5
  %132 = load ptr, ptr %10, align 8, !tbaa !5
  %133 = load ptr, ptr %4, align 8, !tbaa !5
  %134 = getelementptr inbounds %struct.mesh, ptr %133, i32 0, i32 30
  %135 = load i32, ptr %134, align 4, !tbaa !23
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds i32, ptr %132, i64 %136
  %138 = load i32, ptr %137, align 4, !tbaa !16
  %139 = icmp eq i32 %138, 0
  br i1 %139, label %140, label %147

140:                                              ; preds = %120
  %141 = load ptr, ptr %10, align 8, !tbaa !5
  %142 = load ptr, ptr %4, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.mesh, ptr %142, i32 0, i32 30
  %144 = load i32, ptr %143, align 4, !tbaa !23
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds i32, ptr %141, i64 %145
  store i32 1, ptr %146, align 4, !tbaa !16
  br label %147

147:                                              ; preds = %140, %120
  br label %148

148:                                              ; preds = %147, %113
  br label %149

149:                                              ; preds = %148, %71
  %150 = load ptr, ptr %4, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.mesh, ptr %150, i32 0, i32 48
  %152 = load ptr, ptr %151, align 8, !tbaa !17
  %153 = getelementptr inbounds %struct.otri, ptr %8, i32 0, i32 0
  %154 = load ptr, ptr %153, align 8, !tbaa !13
  %155 = getelementptr inbounds %struct.otri, ptr %8, i32 0, i32 1
  %156 = load i32, ptr %155, align 8, !tbaa !15
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds ptr, ptr %154, i64 %157
  store ptr %152, ptr %158, align 8, !tbaa !5
  %159 = getelementptr inbounds %struct.otri, ptr %9, i32 0, i32 0
  %160 = load ptr, ptr %159, align 8, !tbaa !13
  %161 = getelementptr inbounds %struct.otri, ptr %9, i32 0, i32 1
  %162 = load i32, ptr %161, align 8, !tbaa !15
  %163 = sext i32 %162 to i64
  %164 = getelementptr inbounds ptr, ptr %160, i64 %163
  %165 = load ptr, ptr %164, align 8, !tbaa !5
  store ptr %165, ptr %12, align 8, !tbaa !5
  %166 = load ptr, ptr %12, align 8, !tbaa !5
  %167 = ptrtoint ptr %166 to i64
  %168 = and i64 %167, 3
  %169 = trunc i64 %168 to i32
  %170 = getelementptr inbounds %struct.otri, ptr %8, i32 0, i32 1
  store i32 %169, ptr %170, align 8, !tbaa !15
  %171 = load ptr, ptr %12, align 8, !tbaa !5
  %172 = ptrtoint ptr %171 to i64
  %173 = getelementptr inbounds %struct.otri, ptr %8, i32 0, i32 1
  %174 = load i32, ptr %173, align 8, !tbaa !15
  %175 = sext i32 %174 to i64
  %176 = xor i64 %172, %175
  %177 = inttoptr i64 %176 to ptr
  %178 = getelementptr inbounds %struct.otri, ptr %8, i32 0, i32 0
  store ptr %177, ptr %178, align 8, !tbaa !13
  %179 = load ptr, ptr %4, align 8, !tbaa !5
  %180 = getelementptr inbounds %struct.otri, ptr %9, i32 0, i32 0
  %181 = load ptr, ptr %180, align 8, !tbaa !13
  call void @triangledealloc(ptr noundef %179, ptr noundef %181)
  br label %182

182:                                              ; preds = %149
  %183 = getelementptr inbounds %struct.otri, ptr %8, i32 0, i32 0
  %184 = load ptr, ptr %183, align 8, !tbaa !13
  %185 = load ptr, ptr %6, align 8, !tbaa !5
  %186 = getelementptr inbounds %struct.otri, ptr %185, i32 0, i32 0
  %187 = load ptr, ptr %186, align 8, !tbaa !13
  %188 = icmp eq ptr %184, %187
  br i1 %188, label %189, label %196

189:                                              ; preds = %182
  %190 = getelementptr inbounds %struct.otri, ptr %8, i32 0, i32 1
  %191 = load i32, ptr %190, align 8, !tbaa !15
  %192 = load ptr, ptr %6, align 8, !tbaa !5
  %193 = getelementptr inbounds %struct.otri, ptr %192, i32 0, i32 1
  %194 = load i32, ptr %193, align 8, !tbaa !15
  %195 = icmp eq i32 %191, %194
  br label %196

196:                                              ; preds = %189, %182
  %197 = phi i1 [ false, %182 ], [ %195, %189 ]
  %198 = xor i1 %197, true
  br i1 %198, label %71, label %199, !llvm.loop !24

199:                                              ; preds = %196
  %200 = load i64, ptr %11, align 8, !tbaa !21
  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 16, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #3
  ret i64 %200
}

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, !11, i64 116}
!10 = !{!"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, !12, i64 136, !12, i64 140, !12, i64 144, !12, i64 148}
!11 = !{!"int", !7, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"otri", !6, i64 0, !11, i64 8}
!15 = !{!14, !11, i64 8}
!16 = !{!11, !11, i64 0}
!17 = !{!18, !6, i64 82840}
!18 = !{!"mesh", !19, i64 0, !19, i64 88, !19, i64 176, !19, i64 264, !19, i64 352, !19, i64 440, !19, i64 528, !19, i64 616, !7, i64 704, !7, i64 33472, !7, i64 66240, !11, i64 82624, !6, i64 82632, !12, i64 82640, !12, i64 82644, !12, i64 82648, !12, i64 82652, !12, i64 82656, !11, i64 82660, !11, i64 82664, !11, i64 82668, !11, i64 82672, !11, i64 82676, !11, i64 82680, !20, i64 82688, !11, i64 82696, !11, i64 82700, !11, i64 82704, !20, 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, !20, i64 82760, !20, i64 82768, !20, i64 82776, !20, i64 82784, !20, i64 82792, !20, i64 82800, !20, i64 82808, !6, i64 82816, !6, i64 82824, !6, i64 82832, !6, i64 82840, !6, i64 82848, !6, i64 82856, !6, i64 82864, !14, i64 82872}
!19 = !{!"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, !20, i64 64, !20, i64 72, !11, i64 80, !11, i64 84}
!20 = !{!"long", !7, i64 0}
!21 = !{!20, !20, i64 0}
!22 = !{!10, !11, i64 0}
!23 = !{!18, !11, i64 82724}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}


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

@plus1mod3 = external dso_local local_unnamed_addr global [3 x i32], align 4
@minus1mod3 = external dso_local local_unnamed_addr global [3 x i32], align 4
@.str.65 = external hidden unnamed_addr constant [29 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 @triangledealloc(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local range(i64 -9223372036854775807, -9223372036854775808) i64 @removeghosts(ptr noundef %0, ptr nocapture noundef readonly %1, ptr nocapture noundef readonly %2) local_unnamed_addr #1 {
  %4 = getelementptr inbounds i8, ptr %1, i64 116
  %5 = load i32, ptr %4, align 4, !tbaa !5
  %.not = icmp eq i32 %5, 0
  br i1 %.not, label %8, label %6

6:                                                ; preds = %3
  %7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.65)
  br label %8

8:                                                ; preds = %6, %3
  %9 = load ptr, ptr %2, align 8, !tbaa !11
  %10 = getelementptr inbounds i8, ptr %2, i64 8
  %11 = load i32, ptr %10, align 8, !tbaa !14
  %12 = sext i32 %11 to i64
  %13 = getelementptr inbounds [3 x i32], ptr @minus1mod3, i64 0, i64 %12
  %14 = load i32, ptr %13, align 4, !tbaa !15
  %15 = sext i32 %14 to i64
  %16 = getelementptr inbounds ptr, ptr %9, i64 %15
  %17 = load ptr, ptr %16, align 8, !tbaa !16
  %18 = getelementptr inbounds i8, ptr %0, i64 82840
  %19 = load ptr, ptr %18, align 8, !tbaa !17
  store ptr %17, ptr %19, align 8, !tbaa !16
  %20 = load ptr, ptr %2, align 8, !tbaa !11
  %21 = getelementptr inbounds i8, ptr %0, i64 82724
  br label %.critedge

.critedge:                                        ; preds = %.critedge.backedge, %8
  %22 = phi i32 [ %14, %8 ], [ %.pre, %.critedge.backedge ]
  %.sroa.010.0 = phi ptr [ %20, %8 ], [ %57, %.critedge.backedge ]
  %.sroa.11.0 = phi i32 [ %11, %8 ], [ %55, %.critedge.backedge ]
  %.0 = phi i64 [ 0, %8 ], [ %23, %.critedge.backedge ]
  %23 = add nuw nsw i64 %.0, 1
  %24 = sext i32 %.sroa.11.0 to i64
  %25 = getelementptr inbounds [3 x i32], ptr @plus1mod3, i64 0, i64 %24
  %26 = load i32, ptr %25, align 4, !tbaa !15
  %27 = sext i32 %22 to i64
  %28 = getelementptr inbounds ptr, ptr %.sroa.010.0, i64 %27
  %29 = load ptr, ptr %28, align 8, !tbaa !16
  %30 = ptrtoint ptr %29 to i64
  %31 = and i64 %30, 3
  %32 = and i64 %30, -4
  %33 = inttoptr i64 %32 to ptr
  %34 = load i32, ptr %1, align 4, !tbaa !21
  %.not43 = icmp ne i32 %34, 0
  %.pre46 = load ptr, ptr %18, align 8, !tbaa !17
  %.not44 = icmp eq ptr %.pre46, %33
  %or.cond = select i1 %.not43, i1 true, i1 %.not44
  br i1 %or.cond, label %48, label %35

35:                                               ; preds = %.critedge
  %36 = getelementptr inbounds [3 x i32], ptr @plus1mod3, i64 0, i64 %31
  %37 = load i32, ptr %36, align 4, !tbaa !15
  %38 = sext i32 %37 to i64
  %39 = getelementptr ptr, ptr %33, i64 %38
  %40 = getelementptr i8, ptr %39, i64 24
  %41 = load ptr, ptr %40, align 8, !tbaa !16
  %42 = load i32, ptr %21, align 4, !tbaa !22
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds i32, ptr %41, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !15
  %46 = icmp eq i32 %45, 0
  br i1 %46, label %47, label %48

47:                                               ; preds = %35
  store i32 1, ptr %44, align 4, !tbaa !15
  br label %48

48:                                               ; preds = %47, %35, %.critedge
  %49 = getelementptr inbounds ptr, ptr %33, i64 %31
  store ptr %.pre46, ptr %49, align 8, !tbaa !16
  %50 = sext i32 %26 to i64
  %51 = getelementptr inbounds ptr, ptr %.sroa.010.0, i64 %50
  %52 = load ptr, ptr %51, align 8, !tbaa !16
  %53 = ptrtoint ptr %52 to i64
  %54 = trunc i64 %53 to i32
  %55 = and i32 %54, 3
  %56 = and i64 %53, -4
  %57 = inttoptr i64 %56 to ptr
  tail call void @triangledealloc(ptr noundef nonnull %0, ptr noundef nonnull %.sroa.010.0)
  %58 = load ptr, ptr %2, align 8, !tbaa !11
  %59 = icmp eq ptr %58, %57
  br i1 %59, label %60, label %.critedge.backedge

60:                                               ; preds = %48
  %61 = load i32, ptr %10, align 8, !tbaa !14
  %62 = icmp eq i32 %55, %61
  br i1 %62, label %63, label %.critedge.backedge

.critedge.backedge:                               ; preds = %60, %48
  %.phi.trans.insert = and i64 %53, 3
  %.phi.trans.insert45 = getelementptr inbounds [3 x i32], ptr @minus1mod3, i64 0, i64 %.phi.trans.insert
  %.pre = load i32, ptr %.phi.trans.insert45, align 4, !tbaa !15
  br label %.critedge, !llvm.loop !23

63:                                               ; preds = %60
  ret i64 %23
}

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, !7, i64 116}
!6 = !{!"behavior", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !7, i64 36, !7, i64 40, !7, i64 44, !7, i64 48, !7, i64 52, !7, i64 56, !7, i64 60, !7, i64 64, !7, i64 68, !7, i64 72, !7, i64 76, !7, i64 80, !7, i64 84, !7, i64 88, !7, i64 92, !7, i64 96, !7, i64 100, !7, i64 104, !7, i64 108, !7, i64 112, !7, i64 116, !7, i64 120, !7, i64 124, !7, i64 128, !7, i64 132, !10, i64 136, !10, i64 140, !10, i64 144, !10, i64 148}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"float", !8, i64 0}
!11 = !{!12, !13, i64 0}
!12 = !{!"otri", !13, i64 0, !7, i64 8}
!13 = !{!"any pointer", !8, i64 0}
!14 = !{!12, !7, i64 8}
!15 = !{!7, !7, i64 0}
!16 = !{!13, !13, i64 0}
!17 = !{!18, !13, i64 82840}
!18 = !{!"mesh", !19, i64 0, !19, i64 88, !19, i64 176, !19, i64 264, !19, i64 352, !19, i64 440, !19, i64 528, !19, i64 616, !8, i64 704, !8, i64 33472, !8, i64 66240, !7, i64 82624, !13, i64 82632, !10, i64 82640, !10, i64 82644, !10, i64 82648, !10, i64 82652, !10, i64 82656, !7, i64 82660, !7, i64 82664, !7, i64 82668, !7, i64 82672, !7, i64 82676, !7, i64 82680, !20, i64 82688, !7, i64 82696, !7, i64 82700, !7, i64 82704, !20, i64 82712, !7, i64 82720, !7, i64 82724, !7, i64 82728, !7, i64 82732, !7, i64 82736, !7, i64 82740, !7, i64 82744, !7, i64 82748, !7, i64 82752, !20, i64 82760, !20, i64 82768, !20, i64 82776, !20, i64 82784, !20, i64 82792, !20, i64 82800, !20, i64 82808, !13, i64 82816, !13, i64 82824, !13, i64 82832, !13, i64 82840, !13, i64 82848, !13, i64 82856, !13, i64 82864, !12, i64 82872}
!19 = !{!"memorypool", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24, !13, i64 32, !13, i64 40, !7, i64 48, !7, i64 52, !7, i64 56, !7, i64 60, !20, i64 64, !20, i64 72, !7, i64 80, !7, i64 84}
!20 = !{!"long", !8, i64 0}
!21 = !{!6, !7, i64 0}
!22 = !{!18, !7, i64 82724}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass