; LLVM IR from jgaeddert/liquid-dsp :: src/fec/tests (fec_hamming84_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_hamming84_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_hamming84_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_hamming84_codec.msg, i64 4, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 5, 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 = getelementptr inbounds i8, ptr %18, i64 1
  %37 = load i8, ptr %36, align 1, !tbaa !11
  %38 = zext i8 %37 to i32
  %39 = xor i32 %38, 4
  %40 = trunc i32 %39 to i8
  store i8 %40, ptr %36, align 1, !tbaa !11
  %41 = getelementptr inbounds i8, ptr %18, i64 2
  %42 = load i8, ptr %41, align 2, !tbaa !11
  %43 = zext i8 %42 to i32
  %44 = xor i32 %43, 2
  %45 = trunc i32 %44 to i8
  store i8 %45, ptr %41, align 2, !tbaa !11
  %46 = getelementptr inbounds i8, ptr %18, i64 3
  %47 = load i8, ptr %46, align 1, !tbaa !11
  %48 = zext i8 %47 to i32
  %49 = xor i32 %48, 1
  %50 = trunc i32 %49 to i8
  store i8 %50, ptr %46, align 1, !tbaa !11
  %51 = getelementptr inbounds i8, ptr %18, i64 4
  %52 = load i8, ptr %51, align 4, !tbaa !11
  %53 = zext i8 %52 to i32
  %54 = xor i32 %53, 128
  %55 = trunc i32 %54 to i8
  store i8 %55, ptr %51, align 4, !tbaa !11
  %56 = getelementptr inbounds i8, ptr %18, i64 5
  %57 = load i8, ptr %56, align 1, !tbaa !11
  %58 = zext i8 %57 to i32
  %59 = xor i32 %58, 64
  %60 = trunc i32 %59 to i8
  store i8 %60, ptr %56, align 1, !tbaa !11
  %61 = getelementptr inbounds i8, ptr %18, i64 6
  %62 = load i8, ptr %61, align 2, !tbaa !11
  %63 = zext i8 %62 to i32
  %64 = xor i32 %63, 32
  %65 = trunc i32 %64 to i8
  store i8 %65, ptr %61, align 2, !tbaa !11
  %66 = getelementptr inbounds i8, ptr %18, i64 7
  %67 = load i8, ptr %66, align 1, !tbaa !11
  %68 = zext i8 %67 to i32
  %69 = xor i32 %68, 16
  %70 = trunc i32 %69 to i8
  store i8 %70, ptr %66, align 1, !tbaa !11
  %71 = load ptr, ptr %8, align 8, !tbaa !9
  %72 = load i32, ptr %1, align 4, !tbaa !5
  %73 = call i32 @fec_decode(ptr noundef %71, i32 noundef %72, ptr noundef %18, ptr noundef %15)
  %74 = getelementptr inbounds [4 x i8], ptr %2, i64 0, i64 0
  %75 = load i32, ptr %1, align 4, !tbaa !5
  %76 = call i32 @liquid_autotest_same_data(ptr noundef %74, ptr noundef %15, i32 noundef %75)
  %77 = icmp ne i32 %76, 0
  br i1 %77, label %86, label %78

78:                                               ; preds = %26
  call void @liquid_autotest_failed_msg(ptr noundef @.str, i32 noundef 62, ptr noundef @.str.1)
  %79 = load i32, ptr @liquid_autotest_verbose, align 4, !tbaa !5
  %80 = icmp ne i32 %79, 0
  br i1 %80, label %81, label %85

81:                                               ; preds = %78
  %82 = getelementptr inbounds [4 x i8], ptr %2, i64 0, i64 0
  %83 = load i32, ptr %1, align 4, !tbaa !5
  call void @liquid_autotest_print_array(ptr noundef %82, i32 noundef %83)
  %84 = load i32, ptr %1, align 4, !tbaa !5
  call void @liquid_autotest_print_array(ptr noundef %15, i32 noundef %84)
  br label %85

85:                                               ; preds = %81, %78
  br label %87

86:                                               ; preds = %26
  call void (...) @liquid_autotest_passed()
  br label %87

87:                                               ; preds = %86, %85
  %88 = load ptr, ptr %8, align 8, !tbaa !9
  %89 = call i32 @fec_destroy(ptr noundef %88)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  %90 = load ptr, ptr %5, align 8
  call void @llvm.stackrestore.p0(ptr %90)
  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_hamming84_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_hamming84_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_hamming84_codec.msg, align 1
  store i32 %2, ptr %1, align 4
  %3 = tail call i32 @fec_get_enc_msg_length(i32 noundef 5, 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 5, 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 <8 x i8>, ptr %7, align 16, !tbaa !9
  %15 = xor <8 x i8> %14, <i8 4, i8 4, i8 2, i8 1, i8 -128, i8 64, i8 32, i8 16>
  store <8 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 62, 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,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass