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

%struct.tagPROPVARIANT = type { i16, i16, i16, i16, %union.anon }
%union.anon = type { %struct._LARGE_INTEGER }
%struct._LARGE_INTEGER = type { i64 }

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z19ParseStringToUInt32RK7UStringRj(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #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 i32 @_Z17ParsePropToUInt32RK7UStringRK14tagPROPVARIANTRj(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(4) %2) #0 {
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %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 %6, align 8, !tbaa !5
  %11 = getelementptr inbounds %struct.tagPROPVARIANT, ptr %10, i32 0, i32 0
  %12 = load i16, ptr %11, align 8, !tbaa !9
  %13 = zext i16 %12 to i32
  %14 = icmp eq i32 %13, 19
  br i1 %14, label %15, label %24

15:                                               ; preds = %3
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = call noundef zeroext i1 @_ZNK7UString7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(16) %16)
  br i1 %17, label %19, label %18

18:                                               ; preds = %15
  store i32 -2147024809, ptr %4, align 4
  br label %46

19:                                               ; preds = %15
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.tagPROPVARIANT, ptr %20, i32 0, i32 4
  %22 = load i32, ptr %21, align 8, !tbaa !12
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 %22, ptr %23, align 4, !tbaa !13
  store i32 0, ptr %4, align 4
  br label %46

24:                                               ; preds = %3
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.tagPROPVARIANT, ptr %25, i32 0, i32 0
  %27 = load i16, ptr %26, align 8, !tbaa !9
  %28 = zext i16 %27 to i32
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %31

30:                                               ; preds = %24
  store i32 -2147024809, ptr %4, align 4
  br label %46

31:                                               ; preds = %24
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = call noundef zeroext i1 @_ZNK7UString7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(16) %32)
  br i1 %33, label %34, label %35

34:                                               ; preds = %31
  store i32 0, ptr %4, align 4
  br label %46

35:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = call noundef i32 @_Z19ParseStringToUInt32RK7UStringRj(ptr noundef nonnull align 8 dereferenceable(16) %36, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = call noundef i32 @_ZNK7UString3LenEv(ptr noundef nonnull align 8 dereferenceable(16) %38)
  %40 = icmp ne i32 %37, %39
  br i1 %40, label %41, label %42

41:                                               ; preds = %35
  store i32 -2147024809, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %45

42:                                               ; preds = %35
  %43 = load i32, ptr %8, align 4, !tbaa !13
  %44 = load ptr, ptr %7, align 8, !tbaa !5
  store i32 %43, ptr %44, align 4, !tbaa !13
  store i32 0, ptr %4, align 4
  store i32 1, ptr %9, align 4
  br label %45

45:                                               ; preds = %42, %41
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %46

46:                                               ; preds = %45, %34, %30, %19, %18
  %47 = load i32, ptr %4, align 4
  ret i32 %47
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK7UString3LenEv(ptr noundef nonnull align 8 dereferenceable(16)) #2 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 = { 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, !11, i64 0}
!10 = !{!"_ZTS14tagPROPVARIANT", !11, i64 0, !11, i64 2, !11, i64 4, !11, i64 6, !7, i64 8}
!11 = !{!"short", !7, i64 0}
!12 = !{!7, !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"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"

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z19ParseStringToUInt32RK7UStringRj(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) 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 range(i32 -2147024809, 1) i32 @_Z17ParsePropToUInt32RK7UStringRK14tagPROPVARIANTRj(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(16) %1, ptr nocapture noundef nonnull writeonly align 4 dereferenceable(4) %2) local_unnamed_addr #0 {
  %4 = alloca i32, align 4
  %5 = load i16, ptr %1, align 8, !tbaa !5
  switch i16 %5, label %19 [
    i16 19, label %6
    i16 0, label %11
  ]

6:                                                ; preds = %3
  %7 = tail call noundef zeroext i1 @_ZNK7UString7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(16) %0)
  br i1 %7, label %8, label %19

8:                                                ; preds = %6
  %9 = getelementptr inbounds i8, ptr %1, i64 8
  %10 = load i32, ptr %9, align 8, !tbaa !10
  store i32 %10, ptr %2, align 4, !tbaa !11
  br label %19

11:                                               ; preds = %3
  %12 = tail call noundef zeroext i1 @_ZNK7UString7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(16) %0)
  br i1 %12, label %19, label %13

13:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #3
  %14 = call noundef i32 @_Z19ParseStringToUInt32RK7UStringRj(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %15 = call noundef i32 @_ZNK7UString3LenEv(ptr noundef nonnull align 8 dereferenceable(16) %0)
  %.not10 = icmp eq i32 %14, %15
  br i1 %.not10, label %16, label %18

16:                                               ; preds = %13
  %17 = load i32, ptr %4, align 4, !tbaa !11
  store i32 %17, ptr %2, align 4, !tbaa !11
  br label %18

18:                                               ; preds = %13, %16
  %.0 = phi i32 [ 0, %16 ], [ -2147024809, %13 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #3
  br label %19

19:                                               ; preds = %11, %3, %6, %18, %8
  %.1 = phi i32 [ 0, %8 ], [ %.0, %18 ], [ -2147024809, %6 ], [ -2147024809, %3 ], [ 0, %11 ]
  ret i32 %.1
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK7UString3LenEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 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 = { 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, !7, i64 0}
!6 = !{!"_ZTS14tagPROPVARIANT", !7, i64 0, !7, i64 2, !7, i64 4, !7, i64 6, !8, i64 8}
!7 = !{!"short", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!8, !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !8, i64 0}


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