; LLVM IR from jgaeddert/liquid-dsp :: src/fec/src (crc)

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

@crc_scheme_str = external dso_local global [7 x [2 x ptr]], align 16
@.str.12 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @liquid_print_crc_schemes() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 10, ptr %2, align 4, !tbaa !5
  %3 = call i32 (ptr, ...) @printf(ptr noundef @.str.12)
  store i32 0, ptr %1, align 4, !tbaa !5
  br label %4

4:                                                ; preds = %37, %0
  %5 = load i32, ptr %1, align 4, !tbaa !5
  %6 = icmp ult i32 %5, 7
  br i1 %6, label %7, label %40

7:                                                ; preds = %4
  %8 = load i32, ptr %1, align 4, !tbaa !5
  %9 = zext i32 %8 to i64
  %10 = getelementptr inbounds [7 x [2 x ptr]], ptr @crc_scheme_str, i64 0, i64 %9
  %11 = getelementptr inbounds [2 x ptr], ptr %10, i64 0, i64 0
  %12 = load ptr, ptr %11, align 16, !tbaa !9
  %13 = call i32 (ptr, ...) @printf(ptr noundef @.str.13, ptr noundef %12)
  %14 = load i32, ptr %1, align 4, !tbaa !5
  %15 = icmp ne i32 %14, 6
  br i1 %15, label %16, label %18

16:                                               ; preds = %7
  %17 = call i32 (ptr, ...) @printf(ptr noundef @.str.14)
  br label %18

18:                                               ; preds = %16, %7
  %19 = load i32, ptr %1, align 4, !tbaa !5
  %20 = zext i32 %19 to i64
  %21 = getelementptr inbounds [7 x [2 x ptr]], ptr @crc_scheme_str, i64 0, i64 %20
  %22 = getelementptr inbounds [2 x ptr], ptr %21, i64 0, i64 0
  %23 = load ptr, ptr %22, align 16, !tbaa !9
  %24 = call i64 @strlen(ptr noundef %23) #5
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = zext i32 %25 to i64
  %27 = add i64 %26, %24
  %28 = trunc i64 %27 to i32
  store i32 %28, ptr %2, align 4, !tbaa !5
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = icmp ugt i32 %29, 48
  br i1 %30, label %31, label %36

31:                                               ; preds = %18
  %32 = load i32, ptr %1, align 4, !tbaa !5
  %33 = icmp ne i32 %32, 6
  br i1 %33, label %34, label %36

34:                                               ; preds = %31
  store i32 10, ptr %2, align 4, !tbaa !5
  %35 = call i32 (ptr, ...) @printf(ptr noundef @.str.15)
  br label %36

36:                                               ; preds = %34, %31, %18
  br label %37

37:                                               ; preds = %36
  %38 = load i32, ptr %1, align 4, !tbaa !5
  %39 = add i32 %38, 1
  store i32 %39, ptr %1, align 4, !tbaa !5
  br label %4, !llvm.loop !11

40:                                               ; preds = %4
  %41 = call i32 (ptr, ...) @printf(ptr noundef @.str.16)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  ret i32 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: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #3

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

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(read) "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(read) }

!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, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"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"

@crc_scheme_str = external dso_local local_unnamed_addr global [7 x [2 x ptr]], align 16
@.str.12 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: nofree nounwind uwtable
define dso_local noundef i32 @liquid_print_crc_schemes() local_unnamed_addr #0 {
  %1 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12)
  %2 = load ptr, ptr @crc_scheme_str, align 16, !tbaa !5
  %3 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13, ptr noundef %2)
  %4 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14)
  %5 = load ptr, ptr @crc_scheme_str, align 16, !tbaa !5
  %6 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %5) #3
  %7 = add i64 %6, 10
  %8 = trunc i64 %7 to i32
  %9 = icmp ugt i32 %8, 48
  br i1 %9, label %10, label %12

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

12:                                               ; preds = %0, %10
  %.1 = phi i64 [ 10, %10 ], [ %7, %0 ]
  %13 = load ptr, ptr getelementptr inbounds (i8, ptr @crc_scheme_str, i64 16), align 16, !tbaa !5
  %14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13, ptr noundef %13)
  %15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14)
  %16 = load ptr, ptr getelementptr inbounds (i8, ptr @crc_scheme_str, i64 16), align 16, !tbaa !5
  %17 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %16) #3
  %18 = add i64 %17, %.1
  %19 = trunc i64 %18 to i32
  %20 = icmp ugt i32 %19, 48
  br i1 %20, label %21, label %23

21:                                               ; preds = %12
  %22 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15)
  br label %23

23:                                               ; preds = %21, %12
  %.1.1 = phi i64 [ 10, %21 ], [ %18, %12 ]
  %24 = load ptr, ptr getelementptr inbounds (i8, ptr @crc_scheme_str, i64 32), align 16, !tbaa !5
  %25 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13, ptr noundef %24)
  %26 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14)
  %27 = load ptr, ptr getelementptr inbounds (i8, ptr @crc_scheme_str, i64 32), align 16, !tbaa !5
  %28 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %27) #3
  %29 = add i64 %28, %.1.1
  %30 = trunc i64 %29 to i32
  %31 = icmp ugt i32 %30, 48
  br i1 %31, label %32, label %34

32:                                               ; preds = %23
  %33 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15)
  br label %34

34:                                               ; preds = %32, %23
  %.1.2 = phi i64 [ 10, %32 ], [ %29, %23 ]
  %35 = load ptr, ptr getelementptr inbounds (i8, ptr @crc_scheme_str, i64 48), align 16, !tbaa !5
  %36 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13, ptr noundef %35)
  %37 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14)
  %38 = load ptr, ptr getelementptr inbounds (i8, ptr @crc_scheme_str, i64 48), align 16, !tbaa !5
  %39 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %38) #3
  %40 = add i64 %39, %.1.2
  %41 = trunc i64 %40 to i32
  %42 = icmp ugt i32 %41, 48
  br i1 %42, label %43, label %45

43:                                               ; preds = %34
  %44 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15)
  br label %45

45:                                               ; preds = %43, %34
  %.1.3 = phi i64 [ 10, %43 ], [ %40, %34 ]
  %46 = load ptr, ptr getelementptr inbounds (i8, ptr @crc_scheme_str, i64 64), align 16, !tbaa !5
  %47 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13, ptr noundef %46)
  %48 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14)
  %49 = load ptr, ptr getelementptr inbounds (i8, ptr @crc_scheme_str, i64 64), align 16, !tbaa !5
  %50 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %49) #3
  %51 = add i64 %50, %.1.3
  %52 = trunc i64 %51 to i32
  %53 = icmp ugt i32 %52, 48
  br i1 %53, label %54, label %56

54:                                               ; preds = %45
  %55 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15)
  br label %56

56:                                               ; preds = %54, %45
  %.1.4 = phi i64 [ 10, %54 ], [ %51, %45 ]
  %57 = load ptr, ptr getelementptr inbounds (i8, ptr @crc_scheme_str, i64 80), align 16, !tbaa !5
  %58 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13, ptr noundef %57)
  %59 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.14)
  %60 = load ptr, ptr getelementptr inbounds (i8, ptr @crc_scheme_str, i64 80), align 16, !tbaa !5
  %61 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %60) #3
  %62 = add i64 %61, %.1.4
  %63 = trunc i64 %62 to i32
  %64 = icmp ugt i32 %63, 48
  br i1 %64, label %65, label %67

65:                                               ; preds = %56
  %66 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.15)
  br label %67

67:                                               ; preds = %65, %56
  %68 = load ptr, ptr getelementptr inbounds (i8, ptr @crc_scheme_str, i64 96), align 16, !tbaa !5
  %69 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.13, ptr noundef %68)
  %70 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.16)
  ret i32 0
}

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #2

attributes #0 = { nofree 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 nounwind willreturn memory(argmem: read) "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(read) }

!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"}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,PostOrderFunctionAttrsPass,ReassociatePass,SCCPPass,SROAPass,SimplifyCFGPass,TailCallElimPass