; LLVM IR from google/benchmark :: test/reporter_output_test.ll (Z16BM_Complexity_O1RN9benchmark5StateE)

; 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.benchmark::State::StateIterator" = type { i64, ptr }
%"struct.benchmark::State::StateIterator::Value" = type { i8 }

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

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

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { i64, ptr } @_ZN9benchmark5State5beginEv(ptr noundef nonnull align 64 dereferenceable(184)) #1 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { i64, ptr } @_ZN9benchmark5State3endEv(ptr noundef nonnull align 64 dereferenceable(184)) #1 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK9benchmark5State13StateIteratorneERKS1_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZNK9benchmark5State13StateIteratordeEv(ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZN9benchmark5State13StateIteratorppEv(ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK9benchmark5State10iterationsEv(ptr noundef nonnull align 64 dereferenceable(184)) #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z16BM_Complexity_O1RN9benchmark5StateE(ptr noundef nonnull align 64 dereferenceable(184) %0) #3 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca %"struct.benchmark::State::StateIterator", align 8
  %5 = alloca %"struct.benchmark::State::StateIterator", align 8
  %6 = alloca %"struct.benchmark::State::StateIterator::Value", align 1
  %7 = alloca %"struct.benchmark::State::StateIterator::Value", align 1
  %8 = alloca double, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %9, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #4
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %11 = call { i64, ptr } @_ZN9benchmark5State5beginEv(ptr noundef nonnull align 64 dereferenceable(184) %10)
  %12 = getelementptr inbounds { i64, ptr }, ptr %4, i32 0, i32 0
  %13 = extractvalue { i64, ptr } %11, 0
  store i64 %13, ptr %12, align 8
  %14 = getelementptr inbounds { i64, ptr }, ptr %4, i32 0, i32 1
  %15 = extractvalue { i64, ptr } %11, 1
  store ptr %15, ptr %14, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #4
  %16 = load ptr, ptr %3, align 8, !tbaa !5
  %17 = call { i64, ptr } @_ZN9benchmark5State3endEv(ptr noundef nonnull align 64 dereferenceable(184) %16)
  %18 = getelementptr inbounds { i64, ptr }, ptr %5, i32 0, i32 0
  %19 = extractvalue { i64, ptr } %17, 0
  store i64 %19, ptr %18, align 8
  %20 = getelementptr inbounds { i64, ptr }, ptr %5, i32 0, i32 1
  %21 = extractvalue { i64, ptr } %17, 1
  store ptr %21, ptr %20, align 8
  br label %22

22:                                               ; preds = %33, %1
  %23 = call noundef zeroext i1 @_ZNK9benchmark5State13StateIteratorneERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(16) %5)
  br i1 %23, label %25, label %24

24:                                               ; preds = %22
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  br label %35

25:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #4
  call void @_ZNK9benchmark5State13StateIteratordeEv(ptr noundef nonnull align 8 dereferenceable(16) %4)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %26 = load ptr, ptr %2, align 8, !tbaa !5
  %27 = call noundef i64 @_ZNK9benchmark5State10iterationsEv(ptr noundef nonnull align 64 dereferenceable(184) %26)
  %28 = sitofp i64 %27 to double
  %29 = load ptr, ptr %2, align 8, !tbaa !5
  %30 = call noundef i64 @_ZNK9benchmark5State10iterationsEv(ptr noundef nonnull align 64 dereferenceable(184) %29)
  %31 = sitofp i64 %30 to double
  %32 = fmul double %28, %31
  store double %32, ptr %8, align 8, !tbaa !9
  call void @_ZN9benchmark13DoNotOptimizeIdEEvRT_(ptr noundef nonnull align 8 dereferenceable(8) %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #4
  br label %33

33:                                               ; preds = %25
  %34 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN9benchmark5State13StateIteratorppEv(ptr noundef nonnull align 8 dereferenceable(16) %4)
  br label %22

35:                                               ; preds = %24
  %36 = load ptr, ptr %2, align 8, !tbaa !5
  %37 = load ptr, ptr %2, align 8, !tbaa !5
  %38 = call noundef i64 @_ZNK9benchmark5State5rangeEm(ptr noundef nonnull align 64 dereferenceable(184) %37, i64 noundef 0)
  call void @_ZN9benchmark5State14SetComplexityNEl(ptr noundef nonnull align 64 dereferenceable(184) %36, i64 noundef %38)
  ret void
}

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN9benchmark5State14SetComplexityNEl(ptr noundef nonnull align 64 dereferenceable(184), i64 noundef) #2 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK9benchmark5State5rangeEm(ptr noundef nonnull align 64 dereferenceable(184), i64 noundef) #2 align 2

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

%"struct.benchmark::State::StateIterator" = type { i64, ptr }

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

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

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { i64, ptr } @_ZN9benchmark5State5beginEv(ptr noundef nonnull align 64 dereferenceable(184)) local_unnamed_addr #1 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local { i64, ptr } @_ZN9benchmark5State3endEv(ptr noundef nonnull align 64 dereferenceable(184)) local_unnamed_addr #1 align 2

; Function Attrs: alwaysinline mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK9benchmark5State13StateIteratorneERKS1_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZNK9benchmark5State13StateIteratordeEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZN9benchmark5State13StateIteratorppEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK9benchmark5State10iterationsEv(ptr noundef nonnull align 64 dereferenceable(184)) local_unnamed_addr #2 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN9benchmark13DoNotOptimizeIdEEvRT_(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
define dso_local void @_Z16BM_Complexity_O1RN9benchmark5StateE(ptr noundef nonnull align 64 dereferenceable(184) %0) local_unnamed_addr #3 {
  %2 = alloca %"struct.benchmark::State::StateIterator", align 8
  %3 = alloca %"struct.benchmark::State::StateIterator", align 8
  %4 = alloca double, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #4
  %5 = tail call { i64, ptr } @_ZN9benchmark5State5beginEv(ptr noundef nonnull align 64 dereferenceable(184) %0)
  %6 = extractvalue { i64, ptr } %5, 0
  store i64 %6, ptr %2, align 8
  %7 = getelementptr inbounds i8, ptr %2, i64 8
  %8 = extractvalue { i64, ptr } %5, 1
  store ptr %8, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #4
  %9 = tail call { i64, ptr } @_ZN9benchmark5State3endEv(ptr noundef nonnull align 64 dereferenceable(184) %0)
  %10 = extractvalue { i64, ptr } %9, 0
  store i64 %10, ptr %3, align 8
  %11 = getelementptr inbounds i8, ptr %3, i64 8
  %12 = extractvalue { i64, ptr } %9, 1
  store ptr %12, ptr %11, align 8
  %13 = call noundef zeroext i1 @_ZNK9benchmark5State13StateIteratorneERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(16) %3)
  br i1 %13, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %1
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #4
  %14 = call noundef i64 @_ZNK9benchmark5State5rangeEm(ptr noundef nonnull align 64 dereferenceable(184) %0, i64 noundef 0)
  call void @_ZN9benchmark5State14SetComplexityNEl(ptr noundef nonnull align 64 dereferenceable(184) %0, i64 noundef %14)
  ret void

.lr.ph:                                           ; preds = %1, %.lr.ph
  call void @_ZNK9benchmark5State13StateIteratordeEv(ptr noundef nonnull align 8 dereferenceable(16) %2)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #4
  %15 = call noundef i64 @_ZNK9benchmark5State10iterationsEv(ptr noundef nonnull align 64 dereferenceable(184) %0)
  %16 = sitofp i64 %15 to double
  %17 = call noundef i64 @_ZNK9benchmark5State10iterationsEv(ptr noundef nonnull align 64 dereferenceable(184) %0)
  %18 = sitofp i64 %17 to double
  %19 = fmul double %16, %18
  store double %19, ptr %4, align 8, !tbaa !5
  call void @_ZN9benchmark13DoNotOptimizeIdEEvRT_(ptr noundef nonnull align 8 dereferenceable(8) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #4
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN9benchmark5State13StateIteratorppEv(ptr noundef nonnull align 8 dereferenceable(16) %2)
  %21 = call noundef zeroext i1 @_ZNK9benchmark5State13StateIteratorneERKS1_(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(16) %3)
  br i1 %21, label %.lr.ph, label %._crit_edge
}

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local void @_ZN9benchmark5State14SetComplexityNEl(ptr noundef nonnull align 64 dereferenceable(184), i64 noundef) local_unnamed_addr #2 align 2

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNK9benchmark5State5rangeEm(ptr noundef nonnull align 64 dereferenceable(184), i64 noundef) local_unnamed_addr #2 align 2

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


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass