; LLVM IR from jgaeddert/liquid-dsp :: sandbox (fec_hamming_test)

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

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [53 x i8], align 1
@liquid_c_ones_mod2 = external constant [256 x i8], align 16
@.str.1 = external hidden unnamed_addr constant [47 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @fec_hamming_encode_symbol(i32 noundef %0) #0 {
  %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
  store i32 %0, ptr %2, align 4, !tbaa !5
  %8 = load i32, ptr %2, align 4, !tbaa !5
  %9 = icmp uge i32 %8, 2048
  br i1 %9, label %10, label %13

10:                                               ; preds = %1
  %11 = load ptr, ptr @stderr, align 8, !tbaa !9
  %12 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %11, ptr noundef @.str) #5
  call void @exit(i32 noundef 1) #6
  unreachable

13:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = and i32 %14, 1749
  %16 = and i32 %15, 255
  %17 = zext i32 %16 to i64
  %18 = getelementptr inbounds [256 x i8], ptr @liquid_c_ones_mod2, i64 0, i64 %17
  %19 = load i8, ptr %18, align 1, !tbaa !11
  %20 = zext i8 %19 to i32
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = and i32 %21, 1749
  %23 = lshr i32 %22, 8
  %24 = and i32 %23, 255
  %25 = zext i32 %24 to i64
  %26 = getelementptr inbounds [256 x i8], ptr @liquid_c_ones_mod2, i64 0, i64 %25
  %27 = load i8, ptr %26, align 1, !tbaa !11
  %28 = zext i8 %27 to i32
  %29 = add nsw i32 %20, %28
  %30 = srem i32 %29, 2
  store i32 %30, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = and i32 %31, 1459
  %33 = and i32 %32, 255
  %34 = zext i32 %33 to i64
  %35 = getelementptr inbounds [256 x i8], ptr @liquid_c_ones_mod2, i64 0, i64 %34
  %36 = load i8, ptr %35, align 1, !tbaa !11
  %37 = zext i8 %36 to i32
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = and i32 %38, 1459
  %40 = lshr i32 %39, 8
  %41 = and i32 %40, 255
  %42 = zext i32 %41 to i64
  %43 = getelementptr inbounds [256 x i8], ptr @liquid_c_ones_mod2, i64 0, i64 %42
  %44 = load i8, ptr %43, align 1, !tbaa !11
  %45 = zext i8 %44 to i32
  %46 = add nsw i32 %37, %45
  %47 = srem i32 %46, 2
  store i32 %47, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %48 = load i32, ptr %2, align 4, !tbaa !5
  %49 = and i32 %48, 911
  %50 = and i32 %49, 255
  %51 = zext i32 %50 to i64
  %52 = getelementptr inbounds [256 x i8], ptr @liquid_c_ones_mod2, i64 0, i64 %51
  %53 = load i8, ptr %52, align 1, !tbaa !11
  %54 = zext i8 %53 to i32
  %55 = load i32, ptr %2, align 4, !tbaa !5
  %56 = and i32 %55, 911
  %57 = lshr i32 %56, 8
  %58 = and i32 %57, 255
  %59 = zext i32 %58 to i64
  %60 = getelementptr inbounds [256 x i8], ptr @liquid_c_ones_mod2, i64 0, i64 %59
  %61 = load i8, ptr %60, align 1, !tbaa !11
  %62 = zext i8 %61 to i32
  %63 = add nsw i32 %54, %62
  %64 = srem i32 %63, 2
  store i32 %64, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %65 = load i32, ptr %2, align 4, !tbaa !5
  %66 = and i32 %65, 127
  %67 = and i32 %66, 255
  %68 = zext i32 %67 to i64
  %69 = getelementptr inbounds [256 x i8], ptr @liquid_c_ones_mod2, i64 0, i64 %68
  %70 = load i8, ptr %69, align 1, !tbaa !11
  %71 = zext i8 %70 to i32
  %72 = load i32, ptr %2, align 4, !tbaa !5
  %73 = and i32 %72, 127
  %74 = lshr i32 %73, 8
  %75 = and i32 %74, 255
  %76 = zext i32 %75 to i64
  %77 = getelementptr inbounds [256 x i8], ptr @liquid_c_ones_mod2, i64 0, i64 %76
  %78 = load i8, ptr %77, align 1, !tbaa !11
  %79 = zext i8 %78 to i32
  %80 = add nsw i32 %71, %79
  %81 = srem i32 %80, 2
  store i32 %81, ptr %6, align 4, !tbaa !5
  %82 = load i32, ptr %3, align 4, !tbaa !5
  %83 = load i32, ptr %4, align 4, !tbaa !5
  %84 = load i32, ptr %5, align 4, !tbaa !5
  %85 = load i32, ptr %6, align 4, !tbaa !5
  %86 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i32 noundef %82, i32 noundef %83, i32 noundef %84, i32 noundef %85)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %87 = load i32, ptr %2, align 4, !tbaa !5
  %88 = and i32 %87, 127
  %89 = shl i32 %88, 0
  %90 = load i32, ptr %2, align 4, !tbaa !5
  %91 = and i32 %90, 896
  %92 = shl i32 %91, 1
  %93 = or i32 %89, %92
  %94 = load i32, ptr %2, align 4, !tbaa !5
  %95 = and i32 %94, 1024
  %96 = shl i32 %95, 2
  %97 = or i32 %93, %96
  %98 = load i32, ptr %3, align 4, !tbaa !5
  %99 = shl i32 %98, 14
  %100 = or i32 %97, %99
  %101 = load i32, ptr %4, align 4, !tbaa !5
  %102 = shl i32 %101, 13
  %103 = or i32 %100, %102
  %104 = load i32, ptr %5, align 4, !tbaa !5
  %105 = shl i32 %104, 11
  %106 = or i32 %103, %105
  %107 = load i32, ptr %6, align 4, !tbaa !5
  %108 = shl i32 %107, 7
  %109 = or i32 %106, %108
  store i32 %109, ptr %7, align 4, !tbaa !5
  %110 = load i32, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  ret i32 %110
}

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #1

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #2

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

declare i32 @printf(ptr noundef, ...) #4

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { 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 = { noreturn 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { "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 #5 = { nounwind }
attributes #6 = { noreturn 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"

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [53 x i8], align 1
@liquid_c_ones_mod2 = external local_unnamed_addr constant [256 x i8], align 16
@.str.1 = external hidden unnamed_addr constant [47 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 32768) i32 @fec_hamming_encode_symbol(i32 noundef %0) local_unnamed_addr #0 {
  %2 = icmp ugt i32 %0, 2047
  br i1 %2, label %3, label %6

3:                                                ; preds = %1
  %4 = load ptr, ptr @stderr, align 8, !tbaa !5
  %5 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %4, ptr noundef nonnull @.str) #3
  tail call void @exit(i32 noundef 1) #4
  unreachable

6:                                                ; preds = %1
  %7 = and i32 %0, 213
  %8 = zext nneg i32 %7 to i64
  %9 = getelementptr inbounds [256 x i8], ptr @liquid_c_ones_mod2, i64 0, i64 %8
  %10 = load i8, ptr %9, align 1, !tbaa !9
  %11 = zext i8 %10 to i32
  %12 = lshr i32 %0, 8
  %13 = and i32 %12, 6
  %14 = zext nneg i32 %13 to i64
  %15 = getelementptr inbounds [256 x i8], ptr @liquid_c_ones_mod2, i64 0, i64 %14
  %16 = load i8, ptr %15, align 2, !tbaa !9
  %17 = zext i8 %16 to i32
  %18 = add nuw nsw i32 %17, %11
  %19 = and i32 %18, 1
  %20 = and i32 %0, 179
  %21 = zext nneg i32 %20 to i64
  %22 = getelementptr inbounds [256 x i8], ptr @liquid_c_ones_mod2, i64 0, i64 %21
  %23 = load i8, ptr %22, align 1, !tbaa !9
  %24 = zext i8 %23 to i32
  %25 = and i32 %12, 5
  %26 = zext nneg i32 %25 to i64
  %27 = getelementptr inbounds [256 x i8], ptr @liquid_c_ones_mod2, i64 0, i64 %26
  %28 = load i8, ptr %27, align 1, !tbaa !9
  %29 = zext i8 %28 to i32
  %30 = add nuw nsw i32 %29, %24
  %31 = and i32 %30, 1
  %32 = and i32 %0, 143
  %33 = zext nneg i32 %32 to i64
  %34 = getelementptr inbounds [256 x i8], ptr @liquid_c_ones_mod2, i64 0, i64 %33
  %35 = load i8, ptr %34, align 1, !tbaa !9
  %36 = zext i8 %35 to i32
  %37 = and i32 %12, 3
  %38 = zext nneg i32 %37 to i64
  %39 = getelementptr inbounds [256 x i8], ptr @liquid_c_ones_mod2, i64 0, i64 %38
  %40 = load i8, ptr %39, align 1, !tbaa !9
  %41 = zext i8 %40 to i32
  %42 = add nuw nsw i32 %41, %36
  %43 = and i32 %42, 1
  %44 = and i32 %0, 127
  %45 = zext nneg i32 %44 to i64
  %46 = getelementptr inbounds [256 x i8], ptr @liquid_c_ones_mod2, i64 0, i64 %45
  %47 = load i8, ptr %46, align 1, !tbaa !9
  %48 = zext i8 %47 to i32
  %49 = load i8, ptr @liquid_c_ones_mod2, align 16, !tbaa !9
  %50 = zext i8 %49 to i32
  %51 = add nuw nsw i32 %50, %48
  %52 = and i32 %51, 1
  %53 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i32 noundef %19, i32 noundef %31, i32 noundef %43, i32 noundef %52)
  %54 = shl nuw nsw i32 %0, 1
  %55 = and i32 %54, 1792
  %56 = shl nuw nsw i32 %0, 2
  %57 = and i32 %56, 4096
  %58 = or disjoint i32 %55, %57
  %59 = shl nuw nsw i32 %19, 14
  %60 = or disjoint i32 %59, %58
  %61 = shl nuw nsw i32 %31, 13
  %62 = or disjoint i32 %61, %60
  %63 = shl nuw nsw i32 %43, 11
  %64 = or disjoint i32 %63, %62
  %65 = shl nuw nsw i32 %52, 7
  %66 = or disjoint i32 %65, %64
  %67 = or disjoint i32 %66, %44
  ret i32 %67
}

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #1

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #2

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

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 = { nofree 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 = { noreturn 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 = { cold nounwind }
attributes #4 = { noreturn 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 = !{!"any pointer", !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,ReassociatePass,SROAPass,TailCallElimPass