; LLVM IR from intel/intel-ipsec-mb :: lib/x86_64 (ooo_mgr_reset)

; 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.MB_MGR_AES_OOO = type { %struct.AES_ARGS, [16 x i16], i64, [16 x ptr], i64, [16 x i8], [16 x i64], i32, i64, [48 x i8] }
%struct.AES_ARGS = type { [16 x ptr], [16 x ptr], [16 x ptr], [16 x %struct.imb_uint128_t], [15 x [16 x %struct.imb_uint128_t]] }
%struct.imb_uint128_t = type { i64, i64 }

; Function Attrs: nounwind uwtable
define hidden void @ooo_mgr_aes_reset(ptr noundef %0, i32 noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  store ptr %7, ptr %5, align 8, !tbaa !5
  %8 = load ptr, ptr %5, align 8, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 64 %8, i8 0, i64 4808, i1 false)
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.MB_MGR_AES_OOO, ptr %9, i32 0, i32 1
  %11 = getelementptr inbounds [16 x i16], ptr %10, i64 0, i64 0
  call void @llvm.memset.p0.i64(ptr align 64 %11, i8 -1, i64 32, i1 false)
  %12 = load i32, ptr %4, align 4, !tbaa !9
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.MB_MGR_AES_OOO, ptr %13, i32 0, i32 7
  store i32 %12, ptr %14, align 64, !tbaa !11
  %15 = load i32, ptr %4, align 4, !tbaa !9
  %16 = icmp eq i32 %15, 4
  br i1 %16, label %17, label %20

17:                                               ; preds = %2
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.MB_MGR_AES_OOO, ptr %18, i32 0, i32 2
  store i64 995856, ptr %19, align 32, !tbaa !15
  br label %44

20:                                               ; preds = %2
  %21 = load i32, ptr %4, align 4, !tbaa !9
  %22 = icmp eq i32 %21, 8
  br i1 %22, label %23, label %26

23:                                               ; preds = %20
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.MB_MGR_AES_OOO, ptr %24, i32 0, i32 2
  store i64 66409738768, ptr %25, align 32, !tbaa !15
  br label %43

26:                                               ; preds = %20
  %27 = load i32, ptr %4, align 4, !tbaa !9
  %28 = icmp eq i32 %27, 12
  br i1 %28, label %29, label %35

29:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  store i64 32, ptr %6, align 8, !tbaa !16
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.MB_MGR_AES_OOO, ptr %30, i32 0, i32 2
  store i64 205163983024656, ptr %31, align 32, !tbaa !15
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.MB_MGR_AES_OOO, ptr %32, i32 0, i32 6
  %34 = getelementptr inbounds [16 x i64], ptr %33, i64 0, i64 12
  call void @llvm.memset.p0.i64(ptr align 32 %34, i8 -1, i64 32, i1 false)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  br label %42

35:                                               ; preds = %26
  %36 = load i32, ptr %4, align 4, !tbaa !9
  %37 = icmp eq i32 %36, 16
  br i1 %37, label %38, label %41

38:                                               ; preds = %35
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.MB_MGR_AES_OOO, ptr %39, i32 0, i32 2
  store i64 -81985529216486896, ptr %40, align 32, !tbaa !15
  br label %41

41:                                               ; preds = %38, %35
  br label %42

42:                                               ; preds = %41, %29
  br label %43

43:                                               ; preds = %42, %23
  br label %44

44:                                               ; preds = %43, %17
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.MB_MGR_AES_OOO, ptr %45, i32 0, i32 4
  store i64 0, ptr %46, align 8, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret void
}

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 4800}
!12 = !{!"", !13, i64 0, !7, i64 4480, !14, i64 4512, !7, i64 4520, !14, i64 4648, !7, i64 4672, !10, i64 4800, !14, i64 4808}
!13 = !{!"", !7, i64 0, !7, i64 128, !7, i64 256, !7, i64 384, !7, i64 640}
!14 = !{!"long", !7, i64 0}
!15 = !{!12, !14, i64 4512}
!16 = !{!14, !14, i64 0}
!17 = !{!12, !14, i64 4648}


; 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 hidden void @ooo_mgr_aes_reset(ptr nocapture noundef writeonly %0, i32 noundef %1) local_unnamed_addr #0 {
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 64 dereferenceable(4808) %0, i8 0, i64 4808, i1 false)
  %3 = getelementptr inbounds i8, ptr %0, i64 4480
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 64 dereferenceable(32) %3, i8 -1, i64 32, i1 false)
  %4 = getelementptr inbounds i8, ptr %0, i64 4800
  store i32 %1, ptr %4, align 64, !tbaa !5
  %5 = add i32 %1, -4
  %6 = tail call i32 @llvm.fshl.i32(i32 %5, i32 %5, i32 30)
  switch i32 %6, label %16 [
    i32 0, label %7
    i32 1, label %9
    i32 2, label %11
    i32 3, label %14
  ]

7:                                                ; preds = %2
  %8 = getelementptr inbounds i8, ptr %0, i64 4512
  store i64 995856, ptr %8, align 32, !tbaa !12
  br label %16

9:                                                ; preds = %2
  %10 = getelementptr inbounds i8, ptr %0, i64 4512
  store i64 66409738768, ptr %10, align 32, !tbaa !12
  br label %16

11:                                               ; preds = %2
  %12 = getelementptr inbounds i8, ptr %0, i64 4512
  store i64 205163983024656, ptr %12, align 32, !tbaa !12
  %13 = getelementptr inbounds i8, ptr %0, i64 4768
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 32 dereferenceable(32) %13, i8 -1, i64 32, i1 false)
  br label %16

14:                                               ; preds = %2
  %15 = getelementptr inbounds i8, ptr %0, i64 4512
  store i64 -81985529216486896, ptr %15, align 32, !tbaa !12
  br label %16

16:                                               ; preds = %2, %9, %14, %11, %7
  %17 = getelementptr inbounds i8, ptr %0, i64 4648
  store i64 0, ptr %17, align 8, !tbaa !13
  ret void
}

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.fshl.i32(i32, i32, i32) #2

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" }
attributes #1 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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, !11, i64 4800}
!6 = !{!"", !7, i64 0, !8, i64 4480, !10, i64 4512, !8, i64 4520, !10, i64 4648, !8, i64 4672, !11, i64 4800, !10, i64 4808}
!7 = !{!"", !8, i64 0, !8, i64 128, !8, i64 256, !8, i64 384, !8, i64 640}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!6, !10, i64 4512}
!13 = !{!6, !10, i64 4648}


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