; LLVM IR from microsoft/LightAIMD :: src (diagnostics)

; 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.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local void @print_u32_array(ptr noundef %0, i64 noundef %1, i64 noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  store i64 %2, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %16 = load i64, ptr %5, align 8, !tbaa !9
  %17 = load i64, ptr %6, align 8, !tbaa !9
  %18 = udiv i64 %16, %17
  store i64 %18, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %19 = load i64, ptr %5, align 8, !tbaa !9
  %20 = load i64, ptr %6, align 8, !tbaa !9
  %21 = urem i64 %19, %20
  store i64 %21, ptr %8, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %22 = load i64, ptr %6, align 8, !tbaa !9
  %23 = mul i64 %22, 6
  %24 = sub i64 %23, 1
  store i64 %24, ptr %9, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  store i64 0, ptr %10, align 8, !tbaa !9
  br label %25

25:                                               ; preds = %32, %3
  %26 = load i64, ptr %10, align 8, !tbaa !9
  %27 = load i64, ptr %9, align 8, !tbaa !9
  %28 = icmp ult i64 %26, %27
  br i1 %28, label %30, label %29

29:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br label %35

30:                                               ; preds = %25
  %31 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  br label %32

32:                                               ; preds = %30
  %33 = load i64, ptr %10, align 8, !tbaa !9
  %34 = add i64 %33, 1
  store i64 %34, ptr %10, align 8, !tbaa !9
  br label %25, !llvm.loop !11

35:                                               ; preds = %29
  %36 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  store i64 0, ptr %11, align 8, !tbaa !9
  br label %37

37:                                               ; preds = %63, %35
  %38 = load i64, ptr %11, align 8, !tbaa !9
  %39 = load i64, ptr %7, align 8, !tbaa !9
  %40 = icmp ult i64 %38, %39
  br i1 %40, label %42, label %41

41:                                               ; preds = %37
  store i32 5, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  br label %66

42:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  store i64 0, ptr %13, align 8, !tbaa !9
  br label %43

43:                                               ; preds = %58, %42
  %44 = load i64, ptr %13, align 8, !tbaa !9
  %45 = load i64, ptr %6, align 8, !tbaa !9
  %46 = icmp ult i64 %44, %45
  br i1 %46, label %48, label %47

47:                                               ; preds = %43
  store i32 8, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  br label %61

48:                                               ; preds = %43
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = load i64, ptr %11, align 8, !tbaa !9
  %51 = load i64, ptr %6, align 8, !tbaa !9
  %52 = mul i64 %50, %51
  %53 = load i64, ptr %13, align 8, !tbaa !9
  %54 = add i64 %52, %53
  %55 = getelementptr inbounds i32, ptr %49, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !13
  %57 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %56)
  br label %58

58:                                               ; preds = %48
  %59 = load i64, ptr %13, align 8, !tbaa !9
  %60 = add i64 %59, 1
  store i64 %60, ptr %13, align 8, !tbaa !9
  br label %43, !llvm.loop !15

61:                                               ; preds = %47
  %62 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  br label %63

63:                                               ; preds = %61
  %64 = load i64, ptr %11, align 8, !tbaa !9
  %65 = add i64 %64, 1
  store i64 %65, ptr %11, align 8, !tbaa !9
  br label %37, !llvm.loop !16

66:                                               ; preds = %41
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  store i64 0, ptr %14, align 8, !tbaa !9
  br label %67

67:                                               ; preds = %82, %66
  %68 = load i64, ptr %14, align 8, !tbaa !9
  %69 = load i64, ptr %8, align 8, !tbaa !9
  %70 = icmp ult i64 %68, %69
  br i1 %70, label %72, label %71

71:                                               ; preds = %67
  store i32 11, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  br label %85

72:                                               ; preds = %67
  %73 = load ptr, ptr %4, align 8, !tbaa !5
  %74 = load i64, ptr %7, align 8, !tbaa !9
  %75 = load i64, ptr %6, align 8, !tbaa !9
  %76 = mul i64 %74, %75
  %77 = load i64, ptr %14, align 8, !tbaa !9
  %78 = add i64 %76, %77
  %79 = getelementptr inbounds i32, ptr %73, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !13
  %81 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %80)
  br label %82

82:                                               ; preds = %72
  %83 = load i64, ptr %14, align 8, !tbaa !9
  %84 = add i64 %83, 1
  store i64 %84, ptr %14, align 8, !tbaa !9
  br label %67, !llvm.loop !17

85:                                               ; preds = %71
  %86 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  store i64 0, ptr %15, align 8, !tbaa !9
  br label %87

87:                                               ; preds = %94, %85
  %88 = load i64, ptr %15, align 8, !tbaa !9
  %89 = load i64, ptr %9, align 8, !tbaa !9
  %90 = icmp ult i64 %88, %89
  br i1 %90, label %92, label %91

91:                                               ; preds = %87
  store i32 14, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  br label %97

92:                                               ; preds = %87
  %93 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  br label %94

94:                                               ; preds = %92
  %95 = load i64, ptr %15, align 8, !tbaa !9
  %96 = add i64 %95, 1
  store i64 %96, ptr %15, align 8, !tbaa !9
  br label %87, !llvm.loop !18

97:                                               ; preds = %91
  %98 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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"="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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


; 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.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [4 x i8], align 1

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

; Function Attrs: nofree nounwind uwtable
define dso_local void @print_u32_array(ptr nocapture noundef readonly %0, i64 noundef %1, i64 noundef %2) local_unnamed_addr #1 {
  %4 = udiv i64 %1, %2
  %5 = urem i64 %1, %2
  %6 = mul i64 %2, 6
  %7 = add i64 %6, -1
  br label %10

8:                                                ; preds = %10
  %9 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  %.not = icmp ugt i64 %2, %1
  br i1 %.not, label %.preheader, label %.preheader34.preheader

.preheader34.preheader:                           ; preds = %8
  %umax = tail call i64 @llvm.umax.i64(i64 %2, i64 1)
  br label %.preheader34

10:                                               ; preds = %3, %10
  %.03035 = phi i64 [ 0, %3 ], [ %12, %10 ]
  %11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %12 = add nuw i64 %.03035, 1
  %exitcond.not = icmp eq i64 %12, %7
  br i1 %exitcond.not, label %8, label %10, !llvm.loop !5

.preheader34:                                     ; preds = %.preheader34.preheader, %17
  %.02937 = phi i64 [ %19, %17 ], [ 0, %.preheader34.preheader ]
  %13 = mul i64 %.02937, %2
  %14 = getelementptr i32, ptr %0, i64 %13
  br label %21

.preheader:                                       ; preds = %17, %8
  %.not40 = icmp eq i64 %5, 0
  br i1 %.not40, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader
  %15 = mul i64 %4, %2
  %16 = getelementptr i32, ptr %0, i64 %15
  br label %27

17:                                               ; preds = %21
  %18 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  %19 = add nuw i64 %.02937, 1
  %20 = icmp ult i64 %19, %4
  br i1 %20, label %.preheader34, label %.preheader, !llvm.loop !7

21:                                               ; preds = %.preheader34, %21
  %.02836 = phi i64 [ 0, %.preheader34 ], [ %25, %21 ]
  %22 = getelementptr i32, ptr %14, i64 %.02836
  %23 = load i32, ptr %22, align 4, !tbaa !8
  %24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %23)
  %25 = add nuw i64 %.02836, 1
  %exitcond41.not = icmp eq i64 %25, %umax
  br i1 %exitcond41.not, label %17, label %21, !llvm.loop !12

._crit_edge:                                      ; preds = %27, %.preheader
  %26 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %35

27:                                               ; preds = %.lr.ph, %27
  %.02738 = phi i64 [ 0, %.lr.ph ], [ %31, %27 ]
  %28 = getelementptr i32, ptr %16, i64 %.02738
  %29 = load i32, ptr %28, align 4, !tbaa !8
  %30 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %29)
  %31 = add nuw i64 %.02738, 1
  %32 = icmp ult i64 %31, %5
  br i1 %32, label %27, label %._crit_edge, !llvm.loop !13

33:                                               ; preds = %35
  %34 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  ret void

35:                                               ; preds = %._crit_edge, %35
  %.039 = phi i64 [ 0, %._crit_edge ], [ %37, %35 ]
  %36 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  %37 = add nuw i64 %.039, 1
  %exitcond42.not = icmp eq i64 %37, %7
  br i1 %exitcond42.not, label %33, label %35, !llvm.loop !14
}

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.umax.i64(i64, i64) #2

attributes #0 = { 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 #1 = { nofree 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 #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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"}
!7 = distinct !{!7, !6}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C/C++ TBAA"}
!12 = distinct !{!12, !6}
!13 = distinct !{!13, !6}
!14 = distinct !{!14, !6}


; Effective O3 passes: CorrelatedValuePropagationPass,DivRemPairsPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass