; LLVM IR from fast-pack/simdcomp :: src (simdcomputil)

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

; Function Attrs: nounwind willreturn memory(read) uwtable
define dso_local i32 @maxbits(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca <2 x i64>, align 16
  %5 = alloca i32, align 4
  %6 = alloca <2 x i64>, align 16
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %7, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #4
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = call <2 x i64> @_mm_loadu_si128(ptr noundef %8)
  store <2 x i64> %9, ptr %4, align 16, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 1, ptr %5, align 4, !tbaa !10
  br label %10

10:                                               ; preds = %23, %1
  %11 = load i32, ptr %5, align 4, !tbaa !10
  %12 = mul i32 4, %11
  %13 = icmp ult i32 %12, 128
  br i1 %13, label %14, label %26

14:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #4
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = load i32, ptr %5, align 4, !tbaa !10
  %17 = zext i32 %16 to i64
  %18 = getelementptr inbounds <2 x i64>, ptr %15, i64 %17
  %19 = call <2 x i64> @_mm_loadu_si128(ptr noundef %18)
  store <2 x i64> %19, ptr %6, align 16, !tbaa !9
  %20 = load <2 x i64>, ptr %4, align 16, !tbaa !9
  %21 = load <2 x i64>, ptr %6, align 16, !tbaa !9
  %22 = call <2 x i64> @_mm_or_si128(<2 x i64> noundef %20, <2 x i64> noundef %21)
  store <2 x i64> %22, ptr %4, align 16, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #4
  br label %23

23:                                               ; preds = %14
  %24 = load i32, ptr %5, align 4, !tbaa !10
  %25 = add i32 %24, 1
  store i32 %25, ptr %5, align 4, !tbaa !10
  br label %10, !llvm.loop !12

26:                                               ; preds = %10
  %27 = load <2 x i64>, ptr %4, align 16, !tbaa !9
  %28 = call i32 @maxbitas32int(<2 x i64> noundef %27)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  ret i32 %28
}

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

; Function Attrs: alwaysinline nounwind uwtable
declare hidden <2 x i64> @_mm_loadu_si128(ptr noundef) #2

; Function Attrs: alwaysinline nounwind uwtable
declare hidden <2 x i64> @_mm_or_si128(<2 x i64> noundef, <2 x i64> noundef) #2

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

; Function Attrs: nounwind uwtable
declare hidden i32 @maxbitas32int(<2 x i64> noundef) #3

attributes #0 = { nounwind willreturn memory(read) uwtable "min-legal-vector-width"="128" "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 = { alwaysinline nounwind uwtable "min-legal-vector-width"="128" "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 = { nounwind uwtable "min-legal-vector-width"="128" "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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !7, i64 0}
!12 = distinct !{!12, !13}
!13 = !{!"llvm.loop.mustprogress"}


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

; Function Attrs: mustprogress nofree nounwind willreturn memory(read) uwtable
define dso_local i32 @maxbits(ptr noundef %0) local_unnamed_addr #0 {
  %2 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef %0)
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  %4 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %3)
  %5 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %2, <2 x i64> noundef %4)
  %6 = getelementptr inbounds i8, ptr %0, i64 32
  %7 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %6)
  %8 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %5, <2 x i64> noundef %7)
  %9 = getelementptr inbounds i8, ptr %0, i64 48
  %10 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %9)
  %11 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %8, <2 x i64> noundef %10)
  %12 = getelementptr inbounds i8, ptr %0, i64 64
  %13 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %12)
  %14 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %11, <2 x i64> noundef %13)
  %15 = getelementptr inbounds i8, ptr %0, i64 80
  %16 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %15)
  %17 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %14, <2 x i64> noundef %16)
  %18 = getelementptr inbounds i8, ptr %0, i64 96
  %19 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %18)
  %20 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %17, <2 x i64> noundef %19)
  %21 = getelementptr inbounds i8, ptr %0, i64 112
  %22 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %21)
  %23 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %20, <2 x i64> noundef %22)
  %24 = getelementptr inbounds i8, ptr %0, i64 128
  %25 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %24)
  %26 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %23, <2 x i64> noundef %25)
  %27 = getelementptr inbounds i8, ptr %0, i64 144
  %28 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %27)
  %29 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %26, <2 x i64> noundef %28)
  %30 = getelementptr inbounds i8, ptr %0, i64 160
  %31 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %30)
  %32 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %29, <2 x i64> noundef %31)
  %33 = getelementptr inbounds i8, ptr %0, i64 176
  %34 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %33)
  %35 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %32, <2 x i64> noundef %34)
  %36 = getelementptr inbounds i8, ptr %0, i64 192
  %37 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %36)
  %38 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %35, <2 x i64> noundef %37)
  %39 = getelementptr inbounds i8, ptr %0, i64 208
  %40 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %39)
  %41 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %38, <2 x i64> noundef %40)
  %42 = getelementptr inbounds i8, ptr %0, i64 224
  %43 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %42)
  %44 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %41, <2 x i64> noundef %43)
  %45 = getelementptr inbounds i8, ptr %0, i64 240
  %46 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %45)
  %47 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %44, <2 x i64> noundef %46)
  %48 = getelementptr inbounds i8, ptr %0, i64 256
  %49 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %48)
  %50 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %47, <2 x i64> noundef %49)
  %51 = getelementptr inbounds i8, ptr %0, i64 272
  %52 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %51)
  %53 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %50, <2 x i64> noundef %52)
  %54 = getelementptr inbounds i8, ptr %0, i64 288
  %55 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %54)
  %56 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %53, <2 x i64> noundef %55)
  %57 = getelementptr inbounds i8, ptr %0, i64 304
  %58 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %57)
  %59 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %56, <2 x i64> noundef %58)
  %60 = getelementptr inbounds i8, ptr %0, i64 320
  %61 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %60)
  %62 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %59, <2 x i64> noundef %61)
  %63 = getelementptr inbounds i8, ptr %0, i64 336
  %64 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %63)
  %65 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %62, <2 x i64> noundef %64)
  %66 = getelementptr inbounds i8, ptr %0, i64 352
  %67 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %66)
  %68 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %65, <2 x i64> noundef %67)
  %69 = getelementptr inbounds i8, ptr %0, i64 368
  %70 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %69)
  %71 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %68, <2 x i64> noundef %70)
  %72 = getelementptr inbounds i8, ptr %0, i64 384
  %73 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %72)
  %74 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %71, <2 x i64> noundef %73)
  %75 = getelementptr inbounds i8, ptr %0, i64 400
  %76 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %75)
  %77 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %74, <2 x i64> noundef %76)
  %78 = getelementptr inbounds i8, ptr %0, i64 416
  %79 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %78)
  %80 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %77, <2 x i64> noundef %79)
  %81 = getelementptr inbounds i8, ptr %0, i64 432
  %82 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %81)
  %83 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %80, <2 x i64> noundef %82)
  %84 = getelementptr inbounds i8, ptr %0, i64 448
  %85 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %84)
  %86 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %83, <2 x i64> noundef %85)
  %87 = getelementptr inbounds i8, ptr %0, i64 464
  %88 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %87)
  %89 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %86, <2 x i64> noundef %88)
  %90 = getelementptr inbounds i8, ptr %0, i64 480
  %91 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %90)
  %92 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %89, <2 x i64> noundef %91)
  %93 = getelementptr inbounds i8, ptr %0, i64 496
  %94 = tail call <2 x i64> @_mm_loadu_si128(ptr noundef nonnull %93)
  %95 = tail call <2 x i64> @_mm_or_si128(<2 x i64> noundef %92, <2 x i64> noundef %94)
  %96 = tail call i32 @maxbitas32int(<2 x i64> noundef %95)
  ret i32 %96
}

; Function Attrs: alwaysinline nounwind uwtable
declare hidden <2 x i64> @_mm_loadu_si128(ptr noundef) local_unnamed_addr #1

; Function Attrs: alwaysinline nounwind uwtable
declare hidden <2 x i64> @_mm_or_si128(<2 x i64> noundef, <2 x i64> noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden i32 @maxbitas32int(<2 x i64> noundef) local_unnamed_addr #2

attributes #0 = { mustprogress nofree nounwind willreturn memory(read) uwtable "min-legal-vector-width"="128" "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 = { alwaysinline nounwind uwtable "min-legal-vector-width"="128" "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 = { nounwind uwtable "min-legal-vector-width"="128" "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" }

!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)"}


; Effective O3 passes: CorrelatedValuePropagationPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass