; LLVM IR from venumb/ZSPACE :: cpp/depends/alglib/cpp/tests (test_c)

; 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.rec4serialization = type { %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector", %"struct.alglib_impl::ae_vector" }
%"struct.alglib_impl::ae_vector" = type { i64, i64, i8, %"struct.alglib_impl::ae_dyn_block", %union.anon }
%"struct.alglib_impl::ae_dyn_block" = type { ptr, ptr, ptr, ptr }
%union.anon = type { ptr }

; 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: mustprogress uwtable
define dso_local void @_Z26rec4serializationserializePN11alglib_impl13ae_serializerEP17rec4serializationPNS_8ae_stateE(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i64, align 8
  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
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.rec4serialization, ptr %9, i32 0, i32 0
  %11 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %10, i32 0, i32 0
  %12 = load i64, ptr %11, align 8, !tbaa !9
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN11alglib_impl27ae_serializer_serialize_intEPNS_13ae_serializerElPNS_8ae_stateE(ptr noundef %8, i64 noundef %12, ptr noundef %13)
  store i64 0, ptr %7, align 8, !tbaa !15
  br label %14

14:                                               ; preds = %33, %3
  %15 = load i64, ptr %7, align 8, !tbaa !15
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.rec4serialization, ptr %16, i32 0, i32 0
  %18 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %17, i32 0, i32 0
  %19 = load i64, ptr %18, align 8, !tbaa !9
  %20 = sub nsw i64 %19, 1
  %21 = icmp sle i64 %15, %20
  br i1 %21, label %22, label %36

22:                                               ; preds = %14
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.rec4serialization, ptr %24, i32 0, i32 0
  %26 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %25, i32 0, i32 4
  %27 = load ptr, ptr %26, align 8, !tbaa !16
  %28 = load i64, ptr %7, align 8, !tbaa !15
  %29 = getelementptr inbounds i8, ptr %27, i64 %28
  %30 = load i8, ptr %29, align 1, !tbaa !17, !range !18, !noundef !19
  %31 = trunc i8 %30 to i1
  %32 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN11alglib_impl28ae_serializer_serialize_boolEPNS_13ae_serializerEbPNS_8ae_stateE(ptr noundef %23, i1 noundef zeroext %31, ptr noundef %32)
  br label %33

33:                                               ; preds = %22
  %34 = load i64, ptr %7, align 8, !tbaa !15
  %35 = add nsw i64 %34, 1
  store i64 %35, ptr %7, align 8, !tbaa !15
  br label %14, !llvm.loop !20

36:                                               ; preds = %14
  %37 = load ptr, ptr %4, align 8, !tbaa !5
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.rec4serialization, ptr %38, i32 0, i32 1
  %40 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %39, i32 0, i32 0
  %41 = load i64, ptr %40, align 8, !tbaa !22
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN11alglib_impl27ae_serializer_serialize_intEPNS_13ae_serializerElPNS_8ae_stateE(ptr noundef %37, i64 noundef %41, ptr noundef %42)
  store i64 0, ptr %7, align 8, !tbaa !15
  br label %43

43:                                               ; preds = %61, %36
  %44 = load i64, ptr %7, align 8, !tbaa !15
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.rec4serialization, ptr %45, i32 0, i32 1
  %47 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %46, i32 0, i32 0
  %48 = load i64, ptr %47, align 8, !tbaa !22
  %49 = sub nsw i64 %48, 1
  %50 = icmp sle i64 %44, %49
  br i1 %50, label %51, label %64

51:                                               ; preds = %43
  %52 = load ptr, ptr %4, align 8, !tbaa !5
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.rec4serialization, ptr %53, i32 0, i32 1
  %55 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %54, i32 0, i32 4
  %56 = load ptr, ptr %55, align 8, !tbaa !16
  %57 = load i64, ptr %7, align 8, !tbaa !15
  %58 = getelementptr inbounds i64, ptr %56, i64 %57
  %59 = load i64, ptr %58, align 8, !tbaa !15
  %60 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN11alglib_impl27ae_serializer_serialize_intEPNS_13ae_serializerElPNS_8ae_stateE(ptr noundef %52, i64 noundef %59, ptr noundef %60)
  br label %61

61:                                               ; preds = %51
  %62 = load i64, ptr %7, align 8, !tbaa !15
  %63 = add nsw i64 %62, 1
  store i64 %63, ptr %7, align 8, !tbaa !15
  br label %43, !llvm.loop !23

64:                                               ; preds = %43
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.rec4serialization, ptr %66, i32 0, i32 2
  %68 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %67, i32 0, i32 0
  %69 = load i64, ptr %68, align 8, !tbaa !24
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN11alglib_impl27ae_serializer_serialize_intEPNS_13ae_serializerElPNS_8ae_stateE(ptr noundef %65, i64 noundef %69, ptr noundef %70)
  store i64 0, ptr %7, align 8, !tbaa !15
  br label %71

71:                                               ; preds = %89, %64
  %72 = load i64, ptr %7, align 8, !tbaa !15
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.rec4serialization, ptr %73, i32 0, i32 2
  %75 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %74, i32 0, i32 0
  %76 = load i64, ptr %75, align 8, !tbaa !24
  %77 = sub nsw i64 %76, 1
  %78 = icmp sle i64 %72, %77
  br i1 %78, label %79, label %92

79:                                               ; preds = %71
  %80 = load ptr, ptr %4, align 8, !tbaa !5
  %81 = load ptr, ptr %5, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.rec4serialization, ptr %81, i32 0, i32 2
  %83 = getelementptr inbounds %"struct.alglib_impl::ae_vector", ptr %82, i32 0, i32 4
  %84 = load ptr, ptr %83, align 8, !tbaa !16
  %85 = load i64, ptr %7, align 8, !tbaa !15
  %86 = getelementptr inbounds double, ptr %84, i64 %85
  %87 = load double, ptr %86, align 8, !tbaa !25
  %88 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN11alglib_impl30ae_serializer_serialize_doubleEPNS_13ae_serializerEdPNS_8ae_stateE(ptr noundef %80, double noundef %87, ptr noundef %88)
  br label %89

89:                                               ; preds = %79
  %90 = load i64, ptr %7, align 8, !tbaa !15
  %91 = add nsw i64 %90, 1
  store i64 %91, ptr %7, align 8, !tbaa !15
  br label %71, !llvm.loop !27

92:                                               ; preds = %71
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  ret void
}

declare void @_ZN11alglib_impl27ae_serializer_serialize_intEPNS_13ae_serializerElPNS_8ae_stateE(ptr noundef, i64 noundef, ptr noundef) #2

declare void @_ZN11alglib_impl28ae_serializer_serialize_boolEPNS_13ae_serializerEbPNS_8ae_stateE(ptr noundef, i1 noundef zeroext, ptr noundef) #2

declare void @_ZN11alglib_impl30ae_serializer_serialize_doubleEPNS_13ae_serializerEdPNS_8ae_stateE(ptr noundef, double noundef, ptr noundef) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress 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 = { "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++ TBAA"}
!9 = !{!10, !12, i64 0}
!10 = !{!"_ZTS17rec4serialization", !11, i64 0, !11, i64 64, !11, i64 128}
!11 = !{!"_ZTSN11alglib_impl9ae_vectorE", !12, i64 0, !12, i64 8, !13, i64 16, !14, i64 24, !7, i64 56}
!12 = !{!"long", !7, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!15 = !{!12, !12, i64 0}
!16 = !{!7, !7, i64 0}
!17 = !{!13, !13, i64 0}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = distinct !{!20, !21}
!21 = !{!"llvm.loop.mustprogress"}
!22 = !{!10, !12, i64 64}
!23 = distinct !{!23, !21}
!24 = !{!10, !12, i64 128}
!25 = !{!26, !26, i64 0}
!26 = !{!"double", !7, i64 0}
!27 = distinct !{!27, !21}


; 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 uwtable
define dso_local void @_Z26rec4serializationserializePN11alglib_impl13ae_serializerEP17rec4serializationPNS_8ae_stateE(ptr noundef %0, ptr nocapture noundef readonly %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = load i64, ptr %1, align 8, !tbaa !5
  tail call void @_ZN11alglib_impl27ae_serializer_serialize_intEPNS_13ae_serializerElPNS_8ae_stateE(ptr noundef %0, i64 noundef %4, ptr noundef %2)
  %5 = load i64, ptr %1, align 8, !tbaa !5
  %.not.not31 = icmp sgt i64 %5, 0
  br i1 %.not.not31, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %3
  %6 = getelementptr inbounds i8, ptr %1, i64 56
  br label %7

7:                                                ; preds = %.lr.ph, %7
  %.032 = phi i64 [ 0, %.lr.ph ], [ %12, %7 ]
  %8 = load ptr, ptr %6, align 8, !tbaa !14
  %9 = getelementptr inbounds i8, ptr %8, i64 %.032
  %10 = load i8, ptr %9, align 1, !tbaa !15, !range !16, !noundef !17
  %11 = trunc nuw i8 %10 to i1
  tail call void @_ZN11alglib_impl28ae_serializer_serialize_boolEPNS_13ae_serializerEbPNS_8ae_stateE(ptr noundef %0, i1 noundef zeroext %11, ptr noundef %2)
  %12 = add nuw nsw i64 %.032, 1
  %13 = load i64, ptr %1, align 8, !tbaa !5
  %.not.not = icmp slt i64 %12, %13
  br i1 %.not.not, label %7, label %._crit_edge, !llvm.loop !18

._crit_edge:                                      ; preds = %7, %3
  %14 = getelementptr inbounds i8, ptr %1, i64 64
  %15 = load i64, ptr %14, align 8, !tbaa !20
  tail call void @_ZN11alglib_impl27ae_serializer_serialize_intEPNS_13ae_serializerElPNS_8ae_stateE(ptr noundef %0, i64 noundef %15, ptr noundef %2)
  %16 = load i64, ptr %14, align 8, !tbaa !20
  %.not.not2933 = icmp sgt i64 %16, 0
  br i1 %.not.not2933, label %.lr.ph36, label %._crit_edge37

.lr.ph36:                                         ; preds = %._crit_edge
  %17 = getelementptr inbounds i8, ptr %1, i64 120
  br label %18

18:                                               ; preds = %.lr.ph36, %18
  %.134 = phi i64 [ 0, %.lr.ph36 ], [ %22, %18 ]
  %19 = load ptr, ptr %17, align 8, !tbaa !14
  %20 = getelementptr inbounds i64, ptr %19, i64 %.134
  %21 = load i64, ptr %20, align 8, !tbaa !21
  tail call void @_ZN11alglib_impl27ae_serializer_serialize_intEPNS_13ae_serializerElPNS_8ae_stateE(ptr noundef %0, i64 noundef %21, ptr noundef %2)
  %22 = add nuw nsw i64 %.134, 1
  %23 = load i64, ptr %14, align 8, !tbaa !20
  %.not.not29 = icmp slt i64 %22, %23
  br i1 %.not.not29, label %18, label %._crit_edge37, !llvm.loop !22

._crit_edge37:                                    ; preds = %18, %._crit_edge
  %24 = getelementptr inbounds i8, ptr %1, i64 128
  %25 = load i64, ptr %24, align 8, !tbaa !23
  tail call void @_ZN11alglib_impl27ae_serializer_serialize_intEPNS_13ae_serializerElPNS_8ae_stateE(ptr noundef %0, i64 noundef %25, ptr noundef %2)
  %26 = load i64, ptr %24, align 8, !tbaa !23
  %.not.not3038 = icmp sgt i64 %26, 0
  br i1 %.not.not3038, label %.lr.ph41, label %._crit_edge42

.lr.ph41:                                         ; preds = %._crit_edge37
  %27 = getelementptr inbounds i8, ptr %1, i64 184
  br label %28

28:                                               ; preds = %.lr.ph41, %28
  %.239 = phi i64 [ 0, %.lr.ph41 ], [ %32, %28 ]
  %29 = load ptr, ptr %27, align 8, !tbaa !14
  %30 = getelementptr inbounds double, ptr %29, i64 %.239
  %31 = load double, ptr %30, align 8, !tbaa !24
  tail call void @_ZN11alglib_impl30ae_serializer_serialize_doubleEPNS_13ae_serializerEdPNS_8ae_stateE(ptr noundef %0, double noundef %31, ptr noundef %2)
  %32 = add nuw nsw i64 %.239, 1
  %33 = load i64, ptr %24, align 8, !tbaa !23
  %.not.not30 = icmp slt i64 %32, %33
  br i1 %.not.not30, label %28, label %._crit_edge42, !llvm.loop !26

._crit_edge42:                                    ; preds = %28, %._crit_edge37
  ret void
}

declare void @_ZN11alglib_impl27ae_serializer_serialize_intEPNS_13ae_serializerElPNS_8ae_stateE(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #1

declare void @_ZN11alglib_impl28ae_serializer_serialize_boolEPNS_13ae_serializerEbPNS_8ae_stateE(ptr noundef, i1 noundef zeroext, ptr noundef) local_unnamed_addr #1

declare void @_ZN11alglib_impl30ae_serializer_serialize_doubleEPNS_13ae_serializerEdPNS_8ae_stateE(ptr noundef, double noundef, ptr noundef) local_unnamed_addr #1

attributes #0 = { mustprogress 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 = { "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, !8, i64 0}
!6 = !{!"_ZTS17rec4serialization", !7, i64 0, !7, i64 64, !7, i64 128}
!7 = !{!"_ZTSN11alglib_impl9ae_vectorE", !8, i64 0, !8, i64 8, !11, i64 16, !12, i64 24, !9, i64 56}
!8 = !{!"long", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"bool", !9, i64 0}
!12 = !{!"_ZTSN11alglib_impl12ae_dyn_blockE", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24}
!13 = !{!"any pointer", !9, i64 0}
!14 = !{!9, !9, i64 0}
!15 = !{!11, !11, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{!6, !8, i64 64}
!21 = !{!8, !8, i64 0}
!22 = distinct !{!22, !19}
!23 = !{!6, !8, i64 128}
!24 = !{!25, !25, i64 0}
!25 = !{!"double", !9, i64 0}
!26 = distinct !{!26, !19}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass