; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/206 Division 1/Problem A (A)

; 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_ostream" = type { ptr, %"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 }

@n = external dso_local global i32, align 4
@l = external dso_local global i32, align 4
@r = external dso_local global i32, align 4
@q1 = external dso_local global i32, align 4
@q2 = external dso_local global i32, align 4
@w = external dso_local global [100000 x i32], align 16
@LEFT = external dso_local global [100000 x i32], align 16
@RIGHT = external dso_local global [100000 x i32], align 16
@cost = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @l, ptr noundef @r)
  %17 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @q1, ptr noundef @q2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %46, %0
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = load i32, ptr @n, align 4, !tbaa !5
  %21 = icmp slt i32 %19, %20
  br i1 %21, label %23, label %22

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

23:                                               ; preds = %18
  %24 = load i32, ptr %2, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [100000 x i32], ptr @w, i64 0, i64 %25
  %27 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %26)
  %28 = load i32, ptr @l, align 4, !tbaa !5
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [100000 x i32], ptr @w, i64 0, i64 %30
  %32 = load i32, ptr %31, align 4, !tbaa !5
  %33 = mul nsw i32 %28, %32
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [100000 x i32], ptr @LEFT, i64 0, i64 %35
  store i32 %33, ptr %36, align 4, !tbaa !5
  %37 = load i32, ptr @r, align 4, !tbaa !5
  %38 = load i32, ptr %2, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [100000 x i32], ptr @w, i64 0, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !5
  %42 = mul nsw i32 %37, %41
  %43 = load i32, ptr %2, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [100000 x i32], ptr @RIGHT, i64 0, i64 %44
  store i32 %42, ptr %45, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %23
  %47 = load i32, ptr %2, align 4, !tbaa !5
  %48 = add nsw i32 %47, 1
  store i32 %48, ptr %2, align 4, !tbaa !5
  br label %18, !llvm.loop !9

49:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %80, %49
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = load i32, ptr @n, align 4, !tbaa !5
  %53 = icmp slt i32 %51, %52
  br i1 %53, label %55, label %54

54:                                               ; preds = %50
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %83

55:                                               ; preds = %50
  %56 = load i32, ptr %3, align 4, !tbaa !5
  %57 = sub nsw i32 %56, 1
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [100000 x i32], ptr @LEFT, i64 0, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = load i32, ptr %3, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [100000 x i32], ptr @LEFT, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = add nsw i32 %64, %60
  store i32 %65, ptr %63, align 4, !tbaa !5
  %66 = load i32, ptr @n, align 4, !tbaa !5
  %67 = load i32, ptr %3, align 4, !tbaa !5
  %68 = sub nsw i32 %66, %67
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [100000 x i32], ptr @RIGHT, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = load i32, ptr @n, align 4, !tbaa !5
  %73 = load i32, ptr %3, align 4, !tbaa !5
  %74 = sub nsw i32 %72, %73
  %75 = sub nsw i32 %74, 1
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [100000 x i32], ptr @RIGHT, i64 0, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = add nsw i32 %78, %71
  store i32 %79, ptr %77, align 4, !tbaa !5
  br label %80

80:                                               ; preds = %55
  %81 = load i32, ptr %3, align 4, !tbaa !5
  %82 = add nsw i32 %81, 1
  store i32 %82, ptr %3, align 4, !tbaa !5
  br label %50, !llvm.loop !11

83:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  %84 = load i32, ptr @RIGHT, align 16, !tbaa !5
  %85 = load i32, ptr @q2, align 4, !tbaa !5
  %86 = load i32, ptr @n, align 4, !tbaa !5
  %87 = sub nsw i32 %86, 1
  %88 = mul nsw i32 %85, %87
  %89 = add nsw i32 %84, %88
  store i32 %89, ptr %4, align 4, !tbaa !5
  %90 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) @cost)
  %91 = load i32, ptr %90, align 4, !tbaa !5
  store i32 %91, ptr @cost, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %92 = load i32, ptr @n, align 4, !tbaa !5
  %93 = sub nsw i32 %92, 1
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [100000 x i32], ptr @LEFT, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = load i32, ptr @q1, align 4, !tbaa !5
  %98 = load i32, ptr @n, align 4, !tbaa !5
  %99 = sub nsw i32 %98, 1
  %100 = mul nsw i32 %97, %99
  %101 = add nsw i32 %96, %100
  store i32 %101, ptr %5, align 4, !tbaa !5
  %102 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) @cost)
  %103 = load i32, ptr %102, align 4, !tbaa !5
  store i32 %103, ptr @cost, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %104

104:                                              ; preds = %157, %83
  %105 = load i32, ptr %6, align 4, !tbaa !5
  %106 = load i32, ptr @n, align 4, !tbaa !5
  %107 = icmp slt i32 %105, %106
  br i1 %107, label %109, label %108

108:                                              ; preds = %104
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %160

109:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %110 = load i32, ptr %6, align 4, !tbaa !5
  %111 = add nsw i32 %110, 1
  %112 = load i32, ptr @n, align 4, !tbaa !5
  %113 = load i32, ptr %6, align 4, !tbaa !5
  %114 = sub nsw i32 %112, %113
  %115 = sub nsw i32 %114, 1
  %116 = icmp sgt i32 %111, %115
  br i1 %116, label %117, label %119

117:                                              ; preds = %109
  %118 = load i32, ptr @q1, align 4, !tbaa !5
  store i32 %118, ptr %7, align 4, !tbaa !5
  br label %121

119:                                              ; preds = %109
  %120 = load i32, ptr @q2, align 4, !tbaa !5
  store i32 %120, ptr %7, align 4, !tbaa !5
  br label %121

121:                                              ; preds = %119, %117
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %122 = load i32, ptr %6, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [100000 x i32], ptr @LEFT, i64 0, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %126 = load i32, ptr %6, align 4, !tbaa !5
  %127 = add nsw i32 %126, 1
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [100000 x i32], ptr @RIGHT, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = add nsw i32 %125, %130
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %132 = load i32, ptr %6, align 4, !tbaa !5
  %133 = add nsw i32 %132, 1
  store i32 %133, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %134 = load i32, ptr @n, align 4, !tbaa !5
  %135 = load i32, ptr %6, align 4, !tbaa !5
  %136 = sub nsw i32 %134, %135
  %137 = sub nsw i32 %136, 1
  store i32 %137, ptr %11, align 4, !tbaa !5
  %138 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %10, ptr noundef nonnull align 4 dereferenceable(4) %11)
  %139 = load i32, ptr %138, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %140 = load i32, ptr %6, align 4, !tbaa !5
  %141 = add nsw i32 %140, 1
  store i32 %141, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %142 = load i32, ptr @n, align 4, !tbaa !5
  %143 = load i32, ptr %6, align 4, !tbaa !5
  %144 = sub nsw i32 %142, %143
  %145 = sub nsw i32 %144, 1
  store i32 %145, ptr %13, align 4, !tbaa !5
  %146 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %147 = load i32, ptr %146, align 4, !tbaa !5
  %148 = sub nsw i32 %139, %147
  %149 = sub nsw i32 %148, 1
  %150 = load i32, ptr %7, align 4, !tbaa !5
  %151 = mul nsw i32 %149, %150
  store i32 %151, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !5
  %152 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %9, ptr noundef nonnull align 4 dereferenceable(4) %14)
  %153 = load i32, ptr %152, align 4, !tbaa !5
  %154 = add nsw i32 %131, %153
  store i32 %154, ptr %8, align 4, !tbaa !5
  %155 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @cost, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %156 = load i32, ptr %155, align 4, !tbaa !5
  store i32 %156, ptr @cost, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %157

157:                                              ; preds = %121
  %158 = load i32, ptr %6, align 4, !tbaa !5
  %159 = add nsw i32 %158, 1
  store i32 %159, ptr %6, align 4, !tbaa !5
  br label %104, !llvm.loop !12

160:                                              ; preds = %108
  %161 = load i32, ptr @cost, align 4, !tbaa !5
  %162 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %161)
  %163 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %162, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #1

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #1

; 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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}


; 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_ostream" = type { ptr, %"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 }

@n = external dso_local global i32, align 4
@l = external dso_local global i32, align 4
@r = external dso_local global i32, align 4
@q1 = external dso_local global i32, align 4
@q2 = external dso_local global i32, align 4
@w = external dso_local global [100000 x i32], align 16
@LEFT = external dso_local local_unnamed_addr global [100000 x i32], align 16
@RIGHT = external dso_local local_unnamed_addr global [100000 x i32], align 16
@cost = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %11 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @l, ptr noundef nonnull @r)
  %12 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @q1, ptr noundef nonnull @q2)
  %13 = load i32, ptr @n, align 4, !tbaa !5
  %14 = icmp sgt i32 %13, 0
  br i1 %14, label %.lr.ph, label %._crit_edge

.preheader:                                       ; preds = %.lr.ph
  %15 = icmp sgt i32 %29, 1
  br i1 %15, label %.lr.ph30.preheader, label %._crit_edge

.lr.ph30.preheader:                               ; preds = %.preheader
  %16 = zext nneg i32 %29 to i64
  %wide.trip.count = zext nneg i32 %29 to i64
  %.pre = load i32, ptr @LEFT, align 16, !tbaa !5
  %17 = shl nuw nsw i64 %wide.trip.count, 2
  %scevgep = getelementptr i8, ptr getelementptr (i8, ptr @RIGHT, i64 -4), i64 %17
  %load_initial = load i32, ptr %scevgep, align 4
  %18 = add nsw i64 %wide.trip.count, -1
  %xtraiter = and i64 %18, 1
  %19 = icmp eq i32 %29, 2
  br i1 %19, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph30.preheader.new

.lr.ph30.preheader.new:                           ; preds = %.lr.ph30.preheader
  %unroll_iter = and i64 %18, -2
  br label %.lr.ph30

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %20 = getelementptr inbounds [100000 x i32], ptr @w, i64 0, i64 %indvars.iv
  %21 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %20)
  %22 = load i32, ptr @l, align 4, !tbaa !5
  %23 = load i32, ptr %20, align 4, !tbaa !5
  %24 = mul nsw i32 %23, %22
  %25 = getelementptr inbounds [100000 x i32], ptr @LEFT, i64 0, i64 %indvars.iv
  store i32 %24, ptr %25, align 4, !tbaa !5
  %26 = load i32, ptr @r, align 4, !tbaa !5
  %27 = mul nsw i32 %26, %23
  %28 = getelementptr inbounds [100000 x i32], ptr @RIGHT, i64 0, i64 %indvars.iv
  store i32 %27, ptr %28, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %29 = load i32, ptr @n, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = icmp slt i64 %indvars.iv.next, %30
  br i1 %31, label %.lr.ph, label %.preheader, !llvm.loop !9

._crit_edge.loopexit.unr-lcssa:                   ; preds = %.lr.ph30, %.lr.ph30.preheader
  %store_forwarded.unr = phi i32 [ %load_initial, %.lr.ph30.preheader ], [ %74, %.lr.ph30 ]
  %.unr = phi i32 [ %.pre, %.lr.ph30.preheader ], [ %70, %.lr.ph30 ]
  %indvars.iv37.unr = phi i64 [ 1, %.lr.ph30.preheader ], [ %indvars.iv.next38.1, %.lr.ph30 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph30.epil

.lr.ph30.epil:                                    ; preds = %._crit_edge.loopexit.unr-lcssa
  %32 = getelementptr inbounds [100000 x i32], ptr @LEFT, i64 0, i64 %indvars.iv37.unr
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = add nsw i32 %33, %.unr
  store i32 %34, ptr %32, align 4, !tbaa !5
  %35 = xor i64 %indvars.iv37.unr, -1
  %36 = add nsw i64 %35, %16
  %37 = getelementptr inbounds [100000 x i32], ptr @RIGHT, i64 0, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !5
  %39 = add nsw i32 %38, %store_forwarded.unr
  store i32 %39, ptr %37, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph30.epil, %._crit_edge.loopexit.unr-lcssa, %0, %.preheader
  %.lcssa44 = phi i32 [ %29, %.preheader ], [ %13, %0 ], [ %29, %._crit_edge.loopexit.unr-lcssa ], [ %29, %.lr.ph30.epil ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %40 = load i32, ptr @RIGHT, align 16, !tbaa !5
  %41 = load i32, ptr @q2, align 4, !tbaa !5
  %42 = add nsw i32 %.lcssa44, -1
  %43 = mul nsw i32 %41, %42
  %44 = add nsw i32 %43, %40
  store i32 %44, ptr %1, align 4, !tbaa !5
  %45 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) @cost)
  %46 = load i32, ptr %45, align 4, !tbaa !5
  store i32 %46, ptr @cost, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %47 = load i32, ptr @n, align 4, !tbaa !5
  %48 = add nsw i32 %47, -1
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [100000 x i32], ptr @LEFT, i64 0, i64 %49
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = load i32, ptr @q1, align 4, !tbaa !5
  %53 = mul nsw i32 %52, %48
  %54 = add nsw i32 %53, %51
  store i32 %54, ptr %2, align 4, !tbaa !5
  %55 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) @cost)
  %56 = load i32, ptr %55, align 4, !tbaa !5
  store i32 %56, ptr @cost, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  %57 = load i32, ptr @n, align 4, !tbaa !5
  %58 = icmp sgt i32 %57, 0
  br i1 %58, label %.lr.ph33, label %._crit_edge34

.lr.ph30:                                         ; preds = %.lr.ph30, %.lr.ph30.preheader.new
  %store_forwarded = phi i32 [ %load_initial, %.lr.ph30.preheader.new ], [ %74, %.lr.ph30 ]
  %59 = phi i32 [ %.pre, %.lr.ph30.preheader.new ], [ %70, %.lr.ph30 ]
  %indvars.iv37 = phi i64 [ 1, %.lr.ph30.preheader.new ], [ %indvars.iv.next38.1, %.lr.ph30 ]
  %niter = phi i64 [ 0, %.lr.ph30.preheader.new ], [ %niter.next.1, %.lr.ph30 ]
  %60 = getelementptr inbounds [100000 x i32], ptr @LEFT, i64 0, i64 %indvars.iv37
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = add nsw i32 %61, %59
  store i32 %62, ptr %60, align 4, !tbaa !5
  %63 = xor i64 %indvars.iv37, -1
  %64 = add nsw i64 %63, %16
  %65 = getelementptr inbounds [100000 x i32], ptr @RIGHT, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = add nsw i32 %66, %store_forwarded
  store i32 %67, ptr %65, align 4, !tbaa !5
  %indvars.iv.next38 = add nuw nsw i64 %indvars.iv37, 1
  %68 = getelementptr inbounds [100000 x i32], ptr @LEFT, i64 0, i64 %indvars.iv.next38
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = add nsw i32 %69, %62
  store i32 %70, ptr %68, align 4, !tbaa !5
  %reass.sub = sub nsw i64 %16, %indvars.iv37
  %71 = add i64 %reass.sub, -2
  %72 = getelementptr inbounds [100000 x i32], ptr @RIGHT, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = add nsw i32 %73, %67
  store i32 %74, ptr %72, align 4, !tbaa !5
  %indvars.iv.next38.1 = add nuw nsw i64 %indvars.iv37, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph30, !llvm.loop !11

._crit_edge34:                                    ; preds = %.lr.ph33, %._crit_edge
  %75 = phi i32 [ %56, %._crit_edge ], [ %102, %.lr.ph33 ]
  %76 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %75)
  %77 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %76, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0

.lr.ph33:                                         ; preds = %._crit_edge, %.lr.ph33
  %indvars.iv40 = phi i64 [ %indvars.iv.next41, %.lr.ph33 ], [ 0, %._crit_edge ]
  %78 = phi i32 [ %103, %.lr.ph33 ], [ %57, %._crit_edge ]
  %indvars.iv.next41 = add nuw nsw i64 %indvars.iv40, 1
  %79 = trunc nuw nsw i64 %indvars.iv40 to i32
  %80 = xor i32 %79, -1
  %81 = add i32 %78, %80
  %82 = sext i32 %81 to i64
  %.not = icmp slt i64 %indvars.iv40, %82
  %q2.val = load i32, ptr @q2, align 4
  %q1.val = load i32, ptr @q1, align 4
  %.0 = select i1 %.not, i32 %q2.val, i32 %q1.val
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %83 = getelementptr inbounds [100000 x i32], ptr @LEFT, i64 0, i64 %indvars.iv40
  %84 = load i32, ptr %83, align 4, !tbaa !5
  %85 = getelementptr inbounds [100000 x i32], ptr @RIGHT, i64 0, i64 %indvars.iv.next41
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = add nsw i32 %86, %84
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  %88 = trunc nuw nsw i64 %indvars.iv.next41 to i32
  store i32 %88, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  store i32 %81, ptr %6, align 4, !tbaa !5
  %89 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %90 = load i32, ptr %89, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %7) #7
  store i32 %88, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %8) #7
  %91 = load i32, ptr @n, align 4, !tbaa !5
  %92 = add i32 %91, %80
  store i32 %92, ptr %8, align 4, !tbaa !5
  %93 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %94 = load i32, ptr %93, align 4, !tbaa !5
  %95 = xor i32 %94, -1
  %96 = add i32 %90, %95
  %97 = mul nsw i32 %96, %.0
  store i32 %97, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %9) #7
  store i32 0, ptr %9, align 4, !tbaa !5
  %98 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %4, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = add nsw i32 %87, %99
  store i32 %100, ptr %3, align 4, !tbaa !5
  %101 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @cost, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %102 = load i32, ptr %101, align 4, !tbaa !5
  store i32 %102, ptr @cost, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  %103 = load i32, ptr @n, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = icmp slt i64 %indvars.iv.next41, %104
  br i1 %105, label %.lr.ph33, label %._crit_edge34, !llvm.loop !12
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #1

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 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 #5 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)) #6

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 = { nofree 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress 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 = { 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 #7 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}


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