; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R3Shapes/R3Grid.ll (ZNK6R3Grid9WriteGridEP8_IO_FILE)

; 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.R3Grid = type { %class.R3Affine, %class.R3Affine, double, double, ptr, [3 x i32], i32, i32, i32 }
%class.R3Affine = type { %class.R3Transformation, %class.R4Matrix, %class.R4Matrix, %class.RNFlags }
%class.R3Transformation = type { ptr }
%class.R4Matrix = type { [4 x [4 x double]] }
%class.RNFlags = type { i64 }

@stdout = external global ptr, align 8
@.str.52 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [35 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(128) ptr @_ZNK8R3Affine6MatrixEv(ptr noundef nonnull align 8 dereferenceable(272)) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZNK8R4MatrixixEi(ptr noundef nonnull align 8 dereferenceable(128), i32 noundef) #2 align 2

declare void @_Z6RNFailPKcz(ptr noundef, ...) #3

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK6R3Grid9WriteGridEP8_IO_FILE(ptr noundef nonnull align 8 dereferenceable(592) %0, ptr noundef %1) #4 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 float, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca float, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %13 = load ptr, ptr %4, align 8
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = icmp ne ptr %14, null
  br i1 %15, label %18, label %16

16:                                               ; preds = %2
  %17 = load ptr, ptr @stdout, align 8, !tbaa !5
  store ptr %17, ptr %5, align 8, !tbaa !5
  br label %18

18:                                               ; preds = %16, %2
  %19 = getelementptr inbounds %class.R3Grid, ptr %13, i32 0, i32 5
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = call i64 @fwrite(ptr noundef %19, i64 noundef 4, i64 noundef 3, ptr noundef %20)
  %22 = icmp ne i64 %21, 3
  br i1 %22, label %23, label %24

23:                                               ; preds = %18
  call void (ptr, ...) @_Z6RNFailPKcz(ptr noundef @.str.52)
  store i32 0, ptr %3, align 4
  br label %83

24:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %25 = getelementptr inbounds %class.R3Grid, ptr %13, i32 0, i32 1
  %26 = call noundef nonnull align 8 dereferenceable(128) ptr @_ZNK8R3Affine6MatrixEv(ptr noundef nonnull align 8 dereferenceable(272) %25)
  %27 = call noundef ptr @_ZNK8R4MatrixixEi(ptr noundef nonnull align 8 dereferenceable(128) %26, i32 noundef 0)
  %28 = getelementptr inbounds double, ptr %27, i64 0
  store ptr %28, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !9
  br label %29

29:                                               ; preds = %46, %24
  %30 = load i32, ptr %7, align 4, !tbaa !9
  %31 = icmp slt i32 %30, 16
  br i1 %31, label %33, label %32

32:                                               ; preds = %29
  store i32 2, ptr %8, align 4
  br label %49

33:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = getelementptr inbounds double, ptr %34, i32 1
  store ptr %35, ptr %6, align 8, !tbaa !5
  %36 = load double, ptr %34, align 8, !tbaa !11
  %37 = fptrunc double %36 to float
  store float %37, ptr %9, align 4, !tbaa !13
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = call i64 @fwrite(ptr noundef %9, i64 noundef 4, i64 noundef 1, ptr noundef %38)
  %40 = icmp ne i64 %39, 1
  br i1 %40, label %41, label %42

41:                                               ; preds = %33
  call void (ptr, ...) @_Z6RNFailPKcz(ptr noundef @.str.53)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %43

42:                                               ; preds = %33
  store i32 0, ptr %8, align 4
  br label %43

43:                                               ; preds = %42, %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  %44 = load i32, ptr %8, align 4
  switch i32 %44, label %49 [
    i32 0, label %45
  ]

45:                                               ; preds = %43
  br label %46

46:                                               ; preds = %45
  %47 = load i32, ptr %7, align 4, !tbaa !9
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %7, align 4, !tbaa !9
  br label %29, !llvm.loop !15

49:                                               ; preds = %43, %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  %50 = load i32, ptr %8, align 4
  switch i32 %50, label %82 [
    i32 2, label %51
  ]

51:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %52 = getelementptr inbounds %class.R3Grid, ptr %13, i32 0, i32 4
  %53 = load ptr, ptr %52, align 8, !tbaa !17
  store ptr %53, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !9
  br label %54

54:                                               ; preds = %73, %51
  %55 = load i32, ptr %11, align 4, !tbaa !9
  %56 = getelementptr inbounds %class.R3Grid, ptr %13, i32 0, i32 8
  %57 = load i32, ptr %56, align 4, !tbaa !24
  %58 = icmp slt i32 %55, %57
  br i1 %58, label %60, label %59

59:                                               ; preds = %54
  store i32 5, ptr %8, align 4
  br label %76

60:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %61 = load ptr, ptr %10, align 8, !tbaa !5
  %62 = getelementptr inbounds double, ptr %61, i32 1
  store ptr %62, ptr %10, align 8, !tbaa !5
  %63 = load double, ptr %61, align 8, !tbaa !11
  %64 = fptrunc double %63 to float
  store float %64, ptr %12, align 4, !tbaa !13
  %65 = load ptr, ptr %5, align 8, !tbaa !5
  %66 = call i64 @fwrite(ptr noundef %12, i64 noundef 4, i64 noundef 1, ptr noundef %65)
  %67 = icmp ne i64 %66, 1
  br i1 %67, label %68, label %69

68:                                               ; preds = %60
  call void (ptr, ...) @_Z6RNFailPKcz(ptr noundef @.str.54)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %70

69:                                               ; preds = %60
  store i32 0, ptr %8, align 4
  br label %70

70:                                               ; preds = %69, %68
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  %71 = load i32, ptr %8, align 4
  switch i32 %71, label %76 [
    i32 0, label %72
  ]

72:                                               ; preds = %70
  br label %73

73:                                               ; preds = %72
  %74 = load i32, ptr %11, align 4, !tbaa !9
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %11, align 4, !tbaa !9
  br label %54, !llvm.loop !25

76:                                               ; preds = %70, %59
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  %77 = load i32, ptr %8, align 4
  switch i32 %77, label %81 [
    i32 5, label %78
  ]

78:                                               ; preds = %76
  %79 = getelementptr inbounds %class.R3Grid, ptr %13, i32 0, i32 8
  %80 = load i32, ptr %79, align 4, !tbaa !24
  store i32 %80, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %81

81:                                               ; preds = %78, %76
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %82

82:                                               ; preds = %81, %49
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  br label %83

83:                                               ; preds = %82, %23
  %84 = load i32, ptr %3, align 4
  ret i32 %84
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint mustprogress 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 = { inlinehint 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 #3 = { "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 = { 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, !12, i64 0}
!12 = !{!"double", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!18, !6, i64 560}
!18 = !{!"_ZTS6R3Grid", !19, i64 0, !19, i64 272, !12, i64 544, !12, i64 552, !6, i64 560, !7, i64 568, !10, i64 580, !10, i64 584, !10, i64 588}
!19 = !{!"_ZTS8R3Affine", !20, i64 0, !21, i64 8, !21, i64 136, !22, i64 264}
!20 = !{!"_ZTS16R3Transformation"}
!21 = !{!"_ZTS8R4Matrix", !7, i64 0}
!22 = !{!"_ZTS7RNFlags", !23, i64 0}
!23 = !{!"long", !7, i64 0}
!24 = !{!18, !10, i64 588}
!25 = distinct !{!25, !16}


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

@stdout = external local_unnamed_addr global ptr, align 8
@.str.52 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [52 x i8], align 1
@.str.54 = external hidden unnamed_addr constant [35 x i8], align 1

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(128) ptr @_ZNK8R3Affine6MatrixEv(ptr noundef nonnull align 8 dereferenceable(272)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZNK8R4MatrixixEi(ptr noundef nonnull align 8 dereferenceable(128), i32 noundef) local_unnamed_addr #2 align 2

declare void @_Z6RNFailPKcz(ptr noundef, ...) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK6R3Grid9WriteGridEP8_IO_FILE(ptr noundef nonnull align 8 dereferenceable(592) %0, ptr noundef %1) local_unnamed_addr #4 align 2 {
  %3 = alloca float, align 4
  %4 = alloca float, align 4
  %.not = icmp eq ptr %1, null
  %5 = load ptr, ptr @stdout, align 8
  %spec.select = select i1 %.not, ptr %5, ptr %1
  %6 = getelementptr inbounds i8, ptr %0, i64 568
  %7 = tail call i64 @fwrite(ptr noundef nonnull %6, i64 noundef 4, i64 noundef 3, ptr noundef %spec.select)
  %.not28 = icmp eq i64 %7, 3
  br i1 %.not28, label %9, label %8

8:                                                ; preds = %2
  tail call void (ptr, ...) @_Z6RNFailPKcz(ptr noundef nonnull @.str.52)
  br label %.loopexit

9:                                                ; preds = %2
  %10 = getelementptr inbounds i8, ptr %0, i64 272
  %11 = tail call noundef nonnull align 8 dereferenceable(128) ptr @_ZNK8R3Affine6MatrixEv(ptr noundef nonnull align 8 dereferenceable(272) %10)
  %12 = tail call noundef ptr @_ZNK8R4MatrixixEi(ptr noundef nonnull align 8 dereferenceable(128) %11, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %13 = load double, ptr %12, align 8, !tbaa !5
  %14 = fptrunc double %13 to float
  store float %14, ptr %3, align 4, !tbaa !9
  %15 = call i64 @fwrite(ptr noundef nonnull %3, i64 noundef 4, i64 noundef 1, ptr noundef %spec.select)
  %.not29 = icmp eq i64 %15, 1
  br i1 %.not29, label %.critedge, label %16

16:                                               ; preds = %.critedge.14, %.critedge.13, %.critedge.12, %.critedge.11, %.critedge.10, %.critedge.9, %.critedge.8, %.critedge.7, %.critedge.6, %.critedge.5, %.critedge.4, %.critedge.3, %.critedge.2, %.critedge.1, %.critedge, %9
  tail call void (ptr, ...) @_Z6RNFailPKcz(ptr noundef nonnull @.str.53)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  br label %.loopexit

.critedge:                                        ; preds = %9
  %17 = getelementptr inbounds i8, ptr %12, i64 8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %18 = load double, ptr %17, align 8, !tbaa !5
  %19 = fptrunc double %18 to float
  store float %19, ptr %3, align 4, !tbaa !9
  %20 = call i64 @fwrite(ptr noundef nonnull %3, i64 noundef 4, i64 noundef 1, ptr noundef %spec.select)
  %.not29.1 = icmp eq i64 %20, 1
  br i1 %.not29.1, label %.critedge.1, label %16

.critedge.1:                                      ; preds = %.critedge
  %21 = getelementptr inbounds i8, ptr %12, i64 16
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %22 = load double, ptr %21, align 8, !tbaa !5
  %23 = fptrunc double %22 to float
  store float %23, ptr %3, align 4, !tbaa !9
  %24 = call i64 @fwrite(ptr noundef nonnull %3, i64 noundef 4, i64 noundef 1, ptr noundef %spec.select)
  %.not29.2 = icmp eq i64 %24, 1
  br i1 %.not29.2, label %.critedge.2, label %16

.critedge.2:                                      ; preds = %.critedge.1
  %25 = getelementptr inbounds i8, ptr %12, i64 24
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %26 = load double, ptr %25, align 8, !tbaa !5
  %27 = fptrunc double %26 to float
  store float %27, ptr %3, align 4, !tbaa !9
  %28 = call i64 @fwrite(ptr noundef nonnull %3, i64 noundef 4, i64 noundef 1, ptr noundef %spec.select)
  %.not29.3 = icmp eq i64 %28, 1
  br i1 %.not29.3, label %.critedge.3, label %16

.critedge.3:                                      ; preds = %.critedge.2
  %29 = getelementptr inbounds i8, ptr %12, i64 32
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %30 = load double, ptr %29, align 8, !tbaa !5
  %31 = fptrunc double %30 to float
  store float %31, ptr %3, align 4, !tbaa !9
  %32 = call i64 @fwrite(ptr noundef nonnull %3, i64 noundef 4, i64 noundef 1, ptr noundef %spec.select)
  %.not29.4 = icmp eq i64 %32, 1
  br i1 %.not29.4, label %.critedge.4, label %16

.critedge.4:                                      ; preds = %.critedge.3
  %33 = getelementptr inbounds i8, ptr %12, i64 40
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %34 = load double, ptr %33, align 8, !tbaa !5
  %35 = fptrunc double %34 to float
  store float %35, ptr %3, align 4, !tbaa !9
  %36 = call i64 @fwrite(ptr noundef nonnull %3, i64 noundef 4, i64 noundef 1, ptr noundef %spec.select)
  %.not29.5 = icmp eq i64 %36, 1
  br i1 %.not29.5, label %.critedge.5, label %16

.critedge.5:                                      ; preds = %.critedge.4
  %37 = getelementptr inbounds i8, ptr %12, i64 48
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %38 = load double, ptr %37, align 8, !tbaa !5
  %39 = fptrunc double %38 to float
  store float %39, ptr %3, align 4, !tbaa !9
  %40 = call i64 @fwrite(ptr noundef nonnull %3, i64 noundef 4, i64 noundef 1, ptr noundef %spec.select)
  %.not29.6 = icmp eq i64 %40, 1
  br i1 %.not29.6, label %.critedge.6, label %16

.critedge.6:                                      ; preds = %.critedge.5
  %41 = getelementptr inbounds i8, ptr %12, i64 56
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %42 = load double, ptr %41, align 8, !tbaa !5
  %43 = fptrunc double %42 to float
  store float %43, ptr %3, align 4, !tbaa !9
  %44 = call i64 @fwrite(ptr noundef nonnull %3, i64 noundef 4, i64 noundef 1, ptr noundef %spec.select)
  %.not29.7 = icmp eq i64 %44, 1
  br i1 %.not29.7, label %.critedge.7, label %16

.critedge.7:                                      ; preds = %.critedge.6
  %45 = getelementptr inbounds i8, ptr %12, i64 64
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %46 = load double, ptr %45, align 8, !tbaa !5
  %47 = fptrunc double %46 to float
  store float %47, ptr %3, align 4, !tbaa !9
  %48 = call i64 @fwrite(ptr noundef nonnull %3, i64 noundef 4, i64 noundef 1, ptr noundef %spec.select)
  %.not29.8 = icmp eq i64 %48, 1
  br i1 %.not29.8, label %.critedge.8, label %16

.critedge.8:                                      ; preds = %.critedge.7
  %49 = getelementptr inbounds i8, ptr %12, i64 72
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %50 = load double, ptr %49, align 8, !tbaa !5
  %51 = fptrunc double %50 to float
  store float %51, ptr %3, align 4, !tbaa !9
  %52 = call i64 @fwrite(ptr noundef nonnull %3, i64 noundef 4, i64 noundef 1, ptr noundef %spec.select)
  %.not29.9 = icmp eq i64 %52, 1
  br i1 %.not29.9, label %.critedge.9, label %16

.critedge.9:                                      ; preds = %.critedge.8
  %53 = getelementptr inbounds i8, ptr %12, i64 80
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %54 = load double, ptr %53, align 8, !tbaa !5
  %55 = fptrunc double %54 to float
  store float %55, ptr %3, align 4, !tbaa !9
  %56 = call i64 @fwrite(ptr noundef nonnull %3, i64 noundef 4, i64 noundef 1, ptr noundef %spec.select)
  %.not29.10 = icmp eq i64 %56, 1
  br i1 %.not29.10, label %.critedge.10, label %16

.critedge.10:                                     ; preds = %.critedge.9
  %57 = getelementptr inbounds i8, ptr %12, i64 88
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %58 = load double, ptr %57, align 8, !tbaa !5
  %59 = fptrunc double %58 to float
  store float %59, ptr %3, align 4, !tbaa !9
  %60 = call i64 @fwrite(ptr noundef nonnull %3, i64 noundef 4, i64 noundef 1, ptr noundef %spec.select)
  %.not29.11 = icmp eq i64 %60, 1
  br i1 %.not29.11, label %.critedge.11, label %16

.critedge.11:                                     ; preds = %.critedge.10
  %61 = getelementptr inbounds i8, ptr %12, i64 96
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %62 = load double, ptr %61, align 8, !tbaa !5
  %63 = fptrunc double %62 to float
  store float %63, ptr %3, align 4, !tbaa !9
  %64 = call i64 @fwrite(ptr noundef nonnull %3, i64 noundef 4, i64 noundef 1, ptr noundef %spec.select)
  %.not29.12 = icmp eq i64 %64, 1
  br i1 %.not29.12, label %.critedge.12, label %16

.critedge.12:                                     ; preds = %.critedge.11
  %65 = getelementptr inbounds i8, ptr %12, i64 104
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %66 = load double, ptr %65, align 8, !tbaa !5
  %67 = fptrunc double %66 to float
  store float %67, ptr %3, align 4, !tbaa !9
  %68 = call i64 @fwrite(ptr noundef nonnull %3, i64 noundef 4, i64 noundef 1, ptr noundef %spec.select)
  %.not29.13 = icmp eq i64 %68, 1
  br i1 %.not29.13, label %.critedge.13, label %16

.critedge.13:                                     ; preds = %.critedge.12
  %69 = getelementptr inbounds i8, ptr %12, i64 112
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %70 = load double, ptr %69, align 8, !tbaa !5
  %71 = fptrunc double %70 to float
  store float %71, ptr %3, align 4, !tbaa !9
  %72 = call i64 @fwrite(ptr noundef nonnull %3, i64 noundef 4, i64 noundef 1, ptr noundef %spec.select)
  %.not29.14 = icmp eq i64 %72, 1
  br i1 %.not29.14, label %.critedge.14, label %16

.critedge.14:                                     ; preds = %.critedge.13
  %73 = getelementptr inbounds i8, ptr %12, i64 120
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %74 = load double, ptr %73, align 8, !tbaa !5
  %75 = fptrunc double %74 to float
  store float %75, ptr %3, align 4, !tbaa !9
  %76 = call i64 @fwrite(ptr noundef nonnull %3, i64 noundef 4, i64 noundef 1, ptr noundef %spec.select)
  %.not29.15 = icmp eq i64 %76, 1
  br i1 %.not29.15, label %.critedge.15, label %16

.critedge.15:                                     ; preds = %.critedge.14
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  %77 = getelementptr inbounds i8, ptr %0, i64 588
  %78 = load i32, ptr %77, align 4
  %.not3142 = icmp sgt i32 %78, 0
  br i1 %.not3142, label %.lr.ph.preheader, label %.loopexit

.lr.ph.preheader:                                 ; preds = %.critedge.15
  %79 = getelementptr inbounds i8, ptr %0, i64 560
  %80 = load ptr, ptr %79, align 8, !tbaa !11
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.critedge35
  %.044 = phi i32 [ %86, %.critedge35 ], [ 0, %.lr.ph.preheader ]
  %.01843 = phi ptr [ %85, %.critedge35 ], [ %80, %.lr.ph.preheader ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #6
  %81 = load double, ptr %.01843, align 8, !tbaa !5
  %82 = fptrunc double %81 to float
  store float %82, ptr %4, align 4, !tbaa !9
  %83 = call i64 @fwrite(ptr noundef nonnull %4, i64 noundef 4, i64 noundef 1, ptr noundef %spec.select)
  %.not30 = icmp eq i64 %83, 1
  br i1 %.not30, label %.critedge35, label %84

84:                                               ; preds = %.lr.ph
  tail call void (ptr, ...) @_Z6RNFailPKcz(ptr noundef nonnull @.str.54)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  br label %.loopexit

.critedge35:                                      ; preds = %.lr.ph
  %85 = getelementptr inbounds i8, ptr %.01843, i64 8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #6
  %86 = add nuw nsw i32 %.044, 1
  %87 = load i32, ptr %77, align 4
  %.not31 = icmp slt i32 %86, %87
  br i1 %.not31, label %.lr.ph, label %.loopexit, !llvm.loop !20

.loopexit:                                        ; preds = %.critedge35, %84, %.critedge.15, %16, %8
  %.8 = phi i32 [ 0, %8 ], [ 0, %16 ], [ 0, %84 ], [ %78, %.critedge.15 ], [ %87, %.critedge35 ]
  ret i32 %.8
}

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint mustprogress 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 = { inlinehint 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 #3 = { "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 = { 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 #6 = { 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}
!11 = !{!12, !18, i64 560}
!12 = !{!"_ZTS6R3Grid", !13, i64 0, !13, i64 272, !6, i64 544, !6, i64 552, !18, i64 560, !7, i64 568, !19, i64 580, !19, i64 584, !19, i64 588}
!13 = !{!"_ZTS8R3Affine", !14, i64 0, !15, i64 8, !15, i64 136, !16, i64 264}
!14 = !{!"_ZTS16R3Transformation"}
!15 = !{!"_ZTS8R4Matrix", !7, i64 0}
!16 = !{!"_ZTS7RNFlags", !17, i64 0}
!17 = !{!"long", !7, i64 0}
!18 = !{!"any pointer", !7, i64 0}
!19 = !{!"int", !7, i64 0}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass