; LLVM IR from VastoLorde95/Competitive-Programming :: CodeChef/LONG/JULY15/MAXDIFFW/A.ll (Z5solvev)

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

@n = external dso_local global i32, align 4
@g = external dso_local global [51 x [51 x i32]], align 16
@vi = external dso_local global [51 x [51 x i32]], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #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
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 15, ptr %11, align 4, !tbaa !5
  %17 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @n, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %18 = load i32, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  store i32 %18, ptr %10, align 4, !tbaa !5
  %19 = call i64 @time(ptr noundef null) #6
  %20 = trunc i64 %19 to i32
  call void @srand(i32 noundef %20) #6
  %21 = load i32, ptr %8, align 4, !tbaa !5
  %22 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %21)
  %23 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %22, ptr noundef @.str)
  %24 = load i32, ptr %9, align 4, !tbaa !5
  %25 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %23, i32 noundef %24)
  %26 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %25, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %27 = load i32, ptr %8, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [51 x [51 x i32]], ptr @vi, i64 0, i64 %28
  %30 = load i32, ptr %9, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [51 x i32], ptr %29, i64 0, i64 %31
  store i32 1, ptr %32, align 4, !tbaa !5
  %33 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %4, ptr noundef %5)
  %34 = icmp ne i32 %33, -1
  br i1 %34, label %35, label %43

35:                                               ; preds = %0
  %36 = load i32, ptr %4, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [51 x [51 x i32]], ptr @vi, i64 0, i64 %37
  %39 = load i32, ptr %5, align 4, !tbaa !5
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [51 x i32], ptr %38, i64 0, i64 %40
  store i32 1, ptr %41, align 4, !tbaa !5
  %42 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %42, ptr %8, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %35, %0
  br label %44

44:                                               ; preds = %166, %43
  br label %45

45:                                               ; preds = %44
  store i32 -1, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  store i32 -1000000, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  store i32 1, ptr %13, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %132, %45
  %47 = load i32, ptr %13, align 4, !tbaa !5
  %48 = load i32, ptr @n, align 4, !tbaa !5
  %49 = icmp sle i32 %47, %48
  br i1 %49, label %51, label %50

50:                                               ; preds = %46
  store i32 4, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %135

51:                                               ; preds = %46
  %52 = load i32, ptr %13, align 4, !tbaa !5
  %53 = load i32, ptr %8, align 4, !tbaa !5
  %54 = icmp eq i32 %52, %53
  br i1 %54, label %55, label %56

55:                                               ; preds = %51
  br label %132

56:                                               ; preds = %51
  %57 = load i32, ptr %8, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [51 x [51 x i32]], ptr @vi, i64 0, i64 %58
  %60 = load i32, ptr %13, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [51 x i32], ptr %59, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = icmp eq i32 %63, 0
  br i1 %64, label %65, label %131

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

66:                                               ; preds = %104, %65
  %67 = load i32, ptr %16, align 4, !tbaa !5
  %68 = load i32, ptr @n, align 4, !tbaa !5
  %69 = icmp sle i32 %67, %68
  br i1 %69, label %71, label %70

70:                                               ; preds = %66
  store i32 7, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %107

71:                                               ; preds = %66
  %72 = load i32, ptr %16, align 4, !tbaa !5
  %73 = load i32, ptr %13, align 4, !tbaa !5
  %74 = icmp eq i32 %72, %73
  br i1 %74, label %75, label %76

75:                                               ; preds = %71
  br label %104

76:                                               ; preds = %71
  %77 = load i32, ptr %13, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [51 x [51 x i32]], ptr @vi, i64 0, i64 %78
  %80 = load i32, ptr %16, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [51 x i32], ptr %79, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = icmp eq i32 %83, 0
  br i1 %84, label %85, label %103

85:                                               ; preds = %76
  %86 = load i32, ptr %13, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [51 x [51 x i32]], ptr @g, i64 0, i64 %87
  %89 = load i32, ptr %16, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [51 x i32], ptr %88, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = load i32, ptr %15, align 4, !tbaa !5
  %94 = icmp sgt i32 %92, %93
  br i1 %94, label %95, label %103

95:                                               ; preds = %85
  %96 = load i32, ptr %13, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [51 x [51 x i32]], ptr @g, i64 0, i64 %97
  %99 = load i32, ptr %16, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [51 x i32], ptr %98, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  store i32 %102, ptr %15, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %95, %85, %76
  br label %104

104:                                              ; preds = %103, %75
  %105 = load i32, ptr %16, align 4, !tbaa !5
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr %16, align 4, !tbaa !5
  br label %66, !llvm.loop !9

107:                                              ; preds = %70
  %108 = load i32, ptr %8, align 4, !tbaa !5
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [51 x [51 x i32]], ptr @g, i64 0, i64 %109
  %111 = load i32, ptr %13, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [51 x i32], ptr %110, i64 0, i64 %112
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = load i32, ptr %15, align 4, !tbaa !5
  %116 = sub nsw i32 %114, %115
  %117 = load i32, ptr %12, align 4, !tbaa !5
  %118 = icmp sgt i32 %116, %117
  br i1 %118, label %119, label %130

119:                                              ; preds = %107
  %120 = load i32, ptr %8, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [51 x [51 x i32]], ptr @g, i64 0, i64 %121
  %123 = load i32, ptr %13, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [51 x i32], ptr %122, i64 0, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = load i32, ptr %15, align 4, !tbaa !5
  %128 = sub nsw i32 %126, %127
  store i32 %128, ptr %12, align 4, !tbaa !5
  %129 = load i32, ptr %13, align 4, !tbaa !5
  store i32 %129, ptr %9, align 4, !tbaa !5
  br label %130

130:                                              ; preds = %119, %107
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %131

131:                                              ; preds = %130, %56
  br label %132

132:                                              ; preds = %131, %55
  %133 = load i32, ptr %13, align 4, !tbaa !5
  %134 = add nsw i32 %133, 1
  store i32 %134, ptr %13, align 4, !tbaa !5
  br label %46, !llvm.loop !11

135:                                              ; preds = %50
  %136 = load i32, ptr %9, align 4, !tbaa !5
  %137 = icmp eq i32 %136, -1
  br i1 %137, label %138, label %139

138:                                              ; preds = %135
  store i32 3, ptr %14, align 4
  br label %164

139:                                              ; preds = %135
  %140 = load i32, ptr %8, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [51 x [51 x i32]], ptr @vi, i64 0, i64 %141
  %143 = load i32, ptr %9, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [51 x i32], ptr %142, i64 0, i64 %144
  store i32 1, ptr %145, align 4, !tbaa !5
  %146 = load i32, ptr %8, align 4, !tbaa !5
  %147 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %146)
  %148 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %147, ptr noundef @.str)
  %149 = load i32, ptr %9, align 4, !tbaa !5
  %150 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %148, i32 noundef %149)
  %151 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %150, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %152 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %4, ptr noundef %5)
  %153 = icmp ne i32 %152, -1
  br i1 %153, label %154, label %162

154:                                              ; preds = %139
  %155 = load i32, ptr %4, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [51 x [51 x i32]], ptr @vi, i64 0, i64 %156
  %158 = load i32, ptr %5, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [51 x i32], ptr %157, i64 0, i64 %159
  store i32 1, ptr %160, align 4, !tbaa !5
  %161 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %161, ptr %8, align 4, !tbaa !5
  br label %163

162:                                              ; preds = %139
  store i32 3, ptr %14, align 4
  br label %164

163:                                              ; preds = %154
  store i32 0, ptr %14, align 4
  br label %164

164:                                              ; preds = %163, %162, %138
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  %165 = load i32, ptr %14, align 4
  switch i32 %165, label %168 [
    i32 0, label %166
    i32 3, label %167
  ]

166:                                              ; preds = %164
  br label %44, !llvm.loop !12

167:                                              ; preds = %164
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #6
  ret void

168:                                              ; preds = %164
  unreachable
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #2

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

; Function Attrs: nounwind
declare void @srand(i32 noundef) #3

; Function Attrs: nounwind
declare i64 @time(ptr noundef) #3

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #4

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #0 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)) #4

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

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

@n = external dso_local global i32, align 4
@g = external dso_local local_unnamed_addr global [51 x [51 x i32]], align 16
@vi = external dso_local local_unnamed_addr global [51 x [51 x i32]], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  store i32 15, ptr %3, align 4, !tbaa !5
  %4 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @n, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  %5 = call i64 @time(ptr noundef null) #8
  %6 = trunc i64 %5 to i32
  call void @srand(i32 noundef %6) #8
  %7 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef undef)
  %8 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull @.str)
  %9 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %8, i32 noundef undef)
  %10 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 1, ptr @vi, align 16, !tbaa !5
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %.not = icmp eq i32 %11, -1
  br i1 %.not, label %18, label %12

12:                                               ; preds = %0
  %13 = load i32, ptr %1, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [51 x [51 x i32]], ptr @vi, i64 0, i64 %14, i64 %16
  store i32 1, ptr %17, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %12, %0
  %.040 = phi i32 [ %15, %12 ], [ undef, %0 ]
  %19 = load i32, ptr @n, align 4, !tbaa !5
  %.not485974 = icmp slt i32 %19, 1
  br i1 %.not485974, label %._crit_edge65.split.thread, label %.lr.ph64

.lr.ph64:                                         ; preds = %18, %73
  %20 = phi i32 [ %79, %73 ], [ %19, %18 ]
  %.14175 = phi i32 [ %76, %73 ], [ %.040, %18 ]
  %21 = sext i32 %.14175 to i64
  %22 = add nuw i32 %20, 1
  %23 = zext i32 %.14175 to i64
  %wide.trip.count71 = zext i32 %22 to i64
  %24 = zext nneg i32 %20 to i64
  %xtraiter = and i64 %24, 1
  %25 = icmp eq i32 %22, 2
  %unroll_iter = and i64 %24, 2147483646
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %27

._crit_edge65.split:                              ; preds = %63
  %26 = icmp eq i32 %.245, -1
  br i1 %26, label %._crit_edge65.split.thread, label %64

27:                                               ; preds = %.lr.ph64, %63
  %indvars.iv68 = phi i64 [ 1, %.lr.ph64 ], [ %indvars.iv.next69, %63 ]
  %.03861 = phi i32 [ -1000000, %.lr.ph64 ], [ %.2, %63 ]
  %.04360 = phi i32 [ -1, %.lr.ph64 ], [ %.245, %63 ]
  %28 = icmp eq i64 %indvars.iv68, %23
  br i1 %28, label %63, label %29

29:                                               ; preds = %27
  %30 = getelementptr inbounds [51 x [51 x i32]], ptr @vi, i64 0, i64 %21, i64 %indvars.iv68
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = icmp eq i32 %31, 0
  br i1 %32, label %.preheader.preheader, label %63

.preheader.preheader:                             ; preds = %29
  br i1 %25, label %._crit_edge.unr-lcssa, label %.preheader

._crit_edge.unr-lcssa:                            ; preds = %62, %.preheader.preheader
  %.1.lcssa.ph = phi i32 [ poison, %.preheader.preheader ], [ %.1.1, %62 ]
  %indvars.iv.unr = phi i64 [ 1, %.preheader.preheader ], [ %indvars.iv.next.1, %62 ]
  %.03557.unr = phi i32 [ 0, %.preheader.preheader ], [ %.1.1, %62 ]
  br i1 %lcmp.mod.not, label %._crit_edge, label %.preheader.epil

.preheader.epil:                                  ; preds = %._crit_edge.unr-lcssa
  %33 = icmp eq i64 %indvars.iv.unr, %indvars.iv68
  br i1 %33, label %._crit_edge, label %34

34:                                               ; preds = %.preheader.epil
  %35 = getelementptr inbounds [51 x [51 x i32]], ptr @vi, i64 0, i64 %indvars.iv68, i64 %indvars.iv.unr
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = icmp eq i32 %36, 0
  br i1 %37, label %38, label %._crit_edge

38:                                               ; preds = %34
  %39 = getelementptr inbounds [51 x [51 x i32]], ptr @g, i64 0, i64 %indvars.iv68, i64 %indvars.iv.unr
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %spec.select52.epil = call i32 @llvm.smax.i32(i32 %40, i32 %.03557.unr)
  br label %._crit_edge

._crit_edge:                                      ; preds = %.preheader.epil, %34, %38, %._crit_edge.unr-lcssa
  %.1.lcssa = phi i32 [ %.1.lcssa.ph, %._crit_edge.unr-lcssa ], [ %.03557.unr, %.preheader.epil ], [ %.03557.unr, %34 ], [ %spec.select52.epil, %38 ]
  %41 = getelementptr inbounds [51 x [51 x i32]], ptr @g, i64 0, i64 %21, i64 %indvars.iv68
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = sub nsw i32 %42, %.1.lcssa
  %44 = icmp sgt i32 %43, %.03861
  %45 = trunc nuw nsw i64 %indvars.iv68 to i32
  %spec.select = select i1 %44, i32 %45, i32 %.04360
  %spec.select51 = call i32 @llvm.smax.i32(i32 %43, i32 %.03861)
  br label %63

.preheader:                                       ; preds = %.preheader.preheader, %62
  %indvars.iv = phi i64 [ %indvars.iv.next.1, %62 ], [ 1, %.preheader.preheader ]
  %.03557 = phi i32 [ %.1.1, %62 ], [ 0, %.preheader.preheader ]
  %niter = phi i64 [ %niter.next.1, %62 ], [ 0, %.preheader.preheader ]
  %46 = icmp eq i64 %indvars.iv, %indvars.iv68
  br i1 %46, label %.preheader.1, label %47

47:                                               ; preds = %.preheader
  %48 = getelementptr inbounds [51 x [51 x i32]], ptr @vi, i64 0, i64 %indvars.iv68, i64 %indvars.iv
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = icmp eq i32 %49, 0
  br i1 %50, label %51, label %.preheader.1

51:                                               ; preds = %47
  %52 = getelementptr inbounds [51 x [51 x i32]], ptr @g, i64 0, i64 %indvars.iv68, i64 %indvars.iv
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %spec.select52 = call i32 @llvm.smax.i32(i32 %53, i32 %.03557)
  br label %.preheader.1

.preheader.1:                                     ; preds = %51, %47, %.preheader
  %.1 = phi i32 [ %.03557, %.preheader ], [ %.03557, %47 ], [ %spec.select52, %51 ]
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %54 = icmp eq i64 %indvars.iv.next, %indvars.iv68
  br i1 %54, label %62, label %55

55:                                               ; preds = %.preheader.1
  %56 = getelementptr inbounds [51 x [51 x i32]], ptr @vi, i64 0, i64 %indvars.iv68, i64 %indvars.iv.next
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = icmp eq i32 %57, 0
  br i1 %58, label %59, label %62

59:                                               ; preds = %55
  %60 = getelementptr inbounds [51 x [51 x i32]], ptr @g, i64 0, i64 %indvars.iv68, i64 %indvars.iv.next
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %spec.select52.1 = call i32 @llvm.smax.i32(i32 %61, i32 %.1)
  br label %62

62:                                               ; preds = %59, %55, %.preheader.1
  %.1.1 = phi i32 [ %.1, %.preheader.1 ], [ %.1, %55 ], [ %spec.select52.1, %59 ]
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.unr-lcssa, label %.preheader, !llvm.loop !9

63:                                               ; preds = %29, %._crit_edge, %27
  %.245 = phi i32 [ %.04360, %27 ], [ %spec.select, %._crit_edge ], [ %.04360, %29 ]
  %.2 = phi i32 [ %.03861, %27 ], [ %spec.select51, %._crit_edge ], [ %.03861, %29 ]
  %indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
  %exitcond72.not = icmp eq i64 %indvars.iv.next69, %wide.trip.count71
  br i1 %exitcond72.not, label %._crit_edge65.split, label %27, !llvm.loop !11

64:                                               ; preds = %._crit_edge65.split
  %65 = sext i32 %.14175 to i64
  %66 = sext i32 %.245 to i64
  %67 = getelementptr inbounds [51 x [51 x i32]], ptr @vi, i64 0, i64 %65, i64 %66
  store i32 1, ptr %67, align 4, !tbaa !5
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.14175)
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %68, ptr noundef nonnull @.str)
  %70 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %69, i32 noundef %.245)
  %71 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %70, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %72 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %.not49 = icmp eq i32 %72, -1
  br i1 %.not49, label %._crit_edge65.split.thread, label %73

73:                                               ; preds = %64
  %74 = load i32, ptr %1, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %76 = load i32, ptr %2, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [51 x [51 x i32]], ptr @vi, i64 0, i64 %75, i64 %77
  store i32 1, ptr %78, align 4, !tbaa !5
  %79 = load i32, ptr @n, align 4, !tbaa !5
  %.not4859 = icmp slt i32 %79, 1
  br i1 %.not4859, label %._crit_edge65.split.thread, label %.lr.ph64

._crit_edge65.split.thread:                       ; preds = %64, %._crit_edge65.split, %73, %18
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  ret void
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

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

; Function Attrs: nounwind
declare void @srand(i32 noundef) local_unnamed_addr #3

; Function Attrs: nounwind
declare i64 @time(ptr noundef) local_unnamed_addr #3

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

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

; 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 #0 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)) #4

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #7

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint 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 #3 = { 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 #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 = { "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 = { 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 #7 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #8 = { 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}


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