; LLVM IR from kazunetakahashi/atcoder :: 2018/0908_ABC109 (D)

; 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::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@H = external dso_local global i32, align 4
@W = external dso_local global i32, align 4
@a = external dso_local global [510 x [510 x i8]], align 16
@odd = external dso_local global [510 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z9make_swapiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @H)
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull align 4 dereferenceable(4) @W)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %48, %0
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = load i32, ptr @H, align 4, !tbaa !5
  %24 = icmp slt i32 %22, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %21
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  br label %51

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

27:                                               ; preds = %44, %26
  %28 = load i32, ptr %4, align 4, !tbaa !5
  %29 = load i32, ptr @W, align 4, !tbaa !5
  %30 = icmp slt i32 %28, %29
  br i1 %30, label %32, label %31

31:                                               ; preds = %27
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  br label %47

32:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %33 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %34 = load i32, ptr %5, align 4, !tbaa !5
  %35 = srem i32 %34, 2
  %36 = icmp eq i32 %35, 1
  %37 = load i32, ptr %2, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [510 x [510 x i8]], ptr @a, i64 0, i64 %38
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [510 x i8], ptr %39, i64 0, i64 %41
  %43 = zext i1 %36 to i8
  store i8 %43, ptr %42, align 1, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %44

44:                                               ; preds = %32
  %45 = load i32, ptr %4, align 4, !tbaa !5
  %46 = add nsw i32 %45, 1
  store i32 %46, ptr %4, align 4, !tbaa !5
  br label %27, !llvm.loop !11

47:                                               ; preds = %31
  br label %48

48:                                               ; preds = %47
  %49 = load i32, ptr %2, align 4, !tbaa !5
  %50 = add nsw i32 %49, 1
  store i32 %50, ptr %2, align 4, !tbaa !5
  br label %21, !llvm.loop !13

51:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store i32 -1, ptr %6, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef @odd, ptr noundef getelementptr inbounds (i32, ptr @odd, i64 510), ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %130, %51
  %53 = load i32, ptr %7, align 4, !tbaa !5
  %54 = load i32, ptr @H, align 4, !tbaa !5
  %55 = icmp slt i32 %53, %54
  br i1 %55, label %57, label %56

56:                                               ; preds = %52
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  br label %133

57:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  store i32 -1, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 0, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %58

58:                                               ; preds = %100, %57
  %59 = load i32, ptr %10, align 4, !tbaa !5
  %60 = load i32, ptr @W, align 4, !tbaa !5
  %61 = icmp slt i32 %59, %60
  br i1 %61, label %63, label %62

62:                                               ; preds = %58
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %103

63:                                               ; preds = %58
  %64 = load i32, ptr %7, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [510 x [510 x i8]], ptr @a, i64 0, i64 %65
  %67 = load i32, ptr %10, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [510 x i8], ptr %66, i64 0, i64 %68
  %70 = load i8, ptr %69, align 1, !tbaa !9, !range !14, !noundef !15
  %71 = trunc i8 %70 to i1
  br i1 %71, label %72, label %99

72:                                               ; preds = %63
  %73 = load i32, ptr %9, align 4, !tbaa !5
  %74 = srem i32 %73, 2
  %75 = icmp eq i32 %74, 0
  br i1 %75, label %76, label %78

76:                                               ; preds = %72
  %77 = load i32, ptr %10, align 4, !tbaa !5
  store i32 %77, ptr %8, align 4, !tbaa !5
  br label %96

78:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %79 = load i32, ptr %10, align 4, !tbaa !5
  store i32 %79, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %80 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %80, ptr %12, align 4, !tbaa !5
  br label %81

81:                                               ; preds = %92, %78
  %82 = load i32, ptr %12, align 4, !tbaa !5
  %83 = load i32, ptr %11, align 4, !tbaa !5
  %84 = icmp slt i32 %82, %83
  br i1 %84, label %86, label %85

85:                                               ; preds = %81
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %95

86:                                               ; preds = %81
  %87 = load i32, ptr %7, align 4, !tbaa !5
  %88 = load i32, ptr %12, align 4, !tbaa !5
  %89 = load i32, ptr %7, align 4, !tbaa !5
  %90 = load i32, ptr %12, align 4, !tbaa !5
  %91 = add nsw i32 %90, 1
  call void @_Z9make_swapiiii(i32 noundef %87, i32 noundef %88, i32 noundef %89, i32 noundef %91)
  br label %92

92:                                               ; preds = %86
  %93 = load i32, ptr %12, align 4, !tbaa !5
  %94 = add nsw i32 %93, 1
  store i32 %94, ptr %12, align 4, !tbaa !5
  br label %81, !llvm.loop !16

95:                                               ; preds = %85
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  br label %96

96:                                               ; preds = %95, %76
  %97 = load i32, ptr %9, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  store i32 %98, ptr %9, align 4, !tbaa !5
  br label %99

99:                                               ; preds = %96, %63
  br label %100

100:                                              ; preds = %99
  %101 = load i32, ptr %10, align 4, !tbaa !5
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %10, align 4, !tbaa !5
  br label %58, !llvm.loop !17

103:                                              ; preds = %62
  %104 = load i32, ptr %9, align 4, !tbaa !5
  %105 = srem i32 %104, 2
  %106 = icmp eq i32 %105, 1
  br i1 %106, label %107, label %129

107:                                              ; preds = %103
  %108 = load i32, ptr %8, align 4, !tbaa !5
  %109 = load i32, ptr %7, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [510 x i32], ptr @odd, i64 0, i64 %110
  store i32 %108, ptr %111, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %112 = load i32, ptr %8, align 4, !tbaa !5
  store i32 %112, ptr %13, align 4, !tbaa !5
  br label %113

113:                                              ; preds = %125, %107
  %114 = load i32, ptr %13, align 4, !tbaa !5
  %115 = load i32, ptr @W, align 4, !tbaa !5
  %116 = sub nsw i32 %115, 1
  %117 = icmp slt i32 %114, %116
  br i1 %117, label %119, label %118

118:                                              ; preds = %113
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  br label %128

119:                                              ; preds = %113
  %120 = load i32, ptr %7, align 4, !tbaa !5
  %121 = load i32, ptr %13, align 4, !tbaa !5
  %122 = load i32, ptr %7, align 4, !tbaa !5
  %123 = load i32, ptr %13, align 4, !tbaa !5
  %124 = add nsw i32 %123, 1
  call void @_Z9make_swapiiii(i32 noundef %120, i32 noundef %121, i32 noundef %122, i32 noundef %124)
  br label %125

125:                                              ; preds = %119
  %126 = load i32, ptr %13, align 4, !tbaa !5
  %127 = add nsw i32 %126, 1
  store i32 %127, ptr %13, align 4, !tbaa !5
  br label %113, !llvm.loop !18

128:                                              ; preds = %118
  br label %129

129:                                              ; preds = %128, %103
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %130

130:                                              ; preds = %129
  %131 = load i32, ptr %7, align 4, !tbaa !5
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %7, align 4, !tbaa !5
  br label %52, !llvm.loop !19

133:                                              ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 -1, ptr %14, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  store i32 0, ptr %15, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %134

134:                                              ; preds = %175, %133
  %135 = load i32, ptr %16, align 4, !tbaa !5
  %136 = load i32, ptr @H, align 4, !tbaa !5
  %137 = icmp slt i32 %135, %136
  br i1 %137, label %139, label %138

138:                                              ; preds = %134
  store i32 20, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %178

139:                                              ; preds = %134
  %140 = load i32, ptr %16, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = getelementptr inbounds [510 x i32], ptr @odd, i64 0, i64 %141
  %143 = load i32, ptr %142, align 4, !tbaa !5
  %144 = icmp sge i32 %143, 0
  br i1 %144, label %145, label %174

145:                                              ; preds = %139
  %146 = load i32, ptr %15, align 4, !tbaa !5
  %147 = srem i32 %146, 2
  %148 = icmp eq i32 %147, 0
  br i1 %148, label %149, label %151

149:                                              ; preds = %145
  %150 = load i32, ptr %16, align 4, !tbaa !5
  store i32 %150, ptr %14, align 4, !tbaa !5
  br label %171

151:                                              ; preds = %145
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %152 = load i32, ptr %16, align 4, !tbaa !5
  store i32 %152, ptr %17, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  %153 = load i32, ptr %14, align 4, !tbaa !5
  store i32 %153, ptr %18, align 4, !tbaa !5
  br label %154

154:                                              ; preds = %167, %151
  %155 = load i32, ptr %18, align 4, !tbaa !5
  %156 = load i32, ptr %17, align 4, !tbaa !5
  %157 = icmp slt i32 %155, %156
  br i1 %157, label %159, label %158

158:                                              ; preds = %154
  store i32 23, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  br label %170

159:                                              ; preds = %154
  %160 = load i32, ptr %18, align 4, !tbaa !5
  %161 = load i32, ptr @W, align 4, !tbaa !5
  %162 = sub nsw i32 %161, 1
  %163 = load i32, ptr %18, align 4, !tbaa !5
  %164 = add nsw i32 %163, 1
  %165 = load i32, ptr @W, align 4, !tbaa !5
  %166 = sub nsw i32 %165, 1
  call void @_Z9make_swapiiii(i32 noundef %160, i32 noundef %162, i32 noundef %164, i32 noundef %166)
  br label %167

167:                                              ; preds = %159
  %168 = load i32, ptr %18, align 4, !tbaa !5
  %169 = add nsw i32 %168, 1
  store i32 %169, ptr %18, align 4, !tbaa !5
  br label %154, !llvm.loop !20

170:                                              ; preds = %158
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %171

171:                                              ; preds = %170, %149
  %172 = load i32, ptr %15, align 4, !tbaa !5
  %173 = add nsw i32 %172, 1
  store i32 %173, ptr %15, align 4, !tbaa !5
  br label %174

174:                                              ; preds = %171, %139
  br label %175

175:                                              ; preds = %174
  %176 = load i32, ptr %16, align 4, !tbaa !5
  %177 = add nsw i32 %176, 1
  store i32 %177, ptr %16, align 4, !tbaa !5
  br label %134, !llvm.loop !21

178:                                              ; preds = %138
  call void @_Z5flushv()
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  %179 = load i32, ptr %1, align 4
  ret i32 %179
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #3

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

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 = { 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 #3 = { "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 = { 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, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{i8 0, i8 2}
!15 = !{}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}


; 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::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }

@H = external dso_local global i32, align 4
@W = external dso_local global i32, align 4
@a = external dso_local local_unnamed_addr global [510 x [510 x i8]], align 16
@odd = external dso_local global [510 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z9make_swapiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @H)
  %4 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 4 dereferenceable(4) @W)
  %5 = load i32, ptr @H, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  %7 = load i32, ptr @W, align 4
  %8 = icmp sgt i32 %7, 0
  %or.cond = select i1 %6, i1 %8, i1 false
  br i1 %or.cond, label %.preheader68, label %._crit_edge71

.preheader68:                                     ; preds = %0, %._crit_edge
  %9 = phi i32 [ %14, %._crit_edge ], [ %5, %0 ]
  %10 = phi i32 [ %15, %._crit_edge ], [ %7, %0 ]
  %indvars.iv98 = phi i64 [ %indvars.iv.next99, %._crit_edge ], [ 0, %0 ]
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.lr.ph, label %._crit_edge

._crit_edge71:                                    ; preds = %._crit_edge, %0
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  store i32 -1, ptr %2, align 4, !tbaa !5
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef nonnull @odd, ptr noundef nonnull getelementptr inbounds (i8, ptr @odd, i64 2040), ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  %12 = load i32, ptr @H, align 4, !tbaa !5
  %13 = icmp sgt i32 %12, 0
  br i1 %13, label %.preheader67.preheader, label %._crit_edge95

.preheader67.preheader:                           ; preds = %._crit_edge71
  %.pre111 = load i32, ptr @W, align 4, !tbaa !5
  br label %.preheader67

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load i32, ptr @H, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader68
  %14 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %9, %.preheader68 ]
  %15 = phi i32 [ %24, %._crit_edge.loopexit ], [ %10, %.preheader68 ]
  %indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
  %16 = sext i32 %14 to i64
  %17 = icmp slt i64 %indvars.iv.next99, %16
  br i1 %17, label %.preheader68, label %._crit_edge71, !llvm.loop !9

.lr.ph:                                           ; preds = %.preheader68, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.preheader68 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %19 = load i32, ptr %1, align 4, !tbaa !5
  %20 = and i32 %19, -2147483647
  %21 = icmp eq i32 %20, 1
  %22 = getelementptr inbounds [510 x [510 x i8]], ptr @a, i64 0, i64 %indvars.iv98, i64 %indvars.iv
  %23 = zext i1 %21 to i8
  store i8 %23, ptr %22, align 1, !tbaa !12
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %24 = load i32, ptr @W, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = icmp slt i64 %indvars.iv.next, %25
  br i1 %26, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !14

.preheader67:                                     ; preds = %.preheader67.preheader, %.loopexit66
  %.pre112114 = phi i32 [ %.pre111, %.preheader67.preheader ], [ %.pre112115, %.loopexit66 ]
  %27 = phi i32 [ %.pre111, %.preheader67.preheader ], [ %64, %.loopexit66 ]
  %28 = phi i32 [ %.pre111, %.preheader67.preheader ], [ %65, %.loopexit66 ]
  %29 = phi i32 [ %.pre111, %.preheader67.preheader ], [ %66, %.loopexit66 ]
  %indvars.iv104 = phi i64 [ 0, %.preheader67.preheader ], [ %indvars.iv.next105, %.loopexit66 ]
  %30 = icmp sgt i32 %29, 0
  br i1 %30, label %.lr.ph79, label %.loopexit66

.lr.ph79:                                         ; preds = %.preheader67
  %31 = trunc nuw nsw i64 %indvars.iv104 to i32
  br label %35

.preheader63:                                     ; preds = %.loopexit66
  %32 = icmp sgt i32 %67, 0
  br i1 %32, label %.lr.ph94, label %._crit_edge95

._crit_edge80:                                    ; preds = %50
  %33 = and i32 %.157, -2147483647
  %34 = icmp eq i32 %33, 1
  br i1 %34, label %55, label %.loopexit66

35:                                               ; preds = %.lr.ph79, %50
  %.pre112117 = phi i32 [ %.pre112114, %.lr.ph79 ], [ %.pre112118, %50 ]
  %36 = phi i32 [ %27, %.lr.ph79 ], [ %51, %50 ]
  %37 = phi i32 [ %28, %.lr.ph79 ], [ %52, %50 ]
  %indvars.iv101 = phi i64 [ 0, %.lr.ph79 ], [ %indvars.iv.next102, %50 ]
  %.05675 = phi i32 [ 0, %.lr.ph79 ], [ %.157, %50 ]
  %.05874 = phi i32 [ -1, %.lr.ph79 ], [ %.260, %50 ]
  %38 = getelementptr inbounds [510 x [510 x i8]], ptr @a, i64 0, i64 %indvars.iv104, i64 %indvars.iv101
  %39 = load i8, ptr %38, align 1, !tbaa !12, !range !15, !noundef !16
  %40 = trunc nuw i8 %39 to i1
  br i1 %40, label %41, label %50

41:                                               ; preds = %35
  %42 = and i32 %.05675, 1
  %43 = icmp eq i32 %42, 0
  %44 = trunc nuw nsw i64 %indvars.iv101 to i32
  br i1 %43, label %.loopexit65, label %.preheader64

.preheader64:                                     ; preds = %41
  %45 = sext i32 %.05874 to i64
  %46 = icmp sgt i64 %indvars.iv101, %45
  br i1 %46, label %.lr.ph73, label %.loopexit65

.lr.ph73:                                         ; preds = %.preheader64, %.lr.ph73
  %.05472 = phi i32 [ %47, %.lr.ph73 ], [ %.05874, %.preheader64 ]
  %47 = add nsw i32 %.05472, 1
  call void @_Z9make_swapiiii(i32 noundef %31, i32 noundef %.05472, i32 noundef %31, i32 noundef %47)
  %48 = zext i32 %47 to i64
  %exitcond.not = icmp eq i64 %indvars.iv101, %48
  br i1 %exitcond.not, label %.loopexit65.loopexit, label %.lr.ph73, !llvm.loop !17

.loopexit65.loopexit:                             ; preds = %.lr.ph73
  %.pre112.pre = load i32, ptr @W, align 4, !tbaa !5
  br label %.loopexit65

.loopexit65:                                      ; preds = %.loopexit65.loopexit, %.preheader64, %41
  %.pre112 = phi i32 [ %.pre112117, %41 ], [ %.pre112117, %.preheader64 ], [ %.pre112.pre, %.loopexit65.loopexit ]
  %.159 = phi i32 [ %44, %41 ], [ %.05874, %.preheader64 ], [ %.05874, %.loopexit65.loopexit ]
  %49 = add nsw i32 %.05675, 1
  br label %50

50:                                               ; preds = %35, %.loopexit65
  %.pre112118 = phi i32 [ %.pre112, %.loopexit65 ], [ %.pre112117, %35 ]
  %51 = phi i32 [ %.pre112, %.loopexit65 ], [ %36, %35 ]
  %52 = phi i32 [ %.pre112, %.loopexit65 ], [ %37, %35 ]
  %.260 = phi i32 [ %.159, %.loopexit65 ], [ %.05874, %35 ]
  %.157 = phi i32 [ %49, %.loopexit65 ], [ %.05675, %35 ]
  %indvars.iv.next102 = add nuw nsw i64 %indvars.iv101, 1
  %53 = sext i32 %52 to i64
  %54 = icmp slt i64 %indvars.iv.next102, %53
  br i1 %54, label %35, label %._crit_edge80, !llvm.loop !18

55:                                               ; preds = %._crit_edge80
  %56 = getelementptr inbounds [510 x i32], ptr @odd, i64 0, i64 %indvars.iv104
  store i32 %.260, ptr %56, align 4, !tbaa !5
  %57 = add nsw i32 %51, -1
  %58 = icmp slt i32 %.260, %57
  br i1 %58, label %.lr.ph84.preheader, label %.loopexit66

.lr.ph84.preheader:                               ; preds = %55
  %59 = trunc nuw nsw i64 %indvars.iv104 to i32
  br label %.lr.ph84

.lr.ph84:                                         ; preds = %.lr.ph84.preheader, %.lr.ph84
  %.05382 = phi i32 [ %60, %.lr.ph84 ], [ %.260, %.lr.ph84.preheader ]
  %60 = add nsw i32 %.05382, 1
  call void @_Z9make_swapiiii(i32 noundef %59, i32 noundef %.05382, i32 noundef %59, i32 noundef %60)
  %61 = load i32, ptr @W, align 4, !tbaa !5
  %62 = add nsw i32 %61, -1
  %63 = icmp slt i32 %60, %62
  br i1 %63, label %.lr.ph84, label %.loopexit66, !llvm.loop !19

.loopexit66:                                      ; preds = %.lr.ph84, %.preheader67, %55, %._crit_edge80
  %.pre112115 = phi i32 [ %.pre112118, %55 ], [ %.pre112118, %._crit_edge80 ], [ %.pre112114, %.preheader67 ], [ %61, %.lr.ph84 ]
  %64 = phi i32 [ %51, %55 ], [ %51, %._crit_edge80 ], [ %27, %.preheader67 ], [ %61, %.lr.ph84 ]
  %65 = phi i32 [ %51, %55 ], [ %52, %._crit_edge80 ], [ %28, %.preheader67 ], [ %61, %.lr.ph84 ]
  %66 = phi i32 [ %51, %55 ], [ %52, %._crit_edge80 ], [ %29, %.preheader67 ], [ %61, %.lr.ph84 ]
  %indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
  %67 = load i32, ptr @H, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = icmp slt i64 %indvars.iv.next105, %68
  br i1 %69, label %.preheader67, label %.preheader63, !llvm.loop !20

._crit_edge95:                                    ; preds = %85, %._crit_edge71, %.preheader63
  call void @_Z5flushv()
  ret i32 0

.lr.ph94:                                         ; preds = %.preheader63, %85
  %.pre113120 = phi i32 [ %.pre113121, %85 ], [ %67, %.preheader63 ]
  %70 = phi i32 [ %86, %85 ], [ %67, %.preheader63 ]
  %indvars.iv108 = phi i64 [ %indvars.iv.next109, %85 ], [ 0, %.preheader63 ]
  %.05090 = phi i32 [ %.1, %85 ], [ 0, %.preheader63 ]
  %.05189 = phi i32 [ %.2, %85 ], [ -1, %.preheader63 ]
  %71 = getelementptr inbounds [510 x i32], ptr @odd, i64 0, i64 %indvars.iv108
  %72 = load i32, ptr %71, align 4, !tbaa !5
  %73 = icmp sgt i32 %72, -1
  br i1 %73, label %74, label %85

74:                                               ; preds = %.lr.ph94
  %75 = and i32 %.05090, 1
  %76 = icmp eq i32 %75, 0
  %77 = trunc nuw nsw i64 %indvars.iv108 to i32
  br i1 %76, label %.loopexit, label %.preheader

.preheader:                                       ; preds = %74
  %78 = sext i32 %.05189 to i64
  %79 = icmp sgt i64 %indvars.iv108, %78
  br i1 %79, label %.lr.ph88, label %.loopexit

.lr.ph88:                                         ; preds = %.preheader, %.lr.ph88
  %.087 = phi i32 [ %82, %.lr.ph88 ], [ %.05189, %.preheader ]
  %80 = load i32, ptr @W, align 4, !tbaa !5
  %81 = add nsw i32 %80, -1
  %82 = add nsw i32 %.087, 1
  call void @_Z9make_swapiiii(i32 noundef %.087, i32 noundef %81, i32 noundef %82, i32 noundef %81)
  %83 = zext i32 %82 to i64
  %exitcond107.not = icmp eq i64 %indvars.iv108, %83
  br i1 %exitcond107.not, label %.loopexit.loopexit, label %.lr.ph88, !llvm.loop !21

.loopexit.loopexit:                               ; preds = %.lr.ph88
  %.pre113.pre = load i32, ptr @H, align 4, !tbaa !5
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %.preheader, %74
  %.pre113 = phi i32 [ %.pre113120, %74 ], [ %.pre113120, %.preheader ], [ %.pre113.pre, %.loopexit.loopexit ]
  %.152 = phi i32 [ %77, %74 ], [ %.05189, %.preheader ], [ %.05189, %.loopexit.loopexit ]
  %84 = add nsw i32 %.05090, 1
  br label %85

85:                                               ; preds = %.lr.ph94, %.loopexit
  %.pre113121 = phi i32 [ %.pre113, %.loopexit ], [ %.pre113120, %.lr.ph94 ]
  %86 = phi i32 [ %.pre113, %.loopexit ], [ %70, %.lr.ph94 ]
  %.2 = phi i32 [ %.152, %.loopexit ], [ %.05189, %.lr.ph94 ]
  %.1 = phi i32 [ %84, %.loopexit ], [ %.05090, %.lr.ph94 ]
  %indvars.iv.next109 = add nuw nsw i64 %indvars.iv108, 1
  %87 = sext i32 %86 to i64
  %88 = icmp slt i64 %indvars.iv.next109, %87
  br i1 %88, label %.lr.ph94, label %._crit_edge95, !llvm.loop !22
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

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

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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" }
attributes #3 = { "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 = { 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, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.unswitch.partial.disable"}
!12 = !{!13, !13, i64 0}
!13 = !{!"bool", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}
!20 = distinct !{!20, !10}
!21 = distinct !{!21, !10}
!22 = distinct !{!22, !10}


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