; LLVM IR from steps3d/graphics-book :: Code/Core (Texture)

; 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.Data = type { ptr, ptr, i32, i32 }
%class.Texture = type { i32, i32, i32, i32, i32, i8, i32, %"class.std::__cxx11::basic_string" }
%"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] }
%struct.DDS_header = type { i32, i32, i32, i32, i32, i32, i32, i32, [11 x i32], %struct.anon, %struct.anon.0, i32 }
%struct.anon = type { i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.anon.0 = type { i32, i32, i32, i32 }

@__glewGenerateMipmap = external global ptr, align 8

declare i32 @__gxx_personality_v0(...)

declare void @glTexParameteri(i32 noundef, i32 noundef, i32 noundef) #0

declare void @glGenTextures(i32 noundef, ptr noundef) #0

declare void @glBindTexture(i32 noundef, i32 noundef) #0

declare void @glTexImage2D(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) #0

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

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

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

declare void @glTexParameterf(i32 noundef, i32 noundef, float noundef) #0

declare void @_ZN4DataC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN7Texture14loadCubemapHdrERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(64) %0, ptr noundef nonnull align 8 dereferenceable(32) %1) #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %class.Data, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %14 = load ptr, ptr %4, align 8
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds %class.Texture, ptr %14, i32 0, i32 7
  %17 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %16, ptr noundef nonnull align 8 dereferenceable(32) %15)
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #5
  %18 = getelementptr inbounds %class.Texture, ptr %14, i32 0, i32 7
  call void @_ZN4DataC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(32) %18)
  %19 = invoke noundef i32 @_ZNK4Data9getLengthEv(ptr noundef nonnull align 8 dereferenceable(24) %6)
          to label %20 unwind label %24

20:                                               ; preds = %2
  %21 = sext i32 %19 to i64
  %22 = icmp ult i64 %21, 128
  br i1 %22, label %23, label %28

23:                                               ; preds = %20
  store i1 false, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %192

24:                                               ; preds = %2
  %25 = landingpad { ptr, i32 }
          cleanup
  %26 = extractvalue { ptr, i32 } %25, 0
  store ptr %26, ptr %7, align 8
  %27 = extractvalue { ptr, i32 } %25, 1
  store i32 %27, ptr %8, align 4
  br label %194

28:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %29 = invoke noundef ptr @_ZNK4Data6getPtrEv(ptr noundef nonnull align 8 dereferenceable(24) %6)
          to label %30 unwind label %36

30:                                               ; preds = %28
  store ptr %29, ptr %10, align 8, !tbaa !5
  %31 = load ptr, ptr %10, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.DDS_header, ptr %31, i32 0, i32 0
  %33 = load i32, ptr %32, align 4, !tbaa !9
  %34 = icmp ne i32 %33, 542327876
  br i1 %34, label %35, label %40

35:                                               ; preds = %30
  store i1 false, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %190

36:                                               ; preds = %28
  %37 = landingpad { ptr, i32 }
          cleanup
  %38 = extractvalue { ptr, i32 } %37, 0
  store ptr %38, ptr %7, align 8
  %39 = extractvalue { ptr, i32 } %37, 1
  store i32 %39, ptr %8, align 4
  br label %191

40:                                               ; preds = %30
  %41 = load ptr, ptr %10, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.DDS_header, ptr %41, i32 0, i32 1
  %43 = load i32, ptr %42, align 4, !tbaa !14
  %44 = icmp ne i32 %43, 124
  br i1 %44, label %45, label %46

45:                                               ; preds = %40
  store i1 false, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %190

46:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 4103, ptr %11, align 4, !tbaa !15
  %47 = load ptr, ptr %10, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.DDS_header, ptr %47, i32 0, i32 2
  %49 = load i32, ptr %48, align 4, !tbaa !16
  %50 = load i32, ptr %11, align 4, !tbaa !15
  %51 = and i32 %49, %50
  %52 = load i32, ptr %11, align 4, !tbaa !15
  %53 = icmp ne i32 %51, %52
  br i1 %53, label %54, label %55

54:                                               ; preds = %46
  store i1 false, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %189

55:                                               ; preds = %46
  %56 = load ptr, ptr %10, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.DDS_header, ptr %56, i32 0, i32 9
  %58 = getelementptr inbounds %struct.anon, ptr %57, i32 0, i32 0
  %59 = load i32, ptr %58, align 4, !tbaa !17
  %60 = icmp ne i32 %59, 32
  br i1 %60, label %61, label %62

61:                                               ; preds = %55
  store i1 false, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %189

62:                                               ; preds = %55
  store i32 68, ptr %11, align 4, !tbaa !15
  %63 = load ptr, ptr %10, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.DDS_header, ptr %63, i32 0, i32 9
  %65 = getelementptr inbounds %struct.anon, ptr %64, i32 0, i32 1
  %66 = load i32, ptr %65, align 4, !tbaa !18
  %67 = load i32, ptr %11, align 4, !tbaa !15
  %68 = and i32 %66, %67
  %69 = icmp eq i32 %68, 0
  br i1 %69, label %70, label %71

70:                                               ; preds = %62
  store i1 false, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %189

71:                                               ; preds = %62
  %72 = load ptr, ptr %10, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.DDS_header, ptr %72, i32 0, i32 10
  %74 = getelementptr inbounds %struct.anon.0, ptr %73, i32 0, i32 0
  %75 = load i32, ptr %74, align 4, !tbaa !19
  %76 = and i32 %75, 4096
  %77 = icmp eq i32 %76, 0
  br i1 %77, label %78, label %79

78:                                               ; preds = %71
  store i1 false, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %189

79:                                               ; preds = %71
  %80 = load ptr, ptr %10, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.DDS_header, ptr %80, i32 0, i32 10
  %82 = getelementptr inbounds %struct.anon.0, ptr %81, i32 0, i32 1
  %83 = load i32, ptr %82, align 4, !tbaa !20
  %84 = and i32 %83, 512
  %85 = icmp eq i32 %84, 0
  br i1 %85, label %86, label %87

86:                                               ; preds = %79
  store i1 false, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %189

87:                                               ; preds = %79
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #5
  %88 = load ptr, ptr %10, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.DDS_header, ptr %88, i64 1
  store ptr %89, ptr %12, align 8, !tbaa !5
  %90 = load ptr, ptr %10, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.DDS_header, ptr %90, i32 0, i32 9
  %92 = getelementptr inbounds %struct.anon, ptr %91, i32 0, i32 2
  %93 = load i32, ptr %92, align 4, !tbaa !21
  %94 = icmp eq i32 %93, 113
  br i1 %94, label %95, label %148

95:                                               ; preds = %87
  %96 = getelementptr inbounds %class.Texture, ptr %14, i32 0, i32 1
  store i32 34067, ptr %96, align 4, !tbaa !22
  %97 = load ptr, ptr %10, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.DDS_header, ptr %97, i32 0, i32 4
  %99 = load i32, ptr %98, align 4, !tbaa !28
  %100 = getelementptr inbounds %class.Texture, ptr %14, i32 0, i32 2
  store i32 %99, ptr %100, align 8, !tbaa !29
  %101 = load ptr, ptr %10, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.DDS_header, ptr %101, i32 0, i32 3
  %103 = load i32, ptr %102, align 4, !tbaa !30
  %104 = getelementptr inbounds %class.Texture, ptr %14, i32 0, i32 3
  store i32 %103, ptr %104, align 4, !tbaa !31
  %105 = getelementptr inbounds %class.Texture, ptr %14, i32 0, i32 4
  store i32 1, ptr %105, align 8, !tbaa !32
  %106 = getelementptr inbounds %class.Texture, ptr %14, i32 0, i32 0
  invoke void @glGenTextures(i32 noundef 1, ptr noundef %106)
          to label %107 unwind label %117

107:                                              ; preds = %95
  %108 = getelementptr inbounds %class.Texture, ptr %14, i32 0, i32 1
  %109 = load i32, ptr %108, align 4, !tbaa !22
  %110 = getelementptr inbounds %class.Texture, ptr %14, i32 0, i32 0
  %111 = load i32, ptr %110, align 8, !tbaa !33
  invoke void @glBindTexture(i32 noundef %109, i32 noundef %111)
          to label %112 unwind label %117

112:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !15
  br label %113

113:                                              ; preds = %140, %112
  %114 = load i32, ptr %13, align 4, !tbaa !15
  %115 = icmp slt i32 %114, 6
  br i1 %115, label %121, label %116

116:                                              ; preds = %113
  store i32 2, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %147

117:                                              ; preds = %184, %180, %177, %173, %170, %161, %154, %151, %148, %107, %95
  %118 = landingpad { ptr, i32 }
          cleanup
  %119 = extractvalue { ptr, i32 } %118, 0
  store ptr %119, ptr %7, align 8
  %120 = extractvalue { ptr, i32 } %118, 1
  store i32 %120, ptr %8, align 4
  br label %188

121:                                              ; preds = %113
  %122 = load i32, ptr %13, align 4, !tbaa !15
  %123 = add nsw i32 34069, %122
  %124 = getelementptr inbounds %class.Texture, ptr %14, i32 0, i32 2
  %125 = load i32, ptr %124, align 8, !tbaa !29
  %126 = getelementptr inbounds %class.Texture, ptr %14, i32 0, i32 3
  %127 = load i32, ptr %126, align 4, !tbaa !31
  %128 = load ptr, ptr %12, align 8, !tbaa !5
  %129 = load i32, ptr %13, align 4, !tbaa !15
  %130 = mul nsw i32 %129, 2
  %131 = getelementptr inbounds %class.Texture, ptr %14, i32 0, i32 2
  %132 = load i32, ptr %131, align 8, !tbaa !29
  %133 = mul nsw i32 %130, %132
  %134 = getelementptr inbounds %class.Texture, ptr %14, i32 0, i32 3
  %135 = load i32, ptr %134, align 4, !tbaa !31
  %136 = mul nsw i32 %133, %135
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds i8, ptr %128, i64 %137
  invoke void @glTexImage2D(i32 noundef %123, i32 noundef 0, i32 noundef 34842, i32 noundef %125, i32 noundef %127, i32 noundef 0, i32 noundef 6408, i32 noundef 5131, ptr noundef %138)
          to label %139 unwind label %143

139:                                              ; preds = %121
  br label %140

140:                                              ; preds = %139
  %141 = load i32, ptr %13, align 4, !tbaa !15
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %13, align 4, !tbaa !15
  br label %113, !llvm.loop !34

143:                                              ; preds = %121
  %144 = landingpad { ptr, i32 }
          cleanup
  %145 = extractvalue { ptr, i32 } %144, 0
  store ptr %145, ptr %7, align 8
  %146 = extractvalue { ptr, i32 } %144, 1
  store i32 %146, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %188

147:                                              ; preds = %116
  br label %148

148:                                              ; preds = %147, %87
  %149 = getelementptr inbounds %class.Texture, ptr %14, i32 0, i32 1
  %150 = load i32, ptr %149, align 4, !tbaa !22
  invoke void @glTexParameterf(i32 noundef %150, i32 noundef 10242, float noundef 3.307100e+04)
          to label %151 unwind label %117

151:                                              ; preds = %148
  %152 = getelementptr inbounds %class.Texture, ptr %14, i32 0, i32 1
  %153 = load i32, ptr %152, align 4, !tbaa !22
  invoke void @glTexParameterf(i32 noundef %153, i32 noundef 10243, float noundef 3.307100e+04)
          to label %154 unwind label %117

154:                                              ; preds = %151
  %155 = getelementptr inbounds %class.Texture, ptr %14, i32 0, i32 1
  %156 = load i32, ptr %155, align 4, !tbaa !22
  invoke void @glTexParameteri(i32 noundef %156, i32 noundef 32882, i32 noundef 33071)
          to label %157 unwind label %117

157:                                              ; preds = %154
  %158 = getelementptr inbounds %class.Texture, ptr %14, i32 0, i32 5
  %159 = load i8, ptr %158, align 4, !tbaa !36, !range !37, !noundef !38
  %160 = trunc i8 %159 to i1
  br i1 %160, label %161, label %166

161:                                              ; preds = %157
  %162 = load ptr, ptr @__glewGenerateMipmap, align 8, !tbaa !5
  %163 = getelementptr inbounds %class.Texture, ptr %14, i32 0, i32 1
  %164 = load i32, ptr %163, align 4, !tbaa !22
  invoke void %162(i32 noundef %164)
          to label %165 unwind label %117

165:                                              ; preds = %161
  br label %166

166:                                              ; preds = %165, %157
  %167 = getelementptr inbounds %class.Texture, ptr %14, i32 0, i32 5
  %168 = load i8, ptr %167, align 4, !tbaa !36, !range !37, !noundef !38
  %169 = trunc i8 %168 to i1
  br i1 %169, label %170, label %177

170:                                              ; preds = %166
  %171 = getelementptr inbounds %class.Texture, ptr %14, i32 0, i32 1
  %172 = load i32, ptr %171, align 4, !tbaa !22
  invoke void @glTexParameteri(i32 noundef %172, i32 noundef 10241, i32 noundef 9987)
          to label %173 unwind label %117

173:                                              ; preds = %170
  %174 = getelementptr inbounds %class.Texture, ptr %14, i32 0, i32 1
  %175 = load i32, ptr %174, align 4, !tbaa !22
  invoke void @glTexParameteri(i32 noundef %175, i32 noundef 10240, i32 noundef 9729)
          to label %176 unwind label %117

176:                                              ; preds = %173
  br label %184

177:                                              ; preds = %166
  %178 = getelementptr inbounds %class.Texture, ptr %14, i32 0, i32 1
  %179 = load i32, ptr %178, align 4, !tbaa !22
  invoke void @glTexParameteri(i32 noundef %179, i32 noundef 10241, i32 noundef 9729)
          to label %180 unwind label %117

180:                                              ; preds = %177
  %181 = getelementptr inbounds %class.Texture, ptr %14, i32 0, i32 1
  %182 = load i32, ptr %181, align 4, !tbaa !22
  invoke void @glTexParameteri(i32 noundef %182, i32 noundef 10240, i32 noundef 9729)
          to label %183 unwind label %117

183:                                              ; preds = %180
  br label %184

184:                                              ; preds = %183, %176
  %185 = getelementptr inbounds %class.Texture, ptr %14, i32 0, i32 1
  %186 = load i32, ptr %185, align 4, !tbaa !22
  invoke void @glBindTexture(i32 noundef %186, i32 noundef 0)
          to label %187 unwind label %117

187:                                              ; preds = %184
  store i1 true, ptr %3, align 1
  store i32 1, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  br label %189

188:                                              ; preds = %143, %117
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %191

189:                                              ; preds = %187, %86, %78, %70, %61, %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %190

190:                                              ; preds = %189, %45, %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %192

191:                                              ; preds = %188, %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %194

192:                                              ; preds = %190, %23
  call void @_ZN4DataD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #5
  %193 = load i1, ptr %3, align 1
  ret i1 %193

194:                                              ; preds = %191, %24
  call void @_ZN4DataD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #5
  br label %195

195:                                              ; preds = %194
  %196 = load ptr, ptr %7, align 8
  %197 = load i32, ptr %8, align 4
  %198 = insertvalue { ptr, i32 } poison, ptr %196, 0
  %199 = insertvalue { ptr, i32 } %198, i32 %197, 1
  resume { ptr, i32 } %199
}

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 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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = !{!"_ZTS10DDS_header", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !7, i64 32, !12, i64 76, !13, i64 108, !11, i64 124}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTSN10DDS_headerUt_E", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28}
!13 = !{!"_ZTSN10DDS_headerUt0_E", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12}
!14 = !{!10, !11, i64 4}
!15 = !{!11, !11, i64 0}
!16 = !{!10, !11, i64 8}
!17 = !{!10, !11, i64 76}
!18 = !{!10, !11, i64 80}
!19 = !{!10, !11, i64 108}
!20 = !{!10, !11, i64 112}
!21 = !{!10, !11, i64 84}
!22 = !{!23, !11, i64 4}
!23 = !{!"_ZTS7Texture", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !24, i64 20, !11, i64 24, !25, i64 32}
!24 = !{!"bool", !7, i64 0}
!25 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !26, i64 0, !27, i64 8, !7, i64 16}
!26 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!27 = !{!"long", !7, i64 0}
!28 = !{!10, !11, i64 16}
!29 = !{!23, !11, i64 8}
!30 = !{!10, !11, i64 12}
!31 = !{!23, !11, i64 12}
!32 = !{!23, !11, i64 16}
!33 = !{!23, !11, i64 0}
!34 = distinct !{!34, !35}
!35 = !{!"llvm.loop.mustprogress"}
!36 = !{!23, !24, i64 20}
!37 = !{i8 0, i8 2}
!38 = !{}


; 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.Data = type { ptr, ptr, i32, i32 }

@__glewGenerateMipmap = external local_unnamed_addr global ptr, align 8

declare i32 @__gxx_personality_v0(...)

declare void @glTexParameteri(i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

declare void @glGenTextures(i32 noundef, ptr noundef) local_unnamed_addr #0

declare void @glBindTexture(i32 noundef, i32 noundef) local_unnamed_addr #0

declare void @glTexImage2D(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

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

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

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

declare void @glTexParameterf(i32 noundef, i32 noundef, float noundef) local_unnamed_addr #0

declare void @_ZN4DataC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN7Texture14loadCubemapHdrERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(64) %0, ptr noundef nonnull align 8 dereferenceable(32) %1) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %class.Data, align 8
  %4 = getelementptr inbounds i8, ptr %0, i64 32
  %5 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSERKS4_(ptr noundef nonnull align 8 dereferenceable(32) %4, ptr noundef nonnull align 8 dereferenceable(32) %1)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #5
  call void @_ZN4DataC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(32) %4)
  %6 = call noundef i32 @_ZNK4Data9getLengthEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  %7 = icmp ult i32 %6, 128
  br i1 %7, label %108, label %8

8:                                                ; preds = %2
  %9 = call noundef ptr @_ZNK4Data6getPtrEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  %10 = load i32, ptr %9, align 4, !tbaa !5
  %.not = icmp eq i32 %10, 542327876
  br i1 %.not, label %11, label %108

11:                                               ; preds = %8
  %12 = getelementptr inbounds i8, ptr %9, i64 4
  %13 = load i32, ptr %12, align 4, !tbaa !12
  %.not26 = icmp eq i32 %13, 124
  br i1 %.not26, label %14, label %108

14:                                               ; preds = %11
  %15 = getelementptr inbounds i8, ptr %9, i64 8
  %16 = load i32, ptr %15, align 4, !tbaa !13
  %17 = and i32 %16, 4103
  %.not27 = icmp eq i32 %17, 4103
  br i1 %.not27, label %18, label %108

18:                                               ; preds = %14
  %19 = getelementptr inbounds i8, ptr %9, i64 76
  %20 = load i32, ptr %19, align 4, !tbaa !14
  %.not28 = icmp eq i32 %20, 32
  br i1 %.not28, label %21, label %108

21:                                               ; preds = %18
  %22 = getelementptr inbounds i8, ptr %9, i64 80
  %23 = load i32, ptr %22, align 4, !tbaa !15
  %24 = and i32 %23, 68
  %25 = icmp eq i32 %24, 0
  br i1 %25, label %108, label %26

26:                                               ; preds = %21
  %27 = getelementptr inbounds i8, ptr %9, i64 108
  %28 = load i32, ptr %27, align 4, !tbaa !16
  %29 = and i32 %28, 4096
  %30 = icmp eq i32 %29, 0
  br i1 %30, label %108, label %31

31:                                               ; preds = %26
  %32 = getelementptr inbounds i8, ptr %9, i64 112
  %33 = load i32, ptr %32, align 4, !tbaa !17
  %34 = and i32 %33, 512
  %35 = icmp eq i32 %34, 0
  br i1 %35, label %108, label %36

36:                                               ; preds = %31
  %37 = getelementptr inbounds i8, ptr %9, i64 128
  %38 = getelementptr inbounds i8, ptr %9, i64 84
  %39 = load i32, ptr %38, align 4, !tbaa !18
  %40 = icmp eq i32 %39, 113
  br i1 %40, label %41, label %.loopexit

41:                                               ; preds = %36
  %42 = getelementptr inbounds i8, ptr %0, i64 4
  store i32 34067, ptr %42, align 4, !tbaa !19
  %43 = getelementptr inbounds i8, ptr %0, i64 8
  %44 = getelementptr inbounds i8, ptr %9, i64 12
  %45 = getelementptr inbounds i8, ptr %0, i64 12
  %46 = load <2 x i32>, ptr %44, align 4, !tbaa !26
  %47 = shufflevector <2 x i32> %46, <2 x i32> poison, <2 x i32> <i32 1, i32 0>
  store <2 x i32> %47, ptr %43, align 8, !tbaa !26
  %48 = getelementptr inbounds i8, ptr %0, i64 16
  store i32 1, ptr %48, align 8, !tbaa !27
  invoke void @glGenTextures(i32 noundef 1, ptr noundef nonnull %0)
          to label %49 unwind label %54

49:                                               ; preds = %41
  %50 = load i32, ptr %42, align 4, !tbaa !19
  %51 = load i32, ptr %0, align 8, !tbaa !28
  invoke void @glBindTexture(i32 noundef %50, i32 noundef %51)
          to label %.preheader.preheader unwind label %54

.preheader.preheader:                             ; preds = %49
  %52 = load i32, ptr %43, align 8, !tbaa !29
  %53 = load i32, ptr %45, align 4, !tbaa !30
  invoke void @glTexImage2D(i32 noundef 34069, i32 noundef 0, i32 noundef 34842, i32 noundef %52, i32 noundef %53, i32 noundef 0, i32 noundef 6408, i32 noundef 5131, ptr noundef nonnull %37)
          to label %.preheader.1 unwind label %86

54:                                               ; preds = %.invoke31, %.invoke, %105, %98, %92, %90, %.loopexit, %49, %41
  %55 = landingpad { ptr, i32 }
          cleanup
  br label %107

.preheader.1:                                     ; preds = %.preheader.preheader
  %56 = load i32, ptr %43, align 8, !tbaa !29
  %57 = load i32, ptr %45, align 4, !tbaa !30
  %58 = shl nsw i32 %56, 1
  %59 = mul nsw i32 %58, %57
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds i8, ptr %37, i64 %60
  invoke void @glTexImage2D(i32 noundef 34070, i32 noundef 0, i32 noundef 34842, i32 noundef %56, i32 noundef %57, i32 noundef 0, i32 noundef 6408, i32 noundef 5131, ptr noundef nonnull %61)
          to label %.preheader.2 unwind label %86

.preheader.2:                                     ; preds = %.preheader.1
  %62 = load i32, ptr %43, align 8, !tbaa !29
  %63 = load i32, ptr %45, align 4, !tbaa !30
  %64 = shl nsw i32 %62, 2
  %65 = mul nsw i32 %64, %63
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds i8, ptr %37, i64 %66
  invoke void @glTexImage2D(i32 noundef 34071, i32 noundef 0, i32 noundef 34842, i32 noundef %62, i32 noundef %63, i32 noundef 0, i32 noundef 6408, i32 noundef 5131, ptr noundef nonnull %67)
          to label %.preheader.3 unwind label %86

.preheader.3:                                     ; preds = %.preheader.2
  %68 = load i32, ptr %43, align 8, !tbaa !29
  %69 = load i32, ptr %45, align 4, !tbaa !30
  %70 = mul nsw i32 %68, 6
  %71 = mul nsw i32 %70, %69
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds i8, ptr %37, i64 %72
  invoke void @glTexImage2D(i32 noundef 34072, i32 noundef 0, i32 noundef 34842, i32 noundef %68, i32 noundef %69, i32 noundef 0, i32 noundef 6408, i32 noundef 5131, ptr noundef nonnull %73)
          to label %.preheader.4 unwind label %86

.preheader.4:                                     ; preds = %.preheader.3
  %74 = load i32, ptr %43, align 8, !tbaa !29
  %75 = load i32, ptr %45, align 4, !tbaa !30
  %76 = shl nsw i32 %74, 3
  %77 = mul nsw i32 %76, %75
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds i8, ptr %37, i64 %78
  invoke void @glTexImage2D(i32 noundef 34073, i32 noundef 0, i32 noundef 34842, i32 noundef %74, i32 noundef %75, i32 noundef 0, i32 noundef 6408, i32 noundef 5131, ptr noundef nonnull %79)
          to label %.preheader.5 unwind label %86

.preheader.5:                                     ; preds = %.preheader.4
  %80 = load i32, ptr %43, align 8, !tbaa !29
  %81 = load i32, ptr %45, align 4, !tbaa !30
  %82 = mul nsw i32 %80, 10
  %83 = mul nsw i32 %82, %81
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds i8, ptr %37, i64 %84
  invoke void @glTexImage2D(i32 noundef 34074, i32 noundef 0, i32 noundef 34842, i32 noundef %80, i32 noundef %81, i32 noundef 0, i32 noundef 6408, i32 noundef 5131, ptr noundef nonnull %85)
          to label %.loopexit unwind label %86

86:                                               ; preds = %.preheader.5, %.preheader.4, %.preheader.3, %.preheader.2, %.preheader.1, %.preheader.preheader
  %87 = landingpad { ptr, i32 }
          cleanup
  br label %107

.loopexit:                                        ; preds = %.preheader.5, %36
  %88 = getelementptr inbounds i8, ptr %0, i64 4
  %89 = load i32, ptr %88, align 4, !tbaa !19
  invoke void @glTexParameterf(i32 noundef %89, i32 noundef 10242, float noundef 3.307100e+04)
          to label %90 unwind label %54

90:                                               ; preds = %.loopexit
  %91 = load i32, ptr %88, align 4, !tbaa !19
  invoke void @glTexParameterf(i32 noundef %91, i32 noundef 10243, float noundef 3.307100e+04)
          to label %92 unwind label %54

92:                                               ; preds = %90
  %93 = load i32, ptr %88, align 4, !tbaa !19
  invoke void @glTexParameteri(i32 noundef %93, i32 noundef 32882, i32 noundef 33071)
          to label %94 unwind label %54

94:                                               ; preds = %92
  %95 = getelementptr inbounds i8, ptr %0, i64 20
  %96 = load i8, ptr %95, align 4, !tbaa !31, !range !32, !noundef !33
  %97 = trunc nuw i8 %96 to i1
  br i1 %97, label %98, label %.invoke31

98:                                               ; preds = %94
  %99 = load ptr, ptr @__glewGenerateMipmap, align 8, !tbaa !34
  %100 = load i32, ptr %88, align 4, !tbaa !19
  invoke void %99(i32 noundef %100)
          to label %._crit_edge unwind label %54

._crit_edge:                                      ; preds = %98
  %.pre = load i8, ptr %95, align 4, !tbaa !31, !range !32
  br label %.invoke31

.invoke31:                                        ; preds = %._crit_edge, %94
  %101 = phi i8 [ %.pre, %._crit_edge ], [ %96, %94 ]
  %102 = trunc nuw i8 %101 to i1
  %103 = load i32, ptr %88, align 4, !tbaa !19
  %. = select i1 %102, i32 9987, i32 9729
  invoke void @glTexParameteri(i32 noundef %103, i32 noundef 10241, i32 noundef %.)
          to label %.invoke unwind label %54

.invoke:                                          ; preds = %.invoke31
  %104 = load i32, ptr %88, align 4, !tbaa !19
  invoke void @glTexParameteri(i32 noundef %104, i32 noundef 10240, i32 noundef 9729)
          to label %105 unwind label %54

105:                                              ; preds = %.invoke
  %106 = load i32, ptr %88, align 4, !tbaa !19
  invoke void @glBindTexture(i32 noundef %106, i32 noundef 0)
          to label %108 unwind label %54

107:                                              ; preds = %86, %54
  %.pn = phi { ptr, i32 } [ %87, %86 ], [ %55, %54 ]
  call void @_ZN4DataD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #5
  resume { ptr, i32 } %.pn

108:                                              ; preds = %8, %11, %105, %31, %26, %21, %18, %14, %2
  %.2 = phi i1 [ false, %2 ], [ false, %8 ], [ false, %11 ], [ false, %14 ], [ false, %18 ], [ false, %21 ], [ false, %26 ], [ false, %31 ], [ true, %105 ]
  call void @_ZN4DataD1Ev(ptr noundef nonnull align 8 dereferenceable(24) %3) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #5
  ret i1 %.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 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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { 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 = !{!"_ZTS10DDS_header", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !8, i64 32, !10, i64 76, !11, i64 108, !7, i64 124}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN10DDS_headerUt_E", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28}
!11 = !{!"_ZTSN10DDS_headerUt0_E", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12}
!12 = !{!6, !7, i64 4}
!13 = !{!6, !7, i64 8}
!14 = !{!6, !7, i64 76}
!15 = !{!6, !7, i64 80}
!16 = !{!6, !7, i64 108}
!17 = !{!6, !7, i64 112}
!18 = !{!6, !7, i64 84}
!19 = !{!20, !7, i64 4}
!20 = !{!"_ZTS7Texture", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !21, i64 20, !7, i64 24, !22, i64 32}
!21 = !{!"bool", !8, i64 0}
!22 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !23, i64 0, !25, i64 8, !8, i64 16}
!23 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !24, i64 0}
!24 = !{!"any pointer", !8, i64 0}
!25 = !{!"long", !8, i64 0}
!26 = !{!7, !7, i64 0}
!27 = !{!20, !7, i64 16}
!28 = !{!20, !7, i64 0}
!29 = !{!20, !7, i64 8}
!30 = !{!20, !7, i64 12}
!31 = !{!20, !21, i64 20}
!32 = !{i8 0, i8 2}
!33 = !{}
!34 = !{!24, !24, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass