; LLVM IR from SSBMTonberry/pocketlzma :: ref_spec/lzma1900/CPP/7zip/Archive/Common (HandlerOut)

; 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.UString = type { ptr, i32, i32 }
%"class.NArchive::CCommonMethodProps" = type { i32, i32, i64, i64 }

@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN8NArchive15ParseSizeStringEPKwRK14tagPROPVARIANTyRy(ptr noundef, ptr noundef nonnull align 8 dereferenceable(16), i64 noundef, ptr noundef nonnull align 8 dereferenceable(8)) #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN8NArchive18CCommonMethodProps17SetCommonPropertyERK7UStringRK14tagPROPVARIANTRi(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) %3) #0 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca i1, align 1
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca %class.UString, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  %13 = load ptr, ptr %6, align 8
  %14 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 0, ptr %14, align 4, !tbaa !9
  %15 = load ptr, ptr %7, align 8, !tbaa !5
  %16 = call noundef zeroext i1 @_ZNK7UString25IsPrefixedBy_Ascii_NoCaseEPKc(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef @.str) #5
  br i1 %16, label %17, label %31

17:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #5
  %18 = load ptr, ptr %7, align 8, !tbaa !5
  %19 = call noundef ptr @_ZNK7UString3PtrEj(ptr noundef nonnull align 8 dereferenceable(16) %18, i32 noundef 2)
  call void @_ZN7UStringC1EPKw(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef %19)
  %20 = load ptr, ptr %8, align 8, !tbaa !5
  %21 = getelementptr inbounds %"class.NArchive::CCommonMethodProps", ptr %13, i32 0, i32 1
  %22 = load i32, ptr %21, align 4, !tbaa !11
  %23 = getelementptr inbounds %"class.NArchive::CCommonMethodProps", ptr %13, i32 0, i32 0
  %24 = invoke noundef i32 @_Z11ParseMtPropRK7UStringRK14tagPROPVARIANTjRj(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 8 dereferenceable(16) %20, i32 noundef %22, ptr noundef nonnull align 4 dereferenceable(4) %23)
          to label %25 unwind label %27

25:                                               ; preds = %17
  %26 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %24, ptr %26, align 4, !tbaa !9
  call void @_ZN7UStringD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %10) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #5
  store i1 true, ptr %5, align 1
  br label %46

27:                                               ; preds = %17
  %28 = landingpad { ptr, i32 }
          cleanup
  %29 = extractvalue { ptr, i32 } %28, 0
  store ptr %29, ptr %11, align 8
  %30 = extractvalue { ptr, i32 } %28, 1
  store i32 %30, ptr %12, align 4
  call void @_ZN7UStringD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %10) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #5
  br label %48

31:                                               ; preds = %4
  %32 = load ptr, ptr %7, align 8, !tbaa !5
  %33 = call noundef zeroext i1 @_ZNK7UString25IsPrefixedBy_Ascii_NoCaseEPKc(ptr noundef nonnull align 8 dereferenceable(16) %32, ptr noundef @.str.1) #5
  br i1 %33, label %34, label %45

34:                                               ; preds = %31
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = call noundef ptr @_ZNK7UString3PtrEj(ptr noundef nonnull align 8 dereferenceable(16) %35, i32 noundef 6)
  %37 = load ptr, ptr %8, align 8, !tbaa !5
  %38 = getelementptr inbounds %"class.NArchive::CCommonMethodProps", ptr %13, i32 0, i32 3
  %39 = load i64, ptr %38, align 8, !tbaa !14
  %40 = getelementptr inbounds %"class.NArchive::CCommonMethodProps", ptr %13, i32 0, i32 2
  %41 = call noundef zeroext i1 @_ZN8NArchive15ParseSizeStringEPKwRK14tagPROPVARIANTyRy(ptr noundef %36, ptr noundef nonnull align 8 dereferenceable(16) %37, i64 noundef %39, ptr noundef nonnull align 8 dereferenceable(8) %40)
  br i1 %41, label %44, label %42

42:                                               ; preds = %34
  %43 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 -2147024809, ptr %43, align 4, !tbaa !9
  br label %44

44:                                               ; preds = %42, %34
  store i1 true, ptr %5, align 1
  br label %46

45:                                               ; preds = %31
  store i1 false, ptr %5, align 1
  br label %46

46:                                               ; preds = %45, %44, %25
  %47 = load i1, ptr %5, align 1
  ret i1 %47

48:                                               ; preds = %27
  %49 = load ptr, ptr %11, align 8
  %50 = load i32, ptr %12, align 4
  %51 = insertvalue { ptr, i32 } poison, ptr %49, 0
  %52 = insertvalue { ptr, i32 } %51, i32 %50, 1
  resume { ptr, i32 } %52
}

; Function Attrs: nounwind
declare noundef zeroext i1 @_ZNK7UString25IsPrefixedBy_Ascii_NoCaseEPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) #2

declare noundef i32 @_Z11ParseMtPropRK7UStringRK14tagPROPVARIANTjRj(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16), i32 noundef, ptr noundef nonnull align 4 dereferenceable(4)) #3

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

declare void @_ZN7UStringC1EPKw(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #3

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7UStringD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind "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 = { "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 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 #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}
!11 = !{!12, !10, i64 4}
!12 = !{!"_ZTSN8NArchive18CCommonMethodPropsE", !10, i64 0, !10, i64 4, !13, i64 8, !13, i64 16}
!13 = !{!"long long", !7, i64 0}
!14 = !{!12, !13, i64 16}


; 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.UString = type { ptr, i32, i32 }

@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN8NArchive15ParseSizeStringEPKwRK14tagPROPVARIANTyRy(ptr noundef, ptr noundef nonnull align 8 dereferenceable(16), i64 noundef, ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN8NArchive18CCommonMethodProps17SetCommonPropertyERK7UStringRK14tagPROPVARIANTRi(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 8 dereferenceable(16) %2, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(4) %3) local_unnamed_addr #0 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca %class.UString, align 8
  store i32 0, ptr %3, align 4, !tbaa !5
  %6 = tail call noundef zeroext i1 @_ZNK7UString25IsPrefixedBy_Ascii_NoCaseEPKc(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull @.str) #5
  br i1 %6, label %7, label %15

7:                                                ; preds = %4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #5
  %8 = tail call noundef ptr @_ZNK7UString3PtrEj(ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef 2)
  call void @_ZN7UStringC1EPKw(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef %8)
  %9 = getelementptr inbounds i8, ptr %0, i64 4
  %10 = load i32, ptr %9, align 4, !tbaa !9
  %11 = invoke noundef i32 @_Z11ParseMtPropRK7UStringRK14tagPROPVARIANTjRj(ptr noundef nonnull align 8 dereferenceable(16) %5, ptr noundef nonnull align 8 dereferenceable(16) %2, i32 noundef %10, ptr noundef nonnull align 4 dereferenceable(4) %0)
          to label %12 unwind label %13

12:                                               ; preds = %7
  store i32 %11, ptr %3, align 4, !tbaa !5
  call void @_ZN7UStringD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #5
  br label %24

13:                                               ; preds = %7
  %14 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN7UStringD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %5) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #5
  resume { ptr, i32 } %14

15:                                               ; preds = %4
  %16 = tail call noundef zeroext i1 @_ZNK7UString25IsPrefixedBy_Ascii_NoCaseEPKc(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull @.str.1) #5
  br i1 %16, label %17, label %24

17:                                               ; preds = %15
  %18 = tail call noundef ptr @_ZNK7UString3PtrEj(ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef 6)
  %19 = getelementptr inbounds i8, ptr %0, i64 16
  %20 = load i64, ptr %19, align 8, !tbaa !12
  %21 = getelementptr inbounds i8, ptr %0, i64 8
  %22 = tail call noundef zeroext i1 @_ZN8NArchive15ParseSizeStringEPKwRK14tagPROPVARIANTyRy(ptr noundef %18, ptr noundef nonnull align 8 dereferenceable(16) %2, i64 noundef %20, ptr noundef nonnull align 8 dereferenceable(8) %21)
  br i1 %22, label %24, label %23

23:                                               ; preds = %17
  store i32 -2147024809, ptr %3, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %15, %17, %23, %12
  %.0 = phi i1 [ true, %12 ], [ true, %23 ], [ true, %17 ], [ false, %15 ]
  ret i1 %.0
}

; Function Attrs: nounwind
declare noundef zeroext i1 @_ZNK7UString25IsPrefixedBy_Ascii_NoCaseEPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) local_unnamed_addr #2

declare noundef i32 @_Z11ParseMtPropRK7UStringRK14tagPROPVARIANTjRj(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16), i32 noundef, ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

declare void @_ZN7UStringC1EPKw(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #3

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7UStringD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #4 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nounwind "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 = { "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 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 #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"}
!9 = !{!10, !6, i64 4}
!10 = !{!"_ZTSN8NArchive18CCommonMethodPropsE", !6, i64 0, !6, i64 4, !11, i64 8, !11, i64 16}
!11 = !{!"long long", !7, i64 0}
!12 = !{!10, !11, i64 16}


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