; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R2Shapes/R2Grid.ll (ZNK6R2Grid12WriteRAWFileEPKc)

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

%class.R2Grid = type { %class.R2Affine, %class.R2Affine, double, ptr, [2 x i32], i32, i32 }
%class.R2Affine = type <{ %class.R2Transformation, %class.R3Matrix, i32, [4 x i8] }>
%class.R2Transformation = type { ptr }
%class.R3Matrix = type { [3 x [3 x double]] }

@stderr = external global ptr, align 8
@.str.41 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [40 x i8], align 1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #0

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) #1

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #3

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK6R2Grid12WriteRAWFileEPKc(ptr noundef nonnull align 8 dereferenceable(208) %0, ptr noundef %1) #5 align 2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca [4 x i32], align 16
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %16 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = call noalias ptr @fopen(ptr noundef %17, ptr noundef @.str.47)
  store ptr %18, ptr %6, align 8, !tbaa !5
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = icmp ne ptr %19, null
  br i1 %20, label %25, label %21

21:                                               ; preds = %2
  %22 = load ptr, ptr @stderr, align 8, !tbaa !5
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %22, ptr noundef @.str.41, ptr noundef %23) #7
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %129

25:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 54321, ptr %8, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %26 = getelementptr inbounds %class.R2Grid, ptr %16, i32 0, i32 4
  %27 = getelementptr inbounds [2 x i32], ptr %26, i64 0, i64 0
  %28 = load i32, ptr %27, align 8, !tbaa !9
  store i32 %28, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %29 = getelementptr inbounds %class.R2Grid, ptr %16, i32 0, i32 4
  %30 = getelementptr inbounds [2 x i32], ptr %29, i64 0, i64 1
  %31 = load i32, ptr %30, align 4, !tbaa !9
  store i32 %31, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #7
  store i32 54321, ptr %11, align 4, !tbaa !9
  %32 = getelementptr inbounds i32, ptr %11, i64 1
  %33 = load i32, ptr %9, align 4, !tbaa !9
  store i32 %33, ptr %32, align 4, !tbaa !9
  %34 = getelementptr inbounds i32, ptr %11, i64 2
  %35 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %35, ptr %34, align 4, !tbaa !9
  %36 = getelementptr inbounds i32, ptr %11, i64 3
  store i32 1, ptr %36, align 4, !tbaa !9
  %37 = getelementptr inbounds [4 x i32], ptr %11, i64 0, i64 0
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = call i64 @fwrite(ptr noundef %37, i64 noundef 4, i64 noundef 4, ptr noundef %38)
  %40 = icmp ne i64 %39, 4
  br i1 %40, label %41, label %45

41:                                               ; preds = %25
  %42 = load ptr, ptr @stderr, align 8, !tbaa !5
  %43 = load ptr, ptr %5, align 8, !tbaa !5
  %44 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %42, ptr noundef @.str.42, ptr noundef %43) #7
  store i32 -1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %128

45:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %46 = getelementptr inbounds %class.R2Grid, ptr %16, i32 0, i32 5
  %47 = load i32, ptr %46, align 8, !tbaa !11
  %48 = sext i32 %47 to i64
  %49 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %48, i64 4)
  %50 = extractvalue { i64, i1 } %49, 1
  %51 = extractvalue { i64, i1 } %49, 0
  %52 = select i1 %50, i64 -1, i64 %51
  %53 = call noalias noundef nonnull ptr @_Znam(i64 noundef %52) #8
  store ptr %53, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %54

54:                                               ; preds = %113, %45
  %55 = load i32, ptr %13, align 4, !tbaa !9
  %56 = getelementptr inbounds %class.R2Grid, ptr %16, i32 0, i32 4
  %57 = getelementptr inbounds [2 x i32], ptr %56, i64 0, i64 1
  %58 = load i32, ptr %57, align 4, !tbaa !9
  %59 = icmp slt i32 %55, %58
  br i1 %59, label %61, label %60

60:                                               ; preds = %54
  store i32 2, ptr %7, align 4
  br label %116

61:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %62 = getelementptr inbounds %class.R2Grid, ptr %16, i32 0, i32 3
  %63 = load ptr, ptr %62, align 8, !tbaa !17
  %64 = load i32, ptr %13, align 4, !tbaa !9
  %65 = getelementptr inbounds %class.R2Grid, ptr %16, i32 0, i32 4
  %66 = getelementptr inbounds [2 x i32], ptr %65, i64 0, i64 0
  %67 = load i32, ptr %66, align 8, !tbaa !9
  %68 = mul nsw i32 %64, %67
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds double, ptr %63, i64 %69
  store ptr %70, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %71

71:                                               ; preds = %89, %61
  %72 = load i32, ptr %15, align 4, !tbaa !9
  %73 = getelementptr inbounds %class.R2Grid, ptr %16, i32 0, i32 4
  %74 = getelementptr inbounds [2 x i32], ptr %73, i64 0, i64 0
  %75 = load i32, ptr %74, align 8, !tbaa !9
  %76 = icmp slt i32 %72, %75
  br i1 %76, label %78, label %77

77:                                               ; preds = %71
  store i32 5, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %92

78:                                               ; preds = %71
  %79 = load ptr, ptr %14, align 8, !tbaa !5
  %80 = load i32, ptr %15, align 4, !tbaa !9
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds double, ptr %79, i64 %81
  %83 = load double, ptr %82, align 8, !tbaa !18
  %84 = fptrunc double %83 to float
  %85 = load ptr, ptr %12, align 8, !tbaa !5
  %86 = load i32, ptr %15, align 4, !tbaa !9
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds float, ptr %85, i64 %87
  store float %84, ptr %88, align 4, !tbaa !19
  br label %89

89:                                               ; preds = %78
  %90 = load i32, ptr %15, align 4, !tbaa !9
  %91 = add nsw i32 %90, 1
  store i32 %91, ptr %15, align 4, !tbaa !9
  br label %71, !llvm.loop !21

92:                                               ; preds = %77
  %93 = load ptr, ptr %12, align 8, !tbaa !5
  %94 = getelementptr inbounds %class.R2Grid, ptr %16, i32 0, i32 4
  %95 = getelementptr inbounds [2 x i32], ptr %94, i64 0, i64 0
  %96 = load i32, ptr %95, align 8, !tbaa !9
  %97 = sext i32 %96 to i64
  %98 = load ptr, ptr %6, align 8, !tbaa !5
  %99 = call i64 @fwrite(ptr noundef %93, i64 noundef 4, i64 noundef %97, ptr noundef %98)
  %100 = getelementptr inbounds %class.R2Grid, ptr %16, i32 0, i32 4
  %101 = getelementptr inbounds [2 x i32], ptr %100, i64 0, i64 0
  %102 = load i32, ptr %101, align 8, !tbaa !9
  %103 = zext i32 %102 to i64
  %104 = icmp ne i64 %99, %103
  br i1 %104, label %105, label %109

105:                                              ; preds = %92
  %106 = load ptr, ptr @stderr, align 8, !tbaa !5
  %107 = load ptr, ptr %5, align 8, !tbaa !5
  %108 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %106, ptr noundef @.str.48, ptr noundef %107) #7
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %110

109:                                              ; preds = %92
  store i32 0, ptr %7, align 4
  br label %110

110:                                              ; preds = %109, %105
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  %111 = load i32, ptr %7, align 4
  switch i32 %111, label %116 [
    i32 0, label %112
  ]

112:                                              ; preds = %110
  br label %113

113:                                              ; preds = %112
  %114 = load i32, ptr %13, align 4, !tbaa !9
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %13, align 4, !tbaa !9
  br label %54, !llvm.loop !23

116:                                              ; preds = %110, %60
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  %117 = load i32, ptr %7, align 4
  switch i32 %117, label %127 [
    i32 2, label %118
  ]

118:                                              ; preds = %116
  %119 = load ptr, ptr %12, align 8, !tbaa !5
  %120 = icmp eq ptr %119, null
  br i1 %120, label %122, label %121

121:                                              ; preds = %118
  call void @_ZdaPv(ptr noundef %119) #9
  br label %122

122:                                              ; preds = %121, %118
  %123 = load ptr, ptr %6, align 8, !tbaa !5
  %124 = call i32 @fclose(ptr noundef %123)
  %125 = getelementptr inbounds %class.R2Grid, ptr %16, i32 0, i32 6
  %126 = load i32, ptr %125, align 4, !tbaa !24
  store i32 %126, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %127

127:                                              ; preds = %122, %116
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %128

128:                                              ; preds = %127, %41
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %129

129:                                              ; preds = %128, %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  %130 = load i32, ptr %3, align 4
  ret i32 %130
}

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

declare i32 @fclose(ptr noundef) #6

declare i64 @fwrite(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #6

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nobuiltin allocsize(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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nobuiltin 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 "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 #5 = { mustprogress 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 #6 = { "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 #7 = { nounwind }
attributes #8 = { builtin allocsize(0) }
attributes #9 = { builtin 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 200}
!12 = !{!"_ZTS6R2Grid", !13, i64 0, !13, i64 88, !16, i64 176, !6, i64 184, !7, i64 192, !10, i64 200, !10, i64 204}
!13 = !{!"_ZTS8R2Affine", !14, i64 0, !15, i64 8, !10, i64 80}
!14 = !{!"_ZTS16R2Transformation"}
!15 = !{!"_ZTS8R3Matrix", !7, i64 0}
!16 = !{!"double", !7, i64 0}
!17 = !{!12, !6, i64 184}
!18 = !{!16, !16, i64 0}
!19 = !{!20, !20, i64 0}
!20 = !{!"float", !7, i64 0}
!21 = distinct !{!21, !22}
!22 = !{!"llvm.loop.mustprogress"}
!23 = distinct !{!23, !22}
!24 = !{!12, !10, i64 204}


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

@stderr = external local_unnamed_addr global ptr, align 8
@.str.41 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.47 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.48 = external hidden unnamed_addr constant [40 x i8], align 1

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK6R2Grid12WriteRAWFileEPKc(ptr nocapture noundef nonnull readonly align 8 dereferenceable(208) %0, ptr noundef %1) local_unnamed_addr #4 align 2 {
  %3 = alloca [4 x i32], align 16
  %4 = tail call noalias ptr @fopen(ptr noundef %1, ptr noundef nonnull @.str.47)
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %5, label %8

5:                                                ; preds = %2
  %6 = load ptr, ptr @stderr, align 8, !tbaa !5
  %7 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %6, ptr noundef nonnull @.str.41, ptr noundef %1) #5
  br label %60

8:                                                ; preds = %2
  %9 = getelementptr inbounds i8, ptr %0, i64 192
  %10 = getelementptr inbounds i8, ptr %0, i64 196
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #6
  store i32 54321, ptr %3, align 16, !tbaa !9
  %11 = getelementptr inbounds i8, ptr %3, i64 4
  %12 = load <2 x i32>, ptr %9, align 8, !tbaa !9
  store <2 x i32> %12, ptr %11, align 4, !tbaa !9
  %13 = getelementptr inbounds i8, ptr %3, i64 12
  store i32 1, ptr %13, align 4, !tbaa !9
  %14 = call i64 @fwrite(ptr noundef nonnull %3, i64 noundef 4, i64 noundef 4, ptr noundef nonnull %4)
  %.not31 = icmp eq i64 %14, 4
  br i1 %.not31, label %18, label %15

15:                                               ; preds = %8
  %16 = load ptr, ptr @stderr, align 8, !tbaa !5
  %17 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %16, ptr noundef nonnull @.str.42, ptr noundef %1) #5
  br label %59

18:                                               ; preds = %8
  %19 = getelementptr inbounds i8, ptr %0, i64 200
  %20 = load i32, ptr %19, align 8, !tbaa !11
  %21 = sext i32 %20 to i64
  %22 = icmp slt i32 %20, 0
  %23 = shl nsw i64 %21, 2
  %24 = select i1 %22, i64 -1, i64 %23
  %25 = tail call noalias noundef nonnull ptr @_Znam(i64 noundef %24) #7
  %26 = load i32, ptr %10, align 4, !tbaa !9
  %.not3337 = icmp sgt i32 %26, 0
  br i1 %.not3337, label %.lr.ph40, label %.critedge35

.lr.ph40:                                         ; preds = %18
  %27 = getelementptr inbounds i8, ptr %0, i64 184
  %.pre = load i32, ptr %9, align 8, !tbaa !9
  br label %31

28:                                               ; preds = %.critedge
  %29 = add nuw nsw i32 %.02638, 1
  %30 = load i32, ptr %10, align 4, !tbaa !9
  %.not33 = icmp slt i32 %29, %30
  br i1 %.not33, label %31, label %.critedge35, !llvm.loop !17

31:                                               ; preds = %.lr.ph40, %28
  %32 = phi i32 [ %.pre, %.lr.ph40 ], [ %47, %28 ]
  %.02638 = phi i32 [ 0, %.lr.ph40 ], [ %29, %28 ]
  %33 = load ptr, ptr %27, align 8, !tbaa !19
  %34 = mul nsw i32 %32, %.02638
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds double, ptr %33, i64 %35
  %37 = icmp sgt i32 %32, 0
  br i1 %37, label %.lr.ph.preheader, label %.critedge

.lr.ph.preheader:                                 ; preds = %31
  %wide.trip.count = zext nneg i32 %32 to i64
  %min.iters.check = icmp ult i32 %32, 4
  br i1 %min.iters.check, label %.lr.ph.preheader43, label %vector.ph

.lr.ph.preheader43:                               ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %wide.trip.count, 2147483644
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %38 = getelementptr inbounds double, ptr %36, i64 %index
  %39 = getelementptr inbounds i8, ptr %38, i64 16
  %wide.load = load <2 x double>, ptr %38, align 8, !tbaa !20
  %wide.load42 = load <2 x double>, ptr %39, align 8, !tbaa !20
  %40 = fptrunc <2 x double> %wide.load to <2 x float>
  %41 = fptrunc <2 x double> %wide.load42 to <2 x float>
  %42 = getelementptr inbounds float, ptr %25, i64 %index
  %43 = getelementptr inbounds i8, ptr %42, i64 8
  store <2 x float> %40, ptr %42, align 4, !tbaa !21
  store <2 x float> %41, ptr %43, align 4, !tbaa !21
  %index.next = add nuw i64 %index, 4
  %44 = icmp eq i64 %index.next, %n.vec
  br i1 %44, label %middle.block, label %vector.body, !llvm.loop !23

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %.critedge, label %.lr.ph.preheader43

.critedge:                                        ; preds = %.lr.ph, %middle.block, %31
  %45 = sext i32 %32 to i64
  %46 = tail call i64 @fwrite(ptr noundef nonnull %25, i64 noundef 4, i64 noundef %45, ptr noundef nonnull %4)
  %47 = load i32, ptr %9, align 8, !tbaa !9
  %48 = zext i32 %47 to i64
  %.not32 = icmp eq i64 %46, %48
  br i1 %.not32, label %28, label %53

.lr.ph:                                           ; preds = %.lr.ph.preheader43, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader43 ]
  %49 = getelementptr inbounds double, ptr %36, i64 %indvars.iv
  %50 = load double, ptr %49, align 8, !tbaa !20
  %51 = fptrunc double %50 to float
  %52 = getelementptr inbounds float, ptr %25, i64 %indvars.iv
  store float %51, ptr %52, align 4, !tbaa !21
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.critedge, label %.lr.ph, !llvm.loop !26

53:                                               ; preds = %.critedge
  %54 = load ptr, ptr @stderr, align 8, !tbaa !5
  %55 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %54, ptr noundef nonnull @.str.48, ptr noundef %1) #5
  br label %59

.critedge35:                                      ; preds = %28, %18
  tail call void @_ZdaPv(ptr noundef nonnull %25) #8
  %56 = tail call i32 @fclose(ptr noundef nonnull %4)
  %57 = getelementptr inbounds i8, ptr %0, i64 204
  %58 = load i32, ptr %57, align 4, !tbaa !27
  br label %59

59:                                               ; preds = %53, %.critedge35, %15
  %.4 = phi i32 [ -1, %15 ], [ %58, %.critedge35 ], [ 0, %53 ]
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #6
  br label %60

60:                                               ; preds = %59, %5
  %.5 = phi i32 [ %.4, %59 ], [ 0, %5 ]
  ret i32 %.5
}

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

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind
declare noundef i64 @fwrite(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #3

attributes #0 = { nobuiltin allocsize(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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nobuiltin 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 #3 = { 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 #4 = { mustprogress 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 #5 = { cold nounwind }
attributes #6 = { nounwind }
attributes #7 = { builtin allocsize(0) }
attributes #8 = { builtin 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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 200}
!12 = !{!"_ZTS6R2Grid", !13, i64 0, !13, i64 88, !16, i64 176, !6, i64 184, !7, i64 192, !10, i64 200, !10, i64 204}
!13 = !{!"_ZTS8R2Affine", !14, i64 0, !15, i64 8, !10, i64 80}
!14 = !{!"_ZTS16R2Transformation"}
!15 = !{!"_ZTS8R3Matrix", !7, i64 0}
!16 = !{!"double", !7, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!12, !6, i64 184}
!20 = !{!16, !16, i64 0}
!21 = !{!22, !22, i64 0}
!22 = !{!"float", !7, i64 0}
!23 = distinct !{!23, !18, !24, !25}
!24 = !{!"llvm.loop.isvectorized", i32 1}
!25 = !{!"llvm.loop.unroll.runtime.disable"}
!26 = distinct !{!26, !18, !25, !24}
!27 = !{!12, !10, i64 204}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,PostOrderFunctionAttrsPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass