; LLVM IR from VastoLorde95/Competitive-Programming :: Hackerrank/101 Hacks/101 Hack 2017/101 Hack Jan/Problem D (brute)

; 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
@a = external dso_local global i64, align 8
@b = external dso_local global i64, align 8
@q = external dso_local global i64, align 8
@c = external dso_local global [100100 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 [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [137 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z4fastxx(i64 noundef, i64 noundef) #0

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

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

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

30:                                               ; preds = %41, %0
  %31 = load i32, ptr %2, align 4, !tbaa !8
  %32 = sext i32 %31 to i64
  %33 = load i64, ptr @n, align 8, !tbaa !11
  %34 = icmp slt i64 %32, %33
  br i1 %34, label %36, label %35

35:                                               ; preds = %30
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %44

36:                                               ; preds = %30
  %37 = load i32, ptr %2, align 4, !tbaa !8
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [100100 x i64], ptr @c, 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)
  br label %41

41:                                               ; preds = %36
  %42 = load i32, ptr %2, align 4, !tbaa !8
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %2, align 4, !tbaa !8
  br label %30, !llvm.loop !13

44:                                               ; preds = %35
  br label %45

45:                                               ; preds = %194, %192, %44
  %46 = load i64, ptr @q, align 8, !tbaa !11
  %47 = add nsw i64 %46, -1
  store i64 %47, ptr @q, align 8, !tbaa !11
  %48 = icmp ne i64 %46, 0
  br i1 %48, label %49, label %195

49:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  %50 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %51 = load i32, ptr %3, align 4, !tbaa !8
  %52 = icmp eq i32 %51, 1
  br i1 %52, label %53, label %59

53:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  %54 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %55 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %54, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %56 = load i64, ptr %5, align 8, !tbaa !11
  %57 = load i64, ptr %4, align 8, !tbaa !11
  %58 = getelementptr inbounds [100100 x i64], ptr @c, i64 0, i64 %57
  store i64 %56, ptr %58, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  br label %191

59:                                               ; preds = %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %60 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %61 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %60, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %62 = load i64, ptr %6, align 8, !tbaa !11
  %63 = load i64, ptr %7, align 8, !tbaa !11
  %64 = icmp eq i64 %62, %63
  br i1 %64, label %65, label %84

65:                                               ; preds = %59
  %66 = load i64, ptr @a, align 8, !tbaa !11
  %67 = icmp eq i64 %66, 0
  br i1 %67, label %68, label %71

68:                                               ; preds = %65
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %70 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %69, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %83

71:                                               ; preds = %65
  %72 = load i64, ptr %6, align 8, !tbaa !11
  %73 = getelementptr inbounds [100100 x i64], ptr @c, i64 0, i64 %72
  %74 = load i64, ptr %73, align 8, !tbaa !11
  %75 = icmp eq i64 %74, 0
  br i1 %75, label %76, label %79

76:                                               ; preds = %71
  %77 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %78 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %77, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %82

79:                                               ; preds = %71
  %80 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.1)
  %81 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %80, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %82

82:                                               ; preds = %79, %76
  br label %83

83:                                               ; preds = %82, %68
  store i32 5, ptr %8, align 4
  br label %188, !llvm.loop !15

84:                                               ; preds = %59
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %85 = load i64, ptr %7, align 8, !tbaa !11
  %86 = getelementptr inbounds [100100 x i64], ptr @c, i64 0, i64 %85
  %87 = load i64, ptr %86, align 8, !tbaa !11
  %88 = load i64, ptr @a, align 8, !tbaa !11
  %89 = call noundef i64 @_Z4fastxx(i64 noundef %88, i64 noundef 1000000005)
  %90 = mul nsw i64 %87, %89
  %91 = srem i64 %90, 1000000007
  store i64 %91, ptr %9, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  store i64 0, ptr %10, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  store i64 1, ptr %11, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  %92 = load i64, ptr @a, align 8, !tbaa !11
  %93 = load i64, ptr @b, align 8, !tbaa !11
  %94 = call noundef i64 @_Z4fastxx(i64 noundef %93, i64 noundef 1000000005)
  %95 = mul nsw i64 %92, %94
  %96 = srem i64 %95, 1000000007
  store i64 %96, ptr %12, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %97 = load i64, ptr %7, align 8, !tbaa !11
  %98 = sub nsw i64 %97, 1
  %99 = trunc i64 %98 to i32
  store i32 %99, ptr %13, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !8
  br label %100

100:                                              ; preds = %145, %84
  %101 = load i32, ptr %13, align 4, !tbaa !8
  %102 = sext i32 %101 to i64
  %103 = load i64, ptr %6, align 8, !tbaa !11
  %104 = icmp sge i64 %102, %103
  br i1 %104, label %106, label %105

105:                                              ; preds = %100
  store i32 7, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %150

106:                                              ; preds = %100
  %107 = load i32, ptr %14, align 4, !tbaa !8
  %108 = srem i32 %107, 2
  %109 = icmp eq i32 %108, 0
  br i1 %109, label %110, label %122

110:                                              ; preds = %106
  %111 = load i32, ptr %13, align 4, !tbaa !8
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [100100 x i64], ptr @c, i64 0, i64 %112
  %114 = load i64, ptr %113, align 8, !tbaa !11
  %115 = load i64, ptr %11, align 8, !tbaa !11
  %116 = mul nsw i64 %114, %115
  %117 = srem i64 %116, 1000000007
  %118 = load i64, ptr %10, align 8, !tbaa !11
  %119 = add nsw i64 %118, %117
  store i64 %119, ptr %10, align 8, !tbaa !11
  %120 = load i64, ptr %10, align 8, !tbaa !11
  %121 = srem i64 %120, 1000000007
  store i64 %121, ptr %10, align 8, !tbaa !11
  br label %140

122:                                              ; preds = %106
  %123 = load i32, ptr %13, align 4, !tbaa !8
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [100100 x i64], ptr @c, i64 0, i64 %124
  %126 = load i64, ptr %125, align 8, !tbaa !11
  %127 = load i64, ptr %11, align 8, !tbaa !11
  %128 = mul nsw i64 %126, %127
  %129 = srem i64 %128, 1000000007
  %130 = load i64, ptr %10, align 8, !tbaa !11
  %131 = sub nsw i64 %130, %129
  store i64 %131, ptr %10, align 8, !tbaa !11
  %132 = load i64, ptr %10, align 8, !tbaa !11
  %133 = srem i64 %132, 1000000007
  store i64 %133, ptr %10, align 8, !tbaa !11
  %134 = load i64, ptr %10, align 8, !tbaa !11
  %135 = icmp slt i64 %134, 0
  br i1 %135, label %136, label %139

136:                                              ; preds = %122
  %137 = load i64, ptr %10, align 8, !tbaa !11
  %138 = add nsw i64 %137, 1000000007
  store i64 %138, ptr %10, align 8, !tbaa !11
  br label %139

139:                                              ; preds = %136, %122
  br label %140

140:                                              ; preds = %139, %110
  %141 = load i64, ptr %11, align 8, !tbaa !11
  %142 = load i64, ptr %12, align 8, !tbaa !11
  %143 = mul nsw i64 %141, %142
  %144 = srem i64 %143, 1000000007
  store i64 %144, ptr %11, align 8, !tbaa !11
  br label %145

145:                                              ; preds = %140
  %146 = load i32, ptr %13, align 4, !tbaa !8
  %147 = add nsw i32 %146, -1
  store i32 %147, ptr %13, align 4, !tbaa !8
  %148 = load i32, ptr %14, align 4, !tbaa !8
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr %14, align 4, !tbaa !8
  br label %100, !llvm.loop !16

150:                                              ; preds = %105
  %151 = load i64, ptr %10, align 8, !tbaa !11
  %152 = load i64, ptr @b, align 8, !tbaa !11
  %153 = call noundef i64 @_Z4fastxx(i64 noundef %152, i64 noundef 1000000005)
  %154 = mul nsw i64 %151, %153
  %155 = srem i64 %154, 1000000007
  store i64 %155, ptr %10, align 8, !tbaa !11
  %156 = load i64, ptr %10, align 8, !tbaa !11
  %157 = icmp sle i64 0, %156
  br i1 %157, label %158, label %161

158:                                              ; preds = %150
  %159 = load i64, ptr %10, align 8, !tbaa !11
  %160 = icmp slt i64 %159, 1000000007
  br label %161

161:                                              ; preds = %158, %150
  %162 = phi i1 [ false, %150 ], [ %160, %158 ]
  br i1 %162, label %163, label %164

163:                                              ; preds = %161
  br label %166

164:                                              ; preds = %161
  call void @__assert_fail(ptr noundef @.str.2, ptr noundef @.str.3, i32 noundef 111, ptr noundef @__PRETTY_FUNCTION__.main) #8
  unreachable

165:                                              ; No predecessors!
  br label %166

166:                                              ; preds = %165, %163
  %167 = load i64, ptr %9, align 8, !tbaa !11
  %168 = icmp sle i64 0, %167
  br i1 %168, label %169, label %172

169:                                              ; preds = %166
  %170 = load i64, ptr %9, align 8, !tbaa !11
  %171 = icmp slt i64 %170, 1000000007
  br label %172

172:                                              ; preds = %169, %166
  %173 = phi i1 [ false, %166 ], [ %171, %169 ]
  br i1 %173, label %174, label %175

174:                                              ; preds = %172
  br label %177

175:                                              ; preds = %172
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.3, i32 noundef 112, ptr noundef @__PRETTY_FUNCTION__.main) #8
  unreachable

176:                                              ; No predecessors!
  br label %177

177:                                              ; preds = %176, %174
  %178 = load i64, ptr %10, align 8, !tbaa !11
  %179 = load i64, ptr %9, align 8, !tbaa !11
  %180 = icmp eq i64 %178, %179
  br i1 %180, label %181, label %184

181:                                              ; preds = %177
  %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)
  %183 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %182, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %187

184:                                              ; preds = %177
  %185 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.1)
  %186 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %185, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %187

187:                                              ; preds = %184, %181
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  store i32 0, ptr %8, align 4
  br label %188

188:                                              ; preds = %187, %83
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  %189 = load i32, ptr %8, align 4
  switch i32 %189, label %192 [
    i32 0, label %190
  ]

190:                                              ; preds = %188
  br label %191

191:                                              ; preds = %190, %53
  store i32 0, ptr %8, align 4
  br label %192

192:                                              ; preds = %191, %188
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  %193 = load i32, ptr %8, align 4
  switch i32 %193, label %196 [
    i32 0, label %194
    i32 5, label %45
  ]

194:                                              ; preds = %192
  br label %45, !llvm.loop !15

195:                                              ; preds = %45
  ret i32 0

196:                                              ; preds = %192
  unreachable
}

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #6

attributes #0 = { 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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 = { 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 = { 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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }
attributes #8 = { noreturn 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 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}


; 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 i64, align 8
@b = external dso_local global i64, align 8
@q = external dso_local global i64, align 8
@c = external dso_local global [100100 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 [4 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [137 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [25 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z4fastxx(i64 noundef, i64 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %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 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %7 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %8 = getelementptr i8, ptr %7, i64 -24
  %9 = load i64, ptr %8, align 8
  %10 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %9
  %11 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %10, ptr noundef null)
  %12 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %13 = getelementptr i8, ptr %12, i64 -24
  %14 = load i64, ptr %13, align 8
  %15 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %14
  %16 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %15, ptr noundef null)
  %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) @n)
  %18 = 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) @a)
  %19 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %18, ptr noundef nonnull align 8 dereferenceable(8) @b)
  %20 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull align 8 dereferenceable(8) @q)
  %21 = load i64, ptr @n, align 8, !tbaa !8
  %22 = icmp sgt i64 %21, 0
  br i1 %22, label %.lr.ph, label %.preheader

.preheader:                                       ; preds = %.lr.ph, %0
  %23 = load i64, ptr @q, align 8, !tbaa !8
  %24 = add nsw i64 %23, -1
  store i64 %24, ptr @q, align 8, !tbaa !8
  %.not50 = icmp eq i64 %23, 0
  br i1 %.not50, label %._crit_edge52, label %.lr.ph51

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %25 = getelementptr inbounds [100100 x i64], ptr @c, i64 0, i64 %indvars.iv
  %26 = 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) %25)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %27 = load i64, ptr @n, align 8, !tbaa !8
  %28 = icmp sgt i64 %27, %indvars.iv.next
  br i1 %28, label %.lr.ph, label %.preheader, !llvm.loop !11

.lr.ph51:                                         ; preds = %.preheader, %100
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %29 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %30 = load i32, ptr %1, align 4, !tbaa !13
  %31 = icmp eq i32 %30, 1
  br i1 %31, label %32, label %38

32:                                               ; preds = %.lr.ph51
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %33 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %34 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %33, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %35 = load i64, ptr %3, align 8, !tbaa !8
  %36 = load i64, ptr %2, align 8, !tbaa !8
  %37 = getelementptr inbounds [100100 x i64], ptr @c, i64 0, i64 %36
  store i64 %35, ptr %37, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  br label %100

38:                                               ; preds = %.lr.ph51
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %39 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %40 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %39, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %41 = load i64, ptr %4, align 8, !tbaa !8
  %42 = load i64, ptr %5, align 8, !tbaa !8
  %.not41 = icmp eq i64 %41, %42
  br i1 %.not41, label %43, label %50

43:                                               ; preds = %38
  %44 = load i64, ptr @a, align 8, !tbaa !8
  %45 = icmp eq i64 %44, 0
  br i1 %45, label %97, label %46, !llvm.loop !15

46:                                               ; preds = %43
  %47 = getelementptr inbounds [100100 x i64], ptr @c, i64 0, i64 %41
  %48 = load i64, ptr %47, align 8, !tbaa !8
  %49 = icmp eq i64 %48, 0
  %.str..str.1 = select i1 %49, ptr @.str, ptr @.str.1
  br label %97, !llvm.loop !15

50:                                               ; preds = %38
  %51 = getelementptr inbounds [100100 x i64], ptr @c, i64 0, i64 %42
  %52 = load i64, ptr %51, align 8, !tbaa !8
  %53 = load i64, ptr @a, align 8, !tbaa !8
  %54 = call noundef i64 @_Z4fastxx(i64 noundef %53, i64 noundef 1000000005)
  %55 = mul nsw i64 %54, %52
  %56 = srem i64 %55, 1000000007
  %57 = load i64, ptr @a, align 8, !tbaa !8
  %58 = load i64, ptr @b, align 8, !tbaa !8
  %59 = call noundef i64 @_Z4fastxx(i64 noundef %58, i64 noundef 1000000005)
  %60 = mul nsw i64 %59, %57
  %61 = srem i64 %60, 1000000007
  %62 = load i64, ptr %5, align 8, !tbaa !8
  %63 = trunc i64 %62 to i32
  %64 = load i64, ptr %4, align 8, !tbaa !8
  %.02743 = add i32 %63, -1
  %65 = sext i32 %.02743 to i64
  %.not4044 = icmp sgt i64 %64, %65
  br i1 %.not4044, label %._crit_edge, label %.lr.ph49

._crit_edge:                                      ; preds = %86, %50
  %.030.lcssa = phi i64 [ 0, %50 ], [ %.1, %86 ]
  %66 = load i64, ptr @b, align 8, !tbaa !8
  %67 = call noundef i64 @_Z4fastxx(i64 noundef %66, i64 noundef 1000000005)
  %68 = mul nsw i64 %67, %.030.lcssa
  %69 = srem i64 %68, 1000000007
  %70 = icmp sgt i64 %69, -1
  br i1 %70, label %92, label %91

.lr.ph49:                                         ; preds = %50, %86
  %71 = phi i64 [ %90, %86 ], [ %65, %50 ]
  %.02748 = phi i32 [ %.027, %86 ], [ %.02743, %50 ]
  %.047 = phi i32 [ %89, %86 ], [ 0, %50 ]
  %.02946 = phi i64 [ %88, %86 ], [ 1, %50 ]
  %.03045 = phi i64 [ %.1, %86 ], [ 0, %50 ]
  %72 = and i32 %.047, 1
  %73 = icmp eq i32 %72, 0
  %74 = getelementptr inbounds [100100 x i64], ptr @c, i64 0, i64 %71
  %75 = load i64, ptr %74, align 8, !tbaa !8
  %76 = mul nsw i64 %75, %.02946
  %77 = srem i64 %76, 1000000007
  br i1 %73, label %78, label %81

78:                                               ; preds = %.lr.ph49
  %79 = add nsw i64 %77, %.03045
  %80 = srem i64 %79, 1000000007
  br label %86

81:                                               ; preds = %.lr.ph49
  %82 = sub nsw i64 %.03045, %77
  %83 = srem i64 %82, 1000000007
  %84 = icmp slt i64 %83, 0
  %85 = add nsw i64 %83, 1000000007
  %spec.select = select i1 %84, i64 %85, i64 %83
  br label %86

86:                                               ; preds = %81, %78
  %.1 = phi i64 [ %80, %78 ], [ %spec.select, %81 ]
  %87 = mul nsw i64 %.02946, %61
  %88 = srem i64 %87, 1000000007
  %89 = add nuw nsw i32 %.047, 1
  %.027 = add i32 %.02748, -1
  %90 = sext i32 %.027 to i64
  %.not40 = icmp sgt i64 %64, %90
  br i1 %.not40, label %._crit_edge, label %.lr.ph49, !llvm.loop !16

91:                                               ; preds = %._crit_edge
  call void @__assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, i32 noundef 111, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #8
  unreachable

92:                                               ; preds = %._crit_edge
  %93 = icmp sgt i64 %56, -1
  br i1 %93, label %95, label %94

94:                                               ; preds = %92
  call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.3, i32 noundef 112, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #8
  unreachable

95:                                               ; preds = %92
  %96 = icmp eq i64 %69, %56
  %.str..str.154 = select i1 %96, ptr @.str, ptr @.str.1
  br label %97

97:                                               ; preds = %95, %46, %43
  %.str.sink = phi ptr [ @.str, %43 ], [ %.str..str.1, %46 ], [ %.str..str.154, %95 ]
  %98 = 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.sink)
  %99 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %98, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  br label %100

100:                                              ; preds = %97, %32
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  %101 = load i64, ptr @q, align 8, !tbaa !8
  %102 = add nsw i64 %101, -1
  store i64 %102, ptr @q, align 8, !tbaa !8
  %.not = icmp eq i64 %101, 0
  br i1 %.not, label %._crit_edge52, label %.lr.ph51

._crit_edge52:                                    ; preds = %100, %.preheader
  ret i32 0
}

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #6

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "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 = { 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 = { 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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }
attributes #8 = { noreturn 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}
!16 = distinct !{!16, !12}


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