; LLVM IR from tangjz/acm-icpc :: hackerrank (degree-of-an-algebraic-number)

; 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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, 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 }
%"class.std::bitset" = type { %"struct.std::_Base_bitset" }
%"struct.std::_Base_bitset" = type { [7 x i64] }
%"class.std::bitset<400>::reference" = type { ptr, i64 }

@Hash = external dso_local global %"class.std::map", align 8
@a = external dso_local global [50 x %"class.std::bitset"], align 16
@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@x = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@ans = 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 [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z5indexi(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 %"class.std::bitset<400>::reference", align 8
  %7 = alloca %"class.std::bitset<400>::reference", align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca %"class.std::bitset<400>::reference", align 8
  %12 = alloca i1, align 1
  %13 = alloca i1, align 1
  %14 = alloca %"class.std::bitset<400>::reference", align 8
  store i32 0, ptr %1, align 4
  %15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @t)
  br label %16

16:                                               ; preds = %158, %0
  %17 = load i32, ptr @t, align 4, !tbaa !5
  %18 = add nsw i32 %17, -1
  store i32 %18, ptr @t, align 4, !tbaa !5
  %19 = icmp ne i32 %17, 0
  br i1 %19, label %20, label %163

20:                                               ; preds = %16
  store i32 0, ptr @tot, align 4, !tbaa !5
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @Hash) #5
  %21 = 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 %22

22:                                               ; preds = %87, %20
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = load i32, ptr @n, align 4, !tbaa !5
  %25 = icmp slt i32 %23, %24
  br i1 %25, label %27, label %26

26:                                               ; preds = %22
  store i32 4, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %90

27:                                               ; preds = %22
  %28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @x)
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [50 x %"class.std::bitset"], ptr @a, i64 0, i64 %30
  %32 = call noundef nonnull align 8 dereferenceable(56) ptr @_ZNSt6bitsetILm400EE5resetEv(ptr noundef nonnull align 8 dereferenceable(56) %31) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 2, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  br label %33

33:                                               ; preds = %72, %27
  %34 = load i32, ptr %4, align 4, !tbaa !5
  %35 = load i32, ptr @x, align 4, !tbaa !5
  %36 = load i32, ptr %4, align 4, !tbaa !5
  %37 = sdiv i32 %35, %36
  %38 = icmp sle i32 %34, %37
  br i1 %38, label %40, label %39

39:                                               ; preds = %33
  store i32 7, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %75

40:                                               ; preds = %33
  %41 = load i32, ptr @x, align 4, !tbaa !5
  %42 = load i32, ptr %4, align 4, !tbaa !5
  %43 = srem i32 %41, %42
  %44 = icmp eq i32 %43, 0
  br i1 %44, label %45, label %71

45:                                               ; preds = %40
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %52, %45
  %47 = load i32, ptr @x, align 4, !tbaa !5
  %48 = load i32, ptr %4, align 4, !tbaa !5
  %49 = srem i32 %47, %48
  %50 = icmp eq i32 %49, 0
  br i1 %50, label %51, label %58

51:                                               ; preds = %46
  br label %52

52:                                               ; preds = %51
  %53 = load i32, ptr %4, align 4, !tbaa !5
  %54 = load i32, ptr @x, align 4, !tbaa !5
  %55 = sdiv i32 %54, %53
  store i32 %55, ptr @x, align 4, !tbaa !5
  %56 = load i32, ptr %5, align 4, !tbaa !5
  %57 = add nsw i32 %56, 1
  store i32 %57, ptr %5, align 4, !tbaa !5
  br label %46, !llvm.loop !9

58:                                               ; preds = %46
  %59 = load i32, ptr %5, align 4, !tbaa !5
  %60 = and i32 %59, 1
  %61 = icmp ne i32 %60, 0
  br i1 %61, label %62, label %70

62:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #5
  %63 = load i32, ptr %2, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [50 x %"class.std::bitset"], ptr @a, i64 0, i64 %64
  %66 = load i32, ptr %4, align 4, !tbaa !5
  %67 = call noundef i32 @_Z5indexi(i32 noundef %66)
  %68 = sext i32 %67 to i64
  call void @_ZNSt6bitsetILm400EEixEm(ptr dead_on_unwind writable sret(%"class.std::bitset<400>::reference") align 8 %6, ptr noundef nonnull align 8 dereferenceable(56) %65, i64 noundef %68)
  %69 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm400EE9referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %6, i1 noundef zeroext true) #5
  call void @_ZNSt6bitsetILm400EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %6) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #5
  br label %70

70:                                               ; preds = %62, %58
  br label %71

71:                                               ; preds = %70, %40
  br label %72

72:                                               ; preds = %71
  %73 = load i32, ptr %4, align 4, !tbaa !5
  %74 = add nsw i32 %73, 1
  store i32 %74, ptr %4, align 4, !tbaa !5
  br label %33, !llvm.loop !11

75:                                               ; preds = %39
  %76 = load i32, ptr @x, align 4, !tbaa !5
  %77 = icmp sgt i32 %76, 1
  br i1 %77, label %78, label %86

78:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 16, ptr %7) #5
  %79 = load i32, ptr %2, align 4, !tbaa !5
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [50 x %"class.std::bitset"], ptr @a, i64 0, i64 %80
  %82 = load i32, ptr @x, align 4, !tbaa !5
  %83 = call noundef i32 @_Z5indexi(i32 noundef %82)
  %84 = sext i32 %83 to i64
  call void @_ZNSt6bitsetILm400EEixEm(ptr dead_on_unwind writable sret(%"class.std::bitset<400>::reference") align 8 %7, ptr noundef nonnull align 8 dereferenceable(56) %81, i64 noundef %84)
  %85 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm400EE9referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %7, i1 noundef zeroext true) #5
  call void @_ZNSt6bitsetILm400EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %7) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %7) #5
  br label %86

86:                                               ; preds = %78, %75
  br label %87

87:                                               ; preds = %86
  %88 = load i32, ptr %2, align 4, !tbaa !5
  %89 = add nsw i32 %88, 1
  store i32 %89, ptr %2, align 4, !tbaa !5
  br label %22, !llvm.loop !12

90:                                               ; preds = %26
  store i32 0, ptr @ans, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  br label %91

91:                                               ; preds = %155, %90
  %92 = load i32, ptr %8, align 4, !tbaa !5
  %93 = load i32, ptr @n, align 4, !tbaa !5
  %94 = icmp slt i32 %92, %93
  br i1 %94, label %96, label %95

95:                                               ; preds = %91
  store i32 13, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %158

96:                                               ; preds = %91
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %97

97:                                               ; preds = %118, %96
  %98 = load i32, ptr %9, align 4, !tbaa !5
  %99 = load i32, ptr @tot, align 4, !tbaa !5
  %100 = icmp slt i32 %98, %99
  store i1 false, ptr %12, align 1
  store i1 false, ptr %13, align 1
  br i1 %100, label %101, label %109

101:                                              ; preds = %97
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #5
  store i1 true, ptr %12, align 1
  %102 = load i32, ptr %8, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [50 x %"class.std::bitset"], ptr @a, i64 0, i64 %103
  %105 = load i32, ptr %9, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  call void @_ZNSt6bitsetILm400EEixEm(ptr dead_on_unwind writable sret(%"class.std::bitset<400>::reference") align 8 %11, ptr noundef nonnull align 8 dereferenceable(56) %104, i64 noundef %106)
  store i1 true, ptr %13, align 1
  %107 = call noundef zeroext i1 @_ZNKSt6bitsetILm400EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %11) #5
  %108 = xor i1 %107, true
  br label %109

109:                                              ; preds = %101, %97
  %110 = phi i1 [ false, %97 ], [ %108, %101 ]
  %111 = load i1, ptr %13, align 1
  br i1 %111, label %112, label %113

112:                                              ; preds = %109
  call void @_ZNSt6bitsetILm400EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %11) #5
  br label %113

113:                                              ; preds = %112, %109
  %114 = load i1, ptr %12, align 1
  br i1 %114, label %115, label %116

115:                                              ; preds = %113
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #5
  br label %116

116:                                              ; preds = %115, %113
  br i1 %110, label %117, label %121

117:                                              ; preds = %116
  br label %118

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

121:                                              ; preds = %116
  %122 = load i32, ptr %9, align 4, !tbaa !5
  %123 = load i32, ptr @tot, align 4, !tbaa !5
  %124 = icmp eq i32 %122, %123
  br i1 %124, label %125, label %126

125:                                              ; preds = %121
  br label %155

126:                                              ; preds = %121
  %127 = load i32, ptr %8, align 4, !tbaa !5
  %128 = add nsw i32 %127, 1
  store i32 %128, ptr %10, align 4, !tbaa !5
  br label %129

129:                                              ; preds = %149, %126
  %130 = load i32, ptr %10, align 4, !tbaa !5
  %131 = load i32, ptr @n, align 4, !tbaa !5
  %132 = icmp slt i32 %130, %131
  br i1 %132, label %133, label %152

133:                                              ; preds = %129
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #5
  %134 = load i32, ptr %10, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [50 x %"class.std::bitset"], ptr @a, i64 0, i64 %135
  %137 = load i32, ptr %9, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  call void @_ZNSt6bitsetILm400EEixEm(ptr dead_on_unwind writable sret(%"class.std::bitset<400>::reference") align 8 %14, ptr noundef nonnull align 8 dereferenceable(56) %136, i64 noundef %138)
  %139 = call noundef zeroext i1 @_ZNKSt6bitsetILm400EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %14) #5
  call void @_ZNSt6bitsetILm400EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %14) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #5
  br i1 %139, label %140, label %148

140:                                              ; preds = %133
  %141 = load i32, ptr %8, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [50 x %"class.std::bitset"], ptr @a, i64 0, i64 %142
  %144 = load i32, ptr %10, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [50 x %"class.std::bitset"], ptr @a, i64 0, i64 %145
  %147 = call noundef nonnull align 8 dereferenceable(56) ptr @_ZNSt6bitsetILm400EEeOERKS0_(ptr noundef nonnull align 8 dereferenceable(56) %146, ptr noundef nonnull align 8 dereferenceable(56) %143) #5
  br label %148

148:                                              ; preds = %140, %133
  br label %149

149:                                              ; preds = %148
  %150 = load i32, ptr %10, align 4, !tbaa !5
  %151 = add nsw i32 %150, 1
  store i32 %151, ptr %10, align 4, !tbaa !5
  br label %129, !llvm.loop !14

152:                                              ; preds = %129
  %153 = load i32, ptr @ans, align 4, !tbaa !5
  %154 = add nsw i32 %153, 1
  store i32 %154, ptr @ans, align 4, !tbaa !5
  br label %155

155:                                              ; preds = %152, %125
  %156 = load i32, ptr %8, align 4, !tbaa !5
  %157 = add nsw i32 %156, 1
  store i32 %157, ptr %8, align 4, !tbaa !5
  br label %91, !llvm.loop !15

158:                                              ; preds = %95
  %159 = load i32, ptr @ans, align 4, !tbaa !5
  %160 = zext i32 %159 to i64
  %161 = shl i64 1, %160
  %162 = call i32 (ptr, ...) @printf(ptr noundef @.str.1, i64 noundef %161)
  br label %16, !llvm.loop !16

163:                                              ; preds = %16
  ret i32 0
}

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6bitsetILm400EEixEm(ptr dead_on_unwind noalias writable sret(%"class.std::bitset<400>::reference") align 8, ptr noundef nonnull align 8 dereferenceable(56), i64 noundef) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm400EE9referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16), i1 noundef zeroext) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6bitsetILm400EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6bitsetILm400EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16)) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(56) ptr @_ZNSt6bitsetILm400EEeOERKS0_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(56)) #3 align 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 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = 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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int>>, std::less<int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, 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 }
%"class.std::bitset" = type { %"struct.std::_Base_bitset" }
%"struct.std::_Base_bitset" = type { [7 x i64] }
%"class.std::bitset<400>::reference" = type { ptr, i64 }

@Hash = external dso_local global %"class.std::map", align 8
@a = external dso_local global [50 x %"class.std::bitset"], align 16
@t = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@x = external dso_local global i32, align 4
@tot = external dso_local local_unnamed_addr global i32, align 4
@ans = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 x i8], align 1

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca %"class.std::bitset<400>::reference", align 8
  %2 = alloca %"class.std::bitset<400>::reference", align 8
  %3 = alloca %"class.std::bitset<400>::reference", align 8
  %4 = alloca %"class.std::bitset<400>::reference", align 8
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @t)
  %6 = load i32, ptr @t, align 4, !tbaa !5
  %7 = add nsw i32 %6, -1
  store i32 %7, ptr @t, align 4, !tbaa !5
  %.not62 = icmp eq i32 %6, 0
  br i1 %.not62, label %._crit_edge65, label %.lr.ph64

.lr.ph64:                                         ; preds = %0, %._crit_edge61
  store i32 0, ptr @tot, align 4, !tbaa !5
  call void @_ZNSt3mapIiiSt4lessIiESaISt4pairIKiiEEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @Hash) #5
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %9 = load i32, ptr @n, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph50, label %._crit_edge51.thread

._crit_edge51.thread:                             ; preds = %.lr.ph64
  store i32 0, ptr @ans, align 4, !tbaa !5
  br label %._crit_edge61

._crit_edge51:                                    ; preds = %39
  store i32 0, ptr @ans, align 4, !tbaa !5
  %11 = icmp sgt i32 %40, 0
  br i1 %11, label %.preheader39, label %._crit_edge61

.lr.ph50:                                         ; preds = %.lr.ph64, %39
  %indvars.iv = phi i64 [ %indvars.iv.next, %39 ], [ 0, %.lr.ph64 ]
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @x)
  %13 = getelementptr inbounds [50 x %"class.std::bitset"], ptr @a, i64 0, i64 %indvars.iv
  %14 = call noundef nonnull align 8 dereferenceable(56) ptr @_ZNSt6bitsetILm400EE5resetEv(ptr noundef nonnull align 8 dereferenceable(56) %13) #5
  %15 = load i32, ptr @x, align 4, !tbaa !5
  %.not3642 = icmp slt i32 %15, 4
  br i1 %.not3642, label %._crit_edge46, label %.lr.ph45

._crit_edge46:                                    ; preds = %31, %.lr.ph50
  %.lcssa = phi i32 [ %15, %.lr.ph50 ], [ %32, %31 ]
  %16 = icmp sgt i32 %.lcssa, 1
  br i1 %16, label %35, label %39

.lr.ph45:                                         ; preds = %.lr.ph50, %31
  %17 = phi i32 [ %32, %31 ], [ %15, %.lr.ph50 ]
  %.03443 = phi i32 [ %33, %31 ], [ 2, %.lr.ph50 ]
  %18 = srem i32 %17, %.03443
  %19 = icmp eq i32 %18, 0
  br i1 %19, label %.lr.ph, label %31

.lr.ph:                                           ; preds = %.lr.ph45, %.lr.ph
  %.03340 = phi i32 [ %22, %.lr.ph ], [ 0, %.lr.ph45 ]
  %20 = phi i32 [ %21, %.lr.ph ], [ %17, %.lr.ph45 ]
  %21 = sdiv i32 %20, %.03443
  %22 = add nuw nsw i32 %.03340, 1
  %23 = srem i32 %21, %.03443
  %24 = icmp eq i32 %23, 0
  br i1 %24, label %.lr.ph, label %25, !llvm.loop !9

25:                                               ; preds = %.lr.ph
  store i32 %21, ptr @x, align 4, !tbaa !5
  %26 = and i32 %.03340, 1
  %.not37.not = icmp eq i32 %26, 0
  br i1 %.not37.not, label %27, label %31

27:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %1) #5
  %28 = call noundef i32 @_Z5indexi(i32 noundef %.03443)
  %29 = sext i32 %28 to i64
  call void @_ZNSt6bitsetILm400EEixEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset<400>::reference") align 8 %1, ptr noundef nonnull align 8 dereferenceable(56) %13, i64 noundef %29)
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm400EE9referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %1, i1 noundef zeroext true) #5
  call void @_ZNSt6bitsetILm400EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %1) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %1) #5
  %.pre = load i32, ptr @x, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %.lr.ph45, %27, %25
  %32 = phi i32 [ %17, %.lr.ph45 ], [ %.pre, %27 ], [ %21, %25 ]
  %33 = add nuw nsw i32 %.03443, 1
  %34 = sdiv i32 %32, %33
  %.not36.not = icmp slt i32 %.03443, %34
  br i1 %.not36.not, label %.lr.ph45, label %._crit_edge46, !llvm.loop !11

35:                                               ; preds = %._crit_edge46
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #5
  %36 = call noundef i32 @_Z5indexi(i32 noundef %.lcssa)
  %37 = sext i32 %36 to i64
  call void @_ZNSt6bitsetILm400EEixEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset<400>::reference") align 8 %2, ptr noundef nonnull align 8 dereferenceable(56) %13, i64 noundef %37)
  %38 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm400EE9referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16) %2, i1 noundef zeroext true) #5
  call void @_ZNSt6bitsetILm400EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %2) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #5
  br label %39

39:                                               ; preds = %._crit_edge46, %35
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %40 = load i32, ptr @n, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = icmp slt i64 %indvars.iv.next, %41
  br i1 %42, label %.lr.ph50, label %._crit_edge51, !llvm.loop !12

.preheader39:                                     ; preds = %._crit_edge51, %.critedge.thread._crit_edge
  %.pre8588 = phi i32 [ %.pre8589, %.critedge.thread._crit_edge ], [ %40, %._crit_edge51 ]
  %indvars.iv79 = phi i64 [ %.pre91, %.critedge.thread._crit_edge ], [ 0, %._crit_edge51 ]
  %indvars.iv73 = phi i64 [ %indvars.iv.next74, %.critedge.thread._crit_edge ], [ 1, %._crit_edge51 ]
  %43 = load i32, ptr @tot, align 4, !tbaa !5
  %44 = icmp sgt i32 %43, 0
  br i1 %44, label %.critedge.lr.ph, label %.critedge.thread

.critedge.lr.ph:                                  ; preds = %.preheader39
  %45 = getelementptr inbounds [50 x %"class.std::bitset"], ptr @a, i64 0, i64 %indvars.iv79
  br label %.critedge

._crit_edge61.loopexit:                           ; preds = %.critedge.thread._crit_edge
  %.pre86 = load i32, ptr @ans, align 4, !tbaa !5
  br label %._crit_edge61

._crit_edge61:                                    ; preds = %._crit_edge51.thread, %._crit_edge61.loopexit, %._crit_edge51
  %46 = phi i32 [ %.pre86, %._crit_edge61.loopexit ], [ 0, %._crit_edge51 ], [ 0, %._crit_edge51.thread ]
  %47 = zext nneg i32 %46 to i64
  %48 = shl nuw i64 1, %47
  %49 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1, i64 noundef %48)
  %50 = load i32, ptr @t, align 4, !tbaa !5
  %51 = add nsw i32 %50, -1
  store i32 %51, ptr @t, align 4, !tbaa !5
  %.not = icmp eq i32 %50, 0
  br i1 %.not, label %._crit_edge65, label %.lr.ph64, !llvm.loop !13

.critedge:                                        ; preds = %.critedge.lr.ph, %53
  %indvars.iv70 = phi i64 [ 0, %.critedge.lr.ph ], [ %indvars.iv.next71, %53 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #5
  call void @_ZNSt6bitsetILm400EEixEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset<400>::reference") align 8 %3, ptr noundef nonnull align 8 dereferenceable(56) %45, i64 noundef %indvars.iv70)
  %52 = call noundef zeroext i1 @_ZNKSt6bitsetILm400EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %3) #5
  call void @_ZNSt6bitsetILm400EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %3) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #5
  %.pre84.pre = load i32, ptr @tot, align 4, !tbaa !5
  br i1 %52, label %.critedge.thread.loopexit, label %53

53:                                               ; preds = %.critedge
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
  %54 = sext i32 %.pre84.pre to i64
  %55 = icmp slt i64 %indvars.iv.next71, %54
  br i1 %55, label %.critedge, label %.critedge.thread.loopexit, !llvm.loop !14

.critedge.thread.loopexit:                        ; preds = %53, %.critedge
  %.031.lcssa.ph.in = phi i64 [ %indvars.iv70, %.critedge ], [ %indvars.iv.next71, %53 ]
  %.031.lcssa.ph = trunc i64 %.031.lcssa.ph.in to i32
  %.pre85.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %.critedge.thread

.critedge.thread:                                 ; preds = %.critedge.thread.loopexit, %.preheader39
  %.pre85 = phi i32 [ %.pre8588, %.preheader39 ], [ %.pre85.pre, %.critedge.thread.loopexit ]
  %56 = phi i32 [ %43, %.preheader39 ], [ %.pre84.pre, %.critedge.thread.loopexit ]
  %.031.lcssa = phi i32 [ 0, %.preheader39 ], [ %.031.lcssa.ph, %.critedge.thread.loopexit ]
  %57 = icmp eq i32 %.031.lcssa, %56
  %.pre91 = add nuw nsw i64 %indvars.iv79, 1
  br i1 %57, label %.critedge.thread._crit_edge, label %.preheader38

.preheader38:                                     ; preds = %.critedge.thread
  %58 = sext i32 %.pre85 to i64
  %59 = icmp slt i64 %.pre91, %58
  br i1 %59, label %.lr.ph57, label %._crit_edge58

.lr.ph57:                                         ; preds = %.preheader38
  %60 = zext nneg i32 %.031.lcssa to i64
  %61 = getelementptr inbounds [50 x %"class.std::bitset"], ptr @a, i64 0, i64 %indvars.iv79
  br label %62

62:                                               ; preds = %.lr.ph57, %67
  %indvars.iv75 = phi i64 [ %indvars.iv73, %.lr.ph57 ], [ %indvars.iv.next76, %67 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #5
  %63 = getelementptr inbounds [50 x %"class.std::bitset"], ptr @a, i64 0, i64 %indvars.iv75
  call void @_ZNSt6bitsetILm400EEixEm(ptr dead_on_unwind nonnull writable sret(%"class.std::bitset<400>::reference") align 8 %4, ptr noundef nonnull align 8 dereferenceable(56) %63, i64 noundef %60)
  %64 = call noundef zeroext i1 @_ZNKSt6bitsetILm400EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16) %4) #5
  call void @_ZNSt6bitsetILm400EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16) %4) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #5
  br i1 %64, label %65, label %67

65:                                               ; preds = %62
  %66 = call noundef nonnull align 8 dereferenceable(56) ptr @_ZNSt6bitsetILm400EEeOERKS0_(ptr noundef nonnull align 8 dereferenceable(56) %63, ptr noundef nonnull align 8 dereferenceable(56) %61) #5
  br label %67

67:                                               ; preds = %62, %65
  %indvars.iv.next76 = add nuw nsw i64 %indvars.iv75, 1
  %68 = load i32, ptr @n, align 4, !tbaa !5
  %69 = trunc nuw i64 %indvars.iv.next76 to i32
  %70 = icmp sgt i32 %68, %69
  br i1 %70, label %62, label %._crit_edge58, !llvm.loop !15

._crit_edge58:                                    ; preds = %67, %.preheader38
  %.pre8587 = phi i32 [ %.pre85, %.preheader38 ], [ %68, %67 ]
  %71 = load i32, ptr @ans, align 4, !tbaa !5
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr @ans, align 4, !tbaa !5
  br label %.critedge.thread._crit_edge

.critedge.thread._crit_edge:                      ; preds = %.critedge.thread, %._crit_edge58
  %.pre8589 = phi i32 [ %.pre8587, %._crit_edge58 ], [ %.pre85, %.critedge.thread ]
  %73 = sext i32 %.pre8589 to i64
  %74 = icmp slt i64 %.pre91, %73
  %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
  br i1 %74, label %.preheader39, label %._crit_edge61.loopexit, !llvm.loop !16

._crit_edge65:                                    ; preds = %._crit_edge61, %0
  ret i32 0
}

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6bitsetILm400EEixEm(ptr dead_on_unwind noalias writable sret(%"class.std::bitset<400>::reference") align 8, ptr noundef nonnull align 8 dereferenceable(56), i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt6bitsetILm400EE9referenceaSEb(ptr noundef nonnull align 8 dereferenceable(16), i1 noundef zeroext) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6bitsetILm400EE9referenceD2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt6bitsetILm400EE9referencecvbEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(56) ptr @_ZNSt6bitsetILm400EEeOERKS0_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #3 align 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 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}


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