; LLVM IR from tangjz/acm-icpc :: codechef/SNCKEL19/IMPO.ll (Z11readPolygonRiP5PointS_S_i)

; 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.Event = type { i32, i32, x86_fp80, x86_fp80 }
%struct.Point = type { i32, i32 }

@tot = external dso_local global i32, align 4
@eve = external dso_local global [400005 x %struct.Event], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11readPolygonRiP5PointS_S_i(ptr noundef nonnull align 4 dereferenceable(4) %0, ptr noundef %1, ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3, i32 noundef %4) #0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca x86_fp80, align 16
  %17 = alloca x86_fp80, align 16
  %18 = alloca %struct.Event, align 16
  %19 = alloca %struct.Event, align 16
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  store i32 %4, ptr %10, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  store i64 0, ptr %11, align 8, !tbaa !11
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = load ptr, ptr %7, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.Point, ptr %21, i64 0
  %23 = getelementptr inbounds %struct.Point, ptr %22, i32 0, i32 0
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.Point, ptr %24, i64 0
  %26 = getelementptr inbounds %struct.Point, ptr %25, i32 0, i32 1
  %27 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %20, ptr noundef %23, ptr noundef %26)
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.Point, ptr %28, i64 0
  %30 = getelementptr inbounds %struct.Point, ptr %29, i32 0, i32 0
  %31 = load i32, ptr %30, align 4, !tbaa !13
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %31, ptr %32, align 4, !tbaa !9
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 %31, ptr %33, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  store i32 1, ptr %12, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %82, %5
  %35 = load i32, ptr %12, align 4, !tbaa !9
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = load i32, ptr %36, align 4, !tbaa !9
  %38 = icmp slt i32 %35, %37
  br i1 %38, label %40, label %39

39:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %85

40:                                               ; preds = %34
  %41 = load ptr, ptr %7, align 8, !tbaa !5
  %42 = load i32, ptr %12, align 4, !tbaa !9
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds %struct.Point, ptr %41, i64 %43
  %45 = getelementptr inbounds %struct.Point, ptr %44, i32 0, i32 0
  %46 = load ptr, ptr %7, align 8, !tbaa !5
  %47 = load i32, ptr %12, align 4, !tbaa !9
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds %struct.Point, ptr %46, i64 %48
  %50 = getelementptr inbounds %struct.Point, ptr %49, i32 0, i32 1
  %51 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %45, ptr noundef %50)
  %52 = load ptr, ptr %8, align 8, !tbaa !5
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = load i32, ptr %12, align 4, !tbaa !9
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds %struct.Point, ptr %53, i64 %55
  %57 = getelementptr inbounds %struct.Point, ptr %56, i32 0, i32 0
  %58 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %52, ptr noundef nonnull align 4 dereferenceable(4) %57)
  %59 = load i32, ptr %58, align 4, !tbaa !9
  %60 = load ptr, ptr %8, align 8, !tbaa !5
  store i32 %59, ptr %60, align 4, !tbaa !9
  %61 = load ptr, ptr %9, align 8, !tbaa !5
  %62 = load ptr, ptr %7, align 8, !tbaa !5
  %63 = load i32, ptr %12, align 4, !tbaa !9
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds %struct.Point, ptr %62, i64 %64
  %66 = getelementptr inbounds %struct.Point, ptr %65, i32 0, i32 0
  %67 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %61, ptr noundef nonnull align 4 dereferenceable(4) %66)
  %68 = load i32, ptr %67, align 4, !tbaa !9
  %69 = load ptr, ptr %9, align 8, !tbaa !5
  store i32 %68, ptr %69, align 4, !tbaa !9
  %70 = load ptr, ptr %7, align 8, !tbaa !5
  %71 = load i32, ptr %12, align 4, !tbaa !9
  %72 = sub nsw i32 %71, 1
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds %struct.Point, ptr %70, i64 %73
  %75 = load ptr, ptr %7, align 8, !tbaa !5
  %76 = load i32, ptr %12, align 4, !tbaa !9
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds %struct.Point, ptr %75, i64 %77
  %79 = call noundef i64 @_ZNK5Point3detERKS_(ptr noundef nonnull align 4 dereferenceable(8) %74, ptr noundef nonnull align 4 dereferenceable(8) %78)
  %80 = load i64, ptr %11, align 8, !tbaa !11
  %81 = add nsw i64 %80, %79
  store i64 %81, ptr %11, align 8, !tbaa !11
  br label %82

82:                                               ; preds = %40
  %83 = load i32, ptr %12, align 4, !tbaa !9
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %12, align 4, !tbaa !9
  br label %34, !llvm.loop !15

85:                                               ; preds = %39
  %86 = load ptr, ptr %7, align 8, !tbaa !5
  %87 = load ptr, ptr %6, align 8, !tbaa !5
  %88 = load i32, ptr %87, align 4, !tbaa !9
  %89 = sub nsw i32 %88, 1
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds %struct.Point, ptr %86, i64 %90
  %92 = load ptr, ptr %7, align 8, !tbaa !5
  %93 = getelementptr inbounds %struct.Point, ptr %92, i64 0
  %94 = call noundef i64 @_ZNK5Point3detERKS_(ptr noundef nonnull align 4 dereferenceable(8) %91, ptr noundef nonnull align 4 dereferenceable(8) %93)
  %95 = load i64, ptr %11, align 8, !tbaa !11
  %96 = add nsw i64 %95, %94
  store i64 %96, ptr %11, align 8, !tbaa !11
  %97 = load i64, ptr %11, align 8, !tbaa !11
  %98 = icmp slt i64 %97, 0
  br i1 %98, label %99, label %106

99:                                               ; preds = %85
  %100 = load ptr, ptr %7, align 8, !tbaa !5
  %101 = load ptr, ptr %7, align 8, !tbaa !5
  %102 = load ptr, ptr %6, align 8, !tbaa !5
  %103 = load i32, ptr %102, align 4, !tbaa !9
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds %struct.Point, ptr %101, i64 %104
  call void @_ZSt7reverseIP5PointEvT_S2_(ptr noundef %100, ptr noundef %105)
  br label %106

106:                                              ; preds = %99, %85
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  store i32 0, ptr %13, align 4, !tbaa !9
  br label %107

107:                                              ; preds = %225, %106
  %108 = load i32, ptr %13, align 4, !tbaa !9
  %109 = load ptr, ptr %6, align 8, !tbaa !5
  %110 = load i32, ptr %109, align 4, !tbaa !9
  %111 = icmp slt i32 %108, %110
  br i1 %111, label %113, label %112

112:                                              ; preds = %107
  store i32 5, ptr %14, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  br label %228

113:                                              ; preds = %107
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  %114 = load i32, ptr %13, align 4, !tbaa !9
  %115 = icmp ne i32 %114, 0
  br i1 %115, label %116, label %119

116:                                              ; preds = %113
  %117 = load i32, ptr %13, align 4, !tbaa !9
  %118 = sub nsw i32 %117, 1
  br label %123

119:                                              ; preds = %113
  %120 = load ptr, ptr %6, align 8, !tbaa !5
  %121 = load i32, ptr %120, align 4, !tbaa !9
  %122 = sub nsw i32 %121, 1
  br label %123

123:                                              ; preds = %119, %116
  %124 = phi i32 [ %118, %116 ], [ %122, %119 ]
  store i32 %124, ptr %15, align 4, !tbaa !9
  %125 = load ptr, ptr %7, align 8, !tbaa !5
  %126 = load i32, ptr %13, align 4, !tbaa !9
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds %struct.Point, ptr %125, i64 %127
  %129 = getelementptr inbounds %struct.Point, ptr %128, i32 0, i32 0
  %130 = load i32, ptr %129, align 4, !tbaa !13
  %131 = load ptr, ptr %7, align 8, !tbaa !5
  %132 = load i32, ptr %15, align 4, !tbaa !9
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds %struct.Point, ptr %131, i64 %133
  %135 = getelementptr inbounds %struct.Point, ptr %134, i32 0, i32 0
  %136 = load i32, ptr %135, align 4, !tbaa !13
  %137 = icmp eq i32 %130, %136
  br i1 %137, label %138, label %139

138:                                              ; preds = %123
  store i32 7, ptr %14, align 4
  br label %222

139:                                              ; preds = %123
  call void @llvm.lifetime.start.p0(i64 16, ptr %16) #8
  %140 = load ptr, ptr %7, align 8, !tbaa !5
  %141 = load i32, ptr %13, align 4, !tbaa !9
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds %struct.Point, ptr %140, i64 %142
  %144 = getelementptr inbounds %struct.Point, ptr %143, i32 0, i32 1
  %145 = load i32, ptr %144, align 4, !tbaa !17
  %146 = load ptr, ptr %7, align 8, !tbaa !5
  %147 = load i32, ptr %15, align 4, !tbaa !9
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds %struct.Point, ptr %146, i64 %148
  %150 = getelementptr inbounds %struct.Point, ptr %149, i32 0, i32 1
  %151 = load i32, ptr %150, align 4, !tbaa !17
  %152 = sub nsw i32 %145, %151
  %153 = sitofp i32 %152 to x86_fp80
  %154 = load ptr, ptr %7, align 8, !tbaa !5
  %155 = load i32, ptr %13, align 4, !tbaa !9
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds %struct.Point, ptr %154, i64 %156
  %158 = getelementptr inbounds %struct.Point, ptr %157, i32 0, i32 0
  %159 = load i32, ptr %158, align 4, !tbaa !13
  %160 = load ptr, ptr %7, align 8, !tbaa !5
  %161 = load i32, ptr %15, align 4, !tbaa !9
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds %struct.Point, ptr %160, i64 %162
  %164 = getelementptr inbounds %struct.Point, ptr %163, i32 0, i32 0
  %165 = load i32, ptr %164, align 4, !tbaa !13
  %166 = sub nsw i32 %159, %165
  %167 = sitofp i32 %166 to x86_fp80
  %168 = fdiv x86_fp80 %153, %167
  store x86_fp80 %168, ptr %16, align 16, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 16, ptr %17) #8
  %169 = load ptr, ptr %7, align 8, !tbaa !5
  %170 = load i32, ptr %13, align 4, !tbaa !9
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds %struct.Point, ptr %169, i64 %171
  %173 = getelementptr inbounds %struct.Point, ptr %172, i32 0, i32 1
  %174 = load i32, ptr %173, align 4, !tbaa !17
  %175 = sitofp i32 %174 to x86_fp80
  %176 = load x86_fp80, ptr %16, align 16, !tbaa !18
  %177 = load ptr, ptr %7, align 8, !tbaa !5
  %178 = load i32, ptr %13, align 4, !tbaa !9
  %179 = sext i32 %178 to i64
  %180 = getelementptr inbounds %struct.Point, ptr %177, i64 %179
  %181 = getelementptr inbounds %struct.Point, ptr %180, i32 0, i32 0
  %182 = load i32, ptr %181, align 4, !tbaa !13
  %183 = sitofp i32 %182 to x86_fp80
  %184 = fneg x86_fp80 %176
  %185 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %184, x86_fp80 %183, x86_fp80 %175)
  store x86_fp80 %185, ptr %17, align 16, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 48, ptr %18) #8
  %186 = getelementptr inbounds %struct.Event, ptr %18, i32 0, i32 0
  %187 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %187, ptr %186, align 16, !tbaa !20
  %188 = getelementptr inbounds %struct.Event, ptr %18, i32 0, i32 1
  %189 = load ptr, ptr %7, align 8, !tbaa !5
  %190 = load i32, ptr %13, align 4, !tbaa !9
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds %struct.Point, ptr %189, i64 %191
  %193 = getelementptr inbounds %struct.Point, ptr %192, i32 0, i32 0
  %194 = load i32, ptr %193, align 4, !tbaa !13
  store i32 %194, ptr %188, align 4, !tbaa !22
  %195 = getelementptr inbounds %struct.Event, ptr %18, i32 0, i32 2
  %196 = load x86_fp80, ptr %16, align 16, !tbaa !18
  store x86_fp80 %196, ptr %195, align 16, !tbaa !23
  %197 = getelementptr inbounds %struct.Event, ptr %18, i32 0, i32 3
  %198 = load x86_fp80, ptr %17, align 16, !tbaa !18
  store x86_fp80 %198, ptr %197, align 16, !tbaa !24
  %199 = load i32, ptr @tot, align 4, !tbaa !9
  %200 = add nsw i32 %199, 1
  store i32 %200, ptr @tot, align 4, !tbaa !9
  %201 = sext i32 %199 to i64
  %202 = getelementptr inbounds [400005 x %struct.Event], ptr @eve, i64 0, i64 %201
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %202, ptr align 16 %18, i64 48, i1 false), !tbaa.struct !25
  call void @llvm.lifetime.end.p0(i64 48, ptr %18) #8
  call void @llvm.lifetime.start.p0(i64 48, ptr %19) #8
  %203 = getelementptr inbounds %struct.Event, ptr %19, i32 0, i32 0
  %204 = load i32, ptr %10, align 4, !tbaa !9
  store i32 %204, ptr %203, align 16, !tbaa !20
  %205 = getelementptr inbounds %struct.Event, ptr %19, i32 0, i32 1
  %206 = load ptr, ptr %7, align 8, !tbaa !5
  %207 = load i32, ptr %15, align 4, !tbaa !9
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds %struct.Point, ptr %206, i64 %208
  %210 = getelementptr inbounds %struct.Point, ptr %209, i32 0, i32 0
  %211 = load i32, ptr %210, align 4, !tbaa !13
  store i32 %211, ptr %205, align 4, !tbaa !22
  %212 = getelementptr inbounds %struct.Event, ptr %19, i32 0, i32 2
  %213 = load x86_fp80, ptr %16, align 16, !tbaa !18
  %214 = fneg x86_fp80 %213
  store x86_fp80 %214, ptr %212, align 16, !tbaa !23
  %215 = getelementptr inbounds %struct.Event, ptr %19, i32 0, i32 3
  %216 = load x86_fp80, ptr %17, align 16, !tbaa !18
  %217 = fneg x86_fp80 %216
  store x86_fp80 %217, ptr %215, align 16, !tbaa !24
  %218 = load i32, ptr @tot, align 4, !tbaa !9
  %219 = add nsw i32 %218, 1
  store i32 %219, ptr @tot, align 4, !tbaa !9
  %220 = sext i32 %218 to i64
  %221 = getelementptr inbounds [400005 x %struct.Event], ptr @eve, i64 0, i64 %220
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %221, ptr align 16 %19, i64 48, i1 false), !tbaa.struct !25
  call void @llvm.lifetime.end.p0(i64 48, ptr %19) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 16, ptr %16) #8
  store i32 0, ptr %14, align 4
  br label %222

222:                                              ; preds = %139, %138
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  %223 = load i32, ptr %14, align 4
  switch i32 %223, label %229 [
    i32 0, label %224
    i32 7, label %225
  ]

224:                                              ; preds = %222
  br label %225

225:                                              ; preds = %224, %222
  %226 = load i32, ptr %13, align 4, !tbaa !9
  %227 = add nsw i32 %226, 1
  store i32 %227, ptr %13, align 4, !tbaa !9
  br label %107, !llvm.loop !26

228:                                              ; preds = %112
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  ret void

229:                                              ; preds = %222
  unreachable
}

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare x86_fp80 @llvm.fmuladd.f80(x86_fp80, x86_fp80, x86_fp80) #6

; 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) #7

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 #5 = { 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 #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = !{!14, !10, i64 0}
!14 = !{!"_ZTS5Point", !10, i64 0, !10, i64 4}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!14, !10, i64 4}
!18 = !{!19, !19, i64 0}
!19 = !{!"long double", !7, i64 0}
!20 = !{!21, !10, i64 0}
!21 = !{!"_ZTS5Event", !10, i64 0, !10, i64 4, !19, i64 16, !19, i64 32}
!22 = !{!21, !10, i64 4}
!23 = !{!21, !19, i64 16}
!24 = !{!21, !19, i64 32}
!25 = !{i64 0, i64 4, !9, i64 4, i64 4, !9, i64 16, i64 16, !18, i64 32, i64 16, !18}
!26 = distinct !{!26, !16}


; 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.Event = type { i32, i32, x86_fp80, x86_fp80 }
%struct.Point = type { i32, i32 }

@tot = external dso_local local_unnamed_addr global i32, align 4
@eve = external dso_local local_unnamed_addr global [400005 x %struct.Event], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z11readPolygonRiP5PointS_S_i(ptr noundef nonnull align 4 dereferenceable(4) %0, ptr noundef %1, ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %3, i32 noundef %4) local_unnamed_addr #0 {
  %6 = getelementptr inbounds i8, ptr %1, i64 4
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %0, ptr noundef %1, ptr noundef nonnull %6)
  %8 = load i32, ptr %1, align 4, !tbaa !5
  store i32 %8, ptr %3, align 4, !tbaa !10
  store i32 %8, ptr %2, align 4, !tbaa !10
  %9 = load i32, ptr %0, align 4, !tbaa !10
  %10 = icmp sgt i32 %9, 1
  br i1 %10, label %.lr.ph, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %5
  %.pre99 = sext i32 %9 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi100 = phi i64 [ %.pre99, %.._crit_edge_crit_edge ], [ %27, %.lr.ph ]
  %.0.lcssa = phi i64 [ 0, %.._crit_edge_crit_edge ], [ %25, %.lr.ph ]
  %11 = getelementptr %struct.Point, ptr %1, i64 %.pre-phi100
  %12 = getelementptr i8, ptr %11, i64 -8
  %13 = tail call noundef i64 @_ZNK5Point3detERKS_(ptr noundef nonnull align 4 dereferenceable(8) %12, ptr noundef nonnull align 4 dereferenceable(8) %1)
  %14 = add nsw i64 %13, %.0.lcssa
  %15 = icmp slt i64 %14, 0
  br i1 %15, label %29, label %33

.lr.ph:                                           ; preds = %5, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %5 ]
  %.084 = phi i64 [ %25, %.lr.ph ], [ 0, %5 ]
  %16 = getelementptr inbounds %struct.Point, ptr %1, i64 %indvars.iv
  %17 = getelementptr inbounds i8, ptr %16, i64 4
  %18 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %16, ptr noundef nonnull %17)
  %19 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) %16)
  %20 = load i32, ptr %19, align 4, !tbaa !10
  store i32 %20, ptr %2, align 4, !tbaa !10
  %21 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) %16)
  %22 = load i32, ptr %21, align 4, !tbaa !10
  store i32 %22, ptr %3, align 4, !tbaa !10
  %23 = getelementptr i8, ptr %16, i64 -8
  %24 = tail call noundef i64 @_ZNK5Point3detERKS_(ptr noundef nonnull align 4 dereferenceable(8) %23, ptr noundef nonnull align 4 dereferenceable(8) %16)
  %25 = add nsw i64 %24, %.084
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %26 = load i32, ptr %0, align 4, !tbaa !10
  %27 = sext i32 %26 to i64
  %28 = icmp slt i64 %indvars.iv.next, %27
  br i1 %28, label %.lr.ph, label %._crit_edge, !llvm.loop !11

29:                                               ; preds = %._crit_edge
  %30 = load i32, ptr %0, align 4, !tbaa !10
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds %struct.Point, ptr %1, i64 %31
  tail call void @_ZSt7reverseIP5PointEvT_S2_(ptr noundef nonnull %1, ptr noundef nonnull %32)
  br label %33

33:                                               ; preds = %29, %._crit_edge
  %34 = load i32, ptr %0, align 4, !tbaa !10
  %35 = icmp sgt i32 %34, 0
  br i1 %35, label %.lr.ph88.preheader, label %._crit_edge89

.lr.ph88.preheader:                               ; preds = %33
  %36 = load i32, ptr %1, align 4, !tbaa !5
  %37 = zext nneg i32 %34 to i64
  %38 = getelementptr %struct.Point, ptr %1, i64 %37
  %39 = getelementptr i8, ptr %38, i64 -8
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = icmp eq i32 %36, %40
  br i1 %41, label %64, label %42

42:                                               ; preds = %.lr.ph88.preheader
  %43 = load i32, ptr %6, align 4, !tbaa !13
  %44 = getelementptr i8, ptr %38, i64 -4
  %45 = load i32, ptr %44, align 4, !tbaa !13
  %46 = sub nsw i32 %43, %45
  %47 = sitofp i32 %46 to x86_fp80
  %48 = sub nsw i32 %36, %40
  %49 = sitofp i32 %48 to x86_fp80
  %50 = fdiv x86_fp80 %47, %49
  %51 = sitofp i32 %43 to x86_fp80
  %52 = sitofp i32 %36 to x86_fp80
  %53 = fneg x86_fp80 %50
  %54 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %53, x86_fp80 %52, x86_fp80 %51)
  %55 = load i32, ptr @tot, align 4, !tbaa !10
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr @tot, align 4, !tbaa !10
  %57 = sext i32 %55 to i64
  %58 = getelementptr inbounds [400005 x %struct.Event], ptr @eve, i64 0, i64 %57
  store i32 %4, ptr %58, align 16, !tbaa !10
  %.sroa.44.0..sroa_idx.peel = getelementptr inbounds i8, ptr %58, i64 4
  store i32 %36, ptr %.sroa.44.0..sroa_idx.peel, align 4, !tbaa !10
  %.sroa.56.0..sroa_idx.peel = getelementptr inbounds i8, ptr %58, i64 16
  store x86_fp80 %50, ptr %.sroa.56.0..sroa_idx.peel, align 16
  %.sroa.68.0..sroa_idx.peel = getelementptr inbounds i8, ptr %58, i64 32
  store x86_fp80 %54, ptr %.sroa.68.0..sroa_idx.peel, align 16
  %59 = load i32, ptr %39, align 4, !tbaa !5
  %60 = fneg x86_fp80 %54
  %61 = add nsw i32 %55, 2
  store i32 %61, ptr @tot, align 4, !tbaa !10
  %62 = sext i32 %56 to i64
  %63 = getelementptr inbounds [400005 x %struct.Event], ptr @eve, i64 0, i64 %62
  store i32 %4, ptr %63, align 16, !tbaa !10
  %.sroa.4.0..sroa_idx.peel = getelementptr inbounds i8, ptr %63, i64 4
  store i32 %59, ptr %.sroa.4.0..sroa_idx.peel, align 4, !tbaa !10
  %.sroa.51.0..sroa_idx.peel = getelementptr inbounds i8, ptr %63, i64 16
  store x86_fp80 %53, ptr %.sroa.51.0..sroa_idx.peel, align 16
  %.sroa.62.0..sroa_idx.peel = getelementptr inbounds i8, ptr %63, i64 32
  store x86_fp80 %60, ptr %.sroa.62.0..sroa_idx.peel, align 16
  %.pre = load i32, ptr %0, align 4, !tbaa !10
  %.pre98 = sext i32 %.pre to i64
  br label %64

64:                                               ; preds = %42, %.lr.ph88.preheader
  %.pre-phi = phi i64 [ %.pre98, %42 ], [ %37, %.lr.ph88.preheader ]
  %65 = phi i32 [ %.pre, %42 ], [ %34, %.lr.ph88.preheader ]
  %66 = icmp sgt i64 %.pre-phi, 1
  br i1 %66, label %.lr.ph88, label %._crit_edge89

._crit_edge89:                                    ; preds = %98, %64, %33
  ret void

.lr.ph88:                                         ; preds = %64, %98
  %67 = phi i32 [ %99, %98 ], [ %65, %64 ]
  %indvars.iv93 = phi i64 [ %indvars.iv.next94, %98 ], [ 1, %64 ]
  %68 = getelementptr inbounds %struct.Point, ptr %1, i64 %indvars.iv93
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %sext = shl i64 %indvars.iv93, 32
  %70 = ashr exact i64 %sext, 29
  %71 = getelementptr i8, ptr %1, i64 %70
  %72 = getelementptr i8, ptr %71, i64 -8
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = icmp eq i32 %69, %73
  br i1 %74, label %98, label %75

75:                                               ; preds = %.lr.ph88
  %76 = getelementptr inbounds i8, ptr %68, i64 4
  %77 = load i32, ptr %76, align 4, !tbaa !13
  %78 = getelementptr i8, ptr %71, i64 -4
  %79 = load i32, ptr %78, align 4, !tbaa !13
  %80 = sub nsw i32 %77, %79
  %81 = sitofp i32 %80 to x86_fp80
  %82 = sub nsw i32 %69, %73
  %83 = sitofp i32 %82 to x86_fp80
  %84 = fdiv x86_fp80 %81, %83
  %85 = sitofp i32 %77 to x86_fp80
  %86 = sitofp i32 %69 to x86_fp80
  %87 = fneg x86_fp80 %84
  %88 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %87, x86_fp80 %86, x86_fp80 %85)
  %89 = load i32, ptr @tot, align 4, !tbaa !10
  %90 = add nsw i32 %89, 1
  store i32 %90, ptr @tot, align 4, !tbaa !10
  %91 = sext i32 %89 to i64
  %92 = getelementptr inbounds [400005 x %struct.Event], ptr @eve, i64 0, i64 %91
  store i32 %4, ptr %92, align 16, !tbaa !10
  %.sroa.44.0..sroa_idx = getelementptr inbounds i8, ptr %92, i64 4
  store i32 %69, ptr %.sroa.44.0..sroa_idx, align 4, !tbaa !10
  %.sroa.56.0..sroa_idx = getelementptr inbounds i8, ptr %92, i64 16
  store x86_fp80 %84, ptr %.sroa.56.0..sroa_idx, align 16
  %.sroa.68.0..sroa_idx = getelementptr inbounds i8, ptr %92, i64 32
  store x86_fp80 %88, ptr %.sroa.68.0..sroa_idx, align 16
  %93 = load i32, ptr %72, align 4, !tbaa !5
  %94 = fneg x86_fp80 %88
  %95 = add nsw i32 %89, 2
  store i32 %95, ptr @tot, align 4, !tbaa !10
  %96 = sext i32 %90 to i64
  %97 = getelementptr inbounds [400005 x %struct.Event], ptr @eve, i64 0, i64 %96
  store i32 %4, ptr %97, align 16, !tbaa !10
  %.sroa.4.0..sroa_idx = getelementptr inbounds i8, ptr %97, i64 4
  store i32 %93, ptr %.sroa.4.0..sroa_idx, align 4, !tbaa !10
  %.sroa.51.0..sroa_idx = getelementptr inbounds i8, ptr %97, i64 16
  store x86_fp80 %87, ptr %.sroa.51.0..sroa_idx, align 16
  %.sroa.62.0..sroa_idx = getelementptr inbounds i8, ptr %97, i64 32
  store x86_fp80 %94, ptr %.sroa.62.0..sroa_idx, align 16
  %.pre97 = load i32, ptr %0, align 4, !tbaa !10
  br label %98

98:                                               ; preds = %.lr.ph88, %75
  %99 = phi i32 [ %67, %.lr.ph88 ], [ %.pre97, %75 ]
  %indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
  %100 = sext i32 %99 to i64
  %101 = icmp slt i64 %indvars.iv.next94, %100
  br i1 %101, label %.lr.ph88, label %._crit_edge89, !llvm.loop !14
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2

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

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare x86_fp80 @llvm.fmuladd.f80(x86_fp80, x86_fp80, x86_fp80) #5

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 = { inlinehint 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 #3 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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, !7, i64 0}
!6 = !{!"_ZTS5Point", !7, i64 0, !7, i64 4}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!7, !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!6, !7, i64 4}
!14 = distinct !{!14, !12, !15}
!15 = !{!"llvm.loop.peeled.count", i32 1}


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