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

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

@liquid_autotest_verbose = external global i32, align 4
@.str = external hidden unnamed_addr constant [18 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [8 x i8], align 1

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

8:                                                ; preds = %68, %0
  %9 = load i32, ptr %3, align 4, !tbaa !5
  %10 = load i32, ptr %2, align 4, !tbaa !5
  %11 = icmp ult i32 %9, %10
  br i1 %11, label %12, label %71

12:                                               ; preds = %8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %13 = call i32 @rand() #4
  %14 = load i32, ptr %1, align 4, !tbaa !5
  %15 = shl i32 1, %14
  %16 = srem i32 %13, %15
  store i32 %16, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %17 = load i32, ptr %4, align 4, !tbaa !5
  %18 = call i32 @fec_hamming128_encode_symbol(i32 noundef %17)
  store i32 %18, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %19 = load i32, ptr %5, align 4, !tbaa !5
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = load i32, ptr %3, align 4, !tbaa !5
  %22 = sub i32 %20, %21
  %23 = sub i32 %22, 1
  %24 = shl i32 1, %23
  %25 = xor i32 %19, %24
  store i32 %25, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %26 = load i32, ptr %6, align 4, !tbaa !5
  %27 = call i32 @fec_hamming128_decode_symbol(i32 noundef %26)
  store i32 %27, ptr %7, align 4, !tbaa !5
  %28 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %29 = icmp ne i32 %28, 0
  br i1 %29, label %30, label %57

30:                                               ; preds = %12
  %31 = load i32, ptr %3, align 4, !tbaa !5
  %32 = call i32 (ptr, ...) @printf(ptr noundef @.str, i32 noundef %31)
  %33 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  %34 = load i32, ptr %4, align 4, !tbaa !5
  %35 = load i32, ptr %1, align 4, !tbaa !5
  %36 = call i32 @liquid_print_bitstring(i32 noundef %34, i32 noundef %35)
  %37 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  %38 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  %39 = load i32, ptr %5, align 4, !tbaa !5
  %40 = load i32, ptr %2, align 4, !tbaa !5
  %41 = call i32 @liquid_print_bitstring(i32 noundef %39, i32 noundef %40)
  %42 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  %43 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  %44 = load i32, ptr %6, align 4, !tbaa !5
  %45 = load i32, ptr %2, align 4, !tbaa !5
  %46 = call i32 @liquid_print_bitstring(i32 noundef %44, i32 noundef %45)
  %47 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  %48 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  %49 = load i32, ptr %7, align 4, !tbaa !5
  %50 = load i32, ptr %1, align 4, !tbaa !5
  %51 = call i32 @liquid_print_bitstring(i32 noundef %49, i32 noundef %50)
  %52 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  %53 = load i32, ptr %4, align 4, !tbaa !5
  %54 = load i32, ptr %7, align 4, !tbaa !5
  %55 = call i32 @count_bit_errors(i32 noundef %53, i32 noundef %54)
  %56 = call i32 (ptr, ...) @printf(ptr noundef @.str.6, i32 noundef %55)
  br label %57

57:                                               ; preds = %30, %12
  %58 = load i32, ptr %4, align 4, !tbaa !5
  %59 = load i32, ptr %7, align 4, !tbaa !5
  %60 = icmp ne i32 %58, %59
  br i1 %60, label %61, label %66

61:                                               ; preds = %57
  %62 = load i32, ptr %4, align 4, !tbaa !5
  %63 = uitofp i32 %62 to double
  %64 = load i32, ptr %7, align 4, !tbaa !5
  %65 = uitofp i32 %64 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str.7, i32 noundef 64, ptr noundef @.str.8, double noundef %63, ptr noundef @.str.9, ptr noundef @.str.10, double noundef %65)
  br label %67

66:                                               ; preds = %57
  call void (...) @liquid_autotest_passed()
  br label %67

67:                                               ; preds = %66, %61
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %68

68:                                               ; preds = %67
  %69 = load i32, ptr %3, align 4, !tbaa !5
  %70 = add i32 %69, 1
  store i32 %70, ptr %3, align 4, !tbaa !5
  br label %8, !llvm.loop !9

71:                                               ; preds = %8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  ret void
}

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

; Function Attrs: nounwind
declare i32 @rand() #2

declare i32 @fec_hamming128_encode_symbol(i32 noundef) #3

declare i32 @fec_hamming128_decode_symbol(i32 noundef) #3

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

declare i32 @liquid_print_bitstring(i32 noundef, i32 noundef) #3

declare i32 @count_bit_errors(i32 noundef, i32 noundef) #3

declare void @liquid_autotest_failed_expr(ptr noundef, i32 noundef, ptr noundef, double noundef, ptr noundef, ptr noundef, double noundef) #3

declare void @liquid_autotest_passed(...) #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 = { 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"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"

@liquid_autotest_verbose = external local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [18 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [94 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @autotest_hamming128_codec() local_unnamed_addr #0 {
  br label %1

1:                                                ; preds = %0, %31
  %.027 = phi i32 [ 0, %0 ], [ %32, %31 ]
  %2 = tail call i32 @rand() #4
  %3 = srem i32 %2, 256
  %4 = tail call i32 @fec_hamming128_encode_symbol(i32 noundef %3) #4
  %5 = sub nuw nsw i32 11, %.027
  %6 = shl nuw nsw i32 1, %5
  %7 = xor i32 %4, %6
  %8 = tail call i32 @fec_hamming128_decode_symbol(i32 noundef %7) #4
  %9 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %.not = icmp eq i32 %9, 0
  br i1 %.not, label %26, label %10

10:                                               ; preds = %1
  %11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, i32 noundef %.027)
  %12 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  %13 = tail call i32 @liquid_print_bitstring(i32 noundef %3, i32 noundef 8) #4
  %14 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %15 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  %16 = tail call i32 @liquid_print_bitstring(i32 noundef %4, i32 noundef 12) #4
  %17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  %19 = tail call i32 @liquid_print_bitstring(i32 noundef %7, i32 noundef 12) #4
  %20 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %21 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  %22 = tail call i32 @liquid_print_bitstring(i32 noundef %8, i32 noundef 8) #4
  %23 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %24 = tail call i32 @count_bit_errors(i32 noundef %3, i32 noundef %8) #4
  %25 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6, i32 noundef %24)
  br label %26

26:                                               ; preds = %10, %1
  %.not26 = icmp eq i32 %3, %8
  br i1 %.not26, label %30, label %27

27:                                               ; preds = %26
  %28 = uitofp i32 %3 to double
  %29 = uitofp i32 %8 to double
  tail call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str.7, i32 noundef 64, ptr noundef nonnull @.str.8, double noundef %28, ptr noundef nonnull @.str.9, ptr noundef nonnull @.str.10, double noundef %29) #4
  br label %31

30:                                               ; preds = %26
  tail call void (...) @liquid_autotest_passed() #4
  br label %31

31:                                               ; preds = %30, %27
  %32 = add nuw nsw i32 %.027, 1
  %exitcond.not = icmp eq i32 %32, 12
  br i1 %exitcond.not, label %33, label %1, !llvm.loop !9

33:                                               ; preds = %31
  ret void
}

; Function Attrs: nounwind
declare i32 @rand() local_unnamed_addr #1

declare i32 @fec_hamming128_encode_symbol(i32 noundef) local_unnamed_addr #2

declare i32 @fec_hamming128_decode_symbol(i32 noundef) local_unnamed_addr #2

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

declare i32 @liquid_print_bitstring(i32 noundef, i32 noundef) local_unnamed_addr #2

declare i32 @count_bit_errors(i32 noundef, i32 noundef) local_unnamed_addr #2

declare void @liquid_autotest_failed_expr(ptr noundef, i32 noundef, ptr noundef, double noundef, ptr noundef, ptr noundef, double noundef) local_unnamed_addr #2

declare void @liquid_autotest_passed(...) 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 = { 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 = { "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 = { 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 #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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,SROAPass,SimplifyCFGPass,TailCallElimPass