; LLVM IR from tangjz/acm-icpc :: self_training/2015-03-15 (B)

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

%struct.Point = type { i32, double, double }

@p = external dso_local global [100001 x %struct.Point], align 16
@A = external dso_local global %struct.Point, align 8
@B = external dso_local global %struct.Point, align 8
@pp = external dso_local global [100001 x %struct.Point], align 16
@n = external dso_local global i32, align 4
@tot = external dso_local global i32, align 4
@ans = external dso_local global double, align 8
@.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 [13 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 %struct.Point, align 8
  %5 = alloca %struct.Point, align 8
  %6 = alloca %struct.Point, align 8
  %7 = alloca %struct.Point, align 8
  %8 = alloca %struct.Point, align 8
  %9 = alloca %struct.Point, align 8
  %10 = alloca %struct.Point, align 8
  %11 = alloca %struct.Point, align 8
  %12 = alloca %struct.Point, align 8
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca %struct.Point, align 8
  %16 = alloca %struct.Point, align 8
  %17 = alloca %struct.Point, align 8
  %18 = alloca %struct.Point, align 8
  %19 = alloca %struct.Point, align 8
  %20 = alloca %struct.Point, align 8
  %21 = alloca %struct.Point, align 8
  store i32 0, ptr %1, align 4
  br label %22

22:                                               ; preds = %205, %0
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  %24 = icmp eq i32 %23, 1
  br i1 %24, label %25, label %208

25:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %26

26:                                               ; preds = %41, %25
  %27 = load i32, ptr %2, align 4, !tbaa !5
  %28 = load i32, ptr @n, align 4, !tbaa !5
  %29 = icmp slt i32 %27, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %26
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %44

31:                                               ; preds = %26
  %32 = load i32, ptr %2, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [100001 x %struct.Point], ptr @p, i64 0, i64 %33
  %35 = getelementptr inbounds %struct.Point, ptr %34, i32 0, i32 1
  %36 = load i32, ptr %2, align 4, !tbaa !5
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [100001 x %struct.Point], ptr @p, i64 0, i64 %37
  %39 = getelementptr inbounds %struct.Point, ptr %38, i32 0, i32 2
  %40 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %35, ptr noundef %39)
  br label %41

41:                                               ; preds = %31
  %42 = load i32, ptr %2, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %2, align 4, !tbaa !5
  br label %26, !llvm.loop !9

44:                                               ; preds = %30
  %45 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.2, ptr noundef getelementptr inbounds (%struct.Point, ptr @A, i32 0, i32 1), ptr noundef getelementptr inbounds (%struct.Point, ptr @A, i32 0, i32 2), ptr noundef getelementptr inbounds (%struct.Point, ptr @B, i32 0, i32 1), ptr noundef getelementptr inbounds (%struct.Point, ptr @B, i32 0, i32 2))
  store i32 0, ptr @tot, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %46

46:                                               ; preds = %82, %44
  %47 = load i32, ptr %3, align 4, !tbaa !5
  %48 = load i32, ptr @n, align 4, !tbaa !5
  %49 = icmp slt i32 %47, %48
  br i1 %49, label %51, label %50

50:                                               ; preds = %46
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %85

51:                                               ; preds = %46
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %4, ptr align 8 @A, i64 24, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %5, ptr align 8 @B, i64 24, i1 false), !tbaa.struct !11
  %52 = load i32, ptr %3, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [100001 x %struct.Point], ptr @p, i64 0, i64 %53
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %6, ptr align 8 %54, i64 24, i1 false), !tbaa.struct !11
  %55 = load i32, ptr %3, align 4, !tbaa !5
  %56 = add nsw i32 %55, 1
  %57 = load i32, ptr @n, align 4, !tbaa !5
  %58 = srem i32 %56, %57
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds [100001 x %struct.Point], ptr @p, i64 0, i64 %59
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %7, ptr align 8 %60, i64 24, i1 false), !tbaa.struct !11
  %61 = call noundef zeroext i1 @_Z5isIns5PointS_S_S_(ptr noundef byval(%struct.Point) align 8 %4, ptr noundef byval(%struct.Point) align 8 %5, ptr noundef byval(%struct.Point) align 8 %6, ptr noundef byval(%struct.Point) align 8 %7)
  br i1 %61, label %62, label %81

62:                                               ; preds = %51
  call void @llvm.lifetime.start.p0(i64 24, ptr %8) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 @A, i64 24, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 @B, i64 24, i1 false), !tbaa.struct !11
  %63 = load i32, ptr %3, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [100001 x %struct.Point], ptr @p, i64 0, i64 %64
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %11, ptr align 8 %65, i64 24, i1 false), !tbaa.struct !11
  %66 = load i32, ptr %3, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  %68 = load i32, ptr @n, align 4, !tbaa !5
  %69 = srem i32 %67, %68
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [100001 x %struct.Point], ptr @p, i64 0, i64 %70
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %12, ptr align 8 %71, i64 24, i1 false), !tbaa.struct !11
  call void @_Z6SegIns5PointS_S_S_(ptr dead_on_unwind writable sret(%struct.Point) align 8 %8, ptr noundef byval(%struct.Point) align 8 %9, ptr noundef byval(%struct.Point) align 8 %10, ptr noundef byval(%struct.Point) align 8 %11, ptr noundef byval(%struct.Point) align 8 %12)
  %72 = load i32, ptr @tot, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [100001 x %struct.Point], ptr @pp, i64 0, i64 %73
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %74, ptr align 8 %8, i64 24, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #7
  %75 = load i32, ptr %3, align 4, !tbaa !5
  %76 = load i32, ptr @tot, align 4, !tbaa !5
  %77 = add nsw i32 %76, 1
  store i32 %77, ptr @tot, align 4, !tbaa !5
  %78 = sext i32 %76 to i64
  %79 = getelementptr inbounds [100001 x %struct.Point], ptr @pp, i64 0, i64 %78
  %80 = getelementptr inbounds %struct.Point, ptr %79, i32 0, i32 0
  store i32 %75, ptr %80, align 8, !tbaa !14
  br label %81

81:                                               ; preds = %62, %51
  br label %82

82:                                               ; preds = %81
  %83 = load i32, ptr %3, align 4, !tbaa !5
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %3, align 4, !tbaa !5
  br label %46, !llvm.loop !16

85:                                               ; preds = %50
  %86 = load i32, ptr @tot, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds %struct.Point, ptr @pp, i64 %87
  call void @_ZSt4sortIP5PointEvT_S2_(ptr noundef @pp, ptr noundef %88)
  store double 0.000000e+00, ptr @ans, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 0, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %89

89:                                               ; preds = %202, %85
  %90 = load i32, ptr %13, align 4, !tbaa !5
  %91 = load i32, ptr @tot, align 4, !tbaa !5
  %92 = icmp slt i32 %90, %91
  br i1 %92, label %94, label %93

93:                                               ; preds = %89
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  br label %205

94:                                               ; preds = %89
  %95 = load i32, ptr %14, align 4, !tbaa !5
  %96 = icmp ne i32 %95, 0
  br i1 %96, label %97, label %108

97:                                               ; preds = %94
  call void @llvm.lifetime.start.p0(i64 24, ptr %15) #7
  %98 = load i32, ptr %13, align 4, !tbaa !5
  %99 = sub nsw i32 %98, 1
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [100001 x %struct.Point], ptr @pp, i64 0, i64 %100
  %102 = load i32, ptr %13, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [100001 x %struct.Point], ptr @pp, i64 0, i64 %103
  call void @_ZNK5PointmiERKS_(ptr dead_on_unwind writable sret(%struct.Point) align 8 %15, ptr noundef nonnull align 8 dereferenceable(24) %101, ptr noundef nonnull align 8 dereferenceable(24) %104)
  %105 = call noundef double @_ZNK5Point4modeEv(ptr noundef nonnull align 8 dereferenceable(24) %15)
  %106 = load double, ptr @ans, align 8, !tbaa !12
  %107 = fadd double %106, %105
  store double %107, ptr @ans, align 8, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #7
  br label %108

108:                                              ; preds = %97, %94
  %109 = load i32, ptr %13, align 4, !tbaa !5
  %110 = add nsw i32 %109, 1
  %111 = load i32, ptr @n, align 4, !tbaa !5
  %112 = icmp slt i32 %110, %111
  br i1 %112, label %113, label %198

113:                                              ; preds = %108
  %114 = load i32, ptr %13, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [100001 x %struct.Point], ptr @pp, i64 0, i64 %115
  %117 = load i32, ptr %13, align 4, !tbaa !5
  %118 = add nsw i32 %117, 1
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [100001 x %struct.Point], ptr @pp, i64 0, i64 %119
  %121 = call noundef zeroext i1 @_ZNK5PointeqERKS_(ptr noundef nonnull align 8 dereferenceable(24) %116, ptr noundef nonnull align 8 dereferenceable(24) %120)
  br i1 %121, label %122, label %198

122:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 24, ptr %16) #7
  %123 = load i32, ptr %13, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [100001 x %struct.Point], ptr @pp, i64 0, i64 %124
  %126 = load i32, ptr %13, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [100001 x %struct.Point], ptr @pp, i64 0, i64 %127
  %129 = getelementptr inbounds %struct.Point, ptr %128, i32 0, i32 0
  %130 = load i32, ptr %129, align 8, !tbaa !14
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [100001 x %struct.Point], ptr @p, i64 0, i64 %131
  %133 = call noundef zeroext i1 @_ZNK5PointeqERKS_(ptr noundef nonnull align 8 dereferenceable(24) %125, ptr noundef nonnull align 8 dereferenceable(24) %132)
  br i1 %133, label %134, label %145

134:                                              ; preds = %122
  %135 = load i32, ptr %13, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [100001 x %struct.Point], ptr @pp, i64 0, i64 %136
  %138 = getelementptr inbounds %struct.Point, ptr %137, i32 0, i32 0
  %139 = load i32, ptr %138, align 8, !tbaa !14
  %140 = add nsw i32 %139, 1
  %141 = load i32, ptr @n, align 4, !tbaa !5
  %142 = srem i32 %140, %141
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [100001 x %struct.Point], ptr @p, i64 0, i64 %143
  br label %153

145:                                              ; preds = %122
  %146 = load i32, ptr %13, align 4, !tbaa !5
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [100001 x %struct.Point], ptr @pp, i64 0, i64 %147
  %149 = getelementptr inbounds %struct.Point, ptr %148, i32 0, i32 0
  %150 = load i32, ptr %149, align 8, !tbaa !14
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [100001 x %struct.Point], ptr @p, i64 0, i64 %151
  br label %153

153:                                              ; preds = %145, %134
  %154 = phi ptr [ %144, %134 ], [ %152, %145 ]
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %16, ptr align 8 %154, i64 24, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.start.p0(i64 24, ptr %17) #7
  %155 = load i32, ptr %13, align 4, !tbaa !5
  %156 = add nsw i32 %155, 1
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [100001 x %struct.Point], ptr @pp, i64 0, i64 %157
  %159 = load i32, ptr %13, align 4, !tbaa !5
  %160 = add nsw i32 %159, 1
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [100001 x %struct.Point], ptr @pp, i64 0, i64 %161
  %163 = getelementptr inbounds %struct.Point, ptr %162, i32 0, i32 0
  %164 = load i32, ptr %163, align 8, !tbaa !14
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [100001 x %struct.Point], ptr @p, i64 0, i64 %165
  %167 = call noundef zeroext i1 @_ZNK5PointeqERKS_(ptr noundef nonnull align 8 dereferenceable(24) %158, ptr noundef nonnull align 8 dereferenceable(24) %166)
  br i1 %167, label %168, label %180

168:                                              ; preds = %153
  %169 = load i32, ptr %13, align 4, !tbaa !5
  %170 = add nsw i32 %169, 1
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [100001 x %struct.Point], ptr @pp, i64 0, i64 %171
  %173 = getelementptr inbounds %struct.Point, ptr %172, i32 0, i32 0
  %174 = load i32, ptr %173, align 8, !tbaa !14
  %175 = add nsw i32 %174, 1
  %176 = load i32, ptr @n, align 4, !tbaa !5
  %177 = srem i32 %175, %176
  %178 = sext i32 %177 to i64
  %179 = getelementptr inbounds [100001 x %struct.Point], ptr @p, i64 0, i64 %178
  br label %189

180:                                              ; preds = %153
  %181 = load i32, ptr %13, align 4, !tbaa !5
  %182 = add nsw i32 %181, 1
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [100001 x %struct.Point], ptr @pp, i64 0, i64 %183
  %185 = getelementptr inbounds %struct.Point, ptr %184, i32 0, i32 0
  %186 = load i32, ptr %185, align 8, !tbaa !14
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [100001 x %struct.Point], ptr @p, i64 0, i64 %187
  br label %189

189:                                              ; preds = %180, %168
  %190 = phi ptr [ %179, %168 ], [ %188, %180 ]
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %17, ptr align 8 %190, i64 24, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %18, ptr align 8 @A, i64 24, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %19, ptr align 8 @B, i64 24, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %20, ptr align 8 %16, i64 24, i1 false), !tbaa.struct !11
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %21, ptr align 8 %17, i64 24, i1 false), !tbaa.struct !11
  %191 = call noundef zeroext i1 @_Z5isIns5PointS_S_S_(ptr noundef byval(%struct.Point) align 8 %18, ptr noundef byval(%struct.Point) align 8 %19, ptr noundef byval(%struct.Point) align 8 %20, ptr noundef byval(%struct.Point) align 8 %21)
  br i1 %191, label %192, label %195

192:                                              ; preds = %189
  %193 = load i32, ptr %14, align 4, !tbaa !5
  %194 = xor i32 %193, 1
  store i32 %194, ptr %14, align 4, !tbaa !5
  br label %195

195:                                              ; preds = %192, %189
  %196 = load i32, ptr %13, align 4, !tbaa !5
  %197 = add nsw i32 %196, 1
  store i32 %197, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 24, ptr %17) #7
  call void @llvm.lifetime.end.p0(i64 24, ptr %16) #7
  br label %201

198:                                              ; preds = %113, %108
  %199 = load i32, ptr %14, align 4, !tbaa !5
  %200 = xor i32 %199, 1
  store i32 %200, ptr %14, align 4, !tbaa !5
  br label %201

201:                                              ; preds = %198, %195
  br label %202

202:                                              ; preds = %201
  %203 = load i32, ptr %13, align 4, !tbaa !5
  %204 = add nsw i32 %203, 1
  store i32 %204, ptr %13, align 4, !tbaa !5
  br label %89, !llvm.loop !17

205:                                              ; preds = %93
  %206 = load double, ptr @ans, align 8, !tbaa !12
  %207 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, double noundef %206)
  br label %22, !llvm.loop !18

208:                                              ; preds = %22
  ret i32 0
}

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z5isIns5PointS_S_S_(ptr noundef byval(%struct.Point) align 8, ptr noundef byval(%struct.Point) align 8, ptr noundef byval(%struct.Point) align 8, ptr noundef byval(%struct.Point) align 8) #3

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z6SegIns5PointS_S_S_(ptr dead_on_unwind noalias writable sret(%struct.Point) align 8, ptr noundef byval(%struct.Point) align 8, ptr noundef byval(%struct.Point) align 8, ptr noundef byval(%struct.Point) align 8, ptr noundef byval(%struct.Point) align 8) #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIP5PointEvT_S2_(ptr noundef, ptr noundef) #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNK5PointmiERKS_(ptr dead_on_unwind noalias writable sret(%struct.Point) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZNK5Point4modeEv(ptr noundef nonnull align 8 dereferenceable(24)) #6 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK5PointeqERKS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #5 align 2

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

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

@p = external dso_local global [100001 x %struct.Point], align 16
@A = external dso_local global %struct.Point, align 8
@B = external dso_local global %struct.Point, align 8
@pp = external dso_local global [100001 x %struct.Point], align 16
@n = 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 double, align 8
@.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 [13 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 %struct.Point, align 8
  %2 = alloca %struct.Point, align 8
  %3 = alloca %struct.Point, align 8
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %5 = icmp eq i32 %4, 1
  br i1 %5, label %.preheader, label %._crit_edge47

.preheader:                                       ; preds = %0, %._crit_edge46
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.preheader
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.2, ptr noundef nonnull getelementptr inbounds (i8, ptr @A, i64 8), ptr noundef nonnull getelementptr inbounds (i8, ptr @A, i64 16), ptr noundef nonnull getelementptr inbounds (i8, ptr @B, i64 8), ptr noundef nonnull getelementptr inbounds (i8, ptr @B, i64 16))
  store i32 0, ptr @tot, align 4, !tbaa !5
  %9 = load i32, ptr @n, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph40, label %._crit_edge41

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader ]
  %11 = getelementptr inbounds [100001 x %struct.Point], ptr @p, i64 0, i64 %indvars.iv
  %12 = getelementptr inbounds i8, ptr %11, i64 8
  %13 = getelementptr inbounds i8, ptr %11, i64 16
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %12, ptr noundef nonnull %13)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %15 = load i32, ptr @n, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = icmp slt i64 %indvars.iv.next, %16
  br i1 %17, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge41.loopexit:                           ; preds = %40
  %.pre = load i32, ptr @tot, align 4, !tbaa !5
  br label %._crit_edge41

._crit_edge41:                                    ; preds = %._crit_edge41.loopexit, %._crit_edge
  %18 = phi i32 [ %.pre, %._crit_edge41.loopexit ], [ 0, %._crit_edge ]
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds %struct.Point, ptr @pp, i64 %19
  call void @_ZSt4sortIP5PointEvT_S2_(ptr noundef nonnull @pp, ptr noundef nonnull %20)
  store double 0.000000e+00, ptr @ans, align 8, !tbaa !11
  %21 = load i32, ptr @tot, align 4, !tbaa !5
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %.lr.ph45, label %._crit_edge46

.lr.ph40:                                         ; preds = %._crit_edge, %40
  %indvars.iv49 = phi i64 [ %indvars.iv.next50, %40 ], [ 0, %._crit_edge ]
  %23 = phi i32 [ %41, %40 ], [ %9, %._crit_edge ]
  %24 = getelementptr inbounds [100001 x %struct.Point], ptr @p, i64 0, i64 %indvars.iv49
  %indvars.iv.next50 = add nuw nsw i64 %indvars.iv49, 1
  %25 = trunc nuw nsw i64 %indvars.iv.next50 to i32
  %26 = srem i32 %25, %23
  %27 = zext nneg i32 %26 to i64
  %28 = getelementptr inbounds [100001 x %struct.Point], ptr @p, i64 0, i64 %27
  %29 = call noundef zeroext i1 @_Z5isIns5PointS_S_S_(ptr noundef nonnull byval(%struct.Point) align 8 @A, ptr noundef nonnull byval(%struct.Point) align 8 @B, ptr noundef nonnull byval(%struct.Point) align 8 %24, ptr noundef nonnull byval(%struct.Point) align 8 %28)
  br i1 %29, label %30, label %40

30:                                               ; preds = %.lr.ph40
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %1) #7
  %31 = load i32, ptr @n, align 4, !tbaa !5
  %32 = srem i32 %25, %31
  %33 = zext nneg i32 %32 to i64
  %34 = getelementptr inbounds [100001 x %struct.Point], ptr @p, i64 0, i64 %33
  call void @_Z6SegIns5PointS_S_S_(ptr dead_on_unwind nonnull writable sret(%struct.Point) align 8 %1, ptr noundef nonnull byval(%struct.Point) align 8 @A, ptr noundef nonnull byval(%struct.Point) align 8 @B, ptr noundef nonnull byval(%struct.Point) align 8 %24, ptr noundef nonnull byval(%struct.Point) align 8 %34)
  %35 = load i32, ptr @tot, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [100001 x %struct.Point], ptr @pp, i64 0, i64 %36
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %37, ptr noundef nonnull align 8 dereferenceable(24) %1, i64 24, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %1) #7
  %38 = add nsw i32 %35, 1
  store i32 %38, ptr @tot, align 4, !tbaa !5
  %39 = trunc nuw nsw i64 %indvars.iv49 to i32
  store i32 %39, ptr %37, align 8, !tbaa !14
  br label %40

40:                                               ; preds = %.lr.ph40, %30
  %41 = load i32, ptr @n, align 4, !tbaa !5
  %42 = sext i32 %41 to i64
  %43 = icmp slt i64 %indvars.iv.next50, %42
  br i1 %43, label %.lr.ph40, label %._crit_edge41.loopexit, !llvm.loop !16

._crit_edge46.loopexit:                           ; preds = %92
  %.pre52 = load double, ptr @ans, align 8, !tbaa !11
  br label %._crit_edge46

._crit_edge46:                                    ; preds = %._crit_edge46.loopexit, %._crit_edge41
  %44 = phi double [ %.pre52, %._crit_edge46.loopexit ], [ 0.000000e+00, %._crit_edge41 ]
  %45 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, double noundef %44)
  %46 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n)
  %47 = icmp eq i32 %46, 1
  br i1 %47, label %.preheader, label %._crit_edge47, !llvm.loop !17

.lr.ph45:                                         ; preds = %._crit_edge41, %92
  %.043 = phi i32 [ %.2, %92 ], [ 0, %._crit_edge41 ]
  %.03042 = phi i32 [ %.pre-phi, %92 ], [ 0, %._crit_edge41 ]
  %.not = icmp eq i32 %.043, 0
  br i1 %.not, label %57, label %48

48:                                               ; preds = %.lr.ph45
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #7
  %49 = add nsw i32 %.03042, -1
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [100001 x %struct.Point], ptr @pp, i64 0, i64 %50
  %52 = sext i32 %.03042 to i64
  %53 = getelementptr inbounds [100001 x %struct.Point], ptr @pp, i64 0, i64 %52
  call void @_ZNK5PointmiERKS_(ptr dead_on_unwind nonnull writable sret(%struct.Point) align 8 %2, ptr noundef nonnull align 8 dereferenceable(24) %51, ptr noundef nonnull align 8 dereferenceable(24) %53)
  %54 = call noundef double @_ZNK5Point4modeEv(ptr noundef nonnull align 8 dereferenceable(24) %2)
  %55 = load double, ptr @ans, align 8, !tbaa !11
  %56 = fadd double %54, %55
  store double %56, ptr @ans, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #7
  br label %57

57:                                               ; preds = %48, %.lr.ph45
  %58 = add nsw i32 %.03042, 1
  %59 = load i32, ptr @n, align 4, !tbaa !5
  %60 = icmp slt i32 %58, %59
  br i1 %60, label %61, label %92

61:                                               ; preds = %57
  %62 = sext i32 %.03042 to i64
  %63 = getelementptr inbounds [100001 x %struct.Point], ptr @pp, i64 0, i64 %62
  %64 = sext i32 %58 to i64
  %65 = getelementptr inbounds [100001 x %struct.Point], ptr @pp, i64 0, i64 %64
  %66 = call noundef zeroext i1 @_ZNK5PointeqERKS_(ptr noundef nonnull align 8 dereferenceable(24) %63, ptr noundef nonnull align 8 dereferenceable(24) %65)
  br i1 %66, label %67, label %92

67:                                               ; preds = %61
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3)
  %68 = load i32, ptr %63, align 8, !tbaa !14
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [100001 x %struct.Point], ptr @p, i64 0, i64 %69
  %71 = call noundef zeroext i1 @_ZNK5PointeqERKS_(ptr noundef nonnull align 8 dereferenceable(24) %63, ptr noundef nonnull align 8 dereferenceable(24) %70)
  %72 = load i32, ptr %63, align 8, !tbaa !14
  br i1 %71, label %73, label %77

73:                                               ; preds = %67
  %74 = add nsw i32 %72, 1
  %75 = load i32, ptr @n, align 4, !tbaa !5
  %76 = srem i32 %74, %75
  br label %77

77:                                               ; preds = %67, %73
  %.pn.in = phi i32 [ %76, %73 ], [ %72, %67 ]
  %.pn = sext i32 %.pn.in to i64
  %78 = getelementptr inbounds [100001 x %struct.Point], ptr @p, i64 0, i64 %.pn
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %78, i64 24, i1 false), !tbaa.struct !13
  %79 = load i32, ptr %65, align 8, !tbaa !14
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [100001 x %struct.Point], ptr @p, i64 0, i64 %80
  %82 = call noundef zeroext i1 @_ZNK5PointeqERKS_(ptr noundef nonnull align 8 dereferenceable(24) %65, ptr noundef nonnull align 8 dereferenceable(24) %81)
  %83 = load i32, ptr %65, align 8, !tbaa !14
  br i1 %82, label %84, label %88

84:                                               ; preds = %77
  %85 = add nsw i32 %83, 1
  %86 = load i32, ptr @n, align 4, !tbaa !5
  %87 = srem i32 %85, %86
  br label %88

88:                                               ; preds = %77, %84
  %.pn35.in = phi i32 [ %87, %84 ], [ %83, %77 ]
  %.pn35 = sext i32 %.pn35.in to i64
  %89 = getelementptr inbounds [100001 x %struct.Point], ptr @p, i64 0, i64 %.pn35
  %90 = call noundef zeroext i1 @_Z5isIns5PointS_S_S_(ptr noundef nonnull byval(%struct.Point) align 8 @A, ptr noundef nonnull byval(%struct.Point) align 8 @B, ptr noundef nonnull byval(%struct.Point) align 8 %3, ptr noundef nonnull byval(%struct.Point) align 8 %89)
  %91 = zext i1 %90 to i32
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3)
  %.pre53 = add nsw i32 %.03042, 2
  br label %92

92:                                               ; preds = %57, %61, %88
  %.pre-phi = phi i32 [ %58, %57 ], [ %58, %61 ], [ %.pre53, %88 ]
  %.pn36 = phi i32 [ 1, %57 ], [ 1, %61 ], [ %91, %88 ]
  %.2 = xor i32 %.pn36, %.043
  %93 = load i32, ptr @tot, align 4, !tbaa !5
  %94 = icmp slt i32 %.pre-phi, %93
  br i1 %94, label %.lr.ph45, label %._crit_edge46.loopexit, !llvm.loop !18

._crit_edge47:                                    ; preds = %._crit_edge46, %0
  ret i32 0
}

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z5isIns5PointS_S_S_(ptr noundef byval(%struct.Point) align 8, ptr noundef byval(%struct.Point) align 8, ptr noundef byval(%struct.Point) align 8, ptr noundef byval(%struct.Point) align 8) local_unnamed_addr #3

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z6SegIns5PointS_S_S_(ptr dead_on_unwind noalias writable sret(%struct.Point) align 8, ptr noundef byval(%struct.Point) align 8, ptr noundef byval(%struct.Point) align 8, ptr noundef byval(%struct.Point) align 8, ptr noundef byval(%struct.Point) align 8) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIP5PointEvT_S2_(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNK5PointmiERKS_(ptr dead_on_unwind noalias writable sret(%struct.Point) align 8, ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef double @_ZNK5Point4modeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #6 align 2

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

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

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


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass