; LLVM IR from tfhe/spqlios-arithmetic :: spqlios/reim4 (reim4_arithmetic_ref)

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

@.str = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [94 x i8], align 1
@__PRETTY_FUNCTION__.reim4_extract_1blk_from_reim_ref = external hidden unnamed_addr constant [94 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @reim4_extract_1blk_from_reim_ref(i64 noundef %0, i64 noundef %1, ptr noundef %2, ptr noundef %3) #0 {
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  store i64 %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !9
  %10 = load i64, ptr %6, align 8, !tbaa !5
  %11 = load i64, ptr %5, align 8, !tbaa !5
  %12 = lshr i64 %11, 2
  %13 = icmp ult i64 %10, %12
  br i1 %13, label %14, label %15

14:                                               ; preds = %4
  br label %16

15:                                               ; preds = %4
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 10, ptr noundef @__PRETTY_FUNCTION__.reim4_extract_1blk_from_reim_ref) #3
  unreachable

16:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %17 = load ptr, ptr %8, align 8, !tbaa !9
  %18 = load i64, ptr %6, align 8, !tbaa !5
  %19 = shl i64 %18, 2
  %20 = getelementptr inbounds double, ptr %17, i64 %19
  store ptr %20, ptr %9, align 8, !tbaa !9
  %21 = load ptr, ptr %9, align 8, !tbaa !9
  %22 = getelementptr inbounds double, ptr %21, i64 0
  %23 = load double, ptr %22, align 8, !tbaa !11
  %24 = load ptr, ptr %7, align 8, !tbaa !9
  %25 = getelementptr inbounds double, ptr %24, i64 0
  store double %23, ptr %25, align 8, !tbaa !11
  %26 = load ptr, ptr %9, align 8, !tbaa !9
  %27 = getelementptr inbounds double, ptr %26, i64 1
  %28 = load double, ptr %27, align 8, !tbaa !11
  %29 = load ptr, ptr %7, align 8, !tbaa !9
  %30 = getelementptr inbounds double, ptr %29, i64 1
  store double %28, ptr %30, align 8, !tbaa !11
  %31 = load ptr, ptr %9, align 8, !tbaa !9
  %32 = getelementptr inbounds double, ptr %31, i64 2
  %33 = load double, ptr %32, align 8, !tbaa !11
  %34 = load ptr, ptr %7, align 8, !tbaa !9
  %35 = getelementptr inbounds double, ptr %34, i64 2
  store double %33, ptr %35, align 8, !tbaa !11
  %36 = load ptr, ptr %9, align 8, !tbaa !9
  %37 = getelementptr inbounds double, ptr %36, i64 3
  %38 = load double, ptr %37, align 8, !tbaa !11
  %39 = load ptr, ptr %7, align 8, !tbaa !9
  %40 = getelementptr inbounds double, ptr %39, i64 3
  store double %38, ptr %40, align 8, !tbaa !11
  %41 = load i64, ptr %5, align 8, !tbaa !5
  %42 = load ptr, ptr %9, align 8, !tbaa !9
  %43 = getelementptr inbounds double, ptr %42, i64 %41
  store ptr %43, ptr %9, align 8, !tbaa !9
  %44 = load ptr, ptr %9, align 8, !tbaa !9
  %45 = getelementptr inbounds double, ptr %44, i64 0
  %46 = load double, ptr %45, align 8, !tbaa !11
  %47 = load ptr, ptr %7, align 8, !tbaa !9
  %48 = getelementptr inbounds double, ptr %47, i64 4
  store double %46, ptr %48, align 8, !tbaa !11
  %49 = load ptr, ptr %9, align 8, !tbaa !9
  %50 = getelementptr inbounds double, ptr %49, i64 1
  %51 = load double, ptr %50, align 8, !tbaa !11
  %52 = load ptr, ptr %7, align 8, !tbaa !9
  %53 = getelementptr inbounds double, ptr %52, i64 5
  store double %51, ptr %53, align 8, !tbaa !11
  %54 = load ptr, ptr %9, align 8, !tbaa !9
  %55 = getelementptr inbounds double, ptr %54, i64 2
  %56 = load double, ptr %55, align 8, !tbaa !11
  %57 = load ptr, ptr %7, align 8, !tbaa !9
  %58 = getelementptr inbounds double, ptr %57, i64 6
  store double %56, ptr %58, align 8, !tbaa !11
  %59 = load ptr, ptr %9, align 8, !tbaa !9
  %60 = getelementptr inbounds double, ptr %59, i64 3
  %61 = load double, ptr %60, align 8, !tbaa !11
  %62 = load ptr, ptr %7, align 8, !tbaa !9
  %63 = getelementptr inbounds double, ptr %62, i64 7
  store double %61, ptr %63, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  ret void
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

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

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

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { noreturn 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { noreturn nounwind }
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, !6, i64 0}
!6 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"double", !7, 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"

@.str = external hidden unnamed_addr constant [15 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [94 x i8], align 1
@__PRETTY_FUNCTION__.reim4_extract_1blk_from_reim_ref = external hidden unnamed_addr constant [94 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @reim4_extract_1blk_from_reim_ref(i64 noundef %0, i64 noundef %1, ptr nocapture noundef writeonly %2, ptr nocapture noundef readonly %3) local_unnamed_addr #0 {
  %5 = lshr i64 %0, 2
  %6 = icmp ugt i64 %5, %1
  br i1 %6, label %8, label %7

7:                                                ; preds = %4
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 10, ptr noundef nonnull @__PRETTY_FUNCTION__.reim4_extract_1blk_from_reim_ref) #2
  unreachable

8:                                                ; preds = %4
  %.idx = shl i64 %1, 5
  %9 = getelementptr inbounds i8, ptr %3, i64 %.idx
  %10 = load double, ptr %9, align 8, !tbaa !5
  store double %10, ptr %2, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %9, i64 8
  %12 = load double, ptr %11, align 8, !tbaa !5
  %13 = getelementptr inbounds i8, ptr %2, i64 8
  store double %12, ptr %13, align 8, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %9, i64 16
  %15 = load double, ptr %14, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %2, i64 16
  store double %15, ptr %16, align 8, !tbaa !5
  %17 = getelementptr inbounds i8, ptr %9, i64 24
  %18 = load double, ptr %17, align 8, !tbaa !5
  %19 = getelementptr inbounds i8, ptr %2, i64 24
  store double %18, ptr %19, align 8, !tbaa !5
  %20 = getelementptr inbounds double, ptr %9, i64 %0
  %21 = load double, ptr %20, align 8, !tbaa !5
  %22 = getelementptr inbounds i8, ptr %2, i64 32
  store double %21, ptr %22, align 8, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %20, i64 8
  %24 = load double, ptr %23, align 8, !tbaa !5
  %25 = getelementptr inbounds i8, ptr %2, i64 40
  store double %24, ptr %25, align 8, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %20, i64 16
  %27 = load double, ptr %26, align 8, !tbaa !5
  %28 = getelementptr inbounds i8, ptr %2, i64 48
  store double %27, ptr %28, align 8, !tbaa !5
  %29 = getelementptr inbounds i8, ptr %20, i64 24
  %30 = load double, ptr %29, align 8, !tbaa !5
  %31 = getelementptr inbounds i8, ptr %2, i64 56
  store double %30, ptr %31, align 8, !tbaa !5
  ret void
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

attributes #0 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { noreturn 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 = { noreturn 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 = !{!"double", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass