; LLVM IR from frozein/DoonEngine :: src/DoonEngine/voxel.ll (DN_decompress_chunk)

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

%struct.DNbvec3 = type { i8, i8, i8 }
%struct.DNivec3 = type { i32, i32, i32 }
%struct.DNchunk = type { %struct.DNivec3, i8, i32, i32, [8 x [8 x [8 x %struct.DNcompressedVoxel]]] }
%struct.DNcompressedVoxel = type { i32, i32 }

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @DN_in_map_bounds(ptr noundef, i64, i32) #2

; Function Attrs: nounwind uwtable
define dso_local void @_DN_decompress_chunk(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca { i64, i32 }, align 4
  %8 = alloca i8, align 1
  %9 = alloca i8, align 1
  %10 = alloca [256 x %struct.DNbvec3], align 16
  %11 = alloca [256 x %struct.DNbvec3], align 16
  %12 = alloca i32, align 4
  %13 = alloca i8, align 1
  %14 = alloca i8, align 1
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca %struct.DNivec3, align 4
  %18 = alloca %struct.DNbvec3, align 1
  %19 = alloca i8, align 1
  %20 = alloca %struct.DNbvec3, align 1
  %21 = alloca i8, align 1
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %22 = load ptr, ptr %6, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.DNchunk, ptr %22, i32 0, i32 0
  call void @_DN_read_buffer(ptr noundef %23, ptr noundef %4, i64 noundef 12)
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.DNchunk, ptr %24, i32 0, i32 1
  store i8 0, ptr %25, align 4, !tbaa !9
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.DNchunk, ptr %26, i32 0, i32 2
  store i32 0, ptr %27, align 4, !tbaa !14
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.DNchunk, ptr %28, i32 0, i32 3
  store i32 0, ptr %29, align 4, !tbaa !15
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.DNchunk, ptr %31, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %7, ptr align 4 %32, i64 12, i1 false)
  %33 = getelementptr inbounds { i64, i32 }, ptr %7, i32 0, i32 0
  %34 = load i64, ptr %33, align 4
  %35 = getelementptr inbounds { i64, i32 }, ptr %7, i32 0, i32 1
  %36 = load i32, ptr %35, align 4
  %37 = call zeroext i1 @DN_in_map_bounds(ptr noundef %30, i64 %34, i32 %36)
  br i1 %37, label %39, label %38

38:                                               ; preds = %3
  br label %197

39:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #3
  store i8 0, ptr %8, align 1, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #3
  store i8 0, ptr %9, align 1, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 768, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 768, ptr %11) #3
  call void @_DN_read_buffer(ptr noundef %8, ptr noundef %4, i64 noundef 1)
  %40 = load i8, ptr %8, align 1, !tbaa !16
  %41 = zext i8 %40 to i32
  %42 = icmp sgt i32 %41, 0
  br i1 %42, label %43, label %48

43:                                               ; preds = %39
  %44 = getelementptr inbounds [256 x %struct.DNbvec3], ptr %10, i64 0, i64 0
  %45 = load i8, ptr %8, align 1, !tbaa !16
  %46 = zext i8 %45 to i64
  %47 = mul i64 3, %46
  call void @_DN_read_buffer(ptr noundef %44, ptr noundef %4, i64 noundef %47)
  br label %48

48:                                               ; preds = %43, %39
  call void @_DN_read_buffer(ptr noundef %9, ptr noundef %4, i64 noundef 1)
  %49 = load i8, ptr %9, align 1, !tbaa !16
  %50 = zext i8 %49 to i32
  %51 = icmp sgt i32 %50, 0
  br i1 %51, label %52, label %57

52:                                               ; preds = %48
  %53 = getelementptr inbounds [256 x %struct.DNbvec3], ptr %11, i64 0, i64 0
  %54 = load i8, ptr %9, align 1, !tbaa !16
  %55 = zext i8 %54 to i64
  %56 = mul i64 3, %55
  call void @_DN_read_buffer(ptr noundef %53, ptr noundef %4, i64 noundef %56)
  br label %57

57:                                               ; preds = %52, %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #3
  store i32 0, ptr %12, align 4, !tbaa !17
  br label %58

58:                                               ; preds = %191, %57
  %59 = load i32, ptr %12, align 4, !tbaa !17
  %60 = icmp slt i32 %59, 512
  br i1 %60, label %61, label %196

61:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #3
  call void @_DN_read_buffer(ptr noundef %13, ptr noundef %4, i64 noundef 1)
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #3
  call void @_DN_read_buffer(ptr noundef %14, ptr noundef %4, i64 noundef 1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #3
  %62 = load i32, ptr %12, align 4, !tbaa !17
  store i32 %62, ptr %15, align 4, !tbaa !17
  br label %63

63:                                               ; preds = %188, %61
  %64 = load i32, ptr %15, align 4, !tbaa !17
  %65 = load i32, ptr %12, align 4, !tbaa !17
  %66 = load i8, ptr %14, align 1, !tbaa !16
  %67 = zext i8 %66 to i32
  %68 = add nsw i32 %65, %67
  %69 = icmp slt i32 %64, %68
  br i1 %69, label %71, label %70

70:                                               ; preds = %63
  store i32 4, ptr %16, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #3
  br label %191

71:                                               ; preds = %63
  call void @llvm.lifetime.start.p0(i64 12, ptr %17) #3
  %72 = getelementptr inbounds %struct.DNivec3, ptr %17, i32 0, i32 0
  %73 = load i32, ptr %15, align 4, !tbaa !17
  %74 = srem i32 %73, 8
  store i32 %74, ptr %72, align 4, !tbaa !18
  %75 = getelementptr inbounds %struct.DNivec3, ptr %17, i32 0, i32 1
  %76 = load i32, ptr %15, align 4, !tbaa !17
  %77 = sdiv i32 %76, 8
  %78 = srem i32 %77, 8
  store i32 %78, ptr %75, align 4, !tbaa !19
  %79 = getelementptr inbounds %struct.DNivec3, ptr %17, i32 0, i32 2
  %80 = load i32, ptr %15, align 4, !tbaa !17
  %81 = sdiv i32 %80, 64
  store i32 %81, ptr %79, align 4, !tbaa !20
  %82 = load i8, ptr %13, align 1, !tbaa !16
  %83 = zext i8 %82 to i32
  %84 = icmp eq i32 %83, 255
  br i1 %84, label %85, label %101

85:                                               ; preds = %71
  %86 = load ptr, ptr %6, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.DNchunk, ptr %86, i32 0, i32 4
  %88 = getelementptr inbounds %struct.DNivec3, ptr %17, i32 0, i32 0
  %89 = load i32, ptr %88, align 4, !tbaa !18
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [8 x [8 x [8 x %struct.DNcompressedVoxel]]], ptr %87, i64 0, i64 %90
  %92 = getelementptr inbounds %struct.DNivec3, ptr %17, i32 0, i32 1
  %93 = load i32, ptr %92, align 4, !tbaa !19
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [8 x [8 x %struct.DNcompressedVoxel]], ptr %91, i64 0, i64 %94
  %96 = getelementptr inbounds %struct.DNivec3, ptr %17, i32 0, i32 2
  %97 = load i32, ptr %96, align 4, !tbaa !20
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [8 x %struct.DNcompressedVoxel], ptr %95, i64 0, i64 %98
  %100 = getelementptr inbounds %struct.DNcompressedVoxel, ptr %99, i32 0, i32 0
  store i32 -1, ptr %100, align 4, !tbaa !21
  store i32 6, ptr %16, align 4
  br label %185

101:                                              ; preds = %71
  call void @llvm.lifetime.start.p0(i64 3, ptr %18) #3
  %102 = load i8, ptr %8, align 1, !tbaa !16
  %103 = zext i8 %102 to i32
  %104 = icmp sgt i32 %103, 0
  br i1 %104, label %105, label %109

105:                                              ; preds = %101
  call void @llvm.lifetime.start.p0(i64 1, ptr %19) #3
  call void @_DN_read_buffer(ptr noundef %19, ptr noundef %4, i64 noundef 1)
  %106 = load i8, ptr %19, align 1, !tbaa !16
  %107 = zext i8 %106 to i64
  %108 = getelementptr inbounds [256 x %struct.DNbvec3], ptr %10, i64 0, i64 %107
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %18, ptr align 1 %108, i64 3, i1 false), !tbaa.struct !23
  call void @llvm.lifetime.end.p0(i64 1, ptr %19) #3
  br label %110

109:                                              ; preds = %101
  call void @_DN_read_buffer(ptr noundef %18, ptr noundef %4, i64 noundef 3)
  br label %110

110:                                              ; preds = %109, %105
  call void @llvm.lifetime.start.p0(i64 3, ptr %20) #3
  %111 = load i8, ptr %9, align 1, !tbaa !16
  %112 = zext i8 %111 to i32
  %113 = icmp sgt i32 %112, 0
  br i1 %113, label %114, label %118

114:                                              ; preds = %110
  call void @llvm.lifetime.start.p0(i64 1, ptr %21) #3
  call void @_DN_read_buffer(ptr noundef %21, ptr noundef %4, i64 noundef 1)
  %115 = load i8, ptr %21, align 1, !tbaa !16
  %116 = zext i8 %115 to i64
  %117 = getelementptr inbounds [256 x %struct.DNbvec3], ptr %11, i64 0, i64 %116
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %20, ptr align 1 %117, i64 3, i1 false), !tbaa.struct !23
  call void @llvm.lifetime.end.p0(i64 1, ptr %21) #3
  br label %119

118:                                              ; preds = %110
  call void @_DN_read_buffer(ptr noundef %20, ptr noundef %4, i64 noundef 3)
  br label %119

119:                                              ; preds = %118, %114
  %120 = load i8, ptr %13, align 1, !tbaa !16
  %121 = zext i8 %120 to i32
  %122 = shl i32 %121, 24
  %123 = getelementptr inbounds %struct.DNbvec3, ptr %18, i32 0, i32 0
  %124 = load i8, ptr %123, align 1, !tbaa !24
  %125 = zext i8 %124 to i32
  %126 = shl i32 %125, 16
  %127 = or i32 %122, %126
  %128 = getelementptr inbounds %struct.DNbvec3, ptr %18, i32 0, i32 1
  %129 = load i8, ptr %128, align 1, !tbaa !26
  %130 = zext i8 %129 to i32
  %131 = shl i32 %130, 8
  %132 = or i32 %127, %131
  %133 = getelementptr inbounds %struct.DNbvec3, ptr %18, i32 0, i32 2
  %134 = load i8, ptr %133, align 1, !tbaa !27
  %135 = zext i8 %134 to i32
  %136 = or i32 %132, %135
  %137 = load ptr, ptr %6, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.DNchunk, ptr %137, i32 0, i32 4
  %139 = getelementptr inbounds %struct.DNivec3, ptr %17, i32 0, i32 0
  %140 = load i32, ptr %139, align 4, !tbaa !18
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [8 x [8 x [8 x %struct.DNcompressedVoxel]]], ptr %138, i64 0, i64 %141
  %143 = getelementptr inbounds %struct.DNivec3, ptr %17, i32 0, i32 1
  %144 = load i32, ptr %143, align 4, !tbaa !19
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [8 x [8 x %struct.DNcompressedVoxel]], ptr %142, i64 0, i64 %145
  %147 = getelementptr inbounds %struct.DNivec3, ptr %17, i32 0, i32 2
  %148 = load i32, ptr %147, align 4, !tbaa !20
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [8 x %struct.DNcompressedVoxel], ptr %146, i64 0, i64 %149
  %151 = getelementptr inbounds %struct.DNcompressedVoxel, ptr %150, i32 0, i32 0
  store i32 %136, ptr %151, align 4, !tbaa !21
  %152 = getelementptr inbounds %struct.DNbvec3, ptr %20, i32 0, i32 0
  %153 = load i8, ptr %152, align 1, !tbaa !24
  %154 = zext i8 %153 to i32
  %155 = shl i32 %154, 24
  %156 = getelementptr inbounds %struct.DNbvec3, ptr %20, i32 0, i32 1
  %157 = load i8, ptr %156, align 1, !tbaa !26
  %158 = zext i8 %157 to i32
  %159 = shl i32 %158, 16
  %160 = or i32 %155, %159
  %161 = getelementptr inbounds %struct.DNbvec3, ptr %20, i32 0, i32 2
  %162 = load i8, ptr %161, align 1, !tbaa !27
  %163 = zext i8 %162 to i32
  %164 = shl i32 %163, 8
  %165 = or i32 %160, %164
  %166 = load ptr, ptr %6, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.DNchunk, ptr %166, i32 0, i32 4
  %168 = getelementptr inbounds %struct.DNivec3, ptr %17, i32 0, i32 0
  %169 = load i32, ptr %168, align 4, !tbaa !18
  %170 = sext i32 %169 to i64
  %171 = getelementptr inbounds [8 x [8 x [8 x %struct.DNcompressedVoxel]]], ptr %167, i64 0, i64 %170
  %172 = getelementptr inbounds %struct.DNivec3, ptr %17, i32 0, i32 1
  %173 = load i32, ptr %172, align 4, !tbaa !19
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [8 x [8 x %struct.DNcompressedVoxel]], ptr %171, i64 0, i64 %174
  %176 = getelementptr inbounds %struct.DNivec3, ptr %17, i32 0, i32 2
  %177 = load i32, ptr %176, align 4, !tbaa !20
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [8 x %struct.DNcompressedVoxel], ptr %175, i64 0, i64 %178
  %180 = getelementptr inbounds %struct.DNcompressedVoxel, ptr %179, i32 0, i32 1
  store i32 %165, ptr %180, align 4, !tbaa !28
  %181 = load ptr, ptr %6, align 8, !tbaa !5
  %182 = getelementptr inbounds %struct.DNchunk, ptr %181, i32 0, i32 2
  %183 = load i32, ptr %182, align 4, !tbaa !14
  %184 = add i32 %183, 1
  store i32 %184, ptr %182, align 4, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 3, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 3, ptr %18) #3
  store i32 0, ptr %16, align 4
  br label %185

185:                                              ; preds = %119, %85
  call void @llvm.lifetime.end.p0(i64 12, ptr %17) #3
  %186 = load i32, ptr %16, align 4
  switch i32 %186, label %198 [
    i32 0, label %187
    i32 6, label %188
  ]

187:                                              ; preds = %185
  br label %188

188:                                              ; preds = %187, %185
  %189 = load i32, ptr %15, align 4, !tbaa !17
  %190 = add nsw i32 %189, 1
  store i32 %190, ptr %15, align 4, !tbaa !17
  br label %63, !llvm.loop !29

191:                                              ; preds = %70
  %192 = load i8, ptr %14, align 1, !tbaa !16
  %193 = zext i8 %192 to i32
  %194 = load i32, ptr %12, align 4, !tbaa !17
  %195 = add nsw i32 %194, %193
  store i32 %195, ptr %12, align 4, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #3
  br label %58, !llvm.loop !31

196:                                              ; preds = %58
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 768, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 768, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #3
  br label %197

197:                                              ; preds = %196, %38
  ret void

198:                                              ; preds = %185
  unreachable
}

; Function Attrs: nounwind uwtable
declare hidden void @_DN_read_buffer(ptr noundef, ptr noundef, i64 noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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/C++ TBAA"}
!9 = !{!10, !13, i64 12}
!10 = !{!"DNchunk", !11, i64 0, !13, i64 12, !12, i64 16, !12, i64 20, !7, i64 24}
!11 = !{!"DNivec3", !12, i64 0, !12, i64 4, !12, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_Bool", !7, i64 0}
!14 = !{!10, !12, i64 16}
!15 = !{!10, !12, i64 20}
!16 = !{!7, !7, i64 0}
!17 = !{!12, !12, i64 0}
!18 = !{!11, !12, i64 0}
!19 = !{!11, !12, i64 4}
!20 = !{!11, !12, i64 8}
!21 = !{!22, !12, i64 0}
!22 = !{!"DNcompressedVoxel", !12, i64 0, !12, i64 4}
!23 = !{i64 0, i64 1, !16, i64 1, i64 1, !16, i64 2, i64 1, !16}
!24 = !{!25, !7, i64 0}
!25 = !{!"DNbvec3", !7, i64 0, !7, i64 1, !7, i64 2}
!26 = !{!25, !7, i64 1}
!27 = !{!25, !7, i64 2}
!28 = !{!22, !12, i64 4}
!29 = distinct !{!29, !30}
!30 = !{!"llvm.loop.mustprogress"}
!31 = distinct !{!31, !30}


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

%struct.DNbvec3 = type { i8, i8, i8 }
%struct.DNcompressedVoxel = type { i32, i32 }

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @DN_in_map_bounds(ptr noundef, i64, i32) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @_DN_decompress_chunk(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #2 {
  %4 = alloca ptr, align 8
  %5 = alloca i8, align 1
  %6 = alloca i8, align 1
  %7 = alloca [256 x %struct.DNbvec3], align 16
  %8 = alloca [256 x %struct.DNbvec3], align 16
  %9 = alloca i8, align 1
  %10 = alloca i8, align 1
  %11 = alloca %struct.DNbvec3, align 1
  %12 = alloca i8, align 1
  %13 = alloca %struct.DNbvec3, align 1
  %14 = alloca i8, align 1
  store ptr %0, ptr %4, align 8, !tbaa !5
  call void @_DN_read_buffer(ptr noundef %2, ptr noundef nonnull %4, i64 noundef 12)
  %15 = getelementptr inbounds i8, ptr %2, i64 12
  store i8 0, ptr %15, align 4, !tbaa !9
  %16 = getelementptr inbounds i8, ptr %2, i64 16
  store i32 0, ptr %16, align 4, !tbaa !14
  %17 = getelementptr inbounds i8, ptr %2, i64 20
  store i32 0, ptr %17, align 4, !tbaa !15
  %.sroa.015.0.copyload = load i64, ptr %2, align 4
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 8
  %.sroa.2.0.copyload = load i32, ptr %.sroa.2.0..sroa_idx, align 4
  %18 = call zeroext i1 @DN_in_map_bounds(ptr noundef %1, i64 %.sroa.015.0.copyload, i32 %.sroa.2.0.copyload)
  br i1 %18, label %19, label %119

19:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #3
  store i8 0, ptr %5, align 1, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #3
  store i8 0, ptr %6, align 1, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 768, ptr nonnull %7) #3
  call void @llvm.lifetime.start.p0(i64 768, ptr nonnull %8) #3
  call void @_DN_read_buffer(ptr noundef nonnull %5, ptr noundef nonnull %4, i64 noundef 1)
  %20 = load i8, ptr %5, align 1, !tbaa !16
  %.not = icmp eq i8 %20, 0
  br i1 %.not, label %24, label %21

21:                                               ; preds = %19
  %22 = zext i8 %20 to i64
  %23 = mul nuw nsw i64 %22, 3
  call void @_DN_read_buffer(ptr noundef nonnull %7, ptr noundef nonnull %4, i64 noundef %23)
  br label %24

24:                                               ; preds = %21, %19
  call void @_DN_read_buffer(ptr noundef nonnull %6, ptr noundef nonnull %4, i64 noundef 1)
  %25 = load i8, ptr %6, align 1, !tbaa !16
  %.not27 = icmp eq i8 %25, 0
  br i1 %.not27, label %29, label %26

26:                                               ; preds = %24
  %27 = zext i8 %25 to i64
  %28 = mul nuw nsw i64 %27, 3
  call void @_DN_read_buffer(ptr noundef nonnull %8, ptr noundef nonnull %4, i64 noundef %28)
  br label %29

29:                                               ; preds = %26, %24
  %30 = getelementptr inbounds i8, ptr %11, i64 1
  %31 = getelementptr inbounds i8, ptr %11, i64 2
  %32 = getelementptr inbounds i8, ptr %2, i64 24
  %33 = getelementptr inbounds i8, ptr %13, i64 1
  %34 = getelementptr inbounds i8, ptr %13, i64 2
  br label %35

35:                                               ; preds = %29, %._crit_edge
  %.031 = phi i32 [ 0, %29 ], [ %.lcssa, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %9) #3
  call void @_DN_read_buffer(ptr noundef nonnull %9, ptr noundef nonnull %4, i64 noundef 1)
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %10) #3
  call void @_DN_read_buffer(ptr noundef nonnull %10, ptr noundef nonnull %4, i64 noundef 1)
  %36 = load i8, ptr %10, align 1, !tbaa !16
  %37 = zext i8 %36 to i32
  %38 = add nuw nsw i32 %.031, %37
  %.not32 = icmp eq i8 %36, 0
  br i1 %.not32, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %35
  %39 = load i8, ptr %9, align 1, !tbaa !16
  %40 = icmp eq i8 %39, -1
  br i1 %40, label %.lr.ph.split.us, label %.lr.ph.split

.lr.ph.split.us:                                  ; preds = %.lr.ph, %.lr.ph.split.us
  %.02530.us = phi i32 [ %49, %.lr.ph.split.us ], [ %.031, %.lr.ph ]
  %41 = and i32 %.02530.us, 7
  %42 = lshr i32 %.02530.us, 3
  %43 = and i32 %42, 7
  %44 = lshr i32 %.02530.us, 6
  %45 = zext nneg i32 %41 to i64
  %46 = zext nneg i32 %43 to i64
  %47 = zext nneg i32 %44 to i64
  %48 = getelementptr inbounds [8 x [8 x [8 x %struct.DNcompressedVoxel]]], ptr %32, i64 0, i64 %45, i64 %46, i64 %47
  store i32 -1, ptr %48, align 4, !tbaa !17
  %49 = add nuw nsw i32 %.02530.us, 1
  %50 = icmp ult i32 %49, %38
  br i1 %50, label %.lr.ph.split.us, label %._crit_edge, !llvm.loop !19

._crit_edge:                                      ; preds = %111, %.lr.ph.split.us, %35
  %.lcssa = phi i32 [ %38, %35 ], [ %38, %.lr.ph.split.us ], [ %116, %111 ]
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %10) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %9) #3
  %51 = icmp ult i32 %.lcssa, 512
  br i1 %51, label %35, label %118, !llvm.loop !21

.lr.ph.split:                                     ; preds = %.lr.ph, %111
  %52 = phi i8 [ %112, %111 ], [ %36, %.lr.ph ]
  %53 = phi i8 [ %113, %111 ], [ %39, %.lr.ph ]
  %.02530 = phi i32 [ %114, %111 ], [ %.031, %.lr.ph ]
  %54 = and i32 %.02530, 7
  %55 = lshr i32 %.02530, 3
  %56 = and i32 %55, 7
  %57 = lshr i32 %.02530, 6
  %58 = icmp eq i8 %53, -1
  br i1 %58, label %59, label %64

59:                                               ; preds = %.lr.ph.split
  %60 = zext nneg i32 %54 to i64
  %61 = zext nneg i32 %56 to i64
  %62 = zext nneg i32 %57 to i64
  %63 = getelementptr inbounds [8 x [8 x [8 x %struct.DNcompressedVoxel]]], ptr %32, i64 0, i64 %60, i64 %61, i64 %62
  store i32 -1, ptr %63, align 4, !tbaa !17
  br label %111

64:                                               ; preds = %.lr.ph.split
  call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %11) #3
  %65 = load i8, ptr %5, align 1, !tbaa !16
  %.not28 = icmp eq i8 %65, 0
  br i1 %.not28, label %70, label %66

66:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %12) #3
  call void @_DN_read_buffer(ptr noundef nonnull %12, ptr noundef nonnull %4, i64 noundef 1)
  %67 = load i8, ptr %12, align 1, !tbaa !16
  %68 = zext i8 %67 to i64
  %69 = getelementptr inbounds [256 x %struct.DNbvec3], ptr %7, i64 0, i64 %68
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(3) %11, ptr noundef nonnull align 1 dereferenceable(3) %69, i64 3, i1 false), !tbaa.struct !22
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %12) #3
  br label %71

70:                                               ; preds = %64
  call void @_DN_read_buffer(ptr noundef nonnull %11, ptr noundef nonnull %4, i64 noundef 3)
  br label %71

71:                                               ; preds = %70, %66
  call void @llvm.lifetime.start.p0(i64 3, ptr nonnull %13) #3
  %72 = load i8, ptr %6, align 1, !tbaa !16
  %.not29 = icmp eq i8 %72, 0
  br i1 %.not29, label %77, label %73

73:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %14) #3
  call void @_DN_read_buffer(ptr noundef nonnull %14, ptr noundef nonnull %4, i64 noundef 1)
  %74 = load i8, ptr %14, align 1, !tbaa !16
  %75 = zext i8 %74 to i64
  %76 = getelementptr inbounds [256 x %struct.DNbvec3], ptr %8, i64 0, i64 %75
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 1 dereferenceable(3) %13, ptr noundef nonnull align 1 dereferenceable(3) %76, i64 3, i1 false), !tbaa.struct !22
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %14) #3
  br label %78

77:                                               ; preds = %71
  call void @_DN_read_buffer(ptr noundef nonnull %13, ptr noundef nonnull %4, i64 noundef 3)
  br label %78

78:                                               ; preds = %77, %73
  %79 = load i8, ptr %9, align 1, !tbaa !16
  %80 = zext i8 %79 to i32
  %81 = shl nuw i32 %80, 24
  %82 = load i8, ptr %11, align 1, !tbaa !23
  %83 = zext i8 %82 to i32
  %84 = shl nuw nsw i32 %83, 16
  %85 = or disjoint i32 %84, %81
  %86 = load i8, ptr %30, align 1, !tbaa !25
  %87 = zext i8 %86 to i32
  %88 = shl nuw nsw i32 %87, 8
  %89 = or disjoint i32 %85, %88
  %90 = load i8, ptr %31, align 1, !tbaa !26
  %91 = zext i8 %90 to i32
  %92 = or disjoint i32 %89, %91
  %93 = zext nneg i32 %54 to i64
  %94 = zext nneg i32 %56 to i64
  %95 = zext nneg i32 %57 to i64
  %96 = getelementptr inbounds [8 x [8 x [8 x %struct.DNcompressedVoxel]]], ptr %32, i64 0, i64 %93, i64 %94, i64 %95
  store i32 %92, ptr %96, align 4, !tbaa !17
  %97 = load i8, ptr %13, align 1, !tbaa !23
  %98 = zext i8 %97 to i32
  %99 = shl nuw i32 %98, 24
  %100 = load i8, ptr %33, align 1, !tbaa !25
  %101 = zext i8 %100 to i32
  %102 = shl nuw nsw i32 %101, 16
  %103 = or disjoint i32 %102, %99
  %104 = load i8, ptr %34, align 1, !tbaa !26
  %105 = zext i8 %104 to i32
  %106 = shl nuw nsw i32 %105, 8
  %107 = or disjoint i32 %103, %106
  %108 = getelementptr inbounds i8, ptr %96, i64 4
  store i32 %107, ptr %108, align 4, !tbaa !27
  %109 = load i32, ptr %16, align 4, !tbaa !14
  %110 = add i32 %109, 1
  store i32 %110, ptr %16, align 4, !tbaa !14
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %13) #3
  call void @llvm.lifetime.end.p0(i64 3, ptr nonnull %11) #3
  %.pre = load i8, ptr %10, align 1, !tbaa !16
  br label %111

111:                                              ; preds = %78, %59
  %112 = phi i8 [ %.pre, %78 ], [ %52, %59 ]
  %113 = phi i8 [ %79, %78 ], [ -1, %59 ]
  %114 = add nuw nsw i32 %.02530, 1
  %115 = zext i8 %112 to i32
  %116 = add nuw nsw i32 %.031, %115
  %117 = icmp ult i32 %114, %116
  br i1 %117, label %.lr.ph.split, label %._crit_edge, !llvm.loop !28

118:                                              ; preds = %._crit_edge
  call void @llvm.lifetime.end.p0(i64 768, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 768, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #3
  br label %119

119:                                              ; preds = %3, %118
  ret void
}

; Function Attrs: nounwind uwtable
declare hidden void @_DN_read_buffer(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { 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/C++ TBAA"}
!9 = !{!10, !13, i64 12}
!10 = !{!"DNchunk", !11, i64 0, !13, i64 12, !12, i64 16, !12, i64 20, !7, i64 24}
!11 = !{!"DNivec3", !12, i64 0, !12, i64 4, !12, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_Bool", !7, i64 0}
!14 = !{!10, !12, i64 16}
!15 = !{!10, !12, i64 20}
!16 = !{!7, !7, i64 0}
!17 = !{!18, !12, i64 0}
!18 = !{!"DNcompressedVoxel", !12, i64 0, !12, i64 4}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}
!22 = !{i64 0, i64 1, !16, i64 1, i64 1, !16, i64 2, i64 1, !16}
!23 = !{!24, !7, i64 0}
!24 = !{!"DNbvec3", !7, i64 0, !7, i64 1, !7, i64 2}
!25 = !{!24, !7, i64 1}
!26 = !{!24, !7, i64 2}
!27 = !{!18, !12, i64 4}
!28 = distinct !{!28, !20, !29}
!29 = !{!"llvm.loop.unswitch.partial.disable"}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass