; LLVM IR from tangjz/acm-icpc :: codeforces (468B)

; 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::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }

@n = external dso_local global i32, align 4
@a = external dso_local global [100001 x i32], align 16
@p = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@dsu = external dso_local global [100001 x i32], align 16
@idx = external dso_local global %"class.std::unordered_map", align 8
@.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 [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1

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

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

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

10:                                               ; preds = %25, %0
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %13 = icmp slt i32 %11, %12
  br i1 %13, label %15, label %14

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

15:                                               ; preds = %10
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds i32, ptr @a, i64 %17
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %18)
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %22
  %24 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt13unordered_mapIiiSt4hashIiESt8equal_toIiESaISt4pairIKiiEEEixERS5_(ptr noundef nonnull align 8 dereferenceable(56) @idx, ptr noundef nonnull align 4 dereferenceable(4) %23)
  store i32 %20, ptr %24, align 4, !tbaa !5
  br label %25

25:                                               ; preds = %15
  %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 %10, !llvm.loop !9

28:                                               ; preds = %14
  %29 = load i32, ptr @n, align 4, !tbaa !5
  %30 = add nsw i32 %29, 2
  %31 = sext i32 %30 to i64
  %32 = mul i64 %31, 4
  call void @llvm.memset.p0.i64(ptr align 16 @dsu, i8 -1, i64 %32, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %33

33:                                               ; preds = %84, %28
  %34 = load i32, ptr %3, align 4, !tbaa !5
  %35 = load i32, ptr @n, align 4, !tbaa !5
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %38, label %37

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

38:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %39 = load i32, ptr @p, align 4, !tbaa !5
  %40 = load i32, ptr %3, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %41
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = sub nsw i32 %39, %43
  store i32 %44, ptr %4, align 4, !tbaa !5
  %45 = call noundef i64 @_ZNKSt13unordered_mapIiiSt4hashIiESt8equal_toIiESaISt4pairIKiiEEE5countERS5_(ptr noundef nonnull align 8 dereferenceable(56) @idx, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %46 = icmp ne i64 %45, 0
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br i1 %46, label %47, label %57

47:                                               ; preds = %38
  %48 = load i32, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %49 = load i32, ptr @p, align 4, !tbaa !5
  %50 = load i32, ptr %3, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = sub nsw i32 %49, %53
  store i32 %54, ptr %5, align 4, !tbaa !5
  %55 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt13unordered_mapIiiSt4hashIiESt8equal_toIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(56) @idx, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %56 = load i32, ptr %55, align 4, !tbaa !5
  call void @_Z9dsu_mergeii(i32 noundef %48, i32 noundef %56)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %61

57:                                               ; preds = %38
  %58 = load i32, ptr %3, align 4, !tbaa !5
  %59 = load i32, ptr @n, align 4, !tbaa !5
  %60 = add nsw i32 %59, 1
  call void @_Z9dsu_mergeii(i32 noundef %58, i32 noundef %60)
  br label %61

61:                                               ; preds = %57, %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %62 = load i32, ptr @q, align 4, !tbaa !5
  %63 = load i32, ptr %3, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = sub nsw i32 %62, %66
  store i32 %67, ptr %6, align 4, !tbaa !5
  %68 = call noundef i64 @_ZNKSt13unordered_mapIiiSt4hashIiESt8equal_toIiESaISt4pairIKiiEEE5countERS5_(ptr noundef nonnull align 8 dereferenceable(56) @idx, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %69 = icmp ne i64 %68, 0
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br i1 %69, label %70, label %80

70:                                               ; preds = %61
  %71 = load i32, ptr %3, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %72 = load i32, ptr @q, align 4, !tbaa !5
  %73 = load i32, ptr %3, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = sub nsw i32 %72, %76
  store i32 %77, ptr %7, align 4, !tbaa !5
  %78 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt13unordered_mapIiiSt4hashIiESt8equal_toIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(56) @idx, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %79 = load i32, ptr %78, align 4, !tbaa !5
  call void @_Z9dsu_mergeii(i32 noundef %71, i32 noundef %79)
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %83

80:                                               ; preds = %61
  %81 = load i32, ptr %3, align 4, !tbaa !5
  %82 = load i32, ptr @n, align 4, !tbaa !5
  call void @_Z9dsu_mergeii(i32 noundef %81, i32 noundef %82)
  br label %83

83:                                               ; preds = %80, %70
  br label %84

84:                                               ; preds = %83
  %85 = load i32, ptr %3, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %3, align 4, !tbaa !5
  br label %33, !llvm.loop !11

87:                                               ; preds = %37
  %88 = load i32, ptr @n, align 4, !tbaa !5
  %89 = call noundef i32 @_Z8dsu_findi(i32 noundef %88)
  %90 = load i32, ptr @n, align 4, !tbaa !5
  %91 = add nsw i32 %90, 1
  %92 = call noundef i32 @_Z8dsu_findi(i32 noundef %91)
  %93 = icmp ne i32 %89, %92
  br i1 %93, label %94, label %122

94:                                               ; preds = %87
  %95 = call i32 @puts(ptr noundef @.str.2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %96

96:                                               ; preds = %118, %94
  %97 = load i32, ptr %8, align 4, !tbaa !5
  %98 = load i32, ptr @n, align 4, !tbaa !5
  %99 = icmp slt i32 %97, %98
  br i1 %99, label %101, label %100

100:                                              ; preds = %96
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %121

101:                                              ; preds = %96
  %102 = load i32, ptr %8, align 4, !tbaa !5
  %103 = call noundef i32 @_Z8dsu_findi(i32 noundef %102)
  %104 = load i32, ptr @n, align 4, !tbaa !5
  %105 = add nsw i32 %104, 1
  %106 = call noundef i32 @_Z8dsu_findi(i32 noundef %105)
  %107 = icmp eq i32 %103, %106
  %108 = zext i1 %107 to i32
  %109 = load i32, ptr %8, align 4, !tbaa !5
  %110 = load i32, ptr @n, align 4, !tbaa !5
  %111 = sub nsw i32 %110, 1
  %112 = icmp eq i32 %109, %111
  %113 = zext i1 %112 to i64
  %114 = getelementptr inbounds [3 x i8], ptr @.str.4, i64 0, i64 %113
  %115 = load i8, ptr %114, align 1, !tbaa !12
  %116 = sext i8 %115 to i32
  %117 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %108, i32 noundef %116)
  br label %118

118:                                              ; preds = %101
  %119 = load i32, ptr %8, align 4, !tbaa !5
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %8, align 4, !tbaa !5
  br label %96, !llvm.loop !13

121:                                              ; preds = %100
  br label %124

122:                                              ; preds = %87
  %123 = call i32 @puts(ptr noundef @.str.5)
  br label %124

124:                                              ; preds = %122, %121
  ret i32 0
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt13unordered_mapIiiSt4hashIiESt8equal_toIiESaISt4pairIKiiEEEixERS5_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt13unordered_mapIiiSt4hashIiESt8equal_toIiESaISt4pairIKiiEEE5countERS5_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt13unordered_mapIiiSt4hashIiESt8equal_toIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

declare i32 @puts(ptr noundef) #2

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

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


; 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::unordered_map" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }

@n = external dso_local global i32, align 4
@a = external dso_local global [100001 x i32], align 16
@p = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@dsu = external dso_local local_unnamed_addr global [100001 x i32], align 16
@idx = external dso_local global %"class.std::unordered_map", align 8
@.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 [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [3 x i8], align 1

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

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

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

._crit_edge.thread:                               ; preds = %0
  %8 = add nsw i32 %6, 2
  %9 = sext i32 %8 to i64
  %10 = shl nsw i64 %9, 2
  tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @dsu, i8 -1, i64 %10, i1 false)
  br label %._crit_edge30

._crit_edge:                                      ; preds = %.lr.ph
  %11 = add nsw i32 %19, 2
  %12 = sext i32 %11 to i64
  %13 = shl nsw i64 %12, 2
  tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @dsu, i8 -1, i64 %13, i1 false)
  %14 = icmp sgt i32 %19, 0
  br i1 %14, label %.lr.ph29, label %._crit_edge30

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %15 = getelementptr inbounds i32, ptr @a, i64 %indvars.iv
  %16 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %15)
  %17 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt13unordered_mapIiiSt4hashIiESt8equal_toIiESaISt4pairIKiiEEEixERS5_(ptr noundef nonnull align 8 dereferenceable(56) @idx, ptr noundef nonnull align 4 dereferenceable(4) %15)
  %18 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %18, ptr %17, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %19 = load i32, ptr @n, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = icmp slt i64 %indvars.iv.next, %20
  br i1 %21, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge30:                                    ; preds = %57, %._crit_edge.thread, %._crit_edge
  %.lcssa = phi i32 [ %19, %._crit_edge ], [ %6, %._crit_edge.thread ], [ %58, %57 ]
  %22 = call noundef i32 @_Z8dsu_findi(i32 noundef %.lcssa)
  %23 = load i32, ptr @n, align 4, !tbaa !5
  %24 = add nsw i32 %23, 1
  %25 = call noundef i32 @_Z8dsu_findi(i32 noundef %24)
  %.not = icmp eq i32 %22, %25
  br i1 %.not, label %82, label %61

.lr.ph29:                                         ; preds = %._crit_edge, %57
  %indvars.iv38 = phi i64 [ %indvars.iv.next39, %57 ], [ 0, %._crit_edge ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %26 = load i32, ptr @p, align 4, !tbaa !5
  %27 = getelementptr inbounds [100001 x i32], ptr @a, i64 0, i64 %indvars.iv38
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = sub nsw i32 %26, %28
  store i32 %29, ptr %1, align 4, !tbaa !5
  %30 = call noundef i64 @_ZNKSt13unordered_mapIiiSt4hashIiESt8equal_toIiESaISt4pairIKiiEEE5countERS5_(ptr noundef nonnull align 8 dereferenceable(56) @idx, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %.not23 = icmp eq i64 %30, 0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  br i1 %.not23, label %38, label %31

31:                                               ; preds = %.lr.ph29
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %32 = load i32, ptr @p, align 4, !tbaa !5
  %33 = load i32, ptr %27, align 4, !tbaa !5
  %34 = sub nsw i32 %32, %33
  store i32 %34, ptr %2, align 4, !tbaa !5
  %35 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt13unordered_mapIiiSt4hashIiESt8equal_toIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(56) @idx, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = trunc nuw nsw i64 %indvars.iv38 to i32
  call void @_Z9dsu_mergeii(i32 noundef %37, i32 noundef %36)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  br label %42

38:                                               ; preds = %.lr.ph29
  %39 = load i32, ptr @n, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  %41 = trunc nuw nsw i64 %indvars.iv38 to i32
  call void @_Z9dsu_mergeii(i32 noundef %41, i32 noundef %40)
  br label %42

42:                                               ; preds = %38, %31
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  %43 = load i32, ptr @q, align 4, !tbaa !5
  %44 = load i32, ptr %27, align 4, !tbaa !5
  %45 = sub nsw i32 %43, %44
  store i32 %45, ptr %3, align 4, !tbaa !5
  %46 = call noundef i64 @_ZNKSt13unordered_mapIiiSt4hashIiESt8equal_toIiESaISt4pairIKiiEEE5countERS5_(ptr noundef nonnull align 8 dereferenceable(56) @idx, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %.not24 = icmp eq i64 %46, 0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  br i1 %.not24, label %54, label %47

47:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  %48 = load i32, ptr @q, align 4, !tbaa !5
  %49 = load i32, ptr %27, align 4, !tbaa !5
  %50 = sub nsw i32 %48, %49
  store i32 %50, ptr %4, align 4, !tbaa !5
  %51 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt13unordered_mapIiiSt4hashIiESt8equal_toIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(56) @idx, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = trunc nuw nsw i64 %indvars.iv38 to i32
  call void @_Z9dsu_mergeii(i32 noundef %53, i32 noundef %52)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  br label %57

54:                                               ; preds = %42
  %55 = load i32, ptr @n, align 4, !tbaa !5
  %56 = trunc nuw nsw i64 %indvars.iv38 to i32
  call void @_Z9dsu_mergeii(i32 noundef %56, i32 noundef %55)
  br label %57

57:                                               ; preds = %47, %54
  %indvars.iv.next39 = add nuw nsw i64 %indvars.iv38, 1
  %58 = load i32, ptr @n, align 4, !tbaa !5
  %59 = sext i32 %58 to i64
  %60 = icmp slt i64 %indvars.iv.next39, %59
  br i1 %60, label %.lr.ph29, label %._crit_edge30, !llvm.loop !11

61:                                               ; preds = %._crit_edge30
  %62 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
  %63 = load i32, ptr @n, align 4, !tbaa !5
  %64 = icmp sgt i32 %63, 0
  br i1 %64, label %.lr.ph34, label %.loopexit

.lr.ph34:                                         ; preds = %61, %.lr.ph34
  %.032 = phi i32 [ %79, %.lr.ph34 ], [ 0, %61 ]
  %65 = call noundef i32 @_Z8dsu_findi(i32 noundef %.032)
  %66 = load i32, ptr @n, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  %68 = call noundef i32 @_Z8dsu_findi(i32 noundef %67)
  %69 = icmp eq i32 %65, %68
  %70 = zext i1 %69 to i32
  %71 = load i32, ptr @n, align 4, !tbaa !5
  %72 = add nsw i32 %71, -1
  %73 = icmp eq i32 %.032, %72
  %74 = zext i1 %73 to i64
  %75 = getelementptr inbounds [3 x i8], ptr @.str.4, i64 0, i64 %74
  %76 = load i8, ptr %75, align 1, !tbaa !12
  %77 = sext i8 %76 to i32
  %78 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %70, i32 noundef %77)
  %79 = add nuw nsw i32 %.032, 1
  %80 = load i32, ptr @n, align 4, !tbaa !5
  %81 = icmp slt i32 %79, %80
  br i1 %81, label %.lr.ph34, label %.loopexit, !llvm.loop !13

82:                                               ; preds = %._crit_edge30
  %83 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.5)
  br label %.loopexit

.loopexit:                                        ; preds = %.lr.ph34, %61, %82
  ret i32 0
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt13unordered_mapIiiSt4hashIiESt8equal_toIiESaISt4pairIKiiEEEixERS5_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt13unordered_mapIiiSt4hashIiESt8equal_toIiESaISt4pairIKiiEEE5countERS5_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt13unordered_mapIiiSt4hashIiESt8equal_toIiESaISt4pairIKiiEEEixEOi(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

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

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

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


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