; 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.DNivec3 = type { i32, i32, i32 }

; 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) #0

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

attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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" }

!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 = !{!"DNivec3", !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 = !{i64 0, i64 4, !15, i64 4, i64 4, !15, i64 8, i64 4, !15}
!15 = !{!11, !11, i64 0}


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

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) uwtable
define dso_local void @DN_separate_position(i64 %0, i32 %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef writeonly %3) local_unnamed_addr #0 {
  %.sroa.07.0.extract.trunc = trunc i64 %0 to i32
  %.sroa.39.0.extract.shift = lshr i64 %0, 32
  %.sroa.39.0.extract.trunc = trunc nuw i64 %.sroa.39.0.extract.shift to i32
  %5 = sdiv i32 %.sroa.07.0.extract.trunc, 8
  store i32 %5, ptr %2, align 4, !tbaa !5
  %.sroa.22.0..sroa_idx = getelementptr inbounds i8, ptr %2, i64 4
  %6 = insertelement <2 x i32> poison, i32 %.sroa.39.0.extract.trunc, i64 0
  %7 = insertelement <2 x i32> %6, i32 %1, i64 1
  %8 = sdiv <2 x i32> %7, <i32 8, i32 8>
  store <2 x i32> %8, ptr %.sroa.22.0..sroa_idx, align 4, !tbaa !5
  %9 = srem i32 %.sroa.07.0.extract.trunc, 8
  %10 = srem i32 %.sroa.39.0.extract.trunc, 8
  %11 = srem i32 %1, 8
  store i32 %9, ptr %3, align 4, !tbaa !5
  %.sroa.2.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 4
  store i32 %10, ptr %.sroa.2.0..sroa_idx, align 4, !tbaa !5
  %.sroa.3.0..sroa_idx = getelementptr inbounds i8, ptr %3, i64 8
  store i32 %11, ptr %.sroa.3.0..sroa_idx, align 4, !tbaa !5
  ret void
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: write) 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" }

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

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


; Effective O3 passes: GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SLPVectorizerPass,SROAPass