; LLVM IR from tangjz/acm-icpc :: TDL_training/2015-11-01 (E - charge-station - lzy)

; 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"

@n = external dso_local global i32, align 4
@d = external dso_local global i32, align 4
@s = external dso_local global [139 x [139 x i32]], align 16
@x = external dso_local global [139 x i32], align 16
@y = external dso_local global [139 x i32], align 16
@g = external dso_local global [139 x i8], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3sqri(i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z3chkv() #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 i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i8, align 1
  %9 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  br label %10

10:                                               ; preds = %164, %115, %0
  %11 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @d)
  %12 = icmp eq i32 %11, 2
  br i1 %12, label %13, label %166

13:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %14

14:                                               ; preds = %27, %13
  %15 = load i32, ptr %2, align 4, !tbaa !5
  %16 = load i32, ptr @n, align 4, !tbaa !5
  %17 = icmp sle i32 %15, %16
  br i1 %17, label %19, label %18

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

19:                                               ; preds = %14
  %20 = load i32, ptr %2, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds i32, ptr @x, i64 %21
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds i32, ptr @y, i64 %24
  %26 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %22, ptr noundef %25)
  br label %27

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

30:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %31

31:                                               ; preds = %78, %30
  %32 = load i32, ptr %3, align 4, !tbaa !5
  %33 = load i32, ptr @n, align 4, !tbaa !5
  %34 = icmp sle i32 %32, %33
  br i1 %34, label %36, label %35

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

36:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #8
  store i32 1, ptr %5, align 4, !tbaa !5
  br label %37

37:                                               ; preds = %74, %36
  %38 = load i32, ptr %5, align 4, !tbaa !5
  %39 = load i32, ptr @n, align 4, !tbaa !5
  %40 = icmp sle i32 %38, %39
  br i1 %40, label %42, label %41

41:                                               ; preds = %37
  store i32 10, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #8
  br label %77

42:                                               ; preds = %37
  %43 = load i32, ptr %3, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [139 x i32], ptr @x, i64 0, i64 %44
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = load i32, ptr %5, align 4, !tbaa !5
  %48 = sext i32 %47 to i64
  %49 = getelementptr inbounds [139 x i32], ptr @x, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = sub nsw i32 %46, %50
  %52 = call noundef i32 @_Z3sqri(i32 noundef %51)
  %53 = load i32, ptr %3, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [139 x i32], ptr @y, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = load i32, ptr %5, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [139 x i32], ptr @y, i64 0, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = sub nsw i32 %56, %60
  %62 = call noundef i32 @_Z3sqri(i32 noundef %61)
  %63 = add nsw i32 %52, %62
  %64 = sitofp i32 %63 to double
  %65 = call double @sqrt(double noundef %64) #8
  %66 = call double @llvm.ceil.f64(double %65)
  %67 = fptosi double %66 to i32
  %68 = load i32, ptr %3, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [139 x [139 x i32]], ptr @s, i64 0, i64 %69
  %71 = load i32, ptr %5, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [139 x i32], ptr %70, i64 0, i64 %72
  store i32 %67, ptr %73, align 4, !tbaa !5
  br label %74

74:                                               ; preds = %42
  %75 = load i32, ptr %5, align 4, !tbaa !5
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %5, align 4, !tbaa !5
  br label %37, !llvm.loop !11

77:                                               ; preds = %41
  br label %78

78:                                               ; preds = %77
  %79 = load i32, ptr %3, align 4, !tbaa !5
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %3, align 4, !tbaa !5
  br label %31, !llvm.loop !12

81:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #8
  %82 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %82, ptr %6, align 4, !tbaa !5
  br label %83

83:                                               ; preds = %110, %81
  %84 = load i32, ptr %6, align 4, !tbaa !5
  %85 = icmp sge i32 %84, 2
  br i1 %85, label %87, label %86

86:                                               ; preds = %83
  store i32 13, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #8
  br label %113

87:                                               ; preds = %83
  %88 = load i32, ptr %6, align 4, !tbaa !5
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [139 x i8], ptr @g, i64 0, i64 %89
  store i8 0, ptr %90, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  store i32 1, ptr %7, align 4, !tbaa !5
  br label %91

91:                                               ; preds = %100, %87
  %92 = load i32, ptr %7, align 4, !tbaa !5
  %93 = load i32, ptr %6, align 4, !tbaa !5
  %94 = icmp slt i32 %92, %93
  br i1 %94, label %96, label %95

95:                                               ; preds = %91
  store i32 16, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  br label %103

96:                                               ; preds = %91
  %97 = load i32, ptr %7, align 4, !tbaa !5
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [139 x i8], ptr @g, i64 0, i64 %98
  store i8 1, ptr %99, align 1, !tbaa !13
  br label %100

100:                                              ; preds = %96
  %101 = load i32, ptr %7, align 4, !tbaa !5
  %102 = add nsw i32 %101, 1
  store i32 %102, ptr %7, align 4, !tbaa !5
  br label %91, !llvm.loop !15

103:                                              ; preds = %95
  %104 = call noundef zeroext i1 @_Z3chkv()
  %105 = xor i1 %104, true
  %106 = load i32, ptr %6, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [139 x i8], ptr @g, i64 0, i64 %107
  %109 = zext i1 %105 to i8
  store i8 %109, ptr %108, align 1, !tbaa !13
  br label %110

110:                                              ; preds = %103
  %111 = load i32, ptr %6, align 4, !tbaa !5
  %112 = add nsw i32 %111, -1
  store i32 %112, ptr %6, align 4, !tbaa !5
  br label %83, !llvm.loop !16

113:                                              ; preds = %86
  store i8 1, ptr getelementptr inbounds ([139 x i8], ptr @g, i64 0, i64 1), align 1, !tbaa !13
  %114 = call noundef zeroext i1 @_Z3chkv()
  br i1 %114, label %117, label %115

115:                                              ; preds = %113
  %116 = call i32 @puts(ptr noundef @.str.1)
  br label %10, !llvm.loop !17

117:                                              ; preds = %113
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #8
  store i8 0, ptr %8, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  %118 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %118, ptr %9, align 4, !tbaa !5
  br label %119

119:                                              ; preds = %156, %117
  %120 = load i32, ptr %9, align 4, !tbaa !5
  %121 = icmp sge i32 %120, 1
  br i1 %121, label %123, label %122

122:                                              ; preds = %119
  store i32 19, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %159

123:                                              ; preds = %119
  %124 = load i8, ptr %8, align 1, !tbaa !13, !range !18, !noundef !19
  %125 = trunc i8 %124 to i1
  br i1 %125, label %126, label %134

126:                                              ; preds = %123
  %127 = load i32, ptr %9, align 4, !tbaa !5
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [139 x i8], ptr @g, i64 0, i64 %128
  %130 = load i8, ptr %129, align 1, !tbaa !13, !range !18, !noundef !19
  %131 = trunc i8 %130 to i1
  %132 = zext i1 %131 to i32
  %133 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %132)
  br label %155

134:                                              ; preds = %123
  %135 = load i32, ptr %9, align 4, !tbaa !5
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [139 x i8], ptr @g, i64 0, i64 %136
  %138 = load i8, ptr %137, align 1, !tbaa !13, !range !18, !noundef !19
  %139 = trunc i8 %138 to i1
  br i1 %139, label %140, label %154

140:                                              ; preds = %134
  %141 = load i32, ptr %9, align 4, !tbaa !5
  %142 = sext i32 %141 to i64
  %143 = getelementptr inbounds [139 x i8], ptr @g, i64 0, i64 %142
  %144 = load i8, ptr %143, align 1, !tbaa !13, !range !18, !noundef !19
  %145 = trunc i8 %144 to i1
  %146 = zext i1 %145 to i8
  store i8 %146, ptr %8, align 1, !tbaa !13
  %147 = load i32, ptr %9, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [139 x i8], ptr @g, i64 0, i64 %148
  %150 = load i8, ptr %149, align 1, !tbaa !13, !range !18, !noundef !19
  %151 = trunc i8 %150 to i1
  %152 = zext i1 %151 to i32
  %153 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %152)
  br label %154

154:                                              ; preds = %140, %134
  br label %155

155:                                              ; preds = %154, %126
  br label %156

156:                                              ; preds = %155
  %157 = load i32, ptr %9, align 4, !tbaa !5
  %158 = add nsw i32 %157, -1
  store i32 %158, ptr %9, align 4, !tbaa !5
  br label %119, !llvm.loop !20

159:                                              ; preds = %122
  %160 = load i8, ptr %8, align 1, !tbaa !13, !range !18, !noundef !19
  %161 = trunc i8 %160 to i1
  br i1 %161, label %164, label %162

162:                                              ; preds = %159
  %163 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef 0)
  br label %164

164:                                              ; preds = %162, %159
  %165 = call i32 @putchar(i32 noundef 10)
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #8
  br label %10, !llvm.loop !17

166:                                              ; preds = %10
  ret i32 0
}

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

; Function Attrs: nounwind
declare double @sqrt(double noundef) #5

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.ceil.f64(double) #6

declare i32 @puts(ptr noundef) #4

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

; Function Attrs: inlinehint mustprogress uwtable
declare i32 @putchar(i32 noundef) #7

attributes #0 = { 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 #1 = { 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 #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 = { "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 "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 = { 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 #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 = !{!"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}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = distinct !{!20, !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"

@n = external dso_local global i32, align 4
@d = external dso_local global i32, align 4
@s = external dso_local local_unnamed_addr global [139 x [139 x i32]], align 16
@x = external dso_local global [139 x i32], align 16
@y = external dso_local global [139 x i32], align 16
@g = external dso_local local_unnamed_addr global [139 x i8], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z3sqri(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z3chkv() 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, ptr noundef nonnull @n, ptr noundef nonnull @d)
  %2 = icmp eq i32 %1, 2
  br i1 %2, label %.preheader41, label %._crit_edge59

.preheader41:                                     ; preds = %0, %.backedge
  %3 = load i32, ptr @n, align 4, !tbaa !5
  %.not42 = icmp slt i32 %3, 1
  br i1 %.not42, label %._crit_edge52, label %.lr.ph

.preheader40:                                     ; preds = %.lr.ph
  %.not3747 = icmp slt i32 %7, 1
  br i1 %.not3747, label %._crit_edge52, label %.preheader

.lr.ph:                                           ; preds = %.preheader41, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.preheader41 ]
  %4 = getelementptr inbounds i32, ptr @x, i64 %indvars.iv
  %5 = getelementptr inbounds i32, ptr @y, i64 %indvars.iv
  %6 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %7 = load i32, ptr @n, align 4, !tbaa !5
  %8 = sext i32 %7 to i64
  %.not.not = icmp slt i64 %indvars.iv, %8
  br i1 %.not.not, label %.lr.ph, label %.preheader40, !llvm.loop !9

.preheader39:                                     ; preds = %._crit_edge
  %9 = icmp sgt i32 %16, 1
  br i1 %9, label %.lr.ph51.preheader, label %._crit_edge52

.lr.ph51.preheader:                               ; preds = %.preheader39
  %10 = zext nneg i32 %16 to i64
  %11 = zext nneg i32 %16 to i64
  %12 = add nsw i32 %16, -1
  %wide.trip.count = zext nneg i32 %12 to i64
  br label %.lr.ph51

.preheader:                                       ; preds = %.preheader40, %._crit_edge
  %13 = phi i32 [ %16, %._crit_edge ], [ %7, %.preheader40 ]
  %indvars.iv66 = phi i64 [ %indvars.iv.next67, %._crit_edge ], [ 1, %.preheader40 ]
  %.not3844 = icmp slt i32 %13, 1
  br i1 %.not3844, label %.preheader.._crit_edge_crit_edge, label %.lr.ph46

.preheader.._crit_edge_crit_edge:                 ; preds = %.preheader
  %.pre = sext i32 %13 to i64
  br label %._crit_edge

.lr.ph46:                                         ; preds = %.preheader
  %14 = getelementptr inbounds [139 x i32], ptr @x, i64 0, i64 %indvars.iv66
  %15 = getelementptr inbounds [139 x i32], ptr @y, i64 0, i64 %indvars.iv66
  br label %17

._crit_edge:                                      ; preds = %17, %.preheader.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.preheader.._crit_edge_crit_edge ], [ %35, %17 ]
  %16 = phi i32 [ %13, %.preheader.._crit_edge_crit_edge ], [ %34, %17 ]
  %indvars.iv.next67 = add nuw nsw i64 %indvars.iv66, 1
  %.not37.not = icmp slt i64 %indvars.iv66, %.pre-phi
  br i1 %.not37.not, label %.preheader, label %.preheader39, !llvm.loop !11

17:                                               ; preds = %.lr.ph46, %17
  %indvars.iv63 = phi i64 [ 1, %.lr.ph46 ], [ %indvars.iv.next64, %17 ]
  %18 = load i32, ptr %14, align 4, !tbaa !5
  %19 = getelementptr inbounds [139 x i32], ptr @x, i64 0, i64 %indvars.iv63
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = sub nsw i32 %18, %20
  %22 = tail call noundef i32 @_Z3sqri(i32 noundef %21)
  %23 = load i32, ptr %15, align 4, !tbaa !5
  %24 = getelementptr inbounds [139 x i32], ptr @y, i64 0, i64 %indvars.iv63
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %26 = sub nsw i32 %23, %25
  %27 = tail call noundef i32 @_Z3sqri(i32 noundef %26)
  %28 = add nsw i32 %27, %22
  %29 = sitofp i32 %28 to double
  %30 = tail call double @sqrt(double noundef %29) #8
  %31 = tail call double @llvm.ceil.f64(double %30)
  %32 = fptosi double %31 to i32
  %33 = getelementptr inbounds [139 x [139 x i32]], ptr @s, i64 0, i64 %indvars.iv66, i64 %indvars.iv63
  store i32 %32, ptr %33, align 4, !tbaa !5
  %indvars.iv.next64 = add nuw nsw i64 %indvars.iv63, 1
  %34 = load i32, ptr @n, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %.not38.not = icmp slt i64 %indvars.iv63, %35
  br i1 %.not38.not, label %17, label %._crit_edge, !llvm.loop !13

._crit_edge52:                                    ; preds = %.lr.ph51, %.preheader41, %.preheader40, %.preheader39
  store i8 1, ptr getelementptr inbounds (i8, ptr @g, i64 1), align 1, !tbaa !14
  %36 = tail call noundef zeroext i1 @_Z3chkv()
  br i1 %36, label %47, label %43

.lr.ph51:                                         ; preds = %.lr.ph51.preheader, %.lr.ph51
  %indvars.iv72 = phi i64 [ %11, %.lr.ph51.preheader ], [ %indvars.iv.next73, %.lr.ph51 ]
  %indvar = phi i64 [ 0, %.lr.ph51.preheader ], [ %indvar.next, %.lr.ph51 ]
  %37 = xor i64 %indvar, -1
  %38 = add nsw i64 %37, %10
  %39 = getelementptr inbounds [139 x i8], ptr @g, i64 0, i64 %indvars.iv72
  store i8 0, ptr %39, align 1, !tbaa !14
  tail call void @llvm.memset.p0.i64(ptr nonnull align 1 getelementptr inbounds (i8, ptr @g, i64 1), i8 1, i64 %38, i1 false), !tbaa !14
  %40 = tail call noundef zeroext i1 @_Z3chkv()
  %41 = xor i1 %40, true
  %42 = zext i1 %41 to i8
  store i8 %42, ptr %39, align 1, !tbaa !14
  %indvars.iv.next73 = add nsw i64 %indvars.iv72, -1
  %indvar.next = add nuw nsw i64 %indvar, 1
  %exitcond.not = icmp eq i64 %indvar.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge52, label %.lr.ph51, !llvm.loop !16

43:                                               ; preds = %._crit_edge52
  %44 = tail call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %.backedge

.backedge:                                        ; preds = %43, %63
  %45 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @d)
  %46 = icmp eq i32 %45, 2
  br i1 %46, label %.preheader41, label %._crit_edge59, !llvm.loop !17

47:                                               ; preds = %._crit_edge52
  %48 = load i32, ptr @n, align 4, !tbaa !5
  %49 = icmp sgt i32 %48, 0
  br i1 %49, label %.lr.ph56.preheader, label %._crit_edge57.thread

.lr.ph56.preheader:                               ; preds = %47
  %50 = zext nneg i32 %48 to i64
  br label %.lr.ph56

._crit_edge57:                                    ; preds = %60
  %51 = trunc nuw i8 %.1 to i1
  br i1 %51, label %63, label %._crit_edge57.thread

.lr.ph56:                                         ; preds = %.lr.ph56.preheader, %60
  %indvars.iv75 = phi i64 [ %50, %.lr.ph56.preheader ], [ %indvars.iv.next76, %60 ]
  %.03053 = phi i8 [ 0, %.lr.ph56.preheader ], [ %.1, %60 ]
  %52 = trunc nuw i8 %.03053 to i1
  %53 = getelementptr inbounds [139 x i8], ptr @g, i64 0, i64 %indvars.iv75
  %54 = load i8, ptr %53, align 1, !tbaa !14, !range !18, !noundef !19
  br i1 %52, label %55, label %57

55:                                               ; preds = %.lr.ph56
  %56 = zext nneg i8 %54 to i32
  br label %.sink.split

57:                                               ; preds = %.lr.ph56
  %58 = trunc nuw i8 %54 to i1
  br i1 %58, label %.sink.split, label %60

.sink.split:                                      ; preds = %57, %55
  %.sink = phi i32 [ %56, %55 ], [ 1, %57 ]
  %.1.ph = phi i8 [ %.03053, %55 ], [ 1, %57 ]
  %59 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %.sink)
  br label %60

60:                                               ; preds = %.sink.split, %57
  %.1 = phi i8 [ %.03053, %57 ], [ %.1.ph, %.sink.split ]
  %indvars.iv.next76 = add nsw i64 %indvars.iv75, -1
  %61 = icmp sgt i64 %indvars.iv75, 1
  br i1 %61, label %.lr.ph56, label %._crit_edge57, !llvm.loop !20

._crit_edge57.thread:                             ; preds = %47, %._crit_edge57
  %62 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef 0)
  br label %63

63:                                               ; preds = %._crit_edge57.thread, %._crit_edge57
  %64 = tail call i32 @putchar(i32 noundef 10)
  br label %.backedge

._crit_edge59:                                    ; preds = %.backedge, %0
  ret i32 0
}

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(write)
declare double @sqrt(double noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.ceil.f64(double) #5

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

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

; Function Attrs: inlinehint mustprogress nofree nounwind uwtable
declare noundef i32 @putchar(i32 noundef) local_unnamed_addr #6

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7

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


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