; LLVM IR from cruppstahl/upscaledb :: 3rdparty/libfor (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"

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

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #3
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #3
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %4

4:                                                ; preds = %9, %0
  %5 = load i32, ptr %2, align 4, !tbaa !5
  %6 = icmp sle i32 %5, 32
  br i1 %6, label %7, label %12

7:                                                ; preds = %4
  %8 = load i32, ptr %2, align 4, !tbaa !5
  call void @lowlevel_block32(i32 noundef %8)
  br label %9

9:                                                ; preds = %7
  %10 = load i32, ptr %2, align 4, !tbaa !5
  %11 = add nsw i32 %10, 1
  store i32 %11, ptr %2, align 4, !tbaa !5
  br label %4, !llvm.loop !9

12:                                               ; preds = %4
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %13

13:                                               ; preds = %18, %12
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = icmp sle i32 %14, 32
  br i1 %15, label %16, label %21

16:                                               ; preds = %13
  %17 = load i32, ptr %2, align 4, !tbaa !5
  call void @lowlevel_block16(i32 noundef %17)
  br label %18

18:                                               ; preds = %16
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = add nsw i32 %19, 1
  store i32 %20, ptr %2, align 4, !tbaa !5
  br label %13, !llvm.loop !11

21:                                               ; preds = %13
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %27, %21
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = icmp sle i32 %23, 32
  br i1 %24, label %25, label %30

25:                                               ; preds = %22
  %26 = load i32, ptr %2, align 4, !tbaa !5
  call void @lowlevel_block8(i32 noundef %26)
  br label %27

27:                                               ; preds = %25
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = add nsw i32 %28, 1
  store i32 %29, ptr %2, align 4, !tbaa !5
  br label %22, !llvm.loop !12

30:                                               ; preds = %22
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %45, %30
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = icmp slt i32 %32, 32
  br i1 %33, label %34, label %48

34:                                               ; preds = %31
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %35

35:                                               ; preds = %41, %34
  %36 = load i32, ptr %3, align 4, !tbaa !5
  %37 = icmp slt i32 %36, 8
  br i1 %37, label %38, label %44

38:                                               ; preds = %35
  %39 = load i32, ptr %3, align 4, !tbaa !5
  %40 = load i32, ptr %2, align 4, !tbaa !5
  call void @lowlevel_blockx(i32 noundef %39, i32 noundef %40)
  br label %41

41:                                               ; preds = %38
  %42 = load i32, ptr %3, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %3, align 4, !tbaa !5
  br label %35, !llvm.loop !13

44:                                               ; preds = %35
  br label %45

45:                                               ; preds = %44
  %46 = load i32, ptr %2, align 4, !tbaa !5
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %2, align 4, !tbaa !5
  br label %31, !llvm.loop !14

48:                                               ; preds = %31
  call void @highlevel_sorted(i32 noundef 0)
  call void @highlevel_sorted(i32 noundef 1)
  call void @highlevel_sorted(i32 noundef 2)
  call void @highlevel_sorted(i32 noundef 3)
  call void @highlevel_sorted(i32 noundef 16)
  call void @highlevel_sorted(i32 noundef 17)
  call void @highlevel_sorted(i32 noundef 32)
  call void @highlevel_sorted(i32 noundef 33)
  call void @highlevel_sorted(i32 noundef 64)
  call void @highlevel_sorted(i32 noundef 65)
  call void @highlevel_sorted(i32 noundef 128)
  call void @highlevel_sorted(i32 noundef 129)
  call void @highlevel_sorted(i32 noundef 256)
  call void @highlevel_sorted(i32 noundef 257)
  call void @highlevel_sorted(i32 noundef 1024)
  call void @highlevel_sorted(i32 noundef 1025)
  call void @highlevel_sorted(i32 noundef 1333)
  call void @highlevel_unsorted(i32 noundef 0)
  call void @highlevel_unsorted(i32 noundef 1)
  call void @highlevel_unsorted(i32 noundef 2)
  call void @highlevel_unsorted(i32 noundef 3)
  call void @highlevel_unsorted(i32 noundef 16)
  call void @highlevel_unsorted(i32 noundef 17)
  call void @highlevel_unsorted(i32 noundef 32)
  call void @highlevel_unsorted(i32 noundef 33)
  call void @highlevel_unsorted(i32 noundef 64)
  call void @highlevel_unsorted(i32 noundef 65)
  call void @highlevel_unsorted(i32 noundef 128)
  call void @highlevel_unsorted(i32 noundef 129)
  call void @highlevel_unsorted(i32 noundef 256)
  call void @highlevel_unsorted(i32 noundef 257)
  call void @highlevel_unsorted(i32 noundef 1024)
  call void @highlevel_unsorted(i32 noundef 1025)
  call void @highlevel_unsorted(i32 noundef 1333)
  %49 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #3
  ret i32 0
}

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

; Function Attrs: nounwind uwtable
declare hidden void @lowlevel_block32(i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @lowlevel_block16(i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @lowlevel_block8(i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @lowlevel_blockx(i32 noundef, i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @highlevel_sorted(i32 noundef) #0

; Function Attrs: nounwind uwtable
declare hidden void @highlevel_unsorted(i32 noundef) #0

declare i32 @printf(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 = { "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 }

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}


; 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

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
.preheader18.preheader:
  tail call void @lowlevel_block32(i32 noundef 0)
  tail call void @lowlevel_block32(i32 noundef 1)
  tail call void @lowlevel_block32(i32 noundef 2)
  tail call void @lowlevel_block32(i32 noundef 3)
  tail call void @lowlevel_block32(i32 noundef 4)
  tail call void @lowlevel_block32(i32 noundef 5)
  tail call void @lowlevel_block32(i32 noundef 6)
  tail call void @lowlevel_block32(i32 noundef 7)
  tail call void @lowlevel_block32(i32 noundef 8)
  tail call void @lowlevel_block32(i32 noundef 9)
  tail call void @lowlevel_block32(i32 noundef 10)
  tail call void @lowlevel_block32(i32 noundef 11)
  tail call void @lowlevel_block32(i32 noundef 12)
  tail call void @lowlevel_block32(i32 noundef 13)
  tail call void @lowlevel_block32(i32 noundef 14)
  tail call void @lowlevel_block32(i32 noundef 15)
  tail call void @lowlevel_block32(i32 noundef 16)
  tail call void @lowlevel_block32(i32 noundef 17)
  tail call void @lowlevel_block32(i32 noundef 18)
  tail call void @lowlevel_block32(i32 noundef 19)
  tail call void @lowlevel_block32(i32 noundef 20)
  tail call void @lowlevel_block32(i32 noundef 21)
  tail call void @lowlevel_block32(i32 noundef 22)
  tail call void @lowlevel_block32(i32 noundef 23)
  tail call void @lowlevel_block32(i32 noundef 24)
  tail call void @lowlevel_block32(i32 noundef 25)
  tail call void @lowlevel_block32(i32 noundef 26)
  tail call void @lowlevel_block32(i32 noundef 27)
  tail call void @lowlevel_block32(i32 noundef 28)
  tail call void @lowlevel_block32(i32 noundef 29)
  tail call void @lowlevel_block32(i32 noundef 30)
  tail call void @lowlevel_block32(i32 noundef 31)
  tail call void @lowlevel_block32(i32 noundef 32)
  tail call void @lowlevel_block16(i32 noundef 0)
  tail call void @lowlevel_block16(i32 noundef 1)
  tail call void @lowlevel_block16(i32 noundef 2)
  tail call void @lowlevel_block16(i32 noundef 3)
  tail call void @lowlevel_block16(i32 noundef 4)
  tail call void @lowlevel_block16(i32 noundef 5)
  tail call void @lowlevel_block16(i32 noundef 6)
  tail call void @lowlevel_block16(i32 noundef 7)
  tail call void @lowlevel_block16(i32 noundef 8)
  tail call void @lowlevel_block16(i32 noundef 9)
  tail call void @lowlevel_block16(i32 noundef 10)
  tail call void @lowlevel_block16(i32 noundef 11)
  tail call void @lowlevel_block16(i32 noundef 12)
  tail call void @lowlevel_block16(i32 noundef 13)
  tail call void @lowlevel_block16(i32 noundef 14)
  tail call void @lowlevel_block16(i32 noundef 15)
  tail call void @lowlevel_block16(i32 noundef 16)
  tail call void @lowlevel_block16(i32 noundef 17)
  tail call void @lowlevel_block16(i32 noundef 18)
  tail call void @lowlevel_block16(i32 noundef 19)
  tail call void @lowlevel_block16(i32 noundef 20)
  tail call void @lowlevel_block16(i32 noundef 21)
  tail call void @lowlevel_block16(i32 noundef 22)
  tail call void @lowlevel_block16(i32 noundef 23)
  tail call void @lowlevel_block16(i32 noundef 24)
  tail call void @lowlevel_block16(i32 noundef 25)
  tail call void @lowlevel_block16(i32 noundef 26)
  tail call void @lowlevel_block16(i32 noundef 27)
  tail call void @lowlevel_block16(i32 noundef 28)
  tail call void @lowlevel_block16(i32 noundef 29)
  tail call void @lowlevel_block16(i32 noundef 30)
  tail call void @lowlevel_block16(i32 noundef 31)
  tail call void @lowlevel_block16(i32 noundef 32)
  tail call void @lowlevel_block8(i32 noundef 0)
  tail call void @lowlevel_block8(i32 noundef 1)
  tail call void @lowlevel_block8(i32 noundef 2)
  tail call void @lowlevel_block8(i32 noundef 3)
  tail call void @lowlevel_block8(i32 noundef 4)
  tail call void @lowlevel_block8(i32 noundef 5)
  tail call void @lowlevel_block8(i32 noundef 6)
  tail call void @lowlevel_block8(i32 noundef 7)
  tail call void @lowlevel_block8(i32 noundef 8)
  tail call void @lowlevel_block8(i32 noundef 9)
  tail call void @lowlevel_block8(i32 noundef 10)
  tail call void @lowlevel_block8(i32 noundef 11)
  tail call void @lowlevel_block8(i32 noundef 12)
  tail call void @lowlevel_block8(i32 noundef 13)
  tail call void @lowlevel_block8(i32 noundef 14)
  tail call void @lowlevel_block8(i32 noundef 15)
  tail call void @lowlevel_block8(i32 noundef 16)
  tail call void @lowlevel_block8(i32 noundef 17)
  tail call void @lowlevel_block8(i32 noundef 18)
  tail call void @lowlevel_block8(i32 noundef 19)
  tail call void @lowlevel_block8(i32 noundef 20)
  tail call void @lowlevel_block8(i32 noundef 21)
  tail call void @lowlevel_block8(i32 noundef 22)
  tail call void @lowlevel_block8(i32 noundef 23)
  tail call void @lowlevel_block8(i32 noundef 24)
  tail call void @lowlevel_block8(i32 noundef 25)
  tail call void @lowlevel_block8(i32 noundef 26)
  tail call void @lowlevel_block8(i32 noundef 27)
  tail call void @lowlevel_block8(i32 noundef 28)
  tail call void @lowlevel_block8(i32 noundef 29)
  tail call void @lowlevel_block8(i32 noundef 30)
  tail call void @lowlevel_block8(i32 noundef 31)
  tail call void @lowlevel_block8(i32 noundef 32)
  br label %.preheader

.preheader:                                       ; preds = %.preheader18.preheader, %.preheader
  %.323 = phi i32 [ %0, %.preheader ], [ 0, %.preheader18.preheader ]
  tail call void @lowlevel_blockx(i32 noundef 0, i32 noundef %.323)
  tail call void @lowlevel_blockx(i32 noundef 1, i32 noundef %.323)
  tail call void @lowlevel_blockx(i32 noundef 2, i32 noundef %.323)
  tail call void @lowlevel_blockx(i32 noundef 3, i32 noundef %.323)
  tail call void @lowlevel_blockx(i32 noundef 4, i32 noundef %.323)
  tail call void @lowlevel_blockx(i32 noundef 5, i32 noundef %.323)
  tail call void @lowlevel_blockx(i32 noundef 6, i32 noundef %.323)
  tail call void @lowlevel_blockx(i32 noundef 7, i32 noundef %.323)
  %0 = add nuw nsw i32 %.323, 1
  %exitcond.not = icmp eq i32 %0, 32
  br i1 %exitcond.not, label %1, label %.preheader, !llvm.loop !5

1:                                                ; preds = %.preheader
  tail call void @highlevel_sorted(i32 noundef 0)
  tail call void @highlevel_sorted(i32 noundef 1)
  tail call void @highlevel_sorted(i32 noundef 2)
  tail call void @highlevel_sorted(i32 noundef 3)
  tail call void @highlevel_sorted(i32 noundef 16)
  tail call void @highlevel_sorted(i32 noundef 17)
  tail call void @highlevel_sorted(i32 noundef 32)
  tail call void @highlevel_sorted(i32 noundef 33)
  tail call void @highlevel_sorted(i32 noundef 64)
  tail call void @highlevel_sorted(i32 noundef 65)
  tail call void @highlevel_sorted(i32 noundef 128)
  tail call void @highlevel_sorted(i32 noundef 129)
  tail call void @highlevel_sorted(i32 noundef 256)
  tail call void @highlevel_sorted(i32 noundef 257)
  tail call void @highlevel_sorted(i32 noundef 1024)
  tail call void @highlevel_sorted(i32 noundef 1025)
  tail call void @highlevel_sorted(i32 noundef 1333)
  tail call void @highlevel_unsorted(i32 noundef 0)
  tail call void @highlevel_unsorted(i32 noundef 1)
  tail call void @highlevel_unsorted(i32 noundef 2)
  tail call void @highlevel_unsorted(i32 noundef 3)
  tail call void @highlevel_unsorted(i32 noundef 16)
  tail call void @highlevel_unsorted(i32 noundef 17)
  tail call void @highlevel_unsorted(i32 noundef 32)
  tail call void @highlevel_unsorted(i32 noundef 33)
  tail call void @highlevel_unsorted(i32 noundef 64)
  tail call void @highlevel_unsorted(i32 noundef 65)
  tail call void @highlevel_unsorted(i32 noundef 128)
  tail call void @highlevel_unsorted(i32 noundef 129)
  tail call void @highlevel_unsorted(i32 noundef 256)
  tail call void @highlevel_unsorted(i32 noundef 257)
  tail call void @highlevel_unsorted(i32 noundef 1024)
  tail call void @highlevel_unsorted(i32 noundef 1025)
  tail call void @highlevel_unsorted(i32 noundef 1333)
  %2 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  ret i32 0
}

; Function Attrs: nounwind uwtable
declare hidden void @lowlevel_block32(i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @lowlevel_block16(i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @lowlevel_block8(i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @lowlevel_blockx(i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @highlevel_sorted(i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden void @highlevel_unsorted(i32 noundef) local_unnamed_addr #0

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

!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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


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