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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN18NCommandLineParser16SplitCommandLineERK7UStringRS0_S3_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 8 dereferenceable(16) %2) #0 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i8, align 1
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = 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
  %12 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN7UString5EmptyEv(ptr noundef nonnull align 8 dereferenceable(16) %12)
  %13 = load ptr, ptr %7, align 8, !tbaa !5
  call void @_ZN7UString5EmptyEv(ptr noundef nonnull align 8 dereferenceable(16) %13)
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #4
  store i8 0, ptr %8, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 0, ptr %9, align 4, !tbaa !11
  br label %14

14:                                               ; preds = %59, %3
  %15 = load i32, ptr %9, align 4, !tbaa !11
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = call noundef i32 @_ZNK7UString3LenEv(ptr noundef nonnull align 8 dereferenceable(16) %16)
  %18 = icmp ult i32 %15, %17
  br i1 %18, label %19, label %62

19:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = call noundef ptr @_ZNK7UStringcvPKwEv(ptr noundef nonnull align 8 dereferenceable(16) %20)
  %22 = load i32, ptr %9, align 4, !tbaa !11
  %23 = zext i32 %22 to i64
  %24 = getelementptr inbounds i32, ptr %21, i64 %23
  %25 = load i32, ptr %24, align 4, !tbaa !13
  store i32 %25, ptr %10, align 4, !tbaa !13
  %26 = load i32, ptr %10, align 4, !tbaa !13
  %27 = icmp eq i32 %26, 32
  br i1 %27, label %31, label %28

28:                                               ; preds = %19
  %29 = load i32, ptr %10, align 4, !tbaa !13
  %30 = icmp eq i32 %29, 9
  br i1 %30, label %31, label %43

31:                                               ; preds = %28, %19
  %32 = load i8, ptr %8, align 1, !tbaa !9, !range !15, !noundef !16
  %33 = trunc i8 %32 to i1
  br i1 %33, label %43, label %34

34:                                               ; preds = %31
  %35 = load ptr, ptr %5, align 8, !tbaa !5
  %36 = load i32, ptr %9, align 4, !tbaa !11
  %37 = add i32 %36, 1
  %38 = call noundef ptr @_ZNK7UString3PtrEj(ptr noundef nonnull align 8 dereferenceable(16) %35, i32 noundef %37)
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN7UStringaSEPKw(ptr noundef nonnull align 8 dereferenceable(16) %39, ptr noundef %38)
  %41 = load i32, ptr %9, align 4, !tbaa !11
  %42 = icmp ne i32 %41, 0
  store i1 %42, ptr %4, align 1
  store i32 1, ptr %11, align 4
  br label %56

43:                                               ; preds = %31, %28
  %44 = load i32, ptr %10, align 4, !tbaa !13
  %45 = icmp eq i32 %44, 34
  br i1 %45, label %46, label %51

46:                                               ; preds = %43
  %47 = load i8, ptr %8, align 1, !tbaa !9, !range !15, !noundef !16
  %48 = trunc i8 %47 to i1
  %49 = xor i1 %48, true
  %50 = zext i1 %49 to i8
  store i8 %50, ptr %8, align 1, !tbaa !9
  br label %55

51:                                               ; preds = %43
  %52 = load i32, ptr %10, align 4, !tbaa !13
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN7UStringpLEw(ptr noundef nonnull align 8 dereferenceable(16) %53, i32 noundef signext %52)
  br label %55

55:                                               ; preds = %51, %46
  store i32 0, ptr %11, align 4
  br label %56

56:                                               ; preds = %55, %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  %57 = load i32, ptr %11, align 4
  switch i32 %57, label %65 [
    i32 0, label %58
  ]

58:                                               ; preds = %56
  br label %59

59:                                               ; preds = %58
  %60 = load i32, ptr %9, align 4, !tbaa !11
  %61 = add i32 %60, 1
  store i32 %61, ptr %9, align 4, !tbaa !11
  br label %14, !llvm.loop !17

62:                                               ; preds = %14
  %63 = load i32, ptr %9, align 4, !tbaa !11
  %64 = icmp ne i32 %63, 0
  store i1 %64, ptr %4, align 1
  store i32 1, ptr %11, align 4
  br label %65

65:                                               ; preds = %62, %56
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #4
  %66 = load i1, ptr %4, align 1
  ret i1 %66
}

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

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

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

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

; 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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"bool", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"wchar_t", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !18}
!18 = !{!"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
define dso_local noundef zeroext i1 @_ZN18NCommandLineParser16SplitCommandLineERK7UStringRS0_S3_(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 8 dereferenceable(16) %2) local_unnamed_addr #0 {
  tail call void @_ZN7UString5EmptyEv(ptr noundef nonnull align 8 dereferenceable(16) %1)
  tail call void @_ZN7UString5EmptyEv(ptr noundef nonnull align 8 dereferenceable(16) %2)
  %4 = tail call noundef i32 @_ZNK7UString3LenEv(ptr noundef nonnull align 8 dereferenceable(16) %0)
  %.not = icmp eq i32 %4, 0
  br i1 %.not, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %3, %19
  %indvars.iv = phi i64 [ %indvars.iv.next, %19 ], [ 0, %3 ]
  %.02334 = phi i1 [ %.225.ph, %19 ], [ false, %3 ]
  %5 = tail call noundef ptr @_ZNK7UStringcvPKwEv(ptr noundef nonnull align 8 dereferenceable(16) %0)
  %6 = getelementptr inbounds i32, ptr %5, i64 %indvars.iv
  %7 = load i32, ptr %6, align 4, !tbaa !5
  switch i32 %7, label %11 [
    i32 32, label %8
    i32 9, label %8
    i32 34, label %9
  ]

8:                                                ; preds = %.lr.ph, %.lr.ph
  br i1 %.02334, label %11, label %13

9:                                                ; preds = %.lr.ph
  %10 = xor i1 %.02334, true
  br label %19

11:                                               ; preds = %8, %.lr.ph
  %12 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZN7UStringpLEw(ptr noundef nonnull align 8 dereferenceable(16) %1, i32 noundef signext %7)
  br label %19

13:                                               ; preds = %8
  %14 = trunc nuw i64 %indvars.iv to i32
  %15 = add nuw i32 %14, 1
  %16 = tail call noundef ptr @_ZNK7UString3PtrEj(ptr noundef nonnull align 8 dereferenceable(16) %0, i32 noundef %15)
  %17 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZN7UStringaSEPKw(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef %16)
  %18 = icmp ne i64 %indvars.iv, 0
  br label %.loopexit

19:                                               ; preds = %11, %9
  %.225.ph = phi i1 [ %.02334, %11 ], [ %10, %9 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %20 = tail call noundef i32 @_ZNK7UString3LenEv(ptr noundef nonnull align 8 dereferenceable(16) %0)
  %21 = zext i32 %20 to i64
  %22 = icmp ult i64 %indvars.iv.next, %21
  br i1 %22, label %.lr.ph, label %.loopexit, !llvm.loop !9

.loopexit:                                        ; preds = %19, %3, %13
  %.02233 = phi i1 [ %18, %13 ], [ false, %3 ], [ true, %19 ]
  ret i1 %.02233
}

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

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

; 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 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 #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZN7UStringpLEw(ptr noundef nonnull align 8 dereferenceable(16), i32 noundef signext) local_unnamed_addr #0 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" }
attributes #2 = { "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, !6, i64 0}
!6 = !{!"wchar_t", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: AggressiveInstCombinePass,CorrelatedValuePropagationPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass