; LLVM IR from eyangch/competitive-programming :: FacebookHackercup/2022/round1/a1 (a1)

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

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@K = external dso_local global i64, align 8
@A = external dso_local global [500000 x i64], align 16
@B = external dso_local global [500000 x i64], align 16
@R = external dso_local global [500000 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i8, align 1
  %7 = alloca i8, align 1
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i8, align 1
  %12 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %13 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %14 = getelementptr i8, ptr %13, i64 -24
  %15 = load i64, ptr %14, align 8
  %16 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %15
  %17 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %16, ptr noundef null)
  %18 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %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) @T)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  store i64 1, ptr %2, align 8, !tbaa !8
  br label %20

20:                                               ; preds = %188, %0
  %21 = load i64, ptr %2, align 8, !tbaa !8
  %22 = load i64, ptr @T, align 8, !tbaa !8
  %23 = icmp sle i64 %21, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %20
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  br label %191

25:                                               ; preds = %20
  %26 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %27 = load i64, ptr %2, align 8, !tbaa !8
  %28 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %26, i64 noundef %27)
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %28, ptr noundef @.str.1)
  %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) @N)
  %31 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %30, ptr noundef nonnull align 8 dereferenceable(8) @K)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  store i64 0, ptr %4, align 8, !tbaa !8
  br label %32

32:                                               ; preds = %45, %25
  %33 = load i64, ptr %4, align 8, !tbaa !8
  %34 = load i64, ptr @N, align 8, !tbaa !8
  %35 = icmp slt i64 %33, %34
  br i1 %35, label %37, label %36

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

37:                                               ; preds = %32
  %38 = load i64, ptr %4, align 8, !tbaa !8
  %39 = getelementptr inbounds [500000 x i64], ptr @A, i64 0, i64 %38
  %40 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %39)
  %41 = load i64, ptr %4, align 8, !tbaa !8
  %42 = getelementptr inbounds [500000 x i64], ptr @A, i64 0, i64 %41
  %43 = load i64, ptr %42, align 8, !tbaa !8
  %44 = add nsw i64 %43, -1
  store i64 %44, ptr %42, align 8, !tbaa !8
  br label %45

45:                                               ; preds = %37
  %46 = load i64, ptr %4, align 8, !tbaa !8
  %47 = add nsw i64 %46, 1
  store i64 %47, ptr %4, align 8, !tbaa !8
  br label %32, !llvm.loop !11

48:                                               ; preds = %36
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  store i64 0, ptr %5, align 8, !tbaa !8
  br label %49

49:                                               ; preds = %62, %48
  %50 = load i64, ptr %5, align 8, !tbaa !8
  %51 = load i64, ptr @N, align 8, !tbaa !8
  %52 = icmp slt i64 %50, %51
  br i1 %52, label %54, label %53

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

54:                                               ; preds = %49
  %55 = load i64, ptr %5, align 8, !tbaa !8
  %56 = getelementptr inbounds [500000 x i64], ptr @B, i64 0, 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 %5, align 8, !tbaa !8
  %59 = getelementptr inbounds [500000 x i64], ptr @B, i64 0, i64 %58
  %60 = load i64, ptr %59, align 8, !tbaa !8
  %61 = add nsw i64 %60, -1
  store i64 %61, ptr %59, align 8, !tbaa !8
  br label %62

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

65:                                               ; preds = %53
  %66 = load i64, ptr @N, align 8, !tbaa !8
  %67 = icmp eq i64 %66, 2
  br i1 %67, label %68, label %93

68:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #6
  %69 = load i64, ptr @A, align 16, !tbaa !8
  %70 = load i64, ptr @B, align 16, !tbaa !8
  %71 = icmp eq i64 %69, %70
  %72 = zext i1 %71 to i8
  store i8 %72, ptr %6, align 1, !tbaa !14
  %73 = load i8, ptr %6, align 1, !tbaa !14, !range !16, !noundef !17
  %74 = trunc i8 %73 to i1
  br i1 %74, label %75, label %79

75:                                               ; preds = %68
  %76 = load i64, ptr @K, align 8, !tbaa !8
  %77 = srem i64 %76, 2
  %78 = icmp eq i64 %77, 0
  br i1 %78, label %86, label %79

79:                                               ; preds = %75, %68
  %80 = load i8, ptr %6, align 1, !tbaa !14, !range !16, !noundef !17
  %81 = trunc i8 %80 to i1
  br i1 %81, label %89, label %82

82:                                               ; preds = %79
  %83 = load i64, ptr @K, align 8, !tbaa !8
  %84 = srem i64 %83, 2
  %85 = icmp eq i64 %84, 1
  br i1 %85, label %86, label %89

86:                                               ; preds = %82, %75
  %87 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.2)
  %88 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %87, i8 noundef signext 10)
  br label %92

89:                                               ; preds = %82, %79
  %90 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.3)
  %91 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %90, i8 noundef signext 10)
  br label %92

92:                                               ; preds = %89, %86
  store i32 4, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #6
  br label %188

93:                                               ; preds = %65
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #6
  store i8 1, ptr %7, align 1, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store i64 0, ptr %8, align 8, !tbaa !8
  br label %94

94:                                               ; preds = %109, %93
  %95 = load i64, ptr %8, align 8, !tbaa !8
  %96 = load i64, ptr @N, align 8, !tbaa !8
  %97 = icmp slt i64 %95, %96
  br i1 %97, label %99, label %98

98:                                               ; preds = %94
  store i32 11, ptr %3, align 4
  br label %112

99:                                               ; preds = %94
  %100 = load i64, ptr %8, align 8, !tbaa !8
  %101 = getelementptr inbounds [500000 x i64], ptr @A, i64 0, i64 %100
  %102 = load i64, ptr %101, align 8, !tbaa !8
  %103 = load i64, ptr %8, align 8, !tbaa !8
  %104 = getelementptr inbounds [500000 x i64], ptr @B, i64 0, i64 %103
  %105 = load i64, ptr %104, align 8, !tbaa !8
  %106 = icmp ne i64 %102, %105
  br i1 %106, label %107, label %108

107:                                              ; preds = %99
  store i8 0, ptr %7, align 1, !tbaa !14
  store i32 11, ptr %3, align 4
  br label %112

108:                                              ; preds = %99
  br label %109

109:                                              ; preds = %108
  %110 = load i64, ptr %8, align 8, !tbaa !8
  %111 = add nsw i64 %110, 1
  store i64 %111, ptr %8, align 8, !tbaa !8
  br label %94, !llvm.loop !18

112:                                              ; preds = %107, %98
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %113

113:                                              ; preds = %112
  %114 = load i64, ptr @K, align 8, !tbaa !8
  %115 = icmp eq i64 %114, 0
  br i1 %115, label %116, label %126

116:                                              ; preds = %113
  %117 = load i8, ptr %7, align 1, !tbaa !14, !range !16, !noundef !17
  %118 = trunc i8 %117 to i1
  br i1 %118, label %119, label %122

119:                                              ; preds = %116
  %120 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.2)
  %121 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %120, i8 noundef signext 10)
  br label %125

122:                                              ; preds = %116
  %123 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.3)
  %124 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %123, i8 noundef signext 10)
  br label %125

125:                                              ; preds = %122, %119
  store i32 4, ptr %3, align 4
  br label %185

126:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  store i64 0, ptr %9, align 8, !tbaa !8
  br label %127

127:                                              ; preds = %138, %126
  %128 = load i64, ptr %9, align 8, !tbaa !8
  %129 = load i64, ptr @N, align 8, !tbaa !8
  %130 = icmp slt i64 %128, %129
  br i1 %130, label %132, label %131

131:                                              ; preds = %127
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %141

132:                                              ; preds = %127
  %133 = load i64, ptr %9, align 8, !tbaa !8
  %134 = load i64, ptr %9, align 8, !tbaa !8
  %135 = getelementptr inbounds [500000 x i64], ptr @A, i64 0, i64 %134
  %136 = load i64, ptr %135, align 8, !tbaa !8
  %137 = getelementptr inbounds [500000 x i64], ptr @R, i64 0, i64 %136
  store i64 %133, ptr %137, align 8, !tbaa !8
  br label %138

138:                                              ; preds = %132
  %139 = load i64, ptr %9, align 8, !tbaa !8
  %140 = add nsw i64 %139, 1
  store i64 %140, ptr %9, align 8, !tbaa !8
  br label %127, !llvm.loop !19

141:                                              ; preds = %131
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %142 = load i64, ptr @B, align 16, !tbaa !8
  %143 = getelementptr inbounds [500000 x i64], ptr @R, i64 0, i64 %142
  %144 = load i64, ptr %143, align 8, !tbaa !8
  store i64 %144, ptr %10, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 1, ptr %11) #6
  store i8 1, ptr %11, align 1, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  store i64 0, ptr %12, align 8, !tbaa !8
  br label %145

145:                                              ; preds = %164, %141
  %146 = load i64, ptr %12, align 8, !tbaa !8
  %147 = load i64, ptr @N, align 8, !tbaa !8
  %148 = icmp slt i64 %146, %147
  br i1 %148, label %150, label %149

149:                                              ; preds = %145
  store i32 17, ptr %3, align 4
  br label %167

150:                                              ; preds = %145
  %151 = load i64, ptr %12, align 8, !tbaa !8
  %152 = getelementptr inbounds [500000 x i64], ptr @B, i64 0, i64 %151
  %153 = load i64, ptr %152, align 8, !tbaa !8
  %154 = load i64, ptr %10, align 8, !tbaa !8
  %155 = load i64, ptr %12, align 8, !tbaa !8
  %156 = add nsw i64 %154, %155
  %157 = load i64, ptr @N, align 8, !tbaa !8
  %158 = srem i64 %156, %157
  %159 = getelementptr inbounds [500000 x i64], ptr @A, i64 0, i64 %158
  %160 = load i64, ptr %159, align 8, !tbaa !8
  %161 = icmp ne i64 %153, %160
  br i1 %161, label %162, label %163

162:                                              ; preds = %150
  store i8 0, ptr %11, align 1, !tbaa !14
  store i32 17, ptr %3, align 4
  br label %167

163:                                              ; preds = %150
  br label %164

164:                                              ; preds = %163
  %165 = load i64, ptr %12, align 8, !tbaa !8
  %166 = add nsw i64 %165, 1
  store i64 %166, ptr %12, align 8, !tbaa !8
  br label %145, !llvm.loop !20

167:                                              ; preds = %162, %149
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %168

168:                                              ; preds = %167
  %169 = load i64, ptr @K, align 8, !tbaa !8
  %170 = icmp eq i64 %169, 1
  br i1 %170, label %171, label %175

171:                                              ; preds = %168
  %172 = load i8, ptr %7, align 1, !tbaa !14, !range !16, !noundef !17
  %173 = trunc i8 %172 to i1
  br i1 %173, label %174, label %175

174:                                              ; preds = %171
  store i8 0, ptr %11, align 1, !tbaa !14
  br label %175

175:                                              ; preds = %174, %171, %168
  %176 = load i8, ptr %11, align 1, !tbaa !14, !range !16, !noundef !17
  %177 = trunc i8 %176 to i1
  br i1 %177, label %178, label %181

178:                                              ; preds = %175
  %179 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.2)
  %180 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %179, i8 noundef signext 10)
  br label %184

181:                                              ; preds = %175
  %182 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.3)
  %183 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %182, i8 noundef signext 10)
  br label %184

184:                                              ; preds = %181, %178
  call void @llvm.lifetime.end.p0(i64 1, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  store i32 0, ptr %3, align 4
  br label %185

185:                                              ; preds = %184, %125
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #6
  %186 = load i32, ptr %3, align 4
  switch i32 %186, label %193 [
    i32 0, label %187
    i32 4, label %188
  ]

187:                                              ; preds = %185
  br label %188

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

191:                                              ; preds = %24
  %192 = load i32, ptr %1, align 4
  ret i32 %192

193:                                              ; preds = %185
  unreachable
}

; 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: 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) #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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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) #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 = { 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}
!14 = !{!15, !15, i64 0}
!15 = !{!"bool", !10, i64 0}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !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" }

@T = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@K = external dso_local global i64, align 8
@A = external dso_local global [500000 x i64], align 16
@B = external dso_local global [500000 x i64], align 16
@R = external dso_local local_unnamed_addr global [500000 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1

; 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) @T)
  %8 = load i64, ptr @T, align 8, !tbaa !8
  %.not67 = icmp slt i64 %8, 1
  br i1 %.not67, label %._crit_edge71, label %.lr.ph70

._crit_edge71:                                    ; preds = %87, %0
  ret i32 0

.lr.ph70:                                         ; preds = %0, %87
  %.03168 = phi i64 [ %90, %87 ], [ 1, %0 ]
  %9 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str)
  %10 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %9, i64 noundef %.03168)
  %11 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull @.str.1)
  %12 = 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)
  %13 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %12, ptr noundef nonnull align 8 dereferenceable(8) @K)
  %14 = load i64, ptr @N, align 8, !tbaa !8
  %15 = icmp sgt i64 %14, 0
  br i1 %15, label %.lr.ph, label %.thread

.preheader44:                                     ; preds = %.lr.ph
  %16 = icmp sgt i64 %22, 0
  br i1 %16, label %.lr.ph50, label %.thread

.lr.ph:                                           ; preds = %.lr.ph70, %.lr.ph
  %.03648 = phi i64 [ %21, %.lr.ph ], [ 0, %.lr.ph70 ]
  %17 = getelementptr inbounds [500000 x i64], ptr @A, i64 0, i64 %.03648
  %18 = 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) %17)
  %19 = load i64, ptr %17, align 8, !tbaa !8
  %20 = add nsw i64 %19, -1
  store i64 %20, ptr %17, align 8, !tbaa !8
  %21 = add nuw nsw i64 %.03648, 1
  %22 = load i64, ptr @N, align 8, !tbaa !8
  %23 = icmp slt i64 %21, %22
  br i1 %23, label %.lr.ph, label %.preheader44, !llvm.loop !11

._crit_edge:                                      ; preds = %.lr.ph50
  %24 = icmp eq i64 %.pr, 2
  br i1 %24, label %33, label %.preheader43

.preheader43:                                     ; preds = %._crit_edge
  %.not4152 = icmp sgt i64 %.pr, 0
  br i1 %.not4152, label %.lr.ph55.preheader, label %.thread

.lr.ph55.preheader:                               ; preds = %.preheader43
  %25 = load i64, ptr @A, align 16, !tbaa !8
  %26 = load i64, ptr @B, align 16, !tbaa !8
  %.not3993 = icmp eq i64 %25, %26
  br i1 %.not3993, label %.lr.ph95, label %.lr.ph55._crit_edge

.lr.ph50:                                         ; preds = %.preheader44, %.lr.ph50
  %.03549 = phi i64 [ %31, %.lr.ph50 ], [ 0, %.preheader44 ]
  %27 = getelementptr inbounds [500000 x i64], ptr @B, i64 0, i64 %.03549
  %28 = 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) %27)
  %29 = load i64, ptr %27, align 8, !tbaa !8
  %30 = add nsw i64 %29, -1
  store i64 %30, ptr %27, align 8, !tbaa !8
  %31 = add nuw nsw i64 %.03549, 1
  %.pr = load i64, ptr @N, align 8, !tbaa !8
  %32 = icmp slt i64 %31, %.pr
  br i1 %32, label %.lr.ph50, label %._crit_edge, !llvm.loop !13

33:                                               ; preds = %._crit_edge
  %34 = load i64, ptr @A, align 16, !tbaa !8
  %35 = load i64, ptr @B, align 16, !tbaa !8
  %36 = icmp eq i64 %34, %35
  %37 = load i64, ptr @K, align 8, !tbaa !8
  br i1 %36, label %38, label %.critedge

38:                                               ; preds = %33
  %39 = and i64 %37, 1
  %40 = icmp eq i64 %39, 0
  br i1 %40, label %87, label %43

.critedge:                                        ; preds = %33
  %41 = and i64 %37, -9223372036854775807
  %42 = icmp eq i64 %41, 1
  br i1 %42, label %87, label %43

43:                                               ; preds = %38, %.critedge
  br label %87

.lr.ph95:                                         ; preds = %.lr.ph55.preheader, %.lr.ph55
  %.0335394 = phi i64 [ %44, %.lr.ph55 ], [ 0, %.lr.ph55.preheader ]
  %44 = add nuw nsw i64 %.0335394, 1
  %exitcond.not = icmp eq i64 %44, %.pr
  br i1 %exitcond.not, label %.thread, label %.lr.ph55, !llvm.loop !14

.lr.ph55:                                         ; preds = %.lr.ph95
  %45 = getelementptr inbounds [500000 x i64], ptr @A, i64 0, i64 %44
  %46 = load i64, ptr %45, align 8, !tbaa !8
  %47 = getelementptr inbounds [500000 x i64], ptr @B, i64 0, i64 %44
  %48 = load i64, ptr %47, align 8, !tbaa !8
  %.not39 = icmp eq i64 %46, %48
  br i1 %.not39, label %.lr.ph95, label %.lr.ph55._crit_edge.loopexit, !llvm.loop !14

.lr.ph55._crit_edge.loopexit:                     ; preds = %.lr.ph55
  %.not41.le = icmp slt i64 %44, %.pr
  br label %.lr.ph55._crit_edge

.lr.ph55._crit_edge:                              ; preds = %.lr.ph55._crit_edge.loopexit, %.lr.ph55.preheader
  %.not4154.lcssa = phi i1 [ true, %.lr.ph55.preheader ], [ %.not41.le, %.lr.ph55._crit_edge.loopexit ]
  %49 = load i64, ptr @K, align 8, !tbaa !8
  %50 = icmp eq i64 %49, 0
  br i1 %50, label %87, label %.preheader

.thread:                                          ; preds = %.lr.ph95, %.preheader44, %.lr.ph70, %.preheader43
  %.not415285 = phi i1 [ false, %.preheader43 ], [ false, %.lr.ph70 ], [ false, %.preheader44 ], [ %.not4152, %.lr.ph95 ]
  %.lcssa457983 = phi i64 [ %.pr, %.preheader43 ], [ %14, %.lr.ph70 ], [ %22, %.preheader44 ], [ %.pr, %.lr.ph95 ]
  %51 = load i64, ptr @K, align 8, !tbaa !8
  %52 = icmp eq i64 %51, 0
  br i1 %52, label %87, label %.preheader

.preheader:                                       ; preds = %.lr.ph55._crit_edge, %.thread
  %.not415284 = phi i1 [ %.not415285, %.thread ], [ %.not4152, %.lr.ph55._crit_edge ]
  %.lcssa4580 = phi i64 [ %.lcssa457983, %.thread ], [ %.pr, %.lr.ph55._crit_edge ]
  %.not4147 = phi i1 [ false, %.thread ], [ %.not4154.lcssa, %.lr.ph55._crit_edge ]
  %.ph = phi i64 [ %51, %.thread ], [ %49, %.lr.ph55._crit_edge ]
  br i1 %.not415284, label %.lr.ph58.preheader, label %._crit_edge63

.lr.ph58.preheader:                               ; preds = %.preheader
  %53 = add i64 %.lcssa4580, -1
  %xtraiter = and i64 %.lcssa4580, 3
  %54 = icmp ult i64 %53, 3
  br i1 %54, label %._crit_edge59.unr-lcssa, label %.lr.ph58.preheader.new

.lr.ph58.preheader.new:                           ; preds = %.lr.ph58.preheader
  %unroll_iter = and i64 %.lcssa4580, -4
  br label %.lr.ph58

._crit_edge59.unr-lcssa:                          ; preds = %.lr.ph58, %.lr.ph58.preheader
  %.03257.unr = phi i64 [ 0, %.lr.ph58.preheader ], [ %77, %.lr.ph58 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge59, label %.lr.ph58.epil

.lr.ph58.epil:                                    ; preds = %._crit_edge59.unr-lcssa, %.lr.ph58.epil
  %.03257.epil = phi i64 [ %58, %.lr.ph58.epil ], [ %.03257.unr, %._crit_edge59.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph58.epil ], [ 0, %._crit_edge59.unr-lcssa ]
  %55 = getelementptr inbounds [500000 x i64], ptr @A, i64 0, i64 %.03257.epil
  %56 = load i64, ptr %55, align 8, !tbaa !8
  %57 = getelementptr inbounds [500000 x i64], ptr @R, i64 0, i64 %56
  store i64 %.03257.epil, ptr %57, align 8, !tbaa !8
  %58 = add nuw nsw i64 %.03257.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge59, label %.lr.ph58.epil, !llvm.loop !15

._crit_edge59:                                    ; preds = %.lr.ph58.epil, %._crit_edge59.unr-lcssa
  %59 = load i64, ptr @B, align 16, !tbaa !8
  %60 = getelementptr inbounds [500000 x i64], ptr @R, i64 0, i64 %59
  %61 = load i64, ptr %60, align 8, !tbaa !8
  br i1 %.not415284, label %.lr.ph62, label %._crit_edge63

.lr.ph58:                                         ; preds = %.lr.ph58, %.lr.ph58.preheader.new
  %.03257 = phi i64 [ 0, %.lr.ph58.preheader.new ], [ %77, %.lr.ph58 ]
  %niter = phi i64 [ 0, %.lr.ph58.preheader.new ], [ %niter.next.3, %.lr.ph58 ]
  %62 = getelementptr inbounds [500000 x i64], ptr @A, i64 0, i64 %.03257
  %63 = load i64, ptr %62, align 16, !tbaa !8
  %64 = getelementptr inbounds [500000 x i64], ptr @R, i64 0, i64 %63
  store i64 %.03257, ptr %64, align 8, !tbaa !8
  %65 = or disjoint i64 %.03257, 1
  %66 = getelementptr inbounds [500000 x i64], ptr @A, i64 0, i64 %65
  %67 = load i64, ptr %66, align 8, !tbaa !8
  %68 = getelementptr inbounds [500000 x i64], ptr @R, i64 0, i64 %67
  store i64 %65, ptr %68, align 8, !tbaa !8
  %69 = or disjoint i64 %.03257, 2
  %70 = getelementptr inbounds [500000 x i64], ptr @A, i64 0, i64 %69
  %71 = load i64, ptr %70, align 16, !tbaa !8
  %72 = getelementptr inbounds [500000 x i64], ptr @R, i64 0, i64 %71
  store i64 %69, ptr %72, align 8, !tbaa !8
  %73 = or disjoint i64 %.03257, 3
  %74 = getelementptr inbounds [500000 x i64], ptr @A, i64 0, i64 %73
  %75 = load i64, ptr %74, align 8, !tbaa !8
  %76 = getelementptr inbounds [500000 x i64], ptr @R, i64 0, i64 %75
  store i64 %73, ptr %76, align 8, !tbaa !8
  %77 = add nuw nsw i64 %.03257, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge59.unr-lcssa, label %.lr.ph58, !llvm.loop !17

78:                                               ; preds = %.lr.ph62
  %79 = add nuw nsw i64 %.060, 1
  %exitcond76.not = icmp eq i64 %79, %.lcssa4580
  br i1 %exitcond76.not, label %._crit_edge63, label %.lr.ph62, !llvm.loop !18

.lr.ph62:                                         ; preds = %._crit_edge59, %78
  %.060 = phi i64 [ %79, %78 ], [ 0, %._crit_edge59 ]
  %80 = getelementptr inbounds [500000 x i64], ptr @B, i64 0, i64 %.060
  %81 = load i64, ptr %80, align 8, !tbaa !8
  %82 = add nsw i64 %.060, %61
  %83 = srem i64 %82, %.lcssa4580
  %84 = getelementptr inbounds [500000 x i64], ptr @A, i64 0, i64 %83
  %85 = load i64, ptr %84, align 8, !tbaa !8
  %.not40 = icmp eq i64 %81, %85
  br i1 %.not40, label %78, label %._crit_edge63.thread

._crit_edge63:                                    ; preds = %78, %.preheader, %._crit_edge59
  %86 = icmp ne i64 %.ph, 1
  %spec.select = or i1 %86, %.not4147
  br i1 %spec.select, label %87, label %._crit_edge63.thread

._crit_edge63.thread:                             ; preds = %.lr.ph62, %._crit_edge63
  br label %87

87:                                               ; preds = %._crit_edge63, %.lr.ph55._crit_edge, %.thread, %38, %.critedge, %._crit_edge63.thread, %43
  %.str.3.sink = phi ptr [ @.str.3, %._crit_edge63.thread ], [ @.str.3, %43 ], [ @.str.2, %.critedge ], [ @.str.2, %38 ], [ @.str.2, %.thread ], [ @.str.3, %.lr.ph55._crit_edge ], [ @.str.2, %._crit_edge63 ]
  %88 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull %.str.3.sink)
  %89 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %88, i8 noundef signext 10)
  %90 = add nuw nsw i64 %.03168, 1
  %91 = load i64, ptr @T, align 8, !tbaa !8
  %.not.not = icmp slt i64 %.03168, %91
  br i1 %.not.not, label %.lr.ph70, label %._crit_edge71, !llvm.loop !19
}

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

; 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

; 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

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}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.unroll.disable"}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}


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