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

%union.QMvec3 = type { [3 x float] }
%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 }
%struct.DNuvec3 = type { i32, i32, i32 }

@g_lightingRequestBuffer = external dso_local global i32, align 4
@g_lightingProgram = external dso_local global i32, align 4
@g_maxLightingRequests = external dso_local global i32, align 4
@g_DN_message_callback = external dso_local global ptr, align 8
@glad_glBindBufferBase = external global ptr, align 8
@glad_glBindBuffer = external global ptr, align 8
@glad_glMemoryBarrier = external global ptr, align 8
@glad_glUseProgram = external global ptr, align 8
@glad_glBufferSubData = external global ptr, align 8
@glad_glBindTexture = external global ptr, align 8
@glad_glActiveTexture = external global ptr, align 8
@.str.23 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [16 x i8], align 1
@glad_glUniform3uiv = external global ptr, align 8
@glad_glGetUniformLocation = external global ptr, align 8
@.str.33 = external hidden unnamed_addr constant [8 x i8], align 1
@glad_glDispatchCompute = external global ptr, align 8
@.str.34 = external hidden unnamed_addr constant [86 x i8], align 1
@glad_glBufferData = external global ptr, align 8
@.str.35 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [15 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
declare i32 @sprintf(ptr noundef, ptr noundef, ...) #2

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @DN_update_lighting(ptr noundef %0, i32 noundef %1, i32 noundef %2, float noundef %3) #4 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca float, align 4
  %9 = alloca i64, align 8
  %10 = alloca [256 x i8], align 16
  %11 = alloca i32, align 4
  %12 = alloca %union.QMvec3, align 4
  %13 = alloca { <2 x float>, float }, align 8
  %14 = alloca { <2 x float>, float }, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !9
  store float %3, ptr %8, align 4, !tbaa !11
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.DNvolume, ptr %15, i32 0, i32 29
  %17 = load i32, ptr %16, align 8, !tbaa !13
  %18 = icmp eq i32 %17, 0
  br i1 %18, label %19, label %23

19:                                               ; preds = %4
  %20 = load float, ptr %8, align 4, !tbaa !11
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.DNvolume, ptr %21, i32 0, i32 30
  store float %20, ptr %22, align 4, !tbaa !18
  br label %23

23:                                               ; preds = %19, %4
  %24 = load ptr, ptr @glad_glUseProgram, align 8, !tbaa !5
  %25 = load i32, ptr @g_lightingProgram, align 4, !tbaa !9
  call void %24(i32 noundef %25)
  %26 = load ptr, ptr @glad_glBindBufferBase, align 8, !tbaa !5
  %27 = load ptr, ptr %5, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.DNvolume, ptr %27, i32 0, i32 1
  %29 = load i32, ptr %28, align 4, !tbaa !19
  call void %26(i32 noundef 37074, i32 noundef 1, i32 noundef %29)
  %30 = load ptr, ptr @glad_glBindBufferBase, align 8, !tbaa !5
  %31 = load ptr, ptr %5, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.DNvolume, ptr %31, i32 0, i32 0
  %33 = load i32, ptr %32, align 8, !tbaa !20
  call void %30(i32 noundef 37074, i32 noundef 0, i32 noundef %33)
  %34 = load ptr, ptr @glad_glBindBufferBase, align 8, !tbaa !5
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.DNvolume, ptr %35, i32 0, i32 2
  %37 = load i32, ptr %36, align 8, !tbaa !21
  call void %34(i32 noundef 37074, i32 noundef 4, i32 noundef %37)
  %38 = load ptr, ptr @glad_glBindBuffer, align 8, !tbaa !5
  %39 = load i32, ptr @g_lightingRequestBuffer, align 4, !tbaa !9
  call void %38(i32 noundef 37074, i32 noundef %39)
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.DNvolume, ptr %40, i32 0, i32 8
  %42 = load i64, ptr %41, align 8, !tbaa !22
  %43 = load i32, ptr @g_maxLightingRequests, align 4, !tbaa !9
  %44 = sext i32 %43 to i64
  %45 = icmp ugt i64 %42, %44
  br i1 %45, label %46, label %78

46:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %47 = load i32, ptr @g_maxLightingRequests, align 4, !tbaa !9
  %48 = sext i32 %47 to i64
  store i64 %48, ptr %9, align 8, !tbaa !23
  br label %49

49:                                               ; preds = %55, %46
  %50 = load i64, ptr %9, align 8, !tbaa !23
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.DNvolume, ptr %51, i32 0, i32 8
  %53 = load i64, ptr %52, align 8, !tbaa !22
  %54 = icmp ult i64 %50, %53
  br i1 %54, label %55, label %58

55:                                               ; preds = %49
  %56 = load i64, ptr %9, align 8, !tbaa !23
  %57 = mul i64 %56, 2
  store i64 %57, ptr %9, align 8, !tbaa !23
  br label %49, !llvm.loop !24

58:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 256, ptr %10) #7
  %59 = getelementptr inbounds [256 x i8], ptr %10, i64 0, i64 0
  %60 = load i64, ptr %9, align 8, !tbaa !23
  %61 = load i64, ptr %9, align 8, !tbaa !23
  %62 = mul i64 %61, 4
  %63 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %59, ptr noundef @.str.34, i64 noundef %60, i64 noundef %62) #7
  %64 = load ptr, ptr @g_DN_message_callback, align 8, !tbaa !5
  %65 = getelementptr inbounds [256 x i8], ptr %10, i64 0, i64 0
  call void %64(i32 noundef 1, i32 noundef 0, ptr noundef %65)
  call void @_DN_clear_gl_errors()
  %66 = load ptr, ptr @glad_glBufferData, align 8, !tbaa !5
  %67 = load i64, ptr %9, align 8, !tbaa !23
  %68 = mul i64 %67, 4
  call void %66(i32 noundef 37074, i64 noundef %68, ptr noundef null, i32 noundef 35048)
  %69 = call zeroext i1 @_DN_gl_error()
  br i1 %69, label %70, label %72

70:                                               ; preds = %58
  %71 = load ptr, ptr @g_DN_message_callback, align 8, !tbaa !5
  call void %71(i32 noundef 1, i32 noundef 1, ptr noundef @.str.35)
  store i32 1, ptr %11, align 4
  br label %75

72:                                               ; preds = %58
  %73 = load i64, ptr %9, align 8, !tbaa !23
  %74 = trunc i64 %73 to i32
  store i32 %74, ptr @g_maxLightingRequests, align 4, !tbaa !9
  store i32 0, ptr %11, align 4
  br label %75

75:                                               ; preds = %72, %70
  call void @llvm.lifetime.end.p0(i64 256, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  %76 = load i32, ptr %11, align 4
  switch i32 %76, label %163 [
    i32 0, label %77
    i32 1, label %162
  ]

77:                                               ; preds = %75
  br label %78

78:                                               ; preds = %77, %23
  %79 = load ptr, ptr @glad_glBufferSubData, align 8, !tbaa !5
  %80 = load ptr, ptr %5, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.DNvolume, ptr %80, i32 0, i32 8
  %82 = load i64, ptr %81, align 8, !tbaa !22
  %83 = mul i64 %82, 4
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.DNvolume, ptr %84, i32 0, i32 13
  %86 = load ptr, ptr %85, align 8, !tbaa !26
  call void %79(i32 noundef 37074, i64 noundef 0, i64 noundef %83, ptr noundef %86)
  %87 = load i32, ptr @g_lightingProgram, align 4, !tbaa !9
  %88 = load ptr, ptr %5, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.DNvolume, ptr %88, i32 0, i32 25
  %90 = load i8, ptr %89, align 8, !tbaa !27, !range !28, !noundef !29
  %91 = trunc i8 %90 to i1
  %92 = zext i1 %91 to i32
  call void @DN_program_uniform_uint(i32 noundef %87, ptr noundef @.str.23, i32 noundef %92)
  %93 = load i32, ptr @g_lightingProgram, align 4, !tbaa !9
  call void @DN_program_uniform_int(i32 noundef %93, ptr noundef @.str.24, i32 noundef 2)
  %94 = load ptr, ptr %5, align 8, !tbaa !5
  %95 = getelementptr inbounds %struct.DNvolume, ptr %94, i32 0, i32 25
  %96 = load i8, ptr %95, align 8, !tbaa !27, !range !28, !noundef !29
  %97 = trunc i8 %96 to i1
  br i1 %97, label %98, label %104

98:                                               ; preds = %78
  %99 = load ptr, ptr @glad_glActiveTexture, align 8, !tbaa !5
  call void %99(i32 noundef 33986)
  %100 = load ptr, ptr @glad_glBindTexture, align 8, !tbaa !5
  %101 = load ptr, ptr %5, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.DNvolume, ptr %101, i32 0, i32 26
  %103 = load i32, ptr %102, align 4, !tbaa !30
  call void %100(i32 noundef 34067, i32 noundef %103)
  br label %111

104:                                              ; preds = %78
  %105 = load i32, ptr @g_lightingProgram, align 4, !tbaa !9
  %106 = load ptr, ptr %5, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.DNvolume, ptr %106, i32 0, i32 27
  call void @DN_program_uniform_vec3(i32 noundef %105, ptr noundef @.str.25, ptr noundef %107)
  %108 = load i32, ptr @g_lightingProgram, align 4, !tbaa !9
  %109 = load ptr, ptr %5, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.DNvolume, ptr %109, i32 0, i32 28
  call void @DN_program_uniform_vec3(i32 noundef %108, ptr noundef @.str.26, ptr noundef %110)
  br label %111

111:                                              ; preds = %104, %98
  %112 = load i32, ptr @g_lightingProgram, align 4, !tbaa !9
  %113 = load ptr, ptr %5, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.DNvolume, ptr %113, i32 0, i32 15
  call void @DN_program_uniform_vec3(i32 noundef %112, ptr noundef @.str.36, ptr noundef %114)
  %115 = load i32, ptr @g_lightingProgram, align 4, !tbaa !9
  %116 = load ptr, ptr %5, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.DNvolume, ptr %116, i32 0, i32 30
  %118 = load float, ptr %117, align 4, !tbaa !18
  call void @DN_program_uniform_float(i32 noundef %115, ptr noundef @.str.37, float noundef %118)
  %119 = load i32, ptr @g_lightingProgram, align 4, !tbaa !9
  %120 = load i32, ptr %6, align 4, !tbaa !9
  call void @DN_program_uniform_uint(i32 noundef %119, ptr noundef @.str.38, i32 noundef %120)
  %121 = load i32, ptr @g_lightingProgram, align 4, !tbaa !9
  %122 = load i32, ptr %7, align 4, !tbaa !9
  call void @DN_program_uniform_uint(i32 noundef %121, ptr noundef @.str.39, i32 noundef %122)
  %123 = load i32, ptr @g_lightingProgram, align 4, !tbaa !9
  %124 = load ptr, ptr %5, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.DNvolume, ptr %124, i32 0, i32 22
  %126 = load i32, ptr %125, align 4, !tbaa !31
  call void @DN_program_uniform_uint(i32 noundef %123, ptr noundef @.str.40, i32 noundef %126)
  %127 = load i32, ptr @g_lightingProgram, align 4, !tbaa !9
  %128 = load ptr, ptr %5, align 8, !tbaa !5
  %129 = getelementptr inbounds %struct.DNvolume, ptr %128, i32 0, i32 23
  %130 = load i32, ptr %129, align 8, !tbaa !32
  call void @DN_program_uniform_uint(i32 noundef %127, ptr noundef @.str.41, i32 noundef %130)
  call void @llvm.lifetime.start.p0(i64 12, ptr %12) #7
  %131 = load ptr, ptr %5, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.DNvolume, ptr %131, i32 0, i32 19
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %13, ptr align 8 %132, i64 12, i1 false)
  %133 = getelementptr inbounds { <2 x float>, float }, ptr %13, i32 0, i32 0
  %134 = load <2 x float>, ptr %133, align 8
  %135 = getelementptr inbounds { <2 x float>, float }, ptr %13, i32 0, i32 1
  %136 = load float, ptr %135, align 8
  %137 = call { <2 x float>, float } @DN_vec3_normalize(<2 x float> %134, float %136)
  %138 = getelementptr inbounds %union.QMvec3, ptr %12, i32 0, i32 0
  store { <2 x float>, float } %137, ptr %14, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %138, ptr align 8 %14, i64 12, i1 false)
  %139 = load i32, ptr @g_lightingProgram, align 4, !tbaa !9
  call void @DN_program_uniform_vec3(i32 noundef %139, ptr noundef @.str.42, ptr noundef %12)
  %140 = load i32, ptr @g_lightingProgram, align 4, !tbaa !9
  %141 = load ptr, ptr %5, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.DNvolume, ptr %141, i32 0, i32 20
  call void @DN_program_uniform_vec3(i32 noundef %140, ptr noundef @.str.27, ptr noundef %142)
  %143 = load i32, ptr @g_lightingProgram, align 4, !tbaa !9
  %144 = load ptr, ptr %5, align 8, !tbaa !5
  %145 = getelementptr inbounds %struct.DNvolume, ptr %144, i32 0, i32 24
  %146 = load float, ptr %145, align 4, !tbaa !33
  call void @DN_program_uniform_float(i32 noundef %143, ptr noundef @.str.43, float noundef %146)
  %147 = load i32, ptr @g_lightingProgram, align 4, !tbaa !9
  %148 = load ptr, ptr %5, align 8, !tbaa !5
  %149 = getelementptr inbounds %struct.DNvolume, ptr %148, i32 0, i32 21
  call void @DN_program_uniform_vec3(i32 noundef %147, ptr noundef @.str.29, ptr noundef %149)
  %150 = load ptr, ptr @glad_glUniform3uiv, align 8, !tbaa !5
  %151 = load ptr, ptr @glad_glGetUniformLocation, align 8, !tbaa !5
  %152 = load i32, ptr @g_lightingProgram, align 4, !tbaa !9
  %153 = call i32 %151(i32 noundef %152, ptr noundef @.str.33)
  %154 = load ptr, ptr %5, align 8, !tbaa !5
  %155 = getelementptr inbounds %struct.DNvolume, ptr %154, i32 0, i32 3
  call void %150(i32 noundef %153, i32 noundef 1, ptr noundef %155)
  %156 = load ptr, ptr @glad_glDispatchCompute, align 8, !tbaa !5
  %157 = load ptr, ptr %5, align 8, !tbaa !5
  %158 = getelementptr inbounds %struct.DNvolume, ptr %157, i32 0, i32 8
  %159 = load i64, ptr %158, align 8, !tbaa !22
  %160 = trunc i64 %159 to i32
  call void %156(i32 noundef %160, i32 noundef 1, i32 noundef 1)
  %161 = load ptr, ptr @glad_glMemoryBarrier, align 8, !tbaa !5
  call void %161(i32 noundef 8192)
  call void @llvm.lifetime.end.p0(i64 12, ptr %12) #7
  br label %162

162:                                              ; preds = %111, %75
  ret void

163:                                              ; preds = %75
  unreachable
}

declare void @DN_program_uniform_float(i32 noundef, ptr noundef, float noundef) #3

; Function Attrs: inlinehint nounwind uwtable
declare hidden { <2 x float>, float } @DN_vec3_normalize(<2 x float>, float) #5

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #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 uwtable "min-legal-vector-width"="64" "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 = { inlinehint nounwind uwtable "min-legal-vector-width"="64" "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 #6 = { 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 #7 = { 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"float", !7, i64 0}
!13 = !{!14, !10, i64 224}
!14 = !{!"DNvolume", !10, i64 0, !10, i64 4, !10, i64 8, !15, i64 12, !16, i64 24, !16, i64 32, !16, i64 40, !16, i64 48, !16, i64 56, !16, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !7, i64 112, !7, i64 124, !12, i64 136, !10, i64 140, !7, i64 144, !7, i64 156, !7, i64 168, !10, i64 180, !10, i64 184, !12, i64 188, !17, i64 192, !10, i64 196, !7, i64 200, !7, i64 212, !10, i64 224, !12, i64 228}
!15 = !{!"DNuvec3", !10, i64 0, !10, i64 4, !10, i64 8}
!16 = !{!"long", !7, i64 0}
!17 = !{!"_Bool", !7, i64 0}
!18 = !{!14, !12, i64 228}
!19 = !{!14, !10, i64 4}
!20 = !{!14, !10, i64 0}
!21 = !{!14, !10, i64 8}
!22 = !{!14, !16, i64 56}
!23 = !{!16, !16, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}
!26 = !{!14, !6, i64 96}
!27 = !{!14, !17, i64 192}
!28 = !{i8 0, i8 2}
!29 = !{}
!30 = !{!14, !10, i64 196}
!31 = !{!14, !10, i64 180}
!32 = !{!14, !10, i64 184}
!33 = !{!14, !12, i64 188}


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

%union.QMvec3 = type { [3 x float] }

@g_lightingRequestBuffer = external dso_local local_unnamed_addr global i32, align 4
@g_lightingProgram = external dso_local local_unnamed_addr global i32, align 4
@g_maxLightingRequests = external dso_local local_unnamed_addr global i32, align 4
@g_DN_message_callback = external dso_local local_unnamed_addr global ptr, align 8
@glad_glBindBufferBase = external local_unnamed_addr global ptr, align 8
@glad_glBindBuffer = external local_unnamed_addr global ptr, align 8
@glad_glMemoryBarrier = external local_unnamed_addr global ptr, align 8
@glad_glUseProgram = external local_unnamed_addr global ptr, align 8
@glad_glBufferSubData = external local_unnamed_addr global ptr, align 8
@glad_glBindTexture = external local_unnamed_addr global ptr, align 8
@glad_glActiveTexture = external local_unnamed_addr global ptr, align 8
@.str.23 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.27 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [16 x i8], align 1
@glad_glUniform3uiv = external local_unnamed_addr global ptr, align 8
@glad_glGetUniformLocation = external local_unnamed_addr global ptr, align 8
@.str.33 = external hidden unnamed_addr constant [8 x i8], align 1
@glad_glDispatchCompute = external local_unnamed_addr global ptr, align 8
@.str.34 = external hidden unnamed_addr constant [86 x i8], align 1
@glad_glBufferData = external local_unnamed_addr global ptr, align 8
@.str.35 = external hidden unnamed_addr constant [41 x i8], align 1
@.str.36 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [15 x i8], align 1

; 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: nofree nounwind
declare noundef i32 @sprintf(ptr noalias nocapture noundef writeonly, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

declare void @DN_program_uniform_uint(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

declare void @DN_program_uniform_int(i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

declare void @DN_program_uniform_vec3(i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
define dso_local void @DN_update_lighting(ptr noundef %0, i32 noundef %1, i32 noundef %2, float noundef %3) local_unnamed_addr #3 {
  %5 = alloca [256 x i8], align 16
  %6 = alloca %union.QMvec3, align 8
  %7 = getelementptr inbounds i8, ptr %0, i64 224
  %8 = load i32, ptr %7, align 8, !tbaa !5
  %9 = icmp eq i32 %8, 0
  br i1 %9, label %10, label %12

10:                                               ; preds = %4
  %11 = getelementptr inbounds i8, ptr %0, i64 228
  store float %3, ptr %11, align 4, !tbaa !15
  br label %12

12:                                               ; preds = %10, %4
  %13 = load ptr, ptr @glad_glUseProgram, align 8, !tbaa !16
  %14 = load i32, ptr @g_lightingProgram, align 4, !tbaa !17
  tail call void %13(i32 noundef %14) #6
  %15 = load ptr, ptr @glad_glBindBufferBase, align 8, !tbaa !16
  %16 = getelementptr inbounds i8, ptr %0, i64 4
  %17 = load i32, ptr %16, align 4, !tbaa !18
  tail call void %15(i32 noundef 37074, i32 noundef 1, i32 noundef %17) #6
  %18 = load ptr, ptr @glad_glBindBufferBase, align 8, !tbaa !16
  %19 = load i32, ptr %0, align 8, !tbaa !19
  tail call void %18(i32 noundef 37074, i32 noundef 0, i32 noundef %19) #6
  %20 = load ptr, ptr @glad_glBindBufferBase, align 8, !tbaa !16
  %21 = getelementptr inbounds i8, ptr %0, i64 8
  %22 = load i32, ptr %21, align 8, !tbaa !20
  tail call void %20(i32 noundef 37074, i32 noundef 4, i32 noundef %22) #6
  %23 = load ptr, ptr @glad_glBindBuffer, align 8, !tbaa !16
  %24 = load i32, ptr @g_lightingRequestBuffer, align 4, !tbaa !17
  tail call void %23(i32 noundef 37074, i32 noundef %24) #6
  %25 = getelementptr inbounds i8, ptr %0, i64 56
  %26 = load i64, ptr %25, align 8, !tbaa !21
  %27 = load i32, ptr @g_maxLightingRequests, align 4, !tbaa !17
  %28 = sext i32 %27 to i64
  %29 = icmp ugt i64 %26, %28
  br i1 %29, label %.preheader, label %41

.preheader:                                       ; preds = %12, %.preheader
  %.0 = phi i64 [ %31, %.preheader ], [ %28, %12 ]
  %30 = icmp ult i64 %.0, %26
  %31 = shl i64 %.0, 1
  br i1 %30, label %.preheader, label %32, !llvm.loop !22

32:                                               ; preds = %.preheader
  call void @llvm.lifetime.start.p0(i64 256, ptr nonnull %5) #6
  %33 = shl i64 %.0, 2
  %34 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %5, ptr noundef nonnull dereferenceable(1) @.str.34, i64 noundef %.0, i64 noundef %33) #6
  %35 = load ptr, ptr @g_DN_message_callback, align 8, !tbaa !16
  call void %35(i32 noundef 1, i32 noundef 0, ptr noundef nonnull %5) #6
  call void @_DN_clear_gl_errors()
  %36 = load ptr, ptr @glad_glBufferData, align 8, !tbaa !16
  call void %36(i32 noundef 37074, i64 noundef %33, ptr noundef null, i32 noundef 35048) #6
  %37 = call zeroext i1 @_DN_gl_error()
  br i1 %37, label %39, label %.thread

.thread:                                          ; preds = %32
  %38 = trunc i64 %.0 to i32
  store i32 %38, ptr @g_maxLightingRequests, align 4, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %5) #6
  %.pre = load i64, ptr %25, align 8, !tbaa !21
  br label %41

39:                                               ; preds = %32
  %40 = load ptr, ptr @g_DN_message_callback, align 8, !tbaa !16
  call void %40(i32 noundef 1, i32 noundef 1, ptr noundef nonnull @.str.35) #6
  call void @llvm.lifetime.end.p0(i64 256, ptr nonnull %5) #6
  br label %97

41:                                               ; preds = %.thread, %12
  %42 = phi i64 [ %.pre, %.thread ], [ %26, %12 ]
  %43 = load ptr, ptr @glad_glBufferSubData, align 8, !tbaa !16
  %44 = shl i64 %42, 2
  %45 = getelementptr inbounds i8, ptr %0, i64 96
  %46 = load ptr, ptr %45, align 8, !tbaa !24
  call void %43(i32 noundef 37074, i64 noundef 0, i64 noundef %44, ptr noundef %46) #6
  %47 = load i32, ptr @g_lightingProgram, align 4, !tbaa !17
  %48 = getelementptr inbounds i8, ptr %0, i64 192
  %49 = load i8, ptr %48, align 8, !tbaa !25, !range !26, !noundef !27
  %50 = zext nneg i8 %49 to i32
  call void @DN_program_uniform_uint(i32 noundef %47, ptr noundef nonnull @.str.23, i32 noundef %50) #6
  %51 = load i32, ptr @g_lightingProgram, align 4, !tbaa !17
  call void @DN_program_uniform_int(i32 noundef %51, ptr noundef nonnull @.str.24, i32 noundef 2) #6
  %52 = load i8, ptr %48, align 8, !tbaa !25, !range !26, !noundef !27
  %53 = trunc nuw i8 %52 to i1
  br i1 %53, label %54, label %59

54:                                               ; preds = %41
  %55 = load ptr, ptr @glad_glActiveTexture, align 8, !tbaa !16
  call void %55(i32 noundef 33986) #6
  %56 = load ptr, ptr @glad_glBindTexture, align 8, !tbaa !16
  %57 = getelementptr inbounds i8, ptr %0, i64 196
  %58 = load i32, ptr %57, align 4, !tbaa !28
  call void %56(i32 noundef 34067, i32 noundef %58) #6
  br label %64

59:                                               ; preds = %41
  %60 = load i32, ptr @g_lightingProgram, align 4, !tbaa !17
  %61 = getelementptr inbounds i8, ptr %0, i64 200
  call void @DN_program_uniform_vec3(i32 noundef %60, ptr noundef nonnull @.str.25, ptr noundef nonnull %61) #6
  %62 = load i32, ptr @g_lightingProgram, align 4, !tbaa !17
  %63 = getelementptr inbounds i8, ptr %0, i64 212
  call void @DN_program_uniform_vec3(i32 noundef %62, ptr noundef nonnull @.str.26, ptr noundef nonnull %63) #6
  br label %64

64:                                               ; preds = %59, %54
  %65 = load i32, ptr @g_lightingProgram, align 4, !tbaa !17
  %66 = getelementptr inbounds i8, ptr %0, i64 112
  call void @DN_program_uniform_vec3(i32 noundef %65, ptr noundef nonnull @.str.36, ptr noundef nonnull %66) #6
  %67 = load i32, ptr @g_lightingProgram, align 4, !tbaa !17
  %68 = getelementptr inbounds i8, ptr %0, i64 228
  %69 = load float, ptr %68, align 4, !tbaa !15
  call void @DN_program_uniform_float(i32 noundef %67, ptr noundef nonnull @.str.37, float noundef %69) #6
  %70 = load i32, ptr @g_lightingProgram, align 4, !tbaa !17
  call void @DN_program_uniform_uint(i32 noundef %70, ptr noundef nonnull @.str.38, i32 noundef %1) #6
  %71 = load i32, ptr @g_lightingProgram, align 4, !tbaa !17
  call void @DN_program_uniform_uint(i32 noundef %71, ptr noundef nonnull @.str.39, i32 noundef %2) #6
  %72 = load i32, ptr @g_lightingProgram, align 4, !tbaa !17
  %73 = getelementptr inbounds i8, ptr %0, i64 180
  %74 = load i32, ptr %73, align 4, !tbaa !29
  call void @DN_program_uniform_uint(i32 noundef %72, ptr noundef nonnull @.str.40, i32 noundef %74) #6
  %75 = load i32, ptr @g_lightingProgram, align 4, !tbaa !17
  %76 = getelementptr inbounds i8, ptr %0, i64 184
  %77 = load i32, ptr %76, align 8, !tbaa !30
  call void @DN_program_uniform_uint(i32 noundef %75, ptr noundef nonnull @.str.41, i32 noundef %77) #6
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %6) #6
  %78 = getelementptr inbounds i8, ptr %0, i64 144
  %.sroa.01.0.copyload = load <2 x float>, ptr %78, align 8
  %.sroa.22.0..sroa_idx = getelementptr inbounds i8, ptr %0, i64 152
  %.sroa.22.0.copyload = load float, ptr %.sroa.22.0..sroa_idx, align 8
  %79 = call { <2 x float>, float } @DN_vec3_normalize(<2 x float> %.sroa.01.0.copyload, float %.sroa.22.0.copyload)
  %.fca.0.extract = extractvalue { <2 x float>, float } %79, 0
  %.fca.1.extract = extractvalue { <2 x float>, float } %79, 1
  store <2 x float> %.fca.0.extract, ptr %6, align 8
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %6, i64 8
  store float %.fca.1.extract, ptr %.sroa.2.0..sroa_idx, align 8
  %80 = load i32, ptr @g_lightingProgram, align 4, !tbaa !17
  call void @DN_program_uniform_vec3(i32 noundef %80, ptr noundef nonnull @.str.42, ptr noundef nonnull %6) #6
  %81 = load i32, ptr @g_lightingProgram, align 4, !tbaa !17
  %82 = getelementptr inbounds i8, ptr %0, i64 156
  call void @DN_program_uniform_vec3(i32 noundef %81, ptr noundef nonnull @.str.27, ptr noundef nonnull %82) #6
  %83 = load i32, ptr @g_lightingProgram, align 4, !tbaa !17
  %84 = getelementptr inbounds i8, ptr %0, i64 188
  %85 = load float, ptr %84, align 4, !tbaa !31
  call void @DN_program_uniform_float(i32 noundef %83, ptr noundef nonnull @.str.43, float noundef %85) #6
  %86 = load i32, ptr @g_lightingProgram, align 4, !tbaa !17
  %87 = getelementptr inbounds i8, ptr %0, i64 168
  call void @DN_program_uniform_vec3(i32 noundef %86, ptr noundef nonnull @.str.29, ptr noundef nonnull %87) #6
  %88 = load ptr, ptr @glad_glUniform3uiv, align 8, !tbaa !16
  %89 = load ptr, ptr @glad_glGetUniformLocation, align 8, !tbaa !16
  %90 = load i32, ptr @g_lightingProgram, align 4, !tbaa !17
  %91 = call i32 %89(i32 noundef %90, ptr noundef nonnull @.str.33) #6
  %92 = getelementptr inbounds i8, ptr %0, i64 12
  call void %88(i32 noundef %91, i32 noundef 1, ptr noundef nonnull %92) #6
  %93 = load ptr, ptr @glad_glDispatchCompute, align 8, !tbaa !16
  %94 = load i64, ptr %25, align 8, !tbaa !21
  %95 = trunc i64 %94 to i32
  call void %93(i32 noundef %95, i32 noundef 1, i32 noundef 1) #6
  %96 = load ptr, ptr @glad_glMemoryBarrier, align 8, !tbaa !16
  call void %96(i32 noundef 8192) #6
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %6) #6
  br label %97

97:                                               ; preds = %39, %64
  ret void
}

declare void @DN_program_uniform_float(i32 noundef, ptr noundef, float noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden { <2 x float>, float } @DN_vec3_normalize(<2 x float>, float) local_unnamed_addr #4

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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"="64" "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 = { inlinehint nounwind uwtable "min-legal-vector-width"="64" "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 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 #6 = { 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 224}
!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, !13, i64 228}
!16 = !{!12, !12, i64 0}
!17 = !{!7, !7, i64 0}
!18 = !{!6, !7, i64 4}
!19 = !{!6, !7, i64 0}
!20 = !{!6, !7, i64 8}
!21 = !{!6, !11, i64 56}
!22 = distinct !{!22, !23}
!23 = !{!"llvm.loop.mustprogress"}
!24 = !{!6, !12, i64 96}
!25 = !{!6, !14, i64 192}
!26 = !{i8 0, i8 2}
!27 = !{}
!28 = !{!6, !7, i64 196}
!29 = !{!6, !7, i64 180}
!30 = !{!6, !7, i64 184}
!31 = !{!6, !13, i64 188}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass