; LLVM IR from tangjz/acm-icpc :: lydsy (5167)

; 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 [51 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 [51 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 [4 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
  %22 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %23

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

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

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

38:                                               ; preds = %28
  %39 = load i32, ptr %2, align 4, !tbaa !5
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %2, align 4, !tbaa !5
  br label %23, !llvm.loop !9

41:                                               ; preds = %27
  %42 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef getelementptr inbounds (%struct.Point, ptr @A, i32 0, i32 1), ptr noundef getelementptr inbounds (%struct.Point, ptr @A, i32 0, i32 2))
  %43 = load double, ptr getelementptr inbounds (%struct.Point, ptr @A, i32 0, i32 1), align 8, !tbaa !11
  store double %43, ptr getelementptr inbounds (%struct.Point, ptr @B, i32 0, i32 1), align 8, !tbaa !11
  %44 = load double, ptr getelementptr inbounds (%struct.Point, ptr @A, i32 0, i32 2), align 8, !tbaa !14
  %45 = fadd double %44, 1.000000e+00
  store double %45, ptr getelementptr inbounds (%struct.Point, ptr @B, i32 0, i32 2), align 8, !tbaa !14
  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, %41
  %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 !15
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %5, ptr align 8 @B, i64 24, i1 false), !tbaa.struct !15
  %52 = load i32, ptr %3, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %54 = getelementptr inbounds [51 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 !15
  %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 [51 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 !15
  %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 !15
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %10, ptr align 8 @B, i64 24, i1 false), !tbaa.struct !15
  %63 = load i32, ptr %3, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [51 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 !15
  %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 [51 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 !15
  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 [51 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 !15
  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 [51 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 !17
  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 !18

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 !16
  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 [51 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 [51 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 !16
  %107 = fadd double %106, %105
  store double %107, ptr @ans, align 8, !tbaa !16
  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 [51 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 [51 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 [51 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 [51 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 !17
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [51 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 [51 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 !17
  %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 [51 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 [51 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 !17
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [51 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 !15
  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 [51 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 [51 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 !17
  %165 = sext i32 %164 to i64
  %166 = getelementptr inbounds [51 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 [51 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 !17
  %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 [51 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 [51 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 !17
  %187 = sext i32 %186 to i64
  %188 = getelementptr inbounds [51 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 !15
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %18, ptr align 8 @A, i64 24, i1 false), !tbaa.struct !15
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %19, ptr align 8 @B, i64 24, i1 false), !tbaa.struct !15
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %20, ptr align 8 %16, i64 24, i1 false), !tbaa.struct !15
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %21, ptr align 8 %17, i64 24, i1 false), !tbaa.struct !15
  %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 !19

205:                                              ; preds = %93
  %206 = load double, ptr @ans, align 8, !tbaa !16
  %207 = fptosi double %206 to i32
  %208 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %207)
  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 = !{!12, !13, i64 8}
!12 = !{!"_ZTS5Point", !6, i64 0, !13, i64 8, !13, i64 16}
!13 = !{!"double", !7, i64 0}
!14 = !{!12, !13, i64 16}
!15 = !{i64 0, i64 4, !5, i64 8, i64 8, !16, i64 16, i64 8, !16}
!16 = !{!13, !13, i64 0}
!17 = !{!12, !6, i64 0}
!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"

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

@p = external dso_local global [51 x %struct.Point], align 16
@A = external dso_local global %struct.Point, align 8
@B = external dso_local local_unnamed_addr global %struct.Point, align 8
@pp = external dso_local global [51 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 [4 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 = load i32, ptr @n, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds (i8, ptr @A, i64 8), ptr noundef nonnull getelementptr inbounds (i8, ptr @A, i64 16))
  %8 = load double, ptr getelementptr inbounds (i8, ptr @A, i64 8), align 8, !tbaa !9
  store double %8, ptr getelementptr inbounds (i8, ptr @B, i64 8), align 8, !tbaa !9
  %9 = load double, ptr getelementptr inbounds (i8, ptr @A, i64 16), align 8, !tbaa !12
  %10 = fadd double %9, 1.000000e+00
  store double %10, ptr getelementptr inbounds (i8, ptr @B, i64 16), align 8, !tbaa !12
  store i32 0, ptr @tot, align 4, !tbaa !5
  %11 = load i32, ptr @n, align 4, !tbaa !5
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph40, label %._crit_edge41

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

._crit_edge41.loopexit:                           ; preds = %42
  %.pre = load i32, ptr @tot, align 4, !tbaa !5
  %20 = sext i32 %.pre to i64
  br label %._crit_edge41

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

.lr.ph40:                                         ; preds = %._crit_edge, %42
  %indvars.iv48 = phi i64 [ %indvars.iv.next49, %42 ], [ 0, %._crit_edge ]
  %25 = phi i32 [ %43, %42 ], [ %11, %._crit_edge ]
  %26 = getelementptr inbounds [51 x %struct.Point], ptr @p, i64 0, i64 %indvars.iv48
  %indvars.iv.next49 = add nuw nsw i64 %indvars.iv48, 1
  %27 = trunc nuw nsw i64 %indvars.iv.next49 to i32
  %28 = srem i32 %27, %25
  %29 = zext nneg i32 %28 to i64
  %30 = getelementptr inbounds [51 x %struct.Point], ptr @p, i64 0, i64 %29
  %31 = 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 %26, ptr noundef nonnull byval(%struct.Point) align 8 %30)
  br i1 %31, label %32, label %42

32:                                               ; preds = %.lr.ph40
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %1) #7
  %33 = load i32, ptr @n, align 4, !tbaa !5
  %34 = srem i32 %27, %33
  %35 = zext nneg i32 %34 to i64
  %36 = getelementptr inbounds [51 x %struct.Point], ptr @p, i64 0, i64 %35
  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 %26, ptr noundef nonnull byval(%struct.Point) align 8 %36)
  %37 = load i32, ptr @tot, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [51 x %struct.Point], ptr @pp, i64 0, i64 %38
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %39, ptr noundef nonnull align 8 dereferenceable(24) %1, i64 24, i1 false), !tbaa.struct !16
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %1) #7
  %40 = add nsw i32 %37, 1
  store i32 %40, ptr @tot, align 4, !tbaa !5
  %41 = trunc nuw nsw i64 %indvars.iv48 to i32
  store i32 %41, ptr %39, align 8, !tbaa !17
  br label %42

42:                                               ; preds = %.lr.ph40, %32
  %43 = load i32, ptr @n, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = icmp slt i64 %indvars.iv.next49, %44
  br i1 %45, label %.lr.ph40, label %._crit_edge41.loopexit, !llvm.loop !18

._crit_edge46.loopexit:                           ; preds = %93
  %.pre51 = load double, ptr @ans, align 8, !tbaa !15
  %46 = fptosi double %.pre51 to i32
  br label %._crit_edge46

._crit_edge46:                                    ; preds = %._crit_edge46.loopexit, %._crit_edge41
  %47 = phi i32 [ %46, %._crit_edge46.loopexit ], [ 0, %._crit_edge41 ]
  %48 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %47)
  ret i32 0

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

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

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

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

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

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

78:                                               ; preds = %68, %74
  %.pn.in = phi i32 [ %77, %74 ], [ %73, %68 ]
  %.pn = sext i32 %.pn.in to i64
  %79 = getelementptr inbounds [51 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) %79, i64 24, i1 false), !tbaa.struct !16
  %80 = load i32, ptr %66, align 8, !tbaa !17
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [51 x %struct.Point], ptr @p, i64 0, i64 %81
  %83 = call noundef zeroext i1 @_ZNK5PointeqERKS_(ptr noundef nonnull align 8 dereferenceable(24) %66, ptr noundef nonnull align 8 dereferenceable(24) %82)
  %84 = load i32, ptr %66, align 8, !tbaa !17
  br i1 %83, label %85, label %89

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

89:                                               ; preds = %78, %85
  %.pn35.in = phi i32 [ %88, %85 ], [ %84, %78 ]
  %.pn35 = sext i32 %.pn35.in to i64
  %90 = getelementptr inbounds [51 x %struct.Point], ptr @p, i64 0, i64 %.pn35
  %91 = 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 %90)
  %92 = zext i1 %91 to i32
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3)
  %.pre52 = add nsw i32 %.03042, 2
  br label %93

93:                                               ; preds = %58, %62, %89
  %.pre-phi = phi i32 [ %59, %58 ], [ %59, %62 ], [ %.pre52, %89 ]
  %.pn36 = phi i32 [ 1, %58 ], [ 1, %62 ], [ %92, %89 ]
  %.2 = xor i32 %.pn36, %.043
  %94 = load i32, ptr @tot, align 4, !tbaa !5
  %95 = icmp slt i32 %.pre-phi, %94
  br i1 %95, label %.lr.ph45, label %._crit_edge46.loopexit, !llvm.loop !19
}

; 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 = !{!10, !11, i64 8}
!10 = !{!"_ZTS5Point", !6, i64 0, !11, i64 8, !11, i64 16}
!11 = !{!"double", !7, i64 0}
!12 = !{!10, !11, i64 16}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!11, !11, i64 0}
!16 = !{i64 0, i64 4, !5, i64 8, i64 8, !15, i64 16, i64 8, !15}
!17 = !{!10, !6, i64 0}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}


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