; LLVM IR from jgaeddert/liquid-dsp :: src/fec/tests (fec_golay2412_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"

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

; Function Attrs: nounwind uwtable
declare dso_local i32 @golay2412_generate_error_vector(i32 noundef) #0

; 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

; 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 @autotest_golay2412_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
  %8 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  store i32 50, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %9

9:                                                ; preds = %43, %0
  %10 = load i32, ptr %2, align 4, !tbaa !5
  %11 = icmp ule i32 %10, 3
  br i1 %11, label %12, label %46

12:                                               ; preds = %9
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %13

13:                                               ; preds = %39, %12
  %14 = load i32, ptr %3, align 4, !tbaa !5
  %15 = load i32, ptr %1, align 4, !tbaa !5
  %16 = icmp ult i32 %14, %15
  br i1 %16, label %17, label %42

17:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %18 = call i32 @rand() #4
  %19 = srem i32 %18, 4096
  store i32 %19, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = call i32 @fec_golay2412_encode_symbol(i32 noundef %20)
  store i32 %21, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = call i32 @golay2412_generate_error_vector(i32 noundef %22)
  store i32 %23, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  %24 = load i32, ptr %5, align 4, !tbaa !5
  %25 = load i32, ptr %6, align 4, !tbaa !5
  %26 = xor i32 %24, %25
  store i32 %26, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %27 = load i32, ptr %7, align 4, !tbaa !5
  %28 = call i32 @fec_golay2412_decode_symbol(i32 noundef %27)
  store i32 %28, ptr %8, align 4, !tbaa !5
  %29 = load i32, ptr %4, align 4, !tbaa !5
  %30 = load i32, ptr %8, align 4, !tbaa !5
  %31 = icmp ne i32 %29, %30
  br i1 %31, label %32, label %37

32:                                               ; preds = %17
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = uitofp i32 %33 to double
  %35 = load i32, ptr %8, align 4, !tbaa !5
  %36 = uitofp i32 %35 to double
  call void @liquid_autotest_failed_expr(ptr noundef @.str, i32 noundef 103, ptr noundef @.str.2, double noundef %34, ptr noundef @.str.3, ptr noundef @.str.4, double noundef %36)
  br label %38

37:                                               ; preds = %17
  call void (...) @liquid_autotest_passed()
  br label %38

38:                                               ; preds = %37, %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  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 %39

39:                                               ; preds = %38
  %40 = load i32, ptr %3, align 4, !tbaa !5
  %41 = add i32 %40, 1
  store i32 %41, ptr %3, align 4, !tbaa !5
  br label %13, !llvm.loop !9

42:                                               ; preds = %13
  br label %43

43:                                               ; preds = %42
  %44 = load i32, ptr %2, align 4, !tbaa !5
  %45 = add i32 %44, 1
  store i32 %45, ptr %2, align 4, !tbaa !5
  br label %9, !llvm.loop !11

46:                                               ; preds = %9
  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
}

declare i32 @fec_golay2412_encode_symbol(i32 noundef) #3

declare i32 @fec_golay2412_decode_symbol(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

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"}
!11 = distinct !{!11, !10}


; 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 = external hidden unnamed_addr constant [93 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [8 x i8], align 1

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

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

; Function Attrs: nounwind uwtable
define dso_local void @autotest_golay2412_codec() local_unnamed_addr #0 {
.preheader:
  br label %0

0:                                                ; preds = %.preheader, %11
  %.01417 = phi i32 [ 0, %.preheader ], [ %12, %11 ]
  %1 = tail call i32 @rand() #3
  %2 = srem i32 %1, 4096
  %3 = tail call i32 @fec_golay2412_encode_symbol(i32 noundef %2) #3
  %4 = tail call i32 @golay2412_generate_error_vector(i32 noundef 0)
  %5 = xor i32 %4, %3
  %6 = tail call i32 @fec_golay2412_decode_symbol(i32 noundef %5) #3
  %.not = icmp eq i32 %2, %6
  br i1 %.not, label %10, label %7

7:                                                ; preds = %0
  %8 = uitofp i32 %2 to double
  %9 = uitofp i32 %6 to double
  tail call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 103, ptr noundef nonnull @.str.2, double noundef %8, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, double noundef %9) #3
  br label %11

10:                                               ; preds = %0
  tail call void (...) @liquid_autotest_passed() #3
  br label %11

11:                                               ; preds = %10, %7
  %12 = add nuw nsw i32 %.01417, 1
  %exitcond.not = icmp eq i32 %12, 50
  br i1 %exitcond.not, label %.preheader.1, label %0, !llvm.loop !5

.preheader.1:                                     ; preds = %11, %23
  %.01417.1 = phi i32 [ %24, %23 ], [ 0, %11 ]
  %13 = tail call i32 @rand() #3
  %14 = srem i32 %13, 4096
  %15 = tail call i32 @fec_golay2412_encode_symbol(i32 noundef %14) #3
  %16 = tail call i32 @golay2412_generate_error_vector(i32 noundef 1)
  %17 = xor i32 %16, %15
  %18 = tail call i32 @fec_golay2412_decode_symbol(i32 noundef %17) #3
  %.not.1 = icmp eq i32 %14, %18
  br i1 %.not.1, label %22, label %19

19:                                               ; preds = %.preheader.1
  %20 = uitofp i32 %14 to double
  %21 = uitofp i32 %18 to double
  tail call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 103, ptr noundef nonnull @.str.2, double noundef %20, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, double noundef %21) #3
  br label %23

22:                                               ; preds = %.preheader.1
  tail call void (...) @liquid_autotest_passed() #3
  br label %23

23:                                               ; preds = %22, %19
  %24 = add nuw nsw i32 %.01417.1, 1
  %exitcond.1.not = icmp eq i32 %24, 50
  br i1 %exitcond.1.not, label %.preheader.2, label %.preheader.1, !llvm.loop !5

.preheader.2:                                     ; preds = %23, %35
  %.01417.2 = phi i32 [ %36, %35 ], [ 0, %23 ]
  %25 = tail call i32 @rand() #3
  %26 = srem i32 %25, 4096
  %27 = tail call i32 @fec_golay2412_encode_symbol(i32 noundef %26) #3
  %28 = tail call i32 @golay2412_generate_error_vector(i32 noundef 2)
  %29 = xor i32 %28, %27
  %30 = tail call i32 @fec_golay2412_decode_symbol(i32 noundef %29) #3
  %.not.2 = icmp eq i32 %26, %30
  br i1 %.not.2, label %34, label %31

31:                                               ; preds = %.preheader.2
  %32 = uitofp i32 %26 to double
  %33 = uitofp i32 %30 to double
  tail call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 103, ptr noundef nonnull @.str.2, double noundef %32, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, double noundef %33) #3
  br label %35

34:                                               ; preds = %.preheader.2
  tail call void (...) @liquid_autotest_passed() #3
  br label %35

35:                                               ; preds = %34, %31
  %36 = add nuw nsw i32 %.01417.2, 1
  %exitcond.2.not = icmp eq i32 %36, 50
  br i1 %exitcond.2.not, label %.preheader.3, label %.preheader.2, !llvm.loop !5

.preheader.3:                                     ; preds = %35, %47
  %.01417.3 = phi i32 [ %48, %47 ], [ 0, %35 ]
  %37 = tail call i32 @rand() #3
  %38 = srem i32 %37, 4096
  %39 = tail call i32 @fec_golay2412_encode_symbol(i32 noundef %38) #3
  %40 = tail call i32 @golay2412_generate_error_vector(i32 noundef 3)
  %41 = xor i32 %40, %39
  %42 = tail call i32 @fec_golay2412_decode_symbol(i32 noundef %41) #3
  %.not.3 = icmp eq i32 %38, %42
  br i1 %.not.3, label %46, label %43

43:                                               ; preds = %.preheader.3
  %44 = uitofp i32 %38 to double
  %45 = uitofp i32 %42 to double
  tail call void @liquid_autotest_failed_expr(ptr noundef nonnull @.str, i32 noundef 103, ptr noundef nonnull @.str.2, double noundef %44, ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.4, double noundef %45) #3
  br label %47

46:                                               ; preds = %.preheader.3
  tail call void (...) @liquid_autotest_passed() #3
  br label %47

47:                                               ; preds = %46, %43
  %48 = add nuw nsw i32 %.01417.3, 1
  %exitcond.3.not = icmp eq i32 %48, 50
  br i1 %exitcond.3.not, label %49, label %.preheader.3, !llvm.loop !5

49:                                               ; preds = %47
  ret void
}

declare i32 @fec_golay2412_encode_symbol(i32 noundef) local_unnamed_addr #2

declare i32 @fec_golay2412_decode_symbol(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 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass