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

; 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.DNuvec3 = type { i32, i32, i32 }
%struct.DNivec3 = type { i32, i32, i32 }
%struct.DNchunkHandle = type { i8, i32 }
%struct.DNvolume = type { i32, i32, i32, %struct.DNuvec3, i64, i64, i64, i64, i64, i64, ptr, ptr, ptr, ptr, ptr, %union.QMvec3, %union.QMvec3, float, i32, %union.QMvec3, %union.QMvec3, %union.QMvec3, i32, i32, float, i8, i32, %union.QMvec3, %union.QMvec3, i32, float }
%union.QMvec3 = type { [3 x float] }
%struct.DNchunk = type { %struct.DNivec3, i8, i32, i32, [8 x [8 x [8 x %struct.DNcompressedVoxel]]] }
%struct.DNcompressedVoxel = type { i32, i32 }

@g_DN_message_callback = external dso_local global ptr, align 8
@glad_glBindBuffer = external global ptr, align 8
@glad_glBufferData = external global ptr, align 8
@.str.44 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [34 x i8], align 1

; 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 allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @_DN_clear_chunk(ptr noundef, i32 noundef) #3

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

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

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @DN_set_map_size(ptr noundef %0, i64 %1, i32 %2) #3 {
  %4 = alloca i1, align 1
  %5 = alloca %struct.DNuvec3, align 4
  %6 = alloca { i64, i32 }, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca %struct.DNivec3, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca { i64, i32 }, align 4
  %17 = alloca %struct.DNchunkHandle, align 4
  %18 = alloca i32, align 4
  %19 = alloca { i64, i32 }, align 4
  %20 = getelementptr inbounds { i64, i32 }, ptr %6, i32 0, i32 0
  store i64 %1, ptr %20, align 4
  %21 = getelementptr inbounds { i64, i32 }, ptr %6, i32 0, i32 1
  store i32 %2, ptr %21, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %5, ptr align 4 %6, i64 12, i1 false)
  store ptr %0, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %22 = getelementptr inbounds %struct.DNuvec3, ptr %5, i32 0, i32 0
  %23 = load i32, ptr %22, align 4, !tbaa !9
  %24 = zext i32 %23 to i64
  %25 = mul i64 8, %24
  %26 = getelementptr inbounds %struct.DNuvec3, ptr %5, i32 0, i32 1
  %27 = load i32, ptr %26, align 4, !tbaa !12
  %28 = zext i32 %27 to i64
  %29 = mul i64 %25, %28
  %30 = getelementptr inbounds %struct.DNuvec3, ptr %5, i32 0, i32 2
  %31 = load i32, ptr %30, align 4, !tbaa !13
  %32 = zext i32 %31 to i64
  %33 = mul i64 %29, %32
  %34 = call noalias ptr @malloc(i64 noundef %33) #6
  store ptr %34, ptr %8, align 8, !tbaa !5
  %35 = load ptr, ptr %8, align 8, !tbaa !5
  %36 = icmp ne ptr %35, null
  br i1 %36, label %39, label %37

37:                                               ; preds = %3
  %38 = load ptr, ptr @g_DN_message_callback, align 8, !tbaa !5
  call void %38(i32 noundef 0, i32 noundef 1, ptr noundef @.str.44)
  store i1 false, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %218

39:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !14
  br label %40

40:                                               ; preds = %128, %39
  %41 = load i32, ptr %10, align 4, !tbaa !14
  %42 = getelementptr inbounds %struct.DNuvec3, ptr %5, i32 0, i32 2
  %43 = load i32, ptr %42, align 4, !tbaa !13
  %44 = icmp ult i32 %41, %43
  br i1 %44, label %46, label %45

45:                                               ; preds = %40
  store i32 2, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %131

46:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  store i32 0, ptr %11, align 4, !tbaa !14
  br label %47

47:                                               ; preds = %124, %46
  %48 = load i32, ptr %11, align 4, !tbaa !14
  %49 = getelementptr inbounds %struct.DNuvec3, ptr %5, i32 0, i32 1
  %50 = load i32, ptr %49, align 4, !tbaa !12
  %51 = icmp ult i32 %48, %50
  br i1 %51, label %53, label %52

52:                                               ; preds = %47
  store i32 5, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %127

53:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !14
  br label %54

54:                                               ; preds = %120, %53
  %55 = load i32, ptr %12, align 4, !tbaa !14
  %56 = getelementptr inbounds %struct.DNuvec3, ptr %5, i32 0, i32 0
  %57 = load i32, ptr %56, align 4, !tbaa !9
  %58 = icmp ult i32 %55, %57
  br i1 %58, label %60, label %59

59:                                               ; preds = %54
  store i32 8, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %123

60:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 12, ptr %13) #5
  %61 = getelementptr inbounds %struct.DNivec3, ptr %13, i32 0, i32 0
  %62 = load i32, ptr %12, align 4, !tbaa !14
  store i32 %62, ptr %61, align 4, !tbaa !15
  %63 = getelementptr inbounds %struct.DNivec3, ptr %13, i32 0, i32 1
  %64 = load i32, ptr %11, align 4, !tbaa !14
  store i32 %64, ptr %63, align 4, !tbaa !17
  %65 = getelementptr inbounds %struct.DNivec3, ptr %13, i32 0, i32 2
  %66 = load i32, ptr %10, align 4, !tbaa !14
  store i32 %66, ptr %65, align 4, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %67 = getelementptr inbounds %struct.DNivec3, ptr %13, i32 0, i32 0
  %68 = load i32, ptr %67, align 4, !tbaa !15
  %69 = load ptr, ptr %7, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.DNvolume, ptr %69, i32 0, i32 3
  %71 = getelementptr inbounds %struct.DNuvec3, ptr %70, i32 0, i32 0
  %72 = load i32, ptr %71, align 4, !tbaa !19
  %73 = getelementptr inbounds %struct.DNivec3, ptr %13, i32 0, i32 1
  %74 = load i32, ptr %73, align 4, !tbaa !17
  %75 = getelementptr inbounds %struct.DNivec3, ptr %13, i32 0, i32 2
  %76 = load i32, ptr %75, align 4, !tbaa !18
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = getelementptr inbounds %struct.DNvolume, ptr %77, i32 0, i32 3
  %79 = getelementptr inbounds %struct.DNuvec3, ptr %78, i32 0, i32 1
  %80 = load i32, ptr %79, align 4, !tbaa !24
  %81 = mul i32 %76, %80
  %82 = add i32 %74, %81
  %83 = mul i32 %72, %82
  %84 = add i32 %68, %83
  store i32 %84, ptr %14, align 4, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %85 = getelementptr inbounds %struct.DNivec3, ptr %13, i32 0, i32 0
  %86 = load i32, ptr %85, align 4, !tbaa !15
  %87 = getelementptr inbounds %struct.DNuvec3, ptr %5, i32 0, i32 0
  %88 = load i32, ptr %87, align 4, !tbaa !9
  %89 = getelementptr inbounds %struct.DNivec3, ptr %13, i32 0, i32 1
  %90 = load i32, ptr %89, align 4, !tbaa !17
  %91 = getelementptr inbounds %struct.DNivec3, ptr %13, i32 0, i32 2
  %92 = load i32, ptr %91, align 4, !tbaa !18
  %93 = getelementptr inbounds %struct.DNuvec3, ptr %5, i32 0, i32 1
  %94 = load i32, ptr %93, align 4, !tbaa !12
  %95 = mul i32 %92, %94
  %96 = add i32 %90, %95
  %97 = mul i32 %88, %96
  %98 = add i32 %86, %97
  store i32 %98, ptr %15, align 4, !tbaa !14
  %99 = load ptr, ptr %8, align 8, !tbaa !5
  %100 = load i32, ptr %15, align 4, !tbaa !14
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds %struct.DNchunkHandle, ptr %99, i64 %101
  %103 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %16, ptr align 4 %13, i64 12, i1 false)
  %104 = getelementptr inbounds { i64, i32 }, ptr %16, i32 0, i32 0
  %105 = load i64, ptr %104, align 4
  %106 = getelementptr inbounds { i64, i32 }, ptr %16, i32 0, i32 1
  %107 = load i32, ptr %106, align 4
  %108 = call zeroext i1 @DN_in_map_bounds(ptr noundef %103, i64 %105, i32 %107)
  br i1 %108, label %109, label %116

109:                                              ; preds = %60
  %110 = load ptr, ptr %7, align 8, !tbaa !5
  %111 = getelementptr inbounds %struct.DNvolume, ptr %110, i32 0, i32 10
  %112 = load ptr, ptr %111, align 8, !tbaa !25
  %113 = load i32, ptr %14, align 4, !tbaa !14
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds %struct.DNchunkHandle, ptr %112, i64 %114
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %102, ptr align 4 %115, i64 8, i1 false), !tbaa.struct !26
  br label %119

116:                                              ; preds = %60
  %117 = getelementptr inbounds %struct.DNchunkHandle, ptr %17, i32 0, i32 0
  store i8 0, ptr %117, align 4, !tbaa !28
  %118 = getelementptr inbounds %struct.DNchunkHandle, ptr %17, i32 0, i32 1
  store i32 0, ptr %118, align 4, !tbaa !30
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %102, ptr align 4 %17, i64 8, i1 false), !tbaa.struct !26
  br label %119

119:                                              ; preds = %116, %109
  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 12, ptr %13) #5
  br label %120

120:                                              ; preds = %119
  %121 = load i32, ptr %12, align 4, !tbaa !14
  %122 = add nsw i32 %121, 1
  store i32 %122, ptr %12, align 4, !tbaa !14
  br label %54, !llvm.loop !31

123:                                              ; preds = %59
  br label %124

124:                                              ; preds = %123
  %125 = load i32, ptr %11, align 4, !tbaa !14
  %126 = add nsw i32 %125, 1
  store i32 %126, ptr %11, align 4, !tbaa !14
  br label %47, !llvm.loop !33

127:                                              ; preds = %52
  br label %128

128:                                              ; preds = %127
  %129 = load i32, ptr %10, align 4, !tbaa !14
  %130 = add nsw i32 %129, 1
  store i32 %130, ptr %10, align 4, !tbaa !14
  br label %40, !llvm.loop !34

131:                                              ; preds = %45
  %132 = load ptr, ptr %7, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.DNvolume, ptr %132, i32 0, i32 10
  %134 = load ptr, ptr %133, align 8, !tbaa !25
  call void @free(ptr noundef %134) #5
  %135 = load ptr, ptr %8, align 8, !tbaa !5
  %136 = load ptr, ptr %7, align 8, !tbaa !5
  %137 = getelementptr inbounds %struct.DNvolume, ptr %136, i32 0, i32 10
  store ptr %135, ptr %137, align 8, !tbaa !25
  %138 = load ptr, ptr %7, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.DNvolume, ptr %138, i32 0, i32 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %139, ptr align 4 %5, i64 12, i1 false), !tbaa.struct !35
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  store i32 0, ptr %18, align 4, !tbaa !14
  br label %140

140:                                              ; preds = %166, %131
  %141 = load i32, ptr %18, align 4, !tbaa !14
  %142 = sext i32 %141 to i64
  %143 = load ptr, ptr %7, align 8, !tbaa !5
  %144 = getelementptr inbounds %struct.DNvolume, ptr %143, i32 0, i32 4
  %145 = load i64, ptr %144, align 8, !tbaa !36
  %146 = icmp ult i64 %142, %145
  br i1 %146, label %148, label %147

147:                                              ; preds = %140
  store i32 11, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %169

148:                                              ; preds = %140
  %149 = load ptr, ptr %7, align 8, !tbaa !5
  %150 = load ptr, ptr %7, align 8, !tbaa !5
  %151 = getelementptr inbounds %struct.DNvolume, ptr %150, i32 0, i32 11
  %152 = load ptr, ptr %151, align 8, !tbaa !37
  %153 = load i32, ptr %18, align 4, !tbaa !14
  %154 = sext i32 %153 to i64
  %155 = getelementptr inbounds %struct.DNchunk, ptr %152, i64 %154
  %156 = getelementptr inbounds %struct.DNchunk, ptr %155, i32 0, i32 0
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %19, ptr align 4 %156, i64 12, i1 false)
  %157 = getelementptr inbounds { i64, i32 }, ptr %19, i32 0, i32 0
  %158 = load i64, ptr %157, align 4
  %159 = getelementptr inbounds { i64, i32 }, ptr %19, i32 0, i32 1
  %160 = load i32, ptr %159, align 4
  %161 = call zeroext i1 @DN_in_map_bounds(ptr noundef %149, i64 %158, i32 %160)
  br i1 %161, label %165, label %162

162:                                              ; preds = %148
  %163 = load ptr, ptr %7, align 8, !tbaa !5
  %164 = load i32, ptr %18, align 4, !tbaa !14
  call void @_DN_clear_chunk(ptr noundef %163, i32 noundef %164)
  br label %165

165:                                              ; preds = %162, %148
  br label %166

166:                                              ; preds = %165
  %167 = load i32, ptr %18, align 4, !tbaa !14
  %168 = add nsw i32 %167, 1
  store i32 %168, ptr %18, align 4, !tbaa !14
  br label %140, !llvm.loop !38

169:                                              ; preds = %147
  call void @_DN_clear_gl_errors()
  %170 = load ptr, ptr @glad_glBindBuffer, align 8, !tbaa !5
  %171 = load ptr, ptr %7, align 8, !tbaa !5
  %172 = getelementptr inbounds %struct.DNvolume, ptr %171, i32 0, i32 0
  %173 = load i32, ptr %172, align 8, !tbaa !39
  call void %170(i32 noundef 37074, i32 noundef %173)
  %174 = load ptr, ptr @glad_glBufferData, align 8, !tbaa !5
  %175 = getelementptr inbounds %struct.DNuvec3, ptr %5, i32 0, i32 0
  %176 = load i32, ptr %175, align 4, !tbaa !9
  %177 = zext i32 %176 to i64
  %178 = mul i64 12, %177
  %179 = getelementptr inbounds %struct.DNuvec3, ptr %5, i32 0, i32 1
  %180 = load i32, ptr %179, align 4, !tbaa !12
  %181 = zext i32 %180 to i64
  %182 = mul i64 %178, %181
  %183 = getelementptr inbounds %struct.DNuvec3, ptr %5, i32 0, i32 2
  %184 = load i32, ptr %183, align 4, !tbaa !13
  %185 = zext i32 %184 to i64
  %186 = mul i64 %182, %185
  %187 = load ptr, ptr %7, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.DNvolume, ptr %187, i32 0, i32 10
  %189 = load ptr, ptr %188, align 8, !tbaa !25
  call void %174(i32 noundef 37074, i64 noundef %186, ptr noundef %189, i32 noundef 35048)
  %190 = call zeroext i1 @_DN_gl_error()
  br i1 %190, label %191, label %193

191:                                              ; preds = %169
  %192 = load ptr, ptr @g_DN_message_callback, align 8, !tbaa !5
  call void %192(i32 noundef 1, i32 noundef 1, ptr noundef @.str.45)
  store i1 false, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %218

193:                                              ; preds = %169
  call void @_DN_clear_gl_errors()
  %194 = load ptr, ptr @glad_glBindBuffer, align 8, !tbaa !5
  %195 = load ptr, ptr %7, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.DNvolume, ptr %195, i32 0, i32 1
  %197 = load i32, ptr %196, align 4, !tbaa !40
  call void %194(i32 noundef 37074, i32 noundef %197)
  %198 = load ptr, ptr @glad_glBufferData, align 8, !tbaa !5
  %199 = getelementptr inbounds %struct.DNuvec3, ptr %5, i32 0, i32 0
  %200 = load i32, ptr %199, align 4, !tbaa !9
  %201 = zext i32 %200 to i64
  %202 = mul i64 96, %201
  %203 = getelementptr inbounds %struct.DNuvec3, ptr %5, i32 0, i32 1
  %204 = load i32, ptr %203, align 4, !tbaa !12
  %205 = zext i32 %204 to i64
  %206 = mul i64 %202, %205
  %207 = getelementptr inbounds %struct.DNuvec3, ptr %5, i32 0, i32 2
  %208 = load i32, ptr %207, align 4, !tbaa !13
  %209 = zext i32 %208 to i64
  %210 = mul i64 %206, %209
  %211 = load ptr, ptr %7, align 8, !tbaa !5
  %212 = getelementptr inbounds %struct.DNvolume, ptr %211, i32 0, i32 10
  %213 = load ptr, ptr %212, align 8, !tbaa !25
  call void %198(i32 noundef 37074, i64 noundef %210, ptr noundef %213, i32 noundef 35048)
  %214 = call zeroext i1 @_DN_gl_error()
  br i1 %214, label %215, label %217

215:                                              ; preds = %193
  %216 = load ptr, ptr @g_DN_message_callback, align 8, !tbaa !5
  call void %216(i32 noundef 1, i32 noundef 1, ptr noundef @.str.46)
  store i1 false, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %218

217:                                              ; preds = %193
  store i1 true, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %218

218:                                              ; preds = %217, %215, %191, %37
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  %219 = load i1, ptr %4, align 1
  ret i1 %219
}

; Function Attrs: nounwind uwtable
declare hidden void @_DN_clear_gl_errors() #3

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @_DN_gl_error() #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree 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 = { 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 }
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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"DNuvec3", !11, i64 0, !11, i64 4, !11, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 4}
!13 = !{!10, !11, i64 8}
!14 = !{!11, !11, i64 0}
!15 = !{!16, !11, i64 0}
!16 = !{!"DNivec3", !11, i64 0, !11, i64 4, !11, i64 8}
!17 = !{!16, !11, i64 4}
!18 = !{!16, !11, i64 8}
!19 = !{!20, !11, i64 12}
!20 = !{!"DNvolume", !11, i64 0, !11, i64 4, !11, i64 8, !10, i64 12, !21, i64 24, !21, i64 32, !21, i64 40, !21, i64 48, !21, i64 56, !21, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !7, i64 112, !7, i64 124, !22, i64 136, !11, i64 140, !7, i64 144, !7, i64 156, !7, i64 168, !11, i64 180, !11, i64 184, !22, i64 188, !23, i64 192, !11, i64 196, !7, i64 200, !7, i64 212, !11, i64 224, !22, i64 228}
!21 = !{!"long", !7, i64 0}
!22 = !{!"float", !7, i64 0}
!23 = !{!"_Bool", !7, i64 0}
!24 = !{!20, !11, i64 16}
!25 = !{!20, !6, i64 72}
!26 = !{i64 0, i64 1, !27, i64 4, i64 4, !14}
!27 = !{!7, !7, i64 0}
!28 = !{!29, !7, i64 0}
!29 = !{!"DNchunkHandle", !7, i64 0, !11, i64 4}
!30 = !{!29, !11, i64 4}
!31 = distinct !{!31, !32}
!32 = !{!"llvm.loop.mustprogress"}
!33 = distinct !{!33, !32}
!34 = distinct !{!34, !32}
!35 = !{i64 0, i64 4, !14, i64 4, i64 4, !14, i64 8, i64 4, !14}
!36 = !{!20, !21, i64 24}
!37 = !{!20, !6, i64 80}
!38 = distinct !{!38, !32}
!39 = !{!20, !11, i64 0}
!40 = !{!20, !11, i64 4}


; 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.DNchunkHandle = type { i8, i32 }
%struct.DNchunk = type { %struct.DNivec3, i8, i32, i32, [8 x [8 x [8 x %struct.DNcompressedVoxel]]] }
%struct.DNivec3 = type { i32, i32, i32 }
%struct.DNcompressedVoxel = type { i32, i32 }

@g_DN_message_callback = external dso_local local_unnamed_addr global ptr, align 8
@glad_glBindBuffer = external local_unnamed_addr global ptr, align 8
@glad_glBufferData = external local_unnamed_addr global ptr, align 8
@.str.44 = external hidden unnamed_addr constant [36 x i8], align 1
@.str.45 = external hidden unnamed_addr constant [32 x i8], align 1
@.str.46 = external hidden unnamed_addr constant [34 x i8], align 1

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

; Function Attrs: nounwind uwtable
declare hidden void @_DN_clear_chunk(ptr noundef, i32 noundef) local_unnamed_addr #1

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

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

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @DN_set_map_size(ptr noundef %0, i64 %1, i32 %2) local_unnamed_addr #1 {
  %.sroa.048.sroa.0.0.extract.trunc = trunc i64 %1 to i32
  %.sroa.048.sroa.7.0.extract.shift = lshr i64 %1, 32
  %.sroa.048.sroa.7.0.extract.trunc = trunc nuw i64 %.sroa.048.sroa.7.0.extract.shift to i32
  %4 = and i64 %1, 4294967295
  %5 = zext i32 %2 to i64
  %6 = mul nuw i64 %.sroa.048.sroa.7.0.extract.shift, %5
  %7 = shl i64 %6, 3
  %8 = mul i64 %7, %4
  %9 = tail call noalias ptr @malloc(i64 noundef %8) #3
  %.not = icmp eq ptr %9, null
  br i1 %.not, label %37, label %.preheader73

.preheader73:                                     ; preds = %3
  %.not89 = icmp eq i32 %2, 0
  br i1 %.not89, label %._crit_edge, label %.preheader72.lr.ph

.preheader72.lr.ph:                               ; preds = %.preheader73
  %.not90 = icmp ult i64 %1, 4294967296
  %10 = getelementptr inbounds i8, ptr %0, i64 12
  %11 = getelementptr inbounds i8, ptr %0, i64 16
  %12 = getelementptr inbounds i8, ptr %0, i64 72
  %.not91 = icmp eq i32 %.sroa.048.sroa.0.0.extract.trunc, 0
  %or.cond = or i1 %.not90, %.not91
  br i1 %or.cond, label %._crit_edge, label %.preheader72.us.us.preheader

.preheader72.us.us.preheader:                     ; preds = %.preheader72.lr.ph
  %wide.trip.count = and i64 %1, 4294967295
  br label %.preheader72.us.us

.preheader72.us.us:                               ; preds = %.preheader72.us.us.preheader, %._crit_edge77.split.us.us.us
  %.06680.us.us = phi i32 [ %36, %._crit_edge77.split.us.us.us ], [ 0, %.preheader72.us.us.preheader ]
  %13 = mul i32 %.06680.us.us, %.sroa.048.sroa.7.0.extract.trunc
  br label %.preheader.us.us.us

.preheader.us.us.us:                              ; preds = %._crit_edge.us.us.us, %.preheader72.us.us
  %indvars.iv96 = phi i64 [ %indvars.iv.next97, %._crit_edge.us.us.us ], [ 0, %.preheader72.us.us ]
  %.sroa.011.4.insert.shift.us.us.us = shl nuw nsw i64 %indvars.iv96, 32
  %14 = trunc nuw nsw i64 %indvars.iv96 to i32
  %15 = add i32 %13, %14
  %16 = mul i32 %15, %.sroa.048.sroa.0.0.extract.trunc
  br label %17

17:                                               ; preds = %35, %.preheader.us.us.us
  %indvars.iv = phi i64 [ %indvars.iv.next, %35 ], [ 0, %.preheader.us.us.us ]
  %.sroa.011.4.insert.insert.us.us.us = or disjoint i64 %.sroa.011.4.insert.shift.us.us.us, %indvars.iv
  %18 = load i32, ptr %10, align 4, !tbaa !5
  %19 = load i32, ptr %11, align 4, !tbaa !15
  %20 = trunc nuw nsw i64 %indvars.iv to i32
  %21 = add i32 %16, %20
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds %struct.DNchunkHandle, ptr %9, i64 %22
  %24 = tail call zeroext i1 @DN_in_map_bounds(ptr noundef %0, i64 %.sroa.011.4.insert.insert.us.us.us, i32 %.06680.us.us)
  br i1 %24, label %26, label %25

25:                                               ; preds = %17
  store i8 0, ptr %23, align 4, !tbaa !16
  %.sroa.26.0..sroa_idx.us.us.us = getelementptr inbounds i8, ptr %23, i64 4
  store i32 0, ptr %.sroa.26.0..sroa_idx.us.us.us, align 4, !tbaa !17
  br label %35

26:                                               ; preds = %17
  %27 = mul i32 %19, %.06680.us.us
  %28 = add i32 %27, %14
  %29 = mul i32 %28, %18
  %30 = add i32 %29, %20
  %31 = load ptr, ptr %12, align 8, !tbaa !18
  %32 = sext i32 %30 to i64
  %33 = getelementptr inbounds %struct.DNchunkHandle, ptr %31, i64 %32
  %34 = load i64, ptr %33, align 4
  store i64 %34, ptr %23, align 4
  br label %35

35:                                               ; preds = %26, %25
  %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.us.us.us, label %17, !llvm.loop !19

._crit_edge.us.us.us:                             ; preds = %35
  %indvars.iv.next97 = add nuw nsw i64 %indvars.iv96, 1
  %exitcond100.not = icmp eq i64 %indvars.iv.next97, %.sroa.048.sroa.7.0.extract.shift
  br i1 %exitcond100.not, label %._crit_edge77.split.us.us.us, label %.preheader.us.us.us, !llvm.loop !21

._crit_edge77.split.us.us.us:                     ; preds = %._crit_edge.us.us.us
  %36 = add nuw i32 %.06680.us.us, 1
  %exitcond101.not = icmp eq i32 %36, %2
  br i1 %exitcond101.not, label %._crit_edge, label %.preheader72.us.us, !llvm.loop !22

37:                                               ; preds = %3
  %38 = load ptr, ptr @g_DN_message_callback, align 8, !tbaa !23
  tail call void %38(i32 noundef 0, i32 noundef 1, ptr noundef nonnull @.str.44) #4
  br label %74

._crit_edge:                                      ; preds = %._crit_edge77.split.us.us.us, %.preheader72.lr.ph, %.preheader73
  %39 = getelementptr inbounds i8, ptr %0, i64 72
  %40 = load ptr, ptr %39, align 8, !tbaa !18
  tail call void @free(ptr noundef %40) #4
  store ptr %9, ptr %39, align 8, !tbaa !18
  %41 = getelementptr inbounds i8, ptr %0, i64 12
  store i64 %1, ptr %41, align 4
  %.sroa.12.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 20
  store i32 %2, ptr %.sroa.12.0..sroa_idx, align 4, !tbaa !17
  %42 = getelementptr inbounds i8, ptr %0, i64 24
  %43 = load i64, ptr %42, align 8, !tbaa !24
  %.not92 = icmp eq i64 %43, 0
  br i1 %.not92, label %._crit_edge88, label %.lr.ph

.lr.ph:                                           ; preds = %._crit_edge
  %44 = getelementptr inbounds i8, ptr %0, i64 80
  br label %52

._crit_edge88:                                    ; preds = %58, %._crit_edge
  tail call void @_DN_clear_gl_errors()
  %45 = load ptr, ptr @glad_glBindBuffer, align 8, !tbaa !23
  %46 = load i32, ptr %0, align 8, !tbaa !25
  tail call void %45(i32 noundef 37074, i32 noundef %46) #4
  %47 = load ptr, ptr @glad_glBufferData, align 8, !tbaa !23
  %48 = mul i64 %6, 12
  %49 = mul i64 %48, %4
  %50 = load ptr, ptr %39, align 8, !tbaa !18
  tail call void %47(i32 noundef 37074, i64 noundef %49, ptr noundef %50, i32 noundef 35048) #4
  %51 = tail call zeroext i1 @_DN_gl_error()
  br i1 %51, label %61, label %63

52:                                               ; preds = %.lr.ph, %58
  %indvars.iv102 = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next103, %58 ]
  %53 = load ptr, ptr %44, align 8, !tbaa !26
  %54 = getelementptr inbounds %struct.DNchunk, ptr %53, i64 %indvars.iv102
  %.sroa.0.0.copyload = load i64, ptr %54, align 4
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %54, i64 8
  %.sroa.2.0.copyload = load i32, ptr %.sroa.2.0..sroa_idx, align 4
  %55 = tail call zeroext i1 @DN_in_map_bounds(ptr noundef nonnull %0, i64 %.sroa.0.0.copyload, i32 %.sroa.2.0.copyload)
  br i1 %55, label %58, label %56

56:                                               ; preds = %52
  %57 = trunc nuw nsw i64 %indvars.iv102 to i32
  tail call void @_DN_clear_chunk(ptr noundef nonnull %0, i32 noundef %57)
  br label %58

58:                                               ; preds = %52, %56
  %indvars.iv.next103 = add nuw nsw i64 %indvars.iv102, 1
  %59 = load i64, ptr %42, align 8, !tbaa !24
  %60 = icmp ugt i64 %59, %indvars.iv.next103
  br i1 %60, label %52, label %._crit_edge88, !llvm.loop !27

61:                                               ; preds = %._crit_edge88
  %62 = load ptr, ptr @g_DN_message_callback, align 8, !tbaa !23
  tail call void %62(i32 noundef 1, i32 noundef 1, ptr noundef nonnull @.str.45) #4
  br label %74

63:                                               ; preds = %._crit_edge88
  tail call void @_DN_clear_gl_errors()
  %64 = load ptr, ptr @glad_glBindBuffer, align 8, !tbaa !23
  %65 = getelementptr inbounds i8, ptr %0, i64 4
  %66 = load i32, ptr %65, align 4, !tbaa !28
  tail call void %64(i32 noundef 37074, i32 noundef %66) #4
  %67 = load ptr, ptr @glad_glBufferData, align 8, !tbaa !23
  %68 = mul i64 %6, 96
  %69 = mul i64 %68, %4
  %70 = load ptr, ptr %39, align 8, !tbaa !18
  tail call void %67(i32 noundef 37074, i64 noundef %69, ptr noundef %70, i32 noundef 35048) #4
  %71 = tail call zeroext i1 @_DN_gl_error()
  br i1 %71, label %72, label %74

72:                                               ; preds = %63
  %73 = load ptr, ptr @g_DN_message_callback, align 8, !tbaa !23
  tail call void %73(i32 noundef 1, i32 noundef 1, ptr noundef nonnull @.str.46) #4
  br label %74

74:                                               ; preds = %63, %72, %61, %37
  %.0 = phi i1 [ false, %61 ], [ false, %72 ], [ false, %37 ], [ true, %63 ]
  ret i1 %.0
}

; Function Attrs: nounwind uwtable
declare hidden void @_DN_clear_gl_errors() local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @_DN_gl_error() local_unnamed_addr #1

attributes #0 = { 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 #1 = { 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 #2 = { 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 #3 = { nounwind allocsize(0) }
attributes #4 = { 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 12}
!6 = !{!"DNvolume", !7, i64 0, !7, i64 4, !7, i64 8, !10, i64 12, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !12, i64 72, !12, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !8, i64 112, !8, i64 124, !13, i64 136, !7, i64 140, !8, i64 144, !8, i64 156, !8, i64 168, !7, i64 180, !7, i64 184, !13, i64 188, !14, i64 192, !7, i64 196, !8, i64 200, !8, i64 212, !7, i64 224, !13, i64 228}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"DNuvec3", !7, i64 0, !7, i64 4, !7, i64 8}
!11 = !{!"long", !8, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!"float", !8, i64 0}
!14 = !{!"_Bool", !8, i64 0}
!15 = !{!6, !7, i64 16}
!16 = !{!8, !8, i64 0}
!17 = !{!7, !7, i64 0}
!18 = !{!6, !12, i64 72}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}
!22 = distinct !{!22, !20}
!23 = !{!12, !12, i64 0}
!24 = !{!6, !11, i64 24}
!25 = !{!6, !7, i64 0}
!26 = !{!6, !12, i64 80}
!27 = distinct !{!27, !20}
!28 = !{!6, !7, i64 4}


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