; 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.1 = external hidden unnamed_addr constant [71 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @golay2412_generate_error_vector(i32 noundef %0) #0 {
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca [24 x i32], align 16
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  %8 = load i32, ptr %3, align 4, !tbaa !5
  %9 = icmp ugt i32 %8, 24
  br i1 %9, label %10, label %12

10:                                               ; preds = %1
  %11 = call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 1, ptr noundef @.str, i32 noundef 34, ptr noundef @.str.1)
  store i32 0, ptr %2, align 4
  br label %68

12:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 96, ptr %5) #4
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %13

13:                                               ; preds = %20, %12
  %14 = load i32, ptr %4, align 4, !tbaa !5
  %15 = icmp ult i32 %14, 24
  br i1 %15, label %16, label %23

16:                                               ; preds = %13
  %17 = load i32, ptr %4, align 4, !tbaa !5
  %18 = zext i32 %17 to i64
  %19 = getelementptr inbounds [24 x i32], ptr %5, i64 0, i64 %18
  store i32 0, ptr %19, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %16
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = add i32 %21, 1
  store i32 %22, ptr %4, align 4, !tbaa !5
  br label %13, !llvm.loop !9

23:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !5
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %24

24:                                               ; preds = %42, %23
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = load i32, ptr %3, align 4, !tbaa !5
  %27 = icmp ult i32 %25, %26
  br i1 %27, label %28, label %45

28:                                               ; preds = %24
  br label %29

29:                                               ; preds = %32, %28
  %30 = call i32 @rand() #4
  %31 = srem i32 %30, 24
  store i32 %31, ptr %6, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %29
  %33 = load i32, ptr %6, align 4, !tbaa !5
  %34 = zext i32 %33 to i64
  %35 = getelementptr inbounds [24 x i32], ptr %5, i64 0, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = icmp ne i32 %36, 0
  br i1 %37, label %29, label %38, !llvm.loop !11

38:                                               ; preds = %32
  %39 = load i32, ptr %6, align 4, !tbaa !5
  %40 = zext i32 %39 to i64
  %41 = getelementptr inbounds [24 x i32], ptr %5, i64 0, i64 %40
  store i32 1, ptr %41, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %38
  %43 = load i32, ptr %4, align 4, !tbaa !5
  %44 = add i32 %43, 1
  store i32 %44, ptr %4, align 4, !tbaa !5
  br label %24, !llvm.loop !12

45:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %63, %45
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = icmp ult i32 %47, 24
  br i1 %48, label %49, label %66

49:                                               ; preds = %46
  %50 = load i32, ptr %4, align 4, !tbaa !5
  %51 = zext i32 %50 to i64
  %52 = getelementptr inbounds [24 x i32], ptr %5, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = icmp ne i32 %53, 0
  br i1 %54, label %55, label %58

55:                                               ; preds = %49
  %56 = load i32, ptr %4, align 4, !tbaa !5
  %57 = shl i32 1, %56
  br label %59

58:                                               ; preds = %49
  br label %59

59:                                               ; preds = %58, %55
  %60 = phi i32 [ %57, %55 ], [ 0, %58 ]
  %61 = load i32, ptr %7, align 4, !tbaa !5
  %62 = or i32 %61, %60
  store i32 %62, ptr %7, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %59
  %64 = load i32, ptr %4, align 4, !tbaa !5
  %65 = add i32 %64, 1
  store i32 %65, ptr %4, align 4, !tbaa !5
  br label %46, !llvm.loop !13

66:                                               ; preds = %46
  %67 = load i32, ptr %7, align 4, !tbaa !5
  store i32 %67, ptr %2, align 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 96, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %68

68:                                               ; preds = %66, %10
  %69 = load i32, ptr %2, align 4
  ret i32 %69
}

declare i32 @liquid_error_fl(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) #1

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !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.1 = external hidden unnamed_addr constant [71 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @golay2412_generate_error_vector(i32 noundef %0) local_unnamed_addr #0 {
  %2 = alloca [24 x i32], align 16
  %3 = icmp ugt i32 %0, 24
  br i1 %3, label %4, label %.preheader21

4:                                                ; preds = %1
  %5 = tail call i32 (i32, ptr, i32, ptr, ...) @liquid_error_fl(i32 noundef 1, ptr noundef nonnull @.str, i32 noundef 34, ptr noundef nonnull @.str.1) #6
  br label %38

.preheader21:                                     ; preds = %1
  call void @llvm.lifetime.start.p0(i64 96, ptr nonnull %2) #6
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(96) %2, i8 0, i64 96, i1 false), !tbaa !5
  %.not27 = icmp eq i32 %0, 0
  br i1 %.not27, label %.preheader, label %.preheader20

.preheader20:                                     ; preds = %.preheader21, %35
  %.124 = phi i32 [ %37, %35 ], [ 0, %.preheader21 ]
  br label %29

.preheader.loopexit:                              ; preds = %35
  %.pre = load i32, ptr %2, align 16, !tbaa !5
  %.phi.trans.insert = getelementptr inbounds i8, ptr %2, i64 4
  %.phi.trans.insert63 = getelementptr inbounds i8, ptr %2, i64 68
  %6 = icmp ne i32 %.pre, 0
  %7 = zext i1 %6 to i32
  %8 = load <16 x i32>, ptr %.phi.trans.insert, align 4, !tbaa !5
  %9 = icmp eq <16 x i32> %8, zeroinitializer
  %10 = select <16 x i1> %9, <16 x i32> zeroinitializer, <16 x i32> <i32 2, i32 4, i32 8, i32 16, i32 32, i32 64, i32 128, i32 256, i32 512, i32 1024, i32 2048, i32 4096, i32 8192, i32 16384, i32 32768, i32 65536>
  %11 = load <4 x i32>, ptr %.phi.trans.insert63, align 4, !tbaa !5
  %12 = icmp eq <4 x i32> %11, zeroinitializer
  %13 = select <4 x i1> %12, <4 x i32> zeroinitializer, <4 x i32> <i32 131072, i32 262144, i32 524288, i32 1048576>
  %14 = tail call i32 @llvm.vector.reduce.or.v16i32(<16 x i32> %10)
  %15 = tail call i32 @llvm.vector.reduce.or.v4i32(<4 x i32> %13)
  %op.rdx = or disjoint i32 %14, %15
  %op.rdx72 = or disjoint i32 %op.rdx, %7
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit, %.preheader21
  %16 = phi i32 [ %op.rdx72, %.preheader.loopexit ], [ 0, %.preheader21 ]
  %17 = getelementptr inbounds i8, ptr %2, i64 84
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %.not.21 = icmp eq i32 %18, 0
  %19 = select i1 %.not.21, i32 0, i32 2097152
  %20 = or i32 %19, %16
  %21 = getelementptr inbounds i8, ptr %2, i64 88
  %22 = load i32, ptr %21, align 8, !tbaa !5
  %.not.22 = icmp eq i32 %22, 0
  %23 = select i1 %.not.22, i32 0, i32 4194304
  %24 = or i32 %23, %20
  %25 = getelementptr inbounds i8, ptr %2, i64 92
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %.not.23 = icmp eq i32 %26, 0
  %27 = select i1 %.not.23, i32 0, i32 8388608
  %28 = or i32 %27, %24
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %2) #6
  br label %38

29:                                               ; preds = %.preheader20, %29
  %30 = tail call i32 @rand() #6
  %31 = srem i32 %30, 24
  %32 = zext i32 %31 to i64
  %33 = getelementptr inbounds [24 x i32], ptr %2, i64 0, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %.not19 = icmp eq i32 %34, 0
  br i1 %.not19, label %35, label %29, !llvm.loop !9

35:                                               ; preds = %29
  %36 = getelementptr inbounds [24 x i32], ptr %2, i64 0, i64 %32
  store i32 1, ptr %36, align 4, !tbaa !5
  %37 = add nuw i32 %.124, 1
  %exitcond.not = icmp eq i32 %37, %0
  br i1 %exitcond.not, label %.preheader.loopexit, label %.preheader20, !llvm.loop !11

38:                                               ; preds = %.preheader, %4
  %.017 = phi i32 [ 0, %4 ], [ %28, %.preheader ]
  ret i32 %.017
}

declare i32 @liquid_error_fl(i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #1

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

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.or.v16i32(<16 x i32>) #5

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.vector.reduce.or.v4i32(<4 x i32>) #5

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


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopIdiomRecognizePass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass