; LLVM IR from VastoLorde95/Competitive-Programming :: SPOJ/Random/INCDSEQ (inc)

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

%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }

@MOD = external dso_local global i32, align 4
@N = external dso_local global i32, align 4
@f = external dso_local global [52 x [10001 x i32]], align 16
@r = external dso_local global [52 x [10001 x i32]], align 16
@INDEX = external dso_local global i32, align 4
@seq = external dso_local global [10001 x i32], align 16
@v = external dso_local global [10001 x i32], align 16
@k = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@t = external dso_local global i32, align 4
@z = external dso_local global i32, align 4
@temp = external dso_local global i32, align 4
@last = external dso_local global %"class.std::map", align 8
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3getPii(ptr noundef, i32 noundef) #0

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z6updatePiii(ptr noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %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 ptr, align 8
  store i32 0, ptr %1, align 4
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @k)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %9

9:                                                ; preds = %26, %0
  %10 = load i32, ptr %2, align 4, !tbaa !5
  %11 = load i32, ptr @n, align 4, !tbaa !5
  %12 = icmp slt i32 %10, %11
  br i1 %12, label %14, label %13

13:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %29

14:                                               ; preds = %9
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds i32, ptr @seq, i64 %16
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %17)
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [10001 x i32], ptr @seq, i64 0, i64 %20
  %22 = load i32, ptr %21, align 4, !tbaa !5
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [10001 x i32], ptr @v, i64 0, i64 %24
  store i32 %22, ptr %25, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %14
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %2, align 4, !tbaa !5
  br label %9, !llvm.loop !9

29:                                               ; preds = %13
  %30 = load i32, ptr @n, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds i32, ptr @seq, i64 %31
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @seq, ptr noundef %32)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %33

33:                                               ; preds = %52, %29
  %34 = load i32, ptr %3, align 4, !tbaa !5
  %35 = load i32, ptr @n, align 4, !tbaa !5
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %55

38:                                               ; preds = %33
  %39 = load i32, ptr %3, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [10001 x i32], ptr @seq, i64 0, i64 %40
  %42 = call noundef i64 @_ZNKSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48) @last, ptr noundef nonnull align 4 dereferenceable(4) %41)
  %43 = icmp ne i64 %42, 0
  br i1 %43, label %51, label %44

44:                                               ; preds = %38
  %45 = load i32, ptr @INDEX, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr @INDEX, align 4, !tbaa !5
  %47 = load i32, ptr %3, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [10001 x i32], ptr @seq, i64 0, i64 %48
  %50 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @last, ptr noundef nonnull align 4 dereferenceable(4) %49)
  store i32 %46, ptr %50, align 4, !tbaa !5
  br label %51

51:                                               ; preds = %44, %38
  br label %52

52:                                               ; preds = %51
  %53 = load i32, ptr %3, align 4, !tbaa !5
  %54 = add nsw i32 %53, 1
  store i32 %54, ptr %3, align 4, !tbaa !5
  br label %33, !llvm.loop !11

55:                                               ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %56

56:                                               ; preds = %118, %55
  %57 = load i32, ptr %4, align 4, !tbaa !5
  %58 = load i32, ptr @n, align 4, !tbaa !5
  %59 = icmp slt i32 %57, %58
  br i1 %59, label %61, label %60

60:                                               ; preds = %56
  store i32 8, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %121

61:                                               ; preds = %56
  %62 = load i32, ptr %4, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [10001 x i32], ptr @v, i64 0, i64 %63
  %65 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @last, ptr noundef nonnull align 4 dereferenceable(4) %64)
  %66 = load i32, ptr %65, align 4, !tbaa !5
  store i32 %66, ptr @z, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 1, ptr %6, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %114, %61
  %68 = load i32, ptr %6, align 4, !tbaa !5
  %69 = load i32, ptr @k, align 4, !tbaa !5
  %70 = icmp sle i32 %68, %69
  br i1 %70, label %72, label %71

71:                                               ; preds = %67
  store i32 11, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %117

72:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = sub nsw i32 %73, 1
  %75 = sext i32 %74 to i64
  %76 = getelementptr inbounds [52 x [10001 x i32]], ptr @r, i64 0, i64 %75
  %77 = load i32, ptr @z, align 4, !tbaa !5
  %78 = sub nsw i32 %77, 1
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [10001 x i32], ptr %76, i64 0, i64 %79
  store ptr %80, ptr %7, align 8, !tbaa !12
  %81 = load i32, ptr %6, align 4, !tbaa !5
  %82 = sub nsw i32 %81, 1
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [52 x [10001 x i32]], ptr @f, i64 0, i64 %83
  %85 = getelementptr inbounds [10001 x i32], ptr %84, i64 0, i64 0
  %86 = load i32, ptr @z, align 4, !tbaa !5
  %87 = sub nsw i32 %86, 1
  %88 = call noundef i32 @_Z3getPii(ptr noundef %85, i32 noundef %87)
  store i32 %88, ptr @t, align 4, !tbaa !5
  %89 = load i32, ptr @t, align 4, !tbaa !5
  %90 = load ptr, ptr %7, align 8, !tbaa !12
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = icmp ne i32 %89, %91
  br i1 %92, label %93, label %113

93:                                               ; preds = %72
  %94 = load i32, ptr @t, align 4, !tbaa !5
  store i32 %94, ptr @temp, align 4, !tbaa !5
  %95 = load ptr, ptr %7, align 8, !tbaa !12
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = load i32, ptr @t, align 4, !tbaa !5
  %98 = sub nsw i32 %97, %96
  store i32 %98, ptr @t, align 4, !tbaa !5
  %99 = icmp slt i32 %98, 0
  br i1 %99, label %100, label %104

100:                                              ; preds = %93
  %101 = load i32, ptr @MOD, align 4, !tbaa !5
  %102 = load i32, ptr @t, align 4, !tbaa !5
  %103 = add nsw i32 %102, %101
  store i32 %103, ptr @t, align 4, !tbaa !5
  br label %104

104:                                              ; preds = %100, %93
  %105 = load i32, ptr @temp, align 4, !tbaa !5
  %106 = load ptr, ptr %7, align 8, !tbaa !12
  store i32 %105, ptr %106, align 4, !tbaa !5
  %107 = load i32, ptr %6, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [52 x [10001 x i32]], ptr @f, i64 0, i64 %108
  %110 = getelementptr inbounds [10001 x i32], ptr %109, i64 0, i64 0
  %111 = load i32, ptr @z, align 4, !tbaa !5
  %112 = load i32, ptr @t, align 4, !tbaa !5
  call void @_Z6updatePiii(ptr noundef %110, i32 noundef %111, i32 noundef %112)
  br label %113

113:                                              ; preds = %104, %72
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %114

114:                                              ; preds = %113
  %115 = load i32, ptr %6, align 4, !tbaa !5
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr %6, align 4, !tbaa !5
  br label %67, !llvm.loop !14

117:                                              ; preds = %71
  br label %118

118:                                              ; preds = %117
  %119 = load i32, ptr %4, align 4, !tbaa !5
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %4, align 4, !tbaa !5
  br label %56, !llvm.loop !15

121:                                              ; preds = %60
  %122 = load i32, ptr @k, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [52 x [10001 x i32]], ptr @f, i64 0, i64 %123
  %125 = getelementptr inbounds [10001 x i32], ptr %124, i64 0, i64 0
  %126 = load i32, ptr @N, align 4, !tbaa !5
  %127 = call noundef i32 @_Z3getPii(ptr noundef %125, i32 noundef %126)
  %128 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %127)
  ret i32 0
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #5 align 2

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

attributes #0 = { mustprogress 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 = { mustprogress norecurse 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 = { "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 = { inlinehint mustprogress 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 #5 = { mustprogress 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 #6 = { 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++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!13, !13, i64 0}
!13 = !{!"any pointer", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !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"

%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }

@MOD = external dso_local local_unnamed_addr global i32, align 4
@N = external dso_local local_unnamed_addr global i32, align 4
@f = external dso_local global [52 x [10001 x i32]], align 16
@r = external dso_local local_unnamed_addr global [52 x [10001 x i32]], align 16
@INDEX = external dso_local local_unnamed_addr global i32, align 4
@seq = external dso_local global [10001 x i32], align 16
@v = external dso_local global [10001 x i32], align 16
@k = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@t = external dso_local local_unnamed_addr global i32, align 4
@z = external dso_local local_unnamed_addr global i32, align 4
@temp = external dso_local local_unnamed_addr global i32, align 4
@last = external dso_local global %"class.std::map", align 8
@.str = external hidden unnamed_addr constant [6 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3getPii(ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z6updatePiii(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @k)
  %2 = load i32, ptr @n, align 4, !tbaa !5
  %3 = icmp sgt i32 %2, 0
  br i1 %3, label %.lr.ph, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre50 = sext i32 %2 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre50, %.._crit_edge_crit_edge ], [ %12, %.lr.ph ]
  %4 = getelementptr inbounds i32, ptr @seq, i64 %.pre-phi
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @seq, ptr noundef nonnull %4)
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph30, label %.preheader.._crit_edge38_crit_edge

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %7 = getelementptr inbounds i32, ptr @seq, i64 %indvars.iv
  %8 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %7)
  %9 = load i32, ptr %7, align 4, !tbaa !5
  %10 = getelementptr inbounds [10001 x i32], ptr @v, i64 0, i64 %indvars.iv
  store i32 %9, ptr %10, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %11 = load i32, ptr @n, align 4, !tbaa !5
  %12 = sext i32 %11 to i64
  %13 = icmp slt i64 %indvars.iv.next, %12
  br i1 %13, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.preheader:                                       ; preds = %21
  %14 = icmp sgt i32 %22, 0
  br i1 %14, label %.lr.ph37, label %.preheader.._crit_edge38_crit_edge

.preheader.._crit_edge38_crit_edge:               ; preds = %._crit_edge, %.preheader
  %.pre = load i32, ptr @k, align 4, !tbaa !5
  br label %._crit_edge38

.lr.ph30:                                         ; preds = %._crit_edge, %21
  %indvars.iv41 = phi i64 [ %indvars.iv.next42, %21 ], [ 0, %._crit_edge ]
  %15 = getelementptr inbounds [10001 x i32], ptr @seq, i64 0, i64 %indvars.iv41
  %16 = tail call noundef i64 @_ZNKSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48) @last, ptr noundef nonnull align 4 dereferenceable(4) %15)
  %.not26 = icmp eq i64 %16, 0
  br i1 %.not26, label %17, label %21

17:                                               ; preds = %.lr.ph30
  %18 = load i32, ptr @INDEX, align 4, !tbaa !5
  %19 = add nsw i32 %18, 1
  store i32 %19, ptr @INDEX, align 4, !tbaa !5
  %20 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @last, ptr noundef nonnull align 4 dereferenceable(4) %15)
  store i32 %19, ptr %20, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %.lr.ph30, %17
  %indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
  %22 = load i32, ptr @n, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = icmp slt i64 %indvars.iv.next42, %23
  br i1 %24, label %.lr.ph30, label %.preheader, !llvm.loop !11

._crit_edge38:                                    ; preds = %._crit_edge35, %.preheader.._crit_edge38_crit_edge
  %25 = phi i32 [ %.pre, %.preheader.._crit_edge38_crit_edge ], [ %35, %._crit_edge35 ]
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [52 x [10001 x i32]], ptr @f, i64 0, i64 %26
  %28 = load i32, ptr @N, align 4, !tbaa !5
  %29 = tail call noundef i32 @_Z3getPii(ptr noundef nonnull %27, i32 noundef %28)
  %30 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %29)
  ret i32 0

.lr.ph37:                                         ; preds = %.preheader, %._crit_edge35
  %indvars.iv47 = phi i64 [ %indvars.iv.next48, %._crit_edge35 ], [ 0, %.preheader ]
  %31 = getelementptr inbounds [10001 x i32], ptr @v, i64 0, i64 %indvars.iv47
  %32 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @last, ptr noundef nonnull align 4 dereferenceable(4) %31)
  %33 = load i32, ptr %32, align 4, !tbaa !5
  store i32 %33, ptr @z, align 4, !tbaa !5
  %34 = load i32, ptr @k, align 4, !tbaa !5
  %.not31 = icmp slt i32 %34, 1
  br i1 %.not31, label %._crit_edge35, label %.lr.ph34

._crit_edge35:                                    ; preds = %57, %.lr.ph37
  %35 = phi i32 [ %34, %.lr.ph37 ], [ %58, %57 ]
  %indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
  %36 = load i32, ptr @n, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = icmp slt i64 %indvars.iv.next48, %37
  br i1 %38, label %.lr.ph37, label %._crit_edge38, !llvm.loop !12

.lr.ph34:                                         ; preds = %.lr.ph37, %57
  %indvars.iv44 = phi i64 [ %indvars.iv.next45, %57 ], [ 1, %.lr.ph37 ]
  %39 = add nsw i64 %indvars.iv44, -1
  %40 = load i32, ptr @z, align 4, !tbaa !5
  %41 = add nsw i32 %40, -1
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [52 x [10001 x i32]], ptr @r, i64 0, i64 %39, i64 %42
  %44 = getelementptr inbounds [52 x [10001 x i32]], ptr @f, i64 0, i64 %39
  %45 = tail call noundef i32 @_Z3getPii(ptr noundef nonnull %44, i32 noundef %41)
  store i32 %45, ptr @t, align 4, !tbaa !5
  %46 = load i32, ptr %43, align 4, !tbaa !5
  %.not25 = icmp eq i32 %45, %46
  br i1 %.not25, label %57, label %47

47:                                               ; preds = %.lr.ph34
  store i32 %45, ptr @temp, align 4, !tbaa !5
  %48 = sub nsw i32 %45, %46
  store i32 %48, ptr @t, align 4, !tbaa !5
  %49 = icmp slt i32 %48, 0
  br i1 %49, label %50, label %53

50:                                               ; preds = %47
  %51 = load i32, ptr @MOD, align 4, !tbaa !5
  %52 = add nsw i32 %51, %48
  store i32 %52, ptr @t, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %50, %47
  %54 = phi i32 [ %52, %50 ], [ %48, %47 ]
  store i32 %45, ptr %43, align 4, !tbaa !5
  %55 = getelementptr inbounds [52 x [10001 x i32]], ptr @f, i64 0, i64 %indvars.iv44
  %56 = load i32, ptr @z, align 4, !tbaa !5
  tail call void @_Z6updatePiii(ptr noundef nonnull %55, i32 noundef %56, i32 noundef %54)
  br label %57

57:                                               ; preds = %53, %.lr.ph34
  %indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
  %58 = load i32, ptr @k, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %.not.not = icmp slt i64 %indvars.iv44, %59
  br i1 %.not.not, label %.lr.ph34, label %._crit_edge35, !llvm.loop !13
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4 align 2

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

attributes #0 = { mustprogress 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 = { mustprogress norecurse 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 = { 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 #3 = { inlinehint mustprogress 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 #4 = { mustprogress 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" }

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


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass