; LLVM IR from tangjz/acm-icpc :: self_training/2015-02-22 (N)

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

%struct.Node = type { i32, i32, i32 }

@n = external dso_local global i32, align 4
@f = external dso_local global [100001 x i32], align 16
@g = external dso_local global [100001 x i32], align 16
@pre = external dso_local global [100001 x i32], align 16
@out = external dso_local global [100001 x i32], align 16
@ans = external dso_local global i32, align 4
@a = external dso_local global [100001 x %struct.Node], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3cmpRK4NodeS1_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 {
  %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
  store i32 0, ptr %1, align 4
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %10

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

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

15:                                               ; preds = %10
  %16 = load i32, ptr %2, align 4, !tbaa !5
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [100001 x %struct.Node], ptr @a, i64 0, i64 %18
  %20 = getelementptr inbounds %struct.Node, ptr %19, i32 0, i32 0
  store i32 %16, ptr %20, align 4, !tbaa !9
  %21 = load i32, ptr %2, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [100001 x %struct.Node], ptr @a, i64 0, i64 %22
  %24 = getelementptr inbounds %struct.Node, ptr %23, i32 0, i32 1
  %25 = load i32, ptr %2, align 4, !tbaa !5
  %26 = sext i32 %25 to i64
  %27 = getelementptr inbounds [100001 x %struct.Node], ptr @a, i64 0, i64 %26
  %28 = getelementptr inbounds %struct.Node, ptr %27, i32 0, i32 2
  %29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %24, ptr noundef %28)
  br label %30

30:                                               ; preds = %15
  %31 = load i32, ptr %2, align 4, !tbaa !5
  %32 = add nsw i32 %31, 1
  store i32 %32, ptr %2, align 4, !tbaa !5
  br label %10, !llvm.loop !11

33:                                               ; preds = %14
  %34 = load i32, ptr @n, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds %struct.Node, ptr @a, i64 %35
  %37 = getelementptr inbounds %struct.Node, ptr %36, i64 1
  call void @_ZSt4sortIP4NodePFbRKS0_S3_EEvT_S6_T0_(ptr noundef getelementptr inbounds (%struct.Node, ptr @a, i64 1), ptr noundef %37, ptr noundef @_Z3cmpRK4NodeS1_)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 1, ptr %3, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %85, %33
  %39 = load i32, ptr %3, align 4, !tbaa !5
  %40 = load i32, ptr @n, align 4, !tbaa !5
  %41 = icmp sle i32 %39, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %38
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %88

43:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %44 = load i32, ptr @ans, align 4, !tbaa !5
  %45 = sext i32 %44 to i64
  %46 = getelementptr inbounds i32, ptr @f, i64 %45
  %47 = getelementptr inbounds i32, ptr %46, i64 1
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %48 = load i32, ptr %3, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [100001 x %struct.Node], ptr @a, i64 0, i64 %49
  %51 = getelementptr inbounds %struct.Node, ptr %50, i32 0, i32 2
  %52 = load i32, ptr %51, align 4, !tbaa !13
  %53 = sub nsw i32 %52, 1
  store i32 %53, ptr %5, align 4, !tbaa !5
  %54 = call noundef ptr @_ZSt11upper_boundIPiiET_S1_S1_RKT0_(ptr noundef getelementptr inbounds (i32, ptr @f, i64 1), ptr noundef %47, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %55 = ptrtoint ptr %54 to i64
  %56 = sub i64 %55, ptrtoint (ptr @f to i64)
  %57 = sdiv exact i64 %56, 4
  %58 = trunc i64 %57 to i32
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  store i32 %58, ptr %4, align 4, !tbaa !5
  %59 = load i32, ptr %4, align 4, !tbaa !5
  %60 = sub nsw i32 %59, 1
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [100001 x i32], ptr @g, i64 0, i64 %61
  %63 = load i32, ptr %62, align 4, !tbaa !5
  %64 = load i32, ptr %3, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [100001 x i32], ptr @pre, i64 0, i64 %65
  store i32 %63, ptr %66, align 4, !tbaa !5
  %67 = load i32, ptr %3, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [100001 x %struct.Node], ptr @a, i64 0, i64 %68
  %70 = getelementptr inbounds %struct.Node, ptr %69, i32 0, i32 2
  %71 = load i32, ptr %70, align 4, !tbaa !13
  %72 = load i32, ptr %4, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [100001 x i32], ptr @f, i64 0, i64 %73
  store i32 %71, ptr %74, align 4, !tbaa !5
  %75 = load i32, ptr %3, align 4, !tbaa !5
  %76 = load i32, ptr %4, align 4, !tbaa !5
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [100001 x i32], ptr @g, i64 0, i64 %77
  store i32 %75, ptr %78, align 4, !tbaa !5
  %79 = load i32, ptr @ans, align 4, !tbaa !5
  %80 = load i32, ptr %4, align 4, !tbaa !5
  %81 = icmp slt i32 %79, %80
  br i1 %81, label %82, label %84

82:                                               ; preds = %43
  %83 = load i32, ptr %4, align 4, !tbaa !5
  store i32 %83, ptr @ans, align 4, !tbaa !5
  br label %84

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

85:                                               ; preds = %84
  %86 = load i32, ptr %3, align 4, !tbaa !5
  %87 = add nsw i32 %86, 1
  store i32 %87, ptr %3, align 4, !tbaa !5
  br label %38, !llvm.loop !14

88:                                               ; preds = %42
  %89 = load i32, ptr @ans, align 4, !tbaa !5
  %90 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %89)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %91 = load i32, ptr @ans, align 4, !tbaa !5
  %92 = sub nsw i32 %91, 1
  store i32 %92, ptr %6, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %93 = load i32, ptr @ans, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [100001 x i32], ptr @g, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  store i32 %96, ptr %7, align 4, !tbaa !5
  br label %97

97:                                               ; preds = %110, %88
  %98 = load i32, ptr %6, align 4, !tbaa !5
  %99 = icmp sge i32 %98, 0
  br i1 %99, label %101, label %100

100:                                              ; preds = %97
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  br label %117

101:                                              ; preds = %97
  %102 = load i32, ptr %7, align 4, !tbaa !5
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [100001 x %struct.Node], ptr @a, i64 0, i64 %103
  %105 = getelementptr inbounds %struct.Node, ptr %104, i32 0, i32 0
  %106 = load i32, ptr %105, align 4, !tbaa !9
  %107 = load i32, ptr %6, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [100001 x i32], ptr @out, i64 0, i64 %108
  store i32 %106, ptr %109, align 4, !tbaa !5
  br label %110

110:                                              ; preds = %101
  %111 = load i32, ptr %6, align 4, !tbaa !5
  %112 = add nsw i32 %111, -1
  store i32 %112, ptr %6, align 4, !tbaa !5
  %113 = load i32, ptr %7, align 4, !tbaa !5
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [100001 x i32], ptr @pre, i64 0, i64 %114
  %116 = load i32, ptr %115, align 4, !tbaa !5
  store i32 %116, ptr %7, align 4, !tbaa !5
  br label %97, !llvm.loop !15

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

118:                                              ; preds = %137, %117
  %119 = load i32, ptr %8, align 4, !tbaa !5
  %120 = load i32, ptr @ans, align 4, !tbaa !5
  %121 = icmp slt i32 %119, %120
  br i1 %121, label %123, label %122

122:                                              ; preds = %118
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %140

123:                                              ; preds = %118
  %124 = load i32, ptr %8, align 4, !tbaa !5
  %125 = sext i32 %124 to i64
  %126 = getelementptr inbounds [100001 x i32], ptr @out, i64 0, i64 %125
  %127 = load i32, ptr %126, align 4, !tbaa !5
  %128 = load i32, ptr %8, align 4, !tbaa !5
  %129 = load i32, ptr @ans, align 4, !tbaa !5
  %130 = sub nsw i32 %129, 1
  %131 = icmp eq i32 %128, %130
  %132 = zext i1 %131 to i64
  %133 = getelementptr inbounds [3 x i8], ptr @.str.4, i64 0, i64 %132
  %134 = load i8, ptr %133, align 1, !tbaa !16
  %135 = sext i8 %134 to i32
  %136 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %127, i32 noundef %135)
  br label %137

137:                                              ; preds = %123
  %138 = load i32, ptr %8, align 4, !tbaa !5
  %139 = add nsw i32 %138, 1
  store i32 %139, ptr %8, align 4, !tbaa !5
  br label %118, !llvm.loop !17

140:                                              ; preds = %122
  ret i32 0
}

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

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

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

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

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

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

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 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 #2 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !6, i64 0}
!10 = !{!"_ZTS4Node", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!10, !6, i64 8}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = !{!7, !7, i64 0}
!17 = distinct !{!17, !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"

%struct.Node = type { i32, i32, i32 }

@n = external dso_local global i32, align 4
@f = external dso_local global [100001 x i32], align 16
@g = external dso_local local_unnamed_addr global [100001 x i32], align 16
@pre = external dso_local local_unnamed_addr global [100001 x i32], align 16
@out = external dso_local local_unnamed_addr global [100001 x i32], align 16
@ans = external dso_local local_unnamed_addr global i32, align 4
@a = external dso_local global [100001 x %struct.Node], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3cmpRK4NodeS1_(ptr noundef nonnull align 4 dereferenceable(12), ptr noundef nonnull align 4 dereferenceable(12)) #0

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

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre = sext i32 %3 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.._crit_edge_crit_edge ], [ %13, %.lr.ph ]
  %4 = getelementptr inbounds %struct.Node, ptr @a, i64 %.pre-phi
  %5 = getelementptr inbounds i8, ptr %4, i64 12
  tail call void @_ZSt4sortIP4NodePFbRKS0_S3_EEvT_S6_T0_(ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 12), ptr noundef nonnull %5, ptr noundef nonnull @_Z3cmpRK4NodeS1_)
  %6 = load i32, ptr @n, align 4, !tbaa !5
  %.not3337 = icmp slt i32 %6, 1
  %.pre60 = load i32, ptr @ans, align 4, !tbaa !5
  br i1 %.not3337, label %._crit_edge41, label %.lr.ph40

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %7 = getelementptr inbounds [100001 x %struct.Node], ptr @a, i64 0, i64 %indvars.iv
  %8 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %8, ptr %7, align 4, !tbaa !9
  %9 = getelementptr inbounds i8, ptr %7, i64 4
  %10 = getelementptr inbounds i8, ptr %7, i64 8
  %11 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %9, ptr noundef nonnull %10)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %.not.not = icmp slt i64 %indvars.iv, %13
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11

._crit_edge41:                                    ; preds = %50, %._crit_edge
  %14 = phi i32 [ %.pre60, %._crit_edge ], [ %51, %50 ]
  %15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %14)
  %16 = load i32, ptr @ans, align 4, !tbaa !5
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.lr.ph45.preheader, label %._crit_edge48

.lr.ph45.preheader:                               ; preds = %._crit_edge41
  %18 = zext nneg i32 %16 to i64
  %19 = getelementptr inbounds [100001 x i32], ptr @g, i64 0, i64 %18
  %20 = zext nneg i32 %16 to i64
  %xtraiter = and i64 %20, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.lr.ph45.prol.loopexit, label %.lr.ph45.prol

.lr.ph45.prol:                                    ; preds = %.lr.ph45.preheader, %.lr.ph45.prol
  %indvars.iv54.prol = phi i64 [ %indvars.iv.next55.prol, %.lr.ph45.prol ], [ %20, %.lr.ph45.preheader ]
  %.026.in43.prol = phi ptr [ %25, %.lr.ph45.prol ], [ %19, %.lr.ph45.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %.lr.ph45.prol ], [ 0, %.lr.ph45.preheader ]
  %indvars.iv.next55.prol = add nsw i64 %indvars.iv54.prol, -1
  %.026.prol = load i32, ptr %.026.in43.prol, align 4, !tbaa !5
  %21 = sext i32 %.026.prol to i64
  %22 = getelementptr inbounds [100001 x %struct.Node], ptr @a, i64 0, i64 %21
  %23 = load i32, ptr %22, align 4, !tbaa !9
  %24 = getelementptr inbounds [100001 x i32], ptr @out, i64 0, i64 %indvars.iv.next55.prol
  store i32 %23, ptr %24, align 4, !tbaa !5
  %25 = getelementptr inbounds [100001 x i32], ptr @pre, i64 0, i64 %21
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %.lr.ph45.prol.loopexit, label %.lr.ph45.prol, !llvm.loop !13

.lr.ph45.prol.loopexit:                           ; preds = %.lr.ph45.prol, %.lr.ph45.preheader
  %indvars.iv54.unr = phi i64 [ %20, %.lr.ph45.preheader ], [ %indvars.iv.next55.prol, %.lr.ph45.prol ]
  %.026.in43.unr = phi ptr [ %19, %.lr.ph45.preheader ], [ %25, %.lr.ph45.prol ]
  %26 = icmp ult i32 %16, 4
  br i1 %26, label %.preheader, label %.lr.ph45

.lr.ph40:                                         ; preds = %._crit_edge, %50
  %27 = phi i32 [ %51, %50 ], [ %.pre60, %._crit_edge ]
  %indvars.iv51 = phi i64 [ %indvars.iv.next52, %50 ], [ 1, %._crit_edge ]
  %28 = sext i32 %27 to i64
  %gep = getelementptr i32, ptr getelementptr inbounds (i8, ptr @f, i64 4), i64 %28
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %29 = getelementptr inbounds [100001 x %struct.Node], ptr @a, i64 0, i64 %indvars.iv51, i32 2
  %30 = load i32, ptr %29, align 4, !tbaa !15
  %31 = add nsw i32 %30, -1
  store i32 %31, ptr %1, align 4, !tbaa !5
  %32 = call noundef ptr @_ZSt11upper_boundIPiiET_S1_S1_RKT0_(ptr noundef nonnull getelementptr inbounds (i8, ptr @f, i64 4), ptr noundef nonnull %gep, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %33 = ptrtoint ptr %32 to i64
  %34 = sub i64 %33, ptrtoint (ptr @f to i64)
  %35 = lshr exact i64 %34, 2
  %36 = trunc i64 %35 to i32
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  %37 = shl i64 %34, 30
  %sext = add i64 %37, -4294967296
  %38 = ashr i64 %sext, 32
  %39 = getelementptr inbounds [100001 x i32], ptr @g, i64 0, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = getelementptr inbounds [100001 x i32], ptr @pre, i64 0, i64 %indvars.iv51
  store i32 %40, ptr %41, align 4, !tbaa !5
  %42 = load i32, ptr %29, align 4, !tbaa !15
  %43 = ashr i64 %37, 32
  %44 = getelementptr inbounds [100001 x i32], ptr @f, i64 0, i64 %43
  store i32 %42, ptr %44, align 4, !tbaa !5
  %45 = getelementptr inbounds [100001 x i32], ptr @g, i64 0, i64 %43
  %46 = trunc nuw nsw i64 %indvars.iv51 to i32
  store i32 %46, ptr %45, align 4, !tbaa !5
  %47 = load i32, ptr @ans, align 4, !tbaa !5
  %48 = icmp slt i32 %47, %36
  br i1 %48, label %49, label %50

49:                                               ; preds = %.lr.ph40
  store i32 %36, ptr @ans, align 4, !tbaa !5
  br label %50

50:                                               ; preds = %49, %.lr.ph40
  %51 = phi i32 [ %36, %49 ], [ %47, %.lr.ph40 ]
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %52 = load i32, ptr @n, align 4, !tbaa !5
  %53 = sext i32 %52 to i64
  %.not33.not = icmp slt i64 %indvars.iv51, %53
  br i1 %.not33.not, label %.lr.ph40, label %._crit_edge41, !llvm.loop !16

.preheader:                                       ; preds = %.lr.ph45, %.lr.ph45.prol.loopexit
  br i1 %17, label %.lr.ph47, label %._crit_edge48

.lr.ph45:                                         ; preds = %.lr.ph45.prol.loopexit, %.lr.ph45
  %indvars.iv54 = phi i64 [ %indvars.iv.next55.3, %.lr.ph45 ], [ %indvars.iv54.unr, %.lr.ph45.prol.loopexit ]
  %.026.in43 = phi ptr [ %73, %.lr.ph45 ], [ %.026.in43.unr, %.lr.ph45.prol.loopexit ]
  %indvars.iv.next55 = add nsw i64 %indvars.iv54, -1
  %.026 = load i32, ptr %.026.in43, align 4, !tbaa !5
  %54 = sext i32 %.026 to i64
  %55 = getelementptr inbounds [100001 x %struct.Node], ptr @a, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !9
  %57 = getelementptr inbounds [100001 x i32], ptr @out, i64 0, i64 %indvars.iv.next55
  store i32 %56, ptr %57, align 4, !tbaa !5
  %58 = getelementptr inbounds [100001 x i32], ptr @pre, i64 0, i64 %54
  %indvars.iv.next55.1 = add nsw i64 %indvars.iv54, -2
  %.026.1 = load i32, ptr %58, align 4, !tbaa !5
  %59 = sext i32 %.026.1 to i64
  %60 = getelementptr inbounds [100001 x %struct.Node], ptr @a, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !9
  %62 = getelementptr inbounds [100001 x i32], ptr @out, i64 0, i64 %indvars.iv.next55.1
  store i32 %61, ptr %62, align 4, !tbaa !5
  %63 = getelementptr inbounds [100001 x i32], ptr @pre, i64 0, i64 %59
  %indvars.iv.next55.2 = add nsw i64 %indvars.iv54, -3
  %.026.2 = load i32, ptr %63, align 4, !tbaa !5
  %64 = sext i32 %.026.2 to i64
  %65 = getelementptr inbounds [100001 x %struct.Node], ptr @a, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !9
  %67 = getelementptr inbounds [100001 x i32], ptr @out, i64 0, i64 %indvars.iv.next55.2
  store i32 %66, ptr %67, align 4, !tbaa !5
  %68 = getelementptr inbounds [100001 x i32], ptr @pre, i64 0, i64 %64
  %indvars.iv.next55.3 = add nsw i64 %indvars.iv54, -4
  %.026.3 = load i32, ptr %68, align 4, !tbaa !5
  %69 = sext i32 %.026.3 to i64
  %70 = getelementptr inbounds [100001 x %struct.Node], ptr @a, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !9
  %72 = getelementptr inbounds [100001 x i32], ptr @out, i64 0, i64 %indvars.iv.next55.3
  store i32 %71, ptr %72, align 4, !tbaa !5
  %73 = getelementptr inbounds [100001 x i32], ptr @pre, i64 0, i64 %69
  %74 = icmp ugt i64 %indvars.iv.next55.2, 1
  br i1 %74, label %.lr.ph45, label %.preheader, !llvm.loop !17

._crit_edge48:                                    ; preds = %.lr.ph47, %._crit_edge41, %.preheader
  ret i32 0

.lr.ph47:                                         ; preds = %.preheader, %.lr.ph47
  %indvars.iv57 = phi i64 [ %indvars.iv.next58, %.lr.ph47 ], [ 0, %.preheader ]
  %75 = phi i32 [ %86, %.lr.ph47 ], [ %16, %.preheader ]
  %76 = getelementptr inbounds [100001 x i32], ptr @out, i64 0, i64 %indvars.iv57
  %77 = load i32, ptr %76, align 4, !tbaa !5
  %78 = add nsw i32 %75, -1
  %79 = zext i32 %78 to i64
  %80 = icmp eq i64 %indvars.iv57, %79
  %81 = zext i1 %80 to i64
  %82 = getelementptr inbounds [3 x i8], ptr @.str.4, i64 0, i64 %81
  %83 = load i8, ptr %82, align 1, !tbaa !18
  %84 = sext i8 %83 to i32
  %85 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %77, i32 noundef %84)
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
  %86 = load i32, ptr @ans, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = icmp slt i64 %indvars.iv.next58, %87
  br i1 %88, label %.lr.ph47, label %._crit_edge48, !llvm.loop !19
}

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

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

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

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

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

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

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 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 #2 = { 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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, !6, i64 0}
!10 = !{!"_ZTS4Node", !6, i64 0, !6, i64 4, !6, i64 8}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.unroll.disable"}
!15 = !{!10, !6, i64 8}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = !{!7, !7, i64 0}
!19 = distinct !{!19, !12}


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