; LLVM IR from Py-Contributors/AlgorithmsAndDataStructure :: C++/Data Structure (WildcardPattern)

; 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: mustprogress uwtable
define dso_local noundef zeroext i1 @_Z3funRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_ii(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, i32 noundef %2, i32 noundef %3) #0 {
  %5 = alloca i1, align 1
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i32 %2, ptr %8, align 4, !tbaa !9
  store i32 %3, ptr %9, align 4, !tbaa !9
  %12 = load i32, ptr %8, align 4, !tbaa !9
  %13 = icmp slt i32 %12, 0
  br i1 %13, label %14, label %18

14:                                               ; preds = %4
  %15 = load i32, ptr %9, align 4, !tbaa !9
  %16 = icmp slt i32 %15, 0
  br i1 %16, label %17, label %18

17:                                               ; preds = %14
  store i1 true, ptr %5, align 1
  br label %108

18:                                               ; preds = %14, %4
  %19 = load i32, ptr %8, align 4, !tbaa !9
  %20 = icmp slt i32 %19, 0
  br i1 %20, label %21, label %25

21:                                               ; preds = %18
  %22 = load i32, ptr %9, align 4, !tbaa !9
  %23 = icmp sge i32 %22, 0
  br i1 %23, label %24, label %25

24:                                               ; preds = %21
  store i1 false, ptr %5, align 1
  br label %108

25:                                               ; preds = %21, %18
  %26 = load i32, ptr %9, align 4, !tbaa !9
  %27 = icmp slt i32 %26, 0
  br i1 %27, label %28, label %53

28:                                               ; preds = %25
  %29 = load i32, ptr %8, align 4, !tbaa !9
  %30 = icmp sge i32 %29, 0
  br i1 %30, label %31, label %53

31:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  store i32 0, ptr %10, align 4, !tbaa !9
  br label %32

32:                                               ; preds = %47, %31
  %33 = load i32, ptr %10, align 4, !tbaa !9
  %34 = load i32, ptr %8, align 4, !tbaa !9
  %35 = icmp sle i32 %33, %34
  br i1 %35, label %37, label %36

36:                                               ; preds = %32
  store i32 2, ptr %11, align 4
  br label %50

37:                                               ; preds = %32
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = load i32, ptr %10, align 4, !tbaa !9
  %40 = sext i32 %39 to i64
  %41 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %38, i64 noundef %40)
  %42 = load i8, ptr %41, align 1, !tbaa !11
  %43 = sext i8 %42 to i32
  %44 = icmp ne i32 %43, 42
  br i1 %44, label %45, label %46

45:                                               ; preds = %37
  store i1 false, ptr %5, align 1
  store i32 1, ptr %11, align 4
  br label %50

46:                                               ; preds = %37
  br label %47

47:                                               ; preds = %46
  %48 = load i32, ptr %10, align 4, !tbaa !9
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %10, align 4, !tbaa !9
  br label %32, !llvm.loop !12

50:                                               ; preds = %45, %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #3
  %51 = load i32, ptr %11, align 4
  switch i32 %51, label %110 [
    i32 2, label %52
    i32 1, label %108
  ]

52:                                               ; preds = %50
  store i1 true, ptr %5, align 1
  br label %108

53:                                               ; preds = %28, %25
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = load i32, ptr %8, align 4, !tbaa !9
  %56 = sext i32 %55 to i64
  %57 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %54, i64 noundef %56)
  %58 = load i8, ptr %57, align 1, !tbaa !11
  %59 = sext i8 %58 to i32
  %60 = load ptr, ptr %7, align 8, !tbaa !5
  %61 = load i32, ptr %9, align 4, !tbaa !9
  %62 = sext i32 %61 to i64
  %63 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %60, i64 noundef %62)
  %64 = load i8, ptr %63, align 1, !tbaa !11
  %65 = sext i8 %64 to i32
  %66 = icmp eq i32 %59, %65
  br i1 %66, label %75, label %67

67:                                               ; preds = %53
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  %69 = load i32, ptr %8, align 4, !tbaa !9
  %70 = sext i32 %69 to i64
  %71 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %68, i64 noundef %70)
  %72 = load i8, ptr %71, align 1, !tbaa !11
  %73 = sext i8 %72 to i32
  %74 = icmp eq i32 %73, 63
  br i1 %74, label %75, label %83

75:                                               ; preds = %67, %53
  %76 = load ptr, ptr %6, align 8, !tbaa !5
  %77 = load ptr, ptr %7, align 8, !tbaa !5
  %78 = load i32, ptr %8, align 4, !tbaa !9
  %79 = sub nsw i32 %78, 1
  %80 = load i32, ptr %9, align 4, !tbaa !9
  %81 = sub nsw i32 %80, 1
  %82 = call noundef zeroext i1 @_Z3funRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_ii(ptr noundef nonnull align 8 dereferenceable(32) %76, ptr noundef nonnull align 8 dereferenceable(32) %77, i32 noundef %79, i32 noundef %81)
  store i1 %82, ptr %5, align 1
  br label %108

83:                                               ; preds = %67
  %84 = load ptr, ptr %6, align 8, !tbaa !5
  %85 = load i32, ptr %8, align 4, !tbaa !9
  %86 = sext i32 %85 to i64
  %87 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %84, i64 noundef %86)
  %88 = load i8, ptr %87, align 1, !tbaa !11
  %89 = sext i8 %88 to i32
  %90 = icmp eq i32 %89, 42
  br i1 %90, label %91, label %107

91:                                               ; preds = %83
  %92 = load ptr, ptr %6, align 8, !tbaa !5
  %93 = load ptr, ptr %7, align 8, !tbaa !5
  %94 = load i32, ptr %8, align 4, !tbaa !9
  %95 = sub nsw i32 %94, 1
  %96 = load i32, ptr %9, align 4, !tbaa !9
  %97 = call noundef zeroext i1 @_Z3funRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_ii(ptr noundef nonnull align 8 dereferenceable(32) %92, ptr noundef nonnull align 8 dereferenceable(32) %93, i32 noundef %95, i32 noundef %96)
  br i1 %97, label %105, label %98

98:                                               ; preds = %91
  %99 = load ptr, ptr %6, align 8, !tbaa !5
  %100 = load ptr, ptr %7, align 8, !tbaa !5
  %101 = load i32, ptr %8, align 4, !tbaa !9
  %102 = load i32, ptr %9, align 4, !tbaa !9
  %103 = sub nsw i32 %102, 1
  %104 = call noundef zeroext i1 @_Z3funRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_ii(ptr noundef nonnull align 8 dereferenceable(32) %99, ptr noundef nonnull align 8 dereferenceable(32) %100, i32 noundef %101, i32 noundef %103)
  br label %105

105:                                              ; preds = %98, %91
  %106 = phi i1 [ true, %91 ], [ %104, %98 ]
  store i1 %106, ptr %5, align 1
  br label %108

107:                                              ; preds = %83
  store i1 false, ptr %5, align 1
  br label %108

108:                                              ; preds = %107, %105, %75, %52, %50, %24, %17
  %109 = load i1, ptr %5, align 1
  ret i1 %109

110:                                              ; preds = %50
  unreachable
}

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #2 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z3funRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_ii(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, i32 noundef %2, i32 noundef %3) local_unnamed_addr #0 {
  %5 = and i32 %3, %2
  %or.cond.not4980 = icmp sgt i32 %5, -1
  br i1 %or.cond.not4980, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %4, %tailrecurse.outer
  %.tr43.ph85 = phi i32 [ %56, %tailrecurse.outer ], [ %3, %4 ]
  %.tr42.ph81 = phi i32 [ %8, %tailrecurse.outer ], [ %2, %4 ]
  %6 = icmp slt i32 %.tr42.ph81, 0
  %7 = sext i32 %.tr42.ph81 to i64
  %8 = add i32 %.tr42.ph81, -1
  %9 = sext i32 %.tr43.ph85 to i64
  br i1 %6, label %.lr.ph.split.split.us.preheader, label %.lr.ph.split.us.split.preheader

.lr.ph.split.us.split.preheader:                  ; preds = %.lr.ph
  %10 = icmp slt i32 %.tr43.ph85, 0
  br label %.lr.ph.split.us.split

.lr.ph.split.us.split:                            ; preds = %.lr.ph.split.us.split.preheader, %tailrecurse.us
  %indvars.iv120 = phi i64 [ %indvars.iv.next121, %tailrecurse.us ], [ %9, %.lr.ph.split.us.split.preheader ]
  %11 = phi i1 [ %29, %tailrecurse.us ], [ %10, %.lr.ph.split.us.split.preheader ]
  br i1 %11, label %.preheader, label %12

12:                                               ; preds = %.lr.ph.split.us.split
  %13 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %7)
  %14 = load i8, ptr %13, align 1, !tbaa !5
  %15 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %indvars.iv120)
  %16 = load i8, ptr %15, align 1, !tbaa !5
  %17 = icmp eq i8 %14, %16
  %18 = trunc nsw i64 %indvars.iv120 to i32
  br i1 %17, label %tailrecurse.outer, label %19

19:                                               ; preds = %12
  %20 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %7)
  %21 = load i8, ptr %20, align 1, !tbaa !5
  %22 = icmp eq i8 %21, 63
  br i1 %22, label %tailrecurse.outer, label %23

23:                                               ; preds = %19
  %24 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %7)
  %25 = load i8, ptr %24, align 1, !tbaa !5
  %26 = icmp eq i8 %25, 42
  br i1 %26, label %27, label %.loopexit

27:                                               ; preds = %23
  %28 = tail call noundef zeroext i1 @_Z3funRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_ii(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, i32 noundef %8, i32 noundef %18)
  br i1 %28, label %.loopexit, label %tailrecurse.us

tailrecurse.us:                                   ; preds = %27
  %indvars.iv.next121 = add nsw i64 %indvars.iv120, -1
  %29 = icmp slt i64 %indvars.iv120, 1
  %30 = trunc nsw i64 %indvars.iv.next121 to i32
  %31 = and i32 %.tr42.ph81, %30
  %or.cond.not.us = icmp sgt i32 %31, -1
  br i1 %or.cond.not.us, label %.lr.ph.split.us.split, label %.loopexit

.lr.ph.split.split.us.preheader:                  ; preds = %.lr.ph
  %32 = icmp sgt i32 %.tr43.ph85, -1
  br label %.lr.ph.split.split.us

.lr.ph.split.split.us:                            ; preds = %.lr.ph.split.split.us.preheader, %tailrecurse.us63
  %indvars.iv122 = phi i64 [ %9, %.lr.ph.split.split.us.preheader ], [ %indvars.iv.next123, %tailrecurse.us63 ]
  br i1 %32, label %.loopexit, label %33

33:                                               ; preds = %.lr.ph.split.split.us
  %34 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %7)
  %35 = load i8, ptr %34, align 1, !tbaa !5
  %36 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %1, i64 noundef %indvars.iv122)
  %37 = load i8, ptr %36, align 1, !tbaa !5
  %38 = icmp eq i8 %35, %37
  %39 = trunc nsw i64 %indvars.iv122 to i32
  br i1 %38, label %tailrecurse.outer, label %40

40:                                               ; preds = %33
  %41 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %7)
  %42 = load i8, ptr %41, align 1, !tbaa !5
  %43 = icmp eq i8 %42, 63
  br i1 %43, label %tailrecurse.outer, label %44

44:                                               ; preds = %40
  %45 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %7)
  %46 = load i8, ptr %45, align 1, !tbaa !5
  %47 = icmp eq i8 %46, 42
  br i1 %47, label %48, label %.loopexit

48:                                               ; preds = %44
  %49 = tail call noundef zeroext i1 @_Z3funRNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES5_ii(ptr noundef nonnull align 8 dereferenceable(32) %0, ptr noundef nonnull align 8 dereferenceable(32) %1, i32 noundef %8, i32 noundef %39)
  br i1 %49, label %.loopexit, label %tailrecurse.us63

tailrecurse.us63:                                 ; preds = %48
  %indvars.iv.next123 = add nsw i64 %indvars.iv122, -1
  %50 = trunc nsw i64 %indvars.iv.next123 to i32
  %51 = and i32 %.tr42.ph81, %50
  %or.cond.not.us64 = icmp sgt i32 %51, -1
  br i1 %or.cond.not.us64, label %.lr.ph.split.split.us, label %.loopexit

.preheader:                                       ; preds = %.lr.ph.split.us.split
  br i1 %6, label %.loopexit, label %.lr.ph89.preheader

.lr.ph89.preheader:                               ; preds = %.preheader
  %52 = add nuw i32 %.tr42.ph81, 1
  %wide.trip.count = zext i32 %52 to i64
  br label %.lr.ph89

53:                                               ; preds = %.lr.ph89
  %indvars.iv.next133 = add nuw nsw i64 %indvars.iv132, 1
  %exitcond = icmp eq i64 %indvars.iv.next133, %wide.trip.count
  br i1 %exitcond, label %.loopexit.loopexit.split.loop.exit, label %.lr.ph89, !llvm.loop !8

.lr.ph89:                                         ; preds = %.lr.ph89.preheader, %53
  %indvars.iv132 = phi i64 [ 0, %.lr.ph89.preheader ], [ %indvars.iv.next133, %53 ]
  %54 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %indvars.iv132)
  %55 = load i8, ptr %54, align 1, !tbaa !5
  %.not40 = icmp eq i8 %55, 42
  br i1 %.not40, label %53, label %.loopexit

tailrecurse.outer:                                ; preds = %19, %12, %40, %33
  %.us-phi57 = phi i32 [ %39, %33 ], [ %39, %40 ], [ %18, %12 ], [ %18, %19 ]
  %56 = add nsw i32 %.us-phi57, -1
  %57 = and i32 %56, %8
  %or.cond.not49 = icmp sgt i32 %57, -1
  br i1 %or.cond.not49, label %.lr.ph, label %.loopexit

.loopexit.loopexit.split.loop.exit:               ; preds = %53
  %.not.le = icmp sge i64 %indvars.iv132, %7
  br label %.loopexit

.loopexit:                                        ; preds = %tailrecurse.outer, %tailrecurse.us, %27, %23, %tailrecurse.us63, %.lr.ph.split.split.us, %48, %44, %.lr.ph89, %.loopexit.loopexit.split.loop.exit, %4, %.preheader
  %.1 = phi i1 [ true, %.preheader ], [ true, %4 ], [ %.not.le, %.loopexit.loopexit.split.loop.exit ], [ false, %.lr.ph89 ], [ true, %tailrecurse.us63 ], [ false, %.lr.ph.split.split.us ], [ true, %48 ], [ false, %44 ], [ %26, %23 ], [ %26, %27 ], [ %26, %tailrecurse.us ], [ true, %tailrecurse.outer ]
  ret i1 %.1
}

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_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" }

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


; Effective O3 passes: ConstraintEliminationPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopFullUnrollPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass