; LLVM IR from SSBMTonberry/pocketlzma :: ref_spec/lzma1900/CPP/Common (Wildcard)

; 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.NWildcard::CCensor" = type { %class.CObjectVector.2, %class.CObjectVector.3 }
%class.CObjectVector.2 = type { %class.CRecordVector }
%class.CRecordVector = type { ptr, i32, i32 }
%class.CObjectVector.3 = type { %class.CRecordVector }
%"struct.NWildcard::CCensorPath" = type <{ %class.UString, i8, i8, i8, [5 x i8] }>
%class.UString = type { ptr, i32, i32 }

; 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: mustprogress uwtable
declare dso_local void @_ZN9NWildcard7CCensor7AddItemENS_15ECensorPathModeEbRK7UStringbb(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i1 noundef zeroext, ptr noundef nonnull align 8 dereferenceable(16), i1 noundef zeroext, i1 noundef zeroext) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9NWildcard7CCensor16AddPathsToCensorENS_15ECensorPathModeE(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !9
  %7 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !11
  br label %8

8:                                                ; preds = %33, %2
  %9 = load i32, ptr %5, align 4, !tbaa !11
  %10 = getelementptr inbounds %"class.NWildcard::CCensor", ptr %7, i32 0, i32 1
  %11 = call noundef i32 @_ZNK13CObjectVectorIN9NWildcard11CCensorPathEE4SizeEv(ptr noundef nonnull align 8 dereferenceable(16) %10)
  %12 = icmp ult i32 %9, %11
  br i1 %12, label %14, label %13

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

14:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %15 = getelementptr inbounds %"class.NWildcard::CCensor", ptr %7, i32 0, i32 1
  %16 = load i32, ptr %5, align 4, !tbaa !11
  %17 = call noundef nonnull align 8 dereferenceable(19) ptr @_ZN13CObjectVectorIN9NWildcard11CCensorPathEEixEj(ptr noundef nonnull align 8 dereferenceable(16) %15, i32 noundef %16)
  store ptr %17, ptr %6, align 8, !tbaa !5
  %18 = load i32, ptr %4, align 4, !tbaa !9
  %19 = load ptr, ptr %6, align 8, !tbaa !5
  %20 = getelementptr inbounds %"struct.NWildcard::CCensorPath", ptr %19, i32 0, i32 1
  %21 = load i8, ptr %20, align 8, !tbaa !13, !range !17, !noundef !18
  %22 = trunc i8 %21 to i1
  %23 = load ptr, ptr %6, align 8, !tbaa !5
  %24 = getelementptr inbounds %"struct.NWildcard::CCensorPath", ptr %23, i32 0, i32 0
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = getelementptr inbounds %"struct.NWildcard::CCensorPath", ptr %25, i32 0, i32 2
  %27 = load i8, ptr %26, align 1, !tbaa !19, !range !17, !noundef !18
  %28 = trunc i8 %27 to i1
  %29 = load ptr, ptr %6, align 8, !tbaa !5
  %30 = getelementptr inbounds %"struct.NWildcard::CCensorPath", ptr %29, i32 0, i32 3
  %31 = load i8, ptr %30, align 2, !tbaa !20, !range !17, !noundef !18
  %32 = trunc i8 %31 to i1
  call void @_ZN9NWildcard7CCensor7AddItemENS_15ECensorPathModeEbRK7UStringbb(ptr noundef nonnull align 8 dereferenceable(32) %7, i32 noundef %18, i1 noundef zeroext %22, ptr noundef nonnull align 8 dereferenceable(16) %24, i1 noundef zeroext %28, i1 noundef zeroext %32)
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  br label %33

33:                                               ; preds = %14
  %34 = load i32, ptr %5, align 4, !tbaa !11
  %35 = add i32 %34, 1
  store i32 %35, ptr %5, align 4, !tbaa !11
  br label %8, !llvm.loop !21

36:                                               ; preds = %13
  %37 = getelementptr inbounds %"class.NWildcard::CCensor", ptr %7, i32 0, i32 1
  call void @_ZN13CObjectVectorIN9NWildcard11CCensorPathEE5ClearEv(ptr noundef nonnull align 8 dereferenceable(16) %37)
  ret void
}

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 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 = !{!"_ZTSN9NWildcard15ECensorPathModeE", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !16, i64 16}
!14 = !{!"_ZTSN9NWildcard11CCensorPathE", !15, i64 0, !16, i64 16, !16, i64 17, !16, i64 18}
!15 = !{!"_ZTS7UString", !6, i64 0, !12, i64 8, !12, i64 12}
!16 = !{!"bool", !7, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!14, !16, i64 17}
!20 = !{!14, !16, i64 18}
!21 = distinct !{!21, !22}
!22 = !{!"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 uwtable
declare dso_local void @_ZN9NWildcard7CCensor7AddItemENS_15ECensorPathModeEbRK7UStringbb(ptr noundef nonnull align 8 dereferenceable(32), i32 noundef, i1 noundef zeroext, ptr noundef nonnull align 8 dereferenceable(16), i1 noundef zeroext, i1 noundef zeroext) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN9NWildcard7CCensor16AddPathsToCensorENS_15ECensorPathModeE(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef %1) local_unnamed_addr #0 align 2 {
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  %4 = tail call noundef i32 @_ZNK13CObjectVectorIN9NWildcard11CCensorPathEE4SizeEv(ptr noundef nonnull align 8 dereferenceable(16) %3)
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %2
  tail call void @_ZN13CObjectVectorIN9NWildcard11CCensorPathEE5ClearEv(ptr noundef nonnull align 8 dereferenceable(16) %3)
  ret void

.lr.ph:                                           ; preds = %2, %.lr.ph
  %.08 = phi i32 [ %15, %.lr.ph ], [ 0, %2 ]
  %5 = tail call noundef nonnull align 8 dereferenceable(19) ptr @_ZN13CObjectVectorIN9NWildcard11CCensorPathEEixEj(ptr noundef nonnull align 8 dereferenceable(16) %3, i32 noundef %.08)
  %6 = getelementptr inbounds i8, ptr %5, i64 16
  %7 = load i8, ptr %6, align 8, !tbaa !5, !range !13, !noundef !14
  %8 = trunc nuw i8 %7 to i1
  %9 = getelementptr inbounds i8, ptr %5, i64 17
  %10 = load i8, ptr %9, align 1, !tbaa !15, !range !13, !noundef !14
  %11 = trunc nuw i8 %10 to i1
  %12 = getelementptr inbounds i8, ptr %5, i64 18
  %13 = load i8, ptr %12, align 2, !tbaa !16, !range !13, !noundef !14
  %14 = trunc nuw i8 %13 to i1
  tail call void @_ZN9NWildcard7CCensor7AddItemENS_15ECensorPathModeEbRK7UStringbb(ptr noundef nonnull align 8 dereferenceable(32) %0, i32 noundef %1, i1 noundef zeroext %8, ptr noundef nonnull align 8 dereferenceable(16) %5, i1 noundef zeroext %11, i1 noundef zeroext %14)
  %15 = add nuw i32 %.08, 1
  %16 = tail call noundef i32 @_ZNK13CObjectVectorIN9NWildcard11CCensorPathEE4SizeEv(ptr noundef nonnull align 8 dereferenceable(16) %3)
  %17 = icmp ult i32 %15, %16
  br i1 %17, label %.lr.ph, label %._crit_edge, !llvm.loop !17
}

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

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

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

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 = { 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, !12, i64 16}
!6 = !{!"_ZTSN9NWildcard11CCensorPathE", !7, i64 0, !12, i64 16, !12, i64 17, !12, i64 18}
!7 = !{!"_ZTS7UString", !8, i64 0, !11, i64 8, !11, i64 12}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"bool", !9, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!6, !12, i64 17}
!16 = !{!6, !12, i64 18}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


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