; 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_index" = type { i32, i32 }
%"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 nonnull align 4 dereferenceable(4) ptr @_ZN5sc_dt9scfx_mantixEi(ptr noundef nonnull align 8 dereferenceable(12), i32 noundef) #0 align 2

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

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

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK5sc_dt10scfx_index2biEv(ptr noundef nonnull align 4 dereferenceable(8)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK5sc_dt10scfx_index2wiEv(ptr noundef nonnull align 4 dereferenceable(8)) #3 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: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK5sc_dt11scfx_params3iwlEv(ptr noundef nonnull align 4 dereferenceable(28)) #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK5sc_dt11scfx_params3encEv(ptr noundef nonnull align 4 dereferenceable(28)) #0 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5sc_dt8scfx_rep8o_extendERKNS_10scfx_indexENS_6sc_encE(ptr noundef nonnull align 8 dereferenceable(37), ptr noundef nonnull align 4 dereferenceable(8), i32 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN5sc_dt8scfx_rep5clearEiRKNS_11scfx_paramsE(ptr noundef nonnull align 8 dereferenceable(37) %0, i32 noundef %1, ptr noundef nonnull align 4 dereferenceable(28) %2) #4 align 2 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca %"class.sc_dt::scfx_index", align 4
  %9 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  %10 = load ptr, ptr %5, align 8
  %11 = call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep9is_normalEv(ptr noundef nonnull align 8 dereferenceable(37) %10)
  br i1 %11, label %13, label %12

12:                                               ; preds = %3
  store i1 false, ptr %4, align 1
  br label %50

13:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %14 = load i32, ptr %6, align 4, !tbaa !9
  %15 = call i64 @_ZNK5sc_dt8scfx_rep12calc_indicesEi(ptr noundef nonnull align 8 dereferenceable(37) %10, i32 noundef %14)
  store i64 %15, ptr %8, align 4
  %16 = call noundef i32 @_ZNK5sc_dt10scfx_index2wiEv(ptr noundef nonnull align 4 dereferenceable(8) %8)
  %17 = call noundef i32 @_ZNK5sc_dt8scfx_rep4sizeEv(ptr noundef nonnull align 8 dereferenceable(37) %10)
  %18 = icmp sge i32 %16, %17
  br i1 %18, label %19, label %26

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

21:                                               ; preds = %19
  store i1 true, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %49

22:                                               ; preds = %19
  %23 = call noundef i32 @_ZNK5sc_dt10scfx_index2wiEv(ptr noundef nonnull align 4 dereferenceable(8) %8)
  %24 = add nsw i32 %23, 1
  call void @_ZN5sc_dt8scfx_rep9resize_toEii(ptr noundef nonnull align 8 dereferenceable(37) %10, i32 noundef %24, i32 noundef 1)
  br label %25

25:                                               ; preds = %22
  br label %31

26:                                               ; preds = %13
  %27 = call noundef i32 @_ZNK5sc_dt10scfx_index2wiEv(ptr noundef nonnull align 4 dereferenceable(8) %8)
  %28 = icmp slt i32 %27, 0
  br i1 %28, label %29, label %30

29:                                               ; preds = %26
  store i1 true, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %49

30:                                               ; preds = %26
  br label %31

31:                                               ; preds = %30, %25
  call void @_ZN5sc_dt8scfx_rep9toggle_tcEv(ptr noundef nonnull align 8 dereferenceable(37) %10)
  %32 = call noundef i32 @_ZNK5sc_dt10scfx_index2biEv(ptr noundef nonnull align 4 dereferenceable(8) %8)
  %33 = shl i32 1, %32
  %34 = xor i32 %33, -1
  %35 = getelementptr inbounds %"class.sc_dt::scfx_rep", ptr %10, i32 0, i32 0
  %36 = call noundef i32 @_ZNK5sc_dt10scfx_index2wiEv(ptr noundef nonnull align 4 dereferenceable(8) %8)
  %37 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN5sc_dt9scfx_mantixEi(ptr noundef nonnull align 8 dereferenceable(12) %35, i32 noundef %36)
  %38 = load i32, ptr %37, align 4, !tbaa !9
  %39 = and i32 %38, %34
  store i32 %39, ptr %37, align 4, !tbaa !9
  %40 = load i32, ptr %6, align 4, !tbaa !9
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = call noundef i32 @_ZNK5sc_dt11scfx_params3iwlEv(ptr noundef nonnull align 4 dereferenceable(28) %41)
  %43 = sub nsw i32 %42, 1
  %44 = icmp eq i32 %40, %43
  br i1 %44, label %45, label %48

45:                                               ; preds = %31
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = call noundef i32 @_ZNK5sc_dt11scfx_params3encEv(ptr noundef nonnull align 4 dereferenceable(28) %46)
  call void @_ZN5sc_dt8scfx_rep8o_extendERKNS_10scfx_indexENS_6sc_encE(ptr noundef nonnull align 8 dereferenceable(37) %10, ptr noundef nonnull align 4 dereferenceable(8) %8, i32 noundef %47)
  br label %48

48:                                               ; preds = %45, %31
  call void @_ZN5sc_dt8scfx_rep9toggle_tcEv(ptr noundef nonnull align 8 dereferenceable(37) %10)
  call void @_ZN5sc_dt8scfx_rep7find_swEv(ptr noundef nonnull align 8 dereferenceable(37) %10)
  store i1 true, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %49

49:                                               ; preds = %48, %29, %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  br label %50

50:                                               ; preds = %49, %12
  %51 = load i1, ptr %4, align 1
  ret i1 %51
}

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { 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, !10, i64 0}
!10 = !{!"int", !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"

%"class.sc_dt::scfx_index" = type { i32, i32 }

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN5sc_dt9scfx_mantixEi(ptr noundef nonnull align 8 dereferenceable(12), i32 noundef) local_unnamed_addr #0 align 2

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

; 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #2

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK5sc_dt10scfx_index2biEv(ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK5sc_dt10scfx_index2wiEv(ptr noundef nonnull align 4 dereferenceable(8)) local_unnamed_addr #3 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: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK5sc_dt11scfx_params3iwlEv(ptr noundef nonnull align 4 dereferenceable(28)) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK5sc_dt11scfx_params3encEv(ptr noundef nonnull align 4 dereferenceable(28)) local_unnamed_addr #0 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN5sc_dt8scfx_rep8o_extendERKNS_10scfx_indexENS_6sc_encE(ptr noundef nonnull align 8 dereferenceable(37), ptr noundef nonnull align 4 dereferenceable(8), i32 noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN5sc_dt8scfx_rep5clearEiRKNS_11scfx_paramsE(ptr noundef nonnull align 8 dereferenceable(37) %0, i32 noundef %1, ptr noundef nonnull align 4 dereferenceable(28) %2) local_unnamed_addr #4 align 2 {
  %4 = alloca %"class.sc_dt::scfx_index", align 8
  %5 = tail call noundef zeroext i1 @_ZNK5sc_dt8scfx_rep9is_normalEv(ptr noundef nonnull align 8 dereferenceable(37) %0)
  br i1 %5, label %6, label %33

6:                                                ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %7 = tail call i64 @_ZNK5sc_dt8scfx_rep12calc_indicesEi(ptr noundef nonnull align 8 dereferenceable(37) %0, i32 noundef %1)
  store i64 %7, ptr %4, align 8
  %8 = call noundef i32 @_ZNK5sc_dt10scfx_index2wiEv(ptr noundef nonnull align 4 dereferenceable(8) %4)
  %9 = call noundef i32 @_ZNK5sc_dt8scfx_rep4sizeEv(ptr noundef nonnull align 8 dereferenceable(37) %0)
  %.not = icmp slt i32 %8, %9
  br i1 %.not, label %15, label %10

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

12:                                               ; preds = %10
  %13 = call noundef i32 @_ZNK5sc_dt10scfx_index2wiEv(ptr noundef nonnull align 4 dereferenceable(8) %4)
  %14 = add nsw i32 %13, 1
  call void @_ZN5sc_dt8scfx_rep9resize_toEii(ptr noundef nonnull align 8 dereferenceable(37) %0, i32 noundef %14, i32 noundef 1)
  br label %18

15:                                               ; preds = %6
  %16 = call noundef i32 @_ZNK5sc_dt10scfx_index2wiEv(ptr noundef nonnull align 4 dereferenceable(8) %4)
  %17 = icmp slt i32 %16, 0
  br i1 %17, label %32, label %18

18:                                               ; preds = %15, %12
  call void @_ZN5sc_dt8scfx_rep9toggle_tcEv(ptr noundef nonnull align 8 dereferenceable(37) %0)
  %19 = call noundef i32 @_ZNK5sc_dt10scfx_index2biEv(ptr noundef nonnull align 4 dereferenceable(8) %4)
  %20 = shl nuw i32 1, %19
  %21 = xor i32 %20, -1
  %22 = call noundef i32 @_ZNK5sc_dt10scfx_index2wiEv(ptr noundef nonnull align 4 dereferenceable(8) %4)
  %23 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN5sc_dt9scfx_mantixEi(ptr noundef nonnull align 8 dereferenceable(12) %0, i32 noundef %22)
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %25 = and i32 %24, %21
  store i32 %25, ptr %23, align 4, !tbaa !5
  %26 = call noundef i32 @_ZNK5sc_dt11scfx_params3iwlEv(ptr noundef nonnull align 4 dereferenceable(28) %2)
  %27 = add nsw i32 %26, -1
  %28 = icmp eq i32 %27, %1
  br i1 %28, label %29, label %31

29:                                               ; preds = %18
  %30 = call noundef i32 @_ZNK5sc_dt11scfx_params3encEv(ptr noundef nonnull align 4 dereferenceable(28) %2)
  call void @_ZN5sc_dt8scfx_rep8o_extendERKNS_10scfx_indexENS_6sc_encE(ptr noundef nonnull align 8 dereferenceable(37) %0, ptr noundef nonnull align 4 dereferenceable(8) %4, i32 noundef %30)
  br label %31

31:                                               ; preds = %29, %18
  call void @_ZN5sc_dt8scfx_rep9toggle_tcEv(ptr noundef nonnull align 8 dereferenceable(37) %0)
  call void @_ZN5sc_dt8scfx_rep7find_swEv(ptr noundef nonnull align 8 dereferenceable(37) %0)
  br label %32

32:                                               ; preds = %15, %10, %31
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  br label %33

33:                                               ; preds = %3, %32
  ret i1 %5
}

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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}


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