; LLVM IR from tangjz/acm-icpc :: self_training/2015-04-25 (C)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

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

@Hash = external dso_local global %"class.std::set", align 8
@tt = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@t = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@x = external dso_local global [100010 x i32], align 16
@y = external dso_local global [100010 x i32], align 16
@tx = external dso_local global [100010 x i32], align 16
@ty = external dso_local global [100010 x i32], align 16
@mx1 = external dso_local global [100010 x i32], align 16
@my1 = external dso_local global [100010 x i32], align 16
@mx2 = external dso_local global [100010 x i32], align 16
@my2 = external dso_local global [100010 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z5crossiiii(i32 noundef, i32 noundef, 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 i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca %"struct.std::pair", align 8
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @tt)
  br label %14

14:                                               ; preds = %219, %0
  %15 = load i32, ptr @tt, align 4, !tbaa !5
  %16 = add nsw i32 %15, -1
  store i32 %16, ptr @tt, align 4, !tbaa !5
  %17 = icmp ne i32 %15, 0
  br i1 %17, label %18, label %220

18:                                               ; preds = %14
  call void @_ZNSt3setIxSt4lessIxESaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @Hash) #5
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @n, ptr noundef @t, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %20

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

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

25:                                               ; preds = %20
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds i32, ptr @x, i64 %27
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds i32, ptr @y, i64 %30
  %32 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %28, ptr noundef %31)
  br label %33

33:                                               ; preds = %25
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = add nsw i32 %34, 1
  store i32 %35, ptr %2, align 4, !tbaa !5
  br label %20, !llvm.loop !9

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

37:                                               ; preds = %50, %36
  %38 = load i32, ptr %3, align 4, !tbaa !5
  %39 = load i32, ptr @t, align 4, !tbaa !5
  %40 = icmp slt i32 %38, %39
  br i1 %40, label %42, label %41

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

42:                                               ; preds = %37
  %43 = load i32, ptr %3, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds i32, ptr @tx, i64 %44
  %46 = load i32, ptr %3, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds i32, ptr @ty, i64 %47
  %49 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef %45, ptr noundef %48)
  br label %50

50:                                               ; preds = %42
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %3, align 4, !tbaa !5
  br label %37, !llvm.loop !11

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

54:                                               ; preds = %73, %53
  %55 = load i32, ptr %4, align 4, !tbaa !5
  %56 = load i32, ptr @m, align 4, !tbaa !5
  %57 = icmp slt i32 %55, %56
  br i1 %57, label %59, label %58

58:                                               ; preds = %54
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %76

59:                                               ; preds = %54
  %60 = load i32, ptr %4, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds i32, ptr @mx1, i64 %61
  %63 = load i32, ptr %4, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds i32, ptr @my1, i64 %64
  %66 = load i32, ptr %4, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds i32, ptr @mx2, i64 %67
  %69 = load i32, ptr %4, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds i32, ptr @my2, i64 %70
  %72 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.3, ptr noundef %62, ptr noundef %65, ptr noundef %68, ptr noundef %71)
  br label %73

73:                                               ; preds = %59
  %74 = load i32, ptr %4, align 4, !tbaa !5
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %4, align 4, !tbaa !5
  br label %54, !llvm.loop !12

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

77:                                               ; preds = %143, %76
  %78 = load i32, ptr %5, align 4, !tbaa !5
  %79 = load i32, ptr @t, align 4, !tbaa !5
  %80 = icmp slt i32 %78, %79
  br i1 %80, label %82, label %81

81:                                               ; preds = %77
  store i32 13, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %146

82:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  store i64 0, ptr %7, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %83

83:                                               ; preds = %134, %82
  %84 = load i32, ptr %8, align 4, !tbaa !5
  %85 = load i32, ptr @m, align 4, !tbaa !5
  %86 = icmp slt i32 %84, %85
  br i1 %86, label %88, label %87

87:                                               ; preds = %83
  store i32 16, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %137

88:                                               ; preds = %83
  %89 = load i32, ptr %8, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [100010 x i32], ptr @mx1, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = load i32, ptr %5, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [100010 x i32], ptr @tx, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = sub nsw i32 %92, %96
  %98 = load i32, ptr %8, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [100010 x i32], ptr @my1, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = load i32, ptr %5, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [100010 x i32], ptr @ty, i64 0, i64 %103
  %105 = load i32, ptr %104, align 4, !tbaa !5
  %106 = sub nsw i32 %101, %105
  %107 = load i32, ptr %8, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [100010 x i32], ptr @mx2, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = load i32, ptr %5, align 4, !tbaa !5
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [100010 x i32], ptr @tx, i64 0, i64 %112
  %114 = load i32, ptr %113, align 4, !tbaa !5
  %115 = sub nsw i32 %110, %114
  %116 = load i32, ptr %8, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [100010 x i32], ptr @my2, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = load i32, ptr %5, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [100010 x i32], ptr @ty, i64 0, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %124 = sub nsw i32 %119, %123
  %125 = call noundef i64 @_Z5crossiiii(i32 noundef %97, i32 noundef %106, i32 noundef %115, i32 noundef %124)
  %126 = icmp sgt i64 %125, 0
  br i1 %126, label %127, label %133

127:                                              ; preds = %88
  %128 = load i32, ptr %8, align 4, !tbaa !5
  %129 = zext i32 %128 to i64
  %130 = shl i64 1, %129
  %131 = load i64, ptr %7, align 8, !tbaa !13
  %132 = or i64 %131, %130
  store i64 %132, ptr %7, align 8, !tbaa !13
  br label %133

133:                                              ; preds = %127, %88
  br label %134

134:                                              ; preds = %133
  %135 = load i32, ptr %8, align 4, !tbaa !5
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr %8, align 4, !tbaa !5
  br label %83, !llvm.loop !15

137:                                              ; preds = %87
  %138 = call { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %139 = getelementptr inbounds { ptr, i8 }, ptr %9, i32 0, i32 0
  %140 = extractvalue { ptr, i8 } %138, 0
  store ptr %140, ptr %139, align 8
  %141 = getelementptr inbounds { ptr, i8 }, ptr %9, i32 0, i32 1
  %142 = extractvalue { ptr, i8 } %138, 1
  store i8 %142, ptr %141, align 8
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  br label %143

143:                                              ; preds = %137
  %144 = load i32, ptr %5, align 4, !tbaa !5
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %5, align 4, !tbaa !5
  br label %77, !llvm.loop !16

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

147:                                              ; preds = %216, %146
  %148 = load i32, ptr %10, align 4, !tbaa !5
  %149 = load i32, ptr @n, align 4, !tbaa !5
  %150 = icmp slt i32 %148, %149
  br i1 %150, label %152, label %151

151:                                              ; preds = %147
  store i32 19, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %219

152:                                              ; preds = %147
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #5
  store i64 0, ptr %11, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %153

153:                                              ; preds = %204, %152
  %154 = load i32, ptr %12, align 4, !tbaa !5
  %155 = load i32, ptr @m, align 4, !tbaa !5
  %156 = icmp slt i32 %154, %155
  br i1 %156, label %158, label %157

157:                                              ; preds = %153
  store i32 22, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %207

158:                                              ; preds = %153
  %159 = load i32, ptr %12, align 4, !tbaa !5
  %160 = sext i32 %159 to i64
  %161 = getelementptr inbounds [100010 x i32], ptr @mx1, i64 0, i64 %160
  %162 = load i32, ptr %161, align 4, !tbaa !5
  %163 = load i32, ptr %10, align 4, !tbaa !5
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [100010 x i32], ptr @x, i64 0, i64 %164
  %166 = load i32, ptr %165, align 4, !tbaa !5
  %167 = sub nsw i32 %162, %166
  %168 = load i32, ptr %12, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [100010 x i32], ptr @my1, i64 0, i64 %169
  %171 = load i32, ptr %170, align 4, !tbaa !5
  %172 = load i32, ptr %10, align 4, !tbaa !5
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [100010 x i32], ptr @y, i64 0, i64 %173
  %175 = load i32, ptr %174, align 4, !tbaa !5
  %176 = sub nsw i32 %171, %175
  %177 = load i32, ptr %12, align 4, !tbaa !5
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [100010 x i32], ptr @mx2, i64 0, i64 %178
  %180 = load i32, ptr %179, align 4, !tbaa !5
  %181 = load i32, ptr %10, align 4, !tbaa !5
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [100010 x i32], ptr @x, i64 0, i64 %182
  %184 = load i32, ptr %183, align 4, !tbaa !5
  %185 = sub nsw i32 %180, %184
  %186 = load i32, ptr %12, align 4, !tbaa !5
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [100010 x i32], ptr @my2, i64 0, i64 %187
  %189 = load i32, ptr %188, align 4, !tbaa !5
  %190 = load i32, ptr %10, align 4, !tbaa !5
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [100010 x i32], ptr @y, i64 0, i64 %191
  %193 = load i32, ptr %192, align 4, !tbaa !5
  %194 = sub nsw i32 %189, %193
  %195 = call noundef i64 @_Z5crossiiii(i32 noundef %167, i32 noundef %176, i32 noundef %185, i32 noundef %194)
  %196 = icmp sgt i64 %195, 0
  br i1 %196, label %197, label %203

197:                                              ; preds = %158
  %198 = load i32, ptr %12, align 4, !tbaa !5
  %199 = zext i32 %198 to i64
  %200 = shl i64 1, %199
  %201 = load i64, ptr %11, align 8, !tbaa !13
  %202 = or i64 %201, %200
  store i64 %202, ptr %11, align 8, !tbaa !13
  br label %203

203:                                              ; preds = %197, %158
  br label %204

204:                                              ; preds = %203
  %205 = load i32, ptr %12, align 4, !tbaa !5
  %206 = add nsw i32 %205, 1
  store i32 %206, ptr %12, align 4, !tbaa !5
  br label %153, !llvm.loop !17

207:                                              ; preds = %157
  %208 = call noundef i64 @_ZNKSt3setIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 8 dereferenceable(8) %11)
  %209 = icmp ne i64 %208, 0
  br i1 %209, label %210, label %211

210:                                              ; preds = %207
  br label %212

211:                                              ; preds = %207
  br label %212

212:                                              ; preds = %211, %210
  %213 = phi ptr [ @.str.4, %210 ], [ @.str.5, %211 ]
  %214 = getelementptr inbounds [2 x i8], ptr %213, i64 0, i64 0
  %215 = call i32 @puts(ptr noundef %214)
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #5
  br label %216

216:                                              ; preds = %212
  %217 = load i32, ptr %10, align 4, !tbaa !5
  %218 = add nsw i32 %217, 1
  store i32 %218, ptr %10, align 4, !tbaa !5
  br label %147, !llvm.loop !18

219:                                              ; preds = %151
  br label %14, !llvm.loop !19

220:                                              ; preds = %14
  ret i32 0
}

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #4 align 2

declare i32 @puts(ptr noundef) #2

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

attributes #0 = { 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 #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 = { 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 #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 = !{!14, !14, i64 0}
!14 = !{!"long long", !7, i64 0}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::set" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_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 }

@Hash = external dso_local global %"class.std::set", align 8
@tt = external dso_local global i32, align 4
@n = external dso_local global i32, align 4
@t = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@x = external dso_local global [100010 x i32], align 16
@y = external dso_local global [100010 x i32], align 16
@tx = external dso_local global [100010 x i32], align 16
@ty = external dso_local global [100010 x i32], align 16
@mx1 = external dso_local global [100010 x i32], align 16
@my1 = external dso_local global [100010 x i32], align 16
@mx2 = external dso_local global [100010 x i32], align 16
@my2 = external dso_local global [100010 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z5crossiiii(i32 noundef, i32 noundef, 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 i64, align 8
  %2 = alloca i64, align 8
  %3 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @tt)
  %4 = load i32, ptr @tt, align 4, !tbaa !5
  %5 = add nsw i32 %4, -1
  store i32 %5, ptr @tt, align 4, !tbaa !5
  %.not65 = icmp eq i32 %4, 0
  br i1 %.not65, label %._crit_edge68, label %.lr.ph67

.loopexit:                                        ; preds = %._crit_edge62, %.preheader
  %6 = load i32, ptr @tt, align 4, !tbaa !5
  %7 = add nsw i32 %6, -1
  store i32 %7, ptr @tt, align 4, !tbaa !5
  %.not = icmp eq i32 %6, 0
  br i1 %.not, label %._crit_edge68, label %.lr.ph67, !llvm.loop !9

.lr.ph67:                                         ; preds = %0, %.loopexit
  call void @_ZNSt3setIxSt4lessIxESaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48) @Hash) #5
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @n, ptr noundef nonnull @t, ptr noundef nonnull @m)
  %9 = load i32, ptr @n, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph, label %.preheader49

.preheader49:                                     ; preds = %.lr.ph, %.lr.ph67
  %11 = load i32, ptr @t, align 4, !tbaa !5
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph52, label %.preheader48

.lr.ph:                                           ; preds = %.lr.ph67, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph67 ]
  %13 = getelementptr inbounds i32, ptr @x, i64 %indvars.iv
  %14 = getelementptr inbounds i32, ptr @y, i64 %indvars.iv
  %15 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %13, ptr noundef nonnull %14)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %16 = load i32, ptr @n, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = icmp slt i64 %indvars.iv.next, %17
  br i1 %18, label %.lr.ph, label %.preheader49, !llvm.loop !11

.preheader48:                                     ; preds = %.lr.ph52, %.preheader49
  %19 = phi i32 [ %11, %.preheader49 ], [ %25, %.lr.ph52 ]
  %20 = load i32, ptr @m, align 4, !tbaa !5
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %.lr.ph54, label %.preheader47

.lr.ph52:                                         ; preds = %.preheader49, %.lr.ph52
  %indvars.iv70 = phi i64 [ %indvars.iv.next71, %.lr.ph52 ], [ 0, %.preheader49 ]
  %22 = getelementptr inbounds i32, ptr @tx, i64 %indvars.iv70
  %23 = getelementptr inbounds i32, ptr @ty, i64 %indvars.iv70
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull %22, ptr noundef nonnull %23)
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv70, 1
  %25 = load i32, ptr @t, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = icmp slt i64 %indvars.iv.next71, %26
  br i1 %27, label %.lr.ph52, label %.preheader48, !llvm.loop !12

.preheader47.loopexit:                            ; preds = %.lr.ph54
  %.pre = load i32, ptr @t, align 4, !tbaa !5
  br label %.preheader47

.preheader47:                                     ; preds = %.preheader47.loopexit, %.preheader48
  %28 = phi i32 [ %.pre, %.preheader47.loopexit ], [ %19, %.preheader48 ]
  %29 = icmp sgt i32 %28, 0
  br i1 %29, label %.lr.ph58, label %.preheader

.lr.ph54:                                         ; preds = %.preheader48, %.lr.ph54
  %indvars.iv73 = phi i64 [ %indvars.iv.next74, %.lr.ph54 ], [ 0, %.preheader48 ]
  %30 = getelementptr inbounds i32, ptr @mx1, i64 %indvars.iv73
  %31 = getelementptr inbounds i32, ptr @my1, i64 %indvars.iv73
  %32 = getelementptr inbounds i32, ptr @mx2, i64 %indvars.iv73
  %33 = getelementptr inbounds i32, ptr @my2, i64 %indvars.iv73
  %34 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.3, ptr noundef nonnull %30, ptr noundef nonnull %31, ptr noundef nonnull %32, ptr noundef nonnull %33)
  %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
  %35 = load i32, ptr @m, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = icmp slt i64 %indvars.iv.next74, %36
  br i1 %37, label %.lr.ph54, label %.preheader47.loopexit, !llvm.loop !13

.preheader:                                       ; preds = %._crit_edge, %.preheader47
  %38 = load i32, ptr @n, align 4, !tbaa !5
  %39 = icmp sgt i32 %38, 0
  br i1 %39, label %.lr.ph64, label %.loopexit

.lr.ph58:                                         ; preds = %.preheader47, %._crit_edge
  %indvars.iv79 = phi i64 [ %indvars.iv.next80, %._crit_edge ], [ 0, %.preheader47 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #5
  store i64 0, ptr %1, align 8, !tbaa !14
  %40 = load i32, ptr @m, align 4, !tbaa !5
  %41 = icmp sgt i32 %40, 0
  br i1 %41, label %.lr.ph56, label %._crit_edge

.lr.ph56:                                         ; preds = %.lr.ph58
  %42 = getelementptr inbounds [100010 x i32], ptr @tx, i64 0, i64 %indvars.iv79
  %43 = getelementptr inbounds [100010 x i32], ptr @ty, i64 0, i64 %indvars.iv79
  br label %48

._crit_edge:                                      ; preds = %69, %.lr.ph58
  %44 = call { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 8 dereferenceable(8) %1)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #5
  %indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
  %45 = load i32, ptr @t, align 4, !tbaa !5
  %46 = sext i32 %45 to i64
  %47 = icmp slt i64 %indvars.iv.next80, %46
  br i1 %47, label %.lr.ph58, label %.preheader, !llvm.loop !16

48:                                               ; preds = %.lr.ph56, %69
  %indvars.iv76 = phi i64 [ 0, %.lr.ph56 ], [ %indvars.iv.next77, %69 ]
  %49 = getelementptr inbounds [100010 x i32], ptr @mx1, i64 0, i64 %indvars.iv76
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = load i32, ptr %42, align 4, !tbaa !5
  %52 = sub nsw i32 %50, %51
  %53 = getelementptr inbounds [100010 x i32], ptr @my1, i64 0, i64 %indvars.iv76
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = load i32, ptr %43, align 4, !tbaa !5
  %56 = sub nsw i32 %54, %55
  %57 = getelementptr inbounds [100010 x i32], ptr @mx2, i64 0, i64 %indvars.iv76
  %58 = load i32, ptr %57, align 4, !tbaa !5
  %59 = sub nsw i32 %58, %51
  %60 = getelementptr inbounds [100010 x i32], ptr @my2, i64 0, i64 %indvars.iv76
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = sub nsw i32 %61, %55
  %63 = call noundef i64 @_Z5crossiiii(i32 noundef %52, i32 noundef %56, i32 noundef %59, i32 noundef %62)
  %64 = icmp sgt i64 %63, 0
  br i1 %64, label %65, label %69

65:                                               ; preds = %48
  %66 = shl nuw i64 1, %indvars.iv76
  %67 = load i64, ptr %1, align 8, !tbaa !14
  %68 = or i64 %67, %66
  store i64 %68, ptr %1, align 8, !tbaa !14
  br label %69

69:                                               ; preds = %48, %65
  %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
  %70 = load i32, ptr @m, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = icmp slt i64 %indvars.iv.next77, %71
  br i1 %72, label %48, label %._crit_edge, !llvm.loop !17

.lr.ph64:                                         ; preds = %.preheader, %._crit_edge62
  %indvars.iv85 = phi i64 [ %indvars.iv.next86, %._crit_edge62 ], [ 0, %.preheader ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  store i64 0, ptr %2, align 8, !tbaa !14
  %73 = load i32, ptr @m, align 4, !tbaa !5
  %74 = icmp sgt i32 %73, 0
  br i1 %74, label %.lr.ph61, label %._crit_edge62

.lr.ph61:                                         ; preds = %.lr.ph64
  %75 = getelementptr inbounds [100010 x i32], ptr @x, i64 0, i64 %indvars.iv85
  %76 = getelementptr inbounds [100010 x i32], ptr @y, i64 0, i64 %indvars.iv85
  br label %83

._crit_edge62:                                    ; preds = %104, %.lr.ph64
  %77 = call noundef i64 @_ZNKSt3setIxSt4lessIxESaIxEE5countERKx(ptr noundef nonnull align 8 dereferenceable(48) @Hash, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %.not46 = icmp eq i64 %77, 0
  %78 = select i1 %.not46, ptr @.str.5, ptr @.str.4
  %79 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %78)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  %indvars.iv.next86 = add nuw nsw i64 %indvars.iv85, 1
  %80 = load i32, ptr @n, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = icmp slt i64 %indvars.iv.next86, %81
  br i1 %82, label %.lr.ph64, label %.loopexit, !llvm.loop !18

83:                                               ; preds = %.lr.ph61, %104
  %indvars.iv82 = phi i64 [ 0, %.lr.ph61 ], [ %indvars.iv.next83, %104 ]
  %84 = getelementptr inbounds [100010 x i32], ptr @mx1, i64 0, i64 %indvars.iv82
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = load i32, ptr %75, align 4, !tbaa !5
  %87 = sub nsw i32 %85, %86
  %88 = getelementptr inbounds [100010 x i32], ptr @my1, i64 0, i64 %indvars.iv82
  %89 = load i32, ptr %88, align 4, !tbaa !5
  %90 = load i32, ptr %76, align 4, !tbaa !5
  %91 = sub nsw i32 %89, %90
  %92 = getelementptr inbounds [100010 x i32], ptr @mx2, i64 0, i64 %indvars.iv82
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %94 = sub nsw i32 %93, %86
  %95 = getelementptr inbounds [100010 x i32], ptr @my2, i64 0, i64 %indvars.iv82
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = sub nsw i32 %96, %90
  %98 = call noundef i64 @_Z5crossiiii(i32 noundef %87, i32 noundef %91, i32 noundef %94, i32 noundef %97)
  %99 = icmp sgt i64 %98, 0
  br i1 %99, label %100, label %104

100:                                              ; preds = %83
  %101 = shl nuw i64 1, %indvars.iv82
  %102 = load i64, ptr %2, align 8, !tbaa !14
  %103 = or i64 %102, %101
  store i64 %103, ptr %2, align 8, !tbaa !14
  br label %104

104:                                              ; preds = %83, %100
  %indvars.iv.next83 = add nuw nsw i64 %indvars.iv82, 1
  %105 = load i32, ptr @m, align 4, !tbaa !5
  %106 = sext i32 %105 to i64
  %107 = icmp slt i64 %indvars.iv.next83, %106
  br i1 %107, label %83, label %._crit_edge62, !llvm.loop !19

._crit_edge68:                                    ; preds = %.loopexit, %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 @_ZNSt3setIxSt4lessIxESaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(48)) local_unnamed_addr #0 align 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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4 align 2

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

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

attributes #0 = { 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 #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 uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = !{!15, !15, i64 0}
!15 = !{!"long long", !7, i64 0}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}


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