; LLVM IR from lzyrapx/Competitive-Programming :: HDUOJ (1512（左偏树）)

; 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, i32 }
%"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 }

@ltree = external dso_local global [100005 x %struct.node], align 16
@par = external dso_local global [100005 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.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 [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z5mergeii(i32 noundef, i32 noundef) #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 noundef i32 @_Z3popi(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
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  br label %12

12:                                               ; preds = %110, %0
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %14 = load ptr, ptr %13, align 8, !tbaa !5
  %15 = getelementptr i8, ptr %14, i64 -24
  %16 = load i64, ptr %15, align 8
  %17 = getelementptr inbounds i8, ptr %13, i64 %16
  %18 = call noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264) %17)
  br i1 %18, label %19, label %111

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

20:                                               ; preds = %43, %19
  %21 = load i32, ptr %4, align 4, !tbaa !8
  %22 = load i32, ptr %2, align 4, !tbaa !8
  %23 = icmp sle i32 %21, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %46

25:                                               ; preds = %20
  %26 = load i32, ptr %4, align 4, !tbaa !8
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [100005 x %struct.node], ptr @ltree, i64 0, i64 %27
  %29 = getelementptr inbounds %struct.node, ptr %28, i32 0, i32 3
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %29)
  %31 = load i32, ptr %4, align 4, !tbaa !8
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [100005 x %struct.node], ptr @ltree, i64 0, i64 %32
  %34 = getelementptr inbounds %struct.node, ptr %33, i32 0, i32 0
  store i32 0, ptr %34, align 16, !tbaa !11
  %35 = load i32, ptr %4, align 4, !tbaa !8
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [100005 x %struct.node], ptr @ltree, i64 0, i64 %36
  %38 = getelementptr inbounds %struct.node, ptr %37, i32 0, i32 1
  store i32 0, ptr %38, align 4, !tbaa !13
  %39 = load i32, ptr %4, align 4, !tbaa !8
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [100005 x %struct.node], ptr @ltree, i64 0, i64 %40
  %42 = getelementptr inbounds %struct.node, ptr %41, i32 0, i32 2
  store i32 0, ptr %42, align 8, !tbaa !14
  br label %43

43:                                               ; preds = %25
  %44 = load i32, ptr %4, align 4, !tbaa !8
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %4, align 4, !tbaa !8
  br label %20, !llvm.loop !15

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

47:                                               ; preds = %57, %46
  %48 = load i32, ptr %5, align 4, !tbaa !8
  %49 = load i32, ptr %2, align 4, !tbaa !8
  %50 = icmp sle i32 %48, %49
  br i1 %50, label %52, label %51

51:                                               ; preds = %47
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %60

52:                                               ; preds = %47
  %53 = load i32, ptr %5, align 4, !tbaa !8
  %54 = load i32, ptr %5, align 4, !tbaa !8
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [100005 x i32], ptr @par, i64 0, i64 %55
  store i32 %53, ptr %56, align 4, !tbaa !8
  br label %57

57:                                               ; preds = %52
  %58 = load i32, ptr %5, align 4, !tbaa !8
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %5, align 4, !tbaa !8
  br label %47, !llvm.loop !17

60:                                               ; preds = %51
  %61 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %3)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  br label %62

62:                                               ; preds = %109, %60
  %63 = load i32, ptr %3, align 4, !tbaa !8
  %64 = add nsw i32 %63, -1
  store i32 %64, ptr %3, align 4, !tbaa !8
  %65 = icmp ne i32 %63, 0
  br i1 %65, label %66, label %110

66:                                               ; preds = %62
  %67 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %6, ptr noundef %7)
  %68 = load i32, ptr %6, align 4, !tbaa !8
  %69 = call noundef i32 @_Z9getfatheri(i32 noundef %68)
  store i32 %69, ptr %8, align 4, !tbaa !8
  %70 = load i32, ptr %7, align 4, !tbaa !8
  %71 = call noundef i32 @_Z9getfatheri(i32 noundef %70)
  store i32 %71, ptr %9, align 4, !tbaa !8
  %72 = load i32, ptr %8, align 4, !tbaa !8
  %73 = load i32, ptr %9, align 4, !tbaa !8
  %74 = icmp eq i32 %72, %73
  br i1 %74, label %75, label %77

75:                                               ; preds = %66
  %76 = call i32 @puts(ptr noundef @.str.2)
  br label %109

77:                                               ; preds = %66
  %78 = load i32, ptr %8, align 4, !tbaa !8
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [100005 x %struct.node], ptr @ltree, i64 0, i64 %79
  %81 = getelementptr inbounds %struct.node, ptr %80, i32 0, i32 3
  %82 = load i32, ptr %81, align 4, !tbaa !18
  %83 = sdiv i32 %82, 2
  store i32 %83, ptr %81, align 4, !tbaa !18
  %84 = load i32, ptr %9, align 4, !tbaa !8
  %85 = sext i32 %84 to i64
  %86 = getelementptr inbounds [100005 x %struct.node], ptr @ltree, i64 0, i64 %85
  %87 = getelementptr inbounds %struct.node, ptr %86, i32 0, i32 3
  %88 = load i32, ptr %87, align 4, !tbaa !18
  %89 = sdiv i32 %88, 2
  store i32 %89, ptr %87, align 4, !tbaa !18
  %90 = load i32, ptr %8, align 4, !tbaa !8
  %91 = call noundef i32 @_Z3popi(i32 noundef %90)
  store i32 %91, ptr %10, align 4, !tbaa !8
  %92 = load i32, ptr %9, align 4, !tbaa !8
  %93 = call noundef i32 @_Z3popi(i32 noundef %92)
  store i32 %93, ptr %11, align 4, !tbaa !8
  %94 = load i32, ptr %10, align 4, !tbaa !8
  %95 = load i32, ptr %8, align 4, !tbaa !8
  %96 = call noundef i32 @_Z5mergeii(i32 noundef %94, i32 noundef %95)
  store i32 %96, ptr %10, align 4, !tbaa !8
  %97 = load i32, ptr %11, align 4, !tbaa !8
  %98 = load i32, ptr %9, align 4, !tbaa !8
  %99 = call noundef i32 @_Z5mergeii(i32 noundef %97, i32 noundef %98)
  store i32 %99, ptr %11, align 4, !tbaa !8
  %100 = load i32, ptr %10, align 4, !tbaa !8
  %101 = load i32, ptr %11, align 4, !tbaa !8
  %102 = call noundef i32 @_Z5mergeii(i32 noundef %100, i32 noundef %101)
  store i32 %102, ptr %10, align 4, !tbaa !8
  %103 = load i32, ptr %10, align 4, !tbaa !8
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [100005 x %struct.node], ptr @ltree, i64 0, i64 %104
  %106 = getelementptr inbounds %struct.node, ptr %105, i32 0, i32 3
  %107 = load i32, ptr %106, align 4, !tbaa !18
  %108 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %107)
  br label %109

109:                                              ; preds = %77, %75
  br label %62, !llvm.loop !19

110:                                              ; preds = %62
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %12, !llvm.loop !20

111:                                              ; preds = %12
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  ret i32 0
}

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: mustprogress uwtable
declare noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264)) #0 align 2

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

declare i32 @puts(ptr noundef) #3

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

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 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !9, i64 0}
!12 = !{!"_ZTS4node", !9, i64 0, !9, i64 4, !9, i64 8, !9, i64 12}
!13 = !{!12, !9, i64 4}
!14 = !{!12, !9, i64 8}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = !{!12, !9, i64 12}
!19 = distinct !{!19, !16}
!20 = distinct !{!20, !16}


; 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, i32 }
%"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 }

@ltree = external dso_local global [100005 x %struct.node], align 16
@par = external dso_local local_unnamed_addr global [100005 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.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 [3 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_Z5mergeii(i32 noundef, i32 noundef) 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 noundef i32 @_Z3popi(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 = alloca i32, align 4
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %5 = 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)
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = getelementptr i8, ptr %6, i64 -24
  %8 = load i64, ptr %7, align 8
  %9 = getelementptr inbounds i8, ptr %5, i64 %8
  %10 = call noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264) %9)
  br i1 %10, label %.preheader28, label %._crit_edge38

.preheader28:                                     ; preds = %0, %._crit_edge37
  %11 = load i32, ptr %1, align 4, !tbaa !8
  %.not29 = icmp slt i32 %11, 1
  br i1 %.not29, label %._crit_edge, label %.lr.ph

.preheader:                                       ; preds = %.lr.ph
  %.not2631 = icmp slt i32 %22, 1
  br i1 %.not2631, label %._crit_edge, label %.lr.ph33.preheader

.lr.ph33.preheader:                               ; preds = %.preheader
  %12 = add nuw i32 %22, 1
  %wide.trip.count = zext i32 %12 to i64
  %13 = zext nneg i32 %22 to i64
  %min.iters.check = icmp ult i32 %22, 8
  br i1 %min.iters.check, label %.lr.ph33.preheader47, label %vector.ph

.lr.ph33.preheader47:                             ; preds = %middle.block, %.lr.ph33.preheader
  %indvars.iv41.ph = phi i64 [ 1, %.lr.ph33.preheader ], [ %ind.end, %middle.block ]
  br label %.lr.ph33

vector.ph:                                        ; preds = %.lr.ph33.preheader
  %n.vec = and i64 %13, 2147483640
  %ind.end = or disjoint i64 %n.vec, 1
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <4 x i32> [ <i32 1, i32 2, i32 3, i32 4>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %offset.idx = or disjoint i64 %index, 1
  %14 = getelementptr inbounds [100005 x i32], ptr @par, i64 0, i64 %offset.idx
  %15 = getelementptr inbounds i8, ptr %14, i64 16
  store <4 x i32> %vec.ind, ptr %14, align 4, !tbaa !8
  store <4 x i32> %step.add, ptr %15, align 4, !tbaa !8
  %index.next = add nuw i64 %index, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %16 = icmp eq i64 %index.next, %n.vec
  br i1 %16, label %middle.block, label %vector.body, !llvm.loop !11

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %13
  br i1 %cmp.n, label %._crit_edge, label %.lr.ph33.preheader47

.lr.ph:                                           ; preds = %.preheader28, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.preheader28 ]
  %17 = getelementptr inbounds [100005 x %struct.node], ptr @ltree, i64 0, i64 %indvars.iv
  %18 = getelementptr inbounds i8, ptr %17, i64 12
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %18)
  store i32 0, ptr %17, align 16, !tbaa !15
  %20 = getelementptr inbounds i8, ptr %17, i64 4
  store i32 0, ptr %20, align 4, !tbaa !17
  %21 = getelementptr inbounds i8, ptr %17, i64 8
  store i32 0, ptr %21, align 8, !tbaa !18
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %22 = load i32, ptr %1, align 4, !tbaa !8
  %23 = sext i32 %22 to i64
  %.not.not = icmp slt i64 %indvars.iv, %23
  br i1 %.not.not, label %.lr.ph, label %.preheader, !llvm.loop !19

._crit_edge:                                      ; preds = %.lr.ph33, %middle.block, %.preheader28, %.preheader
  %24 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %2)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  %25 = load i32, ptr %2, align 4, !tbaa !8
  %26 = add nsw i32 %25, -1
  store i32 %26, ptr %2, align 4, !tbaa !8
  %.not2734 = icmp eq i32 %25, 0
  br i1 %.not2734, label %._crit_edge37, label %.lr.ph36

.lr.ph33:                                         ; preds = %.lr.ph33.preheader47, %.lr.ph33
  %indvars.iv41 = phi i64 [ %indvars.iv.next42, %.lr.ph33 ], [ %indvars.iv41.ph, %.lr.ph33.preheader47 ]
  %27 = getelementptr inbounds [100005 x i32], ptr @par, i64 0, i64 %indvars.iv41
  %28 = trunc nuw nsw i64 %indvars.iv41 to i32
  store i32 %28, ptr %27, align 4, !tbaa !8
  %indvars.iv.next42 = add nuw nsw i64 %indvars.iv41, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next42, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph33, !llvm.loop !20

.lr.ph36:                                         ; preds = %._crit_edge, %55
  %29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %3, ptr noundef nonnull %4)
  %30 = load i32, ptr %3, align 4, !tbaa !8
  %31 = call noundef i32 @_Z9getfatheri(i32 noundef %30)
  %32 = load i32, ptr %4, align 4, !tbaa !8
  %33 = call noundef i32 @_Z9getfatheri(i32 noundef %32)
  %34 = icmp eq i32 %31, %33
  br i1 %34, label %35, label %37

35:                                               ; preds = %.lr.ph36
  %36 = call i32 @puts(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %55

37:                                               ; preds = %.lr.ph36
  %38 = sext i32 %31 to i64
  %39 = getelementptr inbounds [100005 x %struct.node], ptr @ltree, i64 0, i64 %38, i32 3
  %40 = load i32, ptr %39, align 4, !tbaa !21
  %41 = sdiv i32 %40, 2
  store i32 %41, ptr %39, align 4, !tbaa !21
  %42 = sext i32 %33 to i64
  %43 = getelementptr inbounds [100005 x %struct.node], ptr @ltree, i64 0, i64 %42, i32 3
  %44 = load i32, ptr %43, align 4, !tbaa !21
  %45 = sdiv i32 %44, 2
  store i32 %45, ptr %43, align 4, !tbaa !21
  %46 = call noundef i32 @_Z3popi(i32 noundef %31)
  %47 = call noundef i32 @_Z3popi(i32 noundef %33)
  %48 = call noundef i32 @_Z5mergeii(i32 noundef %46, i32 noundef %31)
  %49 = call noundef i32 @_Z5mergeii(i32 noundef %47, i32 noundef %33)
  %50 = call noundef i32 @_Z5mergeii(i32 noundef %48, i32 noundef %49)
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [100005 x %struct.node], ptr @ltree, i64 0, i64 %51, i32 3
  %53 = load i32, ptr %52, align 4, !tbaa !21
  %54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %53)
  br label %55

55:                                               ; preds = %37, %35
  %56 = load i32, ptr %2, align 4, !tbaa !8
  %57 = add nsw i32 %56, -1
  store i32 %57, ptr %2, align 4, !tbaa !8
  %.not27 = icmp eq i32 %56, 0
  br i1 %.not27, label %._crit_edge37, label %.lr.ph36, !llvm.loop !22

._crit_edge37:                                    ; preds = %55, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  %58 = 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)
  %59 = load ptr, ptr %58, align 8, !tbaa !5
  %60 = getelementptr i8, ptr %59, i64 -24
  %61 = load i64, ptr %60, align 8
  %62 = getelementptr inbounds i8, ptr %58, i64 %61
  %63 = call noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264) %62)
  br i1 %63, label %.preheader28, label %._crit_edge38, !llvm.loop !23

._crit_edge38:                                    ; preds = %._crit_edge37, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret i32 0
}

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: mustprogress uwtable
declare noundef zeroext i1 @_ZNKSt9basic_iosIcSt11char_traitsIcEEcvbEv(ptr noundef nonnull align 8 dereferenceable(264)) local_unnamed_addr #0 align 2

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

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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) 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 = { 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 #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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"int", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12, !13, !14}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = !{!16, !9, i64 0}
!16 = !{!"_ZTS4node", !9, i64 0, !9, i64 4, !9, i64 8, !9, i64 12}
!17 = !{!16, !9, i64 4}
!18 = !{!16, !9, i64 8}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12, !14, !13}
!21 = !{!16, !9, i64 12}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12}


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