; LLVM IR from ysyesilyurt/ComputerGraphics :: RayTracing/Scene.ll (ZN5Scene11renderSceneEv)

; 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.std::thread" = type { %"class.std::thread::id" }
%"class.std::thread::id" = type { i64 }
%class.Scene = type { i32, float, float, %struct.Vector3f, %struct.Vector3f, %"class.std::vector.2", %"class.std::vector.7", %"class.std::vector.12", %"class.std::vector.17", %"class.std::vector" }
%struct.Vector3f = type { %union.anon, %union.anon.0, %union.anon.1 }
%union.anon = type { float }
%union.anon.0 = type { float }
%union.anon.1 = type { float }
%"class.std::vector.2" = type { %"struct.std::_Vector_base.3" }
%"struct.std::_Vector_base.3" = type { %"struct.std::_Vector_base<Camera *, std::allocator<Camera *>>::_Vector_impl" }
%"struct.std::_Vector_base<Camera *, std::allocator<Camera *>>::_Vector_impl" = type { %"struct.std::_Vector_base<Camera *, std::allocator<Camera *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Camera *, std::allocator<Camera *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.7" = type { %"struct.std::_Vector_base.8" }
%"struct.std::_Vector_base.8" = type { %"struct.std::_Vector_base<PointLight *, std::allocator<PointLight *>>::_Vector_impl" }
%"struct.std::_Vector_base<PointLight *, std::allocator<PointLight *>>::_Vector_impl" = type { %"struct.std::_Vector_base<PointLight *, std::allocator<PointLight *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<PointLight *, std::allocator<PointLight *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.12" = type { %"struct.std::_Vector_base.13" }
%"struct.std::_Vector_base.13" = type { %"struct.std::_Vector_base<Material *, std::allocator<Material *>>::_Vector_impl" }
%"struct.std::_Vector_base<Material *, std::allocator<Material *>>::_Vector_impl" = type { %"struct.std::_Vector_base<Material *, std::allocator<Material *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Material *, std::allocator<Material *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.17" = type { %"struct.std::_Vector_base.18" }
%"struct.std::_Vector_base.18" = type { %"struct.std::_Vector_base<Vector3f, std::allocator<Vector3f>>::_Vector_impl" }
%"struct.std::_Vector_base<Vector3f, std::allocator<Vector3f>>::_Vector_impl" = type { %"struct.std::_Vector_base<Vector3f, std::allocator<Vector3f>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Vector3f, std::allocator<Vector3f>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<Shape *, std::allocator<Shape *>>::_Vector_impl" }
%"struct.std::_Vector_base<Shape *, std::allocator<Shape *>>::_Vector_impl" = type { %"struct.std::_Vector_base<Shape *, std::allocator<Shape *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<Shape *, std::allocator<Shape *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.Camera = type { [32 x i8], i32, %struct.ImagePlane, %struct.Vector3f, %struct.Vector3f, %struct.Vector3f, %struct.Vector3f }
%struct.ImagePlane = type { float, float, float, float, float, i32, i32 }

@lastRow = external dso_local global i32, align 4

; 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: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP6CameraSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z7executeP5ImageP5Scenei(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5Scene11renderSceneEv(ptr noundef nonnull align 8 dereferenceable(160) %0) #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca %"class.std::thread", align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %14 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  %15 = call noundef i32 @_ZNSt6thread20hardware_concurrencyEv() #8
  store i32 %15, ptr %3, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  store i32 0, ptr %4, align 4, !tbaa !9
  br label %16

16:                                               ; preds = %133, %1
  %17 = load i32, ptr %4, align 4, !tbaa !9
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds %class.Scene, ptr %14, i32 0, i32 5
  %20 = call noundef i64 @_ZNKSt6vectorIP6CameraSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %19) #8
  %21 = icmp ult i64 %18, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %16
  store i32 2, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  br label %136

23:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  %24 = call noalias noundef nonnull ptr @_Znwm(i64 noundef 16) #9
  %25 = getelementptr inbounds %class.Scene, ptr %14, i32 0, i32 5
  %26 = load i32, ptr %4, align 4, !tbaa !9
  %27 = sext i32 %26 to i64
  %28 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP6CameraSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %25, i64 noundef %27) #8
  %29 = load ptr, ptr %28, align 8, !tbaa !5
  %30 = getelementptr inbounds %class.Camera, ptr %29, i32 0, i32 2
  %31 = getelementptr inbounds %struct.ImagePlane, ptr %30, i32 0, i32 5
  %32 = load i32, ptr %31, align 4, !tbaa !11
  %33 = getelementptr inbounds %class.Scene, ptr %14, i32 0, i32 5
  %34 = load i32, ptr %4, align 4, !tbaa !9
  %35 = sext i32 %34 to i64
  %36 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP6CameraSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %33, i64 noundef %35) #8
  %37 = load ptr, ptr %36, align 8, !tbaa !5
  %38 = getelementptr inbounds %class.Camera, ptr %37, i32 0, i32 2
  %39 = getelementptr inbounds %struct.ImagePlane, ptr %38, i32 0, i32 6
  %40 = load i32, ptr %39, align 4, !tbaa !16
  invoke void @_ZN5ImageC1Eii(ptr noundef nonnull align 8 dereferenceable(16) %24, i32 noundef %32, i32 noundef %40)
          to label %41 unwind label %55

41:                                               ; preds = %23
  store ptr %24, ptr %6, align 8, !tbaa !5
  %42 = getelementptr inbounds %class.Scene, ptr %14, i32 0, i32 5
  %43 = load i32, ptr %4, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP6CameraSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %42, i64 noundef %44) #8
  %46 = load ptr, ptr %45, align 8, !tbaa !5
  %47 = getelementptr inbounds %class.Camera, ptr %46, i32 0, i32 2
  %48 = getelementptr inbounds %struct.ImagePlane, ptr %47, i32 0, i32 6
  %49 = load i32, ptr %48, align 4, !tbaa !16
  store i32 %49, ptr @lastRow, align 4, !tbaa !9
  %50 = load i32, ptr %3, align 4, !tbaa !9
  %51 = icmp ne i32 %50, 0
  br i1 %51, label %59, label %52

52:                                               ; preds = %41
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = load i32, ptr %4, align 4, !tbaa !9
  call void @_Z7executeP5ImageP5Scenei(ptr noundef %53, ptr noundef %14, i32 noundef %54)
  br label %124

55:                                               ; preds = %23
  %56 = landingpad { ptr, i32 }
          cleanup
  %57 = extractvalue { ptr, i32 } %56, 0
  store ptr %57, ptr %7, align 8
  %58 = extractvalue { ptr, i32 } %56, 1
  store i32 %58, ptr %8, align 4
  call void @_ZdlPvm(ptr noundef %24, i64 noundef 16) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  br label %137

59:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #8
  %60 = load i32, ptr %3, align 4, !tbaa !9
  %61 = zext i32 %60 to i64
  %62 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %61, i64 8)
  %63 = extractvalue { i64, i1 } %62, 1
  %64 = extractvalue { i64, i1 } %62, 0
  %65 = call { i64, i1 } @llvm.uadd.with.overflow.i64(i64 %64, i64 8)
  %66 = extractvalue { i64, i1 } %65, 1
  %67 = or i1 %63, %66
  %68 = extractvalue { i64, i1 } %65, 0
  %69 = select i1 %67, i64 -1, i64 %68
  %70 = call noalias noundef nonnull ptr @_Znam(i64 noundef %69) #9
  store i64 %61, ptr %70, align 8
  %71 = getelementptr inbounds i8, ptr %70, i64 8
  %72 = icmp eq i64 %61, 0
  br i1 %72, label %79, label %73

73:                                               ; preds = %59
  %74 = getelementptr inbounds %"class.std::thread", ptr %71, i64 %61
  br label %75

75:                                               ; preds = %75, %73
  %76 = phi ptr [ %71, %73 ], [ %77, %75 ]
  call void @_ZNSt6threadC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %76) #8
  %77 = getelementptr inbounds %"class.std::thread", ptr %76, i64 1
  %78 = icmp eq ptr %77, %74
  br i1 %78, label %79, label %75

79:                                               ; preds = %75, %59
  store ptr %71, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #8
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %80

80:                                               ; preds = %91, %79
  %81 = load i32, ptr %10, align 4, !tbaa !9
  %82 = load i32, ptr %3, align 4, !tbaa !9
  %83 = icmp ult i32 %81, %82
  br i1 %83, label %85, label %84

84:                                               ; preds = %80
  store i32 5, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #8
  br label %94

85:                                               ; preds = %80
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  store ptr %14, ptr %12, align 8, !tbaa !5
  call void @_ZNSt6threadC2IRFvP5ImageP5SceneiEJRS2_S4_RiEvEEOT_DpOT0_(ptr noundef nonnull align 8 dereferenceable(8) %11, ptr noundef nonnull @_Z7executeP5ImageP5Scenei, ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %86 = load ptr, ptr %9, align 8, !tbaa !5
  %87 = load i32, ptr %10, align 4, !tbaa !9
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds %"class.std::thread", ptr %86, i64 %88
  %90 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6threadaSEOS_(ptr noundef nonnull align 8 dereferenceable(8) %89, ptr noundef nonnull align 8 dereferenceable(8) %11) #8
  call void @_ZNSt6threadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %11) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  br label %91

91:                                               ; preds = %85
  %92 = load i32, ptr %10, align 4, !tbaa !9
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %10, align 4, !tbaa !9
  br label %80, !llvm.loop !17

94:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %95

95:                                               ; preds = %105, %94
  %96 = load i32, ptr %13, align 4, !tbaa !9
  %97 = load i32, ptr %3, align 4, !tbaa !9
  %98 = icmp ult i32 %96, %97
  br i1 %98, label %100, label %99

99:                                               ; preds = %95
  store i32 8, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  br label %108

100:                                              ; preds = %95
  %101 = load ptr, ptr %9, align 8, !tbaa !5
  %102 = load i32, ptr %13, align 4, !tbaa !9
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds %"class.std::thread", ptr %101, i64 %103
  call void @_ZNSt6thread4joinEv(ptr noundef nonnull align 8 dereferenceable(8) %104)
  br label %105

105:                                              ; preds = %100
  %106 = load i32, ptr %13, align 4, !tbaa !9
  %107 = add nsw i32 %106, 1
  store i32 %107, ptr %13, align 4, !tbaa !9
  br label %95, !llvm.loop !19

108:                                              ; preds = %99
  %109 = load ptr, ptr %9, align 8, !tbaa !5
  %110 = icmp eq ptr %109, null
  br i1 %110, label %123, label %111

111:                                              ; preds = %108
  %112 = getelementptr inbounds i8, ptr %109, i64 -8
  %113 = load i64, ptr %112, align 8
  %114 = getelementptr inbounds %"class.std::thread", ptr %109, i64 %113
  %115 = icmp eq ptr %109, %114
  br i1 %115, label %120, label %116

116:                                              ; preds = %116, %111
  %117 = phi ptr [ %114, %111 ], [ %118, %116 ]
  %118 = getelementptr inbounds %"class.std::thread", ptr %117, i64 -1
  call void @_ZNSt6threadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %118) #8
  %119 = icmp eq ptr %118, %109
  br i1 %119, label %120, label %116

120:                                              ; preds = %116, %111
  %121 = mul i64 8, %113
  %122 = add i64 %121, 8
  call void @_ZdaPvm(ptr noundef %112, i64 noundef %122) #10
  br label %123

123:                                              ; preds = %120, %108
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #8
  br label %124

124:                                              ; preds = %123, %52
  %125 = load ptr, ptr %6, align 8, !tbaa !5
  %126 = getelementptr inbounds %class.Scene, ptr %14, i32 0, i32 5
  %127 = load i32, ptr %4, align 4, !tbaa !9
  %128 = sext i32 %127 to i64
  %129 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP6CameraSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %126, i64 noundef %128) #8
  %130 = load ptr, ptr %129, align 8, !tbaa !5
  %131 = getelementptr inbounds %class.Camera, ptr %130, i32 0, i32 0
  %132 = getelementptr inbounds [32 x i8], ptr %131, i64 0, i64 0
  call void @_ZNK5Image9saveImageEPKc(ptr noundef nonnull align 8 dereferenceable(16) %125, ptr noundef %132)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  br label %133

133:                                              ; preds = %124
  %134 = load i32, ptr %4, align 4, !tbaa !9
  %135 = add nsw i32 %134, 1
  store i32 %135, ptr %4, align 4, !tbaa !9
  br label %16, !llvm.loop !20

136:                                              ; preds = %22
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  ret void

137:                                              ; preds = %55
  %138 = load ptr, ptr %7, align 8
  %139 = load i32, ptr %8, align 4
  %140 = insertvalue { ptr, i32 } poison, ptr %138, 0
  %141 = insertvalue { ptr, i32 } %140, i32 %139, 1
  resume { ptr, i32 } %141
}

; Function Attrs: nounwind
declare noundef i32 @_ZNSt6thread20hardware_concurrencyEv() #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIP6CameraSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #1 align 2

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

declare void @_ZN5ImageC1Eii(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef, i32 noundef) unnamed_addr #5

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #6

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6threadC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6threadC2IRFvP5ImageP5SceneiEJRS2_S4_RiEvEEOT_DpOT0_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6threadaSEOS_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6threadD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

declare void @_ZNSt6thread4joinEv(ptr noundef nonnull align 8 dereferenceable(8)) #5

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPvm(ptr noundef, i64 noundef) #6

declare void @_ZNK5Image9saveImageEPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) #5

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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 = { 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 = { nobuiltin allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { nobuiltin nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }
attributes #10 = { builtin nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 56}
!12 = !{!"_ZTS6Camera", !7, i64 0, !10, i64 32, !13, i64 36, !15, i64 64, !15, i64 76, !15, i64 88, !15, i64 100}
!13 = !{!"_ZTS10ImagePlane", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12, !14, i64 16, !10, i64 20, !10, i64 24}
!14 = !{!"float", !7, i64 0}
!15 = !{!"_ZTS8Vector3f", !7, i64 0, !7, i64 4, !7, i64 8}
!16 = !{!12, !10, i64 60}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = distinct !{!20, !18}


; 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.std::thread" = type { %"class.std::thread::id" }
%"class.std::thread::id" = type { i64 }

@lastRow = external dso_local local_unnamed_addr global i32, align 4

; 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: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP6CameraSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z7executeP5ImageP5Scenei(ptr noundef, ptr noundef, i32 noundef) #2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5Scene11renderSceneEv(ptr noundef nonnull align 8 dereferenceable(160) %0) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca %"class.std::thread", align 8
  %5 = alloca ptr, align 8
  %6 = tail call noundef i32 @_ZNSt6thread20hardware_concurrencyEv() #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %7 = getelementptr inbounds i8, ptr %0, i64 40
  store i32 0, ptr %2, align 4, !tbaa !5
  %8 = tail call noundef i64 @_ZNKSt6vectorIP6CameraSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  %.not24 = icmp eq i64 %8, 0
  br i1 %.not24, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %1
  %.not = icmp eq i32 %6, 0
  %9 = zext i32 %6 to i64
  %10 = shl nuw nsw i64 %9, 3
  %11 = add nuw nsw i64 %10, 8
  br i1 %.not, label %.lr.ph.split.us, label %.lr.ph.split

.lr.ph.split.us:                                  ; preds = %.lr.ph, %23
  %12 = phi i32 [ %30, %23 ], [ 0, %.lr.ph ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %13 = tail call noalias noundef nonnull dereferenceable(16) ptr @_Znwm(i64 noundef 16) #8
  %14 = zext nneg i32 %12 to i64
  %15 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP6CameraSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %14) #7
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = getelementptr inbounds i8, ptr %16, i64 56
  %18 = load i32, ptr %17, align 4, !tbaa !11
  %19 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP6CameraSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %14) #7
  %20 = load ptr, ptr %19, align 8, !tbaa !9
  %21 = getelementptr inbounds i8, ptr %20, i64 60
  %22 = load i32, ptr %21, align 4, !tbaa !16
  invoke void @_ZN5ImageC1Eii(ptr noundef nonnull align 8 dereferenceable(16) %13, i32 noundef %18, i32 noundef %22)
          to label %23 unwind label %.split.us

23:                                               ; preds = %.lr.ph.split.us
  %24 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP6CameraSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %14) #7
  %25 = load ptr, ptr %24, align 8, !tbaa !9
  %26 = getelementptr inbounds i8, ptr %25, i64 60
  %27 = load i32, ptr %26, align 4, !tbaa !16
  store i32 %27, ptr @lastRow, align 4, !tbaa !5
  tail call void @_Z7executeP5ImageP5Scenei(ptr noundef nonnull %13, ptr noundef nonnull %0, i32 noundef %12)
  %28 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP6CameraSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %14) #7
  %29 = load ptr, ptr %28, align 8, !tbaa !9
  tail call void @_ZNK5Image9saveImageEPKc(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef %29)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  %30 = add nuw nsw i32 %12, 1
  store i32 %30, ptr %2, align 4, !tbaa !5
  %31 = zext nneg i32 %30 to i64
  %32 = tail call noundef i64 @_ZNKSt6vectorIP6CameraSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  %33 = icmp ugt i64 %32, %31
  br i1 %33, label %.lr.ph.split.us, label %._crit_edge, !llvm.loop !17

.split.us:                                        ; preds = %.lr.ph.split.us
  %34 = landingpad { ptr, i32 }
          cleanup
  br label %58

._crit_edge:                                      ; preds = %.loopexit, %23, %1
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  ret void

.lr.ph.split:                                     ; preds = %.lr.ph, %.loopexit
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %35 = call noalias noundef nonnull dereferenceable(16) ptr @_Znwm(i64 noundef 16) #8
  %36 = load i32, ptr %2, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP6CameraSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %37) #7
  %39 = load ptr, ptr %38, align 8, !tbaa !9
  %40 = getelementptr inbounds i8, ptr %39, i64 56
  %41 = load i32, ptr %40, align 4, !tbaa !11
  %42 = load i32, ptr %2, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP6CameraSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %43) #7
  %45 = load ptr, ptr %44, align 8, !tbaa !9
  %46 = getelementptr inbounds i8, ptr %45, i64 60
  %47 = load i32, ptr %46, align 4, !tbaa !16
  invoke void @_ZN5ImageC1Eii(ptr noundef nonnull align 8 dereferenceable(16) %35, i32 noundef %41, i32 noundef %47)
          to label %48 unwind label %.split

48:                                               ; preds = %.lr.ph.split
  store ptr %35, ptr %3, align 8, !tbaa !9
  %49 = load i32, ptr %2, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP6CameraSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %50) #7
  %52 = load ptr, ptr %51, align 8, !tbaa !9
  %53 = getelementptr inbounds i8, ptr %52, i64 60
  %54 = load i32, ptr %53, align 4, !tbaa !16
  store i32 %54, ptr @lastRow, align 4, !tbaa !5
  %55 = call noalias noundef nonnull ptr @_Znam(i64 noundef %11) #8
  store i64 %9, ptr %55, align 8
  %.ptr = getelementptr inbounds i8, ptr %55, i64 8
  %56 = getelementptr inbounds %"class.std::thread", ptr %.ptr, i64 %9
  br label %59

.split:                                           ; preds = %.lr.ph.split
  %57 = landingpad { ptr, i32 }
          cleanup
  br label %58

58:                                               ; preds = %.split.us, %.split
  %.us-phi = phi ptr [ %35, %.split ], [ %13, %.split.us ]
  %.us-phi23 = phi { ptr, i32 } [ %57, %.split ], [ %34, %.split.us ]
  call void @_ZdlPvm(ptr noundef nonnull %.us-phi, i64 noundef 16) #9
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  resume { ptr, i32 } %.us-phi23

59:                                               ; preds = %59, %48
  %60 = phi ptr [ %.ptr, %48 ], [ %61, %59 ]
  call void @_ZNSt6threadC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %60) #7
  %61 = getelementptr inbounds i8, ptr %60, i64 8
  %62 = icmp eq ptr %61, %56
  br i1 %62, label %.preheader20, label %59

.preheader20:                                     ; preds = %59, %.preheader20
  %indvars.iv = phi i64 [ %indvars.iv.next, %.preheader20 ], [ 0, %59 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  store ptr %0, ptr %5, align 8, !tbaa !9
  call void @_ZNSt6threadC2IRFvP5ImageP5SceneiEJRS2_S4_RiEvEEOT_DpOT0_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull @_Z7executeP5ImageP5Scenei, ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %63 = getelementptr inbounds %"class.std::thread", ptr %.ptr, i64 %indvars.iv
  %64 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6threadaSEOS_(ptr noundef nonnull align 8 dereferenceable(8) %63, ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  call void @_ZNSt6threadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %9
  br i1 %exitcond.not, label %.preheader19, label %.preheader20, !llvm.loop !19

.preheader19:                                     ; preds = %.preheader20, %.preheader19
  %indvars.iv30 = phi i64 [ %indvars.iv.next31, %.preheader19 ], [ 0, %.preheader20 ]
  %65 = getelementptr inbounds %"class.std::thread", ptr %.ptr, i64 %indvars.iv30
  call void @_ZNSt6thread4joinEv(ptr noundef nonnull align 8 dereferenceable(8) %65)
  %indvars.iv.next31 = add nuw nsw i64 %indvars.iv30, 1
  %exitcond34.not = icmp eq i64 %indvars.iv.next31, %9
  br i1 %exitcond34.not, label %66, label %.preheader19, !llvm.loop !20

66:                                               ; preds = %.preheader19
  %67 = load i64, ptr %55, align 8
  %.idx = shl i64 %67, 3
  %68 = icmp eq i64 %67, 0
  br i1 %68, label %.loopexit, label %.preheader.preheader

.preheader.preheader:                             ; preds = %66
  %69 = getelementptr i8, ptr %55, i64 %.idx
  %.ptr18 = getelementptr i8, ptr %69, i64 8
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %.preheader
  %70 = phi ptr [ %71, %.preheader ], [ %.ptr18, %.preheader.preheader ]
  %71 = getelementptr inbounds i8, ptr %70, i64 -8
  call void @_ZNSt6threadD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %71) #7
  %72 = icmp eq ptr %71, %.ptr
  br i1 %72, label %.loopexit, label %.preheader

.loopexit:                                        ; preds = %.preheader, %66
  %73 = add i64 %.idx, 8
  call void @_ZdaPvm(ptr noundef nonnull %55, i64 noundef %73) #9
  %74 = load ptr, ptr %3, align 8, !tbaa !9
  %75 = load i32, ptr %2, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIP6CameraSaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %7, i64 noundef %76) #7
  %78 = load ptr, ptr %77, align 8, !tbaa !9
  call void @_ZNK5Image9saveImageEPKc(ptr noundef nonnull align 8 dereferenceable(16) %74, ptr noundef %78)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  %79 = load i32, ptr %2, align 4, !tbaa !5
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %2, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = call noundef i64 @_ZNKSt6vectorIP6CameraSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %7) #7
  %83 = icmp ugt i64 %82, %81
  br i1 %83, label %.lr.ph.split, label %._crit_edge, !llvm.loop !17
}

; Function Attrs: nounwind
declare noundef i32 @_ZNSt6thread20hardware_concurrencyEv() local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIP6CameraSaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

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

declare void @_ZN5ImageC1Eii(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef, i32 noundef) unnamed_addr #5

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) local_unnamed_addr #6

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6threadC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6threadC2IRFvP5ImageP5SceneiEJRS2_S4_RiEvEEOT_DpOT0_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull, ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 4 dereferenceable(4)) unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6threadaSEOS_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6threadD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

declare void @_ZNSt6thread4joinEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPvm(ptr noundef, i64 noundef) local_unnamed_addr #6

declare void @_ZNK5Image9saveImageEPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) local_unnamed_addr #5

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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 = { 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 = { nobuiltin allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { nobuiltin nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }
attributes #8 = { builtin allocsize(0) }
attributes #9 = { builtin nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !6, i64 56}
!12 = !{!"_ZTS6Camera", !7, i64 0, !6, i64 32, !13, i64 36, !15, i64 64, !15, i64 76, !15, i64 88, !15, i64 100}
!13 = !{!"_ZTS10ImagePlane", !14, i64 0, !14, i64 4, !14, i64 8, !14, i64 12, !14, i64 16, !6, i64 20, !6, i64 24}
!14 = !{!"float", !7, i64 0}
!15 = !{!"_ZTS8Vector3f", !7, i64 0, !7, i64 4, !7, i64 8}
!16 = !{!12, !6, i64 60}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = distinct !{!20, !18}


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