; LLVM IR from danginsburg/opengles3-book :: Chapter_14/ParticleSystemTransformFeedback (Noise3D)

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

; Function Attrs: nounwind uwtable
declare dso_local void @initNoiseTable() #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: nounwind uwtable
declare dso_local float @noise3D(ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @Create3DNoiseTexture(i32 noundef %0, float noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca float, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca float, align 4
  %13 = alloca float, align 4
  %14 = alloca float, align 4
  %15 = alloca float, align 4
  %16 = alloca [3 x float], align 4
  %17 = alloca float, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store float %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = mul i64 4, %19
  %21 = load i32, ptr %3, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = mul i64 %20, %22
  %24 = load i32, ptr %3, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = mul i64 %23, %25
  %27 = call noalias ptr @malloc(i64 noundef %26) #6
  store ptr %27, ptr %6, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %28 = load i32, ptr %3, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = mul i64 1, %29
  %31 = load i32, ptr %3, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = mul i64 %30, %32
  %34 = load i32, ptr %3, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = mul i64 %33, %35
  %37 = call noalias ptr @malloc(i64 noundef %36) #6
  store ptr %37, ptr %7, align 8, !tbaa !11
  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 4, ptr %10) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store float 1.000000e+03, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store float -1.000000e+03, ptr %13, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  call void @initNoiseTable()
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %110, %2
  %39 = load i32, ptr %10, align 4, !tbaa !5
  %40 = load i32, ptr %3, align 4, !tbaa !5
  %41 = icmp slt i32 %39, %40
  br i1 %41, label %42, label %113

42:                                               ; preds = %38
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %106, %42
  %44 = load i32, ptr %9, align 4, !tbaa !5
  %45 = load i32, ptr %3, align 4, !tbaa !5
  %46 = icmp slt i32 %44, %45
  br i1 %46, label %47, label %109

47:                                               ; preds = %43
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %48

48:                                               ; preds = %102, %47
  %49 = load i32, ptr %8, align 4, !tbaa !5
  %50 = load i32, ptr %3, align 4, !tbaa !5
  %51 = icmp slt i32 %49, %50
  br i1 %51, label %52, label %105

52:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 12, ptr %16) #5
  %53 = load i32, ptr %8, align 4, !tbaa !5
  %54 = sitofp i32 %53 to float
  %55 = load i32, ptr %3, align 4, !tbaa !5
  %56 = sitofp i32 %55 to float
  %57 = fdiv float %54, %56
  store float %57, ptr %16, align 4, !tbaa !9
  %58 = getelementptr inbounds float, ptr %16, i64 1
  %59 = load i32, ptr %9, align 4, !tbaa !5
  %60 = sitofp i32 %59 to float
  %61 = load i32, ptr %3, align 4, !tbaa !5
  %62 = sitofp i32 %61 to float
  %63 = fdiv float %60, %62
  store float %63, ptr %58, align 4, !tbaa !9
  %64 = getelementptr inbounds float, ptr %16, i64 2
  %65 = load i32, ptr %10, align 4, !tbaa !5
  %66 = sitofp i32 %65 to float
  %67 = load i32, ptr %3, align 4, !tbaa !5
  %68 = sitofp i32 %67 to float
  %69 = fdiv float %66, %68
  store float %69, ptr %64, align 4, !tbaa !9
  %70 = load float, ptr %4, align 4, !tbaa !9
  %71 = getelementptr inbounds [3 x float], ptr %16, i64 0, i64 0
  %72 = load float, ptr %71, align 4, !tbaa !9
  %73 = fmul float %72, %70
  store float %73, ptr %71, align 4, !tbaa !9
  %74 = load float, ptr %4, align 4, !tbaa !9
  %75 = getelementptr inbounds [3 x float], ptr %16, i64 0, i64 1
  %76 = load float, ptr %75, align 4, !tbaa !9
  %77 = fmul float %76, %74
  store float %77, ptr %75, align 4, !tbaa !9
  %78 = load float, ptr %4, align 4, !tbaa !9
  %79 = getelementptr inbounds [3 x float], ptr %16, i64 0, i64 2
  %80 = load float, ptr %79, align 4, !tbaa !9
  %81 = fmul float %80, %78
  store float %81, ptr %79, align 4, !tbaa !9
  %82 = getelementptr inbounds [3 x float], ptr %16, i64 0, i64 0
  %83 = call float @noise3D(ptr noundef %82)
  store float %83, ptr %15, align 4, !tbaa !9
  %84 = load float, ptr %15, align 4, !tbaa !9
  %85 = load float, ptr %12, align 4, !tbaa !9
  %86 = fcmp olt float %84, %85
  br i1 %86, label %87, label %89

87:                                               ; preds = %52
  %88 = load float, ptr %15, align 4, !tbaa !9
  store float %88, ptr %12, align 4, !tbaa !9
  br label %89

89:                                               ; preds = %87, %52
  %90 = load float, ptr %15, align 4, !tbaa !9
  %91 = load float, ptr %13, align 4, !tbaa !9
  %92 = fcmp ogt float %90, %91
  br i1 %92, label %93, label %95

93:                                               ; preds = %89
  %94 = load float, ptr %15, align 4, !tbaa !9
  store float %94, ptr %13, align 4, !tbaa !9
  br label %95

95:                                               ; preds = %93, %89
  %96 = load float, ptr %15, align 4, !tbaa !9
  %97 = load ptr, ptr %6, align 8, !tbaa !11
  %98 = load i32, ptr %11, align 4, !tbaa !5
  %99 = add nsw i32 %98, 1
  store i32 %99, ptr %11, align 4, !tbaa !5
  %100 = sext i32 %98 to i64
  %101 = getelementptr inbounds float, ptr %97, i64 %100
  store float %96, ptr %101, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 12, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  br label %102

102:                                              ; preds = %95
  %103 = load i32, ptr %8, align 4, !tbaa !5
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %8, align 4, !tbaa !5
  br label %48, !llvm.loop !13

105:                                              ; preds = %48
  br label %106

106:                                              ; preds = %105
  %107 = load i32, ptr %9, align 4, !tbaa !5
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %9, align 4, !tbaa !5
  br label %43, !llvm.loop !15

109:                                              ; preds = %43
  br label %110

110:                                              ; preds = %109
  %111 = load i32, ptr %10, align 4, !tbaa !5
  %112 = add nsw i32 %111, 1
  store i32 %112, ptr %10, align 4, !tbaa !5
  br label %38, !llvm.loop !16

113:                                              ; preds = %38
  %114 = load float, ptr %13, align 4, !tbaa !9
  %115 = load float, ptr %12, align 4, !tbaa !9
  %116 = fsub float %114, %115
  store float %116, ptr %14, align 4, !tbaa !9
  store i32 0, ptr %11, align 4, !tbaa !5
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %117

117:                                              ; preds = %158, %113
  %118 = load i32, ptr %10, align 4, !tbaa !5
  %119 = load i32, ptr %3, align 4, !tbaa !5
  %120 = icmp slt i32 %118, %119
  br i1 %120, label %121, label %161

121:                                              ; preds = %117
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %122

122:                                              ; preds = %154, %121
  %123 = load i32, ptr %9, align 4, !tbaa !5
  %124 = load i32, ptr %3, align 4, !tbaa !5
  %125 = icmp slt i32 %123, %124
  br i1 %125, label %126, label %157

126:                                              ; preds = %122
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %127

127:                                              ; preds = %150, %126
  %128 = load i32, ptr %8, align 4, !tbaa !5
  %129 = load i32, ptr %3, align 4, !tbaa !5
  %130 = icmp slt i32 %128, %129
  br i1 %130, label %131, label %153

131:                                              ; preds = %127
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %132 = load ptr, ptr %6, align 8, !tbaa !11
  %133 = load i32, ptr %11, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds float, ptr %132, i64 %134
  %136 = load float, ptr %135, align 4, !tbaa !9
  store float %136, ptr %17, align 4, !tbaa !9
  %137 = load float, ptr %17, align 4, !tbaa !9
  %138 = load float, ptr %12, align 4, !tbaa !9
  %139 = fsub float %137, %138
  %140 = load float, ptr %14, align 4, !tbaa !9
  %141 = fdiv float %139, %140
  store float %141, ptr %17, align 4, !tbaa !9
  %142 = load float, ptr %17, align 4, !tbaa !9
  %143 = fmul float %142, 2.550000e+02
  %144 = fptoui float %143 to i8
  %145 = load ptr, ptr %7, align 8, !tbaa !11
  %146 = load i32, ptr %11, align 4, !tbaa !5
  %147 = add nsw i32 %146, 1
  store i32 %147, ptr %11, align 4, !tbaa !5
  %148 = sext i32 %146 to i64
  %149 = getelementptr inbounds i8, ptr %145, i64 %148
  store i8 %144, ptr %149, align 1, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %150

150:                                              ; preds = %131
  %151 = load i32, ptr %8, align 4, !tbaa !5
  %152 = add nsw i32 %151, 1
  store i32 %152, ptr %8, align 4, !tbaa !5
  br label %127, !llvm.loop !18

153:                                              ; preds = %127
  br label %154

154:                                              ; preds = %153
  %155 = load i32, ptr %9, align 4, !tbaa !5
  %156 = add nsw i32 %155, 1
  store i32 %156, ptr %9, align 4, !tbaa !5
  br label %122, !llvm.loop !19

157:                                              ; preds = %122
  br label %158

158:                                              ; preds = %157
  %159 = load i32, ptr %10, align 4, !tbaa !5
  %160 = add nsw i32 %159, 1
  store i32 %160, ptr %10, align 4, !tbaa !5
  br label %117, !llvm.loop !20

161:                                              ; preds = %117
  call void @glGenTextures(i32 noundef 1, ptr noundef %5)
  %162 = load i32, ptr %5, align 4, !tbaa !5
  call void @glBindTexture(i32 noundef 32879, i32 noundef %162)
  %163 = load i32, ptr %3, align 4, !tbaa !5
  %164 = load i32, ptr %3, align 4, !tbaa !5
  %165 = load i32, ptr %3, align 4, !tbaa !5
  %166 = load ptr, ptr %7, align 8, !tbaa !11
  call void @glTexImage3D(i32 noundef 32879, i32 noundef 0, i32 noundef 33321, i32 noundef %163, i32 noundef %164, i32 noundef %165, i32 noundef 0, i32 noundef 6403, i32 noundef 5121, ptr noundef %166)
  call void @glTexParameteri(i32 noundef 32879, i32 noundef 10241, i32 noundef 9729)
  call void @glTexParameteri(i32 noundef 32879, i32 noundef 10240, i32 noundef 9729)
  call void @glTexParameteri(i32 noundef 32879, i32 noundef 10242, i32 noundef 33648)
  call void @glTexParameteri(i32 noundef 32879, i32 noundef 10243, i32 noundef 33648)
  call void @glTexParameteri(i32 noundef 32879, i32 noundef 32882, i32 noundef 33648)
  call void @glBindTexture(i32 noundef 32879, i32 noundef 0)
  %167 = load ptr, ptr %6, align 8, !tbaa !11
  call void @free(ptr noundef %167) #5
  %168 = load ptr, ptr %7, align 8, !tbaa !11
  call void @free(ptr noundef %168) #5
  %169 = load i32, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, 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 8, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  ret i32 %169
}

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

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

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

declare void @glTexImage3D(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) #3

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

; Function Attrs: nounwind
declare void @free(ptr noundef) #4

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

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

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


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: nounwind uwtable
declare dso_local void @initNoiseTable() 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: nounwind uwtable
declare dso_local float @noise3D(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local i32 @Create3DNoiseTexture(i32 noundef %0, float noundef %1) local_unnamed_addr #0 {
  %3 = alloca i32, align 4
  %4 = alloca [3 x float], align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  %5 = sext i32 %0 to i64
  %6 = mul nsw i64 %5, %5
  %7 = shl i64 %6, 2
  %8 = mul i64 %7, %5
  %9 = tail call noalias ptr @malloc(i64 noundef %8) #6
  %10 = mul i64 %6, %5
  %11 = tail call noalias ptr @malloc(i64 noundef %10) #6
  tail call void @initNoiseTable()
  %12 = icmp sgt i32 %0, 0
  br i1 %12, label %.preheader77.lr.ph, label %._crit_edge112

.preheader77.lr.ph:                               ; preds = %2
  %13 = uitofp nneg i32 %0 to float
  %14 = getelementptr inbounds i8, ptr %4, i64 4
  %15 = getelementptr inbounds i8, ptr %4, i64 8
  br label %.preheader77.us

.preheader77.us:                                  ; preds = %._crit_edge88.split.us.us, %.preheader77.lr.ph
  %.05997.us = phi i32 [ 0, %.preheader77.lr.ph ], [ %33, %._crit_edge88.split.us.us ]
  %.06196.us = phi float [ -1.000000e+03, %.preheader77.lr.ph ], [ %.3.us.us, %._crit_edge88.split.us.us ]
  %.06395.us = phi float [ 1.000000e+03, %.preheader77.lr.ph ], [ %.366.us.us, %._crit_edge88.split.us.us ]
  %.06794.us = phi i64 [ 0, %.preheader77.lr.ph ], [ %indvars.iv.next, %._crit_edge88.split.us.us ]
  %16 = uitofp nneg i32 %.05997.us to float
  %17 = fdiv float %16, %13
  %18 = fmul float %17, %1
  br label %.preheader76.us.us

.preheader76.us.us:                               ; preds = %._crit_edge.us.us, %.preheader77.us
  %.05787.us.us = phi i32 [ 0, %.preheader77.us ], [ %32, %._crit_edge.us.us ]
  %.16286.us.us = phi float [ %.06196.us, %.preheader77.us ], [ %.3.us.us, %._crit_edge.us.us ]
  %.16485.us.us = phi float [ %.06395.us, %.preheader77.us ], [ %.366.us.us, %._crit_edge.us.us ]
  %.16884.us.us = phi i64 [ %.06794.us, %.preheader77.us ], [ %indvars.iv.next, %._crit_edge.us.us ]
  %19 = uitofp nneg i32 %.05787.us.us to float
  %20 = fdiv float %19, %13
  %21 = fmul float %20, %1
  %sext = shl i64 %.16884.us.us, 32
  %22 = ashr exact i64 %sext, 32
  br label %23

23:                                               ; preds = %23, %.preheader76.us.us
  %indvars.iv = phi i64 [ %indvars.iv.next, %23 ], [ %22, %.preheader76.us.us ]
  %.081.us.us = phi i32 [ %31, %23 ], [ 0, %.preheader76.us.us ]
  %.280.us.us = phi float [ %.3.us.us, %23 ], [ %.16286.us.us, %.preheader76.us.us ]
  %.26579.us.us = phi float [ %.366.us.us, %23 ], [ %.16485.us.us, %.preheader76.us.us ]
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %4) #5
  %24 = uitofp nneg i32 %.081.us.us to float
  %25 = fdiv float %24, %13
  %26 = fmul float %25, %1
  store float %26, ptr %4, align 4, !tbaa !5
  store float %21, ptr %14, align 4, !tbaa !5
  store float %18, ptr %15, align 4, !tbaa !5
  %27 = call float @noise3D(ptr noundef nonnull %4)
  %28 = fcmp olt float %27, %.26579.us.us
  %.366.us.us = select i1 %28, float %27, float %.26579.us.us
  %29 = fcmp ogt float %27, %.280.us.us
  %.3.us.us = select i1 %29, float %27, float %.280.us.us
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %30 = getelementptr inbounds float, ptr %9, i64 %indvars.iv
  store float %27, ptr %30, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %4) #5
  %31 = add nuw nsw i32 %.081.us.us, 1
  %exitcond.not = icmp eq i32 %31, %0
  br i1 %exitcond.not, label %._crit_edge.us.us, label %23, !llvm.loop !9

._crit_edge.us.us:                                ; preds = %23
  %32 = add nuw nsw i32 %.05787.us.us, 1
  %exitcond115.not = icmp eq i32 %32, %0
  br i1 %exitcond115.not, label %._crit_edge88.split.us.us, label %.preheader76.us.us, !llvm.loop !11

._crit_edge88.split.us.us:                        ; preds = %._crit_edge.us.us
  %33 = add nuw nsw i32 %.05997.us, 1
  %exitcond116.not = icmp eq i32 %33, %0
  br i1 %exitcond116.not, label %._crit_edge, label %.preheader77.us, !llvm.loop !12

._crit_edge:                                      ; preds = %._crit_edge88.split.us.us
  %34 = fsub float %.3.us.us, %.366.us.us
  br i1 %12, label %.preheader75.us.preheader, label %._crit_edge112

.preheader75.us.preheader:                        ; preds = %._crit_edge
  %35 = zext nneg i32 %0 to i64
  %min.iters.check = icmp ult i32 %0, 4
  %n.vec = and i64 %35, 2147483644
  %ind.end126 = trunc nuw nsw i64 %n.vec to i32
  %broadcast.splatinsert = insertelement <4 x float> poison, float %.366.us.us, i64 0
  %broadcast.splat = shufflevector <4 x float> %broadcast.splatinsert, <4 x float> poison, <4 x i32> zeroinitializer
  %broadcast.splatinsert128 = insertelement <4 x float> poison, float %34, i64 0
  %broadcast.splat129 = shufflevector <4 x float> %broadcast.splatinsert128, <4 x float> poison, <4 x i32> zeroinitializer
  %cmp.n = icmp eq i64 %n.vec, %35
  br label %.preheader75.us

.preheader75.us:                                  ; preds = %.preheader75.us.preheader, %._crit_edge107.split.us.us
  %.160111.us = phi i32 [ %53, %._crit_edge107.split.us.us ], [ 0, %.preheader75.us.preheader ]
  %.370110.us = phi i64 [ %indvars.iv.next118.lcssa, %._crit_edge107.split.us.us ], [ 0, %.preheader75.us.preheader ]
  br label %.preheader.us.us

.preheader.us.us:                                 ; preds = %._crit_edge103.us.us, %.preheader75.us
  %.158106.us.us = phi i32 [ 0, %.preheader75.us ], [ %52, %._crit_edge103.us.us ]
  %.4105.us.us = phi i64 [ %.370110.us, %.preheader75.us ], [ %indvars.iv.next118.lcssa, %._crit_edge103.us.us ]
  %sext123 = shl i64 %.4105.us.us, 32
  %36 = ashr exact i64 %sext123, 32
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.ph

vector.ph:                                        ; preds = %.preheader.us.us
  %ind.end = add nsw i64 %36, %n.vec
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %offset.idx = add i64 %36, %index
  %37 = getelementptr inbounds float, ptr %9, i64 %offset.idx
  %wide.load = load <4 x float>, ptr %37, align 4, !tbaa !5
  %38 = fsub <4 x float> %wide.load, %broadcast.splat
  %39 = fdiv <4 x float> %38, %broadcast.splat129
  %40 = fmul <4 x float> %39, <float 2.550000e+02, float 2.550000e+02, float 2.550000e+02, float 2.550000e+02>
  %41 = fptoui <4 x float> %40 to <4 x i8>
  %42 = getelementptr inbounds i8, ptr %11, i64 %offset.idx
  store <4 x i8> %41, ptr %42, align 1, !tbaa !13
  %index.next = add nuw i64 %index, 4
  %43 = icmp eq i64 %index.next, %n.vec
  br i1 %43, label %middle.block, label %vector.body, !llvm.loop !14

middle.block:                                     ; preds = %vector.body
  br i1 %cmp.n, label %._crit_edge103.us.us, label %scalar.ph.preheader

scalar.ph.preheader:                              ; preds = %middle.block, %.preheader.us.us
  %indvars.iv117.ph = phi i64 [ %36, %.preheader.us.us ], [ %ind.end, %middle.block ]
  %.1102.us.us.ph = phi i32 [ 0, %.preheader.us.us ], [ %ind.end126, %middle.block ]
  br label %scalar.ph

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %indvars.iv117 = phi i64 [ %indvars.iv.next118, %scalar.ph ], [ %indvars.iv117.ph, %scalar.ph.preheader ]
  %.1102.us.us = phi i32 [ %51, %scalar.ph ], [ %.1102.us.us.ph, %scalar.ph.preheader ]
  %44 = getelementptr inbounds float, ptr %9, i64 %indvars.iv117
  %45 = load float, ptr %44, align 4, !tbaa !5
  %46 = fsub float %45, %.366.us.us
  %47 = fdiv float %46, %34
  %48 = fmul float %47, 2.550000e+02
  %49 = fptoui float %48 to i8
  %indvars.iv.next118 = add nsw i64 %indvars.iv117, 1
  %50 = getelementptr inbounds i8, ptr %11, i64 %indvars.iv117
  store i8 %49, ptr %50, align 1, !tbaa !13
  %51 = add nuw nsw i32 %.1102.us.us, 1
  %exitcond120.not = icmp eq i32 %51, %0
  br i1 %exitcond120.not, label %._crit_edge103.us.us, label %scalar.ph, !llvm.loop !17

._crit_edge103.us.us:                             ; preds = %scalar.ph, %middle.block
  %indvars.iv.next118.lcssa = phi i64 [ %ind.end, %middle.block ], [ %indvars.iv.next118, %scalar.ph ]
  %52 = add nuw nsw i32 %.158106.us.us, 1
  %exitcond121.not = icmp eq i32 %52, %0
  br i1 %exitcond121.not, label %._crit_edge107.split.us.us, label %.preheader.us.us, !llvm.loop !18

._crit_edge107.split.us.us:                       ; preds = %._crit_edge103.us.us
  %53 = add nuw nsw i32 %.160111.us, 1
  %exitcond122.not = icmp eq i32 %53, %0
  br i1 %exitcond122.not, label %._crit_edge112, label %.preheader75.us, !llvm.loop !19

._crit_edge112:                                   ; preds = %._crit_edge107.split.us.us, %2, %._crit_edge
  call void @glGenTextures(i32 noundef 1, ptr noundef nonnull %3) #5
  %54 = load i32, ptr %3, align 4, !tbaa !20
  call void @glBindTexture(i32 noundef 32879, i32 noundef %54) #5
  call void @glTexImage3D(i32 noundef 32879, i32 noundef 0, i32 noundef 33321, i32 noundef %0, i32 noundef %0, i32 noundef %0, i32 noundef 0, i32 noundef 6403, i32 noundef 5121, ptr noundef %11) #5
  call void @glTexParameteri(i32 noundef 32879, i32 noundef 10241, i32 noundef 9729) #5
  call void @glTexParameteri(i32 noundef 32879, i32 noundef 10240, i32 noundef 9729) #5
  call void @glTexParameteri(i32 noundef 32879, i32 noundef 10242, i32 noundef 33648) #5
  call void @glTexParameteri(i32 noundef 32879, i32 noundef 10243, i32 noundef 33648) #5
  call void @glTexParameteri(i32 noundef 32879, i32 noundef 32882, i32 noundef 33648) #5
  call void @glBindTexture(i32 noundef 32879, i32 noundef 0) #5
  call void @free(ptr noundef %9) #5
  call void @free(ptr noundef %11) #5
  %55 = load i32, ptr %3, align 4, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  ret i32 %55
}

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2

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

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

declare void @glTexImage3D(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

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

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #4

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

!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 = !{!"float", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = !{!7, !7, i64 0}
!14 = distinct !{!14, !10, !15, !16}
!15 = !{!"llvm.loop.isvectorized", i32 1}
!16 = !{!"llvm.loop.unroll.runtime.disable"}
!17 = distinct !{!17, !10, !16, !15}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = !{!21, !21, i64 0}
!21 = !{!"int", !7, i64 0}


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