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

; 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.COneMethodInfo = type { %class.CMethodProps, %class.AString, %class.UString }
%class.CMethodProps = type { %struct.CProps }
%struct.CProps = type { %class.CObjectVector }
%class.CObjectVector = type { %class.CRecordVector }
%class.CRecordVector = type { ptr, i32, i32 }
%class.AString = 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: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZNK7UStringcvPKwEv(ptr noundef nonnull align 8 dereferenceable(16)) #1 align 2

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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN14COneMethodInfo21ParseMethodFromStringERK7UString(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(16) %1) #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca %class.UString, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %11 = load ptr, ptr %4, align 8
  %12 = getelementptr inbounds %class.COneMethodInfo, ptr %11, i32 0, i32 1
  call void @_ZN7AString5EmptyEv(ptr noundef nonnull align 8 dereferenceable(16) %12)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = call noundef i32 @_ZNK7UString4FindEw(ptr noundef nonnull align 8 dereferenceable(16) %13, i32 noundef signext 58)
  store i32 %14, ptr %6, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #4
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  call void @_ZN7UStringC1ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(16) %15)
  %16 = load i32, ptr %6, align 4, !tbaa !9
  %17 = icmp sge i32 %16, 0
  br i1 %17, label %18, label %25

18:                                               ; preds = %2
  %19 = load i32, ptr %6, align 4, !tbaa !9
  invoke void @_ZN7UString10DeleteFromEj(ptr noundef nonnull align 8 dereferenceable(16) %7, i32 noundef %19)
          to label %20 unwind label %21

20:                                               ; preds = %18
  br label %25

21:                                               ; preds = %32, %29, %25, %18
  %22 = landingpad { ptr, i32 }
          cleanup
  %23 = extractvalue { ptr, i32 } %22, 0
  store ptr %23, ptr %8, align 8
  %24 = extractvalue { ptr, i32 } %22, 1
  store i32 %24, ptr %9, align 4
  call void @_ZN7UStringD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %51

25:                                               ; preds = %20, %2
  %26 = invoke noundef zeroext i1 @_ZNK7UString7IsAsciiEv(ptr noundef nonnull align 8 dereferenceable(16) %7)
          to label %27 unwind label %21

27:                                               ; preds = %25
  br i1 %26, label %29, label %28

28:                                               ; preds = %27
  store i32 -2147024809, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %34

29:                                               ; preds = %27
  %30 = getelementptr inbounds %class.COneMethodInfo, ptr %11, i32 0, i32 1
  %31 = invoke noundef ptr @_ZNK7UStringcvPKwEv(ptr noundef nonnull align 8 dereferenceable(16) %7)
          to label %32 unwind label %21

32:                                               ; preds = %29
  invoke void @_ZN7AString20SetFromWStr_if_AsciiEPKw(ptr noundef nonnull align 8 dereferenceable(16) %30, ptr noundef %31)
          to label %33 unwind label %21

33:                                               ; preds = %32
  store i32 0, ptr %10, align 4
  br label %34

34:                                               ; preds = %33, %28
  call void @_ZN7UStringD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #4
  %35 = load i32, ptr %10, align 4
  switch i32 %35, label %49 [
    i32 0, label %36
  ]

36:                                               ; preds = %34
  %37 = load i32, ptr %6, align 4, !tbaa !9
  %38 = icmp slt i32 %37, 0
  br i1 %38, label %39, label %40

39:                                               ; preds = %36
  store i32 0, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %49

40:                                               ; preds = %36
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = load i32, ptr %6, align 4, !tbaa !9
  %43 = add nsw i32 %42, 1
  %44 = call noundef ptr @_ZNK7UString3PtrEj(ptr noundef nonnull align 8 dereferenceable(16) %41, i32 noundef %43)
  %45 = getelementptr inbounds %class.COneMethodInfo, ptr %11, i32 0, i32 2
  %46 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN7UStringaSEPKw(ptr noundef nonnull align 8 dereferenceable(16) %45, ptr noundef %44)
  %47 = getelementptr inbounds %class.COneMethodInfo, ptr %11, i32 0, i32 2
  %48 = call noundef i32 @_ZN12CMethodProps21ParseParamsFromStringERK7UString(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 8 dereferenceable(16) %47)
  store i32 %48, ptr %3, align 4
  store i32 1, ptr %10, align 4
  br label %49

49:                                               ; preds = %40, %39, %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  %50 = load i32, ptr %3, align 4
  ret i32 %50

51:                                               ; preds = %21
  %52 = load ptr, ptr %8, align 8
  %53 = load i32, ptr %9, align 4
  %54 = insertvalue { ptr, i32 } poison, ptr %52, 0
  %55 = insertvalue { ptr, i32 } %54, i32 %53, 1
  resume { ptr, i32 } %55
}

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

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

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

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

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

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZN7UStringaSEPKw(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
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 = { 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}


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

; 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 nounwind uwtable
declare dso_local noundef ptr @_ZNK7UStringcvPKwEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #1 align 2

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

declare i32 @__gxx_personality_v0(...)

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN14COneMethodInfo21ParseMethodFromStringERK7UString(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(16) %1) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %class.UString, align 8
  %4 = getelementptr inbounds i8, ptr %0, i64 16
  tail call void @_ZN7AString5EmptyEv(ptr noundef nonnull align 8 dereferenceable(16) %4)
  %5 = tail call noundef i32 @_ZNK7UString4FindEw(ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef signext 58)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #4
  call void @_ZN7UStringC1ERKS_(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %1)
  %6 = icmp sgt i32 %5, -1
  br i1 %6, label %7, label %10

7:                                                ; preds = %2
  call void @_ZN7UString10DeleteFromEj(ptr noundef nonnull align 8 dereferenceable(16) %3, i32 noundef %5)
  br label %10

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

10:                                               ; preds = %7, %2
  %11 = call noundef zeroext i1 @_ZNK7UString7IsAsciiEv(ptr noundef nonnull align 8 dereferenceable(16) %3)
  br i1 %11, label %12, label %.critedge

12:                                               ; preds = %10
  %13 = call noundef ptr @_ZNK7UStringcvPKwEv(ptr noundef nonnull align 8 dereferenceable(16) %3)
  invoke void @_ZN7AString20SetFromWStr_if_AsciiEPKw(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef %13)
          to label %14 unwind label %8

14:                                               ; preds = %12
  call void @_ZN7UStringD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #4
  %15 = icmp slt i32 %5, 0
  br i1 %15, label %22, label %16

16:                                               ; preds = %14
  %17 = add nuw nsw i32 %5, 1
  %18 = call noundef ptr @_ZNK7UString3PtrEj(ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef %17)
  %19 = getelementptr inbounds i8, ptr %0, i64 32
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN7UStringaSEPKw(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef %18)
  %21 = call noundef i32 @_ZN12CMethodProps21ParseParamsFromStringERK7UString(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %19)
  br label %22

.critedge:                                        ; preds = %10
  call void @_ZN7UStringD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #4
  br label %22

22:                                               ; preds = %14, %.critedge, %16
  %.1 = phi i32 [ %21, %16 ], [ -2147024809, %.critedge ], [ 0, %14 ]
  ret i32 %.1
}

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

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

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

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

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

declare void @_ZN7AString20SetFromWStr_if_AsciiEPKw(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) 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 #1 align 2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZN7UStringaSEPKw(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) local_unnamed_addr #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
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 = { 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)"}


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