; LLVM IR from mackorone/mms :: old/v2/src/lib/tdogl/Program.ll (ZN5tdogl7ProgramC2ERKSt6vectorINS_6ShaderESaIS2_EE)

; 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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon.3 }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon.3 = type { i64, [8 x i8] }
%"class.std::allocator.0" = type { i8 }
%"class.tdogl::Program" = type { i32 }

@.str = external hidden unnamed_addr constant [47 x i8], align 1
@_ZTISt13runtime_error = external constant ptr
@__glewCreateProgram = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [23 x i8], align 1
@__glewAttachShader = external global ptr, align 8
@__glewLinkProgram = external global ptr, align 8
@__glewDetachShader = external global ptr, align 8
@__glewGetProgramiv = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [26 x i8], align 1
@__glewGetProgramInfoLog = external global ptr, align 8
@__glewDeleteProgram = external global ptr, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5tdogl7ProgramC2ERKSt6vectorINS_6ShaderESaIS2_EE(ptr noundef nonnull align 4 dereferenceable(4) %0, ptr noundef nonnull align 8 dereferenceable(24) %1) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"class.std::__cxx11::basic_string", align 8
  %11 = alloca %"class.std::allocator.0", align 1
  %12 = alloca i32, align 4
  %13 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %14 = load ptr, ptr %3, align 8
  %15 = getelementptr inbounds %"class.tdogl::Program", ptr %14, i32 0, i32 0
  store i32 0, ptr %15, align 4, !tbaa !9
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = call noundef i64 @_ZNKSt6vectorIN5tdogl6ShaderESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %16) #7
  %18 = icmp ule i64 %17, 0
  br i1 %18, label %19, label %26

19:                                               ; preds = %2
  %20 = call ptr @__cxa_allocate_exception(i64 16) #7
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef @.str)
          to label %21 unwind label %22

21:                                               ; preds = %19
  call void @__cxa_throw(ptr %20, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #8
  unreachable

22:                                               ; preds = %19
  %23 = landingpad { ptr, i32 }
          cleanup
  %24 = extractvalue { ptr, i32 } %23, 0
  store ptr %24, ptr %5, align 8
  %25 = extractvalue { ptr, i32 } %23, 1
  store i32 %25, ptr %6, align 4
  call void @__cxa_free_exception(ptr %20) #7
  br label %140

26:                                               ; preds = %2
  %27 = load ptr, ptr @__glewCreateProgram, align 8, !tbaa !5
  %28 = call i32 %27()
  %29 = getelementptr inbounds %"class.tdogl::Program", ptr %14, i32 0, i32 0
  store i32 %28, ptr %29, align 4, !tbaa !9
  %30 = getelementptr inbounds %"class.tdogl::Program", ptr %14, i32 0, i32 0
  %31 = load i32, ptr %30, align 4, !tbaa !9
  %32 = icmp eq i32 %31, 0
  br i1 %32, label %33, label %40

33:                                               ; preds = %26
  %34 = call ptr @__cxa_allocate_exception(i64 16) #7
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %34, ptr noundef @.str.1)
          to label %35 unwind label %36

35:                                               ; preds = %33
  call void @__cxa_throw(ptr %34, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #8
  unreachable

36:                                               ; preds = %33
  %37 = landingpad { ptr, i32 }
          cleanup
  %38 = extractvalue { ptr, i32 } %37, 0
  store ptr %38, ptr %5, align 8
  %39 = extractvalue { ptr, i32 } %37, 1
  store i32 %39, ptr %6, align 4
  call void @__cxa_free_exception(ptr %34) #7
  br label %140

40:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 0, ptr %7, align 4, !tbaa !12
  br label %41

41:                                               ; preds = %57, %40
  %42 = load i32, ptr %7, align 4, !tbaa !12
  %43 = zext i32 %42 to i64
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = call noundef i64 @_ZNKSt6vectorIN5tdogl6ShaderESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %44) #7
  %46 = icmp ult i64 %43, %45
  br i1 %46, label %48, label %47

47:                                               ; preds = %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %60

48:                                               ; preds = %41
  %49 = load ptr, ptr @__glewAttachShader, align 8, !tbaa !5
  %50 = getelementptr inbounds %"class.tdogl::Program", ptr %14, i32 0, i32 0
  %51 = load i32, ptr %50, align 4, !tbaa !9
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = load i32, ptr %7, align 4, !tbaa !12
  %54 = zext i32 %53 to i64
  %55 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorIN5tdogl6ShaderESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %52, i64 noundef %54) #7
  %56 = call noundef i32 @_ZNK5tdogl6Shader6objectEv(ptr noundef nonnull align 8 dereferenceable(16) %55)
  call void %49(i32 noundef %51, i32 noundef %56)
  br label %57

57:                                               ; preds = %48
  %58 = load i32, ptr %7, align 4, !tbaa !12
  %59 = add i32 %58, 1
  store i32 %59, ptr %7, align 4, !tbaa !12
  br label %41, !llvm.loop !13

60:                                               ; preds = %47
  %61 = load ptr, ptr @__glewLinkProgram, align 8, !tbaa !5
  %62 = getelementptr inbounds %"class.tdogl::Program", ptr %14, i32 0, i32 0
  %63 = load i32, ptr %62, align 4, !tbaa !9
  call void %61(i32 noundef %63)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 0, ptr %8, align 4, !tbaa !12
  br label %64

64:                                               ; preds = %80, %60
  %65 = load i32, ptr %8, align 4, !tbaa !12
  %66 = zext i32 %65 to i64
  %67 = load ptr, ptr %4, align 8, !tbaa !5
  %68 = call noundef i64 @_ZNKSt6vectorIN5tdogl6ShaderESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %67) #7
  %69 = icmp ult i64 %66, %68
  br i1 %69, label %71, label %70

70:                                               ; preds = %64
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %83

71:                                               ; preds = %64
  %72 = load ptr, ptr @__glewDetachShader, align 8, !tbaa !5
  %73 = getelementptr inbounds %"class.tdogl::Program", ptr %14, i32 0, i32 0
  %74 = load i32, ptr %73, align 4, !tbaa !9
  %75 = load ptr, ptr %4, align 8, !tbaa !5
  %76 = load i32, ptr %8, align 4, !tbaa !12
  %77 = zext i32 %76 to i64
  %78 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorIN5tdogl6ShaderESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %75, i64 noundef %77) #7
  %79 = call noundef i32 @_ZNK5tdogl6Shader6objectEv(ptr noundef nonnull align 8 dereferenceable(16) %78)
  call void %72(i32 noundef %74, i32 noundef %79)
  br label %80

80:                                               ; preds = %71
  %81 = load i32, ptr %8, align 4, !tbaa !12
  %82 = add i32 %81, 1
  store i32 %82, ptr %8, align 4, !tbaa !12
  br label %64, !llvm.loop !15

83:                                               ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %84 = load ptr, ptr @__glewGetProgramiv, align 8, !tbaa !5
  %85 = getelementptr inbounds %"class.tdogl::Program", ptr %14, i32 0, i32 0
  %86 = load i32, ptr %85, align 4, !tbaa !9
  call void %84(i32 noundef %86, i32 noundef 35714, ptr noundef %9)
  %87 = load i32, ptr %9, align 4, !tbaa !12
  %88 = icmp eq i32 %87, 0
  br i1 %88, label %89, label %139

89:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #7
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #7
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef @.str.2, ptr noundef nonnull align 1 dereferenceable(1) %11)
          to label %90 unwind label %120

90:                                               ; preds = %89
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %91 = load ptr, ptr @__glewGetProgramiv, align 8, !tbaa !5
  %92 = getelementptr inbounds %"class.tdogl::Program", ptr %14, i32 0, i32 0
  %93 = load i32, ptr %92, align 4, !tbaa !9
  invoke void %91(i32 noundef %93, i32 noundef 35716, ptr noundef %12)
          to label %94 unwind label %124

94:                                               ; preds = %90
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %95 = load i32, ptr %12, align 4, !tbaa !12
  %96 = add nsw i32 %95, 1
  %97 = sext i32 %96 to i64
  %98 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %97) #9
          to label %99 unwind label %128

99:                                               ; preds = %94
  store ptr %98, ptr %13, align 8, !tbaa !5
  %100 = load ptr, ptr @__glewGetProgramInfoLog, align 8, !tbaa !5
  %101 = getelementptr inbounds %"class.tdogl::Program", ptr %14, i32 0, i32 0
  %102 = load i32, ptr %101, align 4, !tbaa !9
  %103 = load i32, ptr %12, align 4, !tbaa !12
  %104 = load ptr, ptr %13, align 8, !tbaa !5
  invoke void %100(i32 noundef %102, i32 noundef %103, ptr noundef null, ptr noundef %104)
          to label %105 unwind label %128

105:                                              ; preds = %99
  %106 = load ptr, ptr %13, align 8, !tbaa !5
  %107 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef %106)
          to label %108 unwind label %128

108:                                              ; preds = %105
  %109 = load ptr, ptr %13, align 8, !tbaa !5
  %110 = icmp eq ptr %109, null
  br i1 %110, label %112, label %111

111:                                              ; preds = %108
  call void @_ZdaPv(ptr noundef %109) #10
  br label %112

112:                                              ; preds = %111, %108
  %113 = load ptr, ptr @__glewDeleteProgram, align 8, !tbaa !5
  %114 = getelementptr inbounds %"class.tdogl::Program", ptr %14, i32 0, i32 0
  %115 = load i32, ptr %114, align 4, !tbaa !9
  invoke void %113(i32 noundef %115)
          to label %116 unwind label %128

116:                                              ; preds = %112
  %117 = getelementptr inbounds %"class.tdogl::Program", ptr %14, i32 0, i32 0
  store i32 0, ptr %117, align 4, !tbaa !9
  %118 = call ptr @__cxa_allocate_exception(i64 16) #7
  invoke void @_ZNSt13runtime_errorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %118, ptr noundef nonnull align 8 dereferenceable(32) %10)
          to label %119 unwind label %132

119:                                              ; preds = %116
  invoke void @__cxa_throw(ptr %118, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #8
          to label %145 unwind label %128

120:                                              ; preds = %89
  %121 = landingpad { ptr, i32 }
          cleanup
  %122 = extractvalue { ptr, i32 } %121, 0
  store ptr %122, ptr %5, align 8
  %123 = extractvalue { ptr, i32 } %121, 1
  store i32 %123, ptr %6, align 4
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %11) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #7
  br label %138

124:                                              ; preds = %90
  %125 = landingpad { ptr, i32 }
          cleanup
  %126 = extractvalue { ptr, i32 } %125, 0
  store ptr %126, ptr %5, align 8
  %127 = extractvalue { ptr, i32 } %125, 1
  store i32 %127, ptr %6, align 4
  br label %137

128:                                              ; preds = %119, %112, %105, %99, %94
  %129 = landingpad { ptr, i32 }
          cleanup
  %130 = extractvalue { ptr, i32 } %129, 0
  store ptr %130, ptr %5, align 8
  %131 = extractvalue { ptr, i32 } %129, 1
  store i32 %131, ptr %6, align 4
  br label %136

132:                                              ; preds = %116
  %133 = landingpad { ptr, i32 }
          cleanup
  %134 = extractvalue { ptr, i32 } %133, 0
  store ptr %134, ptr %5, align 8
  %135 = extractvalue { ptr, i32 } %133, 1
  store i32 %135, ptr %6, align 4
  call void @__cxa_free_exception(ptr %118) #7
  br label %136

136:                                              ; preds = %132, %128
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  br label %137

137:                                              ; preds = %136, %124
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %10) #7
  br label %138

138:                                              ; preds = %137, %120
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %140

139:                                              ; preds = %83
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  ret void

140:                                              ; preds = %138, %36, %22
  %141 = load ptr, ptr %5, align 8
  %142 = load i32, ptr %6, align 4
  %143 = insertvalue { ptr, i32 } poison, ptr %141, 0
  %144 = insertvalue { ptr, i32 } %143, i32 %142, 1
  resume { ptr, i32 } %144

145:                                              ; preds = %119
  unreachable
}

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

declare ptr @__cxa_allocate_exception(i64)

declare void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

declare void @__cxa_free_exception(ptr)

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

declare void @__cxa_throw(ptr, ptr, ptr)

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

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

declare noundef i32 @_ZNK5tdogl6Shader6objectEv(ptr noundef nonnull align 8 dereferenceable(16)) #2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) #0 align 2

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

declare void @_ZNSt13runtime_errorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2

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

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

attributes #0 = { 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 #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 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #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 = { noreturn }
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, !11, i64 0}
!10 = !{!"_ZTSN5tdogl7ProgramE", !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = !{!11, !11, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}


; 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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon.3 }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon.3 = type { i64, [8 x i8] }
%"class.std::allocator.0" = type { i8 }

@.str = external hidden unnamed_addr constant [47 x i8], align 1
@_ZTISt13runtime_error = external constant ptr
@__glewCreateProgram = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [23 x i8], align 1
@__glewAttachShader = external local_unnamed_addr global ptr, align 8
@__glewLinkProgram = external local_unnamed_addr global ptr, align 8
@__glewDetachShader = external local_unnamed_addr global ptr, align 8
@__glewGetProgramiv = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [26 x i8], align 1
@__glewGetProgramInfoLog = external local_unnamed_addr global ptr, align 8
@__glewDeleteProgram = external local_unnamed_addr global ptr, align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN5tdogl7ProgramC2ERKSt6vectorINS_6ShaderESaIS2_EE(ptr nocapture noundef nonnull align 4 dereferenceable(4) %0, ptr noundef nonnull align 8 dereferenceable(24) %1) unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca %"class.std::__cxx11::basic_string", align 8
  %5 = alloca %"class.std::allocator.0", align 1
  %6 = alloca i32, align 4
  store i32 0, ptr %0, align 4, !tbaa !5
  %7 = tail call noundef i64 @_ZNKSt6vectorIN5tdogl6ShaderESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  %8 = icmp eq i64 %7, 0
  br i1 %8, label %9, label %14

9:                                                ; preds = %2
  %10 = tail call ptr @__cxa_allocate_exception(i64 16) #7
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull @.str)
          to label %11 unwind label %12

11:                                               ; preds = %9
  tail call void @__cxa_throw(ptr nonnull %10, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #8
  unreachable

12:                                               ; preds = %9
  %13 = landingpad { ptr, i32 }
          cleanup
  tail call void @__cxa_free_exception(ptr %10) #7
  br label %80

14:                                               ; preds = %2
  %15 = load ptr, ptr @__glewCreateProgram, align 8, !tbaa !10
  %16 = tail call i32 %15()
  store i32 %16, ptr %0, align 4, !tbaa !5
  %17 = icmp eq i32 %16, 0
  br i1 %17, label %19, label %.preheader

.preheader:                                       ; preds = %14
  %18 = tail call noundef i64 @_ZNKSt6vectorIN5tdogl6ShaderESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  %.not = icmp eq i64 %18, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

19:                                               ; preds = %14
  %20 = tail call ptr @__cxa_allocate_exception(i64 16) #7
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull @.str.1)
          to label %21 unwind label %22

21:                                               ; preds = %19
  tail call void @__cxa_throw(ptr nonnull %20, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #8
  unreachable

22:                                               ; preds = %19
  %23 = landingpad { ptr, i32 }
          cleanup
  tail call void @__cxa_free_exception(ptr %20) #7
  br label %80

._crit_edge:                                      ; preds = %.lr.ph, %.preheader
  %24 = load ptr, ptr @__glewLinkProgram, align 8, !tbaa !10
  %25 = load i32, ptr %0, align 4, !tbaa !5
  tail call void %24(i32 noundef %25)
  %26 = tail call noundef i64 @_ZNKSt6vectorIN5tdogl6ShaderESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  %.not34 = icmp eq i64 %26, 0
  br i1 %.not34, label %._crit_edge33, label %.lr.ph32

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %27 = phi i64 [ %33, %.lr.ph ], [ 0, %.preheader ]
  %.01729 = phi i32 [ %32, %.lr.ph ], [ 0, %.preheader ]
  %28 = load ptr, ptr @__glewAttachShader, align 8, !tbaa !10
  %29 = load i32, ptr %0, align 4, !tbaa !5
  %30 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorIN5tdogl6ShaderESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %27) #7
  %31 = tail call noundef i32 @_ZNK5tdogl6Shader6objectEv(ptr noundef nonnull align 8 dereferenceable(16) %30)
  tail call void %28(i32 noundef %29, i32 noundef %31)
  %32 = add i32 %.01729, 1
  %33 = zext i32 %32 to i64
  %34 = tail call noundef i64 @_ZNKSt6vectorIN5tdogl6ShaderESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  %35 = icmp ugt i64 %34, %33
  br i1 %35, label %.lr.ph, label %._crit_edge, !llvm.loop !12

._crit_edge33:                                    ; preds = %.lr.ph32, %._crit_edge
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %36 = load ptr, ptr @__glewGetProgramiv, align 8, !tbaa !10
  %37 = load i32, ptr %0, align 4, !tbaa !5
  call void %36(i32 noundef %37, i32 noundef 35714, ptr noundef nonnull %3)
  %38 = load i32, ptr %3, align 4, !tbaa !14
  %39 = icmp eq i32 %38, 0
  br i1 %39, label %49, label %79

.lr.ph32:                                         ; preds = %._crit_edge, %.lr.ph32
  %40 = phi i64 [ %46, %.lr.ph32 ], [ 0, %._crit_edge ]
  %.01630 = phi i32 [ %45, %.lr.ph32 ], [ 0, %._crit_edge ]
  %41 = load ptr, ptr @__glewDetachShader, align 8, !tbaa !10
  %42 = load i32, ptr %0, align 4, !tbaa !5
  %43 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt6vectorIN5tdogl6ShaderESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef %40) #7
  %44 = tail call noundef i32 @_ZNK5tdogl6Shader6objectEv(ptr noundef nonnull align 8 dereferenceable(16) %43)
  tail call void %41(i32 noundef %42, i32 noundef %44)
  %45 = add i32 %.01630, 1
  %46 = zext i32 %45 to i64
  %47 = tail call noundef i64 @_ZNKSt6vectorIN5tdogl6ShaderESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #7
  %48 = icmp ugt i64 %47, %46
  br i1 %48, label %.lr.ph32, label %._crit_edge33, !llvm.loop !15

49:                                               ; preds = %._crit_edge33
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #7
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #7
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull @.str.2, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %50 unwind label %69

50:                                               ; preds = %49
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  %51 = load ptr, ptr @__glewGetProgramiv, align 8, !tbaa !10
  %52 = load i32, ptr %0, align 4, !tbaa !5
  invoke void %51(i32 noundef %52, i32 noundef 35716, ptr noundef nonnull %6)
          to label %53 unwind label %71

53:                                               ; preds = %50
  %54 = load i32, ptr %6, align 4, !tbaa !14
  %55 = add nsw i32 %54, 1
  %56 = sext i32 %55 to i64
  %57 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %56) #9
          to label %58 unwind label %73

58:                                               ; preds = %53
  %59 = load ptr, ptr @__glewGetProgramInfoLog, align 8, !tbaa !10
  %60 = load i32, ptr %0, align 4, !tbaa !5
  invoke void %59(i32 noundef %60, i32 noundef %54, ptr noundef null, ptr noundef nonnull %57)
          to label %61 unwind label %73

61:                                               ; preds = %58
  %62 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull %57)
          to label %63 unwind label %73

63:                                               ; preds = %61
  call void @_ZdaPv(ptr noundef nonnull %57) #10
  %64 = load ptr, ptr @__glewDeleteProgram, align 8, !tbaa !10
  %65 = load i32, ptr %0, align 4, !tbaa !5
  invoke void %64(i32 noundef %65)
          to label %66 unwind label %73

66:                                               ; preds = %63
  store i32 0, ptr %0, align 4, !tbaa !5
  %67 = call ptr @__cxa_allocate_exception(i64 16) #7
  invoke void @_ZNSt13runtime_errorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16) %67, ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %68 unwind label %75

68:                                               ; preds = %66
  invoke void @__cxa_throw(ptr nonnull %67, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #8
          to label %81 unwind label %73

69:                                               ; preds = %49
  %70 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #7
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #7
  br label %78

71:                                               ; preds = %50
  %72 = landingpad { ptr, i32 }
          cleanup
  br label %77

73:                                               ; preds = %68, %63, %61, %58, %53
  %74 = landingpad { ptr, i32 }
          cleanup
  br label %77

75:                                               ; preds = %66
  %76 = landingpad { ptr, i32 }
          cleanup
  call void @__cxa_free_exception(ptr %67) #7
  br label %77

77:                                               ; preds = %73, %75, %71
  %.pn.pn = phi { ptr, i32 } [ %72, %71 ], [ %74, %73 ], [ %76, %75 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #7
  br label %78

78:                                               ; preds = %77, %69
  %.pn.pn.pn = phi { ptr, i32 } [ %.pn.pn, %77 ], [ %70, %69 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  br label %80

79:                                               ; preds = %._crit_edge33
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  ret void

80:                                               ; preds = %78, %22, %12
  %.pn27 = phi { ptr, i32 } [ %13, %12 ], [ %23, %22 ], [ %.pn.pn.pn, %78 ]
  resume { ptr, i32 } %.pn27

81:                                               ; preds = %68
  unreachable
}

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

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

declare void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #2

declare i32 @__gxx_personality_v0(...)

declare void @__cxa_free_exception(ptr) local_unnamed_addr

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

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

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

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

declare noundef i32 @_ZNK5tdogl6Shader6objectEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef, ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #0 align 2

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEPKc(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) local_unnamed_addr #0 align 2

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

declare void @_ZNSt13runtime_errorC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #2

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

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

attributes #0 = { 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 #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 = { "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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #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 = { noreturn }
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, !7, i64 0}
!6 = !{!"_ZTSN5tdogl7ProgramE", !7, i64 0}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !13}


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