; LLVM IR from intel/cryptography-primitives :: sources/ippcp (pcpaes_cfbdecrypt)

; 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._cpRijndael128 = type { i32, i32, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, [124 x i32] }

; Function Attrs: nounwind uwtable
define dso_local i32 @ippsAESDecryptCFB(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5) #0 {
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  store ptr %0, ptr %8, align 8, !tbaa !5
  store ptr %1, ptr %9, align 8, !tbaa !5
  store i32 %2, ptr %10, align 4, !tbaa !9
  store i32 %3, ptr %11, align 4, !tbaa !9
  store ptr %4, ptr %12, align 8, !tbaa !5
  store ptr %5, ptr %13, align 8, !tbaa !5
  %15 = load ptr, ptr %12, align 8, !tbaa !5
  %16 = icmp eq ptr null, %15
  br i1 %16, label %17, label %18

17:                                               ; preds = %6
  store i32 -8, ptr %7, align 4
  br label %67

18:                                               ; preds = %6
  %19 = load ptr, ptr %12, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct._cpRijndael128, ptr %19, i32 0, i32 0
  %21 = load i32, ptr %20, align 8, !tbaa !11
  %22 = load ptr, ptr %12, align 8, !tbaa !5
  %23 = call i64 @IPP_UINT_PTR(ptr noundef %22)
  %24 = trunc i64 %23 to i32
  %25 = xor i32 %21, %24
  %26 = icmp eq i32 %25, 542263626
  br i1 %26, label %28, label %27

27:                                               ; preds = %18
  store i32 -13, ptr %7, align 4
  br label %67

28:                                               ; preds = %18
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  %30 = icmp eq ptr null, %29
  br i1 %30, label %31, label %32

31:                                               ; preds = %28
  store i32 -8, ptr %7, align 4
  br label %67

32:                                               ; preds = %28
  %33 = load ptr, ptr %13, align 8, !tbaa !5
  %34 = icmp eq ptr null, %33
  br i1 %34, label %35, label %36

35:                                               ; preds = %32
  store i32 -8, ptr %7, align 4
  br label %67

36:                                               ; preds = %32
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = icmp eq ptr null, %37
  br i1 %38, label %39, label %40

39:                                               ; preds = %36
  store i32 -8, ptr %7, align 4
  br label %67

40:                                               ; preds = %36
  %41 = load i32, ptr %10, align 4, !tbaa !9
  %42 = icmp slt i32 %41, 1
  br i1 %42, label %43, label %44

43:                                               ; preds = %40
  store i32 -15, ptr %7, align 4
  br label %67

44:                                               ; preds = %40
  %45 = load i32, ptr %11, align 4, !tbaa !9
  %46 = icmp sgt i32 1, %45
  br i1 %46, label %50, label %47

47:                                               ; preds = %44
  %48 = load i32, ptr %11, align 4, !tbaa !9
  %49 = icmp slt i32 16, %48
  br i1 %49, label %50, label %51

50:                                               ; preds = %47, %44
  store i32 -1003, ptr %7, align 4
  br label %67

51:                                               ; preds = %47
  %52 = load i32, ptr %10, align 4, !tbaa !9
  %53 = load i32, ptr %11, align 4, !tbaa !9
  %54 = srem i32 %52, %53
  %55 = icmp ne i32 %54, 0
  br i1 %55, label %56, label %57

56:                                               ; preds = %51
  store i32 -1005, ptr %7, align 4
  br label %67

57:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #3
  %58 = load i32, ptr %10, align 4, !tbaa !9
  %59 = load i32, ptr %11, align 4, !tbaa !9
  %60 = sdiv i32 %58, %59
  store i32 %60, ptr %14, align 4, !tbaa !9
  %61 = load ptr, ptr %13, align 8, !tbaa !5
  %62 = load ptr, ptr %8, align 8, !tbaa !5
  %63 = load ptr, ptr %9, align 8, !tbaa !5
  %64 = load i32, ptr %14, align 4, !tbaa !9
  %65 = load i32, ptr %11, align 4, !tbaa !9
  %66 = load ptr, ptr %12, align 8, !tbaa !5
  call void @cpDecryptAES_cfb(ptr noundef %61, ptr noundef %62, ptr noundef %63, i32 noundef %64, i32 noundef %65, ptr noundef %66)
  store i32 0, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #3
  br label %67

67:                                               ; preds = %57, %56, %50, %43, %39, %35, %31, %27, %17
  %68 = load i32, ptr %7, align 4
  ret i32 %68
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @IPP_UINT_PTR(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: nounwind uwtable
declare hidden void @cpDecryptAES_cfb(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) #0

; 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 = { inlinehint 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 0}
!12 = !{!"_cpRijndael128", !10, i64 0, !10, i64 4, !10, i64 8, !10, i64 12, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !10, i64 64, !10, i64 68, !7, i64 72}


; 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: nounwind uwtable
define dso_local range(i32 -1005, 1) i32 @ippsAESDecryptCFB(ptr noundef %0, ptr noundef %1, i32 noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #0 {
  %7 = icmp eq ptr %4, null
  br i1 %7, label %26, label %8

8:                                                ; preds = %6
  %9 = load i32, ptr %4, align 8, !tbaa !5
  %10 = tail call i64 @IPP_UINT_PTR(ptr noundef nonnull %4)
  %11 = trunc i64 %10 to i32
  %12 = xor i32 %9, %11
  %13 = icmp eq i32 %12, 542263626
  br i1 %13, label %14, label %26

14:                                               ; preds = %8
  %15 = icmp eq ptr %0, null
  %16 = icmp eq ptr %5, null
  %or.cond26 = or i1 %15, %16
  %17 = icmp eq ptr %1, null
  %or.cond27 = or i1 %17, %or.cond26
  br i1 %or.cond27, label %26, label %18

18:                                               ; preds = %14
  %19 = icmp slt i32 %2, 1
  br i1 %19, label %26, label %20

20:                                               ; preds = %18
  %21 = add i32 %3, -17
  %or.cond = icmp ult i32 %21, -16
  br i1 %or.cond, label %26, label %22

22:                                               ; preds = %20
  %23 = urem i32 %2, %3
  %24 = udiv i32 %2, %3
  %.not = icmp eq i32 %23, 0
  br i1 %.not, label %25, label %26

25:                                               ; preds = %22
  tail call void @cpDecryptAES_cfb(ptr noundef nonnull %5, ptr noundef nonnull %0, ptr noundef nonnull %1, i32 noundef %24, i32 noundef %3, ptr noundef nonnull %4)
  br label %26

26:                                               ; preds = %22, %20, %18, %14, %8, %6, %25
  %.0 = phi i32 [ 0, %25 ], [ -8, %6 ], [ -13, %8 ], [ -8, %14 ], [ -15, %18 ], [ -1003, %20 ], [ -1005, %22 ]
  ret i32 %.0
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden i64 @IPP_UINT_PTR(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @cpDecryptAES_cfb(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

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 = { inlinehint 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, !7, i64 0}
!6 = !{!"_cpRijndael128", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !10, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !7, i64 64, !7, i64 68, !8, i64 72}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}


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