; LLVM IR from sp-nitech/SPTK :: third_party/REAPER/epoch_tracker (fd_filter)

; 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.sptk::reaper::FdFilter" = type { ptr, ptr, ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, float, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i32, ptr }

@stderr = external global ptr, align 8
@.str.10 = external hidden unnamed_addr constant [41 x i8], align 1

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

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZN4sptk6reaper8FdFilter12FilterStreamEP8_IO_FILES3_(ptr noundef nonnull align 8 dereferenceable(144) %0, ptr noundef %1, ptr noundef %2) #2 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %16 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 1, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  %17 = getelementptr inbounds %"class.sptk::reaper::FdFilter", ptr %16, i32 0, i32 23
  %18 = load i32, ptr %17, align 8, !tbaa !11
  store i32 %18, ptr %9, align 4, !tbaa !9
  %19 = getelementptr inbounds %"class.sptk::reaper::FdFilter", ptr %16, i32 0, i32 11
  store i32 1, ptr %19, align 8, !tbaa !14
  br label %20

20:                                               ; preds = %103, %3
  %21 = getelementptr inbounds %"class.sptk::reaper::FdFilter", ptr %16, i32 0, i32 1
  %22 = load ptr, ptr %21, align 8, !tbaa !15
  %23 = load i32, ptr %9, align 4, !tbaa !9
  %24 = sext i32 %23 to i64
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = call i64 @fread(ptr noundef %22, i64 noundef 2, i64 noundef %24, ptr noundef %25)
  %27 = trunc i64 %26 to i32
  store i32 %27, ptr %11, align 4, !tbaa !9
  %28 = icmp ne i32 %27, 0
  br i1 %28, label %29, label %105

29:                                               ; preds = %20
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = call i32 @getc(ptr noundef %30)
  store i32 %31, ptr %13, align 4, !tbaa !9
  %32 = load ptr, ptr %5, align 8, !tbaa !5
  %33 = call i32 @feof(ptr noundef %32) #4
  %34 = icmp ne i32 %33, 0
  br i1 %34, label %35, label %39

35:                                               ; preds = %29
  %36 = getelementptr inbounds %"class.sptk::reaper::FdFilter", ptr %16, i32 0, i32 11
  %37 = load i32, ptr %36, align 8, !tbaa !14
  %38 = or i32 %37, 2
  store i32 %38, ptr %36, align 8, !tbaa !14
  br label %43

39:                                               ; preds = %29
  %40 = load i32, ptr %13, align 4, !tbaa !9
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = call i32 @ungetc(i32 noundef %40, ptr noundef %41)
  br label %43

43:                                               ; preds = %39, %35
  %44 = getelementptr inbounds %"class.sptk::reaper::FdFilter", ptr %16, i32 0, i32 21
  %45 = load i32, ptr %44, align 8, !tbaa !16
  %46 = icmp sgt i32 %45, 1
  br i1 %46, label %47, label %86

47:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %48 = getelementptr inbounds %"class.sptk::reaper::FdFilter", ptr %16, i32 0, i32 1
  %49 = load ptr, ptr %48, align 8, !tbaa !15
  %50 = load i32, ptr %11, align 4, !tbaa !9
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds i16, ptr %49, i64 %51
  %53 = getelementptr inbounds i16, ptr %52, i64 -1
  store ptr %53, ptr %14, align 8, !tbaa !5
  %54 = getelementptr inbounds %"class.sptk::reaper::FdFilter", ptr %16, i32 0, i32 1
  %55 = load ptr, ptr %54, align 8, !tbaa !15
  %56 = load i32, ptr %11, align 4, !tbaa !9
  %57 = getelementptr inbounds %"class.sptk::reaper::FdFilter", ptr %16, i32 0, i32 21
  %58 = load i32, ptr %57, align 8, !tbaa !16
  %59 = mul nsw i32 %56, %58
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds i16, ptr %55, i64 %60
  %62 = getelementptr inbounds i16, ptr %61, i64 -1
  store ptr %62, ptr %15, align 8, !tbaa !5
  %63 = load i32, ptr %11, align 4, !tbaa !9
  store i32 %63, ptr %7, align 4, !tbaa !9
  br label %64

64:                                               ; preds = %79, %47
  %65 = load i32, ptr %7, align 4, !tbaa !9
  %66 = add nsw i32 %65, -1
  store i32 %66, ptr %7, align 4, !tbaa !9
  %67 = icmp ne i32 %65, 0
  br i1 %67, label %68, label %85

68:                                               ; preds = %64
  %69 = getelementptr inbounds %"class.sptk::reaper::FdFilter", ptr %16, i32 0, i32 21
  %70 = load i32, ptr %69, align 8, !tbaa !16
  %71 = sub nsw i32 %70, 1
  store i32 %71, ptr %8, align 4, !tbaa !9
  br label %72

72:                                               ; preds = %76, %68
  %73 = load i32, ptr %8, align 4, !tbaa !9
  %74 = add nsw i32 %73, -1
  store i32 %74, ptr %8, align 4, !tbaa !9
  %75 = icmp ne i32 %73, 0
  br i1 %75, label %76, label %79

76:                                               ; preds = %72
  %77 = load ptr, ptr %15, align 8, !tbaa !5
  %78 = getelementptr inbounds i16, ptr %77, i32 -1
  store ptr %78, ptr %15, align 8, !tbaa !5
  store i16 0, ptr %77, align 2, !tbaa !17
  br label %72, !llvm.loop !19

79:                                               ; preds = %72
  %80 = load ptr, ptr %14, align 8, !tbaa !5
  %81 = getelementptr inbounds i16, ptr %80, i32 -1
  store ptr %81, ptr %14, align 8, !tbaa !5
  %82 = load i16, ptr %80, align 2, !tbaa !17
  %83 = load ptr, ptr %15, align 8, !tbaa !5
  %84 = getelementptr inbounds i16, ptr %83, i32 -1
  store ptr %84, ptr %15, align 8, !tbaa !5
  store i16 %82, ptr %83, align 2, !tbaa !17
  br label %64, !llvm.loop !21

85:                                               ; preds = %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  br label %86

86:                                               ; preds = %85, %43
  %87 = load i32, ptr %11, align 4, !tbaa !9
  %88 = getelementptr inbounds %"class.sptk::reaper::FdFilter", ptr %16, i32 0, i32 21
  %89 = load i32, ptr %88, align 8, !tbaa !16
  %90 = mul nsw i32 %87, %89
  call void @_ZN4sptk6reaper8FdFilter12FilterBufferEiPi(ptr noundef nonnull align 8 dereferenceable(144) %16, i32 noundef %90, ptr noundef %10)
  %91 = getelementptr inbounds %"class.sptk::reaper::FdFilter", ptr %16, i32 0, i32 0
  %92 = load ptr, ptr %91, align 8, !tbaa !22
  %93 = load i32, ptr %10, align 4, !tbaa !9
  %94 = sext i32 %93 to i64
  %95 = load ptr, ptr %6, align 8, !tbaa !5
  %96 = call i64 @fwrite(ptr noundef %92, i64 noundef 2, i64 noundef %94, ptr noundef %95)
  %97 = trunc i64 %96 to i32
  store i32 %97, ptr %7, align 4, !tbaa !9
  %98 = load i32, ptr %10, align 4, !tbaa !9
  %99 = icmp slt i32 %97, %98
  br i1 %99, label %100, label %103

100:                                              ; preds = %86
  %101 = load ptr, ptr @stderr, align 8, !tbaa !5
  %102 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %101, ptr noundef @.str.10) #4
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %103

103:                                              ; preds = %100, %86
  %104 = getelementptr inbounds %"class.sptk::reaper::FdFilter", ptr %16, i32 0, i32 11
  store i32 0, ptr %104, align 8, !tbaa !14
  br label %20, !llvm.loop !23

105:                                              ; preds = %20
  %106 = load i32, ptr %12, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  ret i32 %106
}

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #3

declare i32 @getc(ptr noundef) #3

; Function Attrs: nounwind
declare i32 @feof(ptr noundef) #1

declare i32 @ungetc(i32 noundef, ptr noundef) #3

declare i64 @fwrite(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #3

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind "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}
!11 = !{!12, !10, i64 128}
!12 = !{!"_ZTSN4sptk6reaper8FdFilterE", !6, i64 0, !6, i64 8, !6, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !13, i64 60, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !10, i64 112, !10, i64 116, !10, i64 120, !10, i64 124, !10, i64 128, !6, i64 136}
!13 = !{!"float", !7, i64 0}
!14 = !{!12, !10, i64 56}
!15 = !{!12, !6, i64 8}
!16 = !{!12, !10, i64 120}
!17 = !{!18, !18, i64 0}
!18 = !{!"short", !7, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}
!22 = !{!12, !6, i64 0}
!23 = distinct !{!23, !20}


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

@stderr = external local_unnamed_addr global ptr, align 8
@.str.10 = external hidden unnamed_addr constant [41 x i8], align 1

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

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef range(i32 0, 2) i32 @_ZN4sptk6reaper8FdFilter12FilterStreamEP8_IO_FILES3_(ptr noundef nonnull align 8 dereferenceable(144) %0, ptr nocapture noundef %1, ptr nocapture noundef %2) local_unnamed_addr #2 align 2 {
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  %5 = getelementptr inbounds i8, ptr %0, i64 128
  %6 = load i32, ptr %5, align 8, !tbaa !5
  %7 = getelementptr inbounds i8, ptr %0, i64 56
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  %9 = sext i32 %6 to i64
  store i32 1, ptr %7, align 8, !tbaa !12
  %10 = load ptr, ptr %8, align 8, !tbaa !13
  %11 = tail call i64 @fread(ptr noundef %10, i64 noundef 2, i64 noundef %9, ptr noundef %1)
  %12 = trunc i64 %11 to i32
  %.not36 = icmp eq i32 %12, 0
  br i1 %.not36, label %._crit_edge39, label %.lr.ph

.lr.ph:                                           ; preds = %3
  %13 = getelementptr inbounds i8, ptr %0, i64 120
  br label %14

14:                                               ; preds = %.lr.ph, %56
  %15 = phi i32 [ %12, %.lr.ph ], [ %59, %56 ]
  %16 = phi i64 [ %11, %.lr.ph ], [ %58, %56 ]
  %.01937 = phi i32 [ 1, %.lr.ph ], [ %.120, %56 ]
  %17 = call i32 @getc(ptr noundef %1)
  %18 = call i32 @feof(ptr noundef %1) #4
  %.not24 = icmp eq i32 %18, 0
  br i1 %.not24, label %22, label %19

19:                                               ; preds = %14
  %20 = load i32, ptr %7, align 8, !tbaa !12
  %21 = or i32 %20, 2
  store i32 %21, ptr %7, align 8, !tbaa !12
  br label %24

22:                                               ; preds = %14
  %23 = call i32 @ungetc(i32 noundef %17, ptr noundef %1)
  br label %24

24:                                               ; preds = %22, %19
  %25 = load i32, ptr %13, align 8, !tbaa !14
  %26 = icmp sgt i32 %25, 1
  br i1 %26, label %.preheader.preheader, label %..loopexit_crit_edge

..loopexit_crit_edge:                             ; preds = %24
  %.pre = mul nsw i32 %25, %15
  br label %.loopexit

.preheader.preheader:                             ; preds = %24
  %27 = load ptr, ptr %8, align 8, !tbaa !13
  %sext = shl i64 %16, 32
  %28 = ashr exact i64 %sext, 31
  %29 = getelementptr inbounds i8, ptr %27, i64 %28
  %30 = mul nsw i32 %25, %15
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds i16, ptr %27, i64 %31
  %.02129 = add nsw i32 %25, -1
  %33 = add nsw i32 %25, -2
  %34 = zext nneg i32 %33 to i64
  %35 = mul nsw i64 %34, -2
  %36 = zext nneg i32 %.02129 to i64
  %37 = shl nuw nsw i64 %36, 1
  %xtraiter = and i32 %15, 3
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader.prol.loopexit, label %.preheader.prol

.preheader.prol:                                  ; preds = %.preheader.preheader, %.preheader.prol
  %.in.prol = phi i32 [ %38, %.preheader.prol ], [ %15, %.preheader.preheader ]
  %.01735.pn.prol = phi ptr [ %.01735.prol, %.preheader.prol ], [ %29, %.preheader.preheader ]
  %.pn2734.prol = phi ptr [ %scevgep43.prol, %.preheader.prol ], [ %32, %.preheader.preheader ]
  %prol.iter = phi i32 [ %prol.iter.next, %.preheader.prol ], [ 0, %.preheader.preheader ]
  %.01735.prol = getelementptr inbounds i8, ptr %.01735.pn.prol, i64 -2
  %38 = add nsw i32 %.in.prol, -1
  %.128.prol = getelementptr inbounds i8, ptr %.pn2734.prol, i64 -2
  %scevgep.prol = getelementptr i8, ptr %.128.prol, i64 %35
  call void @llvm.memset.p0.i64(ptr align 2 %scevgep.prol, i8 0, i64 %37, i1 false), !tbaa !15
  %scevgep42.prol = getelementptr i8, ptr %.pn2734.prol, i64 -4
  %scevgep43.prol = getelementptr i8, ptr %scevgep42.prol, i64 %35
  %39 = load i16, ptr %.01735.prol, align 2, !tbaa !15
  store i16 %39, ptr %scevgep43.prol, align 2, !tbaa !15
  %prol.iter.next = add i32 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i32 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %.preheader.prol.loopexit, label %.preheader.prol, !llvm.loop !17

.preheader.prol.loopexit:                         ; preds = %.preheader.prol, %.preheader.preheader
  %.in.unr = phi i32 [ %15, %.preheader.preheader ], [ %38, %.preheader.prol ]
  %.01735.pn.unr = phi ptr [ %29, %.preheader.preheader ], [ %.01735.prol, %.preheader.prol ]
  %.pn2734.unr = phi ptr [ %32, %.preheader.preheader ], [ %scevgep43.prol, %.preheader.prol ]
  %40 = icmp ult i32 %15, 4
  br i1 %40, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %.preheader.prol.loopexit, %.preheader
  %.in = phi i32 [ %44, %.preheader ], [ %.in.unr, %.preheader.prol.loopexit ]
  %.01735.pn = phi ptr [ %.01735.3, %.preheader ], [ %.01735.pn.unr, %.preheader.prol.loopexit ]
  %.pn2734 = phi ptr [ %scevgep43.3, %.preheader ], [ %.pn2734.unr, %.preheader.prol.loopexit ]
  %.01735 = getelementptr inbounds i8, ptr %.01735.pn, i64 -2
  %.128 = getelementptr inbounds i8, ptr %.pn2734, i64 -2
  %scevgep = getelementptr i8, ptr %.128, i64 %35
  call void @llvm.memset.p0.i64(ptr align 2 %scevgep, i8 0, i64 %37, i1 false), !tbaa !15
  %scevgep42 = getelementptr i8, ptr %.pn2734, i64 -4
  %scevgep43 = getelementptr i8, ptr %scevgep42, i64 %35
  %41 = load i16, ptr %.01735, align 2, !tbaa !15
  store i16 %41, ptr %scevgep43, align 2, !tbaa !15
  %.01735.1 = getelementptr inbounds i8, ptr %.01735.pn, i64 -4
  %.128.1 = getelementptr inbounds i8, ptr %scevgep43, i64 -2
  %scevgep.1 = getelementptr i8, ptr %.128.1, i64 %35
  call void @llvm.memset.p0.i64(ptr align 2 %scevgep.1, i8 0, i64 %37, i1 false), !tbaa !15
  %scevgep42.1 = getelementptr i8, ptr %scevgep43, i64 -4
  %scevgep43.1 = getelementptr i8, ptr %scevgep42.1, i64 %35
  %42 = load i16, ptr %.01735.1, align 2, !tbaa !15
  store i16 %42, ptr %scevgep43.1, align 2, !tbaa !15
  %.01735.2 = getelementptr inbounds i8, ptr %.01735.pn, i64 -6
  %.128.2 = getelementptr inbounds i8, ptr %scevgep43.1, i64 -2
  %scevgep.2 = getelementptr i8, ptr %.128.2, i64 %35
  call void @llvm.memset.p0.i64(ptr align 2 %scevgep.2, i8 0, i64 %37, i1 false), !tbaa !15
  %scevgep42.2 = getelementptr i8, ptr %scevgep43.1, i64 -4
  %scevgep43.2 = getelementptr i8, ptr %scevgep42.2, i64 %35
  %43 = load i16, ptr %.01735.2, align 2, !tbaa !15
  store i16 %43, ptr %scevgep43.2, align 2, !tbaa !15
  %.01735.3 = getelementptr inbounds i8, ptr %.01735.pn, i64 -8
  %44 = add nsw i32 %.in, -4
  %.128.3 = getelementptr inbounds i8, ptr %scevgep43.2, i64 -2
  %scevgep.3 = getelementptr i8, ptr %.128.3, i64 %35
  call void @llvm.memset.p0.i64(ptr align 2 %scevgep.3, i8 0, i64 %37, i1 false), !tbaa !15
  %scevgep42.3 = getelementptr i8, ptr %scevgep43.2, i64 -4
  %scevgep43.3 = getelementptr i8, ptr %scevgep42.3, i64 %35
  %45 = load i16, ptr %.01735.3, align 2, !tbaa !15
  store i16 %45, ptr %scevgep43.3, align 2, !tbaa !15
  %.not25.3 = icmp eq i32 %44, 0
  br i1 %.not25.3, label %.loopexit, label %.preheader, !llvm.loop !19

.loopexit:                                        ; preds = %.preheader.prol.loopexit, %.preheader, %..loopexit_crit_edge
  %.pre-phi = phi i32 [ %.pre, %..loopexit_crit_edge ], [ %30, %.preheader ], [ %30, %.preheader.prol.loopexit ]
  call void @_ZN4sptk6reaper8FdFilter12FilterBufferEiPi(ptr noundef nonnull align 8 dereferenceable(144) %0, i32 noundef %.pre-phi, ptr noundef nonnull %4)
  %46 = load ptr, ptr %0, align 8, !tbaa !21
  %47 = load i32, ptr %4, align 4, !tbaa !22
  %48 = sext i32 %47 to i64
  %49 = call i64 @fwrite(ptr noundef %46, i64 noundef 2, i64 noundef %48, ptr noundef %2)
  %50 = trunc i64 %49 to i32
  %51 = load i32, ptr %4, align 4, !tbaa !22
  %52 = icmp sgt i32 %51, %50
  br i1 %52, label %53, label %56

53:                                               ; preds = %.loopexit
  %54 = load ptr, ptr @stderr, align 8, !tbaa !23
  %55 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %54, ptr noundef nonnull @.str.10) #5
  br label %56

56:                                               ; preds = %53, %.loopexit
  %.120 = phi i32 [ 0, %53 ], [ %.01937, %.loopexit ]
  store i32 0, ptr %7, align 8, !tbaa !12
  %57 = load ptr, ptr %8, align 8, !tbaa !13
  %58 = call i64 @fread(ptr noundef %57, i64 noundef 2, i64 noundef %9, ptr noundef %1)
  %59 = trunc i64 %58 to i32
  %.not = icmp eq i32 %59, 0
  br i1 %.not, label %._crit_edge39, label %14, !llvm.loop !24

._crit_edge39:                                    ; preds = %56, %3
  %.019.lcssa = phi i32 [ 1, %3 ], [ %.120, %56 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  ret i32 %.019.lcssa
}

; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @getc(ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @feof(ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @ungetc(i32 noundef, ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i64 @fwrite(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nofree nounwind "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { nounwind }
attributes #5 = { cold 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, !10, i64 128}
!6 = !{!"_ZTSN4sptk6reaper8FdFilterE", !7, i64 0, !7, i64 8, !7, i64 16, !10, i64 24, !10, i64 28, !10, i64 32, !10, i64 36, !10, i64 40, !10, i64 44, !10, i64 48, !10, i64 52, !10, i64 56, !11, i64 60, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !10, i64 112, !10, i64 116, !10, i64 120, !10, i64 124, !10, i64 128, !7, i64 136}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"float", !8, i64 0}
!12 = !{!6, !10, i64 56}
!13 = !{!6, !7, i64 8}
!14 = !{!6, !10, i64 120}
!15 = !{!16, !16, i64 0}
!16 = !{!"short", !8, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.unroll.disable"}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!6, !7, i64 0}
!22 = !{!10, !10, i64 0}
!23 = !{!7, !7, i64 0}
!24 = distinct !{!24, !20}


; Effective O3 passes: ADCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass