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

@.str.1078 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1079 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1080 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.1089 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1099 = external hidden unnamed_addr constant [20 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

; Function Attrs: nounwind uwtable
declare dso_local void @triexit(i32 noundef) #1

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

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

; Function Attrs: nounwind uwtable
declare dso_local ptr @triangletraverse(ptr noundef) #1

declare noalias ptr @fopen(ptr noundef, ptr noundef) #2

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

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #3

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

23:                                               ; preds = %5
  %24 = load ptr, ptr %8, align 8, !tbaa !5
  %25 = call i32 (ptr, ...) @printf(ptr noundef @.str.1078, ptr noundef %24)
  br label %26

26:                                               ; preds = %23, %5
  %27 = load ptr, ptr %8, align 8, !tbaa !5
  %28 = call noalias ptr @fopen(ptr noundef %27, ptr noundef @.str.1079)
  store ptr %28, ptr %11, align 8, !tbaa !5
  %29 = load ptr, ptr %11, align 8, !tbaa !5
  %30 = icmp eq ptr %29, null
  br i1 %30, label %31, label %34

31:                                               ; preds = %26
  %32 = load ptr, ptr %8, align 8, !tbaa !5
  %33 = call i32 (ptr, ...) @printf(ptr noundef @.str.1080, ptr noundef %32)
  call void @triexit(i32 noundef 1)
  br label %34

34:                                               ; preds = %31, %26
  %35 = load ptr, ptr %11, align 8, !tbaa !5
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.mesh, ptr %36, i32 0, i32 0
  %38 = getelementptr inbounds %struct.memorypool, ptr %37, i32 0, i32 10
  %39 = load i64, ptr %38, align 8, !tbaa !14
  %40 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %35, ptr noundef @.str.1089, i64 noundef %39, i32 noundef 3) #4
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.mesh, ptr %41, i32 0, i32 0
  call void @traversalinit(ptr noundef %42)
  %43 = load ptr, ptr %6, align 8, !tbaa !5
  %44 = call ptr @triangletraverse(ptr noundef %43)
  %45 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 0
  store ptr %44, ptr %45, align 8, !tbaa !19
  %46 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 1
  store i32 0, ptr %46, align 8, !tbaa !20
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.behavior, ptr %47, i32 0, i32 10
  %49 = load i32, ptr %48, align 8, !tbaa !21
  %50 = sext i32 %49 to i64
  store i64 %50, ptr %14, align 8, !tbaa !22
  br label %51

51:                                               ; preds = %55, %34
  %52 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 0
  %53 = load ptr, ptr %52, align 8, !tbaa !19
  %54 = icmp ne ptr %53, null
  br i1 %54, label %55, label %66

55:                                               ; preds = %51
  %56 = load i64, ptr %14, align 8, !tbaa !22
  %57 = trunc i64 %56 to i32
  %58 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 0
  %59 = load ptr, ptr %58, align 8, !tbaa !19
  %60 = getelementptr inbounds ptr, ptr %59, i64 6
  store i32 %57, ptr %60, align 4, !tbaa !9
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  %62 = call ptr @triangletraverse(ptr noundef %61)
  %63 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 0
  store ptr %62, ptr %63, align 8, !tbaa !19
  %64 = load i64, ptr %14, align 8, !tbaa !22
  %65 = add nsw i64 %64, 1
  store i64 %65, ptr %14, align 8, !tbaa !22
  br label %51, !llvm.loop !23

66:                                               ; preds = %51
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.mesh, ptr %67, i32 0, i32 48
  %69 = load ptr, ptr %68, align 8, !tbaa !25
  %70 = getelementptr inbounds ptr, ptr %69, i64 6
  store i32 -1, ptr %70, align 4, !tbaa !9
  %71 = load ptr, ptr %6, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.mesh, ptr %71, i32 0, i32 0
  call void @traversalinit(ptr noundef %72)
  %73 = load ptr, ptr %6, align 8, !tbaa !5
  %74 = call ptr @triangletraverse(ptr noundef %73)
  %75 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 0
  store ptr %74, ptr %75, align 8, !tbaa !19
  %76 = load ptr, ptr %7, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.behavior, ptr %76, i32 0, i32 10
  %78 = load i32, ptr %77, align 8, !tbaa !21
  %79 = sext i32 %78 to i64
  store i64 %79, ptr %14, align 8, !tbaa !22
  br label %80

80:                                               ; preds = %84, %66
  %81 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 0
  %82 = load ptr, ptr %81, align 8, !tbaa !19
  %83 = icmp ne ptr %82, null
  br i1 %83, label %84, label %171

84:                                               ; preds = %80
  %85 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 1
  store i32 1, ptr %85, align 8, !tbaa !20
  %86 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 0
  %87 = load ptr, ptr %86, align 8, !tbaa !19
  %88 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 1
  %89 = load i32, ptr %88, align 8, !tbaa !20
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds ptr, ptr %87, i64 %90
  %92 = load ptr, ptr %91, align 8, !tbaa !5
  store ptr %92, ptr %18, align 8, !tbaa !5
  %93 = load ptr, ptr %18, align 8, !tbaa !5
  %94 = ptrtoint ptr %93 to i64
  %95 = and i64 %94, 3
  %96 = trunc i64 %95 to i32
  %97 = getelementptr inbounds %struct.otri, ptr %13, i32 0, i32 1
  store i32 %96, ptr %97, align 8, !tbaa !20
  %98 = load ptr, ptr %18, align 8, !tbaa !5
  %99 = ptrtoint ptr %98 to i64
  %100 = getelementptr inbounds %struct.otri, ptr %13, i32 0, i32 1
  %101 = load i32, ptr %100, align 8, !tbaa !20
  %102 = sext i32 %101 to i64
  %103 = xor i64 %99, %102
  %104 = inttoptr i64 %103 to ptr
  %105 = getelementptr inbounds %struct.otri, ptr %13, i32 0, i32 0
  store ptr %104, ptr %105, align 8, !tbaa !19
  %106 = getelementptr inbounds %struct.otri, ptr %13, i32 0, i32 0
  %107 = load ptr, ptr %106, align 8, !tbaa !19
  %108 = getelementptr inbounds ptr, ptr %107, i64 6
  %109 = load i32, ptr %108, align 4, !tbaa !9
  store i32 %109, ptr %15, align 4, !tbaa !9
  %110 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 1
  store i32 2, ptr %110, align 8, !tbaa !20
  %111 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 0
  %112 = load ptr, ptr %111, align 8, !tbaa !19
  %113 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 1
  %114 = load i32, ptr %113, align 8, !tbaa !20
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds ptr, ptr %112, i64 %115
  %117 = load ptr, ptr %116, align 8, !tbaa !5
  store ptr %117, ptr %18, align 8, !tbaa !5
  %118 = load ptr, ptr %18, align 8, !tbaa !5
  %119 = ptrtoint ptr %118 to i64
  %120 = and i64 %119, 3
  %121 = trunc i64 %120 to i32
  %122 = getelementptr inbounds %struct.otri, ptr %13, i32 0, i32 1
  store i32 %121, ptr %122, align 8, !tbaa !20
  %123 = load ptr, ptr %18, align 8, !tbaa !5
  %124 = ptrtoint ptr %123 to i64
  %125 = getelementptr inbounds %struct.otri, ptr %13, i32 0, i32 1
  %126 = load i32, ptr %125, align 8, !tbaa !20
  %127 = sext i32 %126 to i64
  %128 = xor i64 %124, %127
  %129 = inttoptr i64 %128 to ptr
  %130 = getelementptr inbounds %struct.otri, ptr %13, i32 0, i32 0
  store ptr %129, ptr %130, align 8, !tbaa !19
  %131 = getelementptr inbounds %struct.otri, ptr %13, i32 0, i32 0
  %132 = load ptr, ptr %131, align 8, !tbaa !19
  %133 = getelementptr inbounds ptr, ptr %132, i64 6
  %134 = load i32, ptr %133, align 4, !tbaa !9
  store i32 %134, ptr %16, align 4, !tbaa !9
  %135 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 1
  store i32 0, ptr %135, align 8, !tbaa !20
  %136 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 0
  %137 = load ptr, ptr %136, align 8, !tbaa !19
  %138 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 1
  %139 = load i32, ptr %138, align 8, !tbaa !20
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds ptr, ptr %137, i64 %140
  %142 = load ptr, ptr %141, align 8, !tbaa !5
  store ptr %142, ptr %18, align 8, !tbaa !5
  %143 = load ptr, ptr %18, align 8, !tbaa !5
  %144 = ptrtoint ptr %143 to i64
  %145 = and i64 %144, 3
  %146 = trunc i64 %145 to i32
  %147 = getelementptr inbounds %struct.otri, ptr %13, i32 0, i32 1
  store i32 %146, ptr %147, align 8, !tbaa !20
  %148 = load ptr, ptr %18, align 8, !tbaa !5
  %149 = ptrtoint ptr %148 to i64
  %150 = getelementptr inbounds %struct.otri, ptr %13, i32 0, i32 1
  %151 = load i32, ptr %150, align 8, !tbaa !20
  %152 = sext i32 %151 to i64
  %153 = xor i64 %149, %152
  %154 = inttoptr i64 %153 to ptr
  %155 = getelementptr inbounds %struct.otri, ptr %13, i32 0, i32 0
  store ptr %154, ptr %155, align 8, !tbaa !19
  %156 = getelementptr inbounds %struct.otri, ptr %13, i32 0, i32 0
  %157 = load ptr, ptr %156, align 8, !tbaa !19
  %158 = getelementptr inbounds ptr, ptr %157, i64 6
  %159 = load i32, ptr %158, align 4, !tbaa !9
  store i32 %159, ptr %17, align 4, !tbaa !9
  %160 = load ptr, ptr %11, align 8, !tbaa !5
  %161 = load i64, ptr %14, align 8, !tbaa !22
  %162 = load i32, ptr %15, align 4, !tbaa !9
  %163 = load i32, ptr %16, align 4, !tbaa !9
  %164 = load i32, ptr %17, align 4, !tbaa !9
  %165 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %160, ptr noundef @.str.1099, i64 noundef %161, i32 noundef %162, i32 noundef %163, i32 noundef %164) #4
  %166 = load ptr, ptr %6, align 8, !tbaa !5
  %167 = call ptr @triangletraverse(ptr noundef %166)
  %168 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 0
  store ptr %167, ptr %168, align 8, !tbaa !19
  %169 = load i64, ptr %14, align 8, !tbaa !22
  %170 = add nsw i64 %169, 1
  store i64 %170, ptr %14, align 8, !tbaa !22
  br label %80, !llvm.loop !26

171:                                              ; preds = %80
  %172 = load ptr, ptr %11, align 8, !tbaa !5
  %173 = load i32, ptr %9, align 4, !tbaa !9
  %174 = load ptr, ptr %10, align 8, !tbaa !5
  call void @finishfile(ptr noundef %172, i32 noundef %173, ptr noundef %174)
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
attributes #2 = { "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 "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 #4 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 112}
!12 = !{!"behavior", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !10, i64 64, !10, i64 68, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !10, i64 88, !10, i64 92, !10, i64 96, !10, i64 100, !10, i64 104, !10, i64 108, !10, i64 112, !10, i64 116, !10, i64 120, !10, i64 124, !10, i64 128, !10, i64 132, !13, i64 136, !13, i64 144, !13, i64 152, !13, 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}
!13 = !{!"double", !7, i64 0}
!14 = !{!15, !17, i64 64}
!15 = !{!"mesh", !16, i64 0, !16, i64 88, !16, i64 176, !16, i64 264, !16, i64 352, !16, i64 440, !16, i64 528, !16, i64 616, !7, i64 704, !7, i64 33472, !7, i64 66240, !10, i64 82624, !6, i64 82632, !13, i64 82640, !13, i64 82648, !13, i64 82656, !13, i64 82664, !13, i64 82672, !10, i64 82680, !10, i64 82684, !10, i64 82688, !10, i64 82692, !10, i64 82696, !10, i64 82700, !17, i64 82704, !10, i64 82712, !10, i64 82716, !10, i64 82720, !17, i64 82728, !10, i64 82736, !10, i64 82740, !10, i64 82744, !10, i64 82748, !10, i64 82752, !10, i64 82756, !10, i64 82760, !10, i64 82764, !10, i64 82768, !17, i64 82776, !17, i64 82784, !17, i64 82792, !17, i64 82800, !17, i64 82808, !17, i64 82816, !17, i64 82824, !6, i64 82832, !6, i64 82840, !6, i64 82848, !6, i64 82856, !6, i64 82864, !6, i64 82872, !6, i64 82880, !18, i64 82888}
!16 = !{!"memorypool", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !10, i64 48, !10, i64 52, !10, i64 56, !10, i64 60, !17, i64 64, !17, i64 72, !10, i64 80, !10, i64 84}
!17 = !{!"long", !7, i64 0}
!18 = !{!"otri", !6, i64 0, !10, i64 8}
!19 = !{!18, !6, i64 0}
!20 = !{!18, !10, i64 8}
!21 = !{!12, !10, i64 40}
!22 = !{!17, !17, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!15, !6, i64 82856}
!26 = distinct !{!26, !24}


; 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.1078 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.1079 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1080 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.1089 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1099 = external hidden unnamed_addr constant [20 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @triexit(i32 noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
declare dso_local void @traversalinit(ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @finishfile(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

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

; Function Attrs: nounwind uwtable
define dso_local void @writeneighbors(ptr noundef %0, ptr nocapture noundef readonly %1, ptr noundef %2, i32 noundef %3, ptr noundef %4) local_unnamed_addr #0 {
  %6 = getelementptr inbounds i8, ptr %1, i64 112
  %7 = load i32, ptr %6, align 8, !tbaa !5
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %8, label %10

8:                                                ; preds = %5
  %9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1078, ptr noundef %2)
  br label %10

10:                                               ; preds = %8, %5
  %11 = tail call noalias ptr @fopen(ptr noundef %2, ptr noundef nonnull @.str.1079)
  %12 = icmp eq ptr %11, null
  br i1 %12, label %13, label %15

13:                                               ; preds = %10
  %14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1080, ptr noundef %2)
  tail call void @triexit(i32 noundef 1)
  br label %15

15:                                               ; preds = %13, %10
  %16 = getelementptr inbounds i8, ptr %0, i64 64
  %17 = load i64, ptr %16, align 8, !tbaa !11
  %18 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %11, ptr noundef nonnull @.str.1089, i64 noundef %17, i32 noundef 3) #2
  tail call void @traversalinit(ptr noundef %0)
  %19 = tail call ptr @triangletraverse(ptr noundef %0)
  %20 = getelementptr inbounds i8, ptr %1, i64 40
  %.not4446 = icmp eq ptr %19, null
  br i1 %.not4446, label %._crit_edge, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %15
  %21 = load i32, ptr %20, align 8, !tbaa !17
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %.sroa.016.048 = phi ptr [ %23, %.lr.ph ], [ %19, %.lr.ph.preheader ]
  %.047 = phi i32 [ %24, %.lr.ph ], [ %21, %.lr.ph.preheader ]
  %22 = getelementptr inbounds i8, ptr %.sroa.016.048, i64 48
  store i32 %.047, ptr %22, align 4, !tbaa !18
  %23 = tail call ptr @triangletraverse(ptr noundef %0)
  %24 = add i32 %.047, 1
  %.not44 = icmp eq ptr %23, null
  br i1 %.not44, label %._crit_edge, label %.lr.ph, !llvm.loop !19

._crit_edge:                                      ; preds = %.lr.ph, %15
  %25 = getelementptr inbounds i8, ptr %0, i64 82856
  %26 = load ptr, ptr %25, align 8, !tbaa !21
  %27 = getelementptr inbounds i8, ptr %26, i64 48
  store i32 -1, ptr %27, align 4, !tbaa !18
  tail call void @traversalinit(ptr noundef %0)
  %28 = tail call ptr @triangletraverse(ptr noundef %0)
  %.not4549 = icmp eq ptr %28, null
  br i1 %.not4549, label %._crit_edge54, label %.lr.ph53.preheader

.lr.ph53.preheader:                               ; preds = %._crit_edge
  %29 = load i32, ptr %20, align 8, !tbaa !17
  %30 = sext i32 %29 to i64
  br label %.lr.ph53

.lr.ph53:                                         ; preds = %.lr.ph53.preheader, %.lr.ph53
  %.sroa.016.151 = phi ptr [ %52, %.lr.ph53 ], [ %28, %.lr.ph53.preheader ]
  %.150 = phi i64 [ %53, %.lr.ph53 ], [ %30, %.lr.ph53.preheader ]
  %31 = getelementptr inbounds i8, ptr %.sroa.016.151, i64 8
  %32 = load ptr, ptr %31, align 8, !tbaa !22
  %33 = ptrtoint ptr %32 to i64
  %34 = and i64 %33, -4
  %35 = inttoptr i64 %34 to ptr
  %36 = getelementptr inbounds i8, ptr %35, i64 48
  %37 = load i32, ptr %36, align 4, !tbaa !18
  %38 = getelementptr inbounds i8, ptr %.sroa.016.151, i64 16
  %39 = load ptr, ptr %38, align 8, !tbaa !22
  %40 = ptrtoint ptr %39 to i64
  %41 = and i64 %40, -4
  %42 = inttoptr i64 %41 to ptr
  %43 = getelementptr inbounds i8, ptr %42, i64 48
  %44 = load i32, ptr %43, align 4, !tbaa !18
  %45 = load ptr, ptr %.sroa.016.151, align 8, !tbaa !22
  %46 = ptrtoint ptr %45 to i64
  %47 = and i64 %46, -4
  %48 = inttoptr i64 %47 to ptr
  %49 = getelementptr inbounds i8, ptr %48, i64 48
  %50 = load i32, ptr %49, align 4, !tbaa !18
  %51 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %11, ptr noundef nonnull @.str.1099, i64 noundef %.150, i32 noundef %37, i32 noundef %44, i32 noundef %50) #2
  %52 = tail call ptr @triangletraverse(ptr noundef %0)
  %53 = add nsw i64 %.150, 1
  %.not45 = icmp eq ptr %52, null
  br i1 %.not45, label %._crit_edge54, label %.lr.ph53, !llvm.loop !23

._crit_edge54:                                    ; preds = %.lr.ph53, %._crit_edge
  tail call void @finishfile(ptr noundef %11, i32 noundef %3, ptr noundef %4)
  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" }
attributes #1 = { 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 #2 = { 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, !7, i64 112}
!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 144, !10, i64 152, !10, i64 160, !8, i64 168, !8, i64 2216, !8, i64 4264, !8, i64 6312, !8, i64 8360, !8, i64 10408, !8, i64 12456, !8, i64 14504, !8, i64 16552, !8, i64 18600, !8, i64 20648, !8, i64 22696}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"double", !8, i64 0}
!11 = !{!12, !15, i64 64}
!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, !7, i64 82624, !14, i64 82632, !10, i64 82640, !10, i64 82648, !10, i64 82656, !10, i64 82664, !10, i64 82672, !7, i64 82680, !7, i64 82684, !7, i64 82688, !7, i64 82692, !7, i64 82696, !7, i64 82700, !15, i64 82704, !7, i64 82712, !7, i64 82716, !7, i64 82720, !15, i64 82728, !7, i64 82736, !7, i64 82740, !7, i64 82744, !7, i64 82748, !7, i64 82752, !7, i64 82756, !7, i64 82760, !7, i64 82764, !7, i64 82768, !15, i64 82776, !15, i64 82784, !15, i64 82792, !15, i64 82800, !15, i64 82808, !15, i64 82816, !15, i64 82824, !14, i64 82832, !14, i64 82840, !14, i64 82848, !14, i64 82856, !14, i64 82864, !14, i64 82872, !14, i64 82880, !16, i64 82888}
!13 = !{!"memorypool", !14, i64 0, !14, i64 8, !14, i64 16, !14, i64 24, !14, i64 32, !14, i64 40, !7, i64 48, !7, i64 52, !7, i64 56, !7, i64 60, !15, i64 64, !15, i64 72, !7, i64 80, !7, i64 84}
!14 = !{!"any pointer", !8, i64 0}
!15 = !{!"long", !8, i64 0}
!16 = !{!"otri", !14, i64 0, !7, i64 8}
!17 = !{!6, !7, i64 40}
!18 = !{!7, !7, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!12, !14, i64 82856}
!22 = !{!14, !14, i64 0}
!23 = distinct !{!23, !20}


; Effective O3 passes: AggressiveInstCombinePass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass