; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/251 Division 2/Problem C (C)

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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@n = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@p = external dso_local global i32, align 4
@a = external dso_local global [100100 x i32], align 16
@taken = external dso_local global [100100 x i32], align 16
@odd = external dso_local global i32, align 4
@even = external dso_local global i32, align 4
@cnt1 = external dso_local global i32, align 4
@cnt2 = external dso_local global i32, align 4
@o = external dso_local global [100100 x %"class.std::vector"], align 16
@e = external dso_local global [100100 x %"class.std::vector"], align 16
@.str.6 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6outputv() #0

declare i32 @puts(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: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i8, align 1
  %7 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %8 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.6, ptr noundef @n, ptr noundef @k, ptr noundef @p)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %9

9:                                                ; preds = %29, %0
  %10 = load i32, ptr %2, align 4, !tbaa !5
  %11 = load i32, ptr @n, align 4, !tbaa !5
  %12 = icmp slt i32 %10, %11
  br i1 %12, label %14, label %13

13:                                               ; preds = %9
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %32

14:                                               ; preds = %9
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  %17 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %16
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.7, ptr noundef %17)
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %20
  %22 = load i32, ptr %21, align 4, !tbaa !5
  %23 = srem i32 %22, 2
  %24 = icmp ne i32 %23, 0
  br i1 %24, label %25, label %28

25:                                               ; preds = %14
  %26 = load i32, ptr @odd, align 4, !tbaa !5
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr @odd, align 4, !tbaa !5
  br label %28

28:                                               ; preds = %25, %14
  br label %29

29:                                               ; preds = %28
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr %2, align 4, !tbaa !5
  br label %9, !llvm.loop !9

32:                                               ; preds = %13
  %33 = load i32, ptr @odd, align 4, !tbaa !5
  %34 = load i32, ptr @k, align 4, !tbaa !5
  %35 = load i32, ptr @p, align 4, !tbaa !5
  %36 = sub nsw i32 %34, %35
  %37 = icmp slt i32 %33, %36
  br i1 %37, label %38, label %40

38:                                               ; preds = %32
  %39 = call i32 @puts(ptr noundef @.str.8)
  store i32 0, ptr %1, align 4
  br label %234

40:                                               ; preds = %32
  %41 = load i32, ptr @n, align 4, !tbaa !5
  %42 = load i32, ptr @odd, align 4, !tbaa !5
  %43 = sub nsw i32 %41, %42
  store i32 %43, ptr @even, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  %44 = load i32, ptr @odd, align 4, !tbaa !5
  %45 = load i32, ptr @k, align 4, !tbaa !5
  %46 = load i32, ptr @p, align 4, !tbaa !5
  %47 = sub nsw i32 %45, %46
  %48 = sub nsw i32 %44, %47
  store i32 %48, ptr %3, align 4, !tbaa !5
  %49 = load i32, ptr %3, align 4, !tbaa !5
  %50 = srem i32 %49, 2
  %51 = icmp eq i32 %50, 1
  br i1 %51, label %52, label %54

52:                                               ; preds = %40
  %53 = call i32 @puts(ptr noundef @.str.8)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  br label %233

54:                                               ; preds = %40
  %55 = load i32, ptr %3, align 4, !tbaa !5
  %56 = sdiv i32 %55, 2
  %57 = load i32, ptr @even, align 4, !tbaa !5
  %58 = add nsw i32 %56, %57
  %59 = load i32, ptr @p, align 4, !tbaa !5
  %60 = icmp slt i32 %58, %59
  br i1 %60, label %61, label %63

61:                                               ; preds = %54
  %62 = call i32 @puts(ptr noundef @.str.8)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  br label %233

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

64:                                               ; preds = %117, %63
  %65 = load i32, ptr %5, align 4, !tbaa !5
  %66 = load i32, ptr @n, align 4, !tbaa !5
  %67 = icmp slt i32 %65, %66
  br i1 %67, label %69, label %68

68:                                               ; preds = %64
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %120

69:                                               ; preds = %64
  %70 = load i32, ptr %5, align 4, !tbaa !5
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = srem i32 %73, 2
  %75 = icmp eq i32 %74, 1
  br i1 %75, label %76, label %93

76:                                               ; preds = %69
  %77 = load i32, ptr @cnt1, align 4, !tbaa !5
  %78 = load i32, ptr @k, align 4, !tbaa !5
  %79 = load i32, ptr @p, align 4, !tbaa !5
  %80 = sub nsw i32 %78, %79
  %81 = icmp slt i32 %77, %80
  br i1 %81, label %82, label %93

82:                                               ; preds = %76
  %83 = load i32, ptr @cnt1, align 4, !tbaa !5
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr @cnt1, align 4, !tbaa !5
  %85 = sext i32 %83 to i64
  %86 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @o, i64 0, i64 %85
  %87 = load i32, ptr %5, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %88
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %86, ptr noundef nonnull align 4 dereferenceable(4) %89)
  %90 = load i32, ptr %5, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [100100 x i32], ptr @taken, i64 0, i64 %91
  store i32 1, ptr %92, align 4, !tbaa !5
  br label %116

93:                                               ; preds = %76, %69
  %94 = load i32, ptr %5, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = srem i32 %97, 2
  %99 = icmp eq i32 %98, 0
  br i1 %99, label %100, label %115

100:                                              ; preds = %93
  %101 = load i32, ptr @cnt2, align 4, !tbaa !5
  %102 = load i32, ptr @p, align 4, !tbaa !5
  %103 = icmp slt i32 %101, %102
  br i1 %103, label %104, label %115

104:                                              ; preds = %100
  %105 = load i32, ptr @cnt2, align 4, !tbaa !5
  %106 = add nsw i32 %105, 1
  store i32 %106, ptr @cnt2, align 4, !tbaa !5
  %107 = sext i32 %105 to i64
  %108 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @e, i64 0, i64 %107
  %109 = load i32, ptr %5, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %110
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %108, ptr noundef nonnull align 4 dereferenceable(4) %111)
  %112 = load i32, ptr %5, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [100100 x i32], ptr @taken, i64 0, i64 %113
  store i32 1, ptr %114, align 4, !tbaa !5
  br label %115

115:                                              ; preds = %104, %100, %93
  br label %116

116:                                              ; preds = %115, %82
  br label %117

117:                                              ; preds = %116
  %118 = load i32, ptr %5, align 4, !tbaa !5
  %119 = add nsw i32 %118, 1
  store i32 %119, ptr %5, align 4, !tbaa !5
  br label %64, !llvm.loop !11

120:                                              ; preds = %68
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #4
  store i8 0, ptr %6, align 1, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %121

121:                                              ; preds = %216, %120
  %122 = load i32, ptr %7, align 4, !tbaa !5
  %123 = load i32, ptr @n, align 4, !tbaa !5
  %124 = icmp slt i32 %122, %123
  br i1 %124, label %126, label %125

125:                                              ; preds = %121
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %219

126:                                              ; preds = %121
  %127 = load i32, ptr %7, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = srem i32 %130, 2
  %132 = icmp eq i32 %131, 1
  br i1 %132, label %133, label %181

133:                                              ; preds = %126
  %134 = load i32, ptr %7, align 4, !tbaa !5
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [100100 x i32], ptr @taken, i64 0, i64 %135
  %137 = load i32, ptr %136, align 4, !tbaa !5
  %138 = icmp eq i32 %137, 0
  br i1 %138, label %139, label %181

139:                                              ; preds = %133
  %140 = load i32, ptr @cnt2, align 4, !tbaa !5
  %141 = load i32, ptr @p, align 4, !tbaa !5
  %142 = icmp slt i32 %140, %141
  br i1 %142, label %143, label %160

143:                                              ; preds = %139
  %144 = load i32, ptr @cnt2, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @e, i64 0, i64 %145
  %147 = load i32, ptr %7, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %148
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %146, ptr noundef nonnull align 4 dereferenceable(4) %149)
  %150 = load i8, ptr %6, align 1, !tbaa !12, !range !14, !noundef !15
  %151 = trunc i8 %150 to i1
  br i1 %151, label %152, label %155

152:                                              ; preds = %143
  %153 = load i32, ptr @cnt2, align 4, !tbaa !5
  %154 = add nsw i32 %153, 1
  store i32 %154, ptr @cnt2, align 4, !tbaa !5
  br label %155

155:                                              ; preds = %152, %143
  %156 = load i8, ptr %6, align 1, !tbaa !12, !range !14, !noundef !15
  %157 = trunc i8 %156 to i1
  %158 = xor i1 %157, true
  %159 = zext i1 %158 to i8
  store i8 %159, ptr %6, align 1, !tbaa !12
  br label %180

160:                                              ; preds = %139
  %161 = load i32, ptr @p, align 4, !tbaa !5
  %162 = icmp sgt i32 %161, 0
  br i1 %162, label %163, label %171

163:                                              ; preds = %160
  %164 = load i32, ptr @cnt2, align 4, !tbaa !5
  %165 = sub nsw i32 %164, 1
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @e, i64 0, i64 %166
  %168 = load i32, ptr %7, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %169
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %167, ptr noundef nonnull align 4 dereferenceable(4) %170)
  br label %179

171:                                              ; preds = %160
  %172 = load i32, ptr @cnt1, align 4, !tbaa !5
  %173 = sub nsw i32 %172, 1
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @o, i64 0, i64 %174
  %176 = load i32, ptr %7, align 4, !tbaa !5
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %177
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %175, ptr noundef nonnull align 4 dereferenceable(4) %178)
  br label %179

179:                                              ; preds = %171, %163
  br label %180

180:                                              ; preds = %179, %155
  br label %215

181:                                              ; preds = %133, %126
  %182 = load i32, ptr %7, align 4, !tbaa !5
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %183
  %185 = load i32, ptr %184, align 4, !tbaa !5
  %186 = srem i32 %185, 2
  %187 = icmp eq i32 %186, 0
  br i1 %187, label %188, label %214

188:                                              ; preds = %181
  %189 = load i32, ptr %7, align 4, !tbaa !5
  %190 = sext i32 %189 to i64
  %191 = getelementptr inbounds [100100 x i32], ptr @taken, i64 0, i64 %190
  %192 = load i32, ptr %191, align 4, !tbaa !5
  %193 = icmp eq i32 %192, 0
  br i1 %193, label %194, label %214

194:                                              ; preds = %188
  %195 = load i32, ptr @p, align 4, !tbaa !5
  %196 = icmp eq i32 %195, 0
  br i1 %196, label %197, label %205

197:                                              ; preds = %194
  %198 = load i32, ptr @cnt1, align 4, !tbaa !5
  %199 = sub nsw i32 %198, 1
  %200 = sext i32 %199 to i64
  %201 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @o, i64 0, i64 %200
  %202 = load i32, ptr %7, align 4, !tbaa !5
  %203 = sext i32 %202 to i64
  %204 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %203
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %201, ptr noundef nonnull align 4 dereferenceable(4) %204)
  br label %213

205:                                              ; preds = %194
  %206 = load i32, ptr @cnt2, align 4, !tbaa !5
  %207 = sub nsw i32 %206, 1
  %208 = sext i32 %207 to i64
  %209 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @e, i64 0, i64 %208
  %210 = load i32, ptr %7, align 4, !tbaa !5
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %211
  call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %209, ptr noundef nonnull align 4 dereferenceable(4) %212)
  br label %213

213:                                              ; preds = %205, %197
  br label %214

214:                                              ; preds = %213, %188, %181
  br label %215

215:                                              ; preds = %214, %180
  br label %216

216:                                              ; preds = %215
  %217 = load i32, ptr %7, align 4, !tbaa !5
  %218 = add nsw i32 %217, 1
  store i32 %218, ptr %7, align 4, !tbaa !5
  br label %121, !llvm.loop !16

219:                                              ; preds = %125
  %220 = load i32, ptr @cnt1, align 4, !tbaa !5
  %221 = load i32, ptr @k, align 4, !tbaa !5
  %222 = load i32, ptr @p, align 4, !tbaa !5
  %223 = sub nsw i32 %221, %222
  %224 = icmp ne i32 %220, %223
  br i1 %224, label %225, label %231

225:                                              ; preds = %219
  %226 = load i32, ptr @cnt2, align 4, !tbaa !5
  %227 = load i32, ptr @p, align 4, !tbaa !5
  %228 = icmp ne i32 %226, %227
  br i1 %228, label %229, label %231

229:                                              ; preds = %225
  %230 = call i32 @puts(ptr noundef @.str.8)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  br label %232

231:                                              ; preds = %225, %219
  call void @_Z6outputv()
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  br label %232

232:                                              ; preds = %231, %229
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #4
  br label %233

233:                                              ; preds = %232, %61, %52
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  br label %234

234:                                              ; preds = %233, %38
  %235 = load i32, ptr %1, align 4
  ret i32 %235
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) #0 align 2

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 = { "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 = { 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 #4 = { nounwind }

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

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


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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@n = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@p = external dso_local global i32, align 4
@a = external dso_local global [100100 x i32], align 16
@taken = external dso_local local_unnamed_addr global [100100 x i32], align 16
@odd = external dso_local local_unnamed_addr global i32, align 4
@even = external dso_local local_unnamed_addr global i32, align 4
@cnt1 = external dso_local local_unnamed_addr global i32, align 4
@cnt2 = external dso_local local_unnamed_addr global i32, align 4
@o = external dso_local global [100100 x %"class.std::vector"], align 16
@e = external dso_local global [100100 x %"class.std::vector"], align 16
@.str.6 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6outputv() local_unnamed_addr #0

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull @n, ptr noundef nonnull @k, ptr noundef nonnull @p)
  %2 = load i32, ptr @n, align 4, !tbaa !5
  %3 = icmp sgt i32 %2, 0
  br i1 %3, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %17, %0
  %4 = phi i32 [ %2, %0 ], [ %18, %17 ]
  %5 = load i32, ptr @odd, align 4, !tbaa !5
  %6 = load i32, ptr @k, align 4, !tbaa !5
  %7 = load i32, ptr @p, align 4, !tbaa !5
  %8 = sub nsw i32 %6, %7
  %9 = icmp slt i32 %5, %8
  br i1 %9, label %21, label %23

.lr.ph:                                           ; preds = %0, %17
  %indvars.iv = phi i64 [ %indvars.iv.next, %17 ], [ 0, %0 ]
  %10 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %indvars.iv
  %11 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.7, ptr noundef nonnull %10)
  %12 = load i32, ptr %10, align 4, !tbaa !5
  %13 = and i32 %12, 1
  %.not41 = icmp eq i32 %13, 0
  br i1 %.not41, label %17, label %14

14:                                               ; preds = %.lr.ph
  %15 = load i32, ptr @odd, align 4, !tbaa !5
  %16 = add nsw i32 %15, 1
  store i32 %16, ptr @odd, align 4, !tbaa !5
  br label %17

17:                                               ; preds = %.lr.ph, %14
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %18 = load i32, ptr @n, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = icmp slt i64 %indvars.iv.next, %19
  br i1 %20, label %.lr.ph, label %._crit_edge, !llvm.loop !9

21:                                               ; preds = %._crit_edge
  %22 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.8)
  br label %126

23:                                               ; preds = %._crit_edge
  %24 = sub nsw i32 %4, %5
  store i32 %24, ptr @even, align 4, !tbaa !5
  %.neg = sub i32 %7, %6
  %25 = add i32 %.neg, %5
  %26 = and i32 %25, -2147483647
  %27 = icmp eq i32 %26, 1
  br i1 %27, label %28, label %30

28:                                               ; preds = %23
  %29 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.8)
  br label %126

30:                                               ; preds = %23
  %31 = sdiv i32 %25, 2
  %32 = add nsw i32 %31, %24
  %33 = icmp slt i32 %32, %7
  br i1 %33, label %35, label %.preheader42

.preheader42:                                     ; preds = %30
  %34 = icmp sgt i32 %4, 0
  br i1 %34, label %.lr.ph45, label %._crit_edge49

35:                                               ; preds = %30
  %36 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.8)
  br label %126

.preheader:                                       ; preds = %59
  %37 = icmp sgt i32 %60, 0
  br i1 %37, label %.lr.ph48, label %._crit_edge49

.lr.ph45:                                         ; preds = %.preheader42, %59
  %indvars.iv52 = phi i64 [ %indvars.iv.next53, %59 ], [ 0, %.preheader42 ]
  %38 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %indvars.iv52
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = and i32 %39, -2147483647
  %41 = icmp eq i32 %40, 1
  br i1 %41, label %42, label %48

42:                                               ; preds = %.lr.ph45
  %43 = load i32, ptr @cnt1, align 4, !tbaa !5
  %44 = load i32, ptr @k, align 4, !tbaa !5
  %45 = load i32, ptr @p, align 4, !tbaa !5
  %46 = sub nsw i32 %44, %45
  %47 = icmp slt i32 %43, %46
  br i1 %47, label %.sink.split, label %48

48:                                               ; preds = %42, %.lr.ph45
  %49 = and i32 %39, 1
  %50 = icmp eq i32 %49, 0
  br i1 %50, label %51, label %59

51:                                               ; preds = %48
  %52 = load i32, ptr @cnt2, align 4, !tbaa !5
  %53 = load i32, ptr @p, align 4, !tbaa !5
  %54 = icmp slt i32 %52, %53
  br i1 %54, label %.sink.split, label %59

.sink.split:                                      ; preds = %51, %42
  %.sink60 = phi i32 [ %43, %42 ], [ %52, %51 ]
  %cnt1.sink = phi ptr [ @cnt1, %42 ], [ @cnt2, %51 ]
  %o.sink = phi ptr [ @o, %42 ], [ @e, %51 ]
  %55 = add nsw i32 %.sink60, 1
  store i32 %55, ptr %cnt1.sink, align 4, !tbaa !5
  %56 = sext i32 %.sink60 to i64
  %57 = getelementptr inbounds [100100 x %"class.std::vector"], ptr %o.sink, i64 0, i64 %56
  tail call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %57, ptr noundef nonnull align 4 dereferenceable(4) %38)
  %58 = getelementptr inbounds [100100 x i32], ptr @taken, i64 0, i64 %indvars.iv52
  store i32 1, ptr %58, align 4, !tbaa !5
  br label %59

59:                                               ; preds = %.sink.split, %51, %48
  %indvars.iv.next53 = add nuw nsw i64 %indvars.iv52, 1
  %60 = load i32, ptr @n, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = icmp slt i64 %indvars.iv.next53, %61
  br i1 %62, label %.lr.ph45, label %.preheader, !llvm.loop !11

._crit_edge49:                                    ; preds = %119, %.preheader42, %.preheader
  %63 = load i32, ptr @cnt1, align 4, !tbaa !5
  %64 = load i32, ptr @k, align 4, !tbaa !5
  %65 = load i32, ptr @p, align 4, !tbaa !5
  %66 = sub nsw i32 %64, %65
  %.not = icmp eq i32 %63, %66
  %67 = load i32, ptr @cnt2, align 4
  %.not40 = icmp eq i32 %67, %65
  %or.cond = select i1 %.not, i1 true, i1 %.not40
  br i1 %or.cond, label %125, label %123

.lr.ph48:                                         ; preds = %.preheader, %119
  %indvars.iv55 = phi i64 [ %indvars.iv.next56, %119 ], [ 0, %.preheader ]
  %.02846 = phi i1 [ %.1, %119 ], [ false, %.preheader ]
  %68 = getelementptr inbounds [100100 x i32], ptr @a, i64 0, i64 %indvars.iv55
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = and i32 %69, -2147483647
  %71 = icmp eq i32 %70, 1
  br i1 %71, label %72, label %99

72:                                               ; preds = %.lr.ph48
  %73 = getelementptr inbounds [100100 x i32], ptr @taken, i64 0, i64 %indvars.iv55
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = icmp eq i32 %74, 0
  br i1 %75, label %76, label %99

76:                                               ; preds = %72
  %77 = load i32, ptr @cnt2, align 4, !tbaa !5
  %78 = load i32, ptr @p, align 4, !tbaa !5
  %79 = icmp slt i32 %77, %78
  br i1 %79, label %80, label %88

80:                                               ; preds = %76
  %81 = sext i32 %77 to i64
  %82 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @e, i64 0, i64 %81
  tail call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %82, ptr noundef nonnull align 4 dereferenceable(4) %68)
  br i1 %.02846, label %83, label %86

83:                                               ; preds = %80
  %84 = load i32, ptr @cnt2, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr @cnt2, align 4, !tbaa !5
  br label %86

86:                                               ; preds = %83, %80
  %87 = xor i1 %.02846, true
  br label %119

88:                                               ; preds = %76
  %89 = icmp sgt i32 %78, 0
  br i1 %89, label %90, label %94

90:                                               ; preds = %88
  %91 = add nsw i32 %77, -1
  %92 = sext i32 %91 to i64
  %93 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @e, i64 0, i64 %92
  tail call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %93, ptr noundef nonnull align 4 dereferenceable(4) %68)
  br label %119

94:                                               ; preds = %88
  %95 = load i32, ptr @cnt1, align 4, !tbaa !5
  %96 = add nsw i32 %95, -1
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @o, i64 0, i64 %97
  tail call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %98, ptr noundef nonnull align 4 dereferenceable(4) %68)
  br label %119

99:                                               ; preds = %72, %.lr.ph48
  %100 = and i32 %69, 1
  %101 = icmp eq i32 %100, 0
  br i1 %101, label %102, label %119

102:                                              ; preds = %99
  %103 = getelementptr inbounds [100100 x i32], ptr @taken, i64 0, i64 %indvars.iv55
  %104 = load i32, ptr %103, align 4, !tbaa !5
  %105 = icmp eq i32 %104, 0
  br i1 %105, label %106, label %119

106:                                              ; preds = %102
  %107 = load i32, ptr @p, align 4, !tbaa !5
  %108 = icmp eq i32 %107, 0
  br i1 %108, label %109, label %114

109:                                              ; preds = %106
  %110 = load i32, ptr @cnt1, align 4, !tbaa !5
  %111 = add nsw i32 %110, -1
  %112 = sext i32 %111 to i64
  %113 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @o, i64 0, i64 %112
  tail call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %113, ptr noundef nonnull align 4 dereferenceable(4) %68)
  br label %119

114:                                              ; preds = %106
  %115 = load i32, ptr @cnt2, align 4, !tbaa !5
  %116 = add nsw i32 %115, -1
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [100100 x %"class.std::vector"], ptr @e, i64 0, i64 %117
  tail call void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %118, ptr noundef nonnull align 4 dereferenceable(4) %68)
  br label %119

119:                                              ; preds = %90, %94, %86, %109, %114, %102, %99
  %.1 = phi i1 [ %87, %86 ], [ %.02846, %90 ], [ %.02846, %94 ], [ %.02846, %109 ], [ %.02846, %114 ], [ %.02846, %102 ], [ %.02846, %99 ]
  %indvars.iv.next56 = add nuw nsw i64 %indvars.iv55, 1
  %120 = load i32, ptr @n, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = icmp slt i64 %indvars.iv.next56, %121
  br i1 %122, label %.lr.ph48, label %._crit_edge49, !llvm.loop !12

123:                                              ; preds = %._crit_edge49
  %124 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.8)
  br label %126

125:                                              ; preds = %._crit_edge49
  tail call void @_Z6outputv()
  br label %126

126:                                              ; preds = %28, %35, %125, %123, %21
  ret i32 0
}

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0 align 2

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 = { 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" }

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

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


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