; LLVM IR from jgaeddert/liquid-dsp :: src/fec/tests (fec_hamming74_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_hamming74_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 [93 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_hamming74_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_hamming74_codec.msg, i64 4, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 4, 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, 4
  %35 = trunc i32 %34 to i8
  store i8 %35, ptr %31, align 16, !tbaa !11
  %36 = load ptr, ptr %8, align 8, !tbaa !9
  %37 = load i32, ptr %1, align 4, !tbaa !5
  %38 = call i32 @fec_decode(ptr noundef %36, i32 noundef %37, ptr noundef %18, ptr noundef %15)
  %39 = getelementptr inbounds [4 x i8], ptr %2, i64 0, i64 0
  %40 = load i32, ptr %1, align 4, !tbaa !5
  %41 = call i32 @liquid_autotest_same_data(ptr noundef %39, ptr noundef %15, i32 noundef %40)
  %42 = icmp ne i32 %41, 0
  br i1 %42, label %51, label %43

43:                                               ; preds = %26
  call void @liquid_autotest_failed_msg(ptr noundef @.str, i32 noundef 63, ptr noundef @.str.1)
  %44 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %46, label %50

46:                                               ; preds = %43
  %47 = getelementptr inbounds [4 x i8], ptr %2, i64 0, i64 0
  %48 = load i32, ptr %1, align 4, !tbaa !5
  call void @liquid_autotest_print_array(ptr noundef %47, i32 noundef %48)
  %49 = load i32, ptr %1, align 4, !tbaa !5
  call void @liquid_autotest_print_array(ptr noundef %15, i32 noundef %49)
  br label %50

50:                                               ; preds = %46, %43
  br label %52

51:                                               ; preds = %26
  call void (...) @liquid_autotest_passed()
  br label %52

52:                                               ; preds = %51, %50
  %53 = load ptr, ptr %8, align 8, !tbaa !9
  %54 = call i32 @fec_destroy(ptr noundef %53)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  %55 = load ptr, ptr %5, align 8
  call void @llvm.stackrestore.p0(ptr %55)
  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_hamming74_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 [93 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_hamming74_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_hamming74_codec.msg, align 1
  store i32 %2, ptr %1, align 4
  %3 = tail call i32 @fec_get_enc_msg_length(i32 noundef 4, 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 4, 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 i8, ptr %7, align 16, !tbaa !9
  %15 = xor i8 %14, 4
  store 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 63, 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,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass