; LLVM IR from eyangch/competitive-programming :: Codeforces/1539 (d)

; 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" }
%class.anon = type { i8 }

@N = external dso_local global i64, align 8
@a = external dso_local global [100000 x i64], align 16
@b = external dso_local global [100000 x i64], align 16
@id = external dso_local global [100000 x i64], align 16
@_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 %class.anon, align 1
  %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 i32, align 4
  %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
  store i32 0, ptr %1, align 4
  %15 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %16 = getelementptr i8, ptr %15, i64 -24
  %17 = load i64, ptr %16, align 8
  %18 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %17
  %19 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %18, ptr noundef null)
  %20 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  store i64 0, ptr %2, align 8, !tbaa !8
  br label %22

22:                                               ; preds = %34, %0
  %23 = load i64, ptr %2, align 8, !tbaa !8
  %24 = load i64, ptr @N, align 8, !tbaa !8
  %25 = icmp slt i64 %23, %24
  br i1 %25, label %27, label %26

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

27:                                               ; preds = %22
  %28 = load i64, ptr %2, align 8, !tbaa !8
  %29 = getelementptr inbounds [100000 x i64], ptr @a, i64 0, i64 %28
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %29)
  %31 = load i64, ptr %2, align 8, !tbaa !8
  %32 = getelementptr inbounds [100000 x i64], ptr @b, i64 0, i64 %31
  %33 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %30, ptr noundef nonnull align 8 dereferenceable(8) %32)
  br label %34

34:                                               ; preds = %27
  %35 = load i64, ptr %2, align 8, !tbaa !8
  %36 = add nsw i64 %35, 1
  store i64 %36, ptr %2, align 8, !tbaa !8
  br label %22, !llvm.loop !11

37:                                               ; preds = %26
  %38 = load i64, ptr @N, align 8, !tbaa !8
  %39 = getelementptr inbounds i64, ptr @id, i64 %38
  call void @_ZSt4iotaIPxiEvT_S1_T0_(ptr noundef @id, ptr noundef %39, i32 noundef 0)
  %40 = load i64, ptr @N, align 8, !tbaa !8
  %41 = getelementptr inbounds i64, ptr @id, i64 %40
  call void @"_ZSt4sortIPxZ4mainE3$_0EvT_S2_T0_"(ptr noundef @id, ptr noundef %41)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %42 = load i64, ptr @N, align 8, !tbaa !8
  %43 = sub nsw i64 %42, 1
  store i64 %43, ptr %4, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  store i64 0, ptr %5, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store i64 0, ptr %6, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  store i64 0, ptr %7, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store i64 0, ptr %8, align 8, !tbaa !8
  br label %44

44:                                               ; preds = %188, %37
  %45 = load i64, ptr %8, align 8, !tbaa !8
  %46 = load i64, ptr @N, align 8, !tbaa !8
  %47 = icmp slt i64 %45, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %44
  store i32 5, ptr %9, align 4
  br label %191

49:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %50 = load i64, ptr %8, align 8, !tbaa !8
  %51 = getelementptr inbounds [100000 x i64], ptr @id, i64 0, i64 %50
  %52 = load i64, ptr %51, align 8, !tbaa !8
  store i64 %52, ptr %10, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %53 = load i64, ptr %4, align 8, !tbaa !8
  %54 = getelementptr inbounds [100000 x i64], ptr @id, i64 0, i64 %53
  %55 = load i64, ptr %54, align 8, !tbaa !8
  store i64 %55, ptr %11, align 8, !tbaa !8
  %56 = load i64, ptr %8, align 8, !tbaa !8
  %57 = load i64, ptr %4, align 8, !tbaa !8
  %58 = icmp sgt i64 %56, %57
  br i1 %58, label %59, label %60

59:                                               ; preds = %49
  store i32 5, ptr %9, align 4
  br label %185

60:                                               ; preds = %49
  %61 = load i64, ptr %8, align 8, !tbaa !8
  %62 = load i64, ptr %4, align 8, !tbaa !8
  %63 = icmp eq i64 %61, %62
  br i1 %63, label %64, label %113

64:                                               ; preds = %60
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %65 = load i64, ptr %10, align 8, !tbaa !8
  %66 = getelementptr inbounds [100000 x i64], ptr @a, i64 0, i64 %65
  %67 = load i64, ptr %66, align 8, !tbaa !8
  %68 = load i64, ptr %5, align 8, !tbaa !8
  %69 = sub nsw i64 %67, %68
  store i64 %69, ptr %12, align 8, !tbaa !8
  %70 = load i64, ptr %6, align 8, !tbaa !8
  %71 = load i64, ptr %10, align 8, !tbaa !8
  %72 = getelementptr inbounds [100000 x i64], ptr @b, i64 0, i64 %71
  %73 = load i64, ptr %72, align 8, !tbaa !8
  %74 = icmp sge i64 %70, %73
  br i1 %74, label %75, label %82

75:                                               ; preds = %64
  %76 = load i64, ptr %12, align 8, !tbaa !8
  %77 = load i64, ptr %6, align 8, !tbaa !8
  %78 = add nsw i64 %77, %76
  store i64 %78, ptr %6, align 8, !tbaa !8
  %79 = load i64, ptr %12, align 8, !tbaa !8
  %80 = load i64, ptr %7, align 8, !tbaa !8
  %81 = add nsw i64 %80, %79
  store i64 %81, ptr %7, align 8, !tbaa !8
  br label %112

82:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %83 = load i64, ptr %10, align 8, !tbaa !8
  %84 = getelementptr inbounds [100000 x i64], ptr @b, i64 0, i64 %83
  %85 = load i64, ptr %84, align 8, !tbaa !8
  %86 = load i64, ptr %6, align 8, !tbaa !8
  %87 = sub nsw i64 %85, %86
  store i64 %87, ptr %13, align 8, !tbaa !8
  %88 = load i64, ptr %13, align 8, !tbaa !8
  %89 = load i64, ptr %12, align 8, !tbaa !8
  %90 = icmp sge i64 %88, %89
  br i1 %90, label %91, label %99

91:                                               ; preds = %82
  %92 = load i64, ptr %12, align 8, !tbaa !8
  %93 = load i64, ptr %6, align 8, !tbaa !8
  %94 = add nsw i64 %93, %92
  store i64 %94, ptr %6, align 8, !tbaa !8
  %95 = load i64, ptr %12, align 8, !tbaa !8
  %96 = mul nsw i64 2, %95
  %97 = load i64, ptr %7, align 8, !tbaa !8
  %98 = add nsw i64 %97, %96
  store i64 %98, ptr %7, align 8, !tbaa !8
  br label %111

99:                                               ; preds = %82
  %100 = load i64, ptr %12, align 8, !tbaa !8
  %101 = load i64, ptr %6, align 8, !tbaa !8
  %102 = add nsw i64 %101, %100
  store i64 %102, ptr %6, align 8, !tbaa !8
  %103 = load i64, ptr %13, align 8, !tbaa !8
  %104 = mul nsw i64 2, %103
  %105 = load i64, ptr %12, align 8, !tbaa !8
  %106 = load i64, ptr %13, align 8, !tbaa !8
  %107 = sub nsw i64 %105, %106
  %108 = add nsw i64 %104, %107
  %109 = load i64, ptr %7, align 8, !tbaa !8
  %110 = add nsw i64 %109, %108
  store i64 %110, ptr %7, align 8, !tbaa !8
  br label %111

111:                                              ; preds = %99, %91
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %112

112:                                              ; preds = %111, %75
  store i32 5, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %185

113:                                              ; preds = %60
  %114 = load i64, ptr %6, align 8, !tbaa !8
  %115 = load i64, ptr %10, align 8, !tbaa !8
  %116 = getelementptr inbounds [100000 x i64], ptr @b, i64 0, i64 %115
  %117 = load i64, ptr %116, align 8, !tbaa !8
  %118 = icmp sge i64 %114, %117
  br i1 %118, label %119, label %130

119:                                              ; preds = %113
  %120 = load i64, ptr %10, align 8, !tbaa !8
  %121 = getelementptr inbounds [100000 x i64], ptr @a, i64 0, i64 %120
  %122 = load i64, ptr %121, align 8, !tbaa !8
  %123 = load i64, ptr %6, align 8, !tbaa !8
  %124 = add nsw i64 %123, %122
  store i64 %124, ptr %6, align 8, !tbaa !8
  %125 = load i64, ptr %10, align 8, !tbaa !8
  %126 = getelementptr inbounds [100000 x i64], ptr @a, i64 0, i64 %125
  %127 = load i64, ptr %126, align 8, !tbaa !8
  %128 = load i64, ptr %7, align 8, !tbaa !8
  %129 = add nsw i64 %128, %127
  store i64 %129, ptr %7, align 8, !tbaa !8
  store i32 7, ptr %9, align 4
  br label %185

130:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %131 = load i64, ptr %10, align 8, !tbaa !8
  %132 = getelementptr inbounds [100000 x i64], ptr @b, i64 0, i64 %131
  %133 = load i64, ptr %132, align 8, !tbaa !8
  %134 = load i64, ptr %6, align 8, !tbaa !8
  %135 = sub nsw i64 %133, %134
  store i64 %135, ptr %14, align 8, !tbaa !8
  %136 = load i64, ptr %11, align 8, !tbaa !8
  %137 = getelementptr inbounds [100000 x i64], ptr @a, i64 0, i64 %136
  %138 = load i64, ptr %137, align 8, !tbaa !8
  %139 = load i64, ptr %5, align 8, !tbaa !8
  %140 = sub nsw i64 %138, %139
  %141 = load i64, ptr %14, align 8, !tbaa !8
  %142 = icmp sle i64 %140, %141
  br i1 %142, label %143, label %163

143:                                              ; preds = %130
  %144 = load i64, ptr %11, align 8, !tbaa !8
  %145 = getelementptr inbounds [100000 x i64], ptr @a, i64 0, i64 %144
  %146 = load i64, ptr %145, align 8, !tbaa !8
  %147 = load i64, ptr %5, align 8, !tbaa !8
  %148 = sub nsw i64 %146, %147
  %149 = load i64, ptr %6, align 8, !tbaa !8
  %150 = add nsw i64 %149, %148
  store i64 %150, ptr %6, align 8, !tbaa !8
  %151 = load i64, ptr %11, align 8, !tbaa !8
  %152 = getelementptr inbounds [100000 x i64], ptr @a, i64 0, i64 %151
  %153 = load i64, ptr %152, align 8, !tbaa !8
  %154 = load i64, ptr %5, align 8, !tbaa !8
  %155 = sub nsw i64 %153, %154
  %156 = mul nsw i64 2, %155
  %157 = load i64, ptr %7, align 8, !tbaa !8
  %158 = add nsw i64 %157, %156
  store i64 %158, ptr %7, align 8, !tbaa !8
  %159 = load i64, ptr %4, align 8, !tbaa !8
  %160 = add nsw i64 %159, -1
  store i64 %160, ptr %4, align 8, !tbaa !8
  store i64 0, ptr %5, align 8, !tbaa !8
  %161 = load i64, ptr %8, align 8, !tbaa !8
  %162 = add nsw i64 %161, -1
  store i64 %162, ptr %8, align 8, !tbaa !8
  br label %184

163:                                              ; preds = %130
  %164 = load i64, ptr %14, align 8, !tbaa !8
  %165 = load i64, ptr %6, align 8, !tbaa !8
  %166 = add nsw i64 %165, %164
  store i64 %166, ptr %6, align 8, !tbaa !8
  %167 = load i64, ptr %14, align 8, !tbaa !8
  %168 = mul nsw i64 2, %167
  %169 = load i64, ptr %7, align 8, !tbaa !8
  %170 = add nsw i64 %169, %168
  store i64 %170, ptr %7, align 8, !tbaa !8
  %171 = load i64, ptr %14, align 8, !tbaa !8
  %172 = load i64, ptr %5, align 8, !tbaa !8
  %173 = add nsw i64 %172, %171
  store i64 %173, ptr %5, align 8, !tbaa !8
  %174 = load i64, ptr %10, align 8, !tbaa !8
  %175 = getelementptr inbounds [100000 x i64], ptr @a, i64 0, i64 %174
  %176 = load i64, ptr %175, align 8, !tbaa !8
  %177 = load i64, ptr %6, align 8, !tbaa !8
  %178 = add nsw i64 %177, %176
  store i64 %178, ptr %6, align 8, !tbaa !8
  %179 = load i64, ptr %10, align 8, !tbaa !8
  %180 = getelementptr inbounds [100000 x i64], ptr @a, i64 0, i64 %179
  %181 = load i64, ptr %180, align 8, !tbaa !8
  %182 = load i64, ptr %7, align 8, !tbaa !8
  %183 = add nsw i64 %182, %181
  store i64 %183, ptr %7, align 8, !tbaa !8
  br label %184

184:                                              ; preds = %163, %143
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  store i32 0, ptr %9, align 4
  br label %185

185:                                              ; preds = %184, %119, %112, %59
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  %186 = load i32, ptr %9, align 4
  switch i32 %186, label %191 [
    i32 0, label %187
    i32 7, label %188
  ]

187:                                              ; preds = %185
  br label %188

188:                                              ; preds = %187, %185
  %189 = load i64, ptr %8, align 8, !tbaa !8
  %190 = add nsw i64 %189, 1
  store i64 %190, ptr %8, align 8, !tbaa !8
  br label %44, !llvm.loop !13

191:                                              ; preds = %185, %48
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %192

192:                                              ; preds = %191
  %193 = load i64, ptr %7, align 8, !tbaa !8
  %194 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %193)
  %195 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %194, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  %196 = load i32, ptr %1, align 4
  ret i32 %196
}

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

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

; 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)) #3 align 2

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIPxZ4mainE3$_0EvT_S2_T0_"(ptr noundef, ptr noundef) #5

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

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

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 = { 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 #2 = { "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 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"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}


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

@N = external dso_local global i64, align 8
@a = external dso_local global [100000 x i64], align 16
@b = external dso_local global [100000 x i64], align 16
@id = external dso_local global [100000 x i64], align 16
@_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 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %2 = getelementptr i8, ptr %1, i64 -24
  %3 = load i64, ptr %2, align 8
  %4 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %3
  %5 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %4, ptr noundef null)
  %6 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %7 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %8 = load i64, ptr @N, align 8, !tbaa !8
  %9 = icmp sgt i64 %8, 0
  br i1 %9, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  %.lcssa108 = phi i64 [ %8, %0 ], [ %21, %.lr.ph ]
  %10 = getelementptr inbounds i64, ptr @id, i64 %.lcssa108
  tail call void @_ZSt4iotaIPxiEvT_S1_T0_(ptr noundef nonnull @id, ptr noundef nonnull %10, i32 noundef 0)
  %11 = load i64, ptr @N, align 8, !tbaa !8
  %12 = getelementptr inbounds i64, ptr @id, i64 %11
  tail call void @"_ZSt4sortIPxZ4mainE3$_0EvT_S2_T0_"(ptr noundef nonnull @id, ptr noundef nonnull %12)
  %13 = load i64, ptr @N, align 8, !tbaa !8
  %14 = icmp sgt i64 %13, 0
  br i1 %14, label %.lr.ph116.preheader, label %.loopexit

.lr.ph116.preheader:                              ; preds = %._crit_edge
  %15 = add nsw i64 %13, -1
  br label %.lr.ph116

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.0109 = phi i64 [ %20, %.lr.ph ], [ 0, %0 ]
  %16 = getelementptr inbounds [100000 x i64], ptr @a, i64 0, i64 %.0109
  %17 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %16)
  %18 = getelementptr inbounds [100000 x i64], ptr @b, i64 0, i64 %.0109
  %19 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 8 dereferenceable(8) %18)
  %20 = add nuw nsw i64 %.0109, 1
  %21 = load i64, ptr @N, align 8, !tbaa !8
  %22 = icmp slt i64 %20, %21
  br i1 %22, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.lr.ph116:                                        ; preds = %.lr.ph116.preheader, %70
  %.066114 = phi i64 [ %.2.ph, %70 ], [ %15, %.lr.ph116.preheader ]
  %.067113 = phi i64 [ %.269.ph, %70 ], [ 0, %.lr.ph116.preheader ]
  %.070112 = phi i64 [ %.4.ph, %70 ], [ 0, %.lr.ph116.preheader ]
  %.073111 = phi i64 [ %.477.ph, %70 ], [ 0, %.lr.ph116.preheader ]
  %.079110 = phi i64 [ %71, %70 ], [ 0, %.lr.ph116.preheader ]
  %23 = getelementptr inbounds [100000 x i64], ptr @id, i64 0, i64 %.079110
  %24 = load i64, ptr %23, align 8, !tbaa !8
  %25 = getelementptr inbounds [100000 x i64], ptr @id, i64 0, i64 %.066114
  %26 = load i64, ptr %25, align 8, !tbaa !8
  %27 = icmp sgt i64 %.079110, %.066114
  br i1 %27, label %.loopexit, label %28

28:                                               ; preds = %.lr.ph116
  %29 = icmp eq i64 %.079110, %.066114
  br i1 %29, label %30, label %43

30:                                               ; preds = %28
  %31 = getelementptr inbounds [100000 x i64], ptr @a, i64 0, i64 %24
  %32 = load i64, ptr %31, align 8, !tbaa !8
  %33 = sub nsw i64 %32, %.067113
  %34 = getelementptr inbounds [100000 x i64], ptr @b, i64 0, i64 %24
  %35 = load i64, ptr %34, align 8, !tbaa !8
  %.not91 = icmp slt i64 %.070112, %35
  br i1 %.not91, label %36, label %42

36:                                               ; preds = %30
  %37 = sub nsw i64 %35, %.070112
  %.not92 = icmp slt i64 %37, %33
  %38 = shl nsw i64 %33, 1
  %39 = shl nsw i64 %37, 1
  %40 = sub i64 %33, %37
  %41 = add nsw i64 %40, %39
  %.pn = select i1 %.not92, i64 %41, i64 %38
  br label %42

42:                                               ; preds = %30, %36
  %.pn93 = phi i64 [ %.pn, %36 ], [ %33, %30 ]
  %.275 = add nsw i64 %.pn93, %.073111
  br label %.loopexit

43:                                               ; preds = %28
  %44 = getelementptr inbounds [100000 x i64], ptr @b, i64 0, i64 %24
  %45 = load i64, ptr %44, align 8, !tbaa !8
  %.not = icmp slt i64 %.070112, %45
  br i1 %.not, label %51, label %46

46:                                               ; preds = %43
  %47 = getelementptr inbounds [100000 x i64], ptr @a, i64 0, i64 %24
  %48 = load i64, ptr %47, align 8, !tbaa !8
  %49 = add nsw i64 %48, %.070112
  %50 = add nsw i64 %48, %.073111
  br label %70

51:                                               ; preds = %43
  %52 = sub nsw i64 %45, %.070112
  %53 = getelementptr inbounds [100000 x i64], ptr @a, i64 0, i64 %26
  %54 = load i64, ptr %53, align 8, !tbaa !8
  %55 = sub nsw i64 %54, %.067113
  %.not90 = icmp sgt i64 %55, %52
  br i1 %.not90, label %62, label %56

56:                                               ; preds = %51
  %57 = add nsw i64 %55, %.070112
  %58 = shl nsw i64 %55, 1
  %59 = add nsw i64 %58, %.073111
  %60 = add nsw i64 %.066114, -1
  %61 = add nsw i64 %.079110, -1
  br label %70

62:                                               ; preds = %51
  %63 = shl nsw i64 %52, 1
  %64 = add nsw i64 %63, %.073111
  %65 = add nsw i64 %52, %.067113
  %66 = getelementptr inbounds [100000 x i64], ptr @a, i64 0, i64 %24
  %67 = load i64, ptr %66, align 8, !tbaa !8
  %68 = add nsw i64 %67, %45
  %69 = add nsw i64 %64, %67
  br label %70

70:                                               ; preds = %46, %62, %56
  %.281.ph = phi i64 [ %.079110, %62 ], [ %61, %56 ], [ %.079110, %46 ]
  %.477.ph = phi i64 [ %69, %62 ], [ %59, %56 ], [ %50, %46 ]
  %.4.ph = phi i64 [ %68, %62 ], [ %57, %56 ], [ %49, %46 ]
  %.269.ph = phi i64 [ %65, %62 ], [ 0, %56 ], [ %.067113, %46 ]
  %.2.ph = phi i64 [ %.066114, %62 ], [ %60, %56 ], [ %.066114, %46 ]
  %71 = add nsw i64 %.281.ph, 1
  %72 = icmp slt i64 %71, %13
  br i1 %72, label %.lr.ph116, label %.loopexit, !llvm.loop !13

.loopexit:                                        ; preds = %70, %.lr.ph116, %._crit_edge, %42
  %.5 = phi i64 [ %.275, %42 ], [ 0, %._crit_edge ], [ %.477.ph, %70 ], [ %.073111, %.lr.ph116 ]
  %73 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.5)
  %74 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %73, i8 noundef signext 10)
  ret i32 0
}

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

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

; 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 #3 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare hidden void @"_ZSt4sortIPxZ4mainE3$_0EvT_S2_T0_"(ptr noundef, ptr noundef) local_unnamed_addr #4

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

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

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 = { 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 #2 = { "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 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 = { 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" }

!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,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass