; LLVM IR from santa01/graphene :: src (ImageTexture)

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

@_ZN8Graphene15glTexParameteriE = external global ptr, align 8
@.str = external hidden unnamed_addr constant [34 x i8], align 1
@_ZN8Graphene13glGetIntegervE = external global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [78 x i8], align 1
@_ZTVN8Graphene16ImageCubeTextureE = external dso_local unnamed_addr constant { [4 x ptr] }, align 8

declare noundef i32 @_ZNK8Graphene5Image8getWidthEv(ptr noundef nonnull align 8 dereferenceable(32)) #0

declare noundef i32 @_ZNK8Graphene5Image9getHeightEv(ptr noundef nonnull align 8 dereferenceable(32)) #0

declare i32 @__gxx_personality_v0(...)

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

declare noundef nonnull align 8 dereferenceable(64) ptr @_ZN8Graphene12EngineConfig11getInstanceEv() #0

declare noundef i32 @_ZNK8Graphene12EngineConfig13getAnisotropyEv(ptr noundef nonnull align 8 dereferenceable(64)) #0

declare noundef zeroext i1 @_ZN8Graphene6OpenGL20isExtensionSupportedERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32)) #0

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 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 #3 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #4

declare noundef nonnull align 4 dereferenceable(4) ptr @_ZN8Graphene6Logger11getInstanceEv() #0

declare void @_ZN8Graphene6Logger7logLineENS_8LogLevelEPKciS3_z(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8Graphene16ImageCubeTextureC2ERKSt5arrayISt10shared_ptrINS_5ImageEELm6EE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(96) %1) unnamed_addr #3 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 %"class.std::__cxx11::basic_string", align 8
  %9 = alloca i1, align 1
  %10 = alloca %"class.std::allocator", align 1
  %11 = alloca i1, align 1
  %12 = alloca i1, align 1
  %13 = alloca i1, align 1
  %14 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %15 = load ptr, ptr %3, align 8
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt5arrayISt10shared_ptrIN8Graphene5ImageEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(96) %16, i64 noundef 0) #6
  %18 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN8Graphene5ImageELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %17) #6
  %19 = call noundef i32 @_ZNK8Graphene5Image8getWidthEv(ptr noundef nonnull align 8 dereferenceable(32) %18)
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt5arrayISt10shared_ptrIN8Graphene5ImageEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(96) %20, i64 noundef 0) #6
  %22 = call noundef ptr @_ZNKSt19__shared_ptr_accessIN8Graphene5ImageELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %21) #6
  %23 = call noundef i32 @_ZNK8Graphene5Image9getHeightEv(ptr noundef nonnull align 8 dereferenceable(32) %22)
  call void @_ZN8Graphene22TextureCubeMapTemplateILj35907ELi4EEC2Eii(ptr noundef nonnull align 8 dereferenceable(24) %15, i32 noundef %19, i32 noundef %23)
  store ptr getelementptr inbounds inrange(-16, 16) ({ [4 x ptr] }, ptr @_ZTVN8Graphene16ImageCubeTextureE, i32 0, i32 0, i32 2), ptr %15, align 8, !tbaa !9
  %24 = load ptr, ptr @_ZN8Graphene15glTexParameteriE, align 8, !tbaa !5
  %25 = getelementptr inbounds %"class.Graphene::Texture", ptr %15, i32 0, i32 3
  %26 = load i32, ptr %25, align 8, !tbaa !11
  invoke void %24(i32 noundef %26, i32 noundef 10241, i32 noundef 9987)
          to label %27 unwind label %66

27:                                               ; preds = %2
  %28 = load ptr, ptr @_ZN8Graphene15glTexParameteriE, align 8, !tbaa !5
  %29 = getelementptr inbounds %"class.Graphene::Texture", ptr %15, i32 0, i32 3
  %30 = load i32, ptr %29, align 8, !tbaa !11
  invoke void %28(i32 noundef %30, i32 noundef 10240, i32 noundef 9729)
          to label %31 unwind label %66

31:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %32 = invoke noundef nonnull align 8 dereferenceable(64) ptr @_ZN8Graphene12EngineConfig11getInstanceEv()
          to label %33 unwind label %70

33:                                               ; preds = %31
  %34 = invoke noundef i32 @_ZNK8Graphene12EngineConfig13getAnisotropyEv(ptr noundef nonnull align 8 dereferenceable(64) %32)
          to label %35 unwind label %70

35:                                               ; preds = %33
  store i32 %34, ptr %7, align 4, !tbaa !14
  %36 = load i32, ptr %7, align 4, !tbaa !14
  %37 = icmp sgt i32 %36, 0
  store i1 false, ptr %9, align 1
  store i1 false, ptr %11, align 1
  store i1 false, ptr %12, align 1
  store i1 false, ptr %13, align 1
  br i1 %37, label %38, label %42

38:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 32, ptr %8) #6
  store i1 true, ptr %9, align 1
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #6
  store i1 true, ptr %11, align 1
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #6
  store i1 true, ptr %12, align 1
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %8, ptr noundef @.str, ptr noundef nonnull align 1 dereferenceable(1) %10)
          to label %39 unwind label %74

39:                                               ; preds = %38
  store i1 true, ptr %13, align 1
  %40 = invoke noundef zeroext i1 @_ZN8Graphene6OpenGL20isExtensionSupportedERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %8)
          to label %41 unwind label %78

41:                                               ; preds = %39
  br label %42

42:                                               ; preds = %41, %35
  %43 = phi i1 [ false, %35 ], [ %40, %41 ]
  %44 = load i1, ptr %13, align 1
  br i1 %44, label %45, label %46

45:                                               ; preds = %42
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #6
  br label %46

46:                                               ; preds = %45, %42
  %47 = load i1, ptr %12, align 1
  br i1 %47, label %48, label %49

48:                                               ; preds = %46
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #6
  br label %49

49:                                               ; preds = %48, %46
  %50 = load i1, ptr %11, align 1
  br i1 %50, label %51, label %52

51:                                               ; preds = %49
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #6
  br label %52

52:                                               ; preds = %51, %49
  %53 = load i1, ptr %9, align 1
  br i1 %53, label %54, label %55

54:                                               ; preds = %52
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #6
  br label %55

55:                                               ; preds = %54, %52
  br i1 %43, label %56, label %99

56:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  %57 = load ptr, ptr @_ZN8Graphene13glGetIntegervE, align 8, !tbaa !5
  invoke void %57(i32 noundef 34047, ptr noundef %14)
          to label %58 unwind label %95

58:                                               ; preds = %56
  %59 = load ptr, ptr @_ZN8Graphene15glTexParameteriE, align 8, !tbaa !5
  %60 = getelementptr inbounds %"class.Graphene::Texture", ptr %15, i32 0, i32 3
  %61 = load i32, ptr %60, align 8, !tbaa !11
  %62 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %14)
          to label %63 unwind label %95

63:                                               ; preds = %58
  %64 = load i32, ptr %62, align 4, !tbaa !14
  invoke void %59(i32 noundef %61, i32 noundef 34046, i32 noundef %64)
          to label %65 unwind label %95

65:                                               ; preds = %63
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %103

66:                                               ; preds = %27, %2
  %67 = landingpad { ptr, i32 }
          cleanup
  %68 = extractvalue { ptr, i32 } %67, 0
  store ptr %68, ptr %5, align 8
  %69 = extractvalue { ptr, i32 } %67, 1
  store i32 %69, ptr %6, align 4
  br label %107

70:                                               ; preds = %103, %101, %99, %33, %31
  %71 = landingpad { ptr, i32 }
          cleanup
  %72 = extractvalue { ptr, i32 } %71, 0
  store ptr %72, ptr %5, align 8
  %73 = extractvalue { ptr, i32 } %71, 1
  store i32 %73, ptr %6, align 4
  br label %106

74:                                               ; preds = %38
  %75 = landingpad { ptr, i32 }
          cleanup
  %76 = extractvalue { ptr, i32 } %75, 0
  store ptr %76, ptr %5, align 8
  %77 = extractvalue { ptr, i32 } %75, 1
  store i32 %77, ptr %6, align 4
  br label %85

78:                                               ; preds = %39
  %79 = landingpad { ptr, i32 }
          cleanup
  %80 = extractvalue { ptr, i32 } %79, 0
  store ptr %80, ptr %5, align 8
  %81 = extractvalue { ptr, i32 } %79, 1
  store i32 %81, ptr %6, align 4
  %82 = load i1, ptr %13, align 1
  br i1 %82, label %83, label %84

83:                                               ; preds = %78
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %8) #6
  br label %84

84:                                               ; preds = %83, %78
  br label %85

85:                                               ; preds = %84, %74
  %86 = load i1, ptr %12, align 1
  br i1 %86, label %87, label %88

87:                                               ; preds = %85
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %10) #6
  br label %88

88:                                               ; preds = %87, %85
  %89 = load i1, ptr %11, align 1
  br i1 %89, label %90, label %91

90:                                               ; preds = %88
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #6
  br label %91

91:                                               ; preds = %90, %88
  %92 = load i1, ptr %9, align 1
  br i1 %92, label %93, label %94

93:                                               ; preds = %91
  call void @llvm.lifetime.end.p0(i64 32, ptr %8) #6
  br label %94

94:                                               ; preds = %93, %91
  br label %106

95:                                               ; preds = %63, %58, %56
  %96 = landingpad { ptr, i32 }
          cleanup
  %97 = extractvalue { ptr, i32 } %96, 0
  store ptr %97, ptr %5, align 8
  %98 = extractvalue { ptr, i32 } %96, 1
  store i32 %98, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %106

99:                                               ; preds = %55
  %100 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN8Graphene6Logger11getInstanceEv()
          to label %101 unwind label %70

101:                                              ; preds = %99
  invoke void (ptr, i32, ptr, i32, ptr, ...) @_ZN8Graphene6Logger7logLineENS_8LogLevelEPKciS3_z(ptr noundef nonnull align 4 dereferenceable(4) %100, i32 noundef 1, ptr noundef @.str.1, i32 noundef 67, ptr noundef @.str.2)
          to label %102 unwind label %70

102:                                              ; preds = %101
  br label %103

103:                                              ; preds = %102, %65
  %104 = load ptr, ptr %4, align 8, !tbaa !5
  invoke void @_ZN8Graphene16ImageCubeTexture6updateERKSt5arrayISt10shared_ptrINS_5ImageEELm6EE(ptr noundef nonnull align 8 dereferenceable(24) %15, ptr noundef nonnull align 8 dereferenceable(96) %104)
          to label %105 unwind label %70

105:                                              ; preds = %103
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  ret void

106:                                              ; preds = %95, %94, %70
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %107

107:                                              ; preds = %106, %66
  call void @_ZN8Graphene7TextureD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %15) #6
  br label %108

108:                                              ; preds = %107
  %109 = load ptr, ptr %5, align 8
  %110 = load i32, ptr %6, align 4
  %111 = insertvalue { ptr, i32 } poison, ptr %109, 0
  %112 = insertvalue { ptr, i32 } %111, i32 %110, 1
  resume { ptr, i32 } %112
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8Graphene22TextureCubeMapTemplateILj35907ELi4EEC2Eii(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8Graphene16ImageCubeTexture6updateERKSt5arrayISt10shared_ptrINS_5ImageEELm6EE(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(96)) #3 align 2

; Function Attrs: nounwind
declare void @_ZN8Graphene7TextureD2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #5

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

attributes #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { 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 #5 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !13, i64 16}
!12 = !{!"_ZTSN8Graphene7TextureE", !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20}
!13 = !{!"int", !7, i64 0}
!14 = !{!13, !13, 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.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::allocator" = type { i8 }

@_ZN8Graphene15glTexParameteriE = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [34 x i8], align 1
@_ZN8Graphene13glGetIntegervE = external local_unnamed_addr global ptr, align 8
@.str.1 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [78 x i8], align 1
@_ZTVN8Graphene16ImageCubeTextureE = external dso_local unnamed_addr constant { [4 x ptr] }, align 8

declare noundef i32 @_ZNK8Graphene5Image8getWidthEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0

declare noundef i32 @_ZNK8Graphene5Image9getHeightEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0

declare i32 @__gxx_personality_v0(...)

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

declare noundef nonnull align 8 dereferenceable(64) ptr @_ZN8Graphene12EngineConfig11getInstanceEv() local_unnamed_addr #0

declare noundef i32 @_ZNK8Graphene12EngineConfig13getAnisotropyEv(ptr noundef nonnull align 8 dereferenceable(64)) local_unnamed_addr #0

declare noundef zeroext i1 @_ZN8Graphene6OpenGL20isExtensionSupportedERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #2 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 #3 align 2

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

declare noundef nonnull align 4 dereferenceable(4) ptr @_ZN8Graphene6Logger11getInstanceEv() local_unnamed_addr #0

declare void @_ZN8Graphene6Logger7logLineENS_8LogLevelEPKciS3_z(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8Graphene16ImageCubeTextureC2ERKSt5arrayISt10shared_ptrINS_5ImageEELm6EE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(96) %1) unnamed_addr #3 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", align 1
  %6 = alloca i32, align 4
  %7 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt5arrayISt10shared_ptrIN8Graphene5ImageEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(96) %1, i64 noundef 0) #6
  %8 = tail call noundef ptr @_ZNKSt19__shared_ptr_accessIN8Graphene5ImageELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %7) #6
  %9 = tail call noundef i32 @_ZNK8Graphene5Image8getWidthEv(ptr noundef nonnull align 8 dereferenceable(32) %8)
  %10 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt5arrayISt10shared_ptrIN8Graphene5ImageEELm6EEixEm(ptr noundef nonnull align 8 dereferenceable(96) %1, i64 noundef 0) #6
  %11 = tail call noundef ptr @_ZNKSt19__shared_ptr_accessIN8Graphene5ImageELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEptEv(ptr noundef nonnull align 1 dereferenceable(1) %10) #6
  %12 = tail call noundef i32 @_ZNK8Graphene5Image9getHeightEv(ptr noundef nonnull align 8 dereferenceable(32) %11)
  tail call void @_ZN8Graphene22TextureCubeMapTemplateILj35907ELi4EEC2Eii(ptr noundef nonnull align 8 dereferenceable(24) %0, i32 noundef %9, i32 noundef %12)
  store ptr getelementptr inbounds inrange(-16, 16) (i8, ptr @_ZTVN8Graphene16ImageCubeTextureE, i64 16), ptr %0, align 8, !tbaa !5
  %13 = load ptr, ptr @_ZN8Graphene15glTexParameteriE, align 8, !tbaa !8
  %14 = getelementptr inbounds i8, ptr %0, i64 16
  %15 = load i32, ptr %14, align 8, !tbaa !11
  invoke void %13(i32 noundef %15, i32 noundef 10241, i32 noundef 9987)
          to label %16 unwind label %36

16:                                               ; preds = %2
  %17 = load ptr, ptr @_ZN8Graphene15glTexParameteriE, align 8, !tbaa !8
  %18 = load i32, ptr %14, align 8, !tbaa !11
  invoke void %17(i32 noundef %18, i32 noundef 10240, i32 noundef 9729)
          to label %19 unwind label %36

19:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #6
  %20 = invoke noundef nonnull align 8 dereferenceable(64) ptr @_ZN8Graphene12EngineConfig11getInstanceEv()
          to label %21 unwind label %38

21:                                               ; preds = %19
  %22 = invoke noundef i32 @_ZNK8Graphene12EngineConfig13getAnisotropyEv(ptr noundef nonnull align 8 dereferenceable(64) %20)
          to label %23 unwind label %38

23:                                               ; preds = %21
  store i32 %22, ptr %3, align 4, !tbaa !14
  %24 = icmp sgt i32 %22, 0
  br i1 %24, label %25, label %.critedge25.thread

25:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %4) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #6
  call void @_ZNSaIcEC2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  invoke void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2IS3_EEPKcRKS3_(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull @.str, ptr noundef nonnull align 1 dereferenceable(1) %5)
          to label %26 unwind label %40

26:                                               ; preds = %25
  %27 = invoke noundef zeroext i1 @_ZN8Graphene6OpenGL20isExtensionSupportedERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(32) %4)
          to label %.critedge25 unwind label %42

.critedge25:                                      ; preds = %26
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #6
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #6
  br i1 %27, label %28, label %.critedge25.thread

28:                                               ; preds = %.critedge25
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #6
  %29 = load ptr, ptr @_ZN8Graphene13glGetIntegervE, align 8, !tbaa !8
  invoke void %29(i32 noundef 34047, ptr noundef nonnull %6)
          to label %30 unwind label %45

30:                                               ; preds = %28
  %31 = load ptr, ptr @_ZN8Graphene15glTexParameteriE, align 8, !tbaa !8
  %32 = load i32, ptr %14, align 8, !tbaa !11
  %33 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %34 = load i32, ptr %33, align 4, !tbaa !14
  invoke void %31(i32 noundef %32, i32 noundef 34046, i32 noundef %34)
          to label %35 unwind label %45

35:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  br label %49

36:                                               ; preds = %16, %2
  %37 = landingpad { ptr, i32 }
          cleanup
  br label %52

38:                                               ; preds = %49, %48, %.critedge25.thread, %21, %19
  %39 = landingpad { ptr, i32 }
          cleanup
  br label %51

40:                                               ; preds = %25
  %41 = landingpad { ptr, i32 }
          cleanup
  br label %44

42:                                               ; preds = %26
  %43 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %4) #6
  br label %44

44:                                               ; preds = %40, %42
  %.pn = phi { ptr, i32 } [ %43, %42 ], [ %41, %40 ]
  call void @_ZNSt15__new_allocatorIcED2Ev(ptr noundef nonnull align 1 dereferenceable(1) %5) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #6
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %4) #6
  br label %51

45:                                               ; preds = %30, %28
  %46 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #6
  br label %51

.critedge25.thread:                               ; preds = %23, %.critedge25
  %47 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZN8Graphene6Logger11getInstanceEv()
          to label %48 unwind label %38

48:                                               ; preds = %.critedge25.thread
  invoke void (ptr, i32, ptr, i32, ptr, ...) @_ZN8Graphene6Logger7logLineENS_8LogLevelEPKciS3_z(ptr noundef nonnull align 4 dereferenceable(4) %47, i32 noundef 1, ptr noundef nonnull @.str.1, i32 noundef 67, ptr noundef nonnull @.str.2)
          to label %49 unwind label %38

49:                                               ; preds = %48, %35
  invoke void @_ZN8Graphene16ImageCubeTexture6updateERKSt5arrayISt10shared_ptrINS_5ImageEELm6EE(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(96) %1)
          to label %50 unwind label %38

50:                                               ; preds = %49
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  ret void

51:                                               ; preds = %44, %45, %38
  %.pn21 = phi { ptr, i32 } [ %39, %38 ], [ %46, %45 ], [ %.pn, %44 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #6
  br label %52

52:                                               ; preds = %51, %36
  %.pn21.pn = phi { ptr, i32 } [ %.pn21, %51 ], [ %37, %36 ]
  call void @_ZN8Graphene7TextureD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #6
  resume { ptr, i32 } %.pn21.pn
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8Graphene22TextureCubeMapTemplateILj35907ELi4EEC2Eii(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8Graphene16ImageCubeTexture6updateERKSt5arrayISt10shared_ptrINS_5ImageEELm6EE(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(96)) local_unnamed_addr #3 align 2

; Function Attrs: nounwind
declare void @_ZN8Graphene7TextureD2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #5

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

attributes #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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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 #4 = { 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 #5 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !13, i64 16}
!12 = !{!"_ZTSN8Graphene7TextureE", !13, i64 8, !13, i64 12, !13, i64 16, !13, i64 20}
!13 = !{!"int", !10, i64 0}
!14 = !{!13, !13, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,SROAPass,SimplifyCFGPass,TailCallElimPass