; LLVM IR from tangjz/acm-icpc :: usaco/Training/Chapter 2 Bigger challenges (sort3)

; 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
@a = external dso_local global [1000 x i32], align 16
@b = external dso_local global [1000 x i32], align 16
@num = external dso_local global [4 x [4 x i32]], align 16
@ans = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = 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
  store i32 0, ptr %1, align 4
  %3 = load ptr, ptr @stdin, align 8, !tbaa !5
  %4 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.1, ptr noundef %3)
  %5 = load ptr, ptr @stdout, align 8, !tbaa !5
  %6 = call ptr @freopen(ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef %5)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef @n)
  store i32 0, ptr %2, align 4, !tbaa !9
  br label %8

8:                                                ; preds = %24, %0
  %9 = load i32, ptr %2, align 4, !tbaa !9
  %10 = load i32, ptr @n, align 4, !tbaa !9
  %11 = icmp slt i32 %9, %10
  br i1 %11, label %12, label %27

12:                                               ; preds = %8
  %13 = load i32, ptr %2, align 4, !tbaa !9
  %14 = sext i32 %13 to i64
  %15 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %14
  %16 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.4, ptr noundef %15)
  %17 = load i32, ptr %2, align 4, !tbaa !9
  %18 = sext i32 %17 to i64
  %19 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %18
  %20 = load i32, ptr %19, align 4, !tbaa !9
  %21 = load i32, ptr %2, align 4, !tbaa !9
  %22 = sext i32 %21 to i64
  %23 = getelementptr inbounds [1000 x i32], ptr @b, i64 0, i64 %22
  store i32 %20, ptr %23, align 4, !tbaa !9
  br label %24

24:                                               ; preds = %12
  %25 = load i32, ptr %2, align 4, !tbaa !9
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr %2, align 4, !tbaa !9
  br label %8, !llvm.loop !11

27:                                               ; preds = %8
  %28 = load i32, ptr @n, align 4, !tbaa !9
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds i32, ptr @b, i64 %29
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @b, ptr noundef %30)
  store i32 0, ptr %2, align 4, !tbaa !9
  br label %31

31:                                               ; preds = %50, %27
  %32 = load i32, ptr %2, align 4, !tbaa !9
  %33 = load i32, ptr @n, align 4, !tbaa !9
  %34 = icmp slt i32 %32, %33
  br i1 %34, label %35, label %53

35:                                               ; preds = %31
  %36 = load i32, ptr %2, align 4, !tbaa !9
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [1000 x i32], ptr @b, i64 0, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !9
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [4 x [4 x i32]], ptr @num, i64 0, i64 %40
  %42 = load i32, ptr %2, align 4, !tbaa !9
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !9
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [4 x i32], ptr %41, i64 0, i64 %46
  %48 = load i32, ptr %47, align 4, !tbaa !9
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %47, align 4, !tbaa !9
  br label %50

50:                                               ; preds = %35
  %51 = load i32, ptr %2, align 4, !tbaa !9
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %2, align 4, !tbaa !9
  br label %31, !llvm.loop !13

53:                                               ; preds = %31
  %54 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds ([4 x i32], ptr getelementptr inbounds ([4 x [4 x i32]], ptr @num, i64 0, i64 1), i64 0, i64 2), ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds ([4 x i32], ptr getelementptr inbounds ([4 x [4 x i32]], ptr @num, i64 0, i64 2), i64 0, i64 1))
  %55 = load i32, ptr %54, align 4, !tbaa !9
  store i32 %55, ptr %2, align 4, !tbaa !9
  %56 = load i32, ptr %2, align 4, !tbaa !9
  %57 = load i32, ptr getelementptr inbounds ([4 x i32], ptr getelementptr inbounds ([4 x [4 x i32]], ptr @num, i64 0, i64 1), i64 0, i64 2), align 8, !tbaa !9
  %58 = sub nsw i32 %57, %56
  store i32 %58, ptr getelementptr inbounds ([4 x i32], ptr getelementptr inbounds ([4 x [4 x i32]], ptr @num, i64 0, i64 1), i64 0, i64 2), align 8, !tbaa !9
  %59 = load i32, ptr %2, align 4, !tbaa !9
  %60 = load i32, ptr getelementptr inbounds ([4 x i32], ptr getelementptr inbounds ([4 x [4 x i32]], ptr @num, i64 0, i64 2), i64 0, i64 1), align 4, !tbaa !9
  %61 = sub nsw i32 %60, %59
  store i32 %61, ptr getelementptr inbounds ([4 x i32], ptr getelementptr inbounds ([4 x [4 x i32]], ptr @num, i64 0, i64 2), i64 0, i64 1), align 4, !tbaa !9
  %62 = load i32, ptr %2, align 4, !tbaa !9
  %63 = load i32, ptr @ans, align 4, !tbaa !9
  %64 = add nsw i32 %63, %62
  store i32 %64, ptr @ans, align 4, !tbaa !9
  %65 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds ([4 x i32], ptr getelementptr inbounds ([4 x [4 x i32]], ptr @num, i64 0, i64 1), i64 0, i64 3), ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds ([4 x i32], ptr getelementptr inbounds ([4 x [4 x i32]], ptr @num, i64 0, i64 3), i64 0, i64 1))
  %66 = load i32, ptr %65, align 4, !tbaa !9
  store i32 %66, ptr %2, align 4, !tbaa !9
  %67 = load i32, ptr %2, align 4, !tbaa !9
  %68 = load i32, ptr getelementptr inbounds ([4 x i32], ptr getelementptr inbounds ([4 x [4 x i32]], ptr @num, i64 0, i64 1), i64 0, i64 3), align 4, !tbaa !9
  %69 = sub nsw i32 %68, %67
  store i32 %69, ptr getelementptr inbounds ([4 x i32], ptr getelementptr inbounds ([4 x [4 x i32]], ptr @num, i64 0, i64 1), i64 0, i64 3), align 4, !tbaa !9
  %70 = load i32, ptr %2, align 4, !tbaa !9
  %71 = load i32, ptr getelementptr inbounds ([4 x i32], ptr getelementptr inbounds ([4 x [4 x i32]], ptr @num, i64 0, i64 3), i64 0, i64 1), align 4, !tbaa !9
  %72 = sub nsw i32 %71, %70
  store i32 %72, ptr getelementptr inbounds ([4 x i32], ptr getelementptr inbounds ([4 x [4 x i32]], ptr @num, i64 0, i64 3), i64 0, i64 1), align 4, !tbaa !9
  %73 = load i32, ptr %2, align 4, !tbaa !9
  %74 = load i32, ptr @ans, align 4, !tbaa !9
  %75 = add nsw i32 %74, %73
  store i32 %75, ptr @ans, align 4, !tbaa !9
  %76 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds ([4 x i32], ptr getelementptr inbounds ([4 x [4 x i32]], ptr @num, i64 0, i64 2), i64 0, i64 3), ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds ([4 x i32], ptr getelementptr inbounds ([4 x [4 x i32]], ptr @num, i64 0, i64 3), i64 0, i64 2))
  %77 = load i32, ptr %76, align 4, !tbaa !9
  store i32 %77, ptr %2, align 4, !tbaa !9
  %78 = load i32, ptr %2, align 4, !tbaa !9
  %79 = load i32, ptr getelementptr inbounds ([4 x i32], ptr getelementptr inbounds ([4 x [4 x i32]], ptr @num, i64 0, i64 2), i64 0, i64 3), align 4, !tbaa !9
  %80 = sub nsw i32 %79, %78
  store i32 %80, ptr getelementptr inbounds ([4 x i32], ptr getelementptr inbounds ([4 x [4 x i32]], ptr @num, i64 0, i64 2), i64 0, i64 3), align 4, !tbaa !9
  %81 = load i32, ptr %2, align 4, !tbaa !9
  %82 = load i32, ptr getelementptr inbounds ([4 x i32], ptr getelementptr inbounds ([4 x [4 x i32]], ptr @num, i64 0, i64 3), i64 0, i64 2), align 8, !tbaa !9
  %83 = sub nsw i32 %82, %81
  store i32 %83, ptr getelementptr inbounds ([4 x i32], ptr getelementptr inbounds ([4 x [4 x i32]], ptr @num, i64 0, i64 3), i64 0, i64 2), align 8, !tbaa !9
  %84 = load i32, ptr %2, align 4, !tbaa !9
  %85 = load i32, ptr @ans, align 4, !tbaa !9
  %86 = add nsw i32 %85, %84
  store i32 %86, ptr @ans, align 4, !tbaa !9
  %87 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds ([4 x i32], ptr getelementptr inbounds ([4 x [4 x i32]], ptr @num, i64 0, i64 1), i64 0, i64 2), ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds ([4 x i32], ptr getelementptr inbounds ([4 x [4 x i32]], ptr @num, i64 0, i64 2), i64 0, i64 1))
  %88 = load i32, ptr %87, align 4, !tbaa !9
  %89 = shl i32 %88, 1
  %90 = load i32, ptr @ans, align 4, !tbaa !9
  %91 = add nsw i32 %90, %89
  store i32 %91, ptr @ans, align 4, !tbaa !9
  %92 = load i32, ptr @ans, align 4, !tbaa !9
  %93 = call i32 (ptr, ...) @printf(ptr noundef @.str.5, i32 noundef %92)
  %94 = load ptr, ptr @stdin, align 8, !tbaa !5
  %95 = call i32 @fclose(ptr noundef %94)
  %96 = load ptr, ptr @stdout, align 8, !tbaa !5
  %97 = call i32 @fclose(ptr noundef %96)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  ret i32 0
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #1

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

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

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

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

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

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

declare i32 @fclose(ptr noundef) #1

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

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 = { "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 = { 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 #4 = { inlinehint 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !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"

@n = external dso_local global i32, align 4
@a = external dso_local global [1000 x i32], align 16
@b = external dso_local global [1000 x i32], align 16
@num = external dso_local global [4 x [4 x i32]], align 16
@ans = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@.str.4 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.5 = 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 = load ptr, ptr @stdin, align 8, !tbaa !5
  %2 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %1)
  %3 = load ptr, ptr @stdout, align 8, !tbaa !5
  %4 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %3)
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.4, ptr noundef nonnull @n)
  %6 = load i32, ptr @n, align 4, !tbaa !9
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph, label %.._crit_edge_crit_edge

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

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

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.._crit_edge_crit_edge ], [ %13, %.lr.ph ]
  %15 = getelementptr inbounds i32, ptr @b, i64 %.pre-phi
  tail call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @b, ptr noundef nonnull %15)
  %16 = load i32, ptr @n, align 4, !tbaa !9
  %17 = icmp sgt i32 %16, 0
  br i1 %17, label %.lr.ph22.preheader, label %._crit_edge23

.lr.ph22.preheader:                               ; preds = %._crit_edge
  %wide.trip.count = zext nneg i32 %16 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %18 = icmp eq i32 %16, 1
  br i1 %18, label %._crit_edge23.loopexit.unr-lcssa, label %.lr.ph22.preheader.new

.lr.ph22.preheader.new:                           ; preds = %.lr.ph22.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  br label %.lr.ph22

.lr.ph22:                                         ; preds = %.lr.ph22, %.lr.ph22.preheader.new
  %indvars.iv26 = phi i64 [ 0, %.lr.ph22.preheader.new ], [ %indvars.iv.next27.1, %.lr.ph22 ]
  %niter = phi i64 [ 0, %.lr.ph22.preheader.new ], [ %niter.next.1, %.lr.ph22 ]
  %19 = getelementptr inbounds [1000 x i32], ptr @b, i64 0, i64 %indvars.iv26
  %20 = load i32, ptr %19, align 8, !tbaa !9
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %indvars.iv26
  %23 = load i32, ptr %22, align 8, !tbaa !9
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [4 x [4 x i32]], ptr @num, i64 0, i64 %21, i64 %24
  %26 = load i32, ptr %25, align 4, !tbaa !9
  %27 = add nsw i32 %26, 1
  store i32 %27, ptr %25, align 4, !tbaa !9
  %indvars.iv.next27 = or disjoint i64 %indvars.iv26, 1
  %28 = getelementptr inbounds [1000 x i32], ptr @b, i64 0, i64 %indvars.iv.next27
  %29 = load i32, ptr %28, align 4, !tbaa !9
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %indvars.iv.next27
  %32 = load i32, ptr %31, align 4, !tbaa !9
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [4 x [4 x i32]], ptr @num, i64 0, i64 %30, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !9
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %34, align 4, !tbaa !9
  %indvars.iv.next27.1 = add nuw nsw i64 %indvars.iv26, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge23.loopexit.unr-lcssa, label %.lr.ph22, !llvm.loop !13

._crit_edge23.loopexit.unr-lcssa:                 ; preds = %.lr.ph22, %.lr.ph22.preheader
  %indvars.iv26.unr = phi i64 [ 0, %.lr.ph22.preheader ], [ %indvars.iv.next27.1, %.lr.ph22 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge23, label %.lr.ph22.epil

.lr.ph22.epil:                                    ; preds = %._crit_edge23.loopexit.unr-lcssa
  %37 = getelementptr inbounds [1000 x i32], ptr @b, i64 0, i64 %indvars.iv26.unr
  %38 = load i32, ptr %37, align 4, !tbaa !9
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %indvars.iv26.unr
  %41 = load i32, ptr %40, align 4, !tbaa !9
  %42 = sext i32 %41 to i64
  %43 = getelementptr inbounds [4 x [4 x i32]], ptr @num, i64 0, i64 %39, i64 %42
  %44 = load i32, ptr %43, align 4, !tbaa !9
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %43, align 4, !tbaa !9
  br label %._crit_edge23

._crit_edge23:                                    ; preds = %.lr.ph22.epil, %._crit_edge23.loopexit.unr-lcssa, %._crit_edge
  %46 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @num, i64 24), ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @num, i64 36))
  %47 = load i32, ptr %46, align 4, !tbaa !9
  %48 = load i32, ptr getelementptr inbounds (i8, ptr @num, i64 24), align 8, !tbaa !9
  %49 = sub nsw i32 %48, %47
  store i32 %49, ptr getelementptr inbounds (i8, ptr @num, i64 24), align 8, !tbaa !9
  %50 = load i32, ptr getelementptr inbounds (i8, ptr @num, i64 36), align 4, !tbaa !9
  %51 = sub nsw i32 %50, %47
  store i32 %51, ptr getelementptr inbounds (i8, ptr @num, i64 36), align 4, !tbaa !9
  %52 = load i32, ptr @ans, align 4, !tbaa !9
  %53 = add nsw i32 %52, %47
  store i32 %53, ptr @ans, align 4, !tbaa !9
  %54 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @num, i64 28), ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @num, i64 52))
  %55 = load i32, ptr %54, align 4, !tbaa !9
  %56 = load i32, ptr getelementptr inbounds (i8, ptr @num, i64 28), align 4, !tbaa !9
  %57 = sub nsw i32 %56, %55
  store i32 %57, ptr getelementptr inbounds (i8, ptr @num, i64 28), align 4, !tbaa !9
  %58 = load i32, ptr getelementptr inbounds (i8, ptr @num, i64 52), align 4, !tbaa !9
  %59 = sub nsw i32 %58, %55
  store i32 %59, ptr getelementptr inbounds (i8, ptr @num, i64 52), align 4, !tbaa !9
  %60 = load i32, ptr @ans, align 4, !tbaa !9
  %61 = add nsw i32 %60, %55
  store i32 %61, ptr @ans, align 4, !tbaa !9
  %62 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @num, i64 44), ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @num, i64 56))
  %63 = load i32, ptr %62, align 4, !tbaa !9
  %64 = load i32, ptr getelementptr inbounds (i8, ptr @num, i64 44), align 4, !tbaa !9
  %65 = sub nsw i32 %64, %63
  store i32 %65, ptr getelementptr inbounds (i8, ptr @num, i64 44), align 4, !tbaa !9
  %66 = load i32, ptr getelementptr inbounds (i8, ptr @num, i64 56), align 8, !tbaa !9
  %67 = sub nsw i32 %66, %63
  store i32 %67, ptr getelementptr inbounds (i8, ptr @num, i64 56), align 8, !tbaa !9
  %68 = load i32, ptr @ans, align 4, !tbaa !9
  %69 = add nsw i32 %68, %63
  store i32 %69, ptr @ans, align 4, !tbaa !9
  %70 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @num, i64 24), ptr noundef nonnull align 4 dereferenceable(4) getelementptr inbounds (i8, ptr @num, i64 36))
  %71 = load i32, ptr %70, align 4, !tbaa !9
  %72 = shl i32 %71, 1
  %73 = load i32, ptr @ans, align 4, !tbaa !9
  %74 = add nsw i32 %73, %72
  store i32 %74, ptr @ans, align 4, !tbaa !9
  %75 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5, i32 noundef %74)
  %76 = load ptr, ptr @stdin, align 8, !tbaa !5
  %77 = tail call i32 @fclose(ptr noundef %76)
  %78 = load ptr, ptr @stdout, align 8, !tbaa !5
  %79 = tail call i32 @fclose(ptr noundef %78)
  ret i32 0
}

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), 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

; Function Attrs: nofree nounwind
declare noundef i32 @fclose(ptr nocapture noundef) local_unnamed_addr #2

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 = { "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 = { 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 #4 = { inlinehint 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" }

!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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}


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