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

; 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.R3Box = type { %class.R3Solid, %class.R3Point, %class.R3Point }
%class.R3Solid = type { %class.R3Shape }
%class.R3Shape = type { ptr }
%class.R3Point = type { [3 x double] }
%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 }

@.str.141 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.142 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.143 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.144 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.145 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.146 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.147 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.148 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.149 = external hidden unnamed_addr constant [6 x i8], align 1

declare i32 @__gxx_personality_v0(...)

; 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 uwtable
declare dso_local noundef double @_ZNK6R3Grid9GridValueEiii(ptr noundef nonnull align 8 dereferenceable(592), i32 noundef, i32 noundef, i32 noundef) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592)) #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK6R3Grid8WorldBoxEv(ptr dead_on_unwind noalias writable sret(%class.R3Box) align 8, ptr noundef nonnull align 8 dereferenceable(592)) #1 align 2

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

; Function Attrs: nounwind
declare void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK6R3Grid11WriteDXFileEPKc(ptr noundef nonnull align 8 dereferenceable(592) %0, ptr noundef %1) #5 align 2 personality ptr @__gxx_personality_v0 {
  %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 %class.R3Box, align 8
  %9 = alloca double, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %15 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = call noalias ptr @fopen(ptr noundef %16, ptr noundef @.str.141)
  store ptr %17, ptr %6, align 8, !tbaa !5
  %18 = load ptr, ptr %6, align 8, !tbaa !5
  %19 = icmp ne ptr %18, null
  br i1 %19, label %22, label %20

20:                                               ; preds = %2
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  call void (ptr, ...) @_Z6RNFailPKcz(ptr noundef @.str.142, ptr noundef %21)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %136

22:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 56, ptr %8) #6
  call void @_ZNK6R3Grid8WorldBoxEv(ptr dead_on_unwind writable sret(%class.R3Box) align 8 %8, ptr noundef nonnull align 8 dereferenceable(592) %15)
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %23 = invoke noundef double @_ZNK6R3Grid22GridToWorldScaleFactorEv(ptr noundef nonnull align 8 dereferenceable(592) %15)
          to label %24 unwind label %76

24:                                               ; preds = %22
  store double %23, ptr %9, align 8, !tbaa !9
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = invoke noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %15)
          to label %27 unwind label %76

27:                                               ; preds = %24
  %28 = invoke noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %15)
          to label %29 unwind label %76

29:                                               ; preds = %27
  %30 = invoke noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %15)
          to label %31 unwind label %76

31:                                               ; preds = %29
  %32 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef @.str.143, i32 noundef %26, i32 noundef %28, i32 noundef %30) #6
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %8, i32 noundef 0)
          to label %35 unwind label %76

35:                                               ; preds = %31
  %36 = invoke noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %34, i32 noundef 0)
          to label %37 unwind label %76

37:                                               ; preds = %35
  %38 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %8, i32 noundef 0)
          to label %39 unwind label %76

39:                                               ; preds = %37
  %40 = invoke noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %38, i32 noundef 1)
          to label %41 unwind label %76

41:                                               ; preds = %39
  %42 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %8, i32 noundef 0)
          to label %43 unwind label %76

43:                                               ; preds = %41
  %44 = invoke noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %42, i32 noundef 2)
          to label %45 unwind label %76

45:                                               ; preds = %43
  %46 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %33, ptr noundef @.str.144, double noundef %36, double noundef %40, double noundef %44) #6
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = load double, ptr %9, align 8, !tbaa !9
  %49 = load double, ptr %9, align 8, !tbaa !9
  %50 = load double, ptr %9, align 8, !tbaa !9
  %51 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %47, ptr noundef @.str.145, double noundef %48, double noundef %49, double noundef %50) #6
  %52 = load ptr, ptr %6, align 8, !tbaa !5
  %53 = invoke noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %15)
          to label %54 unwind label %76

54:                                               ; preds = %45
  %55 = invoke noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %15)
          to label %56 unwind label %76

56:                                               ; preds = %54
  %57 = invoke noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %15)
          to label %58 unwind label %76

58:                                               ; preds = %56
  %59 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %52, ptr noundef @.str.146, i32 noundef %53, i32 noundef %55, i32 noundef %57) #6
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  %61 = invoke noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %15)
          to label %62 unwind label %76

62:                                               ; preds = %58
  %63 = invoke noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %15)
          to label %64 unwind label %76

64:                                               ; preds = %62
  %65 = mul nsw i32 %61, %63
  %66 = invoke noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %15)
          to label %67 unwind label %76

67:                                               ; preds = %64
  %68 = mul nsw i32 %65, %66
  %69 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %60, ptr noundef @.str.147, i32 noundef %68) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 0, ptr %12, align 4, !tbaa !11
  br label %70

70:                                               ; preds = %123, %67
  %71 = load i32, ptr %12, align 4, !tbaa !11
  %72 = invoke noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %15)
          to label %73 unwind label %80

73:                                               ; preds = %70
  %74 = icmp slt i32 %71, %72
  br i1 %74, label %84, label %75

75:                                               ; preds = %73
  store i32 2, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %127

76:                                               ; preds = %127, %64, %62, %58, %56, %54, %45, %43, %41, %39, %37, %35, %31, %29, %27, %24, %22
  %77 = landingpad { ptr, i32 }
          cleanup
  %78 = extractvalue { ptr, i32 } %77, 0
  store ptr %78, ptr %10, align 8
  %79 = extractvalue { ptr, i32 } %77, 1
  store i32 %79, ptr %11, align 4
  br label %135

80:                                               ; preds = %70
  %81 = landingpad { ptr, i32 }
          cleanup
  %82 = extractvalue { ptr, i32 } %81, 0
  store ptr %82, ptr %10, align 8
  %83 = extractvalue { ptr, i32 } %81, 1
  store i32 %83, ptr %11, align 4
  br label %126

84:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 0, ptr %13, align 4, !tbaa !11
  br label %85

85:                                               ; preds = %118, %84
  %86 = load i32, ptr %13, align 4, !tbaa !11
  %87 = invoke noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %15)
          to label %88 unwind label %91

88:                                               ; preds = %85
  %89 = icmp slt i32 %86, %87
  br i1 %89, label %95, label %90

90:                                               ; preds = %88
  store i32 5, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %122

91:                                               ; preds = %85
  %92 = landingpad { ptr, i32 }
          cleanup
  %93 = extractvalue { ptr, i32 } %92, 0
  store ptr %93, ptr %10, align 8
  %94 = extractvalue { ptr, i32 } %92, 1
  store i32 %94, ptr %11, align 4
  br label %121

95:                                               ; preds = %88
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !11
  br label %96

96:                                               ; preds = %114, %95
  %97 = load i32, ptr %14, align 4, !tbaa !11
  %98 = invoke noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %15)
          to label %99 unwind label %102

99:                                               ; preds = %96
  %100 = icmp slt i32 %97, %98
  br i1 %100, label %106, label %101

101:                                              ; preds = %99
  store i32 8, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %117

102:                                              ; preds = %106, %96
  %103 = landingpad { ptr, i32 }
          cleanup
  %104 = extractvalue { ptr, i32 } %103, 0
  store ptr %104, ptr %10, align 8
  %105 = extractvalue { ptr, i32 } %103, 1
  store i32 %105, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %121

106:                                              ; preds = %99
  %107 = load ptr, ptr %6, align 8, !tbaa !5
  %108 = load i32, ptr %12, align 4, !tbaa !11
  %109 = load i32, ptr %13, align 4, !tbaa !11
  %110 = load i32, ptr %14, align 4, !tbaa !11
  %111 = invoke noundef double @_ZNK6R3Grid9GridValueEiii(ptr noundef nonnull align 8 dereferenceable(592) %15, i32 noundef %108, i32 noundef %109, i32 noundef %110)
          to label %112 unwind label %102

112:                                              ; preds = %106
  %113 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %107, ptr noundef @.str.148, double noundef %111) #6
  br label %114

114:                                              ; preds = %112
  %115 = load i32, ptr %14, align 4, !tbaa !11
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr %14, align 4, !tbaa !11
  br label %96, !llvm.loop !13

117:                                              ; preds = %101
  br label %118

118:                                              ; preds = %117
  %119 = load i32, ptr %13, align 4, !tbaa !11
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %13, align 4, !tbaa !11
  br label %85, !llvm.loop !15

121:                                              ; preds = %102, %91
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %126

122:                                              ; preds = %90
  br label %123

123:                                              ; preds = %122
  %124 = load i32, ptr %12, align 4, !tbaa !11
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %12, align 4, !tbaa !11
  br label %70, !llvm.loop !16

126:                                              ; preds = %121, %80
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %135

127:                                              ; preds = %75
  %128 = load ptr, ptr %6, align 8, !tbaa !5
  %129 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %128, ptr noundef @.str.149) #6
  %130 = load ptr, ptr %6, align 8, !tbaa !5
  %131 = invoke i32 @fclose(ptr noundef %130)
          to label %132 unwind label %76

132:                                              ; preds = %127
  %133 = getelementptr inbounds %class.R3Grid, ptr %15, i32 0, i32 8
  %134 = load i32, ptr %133, align 4, !tbaa !17
  store i32 %134, ptr %3, align 4
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %8) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr %8) #6
  br label %136

135:                                              ; preds = %126, %76
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %8) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %138

136:                                              ; preds = %132, %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  %137 = load i32, ptr %3, align 4
  ret i32 %137

138:                                              ; preds = %135
  %139 = load ptr, ptr %10, align 8
  %140 = load i32, ptr %11, align 4
  %141 = insertvalue { ptr, i32 } poison, ptr %139, 0
  %142 = insertvalue { ptr, i32 } %141, i32 %140, 1
  resume { ptr, i32 } %142
}

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

declare i32 @fclose(ptr noundef) #4

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK6R3Grid22GridToWorldScaleFactorEv(ptr noundef nonnull align 8 dereferenceable(592)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56), i32 noundef) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #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 = { "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 = { 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 = !{!"double", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = !{!18, !12, i64 588}
!18 = !{!"_ZTS6R3Grid", !19, i64 0, !19, i64 272, !10, i64 544, !10, i64 552, !6, i64 560, !7, i64 568, !12, i64 580, !12, i64 584, !12, 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}


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

%class.R3Box = type { %class.R3Solid, %class.R3Point, %class.R3Point }
%class.R3Solid = type { %class.R3Shape }
%class.R3Shape = type { ptr }
%class.R3Point = type { [3 x double] }

@.str.141 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.142 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.143 = external hidden unnamed_addr constant [46 x i8], align 1
@.str.144 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.145 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.146 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.147 = external hidden unnamed_addr constant [64 x i8], align 1
@.str.148 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.149 = external hidden unnamed_addr constant [6 x i8], align 1

declare i32 @__gxx_personality_v0(...)

; 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 uwtable
declare dso_local noundef double @_ZNK6R3Grid9GridValueEiii(ptr noundef nonnull align 8 dereferenceable(592), i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZNK6R3Grid8WorldBoxEv(ptr dead_on_unwind noalias writable sret(%class.R3Box) align 8, ptr noundef nonnull align 8 dereferenceable(592)) local_unnamed_addr #1 align 2

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

; Function Attrs: nounwind
declare void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK6R3Grid11WriteDXFileEPKc(ptr noundef nonnull align 8 dereferenceable(592) %0, ptr noundef %1) local_unnamed_addr #6 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %class.R3Box, align 8
  %4 = tail call noalias ptr @fopen(ptr noundef %1, ptr noundef nonnull @.str.141)
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %5, label %6

5:                                                ; preds = %2
  tail call void (ptr, ...) @_Z6RNFailPKcz(ptr noundef nonnull @.str.142, ptr noundef %1)
  br label %60

6:                                                ; preds = %2
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %3) #7
  call void @_ZNK6R3Grid8WorldBoxEv(ptr dead_on_unwind nonnull writable sret(%class.R3Box) align 8 %3, ptr noundef nonnull align 8 dereferenceable(592) %0)
  %7 = call noundef double @_ZNK6R3Grid22GridToWorldScaleFactorEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %8 = call noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %9 = call noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %10 = call noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %11 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %4, ptr noundef nonnull @.str.143, i32 noundef %8, i32 noundef %9, i32 noundef %10) #7
  %12 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %3, i32 noundef 0)
  %13 = invoke noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %12, i32 noundef 0)
          to label %14 unwind label %41

14:                                               ; preds = %6
  %15 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %3, i32 noundef 0)
  %16 = invoke noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %15, i32 noundef 1)
          to label %17 unwind label %41

17:                                               ; preds = %14
  %18 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56) %3, i32 noundef 0)
  %19 = invoke noundef double @_ZNK7R3PointixEi(ptr noundef nonnull align 8 dereferenceable(24) %18, i32 noundef 2)
          to label %20 unwind label %41

20:                                               ; preds = %17
  %21 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %4, ptr noundef nonnull @.str.144, double noundef %13, double noundef %16, double noundef %19) #7
  %22 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %4, ptr noundef nonnull @.str.145, double noundef %7, double noundef %7, double noundef %7) #7
  %23 = call noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %24 = call noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %25 = call noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %26 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %4, ptr noundef nonnull @.str.146, i32 noundef %23, i32 noundef %24, i32 noundef %25) #7
  %27 = call noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %28 = call noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %29 = mul nsw i32 %28, %27
  %30 = call noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %31 = mul nsw i32 %29, %30
  %32 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %4, ptr noundef nonnull @.str.147, i32 noundef %31) #7
  %33 = call noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %34 = icmp sgt i32 %33, 0
  br i1 %34, label %.preheader33, label %._crit_edge38

.preheader33:                                     ; preds = %20, %._crit_edge36
  %.02737 = phi i32 [ %45, %._crit_edge36 ], [ 0, %20 ]
  %35 = call noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %36 = icmp sgt i32 %35, 0
  br i1 %36, label %.preheader, label %._crit_edge36

._crit_edge38:                                    ; preds = %._crit_edge36, %20
  %37 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %4, ptr noundef nonnull @.str.149) #7
  %38 = call i32 @fclose(ptr noundef nonnull %4)
  %39 = getelementptr inbounds i8, ptr %0, i64 588
  %40 = load i32, ptr %39, align 4, !tbaa !5
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %3) #7
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %3) #7
  br label %60

41:                                               ; preds = %17, %14, %6
  %42 = landingpad { ptr, i32 }
          cleanup
  br label %59

.preheader:                                       ; preds = %.preheader33, %._crit_edge
  %.02635 = phi i32 [ %48, %._crit_edge ], [ 0, %.preheader33 ]
  %43 = call noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %44 = icmp sgt i32 %43, 0
  br i1 %44, label %.lr.ph, label %._crit_edge

._crit_edge36:                                    ; preds = %._crit_edge, %.preheader33
  %45 = add nuw nsw i32 %.02737, 1
  %46 = call noundef i32 @_ZNK6R3Grid11XResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %47 = icmp slt i32 %45, %46
  br i1 %47, label %.preheader33, label %._crit_edge38, !llvm.loop !17

._crit_edge:                                      ; preds = %54, %.preheader
  %48 = add nuw nsw i32 %.02635, 1
  %49 = call noundef i32 @_ZNK6R3Grid11YResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %50 = icmp slt i32 %48, %49
  br i1 %50, label %.preheader, label %._crit_edge36, !llvm.loop !19

51:                                               ; preds = %.lr.ph
  %52 = landingpad { ptr, i32 }
          cleanup
  br label %59

.lr.ph:                                           ; preds = %.preheader, %54
  %.034 = phi i32 [ %56, %54 ], [ 0, %.preheader ]
  %53 = invoke noundef double @_ZNK6R3Grid9GridValueEiii(ptr noundef nonnull align 8 dereferenceable(592) %0, i32 noundef %.02737, i32 noundef %.02635, i32 noundef %.034)
          to label %54 unwind label %51

54:                                               ; preds = %.lr.ph
  %55 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %4, ptr noundef nonnull @.str.148, double noundef %53) #7
  %56 = add nuw nsw i32 %.034, 1
  %57 = call noundef i32 @_ZNK6R3Grid11ZResolutionEv(ptr noundef nonnull align 8 dereferenceable(592) %0)
  %58 = icmp slt i32 %56, %57
  br i1 %58, label %.lr.ph, label %._crit_edge, !llvm.loop !20

59:                                               ; preds = %51, %41
  %.pn = phi { ptr, i32 } [ %52, %51 ], [ %42, %41 ]
  call void @_ZN7R3SolidD2Ev(ptr noundef nonnull align 8 dereferenceable(56) %3) #7
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %3) #7
  resume { ptr, i32 } %.pn

60:                                               ; preds = %._crit_edge38, %5
  %.030 = phi i32 [ %40, %._crit_edge38 ], [ 0, %5 ]
  ret i32 %.030
}

; 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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK6R3Grid22GridToWorldScaleFactorEv(ptr noundef nonnull align 8 dereferenceable(592)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK5R3BoxixEi(ptr noundef nonnull align 8 dereferenceable(56), i32 noundef) local_unnamed_addr #2 align 2

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


; Effective O3 passes: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass