; LLVM IR from turi-code/SFrame :: cxxtest/cxxtest/RealDescriptions.ll (ZN7CxxTest20RealWorldDescription9leaveOnlyEPKcS2_)

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

; 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

declare noundef zeroext i1 @_ZN7CxxTest12stringsEqualEPKcS1_(ptr noundef, ptr noundef) #1

declare void @_ZN7CxxTest4List9leaveOnlyERKNS_4LinkE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(25)) #1

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN7CxxTest20RealWorldDescription9leaveOnlyEPKcS2_(ptr noundef nonnull align 8 dereferenceable(25) %0, ptr noundef %1, ptr noundef %2) unnamed_addr #3 align 2 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %10 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #4
  %11 = load ptr, ptr %10, align 8, !tbaa !9
  %12 = getelementptr inbounds ptr, ptr %11, i64 6
  %13 = load ptr, ptr %12, align 8
  %14 = call noundef ptr %13(ptr noundef nonnull align 8 dereferenceable(25) %10)
  store ptr %14, ptr %8, align 8, !tbaa !5
  br label %15

15:                                               ; preds = %43, %3
  %16 = load ptr, ptr %8, align 8, !tbaa !5
  %17 = icmp ne ptr %16, null
  br i1 %17, label %19, label %18

18:                                               ; preds = %15
  store i32 2, ptr %9, align 4
  br label %49

19:                                               ; preds = %15
  %20 = load ptr, ptr %8, align 8, !tbaa !5
  %21 = load ptr, ptr %20, align 8, !tbaa !9
  %22 = getelementptr inbounds ptr, ptr %21, i64 4
  %23 = load ptr, ptr %22, align 8
  %24 = call noundef ptr %23(ptr noundef nonnull align 8 dereferenceable(25) %20)
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = call noundef zeroext i1 @_ZN7CxxTest12stringsEqualEPKcS1_(ptr noundef %24, ptr noundef %25)
  br i1 %26, label %27, label %42

27:                                               ; preds = %19
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = icmp ne ptr %28, null
  br i1 %29, label %30, label %39

30:                                               ; preds = %27
  %31 = load ptr, ptr %8, align 8, !tbaa !5
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = load ptr, ptr %31, align 8, !tbaa !9
  %34 = getelementptr inbounds ptr, ptr %33, i64 13
  %35 = load ptr, ptr %34, align 8
  %36 = call noundef zeroext i1 %35(ptr noundef nonnull align 8 dereferenceable(25) %31, ptr noundef %32)
  br i1 %36, label %38, label %37

37:                                               ; preds = %30
  store i1 false, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %49

38:                                               ; preds = %30
  br label %39

39:                                               ; preds = %38, %27
  %40 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN7CxxTest20RealWorldDescription6suitesEv()
  %41 = load ptr, ptr %8, align 8, !tbaa !5
  call void @_ZN7CxxTest4List9leaveOnlyERKNS_4LinkE(ptr noundef nonnull align 8 dereferenceable(16) %40, ptr noundef nonnull align 8 dereferenceable(25) %41)
  store i1 true, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %49

42:                                               ; preds = %19
  br label %43

43:                                               ; preds = %42
  %44 = load ptr, ptr %8, align 8, !tbaa !5
  %45 = load ptr, ptr %44, align 8, !tbaa !9
  %46 = getelementptr inbounds ptr, ptr %45, i64 10
  %47 = load ptr, ptr %46, align 8
  %48 = call noundef ptr %47(ptr noundef nonnull align 8 dereferenceable(25) %44)
  store ptr %48, ptr %8, align 8, !tbaa !5
  br label %15, !llvm.loop !11

49:                                               ; preds = %39, %37, %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #4
  %50 = load i32, ptr %9, align 4
  switch i32 %50, label %54 [
    i32 2, label %51
    i32 1, label %52
  ]

51:                                               ; preds = %49
  store i1 false, ptr %4, align 1
  br label %52

52:                                               ; preds = %51, %49
  %53 = load i1, ptr %4, align 1
  ret i1 %53

54:                                               ; preds = %49
  unreachable
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 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 = !{!"vtable pointer", !8, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


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

declare noundef zeroext i1 @_ZN7CxxTest12stringsEqualEPKcS1_(ptr noundef, ptr noundef) local_unnamed_addr #0

declare void @_ZN7CxxTest4List9leaveOnlyERKNS_4LinkE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(25)) local_unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN7CxxTest20RealWorldDescription9leaveOnlyEPKcS2_(ptr noundef nonnull align 8 dereferenceable(25) %0, ptr noundef %1, ptr noundef %2) unnamed_addr #2 align 2 {
  %4 = load ptr, ptr %0, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %4, i64 48
  %6 = load ptr, ptr %5, align 8
  %7 = tail call noundef ptr %6(ptr noundef nonnull align 8 dereferenceable(25) %0)
  %.not17.not = icmp eq ptr %7, null
  br i1 %.not17.not, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %3, %21
  %.01018 = phi ptr [ %25, %21 ], [ %7, %3 ]
  %8 = load ptr, ptr %.01018, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %8, i64 32
  %10 = load ptr, ptr %9, align 8
  %11 = tail call noundef ptr %10(ptr noundef nonnull align 8 dereferenceable(25) %.01018)
  %12 = tail call noundef zeroext i1 @_ZN7CxxTest12stringsEqualEPKcS1_(ptr noundef %11, ptr noundef %1)
  br i1 %12, label %13, label %21

13:                                               ; preds = %.lr.ph
  %.not13 = icmp eq ptr %2, null
  br i1 %.not13, label %19, label %14

14:                                               ; preds = %13
  %15 = load ptr, ptr %.01018, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %15, i64 104
  %17 = load ptr, ptr %16, align 8
  %18 = tail call noundef zeroext i1 %17(ptr noundef nonnull align 8 dereferenceable(25) %.01018, ptr noundef nonnull %2)
  br i1 %18, label %19, label %.loopexit

19:                                               ; preds = %14, %13
  %20 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZN7CxxTest20RealWorldDescription6suitesEv()
  tail call void @_ZN7CxxTest4List9leaveOnlyERKNS_4LinkE(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 8 dereferenceable(25) %.01018)
  br label %.loopexit

21:                                               ; preds = %.lr.ph
  %22 = load ptr, ptr %.01018, align 8, !tbaa !5
  %23 = getelementptr inbounds i8, ptr %22, i64 80
  %24 = load ptr, ptr %23, align 8
  %25 = tail call noundef ptr %24(ptr noundef nonnull align 8 dereferenceable(25) %.01018)
  %.not.not = icmp eq ptr %25, null
  br i1 %.not.not, label %.loopexit, label %.lr.ph, !llvm.loop !8

.loopexit:                                        ; preds = %21, %3, %14, %19
  %.not15 = phi i1 [ true, %19 ], [ true, %14 ], [ false, %3 ], [ false, %21 ]
  %.011 = phi i1 [ true, %19 ], [ false, %14 ], [ undef, %3 ], [ undef, %21 ]
  %spec.select = and i1 %.not15, %.011
  ret i1 %spec.select
}

attributes #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 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 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass