; LLVM IR from tangjz/acm-icpc :: hdu (6361)

; 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::complex" = type { { double, double } }

@_ZL2pi = external hidden global double, align 8
@w = external dso_local global [65537 x %"class.std::complex"], align 16
@inv = external dso_local global [60001 x i32], align 16
@a = external dso_local global [60001 x i32], align 16
@b = external dso_local global [60001 x i32], align 16
@c = external dso_local global [60001 x i32], align 16
@d = external dso_local global [60001 x i32], align 16
@a2 = external dso_local global [60001 x i32], align 16
@b2 = external dso_local global [60001 x i32], align 16
@d2 = external dso_local global [60001 x i32], align 16
@da2 = external dso_local global [60001 x i32], align 16
@db = external dso_local global [60001 x i32], align 16
@db2 = external dso_local global [60001 x i32], align 16
@dc = external dso_local global [60001 x i32], align 16
@dd = external dso_local global [60001 x i32], align 16
@dd2 = external dso_local global [60001 x i32], align 16
@ans = external dso_local global [60001 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca %"class.std::complex", align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  store i32 1, ptr getelementptr inbounds ([60001 x i32], ptr @ans, i64 0, i64 1), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([60001 x i32], ptr @dd, i64 0, i64 1), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([60001 x i32], ptr @dc, i64 0, i64 1), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([60001 x i32], ptr @db, i64 0, i64 1), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([60001 x i32], ptr @d, i64 0, i64 1), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([60001 x i32], ptr @c, i64 0, i64 1), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([60001 x i32], ptr @b, i64 0, i64 1), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([60001 x i32], ptr @a, i64 0, i64 1), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds ([60001 x i32], ptr @inv, i64 0, i64 1), align 4, !tbaa !5
  store i32 2, ptr getelementptr inbounds ([60001 x i32], ptr @dd2, i64 0, i64 1), align 4, !tbaa !5
  store i32 2, ptr getelementptr inbounds ([60001 x i32], ptr @db2, i64 0, i64 1), align 4, !tbaa !5
  store i32 2, ptr getelementptr inbounds ([60001 x i32], ptr @da2, i64 0, i64 1), align 4, !tbaa !5
  store i32 2, ptr getelementptr inbounds ([60001 x i32], ptr @d2, i64 0, i64 1), align 4, !tbaa !5
  store i32 2, ptr getelementptr inbounds ([60001 x i32], ptr @b2, i64 0, i64 1), align 4, !tbaa !5
  store i32 2, ptr getelementptr inbounds ([60001 x i32], ptr @a2, i64 0, i64 1), align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  store i32 65536, ptr %3, align 4, !tbaa !5
  br label %11

11:                                               ; preds = %57, %0
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = load i32, ptr %3, align 4, !tbaa !5
  %14 = icmp slt i32 %12, %13
  br i1 %14, label %16, label %15

15:                                               ; preds = %11
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %60

16:                                               ; preds = %11
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  %17 = load i32, ptr %2, align 4, !tbaa !5
  store i32 %17, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %18 = load i32, ptr %3, align 4, !tbaa !5
  %19 = ashr i32 %18, 1
  store i32 %19, ptr %5, align 4, !tbaa !5
  br label %20

20:                                               ; preds = %32, %16
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = and i32 %21, 1
  %23 = icmp ne i32 %22, 0
  br i1 %23, label %29, label %24

24:                                               ; preds = %20
  %25 = load i32, ptr %5, align 4, !tbaa !5
  %26 = and i32 %25, 1
  %27 = icmp ne i32 %26, 0
  %28 = xor i1 %27, true
  br label %29

29:                                               ; preds = %24, %20
  %30 = phi i1 [ false, %20 ], [ %28, %24 ]
  br i1 %30, label %31, label %37

31:                                               ; preds = %29
  br label %32

32:                                               ; preds = %31
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = ashr i32 %33, 1
  store i32 %34, ptr %4, align 4, !tbaa !5
  %35 = load i32, ptr %5, align 4, !tbaa !5
  %36 = ashr i32 %35, 1
  store i32 %36, ptr %5, align 4, !tbaa !5
  br label %20, !llvm.loop !9

37:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #7
  %38 = load double, ptr @_ZL2pi, align 8, !tbaa !11
  %39 = load i32, ptr %5, align 4, !tbaa !5
  %40 = sitofp i32 %39 to double
  %41 = fdiv double %38, %40
  %42 = load i32, ptr %4, align 4, !tbaa !5
  %43 = sitofp i32 %42 to double
  %44 = fmul double %41, %43
  %45 = call double @cos(double noundef %44) #7
  %46 = load double, ptr @_ZL2pi, align 8, !tbaa !11
  %47 = load i32, ptr %5, align 4, !tbaa !5
  %48 = sitofp i32 %47 to double
  %49 = fdiv double %46, %48
  %50 = load i32, ptr %4, align 4, !tbaa !5
  %51 = sitofp i32 %50 to double
  %52 = fmul double %49, %51
  %53 = call double @sin(double noundef %52) #7
  call void @_ZNSt7complexIdEC2Edd(ptr noundef nonnull align 8 dereferenceable(16) %6, double noundef %45, double noundef %53)
  %54 = load i32, ptr %2, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [65537 x %"class.std::complex"], ptr @w, i64 0, i64 %55
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %56, ptr align 8 %6, i64 16, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %57

57:                                               ; preds = %37
  %58 = load i32, ptr %2, align 4, !tbaa !5
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %2, align 4, !tbaa !5
  br label %11, !llvm.loop !15

60:                                               ; preds = %15
  call void @_Z5solveii(i32 noundef 1, i32 noundef 60000)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 2, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %61

61:                                               ; preds = %114, %60
  %62 = load i32, ptr %7, align 4, !tbaa !5
  %63 = icmp slt i32 %62, 60001
  br i1 %63, label %65, label %64

64:                                               ; preds = %61
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %117

65:                                               ; preds = %61
  %66 = load i32, ptr %8, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = load i32, ptr %7, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = mul nsw i64 %67, %69
  %71 = srem i64 %70, 1000000007
  %72 = trunc i64 %71 to i32
  store i32 %72, ptr %8, align 4, !tbaa !5
  %73 = load i32, ptr %7, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [60001 x i32], ptr @a2, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = load i32, ptr %7, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [60001 x i32], ptr @b2, i64 0, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = add nsw i64 %77, %82
  %84 = load i32, ptr %7, align 4, !tbaa !5
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [60001 x i32], ptr @c, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = sub nsw i64 %83, %88
  %90 = load i32, ptr %7, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [60001 x i32], ptr @d, i64 0, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = sub nsw i64 %89, %94
  %96 = load i32, ptr %8, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = mul nsw i64 %95, %97
  %99 = srem i64 %98, 1000000007
  %100 = trunc i64 %99 to i32
  %101 = load i32, ptr %7, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [60001 x i32], ptr @ans, i64 0, i64 %102
  store i32 %100, ptr %103, align 4, !tbaa !5
  %104 = icmp slt i32 %100, 0
  br i1 %104, label %105, label %112

105:                                              ; preds = %65
  %106 = load i32, ptr %7, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [60001 x i32], ptr @ans, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = add nsw i32 %109, 1000000007
  store i32 %110, ptr %108, align 4, !tbaa !5
  %111 = icmp ne i32 %110, 0
  br label %112

112:                                              ; preds = %105, %65
  %113 = phi i1 [ false, %65 ], [ %111, %105 ]
  br label %114

114:                                              ; preds = %112
  %115 = load i32, ptr %7, align 4, !tbaa !5
  %116 = add nsw i32 %115, 1
  store i32 %116, ptr %7, align 4, !tbaa !5
  br label %61, !llvm.loop !16

117:                                              ; preds = %64
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %118 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %9)
  br label %119

119:                                              ; preds = %123, %117
  %120 = load i32, ptr %9, align 4, !tbaa !5
  %121 = add nsw i32 %120, -1
  store i32 %121, ptr %9, align 4, !tbaa !5
  %122 = icmp ne i32 %120, 0
  br i1 %122, label %123, label %130

123:                                              ; preds = %119
  %124 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %10)
  %125 = load i32, ptr %10, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [60001 x i32], ptr @ans, i64 0, i64 %126
  %128 = load i32, ptr %127, align 4, !tbaa !5
  %129 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %128)
  br label %119, !llvm.loop !17

130:                                              ; preds = %119
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  ret i32 0
}

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

; Function Attrs: nounwind
declare double @cos(double noundef) #2

; Function Attrs: nounwind
declare double @sin(double noundef) #2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt7complexIdEC2Edd(ptr noundef nonnull align 8 dereferenceable(16), double noundef, double noundef) unnamed_addr #3 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

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

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

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

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

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

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

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

@_ZL2pi = external hidden local_unnamed_addr global double, align 8
@w = external dso_local local_unnamed_addr global [65537 x %"class.std::complex"], align 16
@inv = external dso_local local_unnamed_addr global [60001 x i32], align 16
@a = external dso_local local_unnamed_addr global [60001 x i32], align 16
@b = external dso_local local_unnamed_addr global [60001 x i32], align 16
@c = external dso_local local_unnamed_addr global [60001 x i32], align 16
@d = external dso_local local_unnamed_addr global [60001 x i32], align 16
@a2 = external dso_local local_unnamed_addr global [60001 x i32], align 16
@b2 = external dso_local local_unnamed_addr global [60001 x i32], align 16
@d2 = external dso_local local_unnamed_addr global [60001 x i32], align 16
@da2 = external dso_local local_unnamed_addr global [60001 x i32], align 16
@db = external dso_local local_unnamed_addr global [60001 x i32], align 16
@db2 = external dso_local local_unnamed_addr global [60001 x i32], align 16
@dc = external dso_local local_unnamed_addr global [60001 x i32], align 16
@dd = external dso_local local_unnamed_addr global [60001 x i32], align 16
@dd2 = external dso_local local_unnamed_addr global [60001 x i32], align 16
@ans = external dso_local local_unnamed_addr global [60001 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca %"class.std::complex", align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  store i32 1, ptr getelementptr inbounds (i8, ptr @ans, i64 4), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @dd, i64 4), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @dc, i64 4), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @db, i64 4), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @d, i64 4), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @c, i64 4), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @b, i64 4), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @a, i64 4), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @inv, i64 4), align 4, !tbaa !5
  store i32 2, ptr getelementptr inbounds (i8, ptr @dd2, i64 4), align 4, !tbaa !5
  store i32 2, ptr getelementptr inbounds (i8, ptr @db2, i64 4), align 4, !tbaa !5
  store i32 2, ptr getelementptr inbounds (i8, ptr @da2, i64 4), align 4, !tbaa !5
  store i32 2, ptr getelementptr inbounds (i8, ptr @d2, i64 4), align 4, !tbaa !5
  store i32 2, ptr getelementptr inbounds (i8, ptr @b2, i64 4), align 4, !tbaa !5
  store i32 2, ptr getelementptr inbounds (i8, ptr @a2, i64 4), align 4, !tbaa !5
  br label %.preheader

.preheader:                                       ; preds = %0, %._crit_edge
  %indvars.iv = phi i64 [ 0, %0 ], [ %indvars.iv.next, %._crit_edge ]
  %4 = trunc nuw nsw i64 %indvars.iv to i32
  %5 = and i32 %4, 1
  %.not3034 = icmp eq i32 %5, 0
  br i1 %.not3034, label %.lr.ph, label %._crit_edge

6:                                                ; preds = %._crit_edge
  call void @_Z5solveii(i32 noundef 1, i32 noundef 60000)
  br label %27

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %.02636 = phi i32 [ %8, %.lr.ph ], [ 32768, %.preheader ]
  %.02735 = phi i32 [ %7, %.lr.ph ], [ %4, %.preheader ]
  %7 = lshr exact i32 %.02735, 1
  %8 = lshr exact i32 %.02636, 1
  %9 = and i32 %.02735, 2
  %.not30 = icmp eq i32 %9, 0
  %10 = and i32 %.02636, 2
  %.not31 = icmp eq i32 %10, 0
  %11 = select i1 %.not30, i1 %.not31, i1 false
  br i1 %11, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph, %.preheader
  %.027.lcssa = phi i32 [ %4, %.preheader ], [ %7, %.lr.ph ]
  %.026.lcssa = phi i32 [ 32768, %.preheader ], [ %8, %.lr.ph ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %1) #7
  %12 = load double, ptr @_ZL2pi, align 8, !tbaa !11
  %13 = uitofp nneg i32 %.026.lcssa to double
  %14 = fdiv double %12, %13
  %15 = uitofp nneg i32 %.027.lcssa to double
  %16 = fmul double %14, %15
  %17 = call double @cos(double noundef %16) #7
  %18 = load double, ptr @_ZL2pi, align 8, !tbaa !11
  %19 = fdiv double %18, %13
  %20 = fmul double %19, %15
  %21 = call double @sin(double noundef %20) #7
  call void @_ZNSt7complexIdEC2Edd(ptr noundef nonnull align 8 dereferenceable(16) %1, double noundef %17, double noundef %21)
  %22 = getelementptr inbounds [65537 x %"class.std::complex"], ptr @w, i64 0, i64 %indvars.iv
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %22, ptr noundef nonnull align 8 dereferenceable(16) %1, i64 16, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %1) #7
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, 65536
  br i1 %exitcond.not, label %6, label %.preheader, !llvm.loop !15

23:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2)
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = add nsw i32 %25, -1
  store i32 %26, ptr %2, align 4, !tbaa !5
  %.not41 = icmp eq i32 %25, 0
  br i1 %.not41, label %._crit_edge44, label %.lr.ph43

27:                                               ; preds = %6, %27
  %indvars.iv47 = phi i64 [ 2, %6 ], [ %indvars.iv.next48, %27 ]
  %.040 = phi i64 [ 1, %6 ], [ %29, %27 ]
  %28 = mul nsw i64 %.040, %indvars.iv47
  %29 = srem i64 %28, 1000000007
  %30 = getelementptr inbounds [60001 x i32], ptr @a2, i64 0, i64 %indvars.iv47
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [60001 x i32], ptr @b2, i64 0, i64 %indvars.iv47
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [60001 x i32], ptr @c, i64 0, i64 %indvars.iv47
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [60001 x i32], ptr @d, i64 0, i64 %indvars.iv47
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %.neg33 = add nsw i64 %35, %32
  %42 = add nsw i64 %38, %41
  %43 = sub nsw i64 %.neg33, %42
  %44 = mul nsw i64 %43, %29
  %45 = srem i64 %44, 1000000007
  %46 = trunc nsw i64 %45 to i32
  %47 = getelementptr inbounds [60001 x i32], ptr @ans, i64 0, i64 %indvars.iv47
  %48 = icmp slt i64 %45, 0
  %49 = add nsw i32 %46, 1000000007
  %spec.select = select i1 %48, i32 %49, i32 %46
  store i32 %spec.select, ptr %47, align 4, !tbaa !5
  %indvars.iv.next48 = add nuw nsw i64 %indvars.iv47, 1
  %exitcond50.not = icmp eq i64 %indvars.iv.next48, 60001
  br i1 %exitcond50.not, label %23, label %27, !llvm.loop !16

.lr.ph43:                                         ; preds = %23, %.lr.ph43
  %50 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %3)
  %51 = load i32, ptr %3, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [60001 x i32], ptr @ans, i64 0, i64 %52
  %54 = load i32, ptr %53, align 4, !tbaa !5
  %55 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %54)
  %56 = load i32, ptr %2, align 4, !tbaa !5
  %57 = add nsw i32 %56, -1
  store i32 %57, ptr %2, align 4, !tbaa !5
  %.not = icmp eq i32 %56, 0
  br i1 %.not, label %._crit_edge44, label %.lr.ph43, !llvm.loop !17

._crit_edge44:                                    ; preds = %.lr.ph43, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  ret i32 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 nofree nounwind willreturn memory(write)
declare double @cos(double noundef) local_unnamed_addr #2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt7complexIdEC2Edd(ptr noundef nonnull align 8 dereferenceable(16), double noundef, double noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #4

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_Z5solveii(i32 noundef, i32 noundef) local_unnamed_addr #5

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

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

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

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

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


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