; LLVM IR from blat-blatnik/Painted-Portal-Ray-Tracing :: src/graphics.ll (Z16loadTextureArrayPPKcjj)

; 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"

@.str.3 = external hidden unnamed_addr constant [90 x i8], align 1
@glad_glGetError = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [2 x i8], align 1
@glad_glGenTextures = external global ptr, align 8
@.str.16 = external hidden unnamed_addr constant [4 x i8], align 1
@glad_glTexParameteri = external global ptr, align 8
@.str.17 = external hidden unnamed_addr constant [7 x i8], align 1
@__PRETTY_FUNCTION__._Z16loadTextureArrayPPKcjj = external hidden unnamed_addr constant [71 x i8], align 1
@glad_glTexStorage3D = external global ptr, align 8
@glad_glTexSubImage3D = external global ptr, align 8
@.str.19 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [12 x i8], align 1
@__func__._Z16loadTextureArrayPPKcjj = external hidden unnamed_addr constant [17 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @stbi_image_free(ptr noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local ptr @stbi_load(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) #1

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

declare i32 @printf(ptr noundef, ...) #4

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z16loadTextureArrayPPKcjj(ptr noundef %0, i32 noundef %1, i32 noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !9
  store i32 %2, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = getelementptr inbounds ptr, ptr %18, i64 0
  %20 = load ptr, ptr %19, align 8, !tbaa !5
  %21 = call ptr @stbi_load(ptr noundef %20, ptr noundef %7, ptr noundef %8, ptr noundef %9, i32 noundef 4)
  store ptr %21, ptr %10, align 8, !tbaa !5
  %22 = load ptr, ptr %10, align 8, !tbaa !5
  %23 = icmp ne ptr %22, null
  br i1 %23, label %24, label %25

24:                                               ; preds = %3
  br label %27

25:                                               ; preds = %3
  call void @__assert_fail(ptr noundef @.str.17, ptr noundef @.str.3, i32 noundef 114, ptr noundef @__PRETTY_FUNCTION__._Z16loadTextureArrayPPKcjj) #6
  unreachable

26:                                               ; No predecessors!
  br label %27

27:                                               ; preds = %26, %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %28 = load ptr, ptr @glad_glGenTextures, align 8, !tbaa !5
  call void %28(i32 noundef 1, ptr noundef %11)
  %29 = load i32, ptr %11, align 4, !tbaa !9
  %30 = icmp ne i32 %29, 0
  br i1 %30, label %31, label %32

31:                                               ; preds = %27
  br label %34

32:                                               ; preds = %27
  call void @__assert_fail(ptr noundef @.str.16, ptr noundef @.str.3, i32 noundef 118, ptr noundef @__PRETTY_FUNCTION__._Z16loadTextureArrayPPKcjj) #6
  unreachable

33:                                               ; No predecessors!
  br label %34

34:                                               ; preds = %33, %31
  %35 = load i32, ptr %11, align 4, !tbaa !9
  call void @_Z16bindTextureArrayjj(i32 noundef %35, i32 noundef 0)
  %36 = load ptr, ptr @glad_glTexStorage3D, align 8, !tbaa !5
  %37 = load i32, ptr %6, align 4, !tbaa !9
  %38 = load i32, ptr %7, align 4, !tbaa !9
  %39 = load i32, ptr %8, align 4, !tbaa !9
  %40 = load i32, ptr %5, align 4, !tbaa !9
  call void %36(i32 noundef 35866, i32 noundef 1, i32 noundef %37, i32 noundef %38, i32 noundef %39, i32 noundef %40)
  %41 = load ptr, ptr @glad_glTexSubImage3D, align 8, !tbaa !5
  %42 = load i32, ptr %7, align 4, !tbaa !9
  %43 = load i32, ptr %8, align 4, !tbaa !9
  %44 = load ptr, ptr %10, align 8, !tbaa !5
  call void %41(i32 noundef 35866, i32 noundef 0, i32 noundef 0, i32 noundef 0, i32 noundef 0, i32 noundef %42, i32 noundef %43, i32 noundef 1, i32 noundef 6408, i32 noundef 5121, ptr noundef %44)
  %45 = load ptr, ptr %10, align 8, !tbaa !5
  call void @stbi_image_free(ptr noundef %45)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 1, ptr %12, align 4, !tbaa !9
  br label %46

46:                                               ; preds = %84, %34
  %47 = load i32, ptr %12, align 4, !tbaa !9
  %48 = load i32, ptr %5, align 4, !tbaa !9
  %49 = icmp ult i32 %47, %48
  br i1 %49, label %51, label %50

50:                                               ; preds = %46
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %87

51:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = load i32, ptr %12, align 4, !tbaa !9
  %54 = zext i32 %53 to i64
  %55 = getelementptr inbounds ptr, ptr %52, i64 %54
  %56 = load ptr, ptr %55, align 8, !tbaa !5
  %57 = call ptr @stbi_load(ptr noundef %56, ptr noundef %13, ptr noundef %14, ptr noundef %15, i32 noundef 4)
  store ptr %57, ptr %10, align 8, !tbaa !5
  %58 = load ptr, ptr %10, align 8, !tbaa !5
  %59 = icmp ne ptr %58, null
  br i1 %59, label %60, label %61

60:                                               ; preds = %51
  br label %63

61:                                               ; preds = %51
  call void @__assert_fail(ptr noundef @.str.17, ptr noundef @.str.3, i32 noundef 130, ptr noundef @__PRETTY_FUNCTION__._Z16loadTextureArrayPPKcjj) #6
  unreachable

62:                                               ; No predecessors!
  br label %63

63:                                               ; preds = %62, %60
  %64 = load i32, ptr %13, align 4, !tbaa !9
  %65 = load i32, ptr %7, align 4, !tbaa !9
  %66 = icmp eq i32 %64, %65
  br i1 %66, label %67, label %68

67:                                               ; preds = %63
  br label %70

68:                                               ; preds = %63
  call void @__assert_fail(ptr noundef @.str.19, ptr noundef @.str.3, i32 noundef 131, ptr noundef @__PRETTY_FUNCTION__._Z16loadTextureArrayPPKcjj) #6
  unreachable

69:                                               ; No predecessors!
  br label %70

70:                                               ; preds = %69, %67
  %71 = load i32, ptr %14, align 4, !tbaa !9
  %72 = load i32, ptr %8, align 4, !tbaa !9
  %73 = icmp eq i32 %71, %72
  br i1 %73, label %74, label %75

74:                                               ; preds = %70
  br label %77

75:                                               ; preds = %70
  call void @__assert_fail(ptr noundef @.str.20, ptr noundef @.str.3, i32 noundef 132, ptr noundef @__PRETTY_FUNCTION__._Z16loadTextureArrayPPKcjj) #6
  unreachable

76:                                               ; No predecessors!
  br label %77

77:                                               ; preds = %76, %74
  %78 = load ptr, ptr @glad_glTexSubImage3D, align 8, !tbaa !5
  %79 = load i32, ptr %12, align 4, !tbaa !9
  %80 = load i32, ptr %7, align 4, !tbaa !9
  %81 = load i32, ptr %8, align 4, !tbaa !9
  %82 = load ptr, ptr %10, align 8, !tbaa !5
  call void %78(i32 noundef 35866, i32 noundef 0, i32 noundef 0, i32 noundef 0, i32 noundef %79, i32 noundef %80, i32 noundef %81, i32 noundef 1, i32 noundef 6408, i32 noundef 5121, ptr noundef %82)
  %83 = load ptr, ptr %10, align 8, !tbaa !5
  call void @stbi_image_free(ptr noundef %83)
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %84

84:                                               ; preds = %77
  %85 = load i32, ptr %12, align 4, !tbaa !9
  %86 = add i32 %85, 1
  store i32 %86, ptr %12, align 4, !tbaa !9
  br label %46, !llvm.loop !11

87:                                               ; preds = %50
  %88 = load ptr, ptr @glad_glTexParameteri, align 8, !tbaa !5
  call void %88(i32 noundef 35866, i32 noundef 10241, i32 noundef 9729)
  %89 = load ptr, ptr @glad_glTexParameteri, align 8, !tbaa !5
  call void %89(i32 noundef 35866, i32 noundef 10240, i32 noundef 9729)
  %90 = load ptr, ptr @glad_glTexParameteri, align 8, !tbaa !5
  call void %90(i32 noundef 35866, i32 noundef 10242, i32 noundef 10497)
  %91 = load ptr, ptr @glad_glTexParameteri, align 8, !tbaa !5
  call void %91(i32 noundef 35866, i32 noundef 10243, i32 noundef 10497)
  br label %92

92:                                               ; preds = %87
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %93 = load ptr, ptr @glad_glGetError, align 8, !tbaa !5
  %94 = call i32 %93()
  store i32 %94, ptr %16, align 4, !tbaa !9
  %95 = load i32, ptr %16, align 4, !tbaa !9
  %96 = icmp ne i32 %95, 0
  br i1 %96, label %97, label %111

97:                                               ; preds = %92
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %98 = load i32, ptr %16, align 4, !tbaa !9
  switch i32 %98, label %106 [
    i32 1280, label %99
    i32 1281, label %100
    i32 1282, label %101
    i32 1283, label %102
    i32 1284, label %103
    i32 1285, label %104
    i32 1286, label %105
  ]

99:                                               ; preds = %97
  store ptr @.str.4, ptr %17, align 8, !tbaa !5
  br label %107

100:                                              ; preds = %97
  store ptr @.str.5, ptr %17, align 8, !tbaa !5
  br label %107

101:                                              ; preds = %97
  store ptr @.str.6, ptr %17, align 8, !tbaa !5
  br label %107

102:                                              ; preds = %97
  store ptr @.str.7, ptr %17, align 8, !tbaa !5
  br label %107

103:                                              ; preds = %97
  store ptr @.str.8, ptr %17, align 8, !tbaa !5
  br label %107

104:                                              ; preds = %97
  store ptr @.str.9, ptr %17, align 8, !tbaa !5
  br label %107

105:                                              ; preds = %97
  store ptr @.str.10, ptr %17, align 8, !tbaa !5
  br label %107

106:                                              ; preds = %97
  store ptr @.str.11, ptr %17, align 8, !tbaa !5
  br label %107

107:                                              ; preds = %106, %105, %104, %103, %102, %101, %100, %99
  %108 = load i32, ptr %16, align 4, !tbaa !9
  %109 = load ptr, ptr %17, align 8, !tbaa !5
  %110 = call i32 (ptr, ...) @printf(ptr noundef @.str.12, i32 noundef %108, ptr noundef %109, ptr noundef @.str.3, i32 noundef 143, ptr noundef @__func__._Z16loadTextureArrayPPKcjj)
  call void @__assert_fail(ptr noundef @.str.13, ptr noundef @.str.3, i32 noundef 143, ptr noundef @__PRETTY_FUNCTION__._Z16loadTextureArrayPPKcjj) #6
  unreachable

111:                                              ; preds = %92
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %112

112:                                              ; preds = %111
  br label %113

113:                                              ; preds = %112
  %114 = load i32, ptr %11, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  ret i32 %114
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z16bindTextureArrayjj(i32 noundef, i32 noundef) #1

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

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

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


; 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"

@.str.3 = external hidden unnamed_addr constant [90 x i8], align 1
@glad_glGetError = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [2 x i8], align 1
@glad_glGenTextures = external local_unnamed_addr global ptr, align 8
@.str.16 = external hidden unnamed_addr constant [4 x i8], align 1
@glad_glTexParameteri = external local_unnamed_addr global ptr, align 8
@.str.17 = external hidden unnamed_addr constant [7 x i8], align 1
@__PRETTY_FUNCTION__._Z16loadTextureArrayPPKcjj = external hidden unnamed_addr constant [71 x i8], align 1
@glad_glTexStorage3D = external local_unnamed_addr global ptr, align 8
@glad_glTexSubImage3D = external local_unnamed_addr global ptr, align 8
@.str.19 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [12 x i8], align 1
@__func__._Z16loadTextureArrayPPKcjj = external hidden unnamed_addr constant [17 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @stbi_image_free(ptr noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local ptr @stbi_load(ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z16loadTextureArrayPPKcjj(ptr nocapture noundef readonly %0, i32 noundef %1, i32 noundef %2) local_unnamed_addr #1 {
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  %11 = load ptr, ptr %0, align 8, !tbaa !5
  %12 = call ptr @stbi_load(ptr noundef %11, ptr noundef nonnull %4, ptr noundef nonnull %5, ptr noundef nonnull %6, i32 noundef 4)
  %.not = icmp eq ptr %12, null
  br i1 %.not, label %13, label %14

13:                                               ; preds = %3
  call void @__assert_fail(ptr noundef nonnull @.str.17, ptr noundef nonnull @.str.3, i32 noundef 114, ptr noundef nonnull @__PRETTY_FUNCTION__._Z16loadTextureArrayPPKcjj) #6
  unreachable

14:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #5
  %15 = load ptr, ptr @glad_glGenTextures, align 8, !tbaa !5
  call void %15(i32 noundef 1, ptr noundef nonnull %7)
  %16 = load i32, ptr %7, align 4, !tbaa !9
  %.not25 = icmp eq i32 %16, 0
  br i1 %.not25, label %17, label %18

17:                                               ; preds = %14
  call void @__assert_fail(ptr noundef nonnull @.str.16, ptr noundef nonnull @.str.3, i32 noundef 118, ptr noundef nonnull @__PRETTY_FUNCTION__._Z16loadTextureArrayPPKcjj) #6
  unreachable

18:                                               ; preds = %14
  call void @_Z16bindTextureArrayjj(i32 noundef %16, i32 noundef 0)
  %19 = load ptr, ptr @glad_glTexStorage3D, align 8, !tbaa !5
  %20 = load i32, ptr %4, align 4, !tbaa !9
  %21 = load i32, ptr %5, align 4, !tbaa !9
  call void %19(i32 noundef 35866, i32 noundef 1, i32 noundef %2, i32 noundef %20, i32 noundef %21, i32 noundef %1)
  %22 = load ptr, ptr @glad_glTexSubImage3D, align 8, !tbaa !5
  %23 = load i32, ptr %4, align 4, !tbaa !9
  %24 = load i32, ptr %5, align 4, !tbaa !9
  call void %22(i32 noundef 35866, i32 noundef 0, i32 noundef 0, i32 noundef 0, i32 noundef 0, i32 noundef %23, i32 noundef %24, i32 noundef 1, i32 noundef 6408, i32 noundef 5121, ptr noundef nonnull %12)
  call void @stbi_image_free(ptr noundef nonnull %12)
  %25 = icmp ugt i32 %1, 1
  br i1 %25, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %18
  %wide.trip.count = zext i32 %1 to i64
  br label %.lr.ph

._crit_edge:                                      ; preds = %46, %18
  %26 = load ptr, ptr @glad_glTexParameteri, align 8, !tbaa !5
  call void %26(i32 noundef 35866, i32 noundef 10241, i32 noundef 9729)
  %27 = load ptr, ptr @glad_glTexParameteri, align 8, !tbaa !5
  call void %27(i32 noundef 35866, i32 noundef 10240, i32 noundef 9729)
  %28 = load ptr, ptr @glad_glTexParameteri, align 8, !tbaa !5
  call void %28(i32 noundef 35866, i32 noundef 10242, i32 noundef 10497)
  %29 = load ptr, ptr @glad_glTexParameteri, align 8, !tbaa !5
  call void %29(i32 noundef 35866, i32 noundef 10243, i32 noundef 10497)
  %30 = load ptr, ptr @glad_glGetError, align 8, !tbaa !5
  %31 = call i32 %30()
  switch i32 %31, label %55 [
    i32 0, label %58
    i32 1280, label %56
    i32 1281, label %49
    i32 1282, label %50
    i32 1283, label %51
    i32 1284, label %52
    i32 1285, label %53
    i32 1286, label %54
  ]

.lr.ph:                                           ; preds = %.lr.ph.preheader, %46
  %indvars.iv = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next, %46 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %10) #5
  %32 = getelementptr inbounds ptr, ptr %0, i64 %indvars.iv
  %33 = load ptr, ptr %32, align 8, !tbaa !5
  %34 = call ptr @stbi_load(ptr noundef %33, ptr noundef nonnull %8, ptr noundef nonnull %9, ptr noundef nonnull %10, i32 noundef 4)
  %.not27 = icmp eq ptr %34, null
  br i1 %.not27, label %35, label %36

35:                                               ; preds = %.lr.ph
  call void @__assert_fail(ptr noundef nonnull @.str.17, ptr noundef nonnull @.str.3, i32 noundef 130, ptr noundef nonnull @__PRETTY_FUNCTION__._Z16loadTextureArrayPPKcjj) #6
  unreachable

36:                                               ; preds = %.lr.ph
  %37 = load i32, ptr %8, align 4, !tbaa !9
  %38 = load i32, ptr %4, align 4, !tbaa !9
  %39 = icmp eq i32 %37, %38
  br i1 %39, label %41, label %40

40:                                               ; preds = %36
  call void @__assert_fail(ptr noundef nonnull @.str.19, ptr noundef nonnull @.str.3, i32 noundef 131, ptr noundef nonnull @__PRETTY_FUNCTION__._Z16loadTextureArrayPPKcjj) #6
  unreachable

41:                                               ; preds = %36
  %42 = load i32, ptr %9, align 4, !tbaa !9
  %43 = load i32, ptr %5, align 4, !tbaa !9
  %44 = icmp eq i32 %42, %43
  br i1 %44, label %46, label %45

45:                                               ; preds = %41
  call void @__assert_fail(ptr noundef nonnull @.str.20, ptr noundef nonnull @.str.3, i32 noundef 132, ptr noundef nonnull @__PRETTY_FUNCTION__._Z16loadTextureArrayPPKcjj) #6
  unreachable

46:                                               ; preds = %41
  %47 = load ptr, ptr @glad_glTexSubImage3D, align 8, !tbaa !5
  %48 = trunc nuw i64 %indvars.iv to i32
  call void %47(i32 noundef 35866, i32 noundef 0, i32 noundef 0, i32 noundef 0, i32 noundef %48, i32 noundef %37, i32 noundef %42, i32 noundef 1, i32 noundef 6408, i32 noundef 5121, ptr noundef nonnull %34)
  call void @stbi_image_free(ptr noundef nonnull %34)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !11

49:                                               ; preds = %._crit_edge
  br label %56

50:                                               ; preds = %._crit_edge
  br label %56

51:                                               ; preds = %._crit_edge
  br label %56

52:                                               ; preds = %._crit_edge
  br label %56

53:                                               ; preds = %._crit_edge
  br label %56

54:                                               ; preds = %._crit_edge
  br label %56

55:                                               ; preds = %._crit_edge
  br label %56

56:                                               ; preds = %._crit_edge, %55, %54, %53, %52, %51, %50, %49
  %.0 = phi ptr [ @.str.11, %55 ], [ @.str.10, %54 ], [ @.str.9, %53 ], [ @.str.8, %52 ], [ @.str.7, %51 ], [ @.str.6, %50 ], [ @.str.5, %49 ], [ @.str.4, %._crit_edge ]
  %57 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12, i32 noundef %31, ptr noundef nonnull %.0, ptr noundef nonnull @.str.3, i32 noundef 143, ptr noundef nonnull @__func__._Z16loadTextureArrayPPKcjj)
  call void @__assert_fail(ptr noundef nonnull @.str.13, ptr noundef nonnull @.str.3, i32 noundef 143, ptr noundef nonnull @__PRETTY_FUNCTION__._Z16loadTextureArrayPPKcjj) #6
  unreachable

58:                                               ; preds = %._crit_edge
  %59 = load i32, ptr %7, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  ret i32 %59
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z16bindTextureArrayjj(i32 noundef, i32 noundef) local_unnamed_addr #1

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

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

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


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