; LLVM IR from ionescu007/minlzma :: minlzlib (dictbuf)

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

@Dictionary = external dso_local global %struct._DICTIONARY_STATE, align 8

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @DtGetSymbol(i32 noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @DtPutSymbol(i8 noundef zeroext) #0

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @DtRepeatSymbol(i32 noundef %0, i32 noundef %1) #0 {
  %3 = alloca i1, align 1
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store i32 %1, ptr %5, align 4, !tbaa !5
  %6 = load i32, ptr %4, align 4, !tbaa !5
  %7 = load i32, ptr getelementptr inbounds (%struct._DICTIONARY_STATE, ptr @Dictionary, i32 0, i32 3), align 8, !tbaa !9
  %8 = add i32 %6, %7
  %9 = load i32, ptr getelementptr inbounds (%struct._DICTIONARY_STATE, ptr @Dictionary, i32 0, i32 4), align 4, !tbaa !12
  %10 = icmp ugt i32 %8, %9
  br i1 %10, label %15, label %11

11:                                               ; preds = %2
  %12 = load i32, ptr %5, align 4, !tbaa !5
  %13 = load i32, ptr getelementptr inbounds (%struct._DICTIONARY_STATE, ptr @Dictionary, i32 0, i32 3), align 8, !tbaa !9
  %14 = icmp ugt i32 %12, %13
  br i1 %14, label %15, label %16

15:                                               ; preds = %11, %2
  store i1 false, ptr %3, align 1
  br label %25

16:                                               ; preds = %11
  br label %17

17:                                               ; preds = %20, %16
  %18 = load i32, ptr %5, align 4, !tbaa !5
  %19 = call zeroext i8 @DtGetSymbol(i32 noundef %18)
  call void @DtPutSymbol(i8 noundef zeroext %19)
  br label %20

20:                                               ; preds = %17
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = add i32 %21, -1
  store i32 %22, ptr %4, align 4, !tbaa !5
  %23 = icmp ugt i32 %22, 0
  br i1 %23, label %17, label %24, !llvm.loop !13

24:                                               ; preds = %20
  store i1 true, ptr %3, align 1
  br label %25

25:                                               ; preds = %24, %15
  %26 = load i1, ptr %3, align 1
  ret i1 %26
}

attributes #0 = { 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" }

!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/C++ TBAA"}
!9 = !{!10, !6, i64 16}
!10 = !{!"_DICTIONARY_STATE", !11, i64 0, !6, i64 8, !6, i64 12, !6, i64 16, !6, i64 20}
!11 = !{!"any pointer", !7, i64 0}
!12 = !{!10, !6, i64 20}
!13 = distinct !{!13, !14}
!14 = !{!"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"

%struct._DICTIONARY_STATE = type { ptr, i32, i32, i32, i32 }

@Dictionary = external dso_local local_unnamed_addr global %struct._DICTIONARY_STATE, align 8

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @DtGetSymbol(i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @DtPutSymbol(i8 noundef zeroext) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @DtRepeatSymbol(i32 noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = load i32, ptr getelementptr inbounds (i8, ptr @Dictionary, i64 16), align 8, !tbaa !5
  %4 = add i32 %3, %0
  %5 = load i32, ptr getelementptr inbounds (i8, ptr @Dictionary, i64 20), align 4, !tbaa !11
  %6 = icmp ule i32 %4, %5
  %7 = icmp uge i32 %3, %1
  %or.cond.not = and i1 %7, %6
  br i1 %or.cond.not, label %.preheader, label %.loopexit

.preheader:                                       ; preds = %2, %.preheader
  %.04 = phi i32 [ %9, %.preheader ], [ %0, %2 ]
  %8 = tail call zeroext i8 @DtGetSymbol(i32 noundef %1)
  tail call void @DtPutSymbol(i8 noundef zeroext %8)
  %9 = add i32 %.04, -1
  %.not = icmp eq i32 %9, 0
  br i1 %.not, label %.loopexit, label %.preheader, !llvm.loop !12

.loopexit:                                        ; preds = %.preheader, %2
  ret i1 %or.cond.not
}

attributes #0 = { 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" }

!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, !10, i64 16}
!6 = !{!"_DICTIONARY_STATE", !7, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !10, i64 20}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !10, i64 20}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InstCombinePass,JumpThreadingPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass