; LLVM IR from gem5/gem5 :: src/systemc/tests/systemc/examples/aes (aes)

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

%"class.sc_dt::sc_uint.0" = type { %"class.sc_dt::sc_uint_base" }
%"class.sc_dt::sc_uint_base" = type { %"class.sc_dt::sc_value_base", i64, i32, i32 }
%"class.sc_dt::sc_value_base" = type { ptr }
%"class.sc_dt::sc_uint" = type { %"class.sc_dt::sc_uint_base" }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK5sc_dt12sc_uint_basecvyEv(ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8AES_Base11AddRoundKeyEPA4_N5sc_dt7sc_uintILi8EEEPA4_KS2_(ptr noundef nonnull align 8 dereferenceable(232) %0, ptr noundef %1, ptr noundef %2) #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %"class.sc_dt::sc_uint.0", align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %"class.sc_dt::sc_uint.0", align 8
  %12 = alloca %"class.sc_dt::sc_uint.0", align 8
  %13 = alloca %"class.sc_dt::sc_uint.0", 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
  %14 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %7) #3
  call void @_ZN5sc_dt7sc_uintILi3EEC2Ei(ptr noundef nonnull align 8 dereferenceable(24) %7, i32 noundef 0)
  br label %15

15:                                               ; preds = %73, %3
  %16 = invoke noundef i64 @_ZNK5sc_dt12sc_uint_basecvyEv(ptr noundef nonnull align 8 dereferenceable(24) %7)
          to label %17 unwind label %20

17:                                               ; preds = %15
  %18 = icmp ult i64 %16, 4
  br i1 %18, label %24, label %19

19:                                               ; preds = %17
  store i32 2, ptr %10, align 4
  call void @_ZN5sc_dt13sc_value_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #3
  br label %75

20:                                               ; preds = %72, %15
  %21 = landingpad { ptr, i32 }
          cleanup
  %22 = extractvalue { ptr, i32 } %21, 0
  store ptr %22, ptr %8, align 8
  %23 = extractvalue { ptr, i32 } %21, 1
  store i32 %23, ptr %9, align 4
  br label %74

24:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 24, ptr %11) #3
  invoke void @_ZN5sc_dt7sc_uintILi3EEC2Ei(ptr noundef nonnull align 8 dereferenceable(24) %11, i32 noundef 0)
          to label %25 unwind label %31

25:                                               ; preds = %24
  br label %26

26:                                               ; preds = %69, %25
  %27 = invoke noundef i64 @_ZNK5sc_dt12sc_uint_basecvyEv(ptr noundef nonnull align 8 dereferenceable(24) %11)
          to label %28 unwind label %35

28:                                               ; preds = %26
  %29 = icmp ult i64 %27, 4
  br i1 %29, label %39, label %30

30:                                               ; preds = %28
  store i32 5, ptr %10, align 4
  call void @_ZN5sc_dt13sc_value_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #3
  br label %71

31:                                               ; preds = %24
  %32 = landingpad { ptr, i32 }
          cleanup
  %33 = extractvalue { ptr, i32 } %32, 0
  store ptr %33, ptr %8, align 8
  %34 = extractvalue { ptr, i32 } %32, 1
  store i32 %34, ptr %9, align 4
  br label %70

35:                                               ; preds = %68, %64, %61, %57, %54, %51, %48, %45, %42, %39, %26
  %36 = landingpad { ptr, i32 }
          cleanup
  %37 = extractvalue { ptr, i32 } %36, 0
  store ptr %37, ptr %8, align 8
  %38 = extractvalue { ptr, i32 } %36, 1
  store i32 %38, ptr %9, align 4
  call void @_ZN5sc_dt13sc_value_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %11) #3
  br label %70

39:                                               ; preds = %28
  %40 = load ptr, ptr %5, align 8, !tbaa !5
  %41 = invoke noundef i64 @_ZNK5sc_dt12sc_uint_basecvyEv(ptr noundef nonnull align 8 dereferenceable(24) %7)
          to label %42 unwind label %35

42:                                               ; preds = %39
  %43 = getelementptr inbounds [4 x %"class.sc_dt::sc_uint"], ptr %40, i64 %41
  %44 = invoke noundef i64 @_ZNK5sc_dt12sc_uint_basecvyEv(ptr noundef nonnull align 8 dereferenceable(24) %11)
          to label %45 unwind label %35

45:                                               ; preds = %42
  %46 = getelementptr inbounds [4 x %"class.sc_dt::sc_uint"], ptr %43, i64 0, i64 %44
  %47 = invoke noundef i64 @_ZNK5sc_dt12sc_uint_basecvyEv(ptr noundef nonnull align 8 dereferenceable(24) %46)
          to label %48 unwind label %35

48:                                               ; preds = %45
  %49 = load ptr, ptr %6, align 8, !tbaa !5
  %50 = invoke noundef i64 @_ZNK5sc_dt12sc_uint_basecvyEv(ptr noundef nonnull align 8 dereferenceable(24) %7)
          to label %51 unwind label %35

51:                                               ; preds = %48
  %52 = getelementptr inbounds [4 x %"class.sc_dt::sc_uint"], ptr %49, i64 %50
  %53 = invoke noundef i64 @_ZNK5sc_dt12sc_uint_basecvyEv(ptr noundef nonnull align 8 dereferenceable(24) %11)
          to label %54 unwind label %35

54:                                               ; preds = %51
  %55 = getelementptr inbounds [4 x %"class.sc_dt::sc_uint"], ptr %52, i64 0, i64 %53
  %56 = invoke noundef i64 @_ZNK5sc_dt12sc_uint_basecvyEv(ptr noundef nonnull align 8 dereferenceable(24) %55)
          to label %57 unwind label %35

57:                                               ; preds = %54
  %58 = xor i64 %47, %56
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = invoke noundef i64 @_ZNK5sc_dt12sc_uint_basecvyEv(ptr noundef nonnull align 8 dereferenceable(24) %7)
          to label %61 unwind label %35

61:                                               ; preds = %57
  %62 = getelementptr inbounds [4 x %"class.sc_dt::sc_uint"], ptr %59, i64 %60
  %63 = invoke noundef i64 @_ZNK5sc_dt12sc_uint_basecvyEv(ptr noundef nonnull align 8 dereferenceable(24) %11)
          to label %64 unwind label %35

64:                                               ; preds = %61
  %65 = getelementptr inbounds [4 x %"class.sc_dt::sc_uint"], ptr %62, i64 0, i64 %63
  %66 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN5sc_dt7sc_uintILi8EEaSEy(ptr noundef nonnull align 8 dereferenceable(24) %65, i64 noundef %58)
          to label %67 unwind label %35

67:                                               ; preds = %64
  br label %68

68:                                               ; preds = %67
  invoke void @_ZN5sc_dt7sc_uintILi3EEppEi(ptr dead_on_unwind writable sret(%"class.sc_dt::sc_uint.0") align 8 %12, ptr noundef nonnull align 8 dereferenceable(24) %11, i32 noundef 0)
          to label %69 unwind label %35

69:                                               ; preds = %68
  call void @_ZN5sc_dt13sc_value_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #3
  br label %26, !llvm.loop !9

70:                                               ; preds = %35, %31
  call void @llvm.lifetime.end.p0(i64 24, ptr %11) #3
  br label %74

71:                                               ; preds = %30
  br label %72

72:                                               ; preds = %71
  invoke void @_ZN5sc_dt7sc_uintILi3EEppEi(ptr dead_on_unwind writable sret(%"class.sc_dt::sc_uint.0") align 8 %13, ptr noundef nonnull align 8 dereferenceable(24) %7, i32 noundef 0)
          to label %73 unwind label %20

73:                                               ; preds = %72
  call void @_ZN5sc_dt13sc_value_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %13) #3
  br label %15, !llvm.loop !11

74:                                               ; preds = %70, %20
  call void @_ZN5sc_dt13sc_value_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr %7) #3
  br label %76

75:                                               ; preds = %19
  ret void

76:                                               ; preds = %74
  %77 = load ptr, ptr %8, align 8
  %78 = load i32, ptr %9, align 4
  %79 = insertvalue { ptr, i32 } poison, ptr %77, 0
  %80 = insertvalue { ptr, i32 } %79, i32 %78, 1
  resume { ptr, i32 } %80
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5sc_dt7sc_uintILi3EEC2Ei(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZN5sc_dt7sc_uintILi8EEaSEy(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5sc_dt7sc_uintILi3EEppEi(ptr dead_on_unwind noalias writable sret(%"class.sc_dt::sc_uint.0") align 8, ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5sc_dt13sc_value_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0 align 2

attributes #0 = { mustprogress 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 = { 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 = { 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++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}


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

%"class.sc_dt::sc_uint.0" = type { %"class.sc_dt::sc_uint_base" }
%"class.sc_dt::sc_uint_base" = type { %"class.sc_dt::sc_value_base", i64, i32, i32 }
%"class.sc_dt::sc_value_base" = type { ptr }
%"class.sc_dt::sc_uint" = type { %"class.sc_dt::sc_uint_base" }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK5sc_dt12sc_uint_basecvyEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8AES_Base11AddRoundKeyEPA4_N5sc_dt7sc_uintILi8EEEPA4_KS2_(ptr nocapture noundef nonnull readnone align 8 dereferenceable(232) %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.sc_dt::sc_uint.0", align 8
  %5 = alloca %"class.sc_dt::sc_uint.0", align 8
  %6 = alloca %"class.sc_dt::sc_uint.0", align 8
  %7 = alloca %"class.sc_dt::sc_uint.0", align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %4) #3
  call void @_ZN5sc_dt7sc_uintILi3EEC2Ei(ptr noundef nonnull align 8 dereferenceable(24) %4, i32 noundef 0)
  %8 = call noundef i64 @_ZNK5sc_dt12sc_uint_basecvyEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %9 = icmp ult i64 %8, 4
  br i1 %9, label %.lr.ph10, label %._crit_edge11

._crit_edge11:                                    ; preds = %36, %3
  call void @_ZN5sc_dt13sc_value_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #3
  ret void

10:                                               ; preds = %._crit_edge
  %11 = landingpad { ptr, i32 }
          cleanup
  br label %39

.lr.ph10:                                         ; preds = %3, %36
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %5) #3
  invoke void @_ZN5sc_dt7sc_uintILi3EEC2Ei(ptr noundef nonnull align 8 dereferenceable(24) %5, i32 noundef 0)
          to label %.preheader unwind label %14

.preheader:                                       ; preds = %.lr.ph10
  %12 = call noundef i64 @_ZNK5sc_dt12sc_uint_basecvyEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %13 = icmp ult i64 %12, 4
  br i1 %13, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %32, %.preheader
  call void @_ZN5sc_dt13sc_value_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #3
  invoke void @_ZN5sc_dt7sc_uintILi3EEppEi(ptr dead_on_unwind nonnull writable sret(%"class.sc_dt::sc_uint.0") align 8 %7, ptr noundef nonnull align 8 dereferenceable(24) %4, i32 noundef 0)
          to label %36 unwind label %10

14:                                               ; preds = %.lr.ph10
  %15 = landingpad { ptr, i32 }
          cleanup
  br label %35

16:                                               ; preds = %31, %.lr.ph
  %17 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN5sc_dt13sc_value_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %5) #3
  br label %35

.lr.ph:                                           ; preds = %.preheader, %32
  %18 = call noundef i64 @_ZNK5sc_dt12sc_uint_basecvyEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %19 = call noundef i64 @_ZNK5sc_dt12sc_uint_basecvyEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %20 = getelementptr inbounds [4 x %"class.sc_dt::sc_uint"], ptr %1, i64 %18, i64 %19
  %21 = call noundef i64 @_ZNK5sc_dt12sc_uint_basecvyEv(ptr noundef nonnull align 8 dereferenceable(24) %20)
  %22 = call noundef i64 @_ZNK5sc_dt12sc_uint_basecvyEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %23 = call noundef i64 @_ZNK5sc_dt12sc_uint_basecvyEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %24 = getelementptr inbounds [4 x %"class.sc_dt::sc_uint"], ptr %2, i64 %22, i64 %23
  %25 = call noundef i64 @_ZNK5sc_dt12sc_uint_basecvyEv(ptr noundef nonnull align 8 dereferenceable(24) %24)
  %26 = xor i64 %25, %21
  %27 = call noundef i64 @_ZNK5sc_dt12sc_uint_basecvyEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %28 = call noundef i64 @_ZNK5sc_dt12sc_uint_basecvyEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %29 = getelementptr inbounds [4 x %"class.sc_dt::sc_uint"], ptr %1, i64 %27, i64 %28
  %30 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN5sc_dt7sc_uintILi8EEaSEy(ptr noundef nonnull align 8 dereferenceable(24) %29, i64 noundef %26)
          to label %31 unwind label %16

31:                                               ; preds = %.lr.ph
  invoke void @_ZN5sc_dt7sc_uintILi3EEppEi(ptr dead_on_unwind nonnull writable sret(%"class.sc_dt::sc_uint.0") align 8 %6, ptr noundef nonnull align 8 dereferenceable(24) %5, i32 noundef 0)
          to label %32 unwind label %16

32:                                               ; preds = %31
  call void @_ZN5sc_dt13sc_value_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #3
  %33 = call noundef i64 @_ZNK5sc_dt12sc_uint_basecvyEv(ptr noundef nonnull align 8 dereferenceable(24) %5)
  %34 = icmp ult i64 %33, 4
  br i1 %34, label %.lr.ph, label %._crit_edge, !llvm.loop !5

35:                                               ; preds = %16, %14
  %.pn = phi { ptr, i32 } [ %17, %16 ], [ %15, %14 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #3
  br label %39

36:                                               ; preds = %._crit_edge
  call void @_ZN5sc_dt13sc_value_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #3
  %37 = call noundef i64 @_ZNK5sc_dt12sc_uint_basecvyEv(ptr noundef nonnull align 8 dereferenceable(24) %4)
  %38 = icmp ult i64 %37, 4
  br i1 %38, label %.lr.ph10, label %._crit_edge11, !llvm.loop !7

39:                                               ; preds = %35, %10
  %.pn.pn = phi { ptr, i32 } [ %.pn, %35 ], [ %11, %10 ]
  call void @_ZN5sc_dt13sc_value_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %4) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %4) #3
  resume { ptr, i32 } %.pn.pn
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5sc_dt7sc_uintILi3EEC2Ei(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZN5sc_dt7sc_uintILi8EEaSEy(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN5sc_dt7sc_uintILi3EEppEi(ptr dead_on_unwind noalias writable sret(%"class.sc_dt::sc_uint.0") align 8, ptr noundef nonnull align 8 dereferenceable(24), i32 noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN5sc_dt13sc_value_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0 align 2

attributes #0 = { mustprogress 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 = { 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 = { mustprogress 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}


; Effective O3 passes: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass