; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/202 Division 2/Problem B (B)

; 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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@v = external dso_local global i32, align 4
@mn = external dso_local global i32, align 4
@ind = external dso_local global i32, align 4
@_Z3resB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@d = external dso_local global [10 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

8:                                                ; preds = %30, %0
  %9 = load i32, ptr %2, align 4, !tbaa !5
  %10 = icmp sle i32 %9, 9
  br i1 %10, label %12, label %11

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

12:                                               ; preds = %8
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds [10 x i32], ptr @d, i64 0, i64 %14
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %15)
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [10 x i32], ptr @d, i64 0, i64 %18
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = load i32, ptr @mn, align 4, !tbaa !5
  %22 = icmp sle i32 %20, %21
  br i1 %22, label %23, label %29

23:                                               ; preds = %12
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [10 x i32], ptr @d, i64 0, i64 %25
  %27 = load i32, ptr %26, align 4, !tbaa !5
  store i32 %27, ptr @mn, align 4, !tbaa !5
  %28 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %28, ptr @ind, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %23, %12
  br label %30

30:                                               ; preds = %29
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %2, align 4, !tbaa !5
  br label %8, !llvm.loop !9

33:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %34

34:                                               ; preds = %46, %33
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = load i32, ptr @v, align 4, !tbaa !5
  %37 = load i32, ptr @mn, align 4, !tbaa !5
  %38 = sdiv i32 %36, %37
  %39 = icmp sle i32 %35, %38
  br i1 %39, label %41, label %40

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

41:                                               ; preds = %34
  %42 = load i32, ptr @ind, align 4, !tbaa !5
  %43 = add nsw i32 %42, 48
  %44 = trunc i32 %43 to i8
  %45 = call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) @_Z3resB5cxx11, i8 noundef signext %44)
  br label %46

46:                                               ; preds = %41
  %47 = load i32, ptr %3, align 4, !tbaa !5
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %3, align 4, !tbaa !5
  br label %34, !llvm.loop !11

49:                                               ; preds = %40
  %50 = load i32, ptr @mn, align 4, !tbaa !5
  %51 = load i32, ptr @v, align 4, !tbaa !5
  %52 = srem i32 %51, %50
  store i32 %52, ptr @v, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %53

53:                                               ; preds = %112, %49
  %54 = load i32, ptr %4, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z3resB5cxx11) #6
  %57 = icmp ult i64 %55, %56
  br i1 %57, label %59, label %58

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

59:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 9, ptr %6, align 4, !tbaa !5
  br label %60

60:                                               ; preds = %107, %59
  %61 = load i32, ptr %6, align 4, !tbaa !5
  %62 = load i32, ptr @ind, align 4, !tbaa !5
  %63 = icmp sgt i32 %61, %62
  br i1 %63, label %65, label %64

64:                                               ; preds = %60
  store i32 11, ptr %5, align 4
  br label %110

65:                                               ; preds = %60
  %66 = load i32, ptr @v, align 4, !tbaa !5
  %67 = load i32, ptr %6, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [10 x i32], ptr @d, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = sub nsw i32 %66, %70
  %72 = load i32, ptr %4, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z3resB5cxx11, i64 noundef %73)
  %75 = load i8, ptr %74, align 1, !tbaa !12
  %76 = sext i8 %75 to i32
  %77 = sub nsw i32 %76, 48
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [10 x i32], ptr @d, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = add nsw i32 %71, %80
  %82 = icmp sge i32 %81, 0
  br i1 %82, label %83, label %106

83:                                               ; preds = %65
  %84 = load i32, ptr @v, align 4, !tbaa !5
  %85 = load i32, ptr %6, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [10 x i32], ptr @d, i64 0, i64 %86
  %88 = load i32, ptr %87, align 4, !tbaa !5
  %89 = sub nsw i32 %84, %88
  %90 = load i32, ptr %4, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z3resB5cxx11, i64 noundef %91)
  %93 = load i8, ptr %92, align 1, !tbaa !12
  %94 = sext i8 %93 to i32
  %95 = sub nsw i32 %94, 48
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [10 x i32], ptr @d, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = add nsw i32 %89, %98
  store i32 %99, ptr @v, align 4, !tbaa !5
  %100 = load i32, ptr %6, align 4, !tbaa !5
  %101 = add nsw i32 %100, 48
  %102 = trunc i32 %101 to i8
  %103 = load i32, ptr %4, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z3resB5cxx11, i64 noundef %104)
  store i8 %102, ptr %105, align 1, !tbaa !12
  store i32 11, ptr %5, align 4
  br label %110

106:                                              ; preds = %65
  br label %107

107:                                              ; preds = %106
  %108 = load i32, ptr %6, align 4, !tbaa !5
  %109 = add nsw i32 %108, -1
  store i32 %109, ptr %6, align 4, !tbaa !5
  br label %60, !llvm.loop !13

110:                                              ; preds = %83, %64
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %111

111:                                              ; preds = %110
  br label %112

112:                                              ; preds = %111
  %113 = load i32, ptr %4, align 4, !tbaa !5
  %114 = add nsw i32 %113, 1
  store i32 %114, ptr %4, align 4, !tbaa !5
  br label %53, !llvm.loop !14

115:                                              ; preds = %58
  %116 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z3resB5cxx11) #6
  %117 = icmp eq i64 %116, 0
  br i1 %117, label %118, label %121

118:                                              ; preds = %115
  %119 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  %120 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %119, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %124

121:                                              ; preds = %115
  %122 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull align 8 dereferenceable(32) @_Z3resB5cxx11)
  %123 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %122, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %124

124:                                              ; preds = %121, %118
  ret i32 0
}

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

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #4 align 2

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #1

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(32)) #5

attributes #0 = { 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 #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 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 #5 = { 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 #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 = !{!7, !7, i64 0}
!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"

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@v = external dso_local global i32, align 4
@mn = external dso_local local_unnamed_addr global i32, align 4
@ind = external dso_local local_unnamed_addr global i32, align 4
@_Z3resB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@d = external dso_local global [10 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @v)
  %2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds (i8, ptr @d, i64 4))
  %3 = load i32, ptr getelementptr inbounds (i8, ptr @d, i64 4), align 4, !tbaa !5
  %4 = load i32, ptr @mn, align 4, !tbaa !5
  %.not23 = icmp sgt i32 %3, %4
  br i1 %.not23, label %6, label %5

5:                                                ; preds = %0
  store i32 %3, ptr @mn, align 4, !tbaa !5
  store i32 1, ptr @ind, align 4, !tbaa !5
  br label %6

6:                                                ; preds = %0, %5
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds (i8, ptr @d, i64 8))
  %8 = load i32, ptr getelementptr inbounds (i8, ptr @d, i64 8), align 8, !tbaa !5
  %9 = load i32, ptr @mn, align 4, !tbaa !5
  %.not23.1 = icmp sgt i32 %8, %9
  br i1 %.not23.1, label %11, label %10

10:                                               ; preds = %6
  store i32 %8, ptr @mn, align 4, !tbaa !5
  store i32 2, ptr @ind, align 4, !tbaa !5
  br label %11

11:                                               ; preds = %10, %6
  %12 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds (i8, ptr @d, i64 12))
  %13 = load i32, ptr getelementptr inbounds (i8, ptr @d, i64 12), align 4, !tbaa !5
  %14 = load i32, ptr @mn, align 4, !tbaa !5
  %.not23.2 = icmp sgt i32 %13, %14
  br i1 %.not23.2, label %16, label %15

15:                                               ; preds = %11
  store i32 %13, ptr @mn, align 4, !tbaa !5
  store i32 3, ptr @ind, align 4, !tbaa !5
  br label %16

16:                                               ; preds = %15, %11
  %17 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds (i8, ptr @d, i64 16))
  %18 = load i32, ptr getelementptr inbounds (i8, ptr @d, i64 16), align 16, !tbaa !5
  %19 = load i32, ptr @mn, align 4, !tbaa !5
  %.not23.3 = icmp sgt i32 %18, %19
  br i1 %.not23.3, label %21, label %20

20:                                               ; preds = %16
  store i32 %18, ptr @mn, align 4, !tbaa !5
  store i32 4, ptr @ind, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %20, %16
  %22 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds (i8, ptr @d, i64 20))
  %23 = load i32, ptr getelementptr inbounds (i8, ptr @d, i64 20), align 4, !tbaa !5
  %24 = load i32, ptr @mn, align 4, !tbaa !5
  %.not23.4 = icmp sgt i32 %23, %24
  br i1 %.not23.4, label %26, label %25

25:                                               ; preds = %21
  store i32 %23, ptr @mn, align 4, !tbaa !5
  store i32 5, ptr @ind, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %25, %21
  %27 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds (i8, ptr @d, i64 24))
  %28 = load i32, ptr getelementptr inbounds (i8, ptr @d, i64 24), align 8, !tbaa !5
  %29 = load i32, ptr @mn, align 4, !tbaa !5
  %.not23.5 = icmp sgt i32 %28, %29
  br i1 %.not23.5, label %31, label %30

30:                                               ; preds = %26
  store i32 %28, ptr @mn, align 4, !tbaa !5
  store i32 6, ptr @ind, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %30, %26
  %32 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds (i8, ptr @d, i64 28))
  %33 = load i32, ptr getelementptr inbounds (i8, ptr @d, i64 28), align 4, !tbaa !5
  %34 = load i32, ptr @mn, align 4, !tbaa !5
  %.not23.6 = icmp sgt i32 %33, %34
  br i1 %.not23.6, label %36, label %35

35:                                               ; preds = %31
  store i32 %33, ptr @mn, align 4, !tbaa !5
  store i32 7, ptr @ind, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %35, %31
  %37 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds (i8, ptr @d, i64 32))
  %38 = load i32, ptr getelementptr inbounds (i8, ptr @d, i64 32), align 16, !tbaa !5
  %39 = load i32, ptr @mn, align 4, !tbaa !5
  %.not23.7 = icmp sgt i32 %38, %39
  br i1 %.not23.7, label %41, label %40

40:                                               ; preds = %36
  store i32 %38, ptr @mn, align 4, !tbaa !5
  store i32 8, ptr @ind, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %40, %36
  %42 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull getelementptr inbounds (i8, ptr @d, i64 36))
  %43 = load i32, ptr getelementptr inbounds (i8, ptr @d, i64 36), align 4, !tbaa !5
  %44 = load i32, ptr @mn, align 4, !tbaa !5
  %.not23.8 = icmp sgt i32 %43, %44
  br i1 %.not23.8, label %.preheader25, label %45

45:                                               ; preds = %41
  store i32 %43, ptr @mn, align 4, !tbaa !5
  store i32 9, ptr @ind, align 4, !tbaa !5
  br label %.preheader25

.preheader25:                                     ; preds = %45, %41
  %46 = phi i32 [ %43, %45 ], [ %44, %41 ]
  %47 = load i32, ptr @v, align 4, !tbaa !5
  %48 = sdiv i32 %47, %46
  %.not30 = icmp slt i32 %48, 1
  br i1 %.not30, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %.preheader25
  %.lcssa28 = phi i32 [ %47, %.preheader25 ], [ %56, %.lr.ph ]
  %.lcssa27 = phi i32 [ %46, %.preheader25 ], [ %57, %.lr.ph ]
  %49 = srem i32 %.lcssa28, %.lcssa27
  store i32 %49, ptr @v, align 4, !tbaa !5
  %50 = tail call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z3resB5cxx11) #6
  %.not = icmp eq i64 %50, 0
  br i1 %.not, label %._crit_edge37, label %.preheader

.lr.ph:                                           ; preds = %.preheader25, %.lr.ph
  %.01931 = phi i32 [ %55, %.lr.ph ], [ 1, %.preheader25 ]
  %51 = load i32, ptr @ind, align 4, !tbaa !5
  %52 = trunc i32 %51 to i8
  %53 = add i8 %52, 48
  %54 = tail call noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) @_Z3resB5cxx11, i8 noundef signext %53)
  %55 = add nuw nsw i32 %.01931, 1
  %56 = load i32, ptr @v, align 4, !tbaa !5
  %57 = load i32, ptr @mn, align 4, !tbaa !5
  %58 = sdiv i32 %56, %57
  %.not.not = icmp slt i32 %.01931, %58
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !9

.preheader:                                       ; preds = %._crit_edge, %.loopexit
  %indvars.iv44 = phi i64 [ %indvars.iv.next45, %.loopexit ], [ 0, %._crit_edge ]
  %59 = load i32, ptr @ind, align 4, !tbaa !5
  %60 = icmp slt i32 %59, 9
  br i1 %60, label %.lr.ph35, label %.loopexit

._crit_edge37:                                    ; preds = %.loopexit, %._crit_edge
  %61 = tail call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z3resB5cxx11) #6
  %62 = icmp eq i64 %61, 0
  br i1 %62, label %96, label %98

.lr.ph35:                                         ; preds = %.preheader, %90
  %indvars.iv = phi i64 [ %indvars.iv.next, %90 ], [ 9, %.preheader ]
  %63 = load i32, ptr @v, align 4, !tbaa !5
  %64 = getelementptr inbounds [10 x i32], ptr @d, i64 0, i64 %indvars.iv
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = sub i32 %63, %65
  %67 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z3resB5cxx11, i64 noundef %indvars.iv44)
  %68 = load i8, ptr %67, align 1, !tbaa !11
  %69 = sext i8 %68 to i64
  %70 = add nsw i64 %69, -48
  %71 = getelementptr inbounds [10 x i32], ptr @d, i64 0, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = add nsw i32 %66, %72
  %74 = icmp sgt i32 %73, -1
  br i1 %74, label %75, label %90

75:                                               ; preds = %.lr.ph35
  %76 = getelementptr inbounds [10 x i32], ptr @d, i64 0, i64 %indvars.iv
  %77 = load i32, ptr @v, align 4, !tbaa !5
  %78 = load i32, ptr %76, align 4, !tbaa !5
  %79 = sub i32 %77, %78
  %80 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z3resB5cxx11, i64 noundef %indvars.iv44)
  %81 = load i8, ptr %80, align 1, !tbaa !11
  %82 = sext i8 %81 to i64
  %83 = add nsw i64 %82, -48
  %84 = getelementptr inbounds [10 x i32], ptr @d, i64 0, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = add nsw i32 %79, %85
  store i32 %86, ptr @v, align 4, !tbaa !5
  %87 = trunc i64 %indvars.iv to i8
  %88 = add i8 %87, 48
  %89 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z3resB5cxx11, i64 noundef %indvars.iv44)
  store i8 %88, ptr %89, align 1, !tbaa !11
  br label %.loopexit

90:                                               ; preds = %.lr.ph35
  %indvars.iv.next = add nsw i64 %indvars.iv, -1
  %91 = load i32, ptr @ind, align 4, !tbaa !5
  %92 = sext i32 %91 to i64
  %93 = icmp sgt i64 %indvars.iv.next, %92
  br i1 %93, label %.lr.ph35, label %.loopexit, !llvm.loop !12

.loopexit:                                        ; preds = %90, %.preheader, %75
  %indvars.iv.next45 = add nuw nsw i64 %indvars.iv44, 1
  %94 = tail call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32) @_Z3resB5cxx11) #6
  %95 = icmp ugt i64 %94, %indvars.iv.next45
  br i1 %95, label %.preheader, label %._crit_edge37, !llvm.loop !13

96:                                               ; preds = %._crit_edge37
  %97 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef -1)
  br label %100

98:                                               ; preds = %._crit_edge37
  %99 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull align 8 dereferenceable(32) @_Z3resB5cxx11)
  br label %100

100:                                              ; preds = %98, %96
  %.sink = phi ptr [ %99, %98 ], [ %97, %96 ]
  %101 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %.sink, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0
}

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE6lengthEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #3 align 2

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #4

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsIcSt11char_traitsIcESaIcEERSt13basic_ostreamIT_T0_ES7_RKNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #5

attributes #0 = { 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 #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" }
attributes #2 = { 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 #3 = { 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 #4 = { "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 = { 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 #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 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}


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