; LLVM IR from cruppstahl/upscaledb :: 3rdparty/libfor (for)

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

@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [76 x i8], align 1
@__PRETTY_FUNCTION__.for_compressed_size_bits = external hidden unnamed_addr constant [54 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @for_compressed_size_bits(i32 noundef %0, i32 noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store i32 %1, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %7 = load i32, ptr %4, align 4, !tbaa !5
  %8 = icmp ule i32 %7, 32
  br i1 %8, label %9, label %10

9:                                                ; preds = %2
  br label %11

10:                                               ; preds = %2
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 72, ptr noundef @__PRETTY_FUNCTION__.for_compressed_size_bits) #4
  unreachable

11:                                               ; preds = %9
  %12 = load i32, ptr %3, align 4, !tbaa !5
  %13 = icmp uge i32 %12, 32
  br i1 %13, label %14, label %27

14:                                               ; preds = %11
  %15 = load i32, ptr %3, align 4, !tbaa !5
  %16 = udiv i32 %15, 32
  store i32 %16, ptr %6, align 4, !tbaa !5
  %17 = load i32, ptr %6, align 4, !tbaa !5
  %18 = mul i32 %17, 32
  %19 = load i32, ptr %4, align 4, !tbaa !5
  %20 = mul i32 %18, %19
  %21 = add i32 %20, 7
  %22 = udiv i32 %21, 8
  %23 = load i32, ptr %5, align 4, !tbaa !5
  %24 = add i32 %23, %22
  store i32 %24, ptr %5, align 4, !tbaa !5
  %25 = load i32, ptr %3, align 4, !tbaa !5
  %26 = urem i32 %25, 32
  store i32 %26, ptr %3, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %14, %11
  %28 = load i32, ptr %3, align 4, !tbaa !5
  %29 = icmp uge i32 %28, 16
  br i1 %29, label %30, label %43

30:                                               ; preds = %27
  %31 = load i32, ptr %3, align 4, !tbaa !5
  %32 = udiv i32 %31, 16
  store i32 %32, ptr %6, align 4, !tbaa !5
  %33 = load i32, ptr %6, align 4, !tbaa !5
  %34 = mul i32 %33, 16
  %35 = load i32, ptr %4, align 4, !tbaa !5
  %36 = mul i32 %34, %35
  %37 = add i32 %36, 7
  %38 = udiv i32 %37, 8
  %39 = load i32, ptr %5, align 4, !tbaa !5
  %40 = add i32 %39, %38
  store i32 %40, ptr %5, align 4, !tbaa !5
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = urem i32 %41, 16
  store i32 %42, ptr %3, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %30, %27
  %44 = load i32, ptr %3, align 4, !tbaa !5
  %45 = icmp uge i32 %44, 8
  br i1 %45, label %46, label %59

46:                                               ; preds = %43
  %47 = load i32, ptr %3, align 4, !tbaa !5
  %48 = udiv i32 %47, 8
  store i32 %48, ptr %6, align 4, !tbaa !5
  %49 = load i32, ptr %6, align 4, !tbaa !5
  %50 = mul i32 %49, 8
  %51 = load i32, ptr %4, align 4, !tbaa !5
  %52 = mul i32 %50, %51
  %53 = add i32 %52, 7
  %54 = udiv i32 %53, 8
  %55 = load i32, ptr %5, align 4, !tbaa !5
  %56 = add i32 %55, %54
  store i32 %56, ptr %5, align 4, !tbaa !5
  %57 = load i32, ptr %3, align 4, !tbaa !5
  %58 = urem i32 %57, 8
  store i32 %58, ptr %3, align 4, !tbaa !5
  br label %59

59:                                               ; preds = %46, %43
  %60 = load i32, ptr %5, align 4, !tbaa !5
  %61 = load i32, ptr %3, align 4, !tbaa !5
  %62 = load i32, ptr %4, align 4, !tbaa !5
  %63 = mul i32 %61, %62
  %64 = add i32 %63, 7
  %65 = udiv i32 %64, 8
  %66 = add i32 %60, %65
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  ret i32 %66
}

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}


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

@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [76 x i8], align 1
@__PRETTY_FUNCTION__.for_compressed_size_bits = external hidden unnamed_addr constant [54 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @for_compressed_size_bits(i32 noundef %0, i32 noundef %1) local_unnamed_addr #0 {
  %3 = icmp ult i32 %1, 33
  br i1 %3, label %5, label %4

4:                                                ; preds = %2
  tail call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 72, ptr noundef nonnull @__PRETTY_FUNCTION__.for_compressed_size_bits) #2
  unreachable

5:                                                ; preds = %2
  %6 = icmp ugt i32 %0, 31
  %7 = and i32 %0, -32
  %8 = mul i32 %7, %1
  %9 = lshr exact i32 %8, 3
  %10 = and i32 %0, 16
  %.0 = select i1 %6, i32 %9, i32 0
  %.not = icmp eq i32 %10, 0
  %11 = shl nuw nsw i32 %1, 1
  %12 = and i32 %0, 8
  %13 = select i1 %.not, i32 0, i32 %11
  %.not28 = icmp eq i32 %12, 0
  %14 = and i32 %0, 7
  %15 = select i1 %.not28, i32 0, i32 %1
  %16 = mul nuw nsw i32 %14, %1
  %17 = add nuw nsw i32 %16, 7
  %18 = lshr i32 %17, 3
  %.1 = add nuw nsw i32 %15, %13
  %.2 = add nuw nsw i32 %.1, %.0
  %19 = add nuw nsw i32 %.2, %18
  ret i32 %19
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) 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 = { 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 #2 = { 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)"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass