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

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

@n = external dso_local global i32, align 4
@s = external dso_local global i32, align 4
@l = external dso_local global i32, align 4
@a = external dso_local global [262144 x i32], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5buildiii(i32 noundef, i32 noundef, i32 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 uwtable
declare dso_local void @_Z6updateiiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z5queryiiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11sparseTablev() #0

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z3geti(i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %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
  store i32 0, ptr %1, align 4
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @s, ptr noundef @l)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %13

13:                                               ; preds = %23, %0
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = load i32, ptr @n, align 4, !tbaa !5
  %16 = icmp slt i32 %14, %15
  br i1 %16, label %18, label %17

17:                                               ; preds = %13
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %26

18:                                               ; preds = %13
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [262144 x i32], ptr @a, i64 0, i64 %20
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %21)
  br label %23

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

26:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 1000000000, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 -1000000000, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %27

27:                                               ; preds = %43, %26
  %28 = load i32, ptr %5, align 4, !tbaa !5
  %29 = load i32, ptr @l, align 4, !tbaa !5
  %30 = icmp slt i32 %28, %29
  br i1 %30, label %32, label %31

31:                                               ; preds = %27
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %46

32:                                               ; preds = %27
  %33 = load i32, ptr %5, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [262144 x i32], ptr @a, i64 0, i64 %34
  %36 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %35)
  %37 = load i32, ptr %36, align 4, !tbaa !5
  store i32 %37, ptr %3, align 4, !tbaa !5
  %38 = load i32, ptr %5, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [262144 x i32], ptr @a, i64 0, i64 %39
  %41 = 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) %40)
  %42 = load i32, ptr %41, align 4, !tbaa !5
  store i32 %42, ptr %4, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %32
  %44 = load i32, ptr %5, align 4, !tbaa !5
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %5, align 4, !tbaa !5
  br label %27, !llvm.loop !11

46:                                               ; preds = %31
  %47 = load i32, ptr %4, align 4, !tbaa !5
  %48 = load i32, ptr %3, align 4, !tbaa !5
  %49 = sub nsw i32 %47, %48
  %50 = load i32, ptr @s, align 4, !tbaa !5
  %51 = icmp sgt i32 %49, %50
  br i1 %51, label %56, label %52

52:                                               ; preds = %46
  %53 = load i32, ptr @n, align 4, !tbaa !5
  %54 = load i32, ptr @l, align 4, !tbaa !5
  %55 = icmp slt i32 %53, %54
  br i1 %55, label %56, label %58

56:                                               ; preds = %52, %46
  %57 = call i32 @puts(ptr noundef @.str.2)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  br label %118

58:                                               ; preds = %52
  call void @_Z11sparseTablev()
  %59 = load i32, ptr @n, align 4, !tbaa !5
  call void @_Z5buildiii(i32 noundef 1, i32 noundef 0, i32 noundef %59)
  %60 = load i32, ptr @l, align 4, !tbaa !5
  %61 = sub nsw i32 %60, 1
  %62 = load i32, ptr @n, align 4, !tbaa !5
  call void @_Z6updateiiiii(i32 noundef %61, i32 noundef 1, i32 noundef 1, i32 noundef 0, i32 noundef %62)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %63 = load i32, ptr @l, align 4, !tbaa !5
  store i32 %63, ptr %7, align 4, !tbaa !5
  br label %64

64:                                               ; preds = %103, %58
  %65 = load i32, ptr %7, align 4, !tbaa !5
  %66 = load i32, ptr @n, align 4, !tbaa !5
  %67 = icmp slt i32 %65, %66
  br i1 %67, label %69, label %68

68:                                               ; preds = %64
  store i32 8, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %106

69:                                               ; preds = %64
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  %70 = load i32, ptr %7, align 4, !tbaa !5
  %71 = load i32, ptr @l, align 4, !tbaa !5
  %72 = sub nsw i32 %70, %71
  store i32 %72, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  %73 = load i32, ptr %7, align 4, !tbaa !5
  %74 = call noundef i32 @_Z3geti(i32 noundef %73)
  store i32 %74, ptr %9, align 4, !tbaa !5
  %75 = load i32, ptr %9, align 4, !tbaa !5
  %76 = add nsw i32 %75, -1
  store i32 %76, ptr %9, align 4, !tbaa !5
  %77 = load i32, ptr %9, align 4, !tbaa !5
  %78 = load i32, ptr %8, align 4, !tbaa !5
  %79 = icmp sgt i32 %77, %78
  br i1 %79, label %80, label %83

80:                                               ; preds = %69
  %81 = load i32, ptr %7, align 4, !tbaa !5
  %82 = load i32, ptr @n, align 4, !tbaa !5
  call void @_Z6updateiiiii(i32 noundef %81, i32 noundef 1000000000, i32 noundef 1, i32 noundef 0, i32 noundef %82)
  br label %99

83:                                               ; preds = %69
  %84 = load i32, ptr %9, align 4, !tbaa !5
  %85 = icmp eq i32 %84, -1
  br i1 %85, label %86, label %89

86:                                               ; preds = %83
  %87 = load i32, ptr %7, align 4, !tbaa !5
  %88 = load i32, ptr @n, align 4, !tbaa !5
  call void @_Z6updateiiiii(i32 noundef %87, i32 noundef 1, i32 noundef 1, i32 noundef 0, i32 noundef %88)
  store i32 10, ptr %6, align 4
  br label %100

89:                                               ; preds = %83
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %90 = load i32, ptr %9, align 4, !tbaa !5
  %91 = load i32, ptr %8, align 4, !tbaa !5
  %92 = add nsw i32 %91, 1
  %93 = load i32, ptr @n, align 4, !tbaa !5
  %94 = call noundef i32 @_Z5queryiiiii(i32 noundef %90, i32 noundef %92, i32 noundef 1, i32 noundef 0, i32 noundef %93)
  store i32 %94, ptr %10, align 4, !tbaa !5
  %95 = load i32, ptr %7, align 4, !tbaa !5
  %96 = load i32, ptr %10, align 4, !tbaa !5
  %97 = add nsw i32 %96, 1
  %98 = load i32, ptr @n, align 4, !tbaa !5
  call void @_Z6updateiiiii(i32 noundef %95, i32 noundef %97, i32 noundef 1, i32 noundef 0, i32 noundef %98)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %99

99:                                               ; preds = %89, %80
  store i32 0, ptr %6, align 4
  br label %100

100:                                              ; preds = %99, %86
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %101 = load i32, ptr %6, align 4
  switch i32 %101, label %120 [
    i32 0, label %102
    i32 10, label %103
  ]

102:                                              ; preds = %100
  br label %103

103:                                              ; preds = %102, %100
  %104 = load i32, ptr %7, align 4, !tbaa !5
  %105 = add nsw i32 %104, 1
  store i32 %105, ptr %7, align 4, !tbaa !5
  br label %64, !llvm.loop !12

106:                                              ; preds = %68
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %107 = load i32, ptr @n, align 4, !tbaa !5
  %108 = sub nsw i32 %107, 1
  %109 = load i32, ptr @n, align 4, !tbaa !5
  %110 = load i32, ptr @n, align 4, !tbaa !5
  %111 = call noundef i32 @_Z5queryiiiii(i32 noundef %108, i32 noundef %109, i32 noundef 1, i32 noundef 0, i32 noundef %110)
  store i32 %111, ptr %11, align 4, !tbaa !5
  %112 = load i32, ptr %11, align 4, !tbaa !5
  %113 = icmp eq i32 %112, 1000000000
  br i1 %113, label %114, label %115

114:                                              ; preds = %106
  store i32 -1, ptr %11, align 4, !tbaa !5
  br label %115

115:                                              ; preds = %114, %106
  %116 = load i32, ptr %11, align 4, !tbaa !5
  %117 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %116)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %118

118:                                              ; preds = %115, %56
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  %119 = load i32, ptr %1, align 4
  ret i32 %119

120:                                              ; preds = %100
  unreachable
}

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

declare i32 @puts(ptr noundef) #4

declare i32 @printf(ptr noundef, ...) #4

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

@n = external dso_local global i32, align 4
@s = external dso_local global i32, align 4
@l = external dso_local global i32, align 4
@a = external dso_local global [262144 x i32], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z5buildiii(i32 noundef, i32 noundef, i32 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 uwtable
declare dso_local void @_Z6updateiiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z5queryiiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z11sparseTablev() local_unnamed_addr #0

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z3geti(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @s, ptr noundef nonnull @l)
  %4 = load i32, ptr @n, align 4
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  %6 = phi i32 [ %4, %0 ], [ %11, %.lr.ph ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  store i32 1000000000, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  store i32 -1000000000, ptr %2, align 4, !tbaa !5
  %7 = load i32, ptr @l, align 4, !tbaa !5
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %.lr.ph35, label %._crit_edge36

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %9 = getelementptr inbounds [262144 x i32], ptr @a, i64 0, i64 %indvars.iv
  %10 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %9)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %11 = load i32, ptr @n, align 4
  %12 = sext i32 %11 to i64
  %13 = icmp slt i64 %indvars.iv.next, %12
  br i1 %13, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge36.loopexit:                           ; preds = %.lr.ph35
  %.pre = load i32, ptr %1, align 4, !tbaa !5
  %.pre48 = load i32, ptr @n, align 4
  %14 = sub nsw i32 %24, %.pre
  br label %._crit_edge36

._crit_edge36:                                    ; preds = %._crit_edge36.loopexit, %._crit_edge
  %15 = phi i32 [ %6, %._crit_edge ], [ %.pre48, %._crit_edge36.loopexit ]
  %.lcssa31 = phi i32 [ %7, %._crit_edge ], [ %25, %._crit_edge36.loopexit ]
  %16 = phi i32 [ -2000000000, %._crit_edge ], [ %14, %._crit_edge36.loopexit ]
  %17 = load i32, ptr @s, align 4, !tbaa !5
  %18 = icmp sgt i32 %16, %17
  %19 = icmp slt i32 %15, %.lcssa31
  %or.cond = select i1 %18, i1 true, i1 %19
  br i1 %or.cond, label %28, label %30

.lr.ph35:                                         ; preds = %._crit_edge, %.lr.ph35
  %indvars.iv45 = phi i64 [ %indvars.iv.next46, %.lr.ph35 ], [ 0, %._crit_edge ]
  %20 = getelementptr inbounds [262144 x i32], ptr @a, i64 0, i64 %indvars.iv45
  %21 = 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) %20)
  %22 = load i32, ptr %21, align 4, !tbaa !5
  store i32 %22, ptr %1, align 4, !tbaa !5
  %23 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %20)
  %24 = load i32, ptr %23, align 4, !tbaa !5
  store i32 %24, ptr %2, align 4, !tbaa !5
  %indvars.iv.next46 = add nuw nsw i64 %indvars.iv45, 1
  %25 = load i32, ptr @l, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = icmp slt i64 %indvars.iv.next46, %26
  br i1 %27, label %.lr.ph35, label %._crit_edge36.loopexit, !llvm.loop !11

28:                                               ; preds = %._crit_edge36
  %29 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %59

30:                                               ; preds = %._crit_edge36
  call void @_Z11sparseTablev()
  %31 = load i32, ptr @n, align 4, !tbaa !5
  call void @_Z5buildiii(i32 noundef 1, i32 noundef 0, i32 noundef %31)
  %32 = load i32, ptr @l, align 4, !tbaa !5
  %33 = add nsw i32 %32, -1
  %34 = load i32, ptr @n, align 4, !tbaa !5
  call void @_Z6updateiiiii(i32 noundef %33, i32 noundef 1, i32 noundef 1, i32 noundef 0, i32 noundef %34)
  %35 = load i32, ptr @l, align 4, !tbaa !5
  %36 = load i32, ptr @n, align 4, !tbaa !5
  %37 = icmp slt i32 %35, %36
  br i1 %37, label %.lr.ph39, label %._crit_edge40

._crit_edge40:                                    ; preds = %54, %30
  %.lcssa = phi i32 [ %36, %30 ], [ %57, %54 ]
  %38 = add nsw i32 %.lcssa, -1
  %39 = call noundef i32 @_Z5queryiiiii(i32 noundef %38, i32 noundef %.lcssa, i32 noundef 1, i32 noundef 0, i32 noundef %.lcssa)
  %40 = icmp eq i32 %39, 1000000000
  %spec.store.select = select i1 %40, i32 -1, i32 %39
  %41 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %spec.store.select)
  br label %59

.lr.ph39:                                         ; preds = %30, %54
  %.02637 = phi i32 [ %56, %54 ], [ %35, %30 ]
  %42 = load i32, ptr @l, align 4, !tbaa !5
  %43 = sub nsw i32 %.02637, %42
  %44 = call noundef i32 @_Z3geti(i32 noundef %.02637)
  %45 = add nsw i32 %44, -1
  %46 = icmp sgt i32 %45, %43
  br i1 %46, label %54, label %47

47:                                               ; preds = %.lr.ph39
  %48 = icmp eq i32 %44, 0
  br i1 %48, label %54, label %49

49:                                               ; preds = %47
  %50 = add nsw i32 %43, 1
  %51 = load i32, ptr @n, align 4, !tbaa !5
  %52 = call noundef i32 @_Z5queryiiiii(i32 noundef %45, i32 noundef %50, i32 noundef 1, i32 noundef 0, i32 noundef %51)
  %53 = add nsw i32 %52, 1
  br label %54

54:                                               ; preds = %47, %.lr.ph39, %49
  %.sink = phi i32 [ %53, %49 ], [ 1000000000, %.lr.ph39 ], [ 1, %47 ]
  %55 = load i32, ptr @n, align 4, !tbaa !5
  call void @_Z6updateiiiii(i32 noundef %.02637, i32 noundef %.sink, i32 noundef 1, i32 noundef 0, i32 noundef %55)
  %56 = add nsw i32 %.02637, 1
  %57 = load i32, ptr @n, align 4, !tbaa !5
  %58 = icmp slt i32 %56, %57
  br i1 %58, label %.lr.ph39, label %._crit_edge40, !llvm.loop !12

59:                                               ; preds = %._crit_edge40, %28
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret i32 0
}

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

; Function Attrs: nofree nounwind
declare noundef i32 @puts(ptr nocapture noundef readonly) local_unnamed_addr #4

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { 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 #5 = { 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: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass