; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/Looksery 2015/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"

%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::pair" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@a = external dso_local global [101 x i32], align 16
@b = external dso_local global [101 x i32], align 16
@s = external dso_local global [101 x [101 x i8]], align 16
@res = external dso_local global %"class.std::set", align 8
@.str = 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
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; 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 %"struct.std::pair", align 8
  %9 = alloca i32, align 4
  %10 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %11 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %12 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  store i32 0, ptr %1, align 4
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %14

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

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

19:                                               ; preds = %14
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [101 x [101 x i8]], ptr @s, i64 0, i64 %21
  %23 = getelementptr inbounds [101 x i8], ptr %22, i64 0, i64 0
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %23)
  br label %25

25:                                               ; preds = %19
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %2, align 4, !tbaa !5
  br label %14, !llvm.loop !9

28:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %29

29:                                               ; preds = %39, %28
  %30 = load i32, ptr %3, align 4, !tbaa !5
  %31 = load i32, ptr @n, align 4, !tbaa !5
  %32 = icmp slt i32 %30, %31
  br i1 %32, label %34, label %33

33:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %42

34:                                               ; preds = %29
  %35 = load i32, ptr %3, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [101 x i32], ptr @a, i64 0, i64 %36
  %38 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %37)
  br label %39

39:                                               ; preds = %34
  %40 = load i32, ptr %3, align 4, !tbaa !5
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %3, align 4, !tbaa !5
  br label %29, !llvm.loop !11

42:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %103, %42
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = load i32, ptr @n, align 4, !tbaa !5
  %46 = icmp slt i32 %44, %45
  br i1 %46, label %48, label %47

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

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

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

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

54:                                               ; preds = %49
  %55 = load i32, ptr %6, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [101 x i32], ptr @b, i64 0, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = load i32, ptr %6, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [101 x i32], ptr @a, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = icmp eq i32 %58, %62
  br i1 %63, label %64, label %98

64:                                               ; preds = %54
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %65 = load i32, ptr %6, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %7, align 4, !tbaa !5
  %67 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48) @res, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %68 = getelementptr inbounds { ptr, i8 }, ptr %8, i32 0, i32 0
  %69 = extractvalue { ptr, i8 } %67, 0
  store ptr %69, ptr %68, align 8
  %70 = getelementptr inbounds { ptr, i8 }, ptr %8, i32 0, i32 1
  %71 = extractvalue { ptr, i8 } %67, 1
  store i8 %71, ptr %70, align 8
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %72

72:                                               ; preds = %94, %64
  %73 = load i32, ptr %9, align 4, !tbaa !5
  %74 = load i32, ptr @n, align 4, !tbaa !5
  %75 = icmp slt i32 %73, %74
  br i1 %75, label %77, label %76

76:                                               ; preds = %72
  store i32 14, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %97

77:                                               ; preds = %72
  %78 = load i32, ptr %6, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [101 x [101 x i8]], ptr @s, i64 0, i64 %79
  %81 = load i32, ptr %9, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [101 x i8], ptr %80, i64 0, i64 %82
  %84 = load i8, ptr %83, align 1, !tbaa !12
  %85 = sext i8 %84 to i32
  %86 = icmp eq i32 %85, 49
  br i1 %86, label %87, label %93

87:                                               ; preds = %77
  %88 = load i32, ptr %9, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [101 x i32], ptr @b, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !5
  %92 = add nsw i32 %91, 1
  store i32 %92, ptr %90, align 4, !tbaa !5
  br label %93

93:                                               ; preds = %87, %77
  br label %94

94:                                               ; preds = %93
  %95 = load i32, ptr %9, align 4, !tbaa !5
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr %9, align 4, !tbaa !5
  br label %72, !llvm.loop !13

97:                                               ; preds = %76
  br label %98

98:                                               ; preds = %97, %54
  br label %99

99:                                               ; preds = %98
  %100 = load i32, ptr %6, align 4, !tbaa !5
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %6, align 4, !tbaa !5
  br label %49, !llvm.loop !14

102:                                              ; preds = %53
  br label %103

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

106:                                              ; preds = %47
  %107 = call noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) @res) #5
  %108 = trunc i64 %107 to i32
  %109 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %108)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #5
  %110 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @res) #5
  %111 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %10, i32 0, i32 0
  store ptr %110, ptr %111, align 8
  br label %112

112:                                              ; preds = %121, %106
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  %113 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @res) #5
  %114 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %11, i32 0, i32 0
  store ptr %113, ptr %114, align 8
  %115 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br i1 %115, label %117, label %116

116:                                              ; preds = %112
  store i32 17, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #5
  br label %124

117:                                              ; preds = %112
  %118 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #5
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = call i32 (ptr, ...) @printf(ptr noundef @.str.4, i32 noundef %119)
  br label %121

121:                                              ; preds = %117
  %122 = call ptr @_ZNSt23_Rb_tree_const_iteratorIiEppEi(ptr noundef nonnull align 8 dereferenceable(8) %10, i32 noundef 0) #5
  %123 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %12, i32 0, i32 0
  store ptr %122, ptr %123, align 8
  br label %112, !llvm.loop !16

124:                                              ; preds = %116
  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: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt23_Rb_tree_const_iteratorIiEppEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #4 align 2

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #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 = !{!7, !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !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::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@n = external dso_local global i32, align 4
@a = external dso_local global [101 x i32], align 16
@b = external dso_local local_unnamed_addr global [101 x i32], align 16
@s = external dso_local global [101 x [101 x i8]], align 16
@res = external dso_local global %"class.std::set", align 8
@.str = 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
@.str.4 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %3 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %5 = load i32, ptr @n, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %._crit_edge33

.preheader24:                                     ; preds = %.lr.ph
  %7 = icmp sgt i32 %10, 0
  br i1 %7, label %.lr.ph27, label %._crit_edge33

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

.preheader23:                                     ; preds = %.lr.ph27
  %13 = icmp sgt i32 %16, 0
  br i1 %13, label %.preheader, label %._crit_edge33

.lr.ph27:                                         ; preds = %.preheader24, %.lr.ph27
  %indvars.iv39 = phi i64 [ %indvars.iv.next40, %.lr.ph27 ], [ 0, %.preheader24 ]
  %14 = getelementptr inbounds [101 x i32], ptr @a, i64 0, i64 %indvars.iv39
  %15 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %14)
  %indvars.iv.next40 = add nuw nsw i64 %indvars.iv39, 1
  %16 = load i32, ptr @n, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = icmp slt i64 %indvars.iv.next40, %17
  br i1 %18, label %.lr.ph27, label %.preheader23, !llvm.loop !11

.preheader:                                       ; preds = %.preheader23, %._crit_edge
  %19 = phi i32 [ %27, %._crit_edge ], [ %16, %.preheader23 ]
  %.02132 = phi i32 [ %28, %._crit_edge ], [ 0, %.preheader23 ]
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %.lr.ph31, label %._crit_edge

._crit_edge33:                                    ; preds = %._crit_edge, %0, %.preheader24, %.preheader23
  %21 = call noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) @res) #5
  %22 = trunc i64 %21 to i32
  %23 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %22)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  %24 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @res) #5
  store ptr %24, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %25 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @res) #5
  store ptr %25, ptr %3, align 8
  %26 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  br i1 %26, label %.lr.ph35, label %._crit_edge36

._crit_edge:                                      ; preds = %.loopexit, %.preheader
  %27 = phi i32 [ %19, %.preheader ], [ %66, %.loopexit ]
  %28 = add nuw nsw i32 %.02132, 1
  %29 = icmp slt i32 %28, %27
  br i1 %29, label %.preheader, label %._crit_edge33, !llvm.loop !12

.lr.ph31:                                         ; preds = %.preheader, %.loopexit
  %30 = phi i32 [ %66, %.loopexit ], [ %19, %.preheader ]
  %31 = phi i32 [ %67, %.loopexit ], [ %19, %.preheader ]
  %indvars.iv45 = phi i64 [ %indvars.iv.next46.pre-phi, %.loopexit ], [ 0, %.preheader ]
  %32 = getelementptr inbounds [101 x i32], ptr @b, i64 0, i64 %indvars.iv45
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = getelementptr inbounds [101 x i32], ptr @a, i64 0, i64 %indvars.iv45
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = icmp eq i32 %33, %35
  br i1 %36, label %37, label %.lr.ph31..loopexit_crit_edge

.lr.ph31..loopexit_crit_edge:                     ; preds = %.lr.ph31
  %.pre = add nuw nsw i64 %indvars.iv45, 1
  br label %.loopexit

37:                                               ; preds = %.lr.ph31
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %38 = add nuw nsw i64 %indvars.iv45, 1
  %39 = trunc nuw nsw i64 %38 to i32
  store i32 %39, ptr %1, align 4, !tbaa !5
  %40 = call { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48) @res, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %41 = load i32, ptr @n, align 4, !tbaa !5
  %42 = icmp sgt i32 %41, 0
  br i1 %42, label %.lr.ph29.preheader, label %.loopexit

.lr.ph29.preheader:                               ; preds = %37
  %wide.trip.count = zext nneg i32 %41 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %43 = icmp eq i32 %41, 1
  br i1 %43, label %.loopexit.loopexit.unr-lcssa, label %.lr.ph29.preheader.new

.lr.ph29.preheader.new:                           ; preds = %.lr.ph29.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  br label %.lr.ph29

.lr.ph29:                                         ; preds = %58, %.lr.ph29.preheader.new
  %indvars.iv42 = phi i64 [ 0, %.lr.ph29.preheader.new ], [ %indvars.iv.next43.1, %58 ]
  %niter = phi i64 [ 0, %.lr.ph29.preheader.new ], [ %niter.next.1, %58 ]
  %44 = getelementptr inbounds [101 x [101 x i8]], ptr @s, i64 0, i64 %indvars.iv45, i64 %indvars.iv42
  %45 = load i8, ptr %44, align 1, !tbaa !14
  %46 = icmp eq i8 %45, 49
  br i1 %46, label %47, label %.lr.ph29.1

47:                                               ; preds = %.lr.ph29
  %48 = getelementptr inbounds [101 x i32], ptr @b, i64 0, i64 %indvars.iv42
  %49 = load i32, ptr %48, align 8, !tbaa !5
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %48, align 8, !tbaa !5
  br label %.lr.ph29.1

.lr.ph29.1:                                       ; preds = %.lr.ph29, %47
  %indvars.iv.next43 = or disjoint i64 %indvars.iv42, 1
  %51 = getelementptr inbounds [101 x [101 x i8]], ptr @s, i64 0, i64 %indvars.iv45, i64 %indvars.iv.next43
  %52 = load i8, ptr %51, align 1, !tbaa !14
  %53 = icmp eq i8 %52, 49
  br i1 %53, label %54, label %58

54:                                               ; preds = %.lr.ph29.1
  %55 = getelementptr inbounds [101 x i32], ptr @b, i64 0, i64 %indvars.iv.next43
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %55, align 4, !tbaa !5
  br label %58

58:                                               ; preds = %54, %.lr.ph29.1
  %indvars.iv.next43.1 = add nuw nsw i64 %indvars.iv42, 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 %.loopexit.loopexit.unr-lcssa, label %.lr.ph29, !llvm.loop !15

.loopexit.loopexit.unr-lcssa:                     ; preds = %58, %.lr.ph29.preheader
  %indvars.iv42.unr = phi i64 [ 0, %.lr.ph29.preheader ], [ %indvars.iv.next43.1, %58 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.loopexit, label %.lr.ph29.epil

.lr.ph29.epil:                                    ; preds = %.loopexit.loopexit.unr-lcssa
  %59 = getelementptr inbounds [101 x [101 x i8]], ptr @s, i64 0, i64 %indvars.iv45, i64 %indvars.iv42.unr
  %60 = load i8, ptr %59, align 1, !tbaa !14
  %61 = icmp eq i8 %60, 49
  br i1 %61, label %62, label %.loopexit

62:                                               ; preds = %.lr.ph29.epil
  %63 = getelementptr inbounds [101 x i32], ptr @b, i64 0, i64 %indvars.iv42.unr
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = add nsw i32 %64, 1
  store i32 %65, ptr %63, align 4, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit.unr-lcssa, %62, %.lr.ph29.epil, %.lr.ph31..loopexit_crit_edge, %37
  %indvars.iv.next46.pre-phi = phi i64 [ %.pre, %.lr.ph31..loopexit_crit_edge ], [ %38, %37 ], [ %38, %.lr.ph29.epil ], [ %38, %62 ], [ %38, %.loopexit.loopexit.unr-lcssa ]
  %66 = phi i32 [ %30, %.lr.ph31..loopexit_crit_edge ], [ %41, %37 ], [ %41, %.lr.ph29.epil ], [ %41, %62 ], [ %41, %.loopexit.loopexit.unr-lcssa ]
  %67 = phi i32 [ %31, %.lr.ph31..loopexit_crit_edge ], [ %41, %37 ], [ %41, %.lr.ph29.epil ], [ %41, %62 ], [ %41, %.loopexit.loopexit.unr-lcssa ]
  %68 = sext i32 %67 to i64
  %69 = icmp slt i64 %indvars.iv.next46.pre-phi, %68
  br i1 %69, label %.lr.ph31, label %._crit_edge, !llvm.loop !16

._crit_edge36:                                    ; preds = %.lr.ph35, %._crit_edge33
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  ret i32 0

.lr.ph35:                                         ; preds = %._crit_edge33, %.lr.ph35
  %70 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #5
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4, i32 noundef %71)
  %73 = call ptr @_ZNSt23_Rb_tree_const_iteratorIiEppEi(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef 0) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %74 = call ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @res) #5
  store ptr %74, ptr %3, align 8
  %75 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  br i1 %75, label %.lr.ph35, label %._crit_edge36, !llvm.loop !17
}

; 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: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIiSt4lessIiESaIiEE6insertEOi(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt3setIiSt4lessIiESaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNKSt3setIiSt4lessIiESaIiEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIiES2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNKSt3setIiSt4lessIiESaIiEE3endEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt23_Rb_tree_const_iteratorIiEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt23_Rb_tree_const_iteratorIiEppEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #4 align 2

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #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, !13}
!13 = !{!"llvm.loop.unswitch.partial.disable"}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,SCCPPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass,TailCallElimPass