; 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 nounwind uwtable
declare dso_local noundef i32 @_Z19PROPVARIANT_to_boolRK14tagPROPVARIANTRb(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) #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
declare dso_local noundef i32 @_Z17ParsePropToUInt32RK7UStringRK14tagPROPVARIANTRj(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z11ParseMtPropRK7UStringRK14tagPROPVARIANTjRj(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef %2, ptr noundef nonnull align 4 dereferenceable(4) %3) #2 {
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i8, align 1
  %11 = alloca i32, align 4
  %12 = 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 ptr %3, ptr %9, align 8, !tbaa !5
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = call noundef zeroext i1 @_ZNK7UString7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(16) %13)
  br i1 %14, label %15, label %47

15:                                               ; preds = %4
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.tagPROPVARIANT, ptr %16, i32 0, i32 0
  %18 = load i16, ptr %17, align 8, !tbaa !11
  %19 = zext i16 %18 to i32
  switch i32 %19, label %25 [
    i32 19, label %20
  ]

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

25:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %26 = load ptr, ptr %7, align 8, !tbaa !5
  %27 = call noundef i32 @_Z19PROPVARIANT_to_boolRK14tagPROPVARIANTRb(ptr noundef nonnull align 8 dereferenceable(16) %26, ptr noundef nonnull align 1 dereferenceable(1) %10)
  store i32 %27, ptr %11, align 4, !tbaa !9
  %28 = load i32, ptr %11, align 4, !tbaa !9
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %32

30:                                               ; preds = %25
  %31 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %31, ptr %5, align 4
  store i32 1, ptr %12, align 4
  br label %33

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

33:                                               ; preds = %32, %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  %34 = load i32, ptr %12, align 4
  switch i32 %34, label %44 [
    i32 0, label %35
  ]

35:                                               ; preds = %33
  %36 = load i8, ptr %10, align 1, !tbaa !15, !range !17, !noundef !18
  %37 = trunc i8 %36 to i1
  br i1 %37, label %38, label %40

38:                                               ; preds = %35
  %39 = load i32, ptr %8, align 4, !tbaa !9
  br label %41

40:                                               ; preds = %35
  br label %41

41:                                               ; preds = %40, %38
  %42 = phi i32 [ %39, %38 ], [ 1, %40 ]
  %43 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %42, ptr %43, align 4, !tbaa !9
  store i32 2, ptr %12, align 4
  br label %44

44:                                               ; preds = %41, %33
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #3
  %45 = load i32, ptr %12, align 4
  switch i32 %45, label %61 [
    i32 1, label %59
    i32 2, label %46
  ]

46:                                               ; preds = %44, %20
  store i32 0, ptr %5, align 4
  br label %59

47:                                               ; preds = %4
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.tagPROPVARIANT, ptr %48, i32 0, i32 0
  %50 = load i16, ptr %49, align 8, !tbaa !11
  %51 = zext i16 %50 to i32
  %52 = icmp ne i32 %51, 0
  br i1 %52, label %53, label %54

53:                                               ; preds = %47
  store i32 -2147024809, ptr %5, align 4
  br label %59

54:                                               ; preds = %47
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = load ptr, ptr %7, align 8, !tbaa !5
  %57 = load ptr, ptr %9, align 8, !tbaa !5
  %58 = call noundef i32 @_Z17ParsePropToUInt32RK7UStringRK14tagPROPVARIANTRj(ptr noundef nonnull align 8 dereferenceable(16) %55, ptr noundef nonnull align 8 dereferenceable(16) %56, ptr noundef nonnull align 4 dereferenceable(4) %57)
  store i32 %58, ptr %5, align 4
  br label %59

59:                                               ; preds = %54, %53, %46, %44
  %60 = load i32, ptr %5, align 4
  ret i32 %60

61:                                               ; preds = %44
  unreachable
}

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" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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, !13, i64 0}
!12 = !{!"_ZTS14tagPROPVARIANT", !13, i64 0, !13, i64 2, !13, i64 4, !13, i64 6, !7, i64 8}
!13 = !{!"short", !7, i64 0}
!14 = !{!7, !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}


; 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
declare dso_local noundef i32 @_Z19PROPVARIANT_to_boolRK14tagPROPVARIANTRb(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 1 dereferenceable(1)) 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
declare dso_local noundef i32 @_Z17ParsePropToUInt32RK7UStringRK14tagPROPVARIANTRj(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_Z11ParseMtPropRK7UStringRK14tagPROPVARIANTjRj(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef %2, ptr noundef nonnull align 4 dereferenceable(4) %3) local_unnamed_addr #2 {
  %5 = alloca i8, align 1
  %6 = tail call noundef zeroext i1 @_ZNK7UString7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(16) %0)
  %7 = load i16, ptr %1, align 8, !tbaa !5
  br i1 %6, label %8, label %18

8:                                                ; preds = %4
  %cond = icmp eq i16 %7, 19
  br i1 %cond, label %9, label %12

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

12:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %5) #3
  %13 = call noundef i32 @_Z19PROPVARIANT_to_boolRK14tagPROPVARIANTRb(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 1 dereferenceable(1) %5)
  %.not18 = icmp eq i32 %13, 0
  br i1 %.not18, label %14, label %.thread

.thread:                                          ; preds = %12
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #3
  br label %21

14:                                               ; preds = %12
  %15 = load i8, ptr %5, align 1, !tbaa !13, !range !15, !noundef !16
  %16 = trunc nuw i8 %15 to i1
  %17 = select i1 %16, i32 %2, i32 1
  store i32 %17, ptr %3, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %5) #3
  br label %21

18:                                               ; preds = %4
  %.not = icmp eq i16 %7, 0
  br i1 %.not, label %19, label %21

19:                                               ; preds = %18
  %20 = tail call 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) %3)
  br label %21

21:                                               ; preds = %9, %14, %.thread, %18, %19
  %.117 = phi i32 [ %20, %19 ], [ -2147024809, %18 ], [ %13, %.thread ], [ 0, %14 ], [ 0, %9 ]
  ret i32 %.117
}

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" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !8, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}


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