; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R3Graphics/R3Scene.ll (ZNK7R3Scene18WritePrincetonFileEPKc)

; 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.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 }
%class.R3Vector = type { [3 x double] }
%class.R3Scene = type { ptr, %class.RNArray, %class.RNArray.0, %class.RNArray.1, %class.RNArray.2, %class.RNArray.3, %class.RNArray.4, %class.RNSymbolTable, %class.R3Viewer, %class.RNRgb, %class.RNRgb, ptr, ptr, ptr }
%class.RNArray = type { %class.RNVArray }
%class.RNVArray = type { ptr, i32, i32 }
%class.RNArray.0 = type { %class.RNVArray }
%class.RNArray.1 = type { %class.RNVArray }
%class.RNArray.2 = type { %class.RNVArray }
%class.RNArray.3 = type { %class.RNVArray }
%class.RNArray.4 = type { %class.RNVArray }
%class.RNSymbolTable = type { %class.RNMap }
%class.RNMap = type { ptr }
%class.R3Viewer = type { ptr, %class.R3Camera, %class.R2Viewport }
%class.R3Camera = type { %class.R3CoordSystem, double, double, double, double, double, ptr }
%class.R3CoordSystem = type { %class.R3Point, %class.R3Triad }
%class.R3Point = type { [3 x double] }
%class.R3Triad = type { [3 x %class.R3Vector] }
%class.R2Viewport = type { i32, i32, i32, i32 }
%class.RNRgb = type { [3 x double] }

@R3identity_affine = external global %class.R3Affine, align 8
@stderr = external global ptr, align 8
@.str.43 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.99 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.100 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.101 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.102 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.103 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.104 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.105 = external hidden unnamed_addr constant [1 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 uwtable
declare dso_local noundef i32 @_ZNK7R3Scene10NMaterialsEv(ptr noundef nonnull align 8 dereferenceable(352)) #1 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK7R3Scene7NLightsEv(ptr noundef nonnull align 8 dereferenceable(352)) #1 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK7R3Scene9NTexturesEv(ptr noundef nonnull align 8 dereferenceable(352)) #1 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK7R3Scene17NReferencedScenesEv(ptr noundef nonnull align 8 dereferenceable(352)) #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7R3Scene16RemoveReferencesEv(ptr noundef nonnull align 8 dereferenceable(352)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK7R3Scene7AmbientEv(ptr noundef nonnull align 8 dereferenceable(352)) #3 align 2

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(144) ptr @_ZNK7R3Scene6CameraEv(ptr noundef nonnull align 8 dereferenceable(352)) #1 align 2

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

26:                                               ; preds = %2
  %27 = load ptr, ptr @stderr, align 8, !tbaa !5
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %27, ptr noundef @.str.43, ptr noundef %28) #7
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %184

30:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  store ptr @.str.100, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %31

31:                                               ; preds = %46, %30
  %32 = load i32, ptr %10, align 4, !tbaa !9
  %33 = call noundef i32 @_ZNK7R3Scene17NReferencedScenesEv(ptr noundef nonnull align 8 dereferenceable(352) %22)
  %34 = icmp slt i32 %32, %33
  br i1 %34, label %36, label %35

35:                                               ; preds = %31
  store i32 2, ptr %7, align 4
  br label %49

36:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %37 = load i32, ptr %10, align 4, !tbaa !9
  %38 = call noundef ptr @_ZNK7R3Scene15ReferencedSceneEi(ptr noundef nonnull align 8 dereferenceable(352) %22, i32 noundef %37)
  store ptr %38, ptr %11, align 8, !tbaa !5
  %39 = load ptr, ptr %11, align 8, !tbaa !5
  %40 = call noundef ptr @_ZNK7R3Scene8FilenameEv(ptr noundef nonnull align 8 dereferenceable(352) %39)
  %41 = icmp ne ptr %40, null
  br i1 %41, label %42, label %43

42:                                               ; preds = %36
  store i32 4, ptr %7, align 4
  br label %44

43:                                               ; preds = %36
  store i32 1, ptr %9, align 4, !tbaa !9
  store i32 2, ptr %7, align 4
  br label %44

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

46:                                               ; preds = %44
  %47 = load i32, ptr %10, align 4, !tbaa !9
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %10, align 4, !tbaa !9
  br label %31, !llvm.loop !11

49:                                               ; preds = %44, %35
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %50

50:                                               ; preds = %49
  %51 = load i32, ptr %9, align 4, !tbaa !9
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %53, label %54

53:                                               ; preds = %50
  call void @_ZN7R3Scene16RemoveReferencesEv(ptr noundef nonnull align 8 dereferenceable(352) %22)
  br label %54

54:                                               ; preds = %53, %50
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK7R3Scene10BackgroundEv(ptr noundef nonnull align 8 dereferenceable(352) %22)
  %57 = call noundef double @_ZNK5RNRgb1REv(ptr noundef nonnull align 8 dereferenceable(24) %56)
  %58 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK7R3Scene10BackgroundEv(ptr noundef nonnull align 8 dereferenceable(352) %22)
  %59 = call noundef double @_ZNK5RNRgb1GEv(ptr noundef nonnull align 8 dereferenceable(24) %58)
  %60 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK7R3Scene10BackgroundEv(ptr noundef nonnull align 8 dereferenceable(352) %22)
  %61 = call noundef double @_ZNK5RNRgb1BEv(ptr noundef nonnull align 8 dereferenceable(24) %60)
  %62 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %55, ptr noundef @.str.101, double noundef %57, double noundef %59, double noundef %61) #7
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK7R3Scene7AmbientEv(ptr noundef nonnull align 8 dereferenceable(352) %22)
  %65 = call noundef double @_ZNK5RNRgb1REv(ptr noundef nonnull align 8 dereferenceable(24) %64)
  %66 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK7R3Scene7AmbientEv(ptr noundef nonnull align 8 dereferenceable(352) %22)
  %67 = call noundef double @_ZNK5RNRgb1GEv(ptr noundef nonnull align 8 dereferenceable(24) %66)
  %68 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK7R3Scene7AmbientEv(ptr noundef nonnull align 8 dereferenceable(352) %22)
  %69 = call noundef double @_ZNK5RNRgb1BEv(ptr noundef nonnull align 8 dereferenceable(24) %68)
  %70 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %63, ptr noundef @.str.102, double noundef %65, double noundef %67, double noundef %69) #7
  %71 = load ptr, ptr %6, align 8, !tbaa !5
  %72 = call noundef nonnull align 8 dereferenceable(144) ptr @_ZNK7R3Scene6CameraEv(ptr noundef nonnull align 8 dereferenceable(352) %22)
  %73 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK8R3Camera6OriginEv(ptr noundef nonnull align 8 dereferenceable(144) %72)
  %74 = call noundef double @_ZNK7R3Point1XEv(ptr noundef nonnull align 8 dereferenceable(24) %73)
  %75 = call noundef nonnull align 8 dereferenceable(144) ptr @_ZNK7R3Scene6CameraEv(ptr noundef nonnull align 8 dereferenceable(352) %22)
  %76 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK8R3Camera6OriginEv(ptr noundef nonnull align 8 dereferenceable(144) %75)
  %77 = call noundef double @_ZNK7R3Point1YEv(ptr noundef nonnull align 8 dereferenceable(24) %76)
  %78 = call noundef nonnull align 8 dereferenceable(144) ptr @_ZNK7R3Scene6CameraEv(ptr noundef nonnull align 8 dereferenceable(352) %22)
  %79 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK8R3Camera6OriginEv(ptr noundef nonnull align 8 dereferenceable(144) %78)
  %80 = call noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %79)
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #7
  %81 = call noundef nonnull align 8 dereferenceable(144) ptr @_ZNK7R3Scene6CameraEv(ptr noundef nonnull align 8 dereferenceable(352) %22)
  call void @_ZNK8R3Camera7TowardsEv(ptr dead_on_unwind writable sret(%class.R3Vector) align 8 %12, ptr noundef nonnull align 8 dereferenceable(144) %81)
  %82 = call noundef double @_ZNK8R3Vector1XEv(ptr noundef nonnull align 8 dereferenceable(24) %12)
  call void @llvm.lifetime.start.p0(i64 24, ptr %13) #7
  %83 = call noundef nonnull align 8 dereferenceable(144) ptr @_ZNK7R3Scene6CameraEv(ptr noundef nonnull align 8 dereferenceable(352) %22)
  call void @_ZNK8R3Camera7TowardsEv(ptr dead_on_unwind writable sret(%class.R3Vector) align 8 %13, ptr noundef nonnull align 8 dereferenceable(144) %83)
  %84 = call noundef double @_ZNK8R3Vector1YEv(ptr noundef nonnull align 8 dereferenceable(24) %13)
  call void @llvm.lifetime.start.p0(i64 24, ptr %14) #7
  %85 = call noundef nonnull align 8 dereferenceable(144) ptr @_ZNK7R3Scene6CameraEv(ptr noundef nonnull align 8 dereferenceable(352) %22)
  call void @_ZNK8R3Camera7TowardsEv(ptr dead_on_unwind writable sret(%class.R3Vector) align 8 %14, ptr noundef nonnull align 8 dereferenceable(144) %85)
  %86 = call noundef double @_ZNK8R3Vector1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %14)
  %87 = call noundef nonnull align 8 dereferenceable(144) ptr @_ZNK7R3Scene6CameraEv(ptr noundef nonnull align 8 dereferenceable(352) %22)
  %88 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK8R3Camera2UpEv(ptr noundef nonnull align 8 dereferenceable(144) %87)
  %89 = call noundef double @_ZNK8R3Vector1XEv(ptr noundef nonnull align 8 dereferenceable(24) %88)
  %90 = call noundef nonnull align 8 dereferenceable(144) ptr @_ZNK7R3Scene6CameraEv(ptr noundef nonnull align 8 dereferenceable(352) %22)
  %91 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK8R3Camera2UpEv(ptr noundef nonnull align 8 dereferenceable(144) %90)
  %92 = call noundef double @_ZNK8R3Vector1YEv(ptr noundef nonnull align 8 dereferenceable(24) %91)
  %93 = call noundef nonnull align 8 dereferenceable(144) ptr @_ZNK7R3Scene6CameraEv(ptr noundef nonnull align 8 dereferenceable(352) %22)
  %94 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK8R3Camera2UpEv(ptr noundef nonnull align 8 dereferenceable(144) %93)
  %95 = call noundef double @_ZNK8R3Vector1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %94)
  %96 = call noundef nonnull align 8 dereferenceable(144) ptr @_ZNK7R3Scene6CameraEv(ptr noundef nonnull align 8 dereferenceable(352) %22)
  %97 = call noundef double @_ZNK8R3Camera4XFOVEv(ptr noundef nonnull align 8 dereferenceable(144) %96)
  %98 = call noundef nonnull align 8 dereferenceable(144) ptr @_ZNK7R3Scene6CameraEv(ptr noundef nonnull align 8 dereferenceable(352) %22)
  %99 = call noundef double @_ZNK8R3Camera4NearEv(ptr noundef nonnull align 8 dereferenceable(144) %98)
  %100 = call noundef nonnull align 8 dereferenceable(144) ptr @_ZNK7R3Scene6CameraEv(ptr noundef nonnull align 8 dereferenceable(352) %22)
  %101 = call noundef double @_ZNK8R3Camera3FarEv(ptr noundef nonnull align 8 dereferenceable(144) %100)
  %102 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %71, ptr noundef @.str.103, double noundef %74, double noundef %77, double noundef %80, double noundef %82, double noundef %84, double noundef %86, double noundef %89, double noundef %92, double noundef %95, double noundef %97, double noundef %99, double noundef %101) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  store i32 0, ptr %15, align 4, !tbaa !9
  br label %103

103:                                              ; preds = %120, %54
  %104 = load i32, ptr %15, align 4, !tbaa !9
  %105 = call noundef i32 @_ZNK7R3Scene9NTexturesEv(ptr noundef nonnull align 8 dereferenceable(352) %22)
  %106 = icmp slt i32 %104, %105
  br i1 %106, label %108, label %107

107:                                              ; preds = %103
  store i32 5, ptr %7, align 4
  br label %123

108:                                              ; preds = %103
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  %109 = load i32, ptr %15, align 4, !tbaa !9
  %110 = call noundef ptr @_ZNK7R3Scene7TextureEi(ptr noundef nonnull align 8 dereferenceable(352) %22, i32 noundef %109)
  store ptr %110, ptr %16, align 8, !tbaa !5
  %111 = load ptr, ptr %16, align 8, !tbaa !5
  %112 = load ptr, ptr %8, align 8, !tbaa !5
  %113 = call noundef i32 @_ZL17CreateTextureFilePK7R3ScenePK9R2TexturePKc(ptr noundef %22, ptr noundef %111, ptr noundef %112)
  %114 = icmp ne i32 %113, 0
  br i1 %114, label %116, label %115

115:                                              ; preds = %108
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %117

116:                                              ; preds = %108
  store i32 0, ptr %7, align 4
  br label %117

117:                                              ; preds = %116, %115
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  %118 = load i32, ptr %7, align 4
  switch i32 %118, label %123 [
    i32 0, label %119
  ]

119:                                              ; preds = %117
  br label %120

120:                                              ; preds = %119
  %121 = load i32, ptr %15, align 4, !tbaa !9
  %122 = add nsw i32 %121, 1
  store i32 %122, ptr %15, align 4, !tbaa !9
  br label %103, !llvm.loop !13

123:                                              ; preds = %117, %107
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  %124 = load i32, ptr %7, align 4
  switch i32 %124, label %183 [
    i32 5, label %125
  ]

125:                                              ; preds = %123
  %126 = load ptr, ptr %6, align 8, !tbaa !5
  %127 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %126, ptr noundef @.str.104) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #7
  store i32 0, ptr %17, align 4, !tbaa !9
  br label %128

128:                                              ; preds = %145, %125
  %129 = load i32, ptr %17, align 4, !tbaa !9
  %130 = call noundef i32 @_ZNK7R3Scene7NLightsEv(ptr noundef nonnull align 8 dereferenceable(352) %22)
  %131 = icmp slt i32 %129, %130
  br i1 %131, label %133, label %132

132:                                              ; preds = %128
  store i32 8, ptr %7, align 4
  br label %148

133:                                              ; preds = %128
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %134 = load i32, ptr %17, align 4, !tbaa !9
  %135 = call noundef ptr @_ZNK7R3Scene5LightEi(ptr noundef nonnull align 8 dereferenceable(352) %22, i32 noundef %134)
  store ptr %135, ptr %18, align 8, !tbaa !5
  %136 = load ptr, ptr %18, align 8, !tbaa !5
  %137 = load ptr, ptr %6, align 8, !tbaa !5
  %138 = call noundef i32 @_ZL19WritePrincetonLightPK7R3ScenePK7R3LightP8_IO_FILE(ptr noundef %22, ptr noundef %136, ptr noundef %137)
  %139 = icmp ne i32 %138, 0
  br i1 %139, label %141, label %140

140:                                              ; preds = %133
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %142

141:                                              ; preds = %133
  store i32 0, ptr %7, align 4
  br label %142

142:                                              ; preds = %141, %140
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  %143 = load i32, ptr %7, align 4
  switch i32 %143, label %148 [
    i32 0, label %144
  ]

144:                                              ; preds = %142
  br label %145

145:                                              ; preds = %144
  %146 = load i32, ptr %17, align 4, !tbaa !9
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %17, align 4, !tbaa !9
  br label %128, !llvm.loop !14

148:                                              ; preds = %142, %132
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #7
  %149 = load i32, ptr %7, align 4
  switch i32 %149, label %183 [
    i32 8, label %150
  ]

150:                                              ; preds = %148
  %151 = load ptr, ptr %6, align 8, !tbaa !5
  %152 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %151, ptr noundef @.str.104) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #7
  store i32 0, ptr %19, align 4, !tbaa !9
  br label %153

153:                                              ; preds = %170, %150
  %154 = load i32, ptr %19, align 4, !tbaa !9
  %155 = call noundef i32 @_ZNK7R3Scene10NMaterialsEv(ptr noundef nonnull align 8 dereferenceable(352) %22)
  %156 = icmp slt i32 %154, %155
  br i1 %156, label %158, label %157

157:                                              ; preds = %153
  store i32 11, ptr %7, align 4
  br label %173

158:                                              ; preds = %153
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %159 = load i32, ptr %19, align 4, !tbaa !9
  %160 = call noundef ptr @_ZNK7R3Scene8MaterialEi(ptr noundef nonnull align 8 dereferenceable(352) %22, i32 noundef %159)
  store ptr %160, ptr %20, align 8, !tbaa !5
  %161 = load ptr, ptr %20, align 8, !tbaa !5
  %162 = load ptr, ptr %6, align 8, !tbaa !5
  %163 = call noundef i32 @_ZL22WritePrincetonMaterialPK7R3ScenePK10R3MaterialP8_IO_FILE(ptr noundef %22, ptr noundef %161, ptr noundef %162)
  %164 = icmp ne i32 %163, 0
  br i1 %164, label %166, label %165

165:                                              ; preds = %158
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %167

166:                                              ; preds = %158
  store i32 0, ptr %7, align 4
  br label %167

167:                                              ; preds = %166, %165
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  %168 = load i32, ptr %7, align 4
  switch i32 %168, label %173 [
    i32 0, label %169
  ]

169:                                              ; preds = %167
  br label %170

170:                                              ; preds = %169
  %171 = load i32, ptr %19, align 4, !tbaa !9
  %172 = add nsw i32 %171, 1
  store i32 %172, ptr %19, align 4, !tbaa !9
  br label %153, !llvm.loop !15

173:                                              ; preds = %167, %157
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #7
  %174 = load i32, ptr %7, align 4
  switch i32 %174, label %183 [
    i32 11, label %175
  ]

175:                                              ; preds = %173
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #7
  %176 = getelementptr inbounds %class.R3Scene, ptr %22, i32 0, i32 0
  %177 = load ptr, ptr %176, align 8, !tbaa !16
  %178 = load ptr, ptr %6, align 8, !tbaa !5
  %179 = call noundef i32 @_ZL18WritePrincetonNodePK7R3ScenePK11R3SceneNodeRK16R3TransformationP8_IO_FILEPKc(ptr noundef %22, ptr noundef %177, ptr noundef nonnull align 8 dereferenceable(8) @R3identity_affine, ptr noundef %178, ptr noundef @.str.105)
  store i32 %179, ptr %21, align 4, !tbaa !9
  %180 = load ptr, ptr %6, align 8, !tbaa !5
  %181 = call i32 @fclose(ptr noundef %180)
  %182 = load i32, ptr %21, align 4, !tbaa !9
  store i32 %182, ptr %3, align 4
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #7
  br label %183

183:                                              ; preds = %175, %173, %148, %123
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %184

184:                                              ; preds = %183, %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  %185 = load i32, ptr %3, align 4
  ret i32 %185
}

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

declare i32 @fclose(ptr noundef) #5

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK7R3Scene8FilenameEv(ptr noundef nonnull align 8 dereferenceable(352)) #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK7R3Scene10BackgroundEv(ptr noundef nonnull align 8 dereferenceable(352)) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK8R3Camera6OriginEv(ptr noundef nonnull align 8 dereferenceable(144)) #1 align 2

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

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

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK8R3Camera2UpEv(ptr noundef nonnull align 8 dereferenceable(144)) #1 align 2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL17CreateTextureFilePK7R3ScenePK9R2TexturePKc(ptr noundef, ptr noundef, ptr noundef) #6

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL19WritePrincetonLightPK7R3ScenePK7R3LightP8_IO_FILE(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL22WritePrincetonMaterialPK7R3ScenePK10R3MaterialP8_IO_FILE(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL18WritePrincetonNodePK7R3ScenePK11R3SceneNodeRK16R3TransformationP8_IO_FILEPKc(ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, ptr noundef) #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 = { 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 = { 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 #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 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 #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, !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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = !{!17, !6, i64 0}
!17 = !{!"_ZTS7R3Scene", !6, i64 0, !18, i64 8, !20, i64 24, !21, i64 40, !22, i64 56, !23, i64 72, !24, i64 88, !25, i64 104, !27, i64 112, !34, i64 280, !34, i64 304, !6, i64 328, !6, i64 336, !6, i64 344}
!18 = !{!"_ZTS7RNArrayIP11R3SceneNodeE", !19, i64 0}
!19 = !{!"_ZTS8RNVArray", !6, i64 0, !10, i64 8, !10, i64 12}
!20 = !{!"_ZTS7RNArrayIP7R3LightE", !19, i64 0}
!21 = !{!"_ZTS7RNArrayIP10R3MaterialE", !19, i64 0}
!22 = !{!"_ZTS7RNArrayIP6R3BrdfE", !19, i64 0}
!23 = !{!"_ZTS7RNArrayIP9R2TextureE", !19, i64 0}
!24 = !{!"_ZTS7RNArrayIP7R3SceneE", !19, i64 0}
!25 = !{!"_ZTS13RNSymbolTableIPKcE", !26, i64 0}
!26 = !{!"_ZTS5RNMapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKcE", !6, i64 0}
!27 = !{!"_ZTS8R3Viewer", !28, i64 8, !33, i64 152}
!28 = !{!"_ZTS8R3Camera", !29, i64 0, !32, i64 96, !32, i64 104, !32, i64 112, !32, i64 120, !32, i64 128, !6, i64 136}
!29 = !{!"_ZTS13R3CoordSystem", !30, i64 0, !31, i64 24}
!30 = !{!"_ZTS7R3Point", !7, i64 0}
!31 = !{!"_ZTS7R3Triad", !7, i64 0}
!32 = !{!"double", !7, i64 0}
!33 = !{!"_ZTS10R2Viewport", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12}
!34 = !{!"_ZTS5RNRgb", !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.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 }
%class.R3Vector = type { [3 x double] }

@R3identity_affine = external global %class.R3Affine, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str.43 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.99 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.100 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.101 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.102 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.103 = external hidden unnamed_addr constant [51 x i8], align 1
@.str.104 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.105 = external hidden unnamed_addr constant [1 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 uwtable
declare dso_local noundef i32 @_ZNK7R3Scene10NMaterialsEv(ptr noundef nonnull align 8 dereferenceable(352)) local_unnamed_addr #1 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK7R3Scene7NLightsEv(ptr noundef nonnull align 8 dereferenceable(352)) local_unnamed_addr #1 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK7R3Scene9NTexturesEv(ptr noundef nonnull align 8 dereferenceable(352)) local_unnamed_addr #1 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK7R3Scene17NReferencedScenesEv(ptr noundef nonnull align 8 dereferenceable(352)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN7R3Scene16RemoveReferencesEv(ptr noundef nonnull align 8 dereferenceable(352)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK7R3Scene7AmbientEv(ptr noundef nonnull align 8 dereferenceable(352)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK5RNRgb1REv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK5RNRgb1GEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK5RNRgb1BEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(144) ptr @_ZNK7R3Scene6CameraEv(ptr noundef nonnull align 8 dereferenceable(352)) local_unnamed_addr #1 align 2

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

.preheader:                                       ; preds = %2
  %7 = tail call noundef i32 @_ZNK7R3Scene17NReferencedScenesEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  %.not7176 = icmp sgt i32 %7, 0
  br i1 %.not7176, label %.lr.ph, label %.critedge73

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

11:                                               ; preds = %.lr.ph
  %12 = add nuw nsw i32 %.05677, 1
  %13 = tail call noundef i32 @_ZNK7R3Scene17NReferencedScenesEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  %.not71 = icmp slt i32 %12, %13
  br i1 %.not71, label %.lr.ph, label %.critedge73, !llvm.loop !9

.lr.ph:                                           ; preds = %.preheader, %11
  %.05677 = phi i32 [ %12, %11 ], [ 0, %.preheader ]
  %14 = tail call noundef ptr @_ZNK7R3Scene15ReferencedSceneEi(ptr noundef nonnull align 8 dereferenceable(352) %0, i32 noundef %.05677)
  %15 = tail call noundef ptr @_ZNK7R3Scene8FilenameEv(ptr noundef nonnull align 8 dereferenceable(352) %14)
  %.not59.not = icmp eq ptr %15, null
  br i1 %.not59.not, label %16, label %11

16:                                               ; preds = %.lr.ph
  tail call void @_ZN7R3Scene16RemoveReferencesEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  br label %.critedge73

.critedge73:                                      ; preds = %11, %.preheader, %16
  %17 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK7R3Scene10BackgroundEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  %18 = tail call noundef double @_ZNK5RNRgb1REv(ptr noundef nonnull align 8 dereferenceable(24) %17)
  %19 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK7R3Scene10BackgroundEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  %20 = tail call noundef double @_ZNK5RNRgb1GEv(ptr noundef nonnull align 8 dereferenceable(24) %19)
  %21 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK7R3Scene10BackgroundEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  %22 = tail call noundef double @_ZNK5RNRgb1BEv(ptr noundef nonnull align 8 dereferenceable(24) %21)
  %23 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %6, ptr noundef nonnull @.str.101, double noundef %18, double noundef %20, double noundef %22) #7
  %24 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK7R3Scene7AmbientEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  %25 = tail call noundef double @_ZNK5RNRgb1REv(ptr noundef nonnull align 8 dereferenceable(24) %24)
  %26 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK7R3Scene7AmbientEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  %27 = tail call noundef double @_ZNK5RNRgb1GEv(ptr noundef nonnull align 8 dereferenceable(24) %26)
  %28 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK7R3Scene7AmbientEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  %29 = tail call noundef double @_ZNK5RNRgb1BEv(ptr noundef nonnull align 8 dereferenceable(24) %28)
  %30 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %6, ptr noundef nonnull @.str.102, double noundef %25, double noundef %27, double noundef %29) #7
  %31 = tail call noundef nonnull align 8 dereferenceable(144) ptr @_ZNK7R3Scene6CameraEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  %32 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK8R3Camera6OriginEv(ptr noundef nonnull align 8 dereferenceable(144) %31)
  %33 = tail call noundef double @_ZNK7R3Point1XEv(ptr noundef nonnull align 8 dereferenceable(24) %32)
  %34 = tail call noundef nonnull align 8 dereferenceable(144) ptr @_ZNK7R3Scene6CameraEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  %35 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK8R3Camera6OriginEv(ptr noundef nonnull align 8 dereferenceable(144) %34)
  %36 = tail call noundef double @_ZNK7R3Point1YEv(ptr noundef nonnull align 8 dereferenceable(24) %35)
  %37 = tail call noundef nonnull align 8 dereferenceable(144) ptr @_ZNK7R3Scene6CameraEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  %38 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK8R3Camera6OriginEv(ptr noundef nonnull align 8 dereferenceable(144) %37)
  %39 = tail call noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %38)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #7
  %40 = tail call noundef nonnull align 8 dereferenceable(144) ptr @_ZNK7R3Scene6CameraEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  call void @_ZNK8R3Camera7TowardsEv(ptr dead_on_unwind nonnull writable sret(%class.R3Vector) align 8 %3, ptr noundef nonnull align 8 dereferenceable(144) %40)
  %41 = call noundef double @_ZNK8R3Vector1XEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #7
  %42 = call noundef nonnull align 8 dereferenceable(144) ptr @_ZNK7R3Scene6CameraEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  call void @_ZNK8R3Camera7TowardsEv(ptr dead_on_unwind nonnull writable sret(%class.R3Vector) align 8 %4, ptr noundef nonnull align 8 dereferenceable(144) %42)
  %43 = call noundef double @_ZNK8R3Vector1YEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #7
  %44 = call noundef nonnull align 8 dereferenceable(144) ptr @_ZNK7R3Scene6CameraEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  call void @_ZNK8R3Camera7TowardsEv(ptr dead_on_unwind nonnull writable sret(%class.R3Vector) align 8 %5, ptr noundef nonnull align 8 dereferenceable(144) %44)
  %45 = call noundef double @_ZNK8R3Vector1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %46 = call noundef nonnull align 8 dereferenceable(144) ptr @_ZNK7R3Scene6CameraEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  %47 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK8R3Camera2UpEv(ptr noundef nonnull align 8 dereferenceable(144) %46)
  %48 = call noundef double @_ZNK8R3Vector1XEv(ptr noundef nonnull align 8 dereferenceable(24) %47)
  %49 = call noundef nonnull align 8 dereferenceable(144) ptr @_ZNK7R3Scene6CameraEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  %50 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK8R3Camera2UpEv(ptr noundef nonnull align 8 dereferenceable(144) %49)
  %51 = call noundef double @_ZNK8R3Vector1YEv(ptr noundef nonnull align 8 dereferenceable(24) %50)
  %52 = call noundef nonnull align 8 dereferenceable(144) ptr @_ZNK7R3Scene6CameraEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  %53 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK8R3Camera2UpEv(ptr noundef nonnull align 8 dereferenceable(144) %52)
  %54 = call noundef double @_ZNK8R3Vector1ZEv(ptr noundef nonnull align 8 dereferenceable(24) %53)
  %55 = call noundef nonnull align 8 dereferenceable(144) ptr @_ZNK7R3Scene6CameraEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  %56 = call noundef double @_ZNK8R3Camera4XFOVEv(ptr noundef nonnull align 8 dereferenceable(144) %55)
  %57 = call noundef nonnull align 8 dereferenceable(144) ptr @_ZNK7R3Scene6CameraEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  %58 = call noundef double @_ZNK8R3Camera4NearEv(ptr noundef nonnull align 8 dereferenceable(144) %57)
  %59 = call noundef nonnull align 8 dereferenceable(144) ptr @_ZNK7R3Scene6CameraEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  %60 = call noundef double @_ZNK8R3Camera3FarEv(ptr noundef nonnull align 8 dereferenceable(144) %59)
  %61 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %6, ptr noundef nonnull @.str.103, double noundef %33, double noundef %36, double noundef %39, double noundef %41, double noundef %43, double noundef %45, double noundef %48, double noundef %51, double noundef %54, double noundef %56, double noundef %58, double noundef %60) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #7
  %62 = call noundef i32 @_ZNK7R3Scene9NTexturesEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  %.not6278 = icmp sgt i32 %62, 0
  br i1 %.not6278, label %.lr.ph80, label %.critedge

63:                                               ; preds = %.lr.ph80
  %64 = add nuw nsw i32 %.05779, 1
  %65 = call noundef i32 @_ZNK7R3Scene9NTexturesEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  %.not62 = icmp slt i32 %64, %65
  br i1 %.not62, label %.lr.ph80, label %.critedge, !llvm.loop !11

.lr.ph80:                                         ; preds = %.critedge73, %63
  %.05779 = phi i32 [ %64, %63 ], [ 0, %.critedge73 ]
  %66 = call noundef ptr @_ZNK7R3Scene7TextureEi(ptr noundef nonnull align 8 dereferenceable(352) %0, i32 noundef %.05779)
  %67 = call noundef i32 @_ZL17CreateTextureFilePK7R3ScenePK9R2TexturePKc(ptr noundef nonnull %0, ptr noundef %66, ptr noundef nonnull @.str.100)
  %.not61.not = icmp eq i32 %67, 0
  br i1 %.not61.not, label %.loopexit, label %63

.critedge:                                        ; preds = %63, %.critedge73
  %68 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %6, ptr noundef nonnull @.str.104) #7
  %69 = call noundef i32 @_ZNK7R3Scene7NLightsEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  %.not6481 = icmp sgt i32 %69, 0
  br i1 %.not6481, label %.lr.ph83, label %.critedge68

70:                                               ; preds = %.lr.ph83
  %71 = add nuw nsw i32 %.05582, 1
  %72 = call noundef i32 @_ZNK7R3Scene7NLightsEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  %.not64 = icmp slt i32 %71, %72
  br i1 %.not64, label %.lr.ph83, label %.critedge68, !llvm.loop !12

.lr.ph83:                                         ; preds = %.critedge, %70
  %.05582 = phi i32 [ %71, %70 ], [ 0, %.critedge ]
  %73 = call noundef ptr @_ZNK7R3Scene5LightEi(ptr noundef nonnull align 8 dereferenceable(352) %0, i32 noundef %.05582)
  %74 = call noundef i32 @_ZL19WritePrincetonLightPK7R3ScenePK7R3LightP8_IO_FILE(ptr noundef nonnull %0, ptr noundef %73, ptr noundef nonnull %6)
  %.not63.not = icmp eq i32 %74, 0
  br i1 %.not63.not, label %.loopexit, label %70

.critedge68:                                      ; preds = %70, %.critedge
  %75 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef nonnull %6, ptr noundef nonnull @.str.104) #7
  %76 = call noundef i32 @_ZNK7R3Scene10NMaterialsEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  %.not6684 = icmp sgt i32 %76, 0
  br i1 %.not6684, label %.lr.ph86, label %.critedge70

77:                                               ; preds = %.lr.ph86
  %78 = add nuw nsw i32 %.05185, 1
  %79 = call noundef i32 @_ZNK7R3Scene10NMaterialsEv(ptr noundef nonnull align 8 dereferenceable(352) %0)
  %.not66 = icmp slt i32 %78, %79
  br i1 %.not66, label %.lr.ph86, label %.critedge70, !llvm.loop !13

.lr.ph86:                                         ; preds = %.critedge68, %77
  %.05185 = phi i32 [ %78, %77 ], [ 0, %.critedge68 ]
  %80 = call noundef ptr @_ZNK7R3Scene8MaterialEi(ptr noundef nonnull align 8 dereferenceable(352) %0, i32 noundef %.05185)
  %81 = call noundef i32 @_ZL22WritePrincetonMaterialPK7R3ScenePK10R3MaterialP8_IO_FILE(ptr noundef nonnull %0, ptr noundef %80, ptr noundef nonnull %6)
  %.not65.not = icmp eq i32 %81, 0
  br i1 %.not65.not, label %.loopexit, label %77

.critedge70:                                      ; preds = %77, %.critedge68
  %82 = load ptr, ptr %0, align 8, !tbaa !14
  %83 = call noundef i32 @_ZL18WritePrincetonNodePK7R3ScenePK11R3SceneNodeRK16R3TransformationP8_IO_FILEPKc(ptr noundef nonnull %0, ptr noundef %82, ptr noundef nonnull align 8 dereferenceable(8) @R3identity_affine, ptr noundef nonnull %6, ptr noundef nonnull @.str.105)
  %84 = call i32 @fclose(ptr noundef nonnull %6)
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph80, %.lr.ph83, %.lr.ph86, %.critedge70, %8
  %.10 = phi i32 [ 0, %8 ], [ %83, %.critedge70 ], [ 0, %.lr.ph86 ], [ 0, %.lr.ph83 ], [ 0, %.lr.ph80 ]
  ret i32 %.10
}

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK7R3Scene8FilenameEv(ptr noundef nonnull align 8 dereferenceable(352)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK7R3Scene10BackgroundEv(ptr noundef nonnull align 8 dereferenceable(352)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK8R3Camera6OriginEv(ptr noundef nonnull align 8 dereferenceable(144)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7R3Point1XEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7R3Point1YEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK7R3Point1ZEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK8R3Vector1XEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK8R3Vector1YEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK8R3Vector1ZEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNK8R3Camera2UpEv(ptr noundef nonnull align 8 dereferenceable(144)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK8R3Camera4XFOVEv(ptr noundef nonnull align 8 dereferenceable(144)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK8R3Camera4NearEv(ptr noundef nonnull align 8 dereferenceable(144)) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef double @_ZNK8R3Camera3FarEv(ptr noundef nonnull align 8 dereferenceable(144)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden noundef i32 @_ZL17CreateTextureFilePK7R3ScenePK9R2TexturePKc(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL19WritePrincetonLightPK7R3ScenePK7R3LightP8_IO_FILE(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL22WritePrincetonMaterialPK7R3ScenePK10R3MaterialP8_IO_FILE(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZL18WritePrincetonNodePK7R3ScenePK11R3SceneNodeRK16R3TransformationP8_IO_FILEPKc(ptr noundef, ptr noundef, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef, ptr noundef) local_unnamed_addr #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 = { 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 = { 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 #4 = { 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 #5 = { 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 #6 = { cold nounwind }
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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = !{!15, !6, i64 0}
!15 = !{!"_ZTS7R3Scene", !6, i64 0, !16, i64 8, !19, i64 24, !20, i64 40, !21, i64 56, !22, i64 72, !23, i64 88, !24, i64 104, !26, i64 112, !33, i64 280, !33, i64 304, !6, i64 328, !6, i64 336, !6, i64 344}
!16 = !{!"_ZTS7RNArrayIP11R3SceneNodeE", !17, i64 0}
!17 = !{!"_ZTS8RNVArray", !6, i64 0, !18, i64 8, !18, i64 12}
!18 = !{!"int", !7, i64 0}
!19 = !{!"_ZTS7RNArrayIP7R3LightE", !17, i64 0}
!20 = !{!"_ZTS7RNArrayIP10R3MaterialE", !17, i64 0}
!21 = !{!"_ZTS7RNArrayIP6R3BrdfE", !17, i64 0}
!22 = !{!"_ZTS7RNArrayIP9R2TextureE", !17, i64 0}
!23 = !{!"_ZTS7RNArrayIP7R3SceneE", !17, i64 0}
!24 = !{!"_ZTS13RNSymbolTableIPKcE", !25, i64 0}
!25 = !{!"_ZTS5RNMapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPKcE", !6, i64 0}
!26 = !{!"_ZTS8R3Viewer", !27, i64 8, !32, i64 152}
!27 = !{!"_ZTS8R3Camera", !28, i64 0, !31, i64 96, !31, i64 104, !31, i64 112, !31, i64 120, !31, i64 128, !6, i64 136}
!28 = !{!"_ZTS13R3CoordSystem", !29, i64 0, !30, i64 24}
!29 = !{!"_ZTS7R3Point", !7, i64 0}
!30 = !{!"_ZTS7R3Triad", !7, i64 0}
!31 = !{!"double", !7, i64 0}
!32 = !{!"_ZTS10R2Viewport", !18, i64 0, !18, i64 4, !18, i64 8, !18, i64 12}
!33 = !{!"_ZTS5RNRgb", !7, i64 0}


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