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

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

@n = external dso_local global i64, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 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 i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %9 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %10 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %11 = getelementptr i8, ptr %10, i64 -24
  %12 = load i64, ptr %11, align 8
  %13 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %12
  %14 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %13, ptr noundef null)
  %15 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %16 = getelementptr i8, ptr %15, i64 -24
  %17 = load i64, ptr %16, align 8
  %18 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %17
  %19 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %18, ptr noundef null)
  %20 = 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)
  %21 = load i64, ptr @n, align 8, !tbaa !8
  %22 = icmp eq i64 %21, 0
  br i1 %22, label %23, label %26

23:                                               ; preds = %0
  %24 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %25 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %24, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  br label %237

26:                                               ; preds = %0
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  store i64 0, ptr %2, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  store i64 600000000, ptr %3, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  br label %27

27:                                               ; preds = %50, %26
  %28 = load i64, ptr %2, align 8, !tbaa !8
  %29 = add nsw i64 %28, 1
  %30 = load i64, ptr %3, align 8, !tbaa !8
  %31 = icmp slt i64 %29, %30
  br i1 %31, label %32, label %51

32:                                               ; preds = %27
  %33 = load i64, ptr %2, align 8, !tbaa !8
  %34 = load i64, ptr %3, align 8, !tbaa !8
  %35 = add nsw i64 %33, %34
  %36 = sdiv i64 %35, 2
  store i64 %36, ptr %4, align 8, !tbaa !8
  %37 = load i64, ptr %4, align 8, !tbaa !8
  %38 = load i64, ptr %4, align 8, !tbaa !8
  %39 = add nsw i64 %38, 1
  %40 = mul nsw i64 %37, %39
  %41 = mul nsw i64 %40, 3
  %42 = add nsw i64 1, %41
  %43 = load i64, ptr @n, align 8, !tbaa !8
  %44 = add nsw i64 %43, 1
  %45 = icmp sle i64 %42, %44
  br i1 %45, label %46, label %48

46:                                               ; preds = %32
  %47 = load i64, ptr %4, align 8, !tbaa !8
  store i64 %47, ptr %2, align 8, !tbaa !8
  br label %50

48:                                               ; preds = %32
  %49 = load i64, ptr %4, align 8, !tbaa !8
  store i64 %49, ptr %3, align 8, !tbaa !8
  br label %50

50:                                               ; preds = %48, %46
  br label %27, !llvm.loop !11

51:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %52 = load i64, ptr %2, align 8, !tbaa !8
  %53 = icmp eq i64 %52, 0
  br i1 %53, label %54, label %57

54:                                               ; preds = %51
  store i64 2, ptr %5, align 8, !tbaa !8
  store i64 0, ptr %6, align 8, !tbaa !8
  %55 = load i64, ptr %2, align 8, !tbaa !8
  %56 = add nsw i64 %55, 1
  store i64 %56, ptr %2, align 8, !tbaa !8
  br label %69

57:                                               ; preds = %51
  %58 = load i64, ptr %2, align 8, !tbaa !8
  %59 = load i64, ptr %2, align 8, !tbaa !8
  %60 = add nsw i64 %59, 1
  %61 = mul nsw i64 %58, %60
  %62 = mul nsw i64 %61, 3
  %63 = load i64, ptr @n, align 8, !tbaa !8
  %64 = sub nsw i64 %63, %62
  store i64 %64, ptr @n, align 8, !tbaa !8
  %65 = load i64, ptr %2, align 8, !tbaa !8
  %66 = add nsw i64 %65, 1
  store i64 %66, ptr %2, align 8, !tbaa !8
  %67 = load i64, ptr %2, align 8, !tbaa !8
  %68 = mul nsw i64 2, %67
  store i64 %68, ptr %5, align 8, !tbaa !8
  store i64 0, ptr %6, align 8, !tbaa !8
  br label %69

69:                                               ; preds = %57, %54
  %70 = load i64, ptr @n, align 8, !tbaa !8
  %71 = icmp eq i64 %70, 0
  br i1 %71, label %72, label %75

72:                                               ; preds = %69
  %73 = load i64, ptr %5, align 8, !tbaa !8
  %74 = sub nsw i64 %73, 2
  store i64 %74, ptr %5, align 8, !tbaa !8
  br label %75

75:                                               ; preds = %72, %69
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !13
  br label %76

76:                                               ; preds = %226, %75
  %77 = load i32, ptr %7, align 4, !tbaa !13
  %78 = icmp slt i32 %77, 6
  br i1 %78, label %79, label %82

79:                                               ; preds = %76
  %80 = load i64, ptr @n, align 8, !tbaa !8
  %81 = icmp sgt i64 %80, 0
  br label %82

82:                                               ; preds = %79, %76
  %83 = phi i1 [ false, %76 ], [ %81, %79 ]
  br i1 %83, label %85, label %84

84:                                               ; preds = %82
  store i32 4, ptr %8, align 4
  br label %229

85:                                               ; preds = %82
  %86 = load i64, ptr %2, align 8, !tbaa !8
  %87 = load i64, ptr @n, align 8, !tbaa !8
  %88 = icmp sle i64 %86, %87
  br i1 %88, label %89, label %158

89:                                               ; preds = %85
  %90 = load i32, ptr %7, align 4, !tbaa !13
  %91 = icmp eq i32 %90, 0
  br i1 %91, label %92, label %100

92:                                               ; preds = %89
  %93 = load i64, ptr %2, align 8, !tbaa !8
  %94 = load i64, ptr %5, align 8, !tbaa !8
  %95 = sub nsw i64 %94, %93
  store i64 %95, ptr %5, align 8, !tbaa !8
  %96 = load i64, ptr %2, align 8, !tbaa !8
  %97 = mul nsw i64 2, %96
  %98 = load i64, ptr %6, align 8, !tbaa !8
  %99 = add nsw i64 %98, %97
  store i64 %99, ptr %6, align 8, !tbaa !8
  br label %154

100:                                              ; preds = %89
  %101 = load i32, ptr %7, align 4, !tbaa !13
  %102 = icmp eq i32 %101, 1
  br i1 %102, label %103, label %108

103:                                              ; preds = %100
  %104 = load i64, ptr %2, align 8, !tbaa !8
  %105 = mul nsw i64 2, %104
  %106 = load i64, ptr %5, align 8, !tbaa !8
  %107 = sub nsw i64 %106, %105
  store i64 %107, ptr %5, align 8, !tbaa !8
  br label %153

108:                                              ; preds = %100
  %109 = load i32, ptr %7, align 4, !tbaa !13
  %110 = icmp eq i32 %109, 2
  br i1 %110, label %111, label %119

111:                                              ; preds = %108
  %112 = load i64, ptr %2, align 8, !tbaa !8
  %113 = load i64, ptr %5, align 8, !tbaa !8
  %114 = sub nsw i64 %113, %112
  store i64 %114, ptr %5, align 8, !tbaa !8
  %115 = load i64, ptr %2, align 8, !tbaa !8
  %116 = mul nsw i64 2, %115
  %117 = load i64, ptr %6, align 8, !tbaa !8
  %118 = sub nsw i64 %117, %116
  store i64 %118, ptr %6, align 8, !tbaa !8
  br label %152

119:                                              ; preds = %108
  %120 = load i32, ptr %7, align 4, !tbaa !13
  %121 = icmp eq i32 %120, 3
  br i1 %121, label %122, label %130

122:                                              ; preds = %119
  %123 = load i64, ptr %2, align 8, !tbaa !8
  %124 = load i64, ptr %5, align 8, !tbaa !8
  %125 = add nsw i64 %124, %123
  store i64 %125, ptr %5, align 8, !tbaa !8
  %126 = load i64, ptr %2, align 8, !tbaa !8
  %127 = mul nsw i64 2, %126
  %128 = load i64, ptr %6, align 8, !tbaa !8
  %129 = sub nsw i64 %128, %127
  store i64 %129, ptr %6, align 8, !tbaa !8
  br label %151

130:                                              ; preds = %119
  %131 = load i32, ptr %7, align 4, !tbaa !13
  %132 = icmp eq i32 %131, 4
  br i1 %132, label %133, label %138

133:                                              ; preds = %130
  %134 = load i64, ptr %2, align 8, !tbaa !8
  %135 = mul nsw i64 2, %134
  %136 = load i64, ptr %5, align 8, !tbaa !8
  %137 = add nsw i64 %136, %135
  store i64 %137, ptr %5, align 8, !tbaa !8
  br label %150

138:                                              ; preds = %130
  %139 = load i32, ptr %7, align 4, !tbaa !13
  %140 = icmp eq i32 %139, 5
  br i1 %140, label %141, label %149

141:                                              ; preds = %138
  %142 = load i64, ptr %2, align 8, !tbaa !8
  %143 = load i64, ptr %5, align 8, !tbaa !8
  %144 = add nsw i64 %143, %142
  store i64 %144, ptr %5, align 8, !tbaa !8
  %145 = load i64, ptr %2, align 8, !tbaa !8
  %146 = mul nsw i64 2, %145
  %147 = load i64, ptr %6, align 8, !tbaa !8
  %148 = add nsw i64 %147, %146
  store i64 %148, ptr %6, align 8, !tbaa !8
  br label %149

149:                                              ; preds = %141, %138
  br label %150

150:                                              ; preds = %149, %133
  br label %151

151:                                              ; preds = %150, %122
  br label %152

152:                                              ; preds = %151, %111
  br label %153

153:                                              ; preds = %152, %103
  br label %154

154:                                              ; preds = %153, %92
  %155 = load i64, ptr %2, align 8, !tbaa !8
  %156 = load i64, ptr @n, align 8, !tbaa !8
  %157 = sub nsw i64 %156, %155
  store i64 %157, ptr @n, align 8, !tbaa !8
  br label %225

158:                                              ; preds = %85
  %159 = load i64, ptr @n, align 8, !tbaa !8
  store i64 %159, ptr %2, align 8, !tbaa !8
  %160 = load i32, ptr %7, align 4, !tbaa !13
  %161 = icmp eq i32 %160, 0
  br i1 %161, label %162, label %170

162:                                              ; preds = %158
  %163 = load i64, ptr %2, align 8, !tbaa !8
  %164 = load i64, ptr %5, align 8, !tbaa !8
  %165 = sub nsw i64 %164, %163
  store i64 %165, ptr %5, align 8, !tbaa !8
  %166 = load i64, ptr %2, align 8, !tbaa !8
  %167 = mul nsw i64 2, %166
  %168 = load i64, ptr %6, align 8, !tbaa !8
  %169 = add nsw i64 %168, %167
  store i64 %169, ptr %6, align 8, !tbaa !8
  br label %224

170:                                              ; preds = %158
  %171 = load i32, ptr %7, align 4, !tbaa !13
  %172 = icmp eq i32 %171, 1
  br i1 %172, label %173, label %178

173:                                              ; preds = %170
  %174 = load i64, ptr %2, align 8, !tbaa !8
  %175 = mul nsw i64 2, %174
  %176 = load i64, ptr %5, align 8, !tbaa !8
  %177 = sub nsw i64 %176, %175
  store i64 %177, ptr %5, align 8, !tbaa !8
  br label %223

178:                                              ; preds = %170
  %179 = load i32, ptr %7, align 4, !tbaa !13
  %180 = icmp eq i32 %179, 2
  br i1 %180, label %181, label %189

181:                                              ; preds = %178
  %182 = load i64, ptr %2, align 8, !tbaa !8
  %183 = load i64, ptr %5, align 8, !tbaa !8
  %184 = sub nsw i64 %183, %182
  store i64 %184, ptr %5, align 8, !tbaa !8
  %185 = load i64, ptr %2, align 8, !tbaa !8
  %186 = mul nsw i64 2, %185
  %187 = load i64, ptr %6, align 8, !tbaa !8
  %188 = sub nsw i64 %187, %186
  store i64 %188, ptr %6, align 8, !tbaa !8
  br label %222

189:                                              ; preds = %178
  %190 = load i32, ptr %7, align 4, !tbaa !13
  %191 = icmp eq i32 %190, 3
  br i1 %191, label %192, label %200

192:                                              ; preds = %189
  %193 = load i64, ptr %2, align 8, !tbaa !8
  %194 = load i64, ptr %5, align 8, !tbaa !8
  %195 = add nsw i64 %194, %193
  store i64 %195, ptr %5, align 8, !tbaa !8
  %196 = load i64, ptr %2, align 8, !tbaa !8
  %197 = mul nsw i64 2, %196
  %198 = load i64, ptr %6, align 8, !tbaa !8
  %199 = sub nsw i64 %198, %197
  store i64 %199, ptr %6, align 8, !tbaa !8
  br label %221

200:                                              ; preds = %189
  %201 = load i32, ptr %7, align 4, !tbaa !13
  %202 = icmp eq i32 %201, 4
  br i1 %202, label %203, label %208

203:                                              ; preds = %200
  %204 = load i64, ptr %2, align 8, !tbaa !8
  %205 = mul nsw i64 2, %204
  %206 = load i64, ptr %5, align 8, !tbaa !8
  %207 = add nsw i64 %206, %205
  store i64 %207, ptr %5, align 8, !tbaa !8
  br label %220

208:                                              ; preds = %200
  %209 = load i32, ptr %7, align 4, !tbaa !13
  %210 = icmp eq i32 %209, 5
  br i1 %210, label %211, label %219

211:                                              ; preds = %208
  %212 = load i64, ptr %2, align 8, !tbaa !8
  %213 = load i64, ptr %5, align 8, !tbaa !8
  %214 = add nsw i64 %213, %212
  store i64 %214, ptr %5, align 8, !tbaa !8
  %215 = load i64, ptr %2, align 8, !tbaa !8
  %216 = mul nsw i64 2, %215
  %217 = load i64, ptr %6, align 8, !tbaa !8
  %218 = add nsw i64 %217, %216
  store i64 %218, ptr %6, align 8, !tbaa !8
  br label %219

219:                                              ; preds = %211, %208
  br label %220

220:                                              ; preds = %219, %203
  br label %221

221:                                              ; preds = %220, %192
  br label %222

222:                                              ; preds = %221, %181
  br label %223

223:                                              ; preds = %222, %173
  br label %224

224:                                              ; preds = %223, %162
  store i32 4, ptr %8, align 4
  br label %229

225:                                              ; preds = %154
  br label %226

226:                                              ; preds = %225
  %227 = load i32, ptr %7, align 4, !tbaa !13
  %228 = add nsw i32 %227, 1
  store i32 %228, ptr %7, align 4, !tbaa !13
  br label %76, !llvm.loop !15

229:                                              ; preds = %224, %84
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %230

230:                                              ; preds = %229
  %231 = load i64, ptr %5, align 8, !tbaa !8
  %232 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %231)
  %233 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %232, ptr noundef @.str.1)
  %234 = load i64, ptr %6, align 8, !tbaa !8
  %235 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %233, i64 noundef %234)
  %236 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %235, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %8, align 4
  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
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  br label %237

237:                                              ; preds = %230, %23
  %238 = load i32, ptr %1, align 4
  ret i32 %238
}

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: 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: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #4

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

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

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

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { "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 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" }
attributes #5 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!14, !14, i64 0}
!14 = !{!"int", !10, i64 0}
!15 = distinct !{!15, !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
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %2 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %3 = getelementptr i8, ptr %2, i64 -24
  %4 = load i64, ptr %3, align 8
  %5 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %4
  %6 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %5, ptr noundef null)
  %7 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %8 = getelementptr i8, ptr %7, i64 -24
  %9 = load i64, ptr %8, align 8
  %10 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %9
  %11 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %10, ptr noundef null)
  %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 = load i64, ptr @n, align 8
  %14 = icmp eq i64 %13, 0
  br i1 %14, label %15, label %.preheader

15:                                               ; preds = %0
  %16 = 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)
  br label %86

.preheader:                                       ; preds = %0, %.preheader
  %.08193 = phi i64 [ %..081, %.preheader ], [ 600000000, %0 ]
  %.08392 = phi i64 [ %.083., %.preheader ], [ 0, %0 ]
  %17 = add nsw i64 %.08193, %.08392
  %18 = sdiv i64 %17, 2
  %19 = add nsw i64 %18, 1
  %20 = mul i64 %18, 3
  %21 = mul i64 %20, %19
  %.not = icmp sgt i64 %21, %13
  %.083. = select i1 %.not, i64 %.08392, i64 %18
  %..081 = select i1 %.not, i64 %18, i64 %.08193
  %22 = add nsw i64 %.083., 1
  %23 = icmp slt i64 %22, %..081
  br i1 %23, label %.preheader, label %24, !llvm.loop !8

24:                                               ; preds = %.preheader
  %25 = icmp eq i64 %.083., 0
  br i1 %25, label %30, label %26

26:                                               ; preds = %24
  %27 = mul i64 %.083., -3
  %.neg = mul i64 %27, %22
  %28 = add i64 %.neg, %13
  store i64 %28, ptr @n, align 8, !tbaa !10
  %29 = shl nsw i64 %22, 1
  br label %30

30:                                               ; preds = %24, %26
  %31 = phi i64 [ %28, %26 ], [ %13, %24 ]
  %.075 = phi i64 [ %29, %26 ], [ 2, %24 ]
  %32 = icmp eq i64 %31, 0
  %33 = add nsw i64 %.075, -2
  %spec.select = select i1 %32, i64 %33, i64 %.075
  %34 = icmp sgt i64 %31, 0
  br i1 %34, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %30
  %35 = shl nsw i64 %22, 1
  br label %36

36:                                               ; preds = %.lr.ph, %56
  %.096 = phi i32 [ 0, %.lr.ph ], [ %58, %56 ]
  %.195 = phi i64 [ 0, %.lr.ph ], [ %.2, %56 ]
  %.27794 = phi i64 [ %spec.select, %.lr.ph ], [ %.378, %56 ]
  %37 = phi i64 [ %31, %.lr.ph ], [ %57, %56 ]
  %.not.not = icmp slt i64 %.083., %37
  br i1 %.not.not, label %38, label %60

38:                                               ; preds = %36
  switch i32 %.096, label %.thread [
    i32 0, label %39
    i32 1, label %42
    i32 2, label %44
    i32 3, label %47
    i32 4, label %50
    i32 5, label %52
  ]

39:                                               ; preds = %38
  %40 = sub nsw i64 %.27794, %22
  %41 = add nsw i64 %.195, %35
  br label %56

42:                                               ; preds = %38
  %43 = sub nsw i64 %.27794, %35
  br label %56

44:                                               ; preds = %38
  %45 = sub nsw i64 %.27794, %22
  %46 = sub nsw i64 %.195, %35
  br label %56

47:                                               ; preds = %38
  %48 = add nsw i64 %.27794, %22
  %49 = sub nsw i64 %.195, %35
  br label %56

50:                                               ; preds = %38
  %51 = add nsw i64 %.27794, %35
  br label %56

52:                                               ; preds = %38
  %53 = add nsw i64 %.27794, %22
  %54 = add nsw i64 %.195, %35
  br label %.thread

.thread:                                          ; preds = %38, %52
  %.378.ph = phi i64 [ %53, %52 ], [ %.27794, %38 ]
  %.2.ph = phi i64 [ %54, %52 ], [ %.195, %38 ]
  %55 = sub nsw i64 %37, %22
  store i64 %55, ptr @n, align 8, !tbaa !10
  br label %.loopexit

56:                                               ; preds = %42, %47, %50, %44, %39
  %.378 = phi i64 [ %40, %39 ], [ %43, %42 ], [ %45, %44 ], [ %48, %47 ], [ %51, %50 ]
  %.2 = phi i64 [ %41, %39 ], [ %.195, %42 ], [ %46, %44 ], [ %49, %47 ], [ %.195, %50 ]
  %57 = sub nsw i64 %37, %22
  store i64 %57, ptr @n, align 8, !tbaa !10
  %58 = add nuw nsw i32 %.096, 1
  %59 = icmp sgt i64 %57, 0
  br i1 %59, label %36, label %.loopexit, !llvm.loop !13

60:                                               ; preds = %36
  switch i32 %.096, label %default.unreachable [
    i32 0, label %61
    i32 1, label %65
    i32 2, label %68
    i32 3, label %72
    i32 4, label %76
    i32 5, label %79
  ]

61:                                               ; preds = %60
  %62 = sub nsw i64 %.27794, %37
  %63 = shl nuw nsw i64 %37, 1
  %64 = add nsw i64 %63, %.195
  br label %.loopexit

65:                                               ; preds = %60
  %66 = shl nuw nsw i64 %37, 1
  %67 = sub nsw i64 %.27794, %66
  br label %.loopexit

68:                                               ; preds = %60
  %69 = sub nsw i64 %.27794, %37
  %70 = shl nuw nsw i64 %37, 1
  %71 = sub nsw i64 %.195, %70
  br label %.loopexit

72:                                               ; preds = %60
  %73 = add nsw i64 %37, %.27794
  %74 = shl nuw nsw i64 %37, 1
  %75 = sub nsw i64 %.195, %74
  br label %.loopexit

76:                                               ; preds = %60
  %77 = shl nuw nsw i64 %37, 1
  %78 = add nsw i64 %77, %.27794
  br label %.loopexit

79:                                               ; preds = %60
  %80 = add nsw i64 %37, %.27794
  %81 = shl nuw nsw i64 %37, 1
  %82 = add nsw i64 %81, %.195
  br label %.loopexit

default.unreachable:                              ; preds = %60
  unreachable

.loopexit:                                        ; preds = %56, %.thread, %30, %61, %68, %76, %79, %72, %65
  %.5 = phi i64 [ %62, %61 ], [ %67, %65 ], [ %69, %68 ], [ %73, %72 ], [ %78, %76 ], [ %80, %79 ], [ %spec.select, %30 ], [ %.378.ph, %.thread ], [ %.378, %56 ]
  %.4 = phi i64 [ %64, %61 ], [ %.195, %65 ], [ %71, %68 ], [ %75, %72 ], [ %.195, %76 ], [ %82, %79 ], [ 0, %30 ], [ %.2.ph, %.thread ], [ %.2, %56 ]
  %83 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.5)
  %84 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %83, ptr noundef nonnull @.str.1)
  %85 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %84, i64 noundef %.4)
  br label %86

86:                                               ; preds = %.loopexit, %15
  %.sink = phi ptr [ %85, %.loopexit ], [ %16, %15 ]
  %87 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %.sink, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0
}

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 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 @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #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 = { "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 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 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}
!10 = !{!11, !11, i64 0}
!11 = !{!"long long", !12, i64 0}
!12 = !{!"omnipotent char", !7, i64 0}
!13 = distinct !{!13, !9}


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