; LLVM IR from gem5/gem5 :: ext/systemc/src/sysc/datatypes/fx (scfx_rep)

; 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::scfx_rep" = type <{ %"class.sc_dt::scfx_mant", i32, i32, i32, i32, i32, i8, [3 x i8] }>
%"class.sc_dt::scfx_mant" = type <{ ptr, i32, [4 x i8] }>

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_nanEv(ptr noundef nonnull align 8 dereferenceable(37)) #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_infEv(ptr noundef nonnull align 8 dereferenceable(37)) #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK5sc_dt8scfx_rep7is_zeroEv(ptr noundef nonnull align 8 dereferenceable(37)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_negEv(ptr noundef nonnull align 8 dereferenceable(37)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN5sc_dt11compare_absERKNS_8scfx_repES2_(ptr noundef nonnull align 8 dereferenceable(37), ptr noundef nonnull align 8 dereferenceable(37)) #2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN5sc_dt12cmp_scfx_repERKNS_8scfx_repES2_(ptr noundef nonnull align 8 dereferenceable(37) %0, ptr noundef nonnull align 8 dereferenceable(37) %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %6 = load ptr, ptr %4, align 8, !tbaa !5
  %7 = call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_nanEv(ptr noundef nonnull align 8 dereferenceable(37) %6)
  br i1 %7, label %11, label %8

8:                                                ; preds = %2
  %9 = load ptr, ptr %5, align 8, !tbaa !5
  %10 = call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_nanEv(ptr noundef nonnull align 8 dereferenceable(37) %9)
  br i1 %10, label %11, label %12

11:                                               ; preds = %8, %2
  store i32 2, ptr %3, align 4
  br label %76

12:                                               ; preds = %8
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_infEv(ptr noundef nonnull align 8 dereferenceable(37) %13)
  br i1 %14, label %18, label %15

15:                                               ; preds = %12
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_infEv(ptr noundef nonnull align 8 dereferenceable(37) %16)
  br i1 %17, label %18, label %49

18:                                               ; preds = %15, %12
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_infEv(ptr noundef nonnull align 8 dereferenceable(37) %19)
  br i1 %20, label %21, label %40

21:                                               ; preds = %18
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_negEv(ptr noundef nonnull align 8 dereferenceable(37) %22)
  br i1 %23, label %32, label %24

24:                                               ; preds = %21
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_infEv(ptr noundef nonnull align 8 dereferenceable(37) %25)
  br i1 %26, label %27, label %31

27:                                               ; preds = %24
  %28 = load ptr, ptr %5, align 8, !tbaa !5
  %29 = call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_negEv(ptr noundef nonnull align 8 dereferenceable(37) %28)
  br i1 %29, label %31, label %30

30:                                               ; preds = %27
  store i32 0, ptr %3, align 4
  br label %76

31:                                               ; preds = %27, %24
  store i32 1, ptr %3, align 4
  br label %76

32:                                               ; preds = %21
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_infEv(ptr noundef nonnull align 8 dereferenceable(37) %33)
  br i1 %34, label %35, label %39

35:                                               ; preds = %32
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_negEv(ptr noundef nonnull align 8 dereferenceable(37) %36)
  br i1 %37, label %38, label %39

38:                                               ; preds = %35
  store i32 0, ptr %3, align 4
  br label %76

39:                                               ; preds = %35, %32
  store i32 -1, ptr %3, align 4
  br label %76

40:                                               ; preds = %18
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_infEv(ptr noundef nonnull align 8 dereferenceable(37) %41)
  br i1 %42, label %43, label %48

43:                                               ; preds = %40
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_negEv(ptr noundef nonnull align 8 dereferenceable(37) %44)
  br i1 %45, label %47, label %46

46:                                               ; preds = %43
  store i32 -1, ptr %3, align 4
  br label %76

47:                                               ; preds = %43
  store i32 1, ptr %3, align 4
  br label %76

48:                                               ; preds = %40
  br label %49

49:                                               ; preds = %48, %15
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep7is_zeroEv(ptr noundef nonnull align 8 dereferenceable(37) %50)
  br i1 %51, label %52, label %56

52:                                               ; preds = %49
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep7is_zeroEv(ptr noundef nonnull align 8 dereferenceable(37) %53)
  br i1 %54, label %55, label %56

55:                                               ; preds = %52
  store i32 0, ptr %3, align 4
  br label %76

56:                                               ; preds = %52, %49
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds %"class.sc_dt::scfx_rep", ptr %57, i32 0, i32 2
  %59 = load i32, ptr %58, align 4, !tbaa !9
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = getelementptr inbounds %"class.sc_dt::scfx_rep", ptr %60, i32 0, i32 2
  %62 = load i32, ptr %61, align 4, !tbaa !9
  %63 = icmp ne i32 %59, %62
  br i1 %63, label %64, label %68

64:                                               ; preds = %56
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %"class.sc_dt::scfx_rep", ptr %65, i32 0, i32 2
  %67 = load i32, ptr %66, align 4, !tbaa !9
  store i32 %67, ptr %3, align 4
  br label %76

68:                                               ; preds = %56
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds %"class.sc_dt::scfx_rep", ptr %69, i32 0, i32 2
  %71 = load i32, ptr %70, align 4, !tbaa !9
  %72 = load ptr, ptr %4, align 8, !tbaa !5
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  %74 = call noundef i32 @_ZN5sc_dt11compare_absERKNS_8scfx_repES2_(ptr noundef nonnull align 8 dereferenceable(37) %72, ptr noundef nonnull align 8 dereferenceable(37) %73)
  %75 = mul nsw i32 %71, %74
  store i32 %75, ptr %3, align 4
  br label %76

76:                                               ; preds = %68, %64, %55, %47, %46, %39, %38, %31, %30, %11
  %77 = load i32, ptr %3, align 4
  ret i32 %77
}

attributes #0 = { inlinehint 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 = { inlinehint 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 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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !12, i64 20}
!10 = !{!"_ZTSN5sc_dt8scfx_repE", !11, i64 0, !12, i64 16, !12, i64 20, !13, i64 24, !12, i64 28, !12, i64 32, !14, i64 36}
!11 = !{!"_ZTSN5sc_dt9scfx_mantE", !6, i64 0, !12, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_ZTSN5sc_dt8scfx_rep5stateE", !7, i64 0}
!14 = !{!"bool", !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"

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_nanEv(ptr noundef nonnull align 8 dereferenceable(37)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_infEv(ptr noundef nonnull align 8 dereferenceable(37)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK5sc_dt8scfx_rep7is_zeroEv(ptr noundef nonnull align 8 dereferenceable(37)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_negEv(ptr noundef nonnull align 8 dereferenceable(37)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN5sc_dt11compare_absERKNS_8scfx_repES2_(ptr noundef nonnull align 8 dereferenceable(37), ptr noundef nonnull align 8 dereferenceable(37)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN5sc_dt12cmp_scfx_repERKNS_8scfx_repES2_(ptr noundef nonnull align 8 dereferenceable(37) %0, ptr noundef nonnull align 8 dereferenceable(37) %1) local_unnamed_addr #2 {
  %3 = tail call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_nanEv(ptr noundef nonnull align 8 dereferenceable(37) %0)
  br i1 %3, label %39, label %4

4:                                                ; preds = %2
  %5 = tail call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_nanEv(ptr noundef nonnull align 8 dereferenceable(37) %1)
  br i1 %5, label %39, label %6

6:                                                ; preds = %4
  %7 = tail call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_infEv(ptr noundef nonnull align 8 dereferenceable(37) %0)
  br i1 %7, label %10, label %8

8:                                                ; preds = %6
  %9 = tail call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_infEv(ptr noundef nonnull align 8 dereferenceable(37) %1)
  br i1 %9, label %10, label %27

10:                                               ; preds = %8, %6
  %11 = tail call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_infEv(ptr noundef nonnull align 8 dereferenceable(37) %0)
  br i1 %11, label %12, label %23

12:                                               ; preds = %10
  %13 = tail call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_negEv(ptr noundef nonnull align 8 dereferenceable(37) %0)
  %14 = tail call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_infEv(ptr noundef nonnull align 8 dereferenceable(37) %1)
  br i1 %13, label %19, label %15

15:                                               ; preds = %12
  br i1 %14, label %16, label %18

16:                                               ; preds = %15
  %17 = tail call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_negEv(ptr noundef nonnull align 8 dereferenceable(37) %1)
  br i1 %17, label %18, label %39

18:                                               ; preds = %16, %15
  br label %39

19:                                               ; preds = %12
  br i1 %14, label %20, label %22

20:                                               ; preds = %19
  %21 = tail call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_negEv(ptr noundef nonnull align 8 dereferenceable(37) %1)
  br i1 %21, label %39, label %22

22:                                               ; preds = %20, %19
  br label %39

23:                                               ; preds = %10
  %24 = tail call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_infEv(ptr noundef nonnull align 8 dereferenceable(37) %1)
  br i1 %24, label %25, label %27

25:                                               ; preds = %23
  %26 = tail call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep6is_negEv(ptr noundef nonnull align 8 dereferenceable(37) %1)
  %. = select i1 %26, i32 1, i32 -1
  br label %39

27:                                               ; preds = %23, %8
  %28 = tail call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep7is_zeroEv(ptr noundef nonnull align 8 dereferenceable(37) %0)
  br i1 %28, label %29, label %31

29:                                               ; preds = %27
  %30 = tail call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep7is_zeroEv(ptr noundef nonnull align 8 dereferenceable(37) %1)
  br i1 %30, label %39, label %31

31:                                               ; preds = %29, %27
  %32 = getelementptr inbounds i8, ptr %0, i64 20
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = getelementptr inbounds i8, ptr %1, i64 20
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %.not = icmp eq i32 %33, %35
  br i1 %.not, label %36, label %39

36:                                               ; preds = %31
  %37 = tail call noundef i32 @_ZN5sc_dt11compare_absERKNS_8scfx_repES2_(ptr noundef nonnull align 8 dereferenceable(37) %0, ptr noundef nonnull align 8 dereferenceable(37) %1)
  %38 = mul nsw i32 %37, %33
  br label %39

39:                                               ; preds = %31, %29, %25, %20, %16, %2, %4, %36, %22, %18
  %.0 = phi i32 [ -1, %22 ], [ 1, %18 ], [ %38, %36 ], [ 2, %4 ], [ 2, %2 ], [ 0, %16 ], [ 0, %20 ], [ %., %25 ], [ 0, %29 ], [ %33, %31 ]
  ret i32 %.0
}

attributes #0 = { inlinehint 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 = { inlinehint 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 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, !11, i64 20}
!6 = !{!"_ZTSN5sc_dt8scfx_repE", !7, i64 0, !11, i64 16, !11, i64 20, !12, i64 24, !11, i64 28, !11, i64 32, !13, i64 36}
!7 = !{!"_ZTSN5sc_dt9scfx_mantE", !8, i64 0, !11, i64 8}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"_ZTSN5sc_dt8scfx_rep5stateE", !9, i64 0}
!13 = !{!"bool", !9, i64 0}


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