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

@__const.autotest_rep3_codec.msg = external hidden unnamed_addr constant [4 x i8], align 1
@liquid_autotest_verbose = external global i32, align 4
@.str = external hidden unnamed_addr constant [88 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [31 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @autotest_rep3_codec() #0 {
  %1 = alloca i32, align 4
  %2 = alloca [4 x i8], align 1
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #5
  store i32 4, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %2, ptr align 1 @__const.autotest_rep3_codec.msg, i64 4, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 2, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %9 = load i32, ptr %3, align 4, !tbaa !5
  %10 = load i32, ptr %1, align 4, !tbaa !5
  %11 = call i32 @fec_get_enc_msg_length(i32 noundef %9, i32 noundef %10)
  store i32 %11, ptr %4, align 4, !tbaa !5
  %12 = load i32, ptr %1, align 4, !tbaa !5
  %13 = zext i32 %12 to i64
  %14 = call ptr @llvm.stacksave.p0()
  store ptr %14, ptr %5, align 8
  %15 = alloca i8, i64 %13, align 16
  store i64 %13, ptr %6, align 8
  %16 = load i32, ptr %4, align 4, !tbaa !5
  %17 = zext i32 %16 to i64
  %18 = alloca i8, i64 %17, align 16
  store i64 %17, ptr %7, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %19 = load i32, ptr %3, align 4, !tbaa !5
  %20 = call ptr @fec_create(i32 noundef %19, ptr noundef null)
  store ptr %20, ptr %8, align 8, !tbaa !9
  %21 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %22 = icmp ne i32 %21, 0
  br i1 %22, label %23, label %26

23:                                               ; preds = %0
  %24 = load ptr, ptr %8, align 8, !tbaa !9
  %25 = call i32 @fec_print(ptr noundef %24)
  br label %26

26:                                               ; preds = %23, %0
  %27 = load ptr, ptr %8, align 8, !tbaa !9
  %28 = load i32, ptr %1, align 4, !tbaa !5
  %29 = getelementptr inbounds [4 x i8], ptr %2, i64 0, i64 0
  %30 = call i32 @fec_encode(ptr noundef %27, i32 noundef %28, ptr noundef %29, ptr noundef %18)
  %31 = getelementptr inbounds i8, ptr %18, i64 0
  %32 = load i8, ptr %31, align 16, !tbaa !11
  %33 = zext i8 %32 to i32
  %34 = xor i32 %33, -1
  %35 = trunc i32 %34 to i8
  %36 = getelementptr inbounds i8, ptr %18, i64 0
  store i8 %35, ptr %36, align 16, !tbaa !11
  %37 = getelementptr inbounds i8, ptr %18, i64 1
  %38 = load i8, ptr %37, align 1, !tbaa !11
  %39 = zext i8 %38 to i32
  %40 = xor i32 %39, -1
  %41 = trunc i32 %40 to i8
  %42 = getelementptr inbounds i8, ptr %18, i64 1
  store i8 %41, ptr %42, align 1, !tbaa !11
  %43 = getelementptr inbounds i8, ptr %18, i64 2
  %44 = load i8, ptr %43, align 2, !tbaa !11
  %45 = zext i8 %44 to i32
  %46 = xor i32 %45, -1
  %47 = trunc i32 %46 to i8
  %48 = getelementptr inbounds i8, ptr %18, i64 2
  store i8 %47, ptr %48, align 2, !tbaa !11
  %49 = getelementptr inbounds i8, ptr %18, i64 3
  %50 = load i8, ptr %49, align 1, !tbaa !11
  %51 = zext i8 %50 to i32
  %52 = xor i32 %51, -1
  %53 = trunc i32 %52 to i8
  %54 = getelementptr inbounds i8, ptr %18, i64 3
  store i8 %53, ptr %54, align 1, !tbaa !11
  %55 = load ptr, ptr %8, align 8, !tbaa !9
  %56 = load i32, ptr %1, align 4, !tbaa !5
  %57 = call i32 @fec_decode(ptr noundef %55, i32 noundef %56, ptr noundef %18, ptr noundef %15)
  %58 = getelementptr inbounds [4 x i8], ptr %2, i64 0, i64 0
  %59 = load i32, ptr %1, align 4, !tbaa !5
  %60 = call i32 @liquid_autotest_same_data(ptr noundef %58, ptr noundef %15, i32 noundef %59)
  %61 = icmp ne i32 %60, 0
  br i1 %61, label %70, label %62

62:                                               ; preds = %26
  call void @liquid_autotest_failed_msg(ptr noundef @.str, i32 noundef 58, ptr noundef @.str.1)
  %63 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %64 = icmp ne i32 %63, 0
  br i1 %64, label %65, label %69

65:                                               ; preds = %62
  %66 = getelementptr inbounds [4 x i8], ptr %2, i64 0, i64 0
  %67 = load i32, ptr %1, align 4, !tbaa !5
  call void @liquid_autotest_print_array(ptr noundef %66, i32 noundef %67)
  %68 = load i32, ptr %1, align 4, !tbaa !5
  call void @liquid_autotest_print_array(ptr noundef %15, i32 noundef %68)
  br label %69

69:                                               ; preds = %65, %62
  br label %71

70:                                               ; preds = %26
  call void (...) @liquid_autotest_passed()
  br label %71

71:                                               ; preds = %70, %69
  %72 = load ptr, ptr %8, align 8, !tbaa !9
  %73 = call i32 @fec_destroy(ptr noundef %72)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  %74 = load ptr, ptr %5, align 8
  call void @llvm.stackrestore.p0(ptr %74)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #5
  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: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4

declare ptr @fec_create(i32 noundef, ptr noundef) #3

declare i32 @fec_print(ptr noundef) #3

declare i32 @fec_encode(ptr noundef, i32 noundef, ptr noundef, ptr noundef) #3

declare i32 @fec_decode(ptr noundef, i32 noundef, ptr noundef, ptr noundef) #3

declare i32 @liquid_autotest_same_data(ptr noundef, ptr noundef, i32 noundef) #3

declare void @liquid_autotest_failed_msg(ptr noundef, i32 noundef, ptr noundef) #3

declare void @liquid_autotest_print_array(ptr noundef, i32 noundef) #3

declare void @liquid_autotest_passed(...) #3

declare i32 @fec_destroy(ptr noundef) #3

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nosync nounwind willreturn }
attributes #5 = { 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 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!7, !7, i64 0}


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

@__const.autotest_rep3_codec.msg = external hidden unnamed_addr constant [4 x i8], align 1
@liquid_autotest_verbose = external local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [88 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [31 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @autotest_rep3_codec() local_unnamed_addr #0 {
  %1 = alloca [4 x i8], align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #4
  %2 = load i32, ptr @__const.autotest_rep3_codec.msg, align 1
  store i32 %2, ptr %1, align 4
  %3 = tail call i32 @fec_get_enc_msg_length(i32 noundef 2, i32 noundef 4) #4
  %4 = tail call ptr @llvm.stacksave.p0()
  %5 = alloca [4 x i8], align 16
  %6 = zext i32 %3 to i64
  %7 = alloca i8, i64 %6, align 16
  %8 = tail call ptr @fec_create(i32 noundef 2, ptr noundef null) #4
  %9 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %.not = icmp eq i32 %9, 0
  br i1 %.not, label %12, label %10

10:                                               ; preds = %0
  %11 = tail call i32 @fec_print(ptr noundef %8) #4
  br label %12

12:                                               ; preds = %10, %0
  %13 = call i32 @fec_encode(ptr noundef %8, i32 noundef 4, ptr noundef nonnull %1, ptr noundef nonnull %7) #4
  %14 = load <4 x i8>, ptr %7, align 16, !tbaa !9
  %15 = xor <4 x i8> %14, <i8 -1, i8 -1, i8 -1, i8 -1>
  store <4 x i8> %15, ptr %7, align 16, !tbaa !9
  %16 = call i32 @fec_decode(ptr noundef %8, i32 noundef 4, ptr noundef nonnull %7, ptr noundef nonnull %5) #4
  %17 = call i32 @liquid_autotest_same_data(ptr noundef nonnull %1, ptr noundef nonnull %5, i32 noundef 4) #4
  %.not14 = icmp eq i32 %17, 0
  br i1 %.not14, label %18, label %21

18:                                               ; preds = %12
  call void @liquid_autotest_failed_msg(ptr noundef nonnull @.str, i32 noundef 58, ptr noundef nonnull @.str.1) #4
  %19 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %.not15 = icmp eq i32 %19, 0
  br i1 %.not15, label %22, label %20

20:                                               ; preds = %18
  call void @liquid_autotest_print_array(ptr noundef nonnull %1, i32 noundef 4) #4
  call void @liquid_autotest_print_array(ptr noundef nonnull %5, i32 noundef 4) #4
  br label %22

21:                                               ; preds = %12
  call void (...) @liquid_autotest_passed() #4
  br label %22

22:                                               ; preds = %18, %20, %21
  %23 = call i32 @fec_destroy(ptr noundef %8) #4
  call void @llvm.stackrestore.p0(ptr %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #4
  ret void
}

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #3

declare ptr @fec_create(i32 noundef, ptr noundef) local_unnamed_addr #2

declare i32 @fec_print(ptr noundef) local_unnamed_addr #2

declare i32 @fec_encode(ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @fec_decode(ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare i32 @liquid_autotest_same_data(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #2

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

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

declare void @liquid_autotest_passed(...) local_unnamed_addr #2

declare i32 @fec_destroy(ptr noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #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 = { mustprogress 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 = { mustprogress nocallback nofree nosync nounwind willreturn }
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 = !{!7, !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass