; LLVM IR from jgaeddert/liquid-dsp :: sandbox (fec_secded2216_test)

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

@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1

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

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

declare i32 @printf(ptr noundef, ...) #2

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

; Function Attrs: nounwind uwtable
define dso_local void @print_bitstring(ptr noundef %0, i8 noundef zeroext %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca i8, align 1
  %5 = alloca i32, align 4
  %6 = alloca %struct.div_t, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  store i8 %1, ptr %4, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %8 = load i8, ptr %4, align 1, !tbaa !9
  %9 = zext i8 %8 to i32
  %10 = call i64 @div(i32 noundef %9, i32 noundef 8) #5
  store i64 %10, ptr %6, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %11 = getelementptr inbounds %struct.div_t, ptr %6, i32 0, i32 0
  %12 = load i32, ptr %11, align 4, !tbaa !10
  %13 = getelementptr inbounds %struct.div_t, ptr %6, i32 0, i32 1
  %14 = load i32, ptr %13, align 4, !tbaa !13
  %15 = icmp ne i32 %14, 0
  %16 = zext i1 %15 to i64
  %17 = select i1 %15, i32 1, i32 0
  %18 = add nsw i32 %12, %17
  store i32 %18, ptr %7, align 4, !tbaa !14
  %19 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  %20 = getelementptr inbounds %struct.div_t, ptr %6, i32 0, i32 1
  %21 = load i32, ptr %20, align 4, !tbaa !13
  %22 = icmp eq i32 %21, 0
  br i1 %22, label %23, label %25

23:                                               ; preds = %2
  %24 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  br label %25

25:                                               ; preds = %23, %2
  store i32 0, ptr %5, align 4, !tbaa !14
  br label %26

26:                                               ; preds = %35, %25
  %27 = load i32, ptr %5, align 4, !tbaa !14
  %28 = getelementptr inbounds %struct.div_t, ptr %6, i32 0, i32 1
  %29 = load i32, ptr %28, align 4, !tbaa !13
  %30 = sub nsw i32 8, %29
  %31 = sub nsw i32 %30, 1
  %32 = icmp ult i32 %27, %31
  br i1 %32, label %33, label %38

33:                                               ; preds = %26
  %34 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  br label %35

35:                                               ; preds = %33
  %36 = load i32, ptr %5, align 4, !tbaa !14
  %37 = add i32 %36, 1
  store i32 %37, ptr %5, align 4, !tbaa !14
  br label %26, !llvm.loop !15

38:                                               ; preds = %26
  store i32 0, ptr %5, align 4, !tbaa !14
  br label %39

39:                                               ; preds = %67, %38
  %40 = load i32, ptr %5, align 4, !tbaa !14
  %41 = load i32, ptr %7, align 4, !tbaa !14
  %42 = icmp ult i32 %40, %41
  br i1 %42, label %43, label %70

43:                                               ; preds = %39
  %44 = load i32, ptr %5, align 4, !tbaa !14
  %45 = icmp eq i32 %44, 0
  br i1 %45, label %46, label %59

46:                                               ; preds = %43
  %47 = getelementptr inbounds %struct.div_t, ptr %6, i32 0, i32 1
  %48 = load i32, ptr %47, align 4, !tbaa !13
  %49 = icmp ne i32 %48, 0
  br i1 %49, label %50, label %59

50:                                               ; preds = %46
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = load i32, ptr %5, align 4, !tbaa !14
  %53 = zext i32 %52 to i64
  %54 = getelementptr inbounds i8, ptr %51, i64 %53
  %55 = load i8, ptr %54, align 1, !tbaa !9
  %56 = getelementptr inbounds %struct.div_t, ptr %6, i32 0, i32 1
  %57 = load i32, ptr %56, align 4, !tbaa !13
  %58 = trunc i32 %57 to i8
  call void @print_bitstring_short(i8 noundef zeroext %55, i8 noundef zeroext %58)
  br label %65

59:                                               ; preds = %46, %43
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = load i32, ptr %5, align 4, !tbaa !14
  %62 = zext i32 %61 to i64
  %63 = getelementptr inbounds i8, ptr %60, i64 %62
  %64 = load i8, ptr %63, align 1, !tbaa !9
  call void @print_bitstring_short(i8 noundef zeroext %64, i8 noundef zeroext 8)
  br label %65

65:                                               ; preds = %59, %50
  %66 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  br label %67

67:                                               ; preds = %65
  %68 = load i32, ptr %5, align 4, !tbaa !14
  %69 = add i32 %68, 1
  store i32 %69, ptr %5, align 4, !tbaa !14
  br label %39, !llvm.loop !17

70:                                               ; preds = %39
  %71 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  ret void
}

; Function Attrs: nounwind willreturn memory(none)
declare i64 @div(i32 noundef, i32 noundef) #3

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" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
attributes #3 = { nounwind willreturn memory(none) "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 }
attributes #5 = { nounwind willreturn memory(none) }

!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/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !12, i64 0}
!11 = !{!"", !12, i64 0, !12, i64 4}
!12 = !{!"int", !7, i64 0}
!13 = !{!11, !12, i64 4}
!14 = !{!12, !12, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


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

@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
define dso_local void @print_bitstring(ptr nocapture noundef readonly %0, i8 noundef zeroext %1) local_unnamed_addr #0 {
  %3 = zext i8 %1 to i32
  %4 = tail call i64 @div(i32 noundef %3, i32 noundef 8) #3
  %.fr20 = freeze i64 %4
  %.sroa.0.0.extract.trunc = trunc i64 %.fr20 to i32
  %.sroa.4.0.extract.shift = lshr i64 %.fr20, 32
  %.sroa.4.0.extract.trunc = trunc nuw i64 %.sroa.4.0.extract.shift to i32
  %5 = icmp ugt i64 %.fr20, 4294967295
  %6 = zext i1 %5 to i32
  %7 = add i32 %6, %.sroa.0.0.extract.trunc
  %8 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  %9 = icmp ult i64 %.fr20, 4294967296
  br i1 %9, label %10, label %12

10:                                               ; preds = %2
  %11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %12

12:                                               ; preds = %10, %2
  %13 = sub i32 7, %.sroa.4.0.extract.trunc
  %.not = icmp eq i64 %.sroa.4.0.extract.shift, 7
  br i1 %.not, label %.preheader, label %.lr.ph

.preheader:                                       ; preds = %.lr.ph, %12
  %.not19 = icmp eq i32 %7, 0
  br i1 %.not19, label %._crit_edge, label %.lr.ph18

.lr.ph18:                                         ; preds = %.preheader
  %wide.trip.count27 = zext i32 %7 to i64
  br i1 %5, label %14, label %.lr.ph18.split.us

14:                                               ; preds = %.lr.ph18
  %15 = trunc i64 %.sroa.4.0.extract.shift to i8
  %16 = load i8, ptr %0, align 1, !tbaa !5
  tail call void @print_bitstring_short(i8 noundef zeroext %16, i8 noundef zeroext %15)
  %17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %exitcond28.peel.not = icmp eq i32 %7, 1
  br i1 %exitcond28.peel.not, label %._crit_edge, label %.lr.ph18.split.peel.next

.lr.ph18.split.us:                                ; preds = %.lr.ph18, %.lr.ph18.split.us
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph18.split.us ], [ 0, %.lr.ph18 ]
  %18 = getelementptr inbounds i8, ptr %0, i64 %indvars.iv
  %19 = load i8, ptr %18, align 1, !tbaa !5
  tail call void @print_bitstring_short(i8 noundef zeroext %19, i8 noundef zeroext 8)
  %20 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond23.not = icmp eq i64 %indvars.iv.next, %wide.trip.count27
  br i1 %exitcond23.not, label %._crit_edge, label %.lr.ph18.split.us, !llvm.loop !8

.lr.ph:                                           ; preds = %12, %.lr.ph
  %.016 = phi i32 [ %22, %.lr.ph ], [ 0, %12 ]
  %21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %22 = add nuw i32 %.016, 1
  %exitcond.not = icmp eq i32 %22, %13
  br i1 %exitcond.not, label %.preheader, label %.lr.ph, !llvm.loop !10

.lr.ph18.split.peel.next:                         ; preds = %14, %.lr.ph18.split.peel.next
  %indvars.iv24 = phi i64 [ %indvars.iv.next25, %.lr.ph18.split.peel.next ], [ 1, %14 ]
  %23 = getelementptr inbounds i8, ptr %0, i64 %indvars.iv24
  %24 = load i8, ptr %23, align 1, !tbaa !5
  tail call void @print_bitstring_short(i8 noundef zeroext %24, i8 noundef zeroext 8)
  %25 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %indvars.iv.next25 = add nuw nsw i64 %indvars.iv24, 1
  %exitcond28.not = icmp eq i64 %indvars.iv.next25, %wide.trip.count27
  br i1 %exitcond28.not, label %._crit_edge, label %.lr.ph18.split.peel.next, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph18.split.us, %.lr.ph18.split.peel.next, %14, %.preheader
  %26 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  ret void
}

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare i64 @div(i32 noundef, i32 noundef) local_unnamed_addr #2

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" }
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 nofree nosync nounwind willreturn memory(none) "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 willreturn memory(none) }

!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 = !{!"omnipotent char", !7, i64 0}
!7 = !{!"Simple C/C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = distinct !{!10, !9}
!11 = distinct !{!11, !9, !12}
!12 = !{!"llvm.loop.peeled.count", i32 1}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopFullUnrollPass,LoopInstSimplifyPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass