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

@plus1mod3 = external dso_local global [3 x i32], align 4
@minus1mod3 = external dso_local global [3 x i32], align 4
@.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.1100 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.1101 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.1102 = 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

; Function Attrs: nounwind uwtable
declare dso_local ptr @vertextraverse(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 @writeoff(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 ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca i64, 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 8, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  %18 = load ptr, ptr %7, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.behavior, ptr %18, i32 0, i32 28
  %20 = load i32, ptr %19, align 8, !tbaa !11
  %21 = icmp ne i32 %20, 0
  br i1 %21, label %25, label %22

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

25:                                               ; preds = %22, %5
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.behavior, ptr %26, i32 0, i32 9
  %28 = load i32, ptr %27, align 4, !tbaa !14
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %40

30:                                               ; preds = %25
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.mesh, ptr %31, i32 0, i32 2
  %33 = getelementptr inbounds %struct.memorypool, ptr %32, i32 0, i32 10
  %34 = load i64, ptr %33, align 8, !tbaa !15
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.mesh, ptr %35, i32 0, i32 23
  %37 = load i32, ptr %36, align 4, !tbaa !20
  %38 = sext i32 %37 to i64
  %39 = sub nsw i64 %34, %38
  store i64 %39, ptr %17, align 8, !tbaa !21
  br label %45

40:                                               ; preds = %25
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.mesh, ptr %41, i32 0, i32 2
  %43 = getelementptr inbounds %struct.memorypool, ptr %42, i32 0, i32 10
  %44 = load i64, ptr %43, align 8, !tbaa !15
  store i64 %44, ptr %17, align 8, !tbaa !21
  br label %45

45:                                               ; preds = %40, %30
  %46 = load ptr, ptr %8, align 8, !tbaa !5
  %47 = call noalias ptr @fopen(ptr noundef %46, ptr noundef @.str.1079)
  store ptr %47, ptr %11, align 8, !tbaa !5
  %48 = load ptr, ptr %11, align 8, !tbaa !5
  %49 = icmp eq ptr %48, null
  br i1 %49, label %50, label %53

50:                                               ; preds = %45
  %51 = load ptr, ptr %8, align 8, !tbaa !5
  %52 = call i32 (ptr, ...) @printf(ptr noundef @.str.1080, ptr noundef %51)
  call void @triexit(i32 noundef 1)
  br label %53

53:                                               ; preds = %50, %45
  %54 = load ptr, ptr %11, align 8, !tbaa !5
  %55 = load i64, ptr %17, align 8, !tbaa !21
  %56 = load ptr, ptr %6, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.mesh, ptr %56, i32 0, i32 0
  %58 = getelementptr inbounds %struct.memorypool, ptr %57, i32 0, i32 10
  %59 = load i64, ptr %58, align 8, !tbaa !22
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.mesh, ptr %60, i32 0, i32 24
  %62 = load i64, ptr %61, align 8, !tbaa !23
  %63 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %54, ptr noundef @.str.1100, i64 noundef %55, i64 noundef %59, i64 noundef %62) #4
  %64 = load ptr, ptr %6, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.mesh, ptr %64, i32 0, i32 2
  call void @traversalinit(ptr noundef %65)
  %66 = load ptr, ptr %6, align 8, !tbaa !5
  %67 = call ptr @vertextraverse(ptr noundef %66)
  store ptr %67, ptr %13, align 8, !tbaa !5
  br label %68

68:                                               ; preds = %95, %53
  %69 = load ptr, ptr %13, align 8, !tbaa !5
  %70 = icmp ne ptr %69, null
  br i1 %70, label %71, label %98

71:                                               ; preds = %68
  %72 = load ptr, ptr %7, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.behavior, ptr %72, i32 0, i32 9
  %74 = load i32, ptr %73, align 4, !tbaa !14
  %75 = icmp ne i32 %74, 0
  br i1 %75, label %76, label %86

76:                                               ; preds = %71
  %77 = load ptr, ptr %13, align 8, !tbaa !5
  %78 = load ptr, ptr %6, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.mesh, ptr %78, i32 0, i32 30
  %80 = load i32, ptr %79, align 4, !tbaa !24
  %81 = add nsw i32 %80, 1
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds i32, ptr %77, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !9
  %85 = icmp ne i32 %84, -32767
  br i1 %85, label %86, label %95

86:                                               ; preds = %76, %71
  %87 = load ptr, ptr %11, align 8, !tbaa !5
  %88 = load ptr, ptr %13, align 8, !tbaa !5
  %89 = getelementptr inbounds double, ptr %88, i64 0
  %90 = load double, ptr %89, align 8, !tbaa !25
  %91 = load ptr, ptr %13, align 8, !tbaa !5
  %92 = getelementptr inbounds double, ptr %91, i64 1
  %93 = load double, ptr %92, align 8, !tbaa !25
  %94 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %87, ptr noundef @.str.1101, double noundef %90, double noundef %93, double noundef 0.000000e+00) #4
  br label %95

95:                                               ; preds = %86, %76
  %96 = load ptr, ptr %6, align 8, !tbaa !5
  %97 = call ptr @vertextraverse(ptr noundef %96)
  store ptr %97, ptr %13, align 8, !tbaa !5
  br label %68, !llvm.loop !26

98:                                               ; preds = %68
  %99 = load ptr, ptr %6, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.mesh, ptr %99, i32 0, i32 0
  call void @traversalinit(ptr noundef %100)
  %101 = load ptr, ptr %6, align 8, !tbaa !5
  %102 = call ptr @triangletraverse(ptr noundef %101)
  %103 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 0
  store ptr %102, ptr %103, align 8, !tbaa !28
  %104 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 1
  store i32 0, ptr %104, align 8, !tbaa !29
  br label %105

105:                                              ; preds = %109, %98
  %106 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 0
  %107 = load ptr, ptr %106, align 8, !tbaa !28
  %108 = icmp ne ptr %107, null
  br i1 %108, label %109, label %178

109:                                              ; preds = %105
  %110 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 0
  %111 = load ptr, ptr %110, align 8, !tbaa !28
  %112 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 1
  %113 = load i32, ptr %112, align 8, !tbaa !29
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [3 x i32], ptr @plus1mod3, i64 0, i64 %114
  %116 = load i32, ptr %115, align 4, !tbaa !9
  %117 = add nsw i32 %116, 3
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds ptr, ptr %111, i64 %118
  %120 = load ptr, ptr %119, align 8, !tbaa !5
  store ptr %120, ptr %14, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 0
  %122 = load ptr, ptr %121, align 8, !tbaa !28
  %123 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 1
  %124 = load i32, ptr %123, align 8, !tbaa !29
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [3 x i32], ptr @minus1mod3, i64 0, i64 %125
  %127 = load i32, ptr %126, align 4, !tbaa !9
  %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 %15, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 0
  %133 = load ptr, ptr %132, align 8, !tbaa !28
  %134 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 1
  %135 = load i32, ptr %134, align 8, !tbaa !29
  %136 = add nsw i32 %135, 3
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds ptr, ptr %133, i64 %137
  %139 = load ptr, ptr %138, align 8, !tbaa !5
  store ptr %139, ptr %16, align 8, !tbaa !5
  %140 = load ptr, ptr %11, align 8, !tbaa !5
  %141 = load ptr, ptr %14, align 8, !tbaa !5
  %142 = load ptr, ptr %6, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.mesh, ptr %142, i32 0, i32 30
  %144 = load i32, ptr %143, align 4, !tbaa !24
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds i32, ptr %141, i64 %145
  %147 = load i32, ptr %146, align 4, !tbaa !9
  %148 = load ptr, ptr %7, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.behavior, ptr %148, i32 0, i32 10
  %150 = load i32, ptr %149, align 8, !tbaa !30
  %151 = sub nsw i32 %147, %150
  %152 = load ptr, ptr %15, align 8, !tbaa !5
  %153 = load ptr, ptr %6, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.mesh, ptr %153, i32 0, i32 30
  %155 = load i32, ptr %154, align 4, !tbaa !24
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds i32, ptr %152, i64 %156
  %158 = load i32, ptr %157, align 4, !tbaa !9
  %159 = load ptr, ptr %7, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.behavior, ptr %159, i32 0, i32 10
  %161 = load i32, ptr %160, align 8, !tbaa !30
  %162 = sub nsw i32 %158, %161
  %163 = load ptr, ptr %16, align 8, !tbaa !5
  %164 = load ptr, ptr %6, align 8, !tbaa !5
  %165 = getelementptr inbounds %struct.mesh, ptr %164, i32 0, i32 30
  %166 = load i32, ptr %165, align 4, !tbaa !24
  %167 = sext i32 %166 to i64
  %168 = getelementptr inbounds i32, ptr %163, i64 %167
  %169 = load i32, ptr %168, align 4, !tbaa !9
  %170 = load ptr, ptr %7, align 8, !tbaa !5
  %171 = getelementptr inbounds %struct.behavior, ptr %170, i32 0, i32 10
  %172 = load i32, ptr %171, align 8, !tbaa !30
  %173 = sub nsw i32 %169, %172
  %174 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %140, ptr noundef @.str.1102, i32 noundef %151, i32 noundef %162, i32 noundef %173) #4
  %175 = load ptr, ptr %6, align 8, !tbaa !5
  %176 = call ptr @triangletraverse(ptr noundef %175)
  %177 = getelementptr inbounds %struct.otri, ptr %12, i32 0, i32 0
  store ptr %176, ptr %177, align 8, !tbaa !28
  br label %105, !llvm.loop !31

178:                                              ; preds = %105
  %179 = load ptr, ptr %11, align 8, !tbaa !5
  %180 = load i32, ptr %9, align 4, !tbaa !9
  %181 = load ptr, ptr %10, align 8, !tbaa !5
  call void @finishfile(ptr noundef %179, i32 noundef %180, ptr noundef %181)
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 8, 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 = !{!12, !10, i64 36}
!15 = !{!16, !18, i64 240}
!16 = !{!"mesh", !17, i64 0, !17, i64 88, !17, i64 176, !17, i64 264, !17, i64 352, !17, i64 440, !17, i64 528, !17, 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, !18, i64 82704, !10, i64 82712, !10, i64 82716, !10, i64 82720, !18, 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, !18, i64 82776, !18, i64 82784, !18, i64 82792, !18, i64 82800, !18, i64 82808, !18, i64 82816, !18, i64 82824, !6, i64 82832, !6, i64 82840, !6, i64 82848, !6, i64 82856, !6, i64 82864, !6, i64 82872, !6, i64 82880, !19, i64 82888}
!17 = !{!"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, !18, i64 64, !18, i64 72, !10, i64 80, !10, i64 84}
!18 = !{!"long", !7, i64 0}
!19 = !{!"otri", !6, i64 0, !10, i64 8}
!20 = !{!16, !10, i64 82700}
!21 = !{!18, !18, i64 0}
!22 = !{!16, !18, i64 64}
!23 = !{!16, !18, i64 82704}
!24 = !{!16, !10, i64 82740}
!25 = !{!13, !13, i64 0}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.mustprogress"}
!28 = !{!19, !6, i64 0}
!29 = !{!19, !10, i64 8}
!30 = !{!12, !10, i64 40}
!31 = distinct !{!31, !27}


; 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.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.1100 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.1101 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.1102 = 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: nounwind uwtable
declare dso_local ptr @vertextraverse(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 @writeoff(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 = getelementptr inbounds i8, ptr %1, i64 36
  %12 = load i32, ptr %11, align 4, !tbaa !11
  %.not44 = icmp eq i32 %12, 0
  %13 = getelementptr inbounds i8, ptr %0, i64 240
  %14 = load i64, ptr %13, align 8, !tbaa !12
  br i1 %.not44, label %20, label %15

15:                                               ; preds = %10
  %16 = getelementptr inbounds i8, ptr %0, i64 82700
  %17 = load i32, ptr %16, align 4, !tbaa !18
  %18 = sext i32 %17 to i64
  %19 = sub nsw i64 %14, %18
  br label %20

20:                                               ; preds = %10, %15
  %.0 = phi i64 [ %19, %15 ], [ %14, %10 ]
  %21 = tail call noalias ptr @fopen(ptr noundef %2, ptr noundef nonnull @.str.1079)
  %22 = icmp eq ptr %21, null
  br i1 %22, label %23, label %25

23:                                               ; preds = %20
  %24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1080, ptr noundef %2)
  tail call void @triexit(i32 noundef 1)
  br label %25

25:                                               ; preds = %23, %20
  %26 = getelementptr inbounds i8, ptr %0, i64 64
  %27 = load i64, ptr %26, align 8, !tbaa !19
  %28 = getelementptr inbounds i8, ptr %0, i64 82704
  %29 = load i64, ptr %28, align 8, !tbaa !20
  %30 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %21, ptr noundef nonnull @.str.1100, i64 noundef %.0, i64 noundef %27, i64 noundef %29) #2
  %31 = getelementptr inbounds i8, ptr %0, i64 176
  tail call void @traversalinit(ptr noundef nonnull %31)
  %32 = tail call ptr @vertextraverse(ptr noundef nonnull %0)
  %.not4549 = icmp eq ptr %32, null
  br i1 %.not4549, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %25
  %33 = getelementptr inbounds i8, ptr %0, i64 82740
  br label %34

34:                                               ; preds = %.lr.ph, %47
  %.04350 = phi ptr [ %32, %.lr.ph ], [ %48, %47 ]
  %35 = load i32, ptr %11, align 4, !tbaa !11
  %.not47 = icmp eq i32 %35, 0
  br i1 %.not47, label %42, label %36

36:                                               ; preds = %34
  %37 = load i32, ptr %33, align 4, !tbaa !21
  %38 = add nsw i32 %37, 1
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds i32, ptr %.04350, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !22
  %.not48 = icmp eq i32 %41, -32767
  br i1 %.not48, label %47, label %42

42:                                               ; preds = %36, %34
  %43 = load double, ptr %.04350, align 8, !tbaa !23
  %44 = getelementptr inbounds i8, ptr %.04350, i64 8
  %45 = load double, ptr %44, align 8, !tbaa !23
  %46 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %21, ptr noundef nonnull @.str.1101, double noundef %43, double noundef %45, double noundef 0.000000e+00) #2
  br label %47

47:                                               ; preds = %42, %36
  %48 = tail call ptr @vertextraverse(ptr noundef %0)
  %.not45 = icmp eq ptr %48, null
  br i1 %.not45, label %._crit_edge, label %34, !llvm.loop !24

._crit_edge:                                      ; preds = %47, %25
  tail call void @traversalinit(ptr noundef %0)
  %49 = tail call ptr @triangletraverse(ptr noundef %0)
  %.not4651 = icmp eq ptr %49, null
  br i1 %.not4651, label %._crit_edge55, label %.lr.ph54

.lr.ph54:                                         ; preds = %._crit_edge
  %50 = getelementptr inbounds i8, ptr %0, i64 82740
  %51 = getelementptr inbounds i8, ptr %1, i64 40
  br label %52

52:                                               ; preds = %.lr.ph54, %52
  %.sroa.0.052 = phi ptr [ %49, %.lr.ph54 ], [ %78, %52 ]
  %53 = load i32, ptr @plus1mod3, align 4, !tbaa !22
  %54 = add nsw i32 %53, 3
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds ptr, ptr %.sroa.0.052, i64 %55
  %57 = load ptr, ptr %56, align 8, !tbaa !26
  %58 = load i32, ptr @minus1mod3, align 4, !tbaa !22
  %59 = add nsw i32 %58, 3
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds ptr, ptr %.sroa.0.052, i64 %60
  %62 = load ptr, ptr %61, align 8, !tbaa !26
  %63 = getelementptr inbounds i8, ptr %.sroa.0.052, i64 24
  %64 = load ptr, ptr %63, align 8, !tbaa !26
  %65 = load i32, ptr %50, align 4, !tbaa !21
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds i32, ptr %57, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !22
  %69 = load i32, ptr %51, align 8, !tbaa !27
  %70 = sub nsw i32 %68, %69
  %71 = getelementptr inbounds i32, ptr %62, i64 %66
  %72 = load i32, ptr %71, align 4, !tbaa !22
  %73 = sub nsw i32 %72, %69
  %74 = getelementptr inbounds i32, ptr %64, i64 %66
  %75 = load i32, ptr %74, align 4, !tbaa !22
  %76 = sub nsw i32 %75, %69
  %77 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %21, ptr noundef nonnull @.str.1102, i32 noundef %70, i32 noundef %73, i32 noundef %76) #2
  %78 = tail call ptr @triangletraverse(ptr noundef %0)
  %.not46 = icmp eq ptr %78, null
  br i1 %.not46, label %._crit_edge55, label %52, !llvm.loop !28

._crit_edge55:                                    ; preds = %52, %._crit_edge
  tail call void @finishfile(ptr noundef %21, 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 = !{!6, !7, i64 36}
!12 = !{!13, !16, i64 240}
!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, !8, i64 704, !8, i64 33472, !8, i64 66240, !7, i64 82624, !15, 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, !16, i64 82704, !7, i64 82712, !7, i64 82716, !7, i64 82720, !16, 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, !16, i64 82776, !16, i64 82784, !16, i64 82792, !16, i64 82800, !16, i64 82808, !16, i64 82816, !16, i64 82824, !15, i64 82832, !15, i64 82840, !15, i64 82848, !15, i64 82856, !15, i64 82864, !15, i64 82872, !15, i64 82880, !17, i64 82888}
!14 = !{!"memorypool", !15, i64 0, !15, i64 8, !15, i64 16, !15, i64 24, !15, i64 32, !15, i64 40, !7, i64 48, !7, i64 52, !7, i64 56, !7, i64 60, !16, i64 64, !16, i64 72, !7, i64 80, !7, i64 84}
!15 = !{!"any pointer", !8, i64 0}
!16 = !{!"long", !8, i64 0}
!17 = !{!"otri", !15, i64 0, !7, i64 8}
!18 = !{!13, !7, i64 82700}
!19 = !{!13, !16, i64 64}
!20 = !{!13, !16, i64 82704}
!21 = !{!13, !7, i64 82740}
!22 = !{!7, !7, i64 0}
!23 = !{!10, !10, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!15, !15, i64 0}
!27 = !{!6, !7, i64 40}
!28 = distinct !{!28, !25}


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