; LLVM IR from tangjz/acm-icpc :: hackerrank (the-prime-game)

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

%struct.Hash = type { [6 x i32] }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<Hash, std::pair<const Hash, int>, std::_Select1st<std::pair<const Hash, int>>, std::less<Hash>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<Hash, std::pair<const Hash, int>, std::_Select1st<std::pair<const Hash, int>>, std::less<Hash>>::_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 }

@sg = external dso_local global [100 x i32], align 16
@cur = external dso_local global %struct.Hash, align 4
@sp = external dso_local global %"class.std::map", align 8
@_ZL2pr = external hidden constant [6 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 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 i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %18

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

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

22:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 0, 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 %23

23:                                               ; preds = %45, %22
  %24 = load i32, ptr %5, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = getelementptr inbounds [6 x i32], ptr @_ZL2pr, i64 0, i64 %25
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = icmp sle i32 %27, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %23
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %48

31:                                               ; preds = %23
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = load i32, ptr %5, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [6 x i32], ptr @_ZL2pr, i64 0, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = sub nsw i32 %32, %36
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [100 x i32], ptr @sg, i64 0, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = load i32, ptr %4, align 4, !tbaa !5
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %4, align 4, !tbaa !5
  %43 = sext i32 %41 to i64
  %44 = getelementptr inbounds [6 x i32], ptr @cur, i64 0, i64 %43
  store i32 %40, ptr %44, align 4, !tbaa !5
  br label %45

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

48:                                               ; preds = %30
  %49 = load i32, ptr %4, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds i32, ptr @cur, i64 %50
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @cur, ptr noundef %51)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 0, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %87, %48
  %53 = load i32, ptr %7, align 4, !tbaa !5
  %54 = load i32, ptr %4, align 4, !tbaa !5
  %55 = icmp slt i32 %53, %54
  br i1 %55, label %56, label %81

56:                                               ; preds = %52
  %57 = load i32, ptr %7, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [6 x i32], ptr @cur, i64 0, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = load i32, ptr %6, align 4, !tbaa !5
  %62 = icmp eq i32 %60, %61
  br i1 %62, label %63, label %81

63:                                               ; preds = %56
  br label %64

64:                                               ; preds = %77, %63
  %65 = load i32, ptr %7, align 4, !tbaa !5
  %66 = load i32, ptr %4, align 4, !tbaa !5
  %67 = icmp slt i32 %65, %66
  br i1 %67, label %68, label %75

68:                                               ; preds = %64
  %69 = load i32, ptr %7, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [6 x i32], ptr @cur, i64 0, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = load i32, ptr %6, align 4, !tbaa !5
  %74 = icmp eq i32 %72, %73
  br label %75

75:                                               ; preds = %68, %64
  %76 = phi i1 [ false, %64 ], [ %74, %68 ]
  br i1 %76, label %77, label %80

77:                                               ; preds = %75
  %78 = load i32, ptr %7, align 4, !tbaa !5
  %79 = add nsw i32 %78, 1
  store i32 %79, ptr %7, align 4, !tbaa !5
  br label %64, !llvm.loop !11

80:                                               ; preds = %75
  br label %86

81:                                               ; preds = %56, %52
  %82 = load i32, ptr %6, align 4, !tbaa !5
  %83 = load i32, ptr %2, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [100 x i32], ptr @sg, i64 0, i64 %84
  store i32 %82, ptr %85, align 4, !tbaa !5
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %90

86:                                               ; preds = %80
  br label %87

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

90:                                               ; preds = %81
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %91

91:                                               ; preds = %90
  %92 = load i32, ptr %2, align 4, !tbaa !5
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %2, align 4, !tbaa !5
  br label %18, !llvm.loop !13

94:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 13, ptr %10, align 4, !tbaa !5
  br label %95

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

96:                                               ; preds = %113, %95
  %97 = load i32, ptr %11, align 4, !tbaa !5
  %98 = icmp slt i32 %97, 6
  br i1 %98, label %100, label %99

99:                                               ; preds = %96
  store i32 16, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %116

100:                                              ; preds = %96
  %101 = load i32, ptr %10, align 4, !tbaa !5
  %102 = load i32, ptr %11, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [6 x i32], ptr @_ZL2pr, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = sub nsw i32 %101, %105
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [100 x i32], ptr @sg, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = load i32, ptr %11, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [6 x i32], ptr @cur, i64 0, i64 %111
  store i32 %109, ptr %112, align 4, !tbaa !5
  br label %113

113:                                              ; preds = %100
  %114 = load i32, ptr %11, align 4, !tbaa !5
  %115 = add nsw i32 %114, 1
  store i32 %115, ptr %11, align 4, !tbaa !5
  br label %96, !llvm.loop !14

116:                                              ; preds = %99
  %117 = call noundef i64 @_ZNKSt3mapI4HashiSt4lessIS0_ESaISt4pairIKS0_iEEE5countERS4_(ptr noundef nonnull align 8 dereferenceable(48) @sp, ptr noundef nonnull align 4 dereferenceable(24) @cur)
  %118 = icmp ne i64 %117, 0
  br i1 %118, label %119, label %126

119:                                              ; preds = %116
  %120 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapI4HashiSt4lessIS0_ESaISt4pairIKS0_iEEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) @sp, ptr noundef nonnull align 4 dereferenceable(24) @cur)
  %121 = load i32, ptr %120, align 4, !tbaa !5
  store i32 %121, ptr %8, align 4, !tbaa !5
  %122 = load i32, ptr %10, align 4, !tbaa !5
  %123 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapI4HashiSt4lessIS0_ESaISt4pairIKS0_iEEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) @sp, ptr noundef nonnull align 4 dereferenceable(24) @cur)
  %124 = load i32, ptr %123, align 4, !tbaa !5
  %125 = sub nsw i32 %122, %124
  store i32 %125, ptr %9, align 4, !tbaa !5
  store i32 13, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %169

126:                                              ; preds = %116
  %127 = load i32, ptr %10, align 4, !tbaa !5
  %128 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapI4HashiSt4lessIS0_ESaISt4pairIKS0_iEEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) @sp, ptr noundef nonnull align 4 dereferenceable(24) @cur)
  store i32 %127, ptr %128, align 4, !tbaa !5
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @cur, ptr noundef getelementptr inbounds (i32, ptr @cur, i64 6))
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 0, ptr %13, align 4, !tbaa !5
  br label %129

129:                                              ; preds = %162, %126
  %130 = load i32, ptr %13, align 4, !tbaa !5
  %131 = icmp slt i32 %130, 6
  br i1 %131, label %132, label %156

132:                                              ; preds = %129
  %133 = load i32, ptr %13, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [6 x i32], ptr @cur, i64 0, i64 %134
  %136 = load i32, ptr %135, align 4, !tbaa !5
  %137 = load i32, ptr %12, align 4, !tbaa !5
  %138 = icmp eq i32 %136, %137
  br i1 %138, label %139, label %156

139:                                              ; preds = %132
  br label %140

140:                                              ; preds = %152, %139
  %141 = load i32, ptr %13, align 4, !tbaa !5
  %142 = icmp slt i32 %141, 6
  br i1 %142, label %143, label %150

143:                                              ; preds = %140
  %144 = load i32, ptr %13, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [6 x i32], ptr @cur, i64 0, i64 %145
  %147 = load i32, ptr %146, align 4, !tbaa !5
  %148 = load i32, ptr %12, align 4, !tbaa !5
  %149 = icmp eq i32 %147, %148
  br label %150

150:                                              ; preds = %143, %140
  %151 = phi i1 [ false, %140 ], [ %149, %143 ]
  br i1 %151, label %152, label %155

152:                                              ; preds = %150
  %153 = load i32, ptr %13, align 4, !tbaa !5
  %154 = add nsw i32 %153, 1
  store i32 %154, ptr %13, align 4, !tbaa !5
  br label %140, !llvm.loop !15

155:                                              ; preds = %150
  br label %161

156:                                              ; preds = %132, %129
  %157 = load i32, ptr %12, align 4, !tbaa !5
  %158 = load i32, ptr %10, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [100 x i32], ptr @sg, i64 0, i64 %159
  store i32 %157, ptr %160, align 4, !tbaa !5
  store i32 19, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %165

161:                                              ; preds = %155
  br label %162

162:                                              ; preds = %161
  %163 = load i32, ptr %12, align 4, !tbaa !5
  %164 = add nsw i32 %163, 1
  store i32 %164, ptr %12, align 4, !tbaa !5
  br label %129, !llvm.loop !16

165:                                              ; preds = %156
  br label %166

166:                                              ; preds = %165
  %167 = load i32, ptr %10, align 4, !tbaa !5
  %168 = add nsw i32 %167, 1
  store i32 %168, ptr %10, align 4, !tbaa !5
  br label %95, !llvm.loop !17

169:                                              ; preds = %119
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %170 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %14)
  br label %171

171:                                              ; preds = %211, %169
  %172 = load i32, ptr %14, align 4, !tbaa !5
  %173 = add nsw i32 %172, -1
  store i32 %173, ptr %14, align 4, !tbaa !5
  %174 = icmp ne i32 %172, 0
  br i1 %174, label %175, label %217

175:                                              ; preds = %171
  store i32 0, ptr %16, align 4, !tbaa !5
  %176 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %15)
  br label %177

177:                                              ; preds = %207, %175
  %178 = load i32, ptr %15, align 4, !tbaa !5
  %179 = add nsw i32 %178, -1
  store i32 %179, ptr %15, align 4, !tbaa !5
  %180 = icmp ne i32 %178, 0
  br i1 %180, label %181, label %211

181:                                              ; preds = %177
  %182 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %17)
  %183 = load i64, ptr %17, align 8, !tbaa !18
  %184 = load i32, ptr %8, align 4, !tbaa !5
  %185 = sext i32 %184 to i64
  %186 = icmp slt i64 %183, %185
  br i1 %186, label %187, label %193

187:                                              ; preds = %181
  %188 = load i64, ptr %17, align 8, !tbaa !18
  %189 = trunc i64 %188 to i32
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds [100 x i32], ptr @sg, i64 0, i64 %190
  %192 = load i32, ptr %191, align 4, !tbaa !5
  br label %207

193:                                              ; preds = %181
  %194 = load i64, ptr %17, align 8, !tbaa !18
  %195 = load i32, ptr %8, align 4, !tbaa !5
  %196 = sext i32 %195 to i64
  %197 = sub nsw i64 %194, %196
  %198 = load i32, ptr %9, align 4, !tbaa !5
  %199 = sext i32 %198 to i64
  %200 = srem i64 %197, %199
  %201 = trunc i64 %200 to i32
  %202 = load i32, ptr %8, align 4, !tbaa !5
  %203 = add nsw i32 %201, %202
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds [100 x i32], ptr @sg, i64 0, i64 %204
  %206 = load i32, ptr %205, align 4, !tbaa !5
  br label %207

207:                                              ; preds = %193, %187
  %208 = phi i32 [ %192, %187 ], [ %206, %193 ]
  %209 = load i32, ptr %16, align 4, !tbaa !5
  %210 = xor i32 %209, %208
  store i32 %210, ptr %16, align 4, !tbaa !5
  br label %177, !llvm.loop !20

211:                                              ; preds = %177
  %212 = load i32, ptr %16, align 4, !tbaa !5
  %213 = icmp ne i32 %212, 0
  %214 = zext i1 %213 to i64
  %215 = select i1 %213, ptr @.str.2, ptr @.str.3
  %216 = call i32 @puts(ptr noundef %215)
  br label %171, !llvm.loop !21

217:                                              ; preds = %171
  store i32 0, ptr %1, align 4
  store i32 1, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  %218 = load i32, ptr %1, align 4
  ret i32 %218
}

; 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: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt3mapI4HashiSt4lessIS0_ESaISt4pairIKS0_iEEE5countERS4_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(24)) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapI4HashiSt4lessIS0_ESaISt4pairIKS0_iEEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(24)) #3 align 2

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

declare i32 @puts(ptr noundef) #4

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { "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 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = !{!19, !19, i64 0}
!19 = !{!"long long", !7, i64 0}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !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"

%struct.Hash = type { [6 x i32] }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<Hash, std::pair<const Hash, int>, std::_Select1st<std::pair<const Hash, int>>, std::less<Hash>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<Hash, std::pair<const Hash, int>, std::_Select1st<std::pair<const Hash, int>>, std::less<Hash>>::_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 }

@sg = external dso_local local_unnamed_addr global [100 x i32], align 16
@cur = external dso_local global %struct.Hash, align 4
@sp = external dso_local global %"class.std::map", align 8
@_ZL2pr = external hidden local_unnamed_addr constant [6 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 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 i32, align 4
  %3 = alloca i64, align 8
  %4 = load i32, ptr @_ZL2pr, align 16, !tbaa !5
  %5 = sext i32 %4 to i64
  br label %.preheader68

.preheader68:                                     ; preds = %0, %._crit_edge81
  %indvars.iv111 = phi i64 [ 0, %0 ], [ %indvars.iv.next112, %._crit_edge81 ]
  %.not6569 = icmp slt i64 %indvars.iv111, %5
  br i1 %.not6569, label %._crit_edge.thread, label %.lr.ph.preheader

._crit_edge.thread:                               ; preds = %.preheader68
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @cur, ptr noundef nonnull @cur)
  br label %._crit_edge81

.lr.ph.preheader:                                 ; preds = %.preheader68
  %6 = trunc nuw nsw i64 %indvars.iv111 to i32
  br label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph
  %7 = trunc nuw nsw i64 %indvars.iv.next to i32
  %8 = and i64 %indvars.iv.next, 4294967295
  %9 = getelementptr inbounds i32, ptr @cur, i64 %8
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @cur, ptr noundef nonnull %9)
  %10 = and i64 %indvars.iv.next, 4294967295
  br label %.lr.ph80

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %11 = phi i32 [ %4, %.lr.ph.preheader ], [ %18, %.lr.ph ]
  %12 = sub nsw i32 %6, %11
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds [100 x i32], ptr @sg, i64 0, i64 %13
  %15 = load i32, ptr %14, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %16 = getelementptr inbounds [6 x i32], ptr @cur, i64 0, i64 %indvars.iv
  store i32 %15, ptr %16, align 4, !tbaa !5
  %17 = getelementptr inbounds [6 x i32], ptr @_ZL2pr, i64 0, i64 %indvars.iv.next
  %18 = load i32, ptr %17, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %.not65 = icmp slt i64 %indvars.iv111, %19
  br i1 %.not65, label %._crit_edge, label %.lr.ph, !llvm.loop !9

.lr.ph80:                                         ; preds = %._crit_edge, %.critedge
  %.05378 = phi i32 [ %.154.lcssa, %.critedge ], [ 0, %._crit_edge ]
  %.05577 = phi i32 [ %32, %.critedge ], [ 0, %._crit_edge ]
  %20 = sext i32 %.05378 to i64
  %21 = getelementptr inbounds [6 x i32], ptr @cur, i64 0, i64 %20
  %22 = load i32, ptr %21, align 4, !tbaa !5
  %23 = icmp eq i32 %22, %.05577
  br i1 %23, label %.preheader67, label %._crit_edge81

.preheader67:                                     ; preds = %.lr.ph80
  %24 = icmp slt i32 %.05378, %7
  br i1 %24, label %.lr.ph73, label %.critedge

.lr.ph73:                                         ; preds = %.preheader67, %28
  %indvars.iv108 = phi i64 [ %indvars.iv.next109, %28 ], [ %20, %.preheader67 ]
  %25 = getelementptr inbounds [6 x i32], ptr @cur, i64 0, i64 %indvars.iv108
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = icmp eq i32 %26, %.05577
  br i1 %27, label %28, label %.critedge.loopexit

28:                                               ; preds = %.lr.ph73
  %indvars.iv.next109 = add nsw i64 %indvars.iv108, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next109, %10
  br i1 %exitcond.not, label %.critedge.thread, label %.lr.ph73, !llvm.loop !11

.critedge.thread:                                 ; preds = %28
  %29 = add nuw nsw i32 %.05577, 1
  br label %._crit_edge81

._crit_edge81:                                    ; preds = %.critedge, %.lr.ph80, %.critedge.thread, %._crit_edge.thread
  %.055.lcssa = phi i32 [ 0, %._crit_edge.thread ], [ %29, %.critedge.thread ], [ %.05577, %.lr.ph80 ], [ %32, %.critedge ]
  %30 = getelementptr inbounds [100 x i32], ptr @sg, i64 0, i64 %indvars.iv111
  store i32 %.055.lcssa, ptr %30, align 4, !tbaa !5
  %indvars.iv.next112 = add nuw nsw i64 %indvars.iv111, 1
  %exitcond114.not = icmp eq i64 %indvars.iv.next112, 13
  br i1 %exitcond114.not, label %.preheader66.preheader, label %.preheader68, !llvm.loop !12

.preheader66.preheader:                           ; preds = %._crit_edge81
  %.pre = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2pr, i64 4), align 4, !tbaa !5
  %.pre126 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2pr, i64 8), align 8, !tbaa !5
  %.pre127 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2pr, i64 12), align 4, !tbaa !5
  %.pre128 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2pr, i64 16), align 16, !tbaa !5
  %.pre129 = load i32, ptr getelementptr inbounds (i8, ptr @_ZL2pr, i64 20), align 4, !tbaa !5
  br label %.preheader66

.critedge.loopexit:                               ; preds = %.lr.ph73
  %31 = trunc nsw i64 %indvars.iv108 to i32
  br label %.critedge

.critedge:                                        ; preds = %.critedge.loopexit, %.preheader67
  %.154.lcssa = phi i32 [ %.05378, %.preheader67 ], [ %31, %.critedge.loopexit ]
  %32 = add nuw nsw i32 %.05577, 1
  %33 = icmp slt i32 %.154.lcssa, %7
  br i1 %33, label %.lr.ph80, label %._crit_edge81, !llvm.loop !13

.preheader66:                                     ; preds = %.preheader66.preheader, %.loopexit
  %indvars.iv123 = phi i64 [ 13, %.preheader66.preheader ], [ %indvars.iv.next124, %.loopexit ]
  %34 = trunc nuw nsw i64 %indvars.iv123 to i32
  %35 = sub nsw i32 %34, %4
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [100 x i32], ptr @sg, i64 0, i64 %36
  %38 = load i32, ptr %37, align 4, !tbaa !5
  store i32 %38, ptr @cur, align 4, !tbaa !5
  %39 = sub nsw i32 %34, %.pre
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [100 x i32], ptr @sg, i64 0, i64 %40
  %42 = load i32, ptr %41, align 4, !tbaa !5
  store i32 %42, ptr getelementptr inbounds (i8, ptr @cur, i64 4), align 4, !tbaa !5
  %43 = sub nsw i32 %34, %.pre126
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [100 x i32], ptr @sg, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !5
  store i32 %46, ptr getelementptr inbounds (i8, ptr @cur, i64 8), align 4, !tbaa !5
  %47 = sub nsw i32 %34, %.pre127
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [100 x i32], ptr @sg, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  store i32 %50, ptr getelementptr inbounds (i8, ptr @cur, i64 12), align 4, !tbaa !5
  %51 = sub nsw i32 %34, %.pre128
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [100 x i32], ptr @sg, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  store i32 %54, ptr getelementptr inbounds (i8, ptr @cur, i64 16), align 4, !tbaa !5
  %55 = sub nsw i32 %34, %.pre129
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [100 x i32], ptr @sg, i64 0, i64 %56
  %58 = load i32, ptr %57, align 4, !tbaa !5
  store i32 %58, ptr getelementptr inbounds (i8, ptr @cur, i64 20), align 4, !tbaa !5
  %59 = tail call noundef i64 @_ZNKSt3mapI4HashiSt4lessIS0_ESaISt4pairIKS0_iEEE5countERS4_(ptr noundef nonnull align 8 dereferenceable(48) @sp, ptr noundef nonnull align 4 dereferenceable(24) @cur)
  %.not = icmp eq i64 %59, 0
  %60 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapI4HashiSt4lessIS0_ESaISt4pairIKS0_iEEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) @sp, ptr noundef nonnull align 4 dereferenceable(24) @cur)
  br i1 %.not, label %71, label %61

61:                                               ; preds = %.preheader66
  %62 = load i32, ptr %60, align 4, !tbaa !5
  %63 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapI4HashiSt4lessIS0_ESaISt4pairIKS0_iEEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48) @sp, ptr noundef nonnull align 4 dereferenceable(24) @cur)
  %64 = load i32, ptr %63, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  %65 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %66 = load i32, ptr %1, align 4, !tbaa !5
  %67 = add nsw i32 %66, -1
  store i32 %67, ptr %1, align 4, !tbaa !5
  %.not62100 = icmp eq i32 %66, 0
  br i1 %.not62100, label %._crit_edge103, label %.lr.ph102

.lr.ph102:                                        ; preds = %61
  %68 = sub nsw i32 %34, %64
  %69 = sext i32 %62 to i64
  %70 = sext i32 %68 to i64
  br label %85

71:                                               ; preds = %.preheader66
  store i32 %34, ptr %60, align 4, !tbaa !5
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @cur, ptr noundef nonnull getelementptr inbounds (i8, ptr @cur, i64 24))
  br label %72

72:                                               ; preds = %71, %.critedge2
  %.04893 = phi i64 [ 0, %71 ], [ %indvars.iv119, %.critedge2 ]
  %.04992 = phi i32 [ 0, %71 ], [ %83, %.critedge2 ]
  %sext143 = shl i64 %.04893, 32
  %73 = ashr exact i64 %sext143, 32
  %74 = getelementptr inbounds [6 x i32], ptr @cur, i64 0, i64 %73
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %76 = icmp eq i32 %75, %.04992
  br i1 %76, label %.lr.ph88, label %.loopexit

.lr.ph88:                                         ; preds = %72, %80
  %indvars.iv119 = phi i64 [ %indvars.iv.next120, %80 ], [ %73, %72 ]
  %77 = getelementptr inbounds [6 x i32], ptr @cur, i64 0, i64 %indvars.iv119
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = icmp eq i32 %78, %.04992
  br i1 %79, label %80, label %.critedge2

80:                                               ; preds = %.lr.ph88
  %indvars.iv.next120 = add nsw i64 %indvars.iv119, 1
  %exitcond122.not = icmp eq i64 %indvars.iv.next120, 6
  br i1 %exitcond122.not, label %.critedge2.thread, label %.lr.ph88, !llvm.loop !14

.critedge2.thread:                                ; preds = %80
  %81 = add nuw nsw i32 %.04992, 1
  br label %.loopexit

.loopexit:                                        ; preds = %72, %.critedge2, %.critedge2.thread
  %.049.lcssa = phi i32 [ %81, %.critedge2.thread ], [ %83, %.critedge2 ], [ %.04992, %72 ]
  %82 = getelementptr inbounds [100 x i32], ptr @sg, i64 0, i64 %indvars.iv123
  store i32 %.049.lcssa, ptr %82, align 4, !tbaa !5
  %indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1
  br label %.preheader66, !llvm.loop !15

.critedge2:                                       ; preds = %.lr.ph88
  %83 = add nuw nsw i32 %.04992, 1
  %84 = icmp slt i64 %indvars.iv119, 6
  br i1 %84, label %72, label %.loopexit, !llvm.loop !16

85:                                               ; preds = %.lr.ph102, %105
  %86 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2)
  %87 = load i32, ptr %2, align 4, !tbaa !5
  %88 = add nsw i32 %87, -1
  store i32 %88, ptr %2, align 4, !tbaa !5
  %.not6394 = icmp eq i32 %87, 0
  br i1 %.not6394, label %._crit_edge98.thread, label %.lr.ph97

.lr.ph97:                                         ; preds = %85, %100
  %.095 = phi i32 [ %102, %100 ], [ 0, %85 ]
  %89 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %3)
  %90 = load i64, ptr %3, align 8, !tbaa !17
  %91 = icmp slt i64 %90, %69
  br i1 %91, label %92, label %94

92:                                               ; preds = %.lr.ph97
  %sext = shl i64 %90, 32
  %93 = ashr exact i64 %sext, 32
  br label %100

94:                                               ; preds = %.lr.ph97
  %95 = sub nsw i64 %90, %69
  %96 = srem i64 %95, %70
  %97 = trunc nsw i64 %96 to i32
  %98 = add nsw i32 %62, %97
  %99 = sext i32 %98 to i64
  br label %100

100:                                              ; preds = %94, %92
  %.pn = phi i64 [ %93, %92 ], [ %99, %94 ]
  %.in = getelementptr inbounds [100 x i32], ptr @sg, i64 0, i64 %.pn
  %101 = load i32, ptr %.in, align 4, !tbaa !5
  %102 = xor i32 %101, %.095
  %103 = load i32, ptr %2, align 4, !tbaa !5
  %104 = add nsw i32 %103, -1
  store i32 %104, ptr %2, align 4, !tbaa !5
  %.not63 = icmp eq i32 %103, 0
  br i1 %.not63, label %._crit_edge98, label %.lr.ph97, !llvm.loop !19

._crit_edge98:                                    ; preds = %100
  %.not64 = icmp eq i32 %101, %.095
  %cond.fr = freeze i1 %.not64
  br i1 %cond.fr, label %._crit_edge98.thread, label %105

._crit_edge98.thread:                             ; preds = %85, %._crit_edge98
  br label %105

105:                                              ; preds = %._crit_edge98, %._crit_edge98.thread
  %106 = phi ptr [ @.str.3, %._crit_edge98.thread ], [ @.str.2, %._crit_edge98 ]
  %107 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %106)
  %108 = load i32, ptr %1, align 4, !tbaa !5
  %109 = add nsw i32 %108, -1
  store i32 %109, ptr %1, align 4, !tbaa !5
  %.not62 = icmp eq i32 %108, 0
  br i1 %.not62, label %._crit_edge103, label %85, !llvm.loop !20

._crit_edge103:                                   ; preds = %105, %61
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  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: 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: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt3mapI4HashiSt4lessIS0_ESaISt4pairIKS0_iEEE5countERS4_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(24)) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt3mapI4HashiSt4lessIS0_ESaISt4pairIKS0_iEEEixERS4_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 4 dereferenceable(24)) local_unnamed_addr #3 align 2

; 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

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { 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}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = !{!18, !18, i64 0}
!18 = !{!"long long", !7, i64 0}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}


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