; LLVM IR from AdarshGaur/Competitive-Programming :: Codechef/Random Problems (A 2nd Greatest Distance)

; 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_istream" = type { ptr, i64, %"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 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_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 i64, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i64, 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 i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca i64, align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %22 = alloca i64, align 8
  %23 = alloca i64, align 8
  %24 = alloca i64, align 8
  %25 = alloca i64, align 8
  %26 = alloca i64, align 8
  %27 = alloca i64, align 8
  %28 = alloca i64, align 8
  %29 = alloca i64, align 8
  %30 = alloca i64, align 8
  %31 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %32 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %33 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %34 = getelementptr i8, ptr %33, i64 -24
  %35 = load i64, ptr %34, align 8
  %36 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %35
  %37 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %36, ptr noundef null)
  %38 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %39 = getelementptr i8, ptr %38, i64 -24
  %40 = load i64, ptr %39, align 8
  %41 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %40
  %42 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %41, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  %43 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %44 = load i64, ptr %2, align 8, !tbaa !8
  %45 = call ptr @llvm.stacksave.p0()
  store ptr %45, ptr %3, align 8
  %46 = alloca i64, i64 %44, align 16
  store i64 %44, ptr %4, align 8
  %47 = load i64, ptr %2, align 8, !tbaa !8
  %48 = alloca i64, i64 %47, align 16
  store i64 %47, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  store i64 0, ptr %6, align 8, !tbaa !8
  br label %49

49:                                               ; preds = %61, %0
  %50 = load i64, ptr %6, align 8, !tbaa !8
  %51 = load i64, ptr %2, align 8, !tbaa !8
  %52 = icmp slt i64 %50, %51
  br i1 %52, label %54, label %53

53:                                               ; preds = %49
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %64

54:                                               ; preds = %49
  %55 = load i64, ptr %6, align 8, !tbaa !8
  %56 = getelementptr inbounds i64, ptr %46, i64 %55
  %57 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %56)
  %58 = load i64, ptr %6, align 8, !tbaa !8
  %59 = getelementptr inbounds i64, ptr %48, i64 %58
  %60 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %57, ptr noundef nonnull align 8 dereferenceable(8) %59)
  br label %61

61:                                               ; preds = %54
  %62 = load i64, ptr %6, align 8, !tbaa !8
  %63 = add nsw i64 %62, 1
  store i64 %63, ptr %6, align 8, !tbaa !8
  br label %49, !llvm.loop !11

64:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %65 = getelementptr inbounds i64, ptr %46, i64 0
  %66 = load i64, ptr %65, align 16, !tbaa !8
  store i64 %66, ptr %7, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %67 = getelementptr inbounds i64, ptr %48, i64 0
  %68 = load i64, ptr %67, align 16, !tbaa !8
  store i64 %68, ptr %8, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %69 = getelementptr inbounds i64, ptr %46, i64 0
  %70 = load i64, ptr %69, align 16, !tbaa !8
  store i64 %70, ptr %9, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %71 = getelementptr inbounds i64, ptr %48, i64 0
  %72 = load i64, ptr %71, align 16, !tbaa !8
  store i64 %72, ptr %10, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %73 = getelementptr inbounds i64, ptr %48, i64 0
  %74 = load i64, ptr %73, align 16, !tbaa !8
  store i64 %74, ptr %11, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %75 = getelementptr inbounds i64, ptr %46, i64 0
  %76 = load i64, ptr %75, align 16, !tbaa !8
  store i64 %76, ptr %12, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %77 = getelementptr inbounds i64, ptr %48, i64 0
  %78 = load i64, ptr %77, align 16, !tbaa !8
  store i64 %78, ptr %13, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %79 = getelementptr inbounds i64, ptr %46, i64 0
  %80 = load i64, ptr %79, align 16, !tbaa !8
  store i64 %80, ptr %14, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  store i64 0, ptr %23, align 8, !tbaa !8
  br label %81

81:                                               ; preds = %103, %64
  %82 = load i64, ptr %23, align 8, !tbaa !8
  %83 = load i64, ptr %2, align 8, !tbaa !8
  %84 = icmp slt i64 %82, %83
  br i1 %84, label %86, label %85

85:                                               ; preds = %81
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  br label %106

86:                                               ; preds = %81
  %87 = load i64, ptr %23, align 8, !tbaa !8
  %88 = getelementptr inbounds i64, ptr %46, i64 %87
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %88)
  %90 = load i64, ptr %89, align 8, !tbaa !8
  store i64 %90, ptr %7, align 8, !tbaa !8
  %91 = load i64, ptr %23, align 8, !tbaa !8
  %92 = getelementptr inbounds i64, ptr %46, i64 %91
  %93 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %92)
  %94 = load i64, ptr %93, align 8, !tbaa !8
  store i64 %94, ptr %9, align 8, !tbaa !8
  %95 = load i64, ptr %23, align 8, !tbaa !8
  %96 = getelementptr inbounds i64, ptr %48, i64 %95
  %97 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %96)
  %98 = load i64, ptr %97, align 8, !tbaa !8
  store i64 %98, ptr %10, align 8, !tbaa !8
  %99 = load i64, ptr %23, align 8, !tbaa !8
  %100 = getelementptr inbounds i64, ptr %48, i64 %99
  %101 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %100)
  %102 = load i64, ptr %101, align 8, !tbaa !8
  store i64 %102, ptr %8, align 8, !tbaa !8
  br label %103

103:                                              ; preds = %86
  %104 = load i64, ptr %23, align 8, !tbaa !8
  %105 = add nsw i64 %104, 1
  store i64 %105, ptr %23, align 8, !tbaa !8
  br label %81, !llvm.loop !13

106:                                              ; preds = %85
  %107 = load i64, ptr %7, align 8, !tbaa !8
  %108 = load i64, ptr %9, align 8, !tbaa !8
  %109 = sub nsw i64 %107, %108
  %110 = icmp slt i64 %109, 0
  br i1 %110, label %111, label %116

111:                                              ; preds = %106
  %112 = load i64, ptr %7, align 8, !tbaa !8
  %113 = load i64, ptr %9, align 8, !tbaa !8
  %114 = sub nsw i64 %112, %113
  %115 = sub nsw i64 0, %114
  br label %120

116:                                              ; preds = %106
  %117 = load i64, ptr %7, align 8, !tbaa !8
  %118 = load i64, ptr %9, align 8, !tbaa !8
  %119 = sub nsw i64 %117, %118
  br label %120

120:                                              ; preds = %116, %111
  %121 = phi i64 [ %115, %111 ], [ %119, %116 ]
  %122 = load i64, ptr %8, align 8, !tbaa !8
  %123 = load i64, ptr %10, align 8, !tbaa !8
  %124 = sub nsw i64 %122, %123
  %125 = icmp slt i64 %124, 0
  br i1 %125, label %126, label %131

126:                                              ; preds = %120
  %127 = load i64, ptr %8, align 8, !tbaa !8
  %128 = load i64, ptr %10, align 8, !tbaa !8
  %129 = sub nsw i64 %127, %128
  %130 = sub nsw i64 0, %129
  br label %135

131:                                              ; preds = %120
  %132 = load i64, ptr %8, align 8, !tbaa !8
  %133 = load i64, ptr %10, align 8, !tbaa !8
  %134 = sub nsw i64 %132, %133
  br label %135

135:                                              ; preds = %131, %126
  %136 = phi i64 [ %130, %126 ], [ %134, %131 ]
  %137 = icmp sgt i64 %121, %136
  br i1 %137, label %138, label %141

138:                                              ; preds = %135
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #7
  %139 = load i64, ptr %7, align 8, !tbaa !8
  store i64 %139, ptr %24, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #7
  %140 = load i64, ptr %9, align 8, !tbaa !8
  store i64 %140, ptr %25, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  br label %144

141:                                              ; preds = %135
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #7
  %142 = load i64, ptr %8, align 8, !tbaa !8
  store i64 %142, ptr %26, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #7
  %143 = load i64, ptr %10, align 8, !tbaa !8
  store i64 %143, ptr %27, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #7
  br label %144

144:                                              ; preds = %141, %138
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #7
  store i64 0, ptr %28, align 8, !tbaa !8
  br label %145

145:                                              ; preds = %151, %144
  %146 = load i64, ptr %28, align 8, !tbaa !8
  %147 = load i64, ptr %2, align 8, !tbaa !8
  %148 = icmp slt i64 %146, %147
  br i1 %148, label %150, label %149

149:                                              ; preds = %145
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #7
  br label %154

150:                                              ; preds = %145
  br label %151

151:                                              ; preds = %150
  %152 = load i64, ptr %28, align 8, !tbaa !8
  %153 = add nsw i64 %152, 1
  store i64 %153, ptr %28, align 8, !tbaa !8
  br label %145, !llvm.loop !14

154:                                              ; preds = %149
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #7
  %155 = load i64, ptr %7, align 8, !tbaa !8
  %156 = load i64, ptr %9, align 8, !tbaa !8
  %157 = sub nsw i64 %155, %156
  %158 = icmp slt i64 %157, 0
  br i1 %158, label %159, label %164

159:                                              ; preds = %154
  %160 = load i64, ptr %7, align 8, !tbaa !8
  %161 = load i64, ptr %9, align 8, !tbaa !8
  %162 = sub nsw i64 %160, %161
  %163 = sub nsw i64 0, %162
  br label %168

164:                                              ; preds = %154
  %165 = load i64, ptr %7, align 8, !tbaa !8
  %166 = load i64, ptr %9, align 8, !tbaa !8
  %167 = sub nsw i64 %165, %166
  br label %168

168:                                              ; preds = %164, %159
  %169 = phi i64 [ %163, %159 ], [ %167, %164 ]
  store i64 %169, ptr %30, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #7
  %170 = load i64, ptr %8, align 8, !tbaa !8
  %171 = load i64, ptr %10, align 8, !tbaa !8
  %172 = sub nsw i64 %170, %171
  %173 = icmp slt i64 %172, 0
  br i1 %173, label %174, label %179

174:                                              ; preds = %168
  %175 = load i64, ptr %8, align 8, !tbaa !8
  %176 = load i64, ptr %10, align 8, !tbaa !8
  %177 = sub nsw i64 %175, %176
  %178 = sub nsw i64 0, %177
  br label %183

179:                                              ; preds = %168
  %180 = load i64, ptr %8, align 8, !tbaa !8
  %181 = load i64, ptr %10, align 8, !tbaa !8
  %182 = sub nsw i64 %180, %181
  br label %183

183:                                              ; preds = %179, %174
  %184 = phi i64 [ %178, %174 ], [ %182, %179 ]
  store i64 %184, ptr %31, align 8, !tbaa !8
  %185 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %30, ptr noundef nonnull align 8 dereferenceable(8) %31)
  %186 = load i64, ptr %185, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #7
  store i64 %186, ptr %29, align 8, !tbaa !8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  %187 = load ptr, ptr %3, align 8
  call void @llvm.stackrestore.p0(ptr %187)
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  %188 = load i32, ptr %1, align 4
  ret i32 %188
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #2 align 2

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #4 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #5

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #6

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #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 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
attributes #5 = { nocallback nofree nosync nounwind willreturn }
attributes #6 = { 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 #7 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !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"

%"class.std::basic_istream" = type { ptr, i64, %"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 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_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 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %9 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %10 = getelementptr i8, ptr %9, i64 -24
  %11 = load i64, ptr %10, align 8
  %12 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %11
  %13 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %12, ptr noundef null)
  %14 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %15 = getelementptr i8, ptr %14, i64 -24
  %16 = load i64, ptr %15, align 8
  %17 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %16
  %18 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %17, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #8
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %20 = load i64, ptr %1, align 8, !tbaa !8
  %21 = call ptr @llvm.stacksave.p0()
  %22 = alloca i64, i64 %20, align 16
  %23 = load i64, ptr %1, align 8, !tbaa !8
  %24 = alloca i64, i64 %23, align 16
  %25 = icmp sgt i64 %23, 0
  br i1 %25, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  br label %._crit_edge26

._crit_edge:                                      ; preds = %.lr.ph
  %.pre = load i64, ptr %22, align 16, !tbaa !8
  %.pre28 = load i64, ptr %24, align 16, !tbaa !8
  %26 = icmp sgt i64 %32, 0
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #8
  store i64 %.pre, ptr %2, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #8
  store i64 %.pre28, ptr %3, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #8
  store i64 %.pre, ptr %4, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #8
  store i64 %.pre28, ptr %5, align 8, !tbaa !8
  br i1 %26, label %.lr.ph25, label %._crit_edge26

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.01322 = phi i64 [ %31, %.lr.ph ], [ 0, %0 ]
  %27 = getelementptr inbounds i64, ptr %22, i64 %.01322
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %27)
  %29 = getelementptr inbounds i64, ptr %24, i64 %.01322
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %28, ptr noundef nonnull align 8 dereferenceable(8) %29)
  %31 = add nuw nsw i64 %.01322, 1
  %32 = load i64, ptr %1, align 8, !tbaa !8
  %33 = icmp slt i64 %31, %32
  br i1 %33, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge26.loopexit:                           ; preds = %.lr.ph25
  %.pre29 = load i64, ptr %2, align 8, !tbaa !8
  %.pre30 = load i64, ptr %4, align 8, !tbaa !8
  %.pre31 = load i64, ptr %5, align 8, !tbaa !8
  br label %._crit_edge26

._crit_edge26:                                    ; preds = %._crit_edge.thread, %._crit_edge26.loopexit, %._crit_edge
  %34 = phi i64 [ %.pre31, %._crit_edge26.loopexit ], [ %.pre28, %._crit_edge ], [ undef, %._crit_edge.thread ]
  %35 = phi i64 [ %52, %._crit_edge26.loopexit ], [ %.pre28, %._crit_edge ], [ undef, %._crit_edge.thread ]
  %36 = phi i64 [ %.pre30, %._crit_edge26.loopexit ], [ %.pre, %._crit_edge ], [ undef, %._crit_edge.thread ]
  %37 = phi i64 [ %.pre29, %._crit_edge26.loopexit ], [ %.pre, %._crit_edge ], [ undef, %._crit_edge.thread ]
  %38 = sub nsw i64 %35, %34
  %39 = call i64 @llvm.abs.i64(i64 %38, i1 true)
  %40 = sub nsw i64 %37, %36
  %41 = call i64 @llvm.abs.i64(i64 %40, i1 true)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #8
  store i64 %41, ptr %6, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #8
  store i64 %39, ptr %7, align 8, !tbaa !8
  %42 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #8
  call void @llvm.stackrestore.p0(ptr %21)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #8
  ret i32 0

.lr.ph25:                                         ; preds = %._crit_edge, %.lr.ph25
  %.01423 = phi i64 [ %53, %.lr.ph25 ], [ 0, %._crit_edge ]
  %43 = getelementptr inbounds i64, ptr %22, i64 %.01423
  %44 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %43)
  %45 = load i64, ptr %44, align 8, !tbaa !8
  store i64 %45, ptr %2, align 8, !tbaa !8
  %46 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %43)
  %47 = load i64, ptr %46, align 8, !tbaa !8
  store i64 %47, ptr %4, align 8, !tbaa !8
  %48 = getelementptr inbounds i64, ptr %24, i64 %.01423
  %49 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %48)
  %50 = load i64, ptr %49, align 8, !tbaa !8
  store i64 %50, ptr %5, align 8, !tbaa !8
  %51 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %48)
  %52 = load i64, ptr %51, align 8, !tbaa !8
  store i64 %52, ptr %3, align 8, !tbaa !8
  %53 = add nuw nsw i64 %.01423, 1
  %54 = load i64, ptr %1, align 8, !tbaa !8
  %55 = icmp slt i64 %53, %54
  br i1 %55, label %.lr.ph25, label %._crit_edge26.loopexit, !llvm.loop !13
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #1

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

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #5

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3maxIxERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #6

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #5

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.abs.i64(i64, i1 immarg) #7

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


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