; LLVM IR from DionysiosB/CodeForces :: 0400-0499 (411C-Kicker)

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

@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3fbsiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3sbfiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) #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 [4 x i32], align 16
  %4 = alloca [4 x i32], align 16
  %5 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 4, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %6

6:                                                ; preds = %20, %0
  %7 = load i32, ptr %5, align 4, !tbaa !5
  %8 = icmp slt i32 %7, 4
  br i1 %8, label %10, label %9

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

10:                                               ; preds = %6
  %11 = getelementptr inbounds [4 x i32], ptr %3, i64 0, i64 0
  %12 = load i32, ptr %5, align 4, !tbaa !5
  %13 = sext i32 %12 to i64
  %14 = getelementptr inbounds i32, ptr %11, i64 %13
  %15 = getelementptr inbounds [4 x i32], ptr %4, i64 0, i64 0
  %16 = load i32, ptr %5, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds i32, ptr %15, i64 %17
  %19 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %14, ptr noundef %18)
  br label %20

20:                                               ; preds = %10
  %21 = load i32, ptr %5, align 4, !tbaa !5
  %22 = add nsw i32 %21, 1
  store i32 %22, ptr %5, align 4, !tbaa !5
  br label %6, !llvm.loop !9

23:                                               ; preds = %9
  %24 = getelementptr inbounds [4 x i32], ptr %3, i64 0, i64 0
  %25 = load i32, ptr %24, align 16, !tbaa !5
  %26 = getelementptr inbounds [4 x i32], ptr %4, i64 0, i64 1
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %28 = getelementptr inbounds [4 x i32], ptr %3, i64 0, i64 2
  %29 = load i32, ptr %28, align 8, !tbaa !5
  %30 = getelementptr inbounds [4 x i32], ptr %4, i64 0, i64 3
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = call noundef zeroext i1 @_Z3fbsiiii(i32 noundef %25, i32 noundef %27, i32 noundef %29, i32 noundef %31)
  br i1 %32, label %33, label %43

33:                                               ; preds = %23
  %34 = getelementptr inbounds [4 x i32], ptr %3, i64 0, i64 0
  %35 = load i32, ptr %34, align 16, !tbaa !5
  %36 = getelementptr inbounds [4 x i32], ptr %4, i64 0, i64 1
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = getelementptr inbounds [4 x i32], ptr %3, i64 0, i64 3
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = getelementptr inbounds [4 x i32], ptr %4, i64 0, i64 2
  %41 = load i32, ptr %40, align 8, !tbaa !5
  %42 = call noundef zeroext i1 @_Z3fbsiiii(i32 noundef %35, i32 noundef %37, i32 noundef %39, i32 noundef %41)
  br i1 %42, label %63, label %43

43:                                               ; preds = %33, %23
  %44 = getelementptr inbounds [4 x i32], ptr %3, i64 0, i64 1
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = getelementptr inbounds [4 x i32], ptr %4, i64 0, i64 0
  %47 = load i32, ptr %46, align 16, !tbaa !5
  %48 = getelementptr inbounds [4 x i32], ptr %3, i64 0, i64 2
  %49 = load i32, ptr %48, align 8, !tbaa !5
  %50 = getelementptr inbounds [4 x i32], ptr %4, i64 0, i64 3
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = call noundef zeroext i1 @_Z3fbsiiii(i32 noundef %45, i32 noundef %47, i32 noundef %49, i32 noundef %51)
  br i1 %52, label %53, label %65

53:                                               ; preds = %43
  %54 = getelementptr inbounds [4 x i32], ptr %3, i64 0, i64 1
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %56 = getelementptr inbounds [4 x i32], ptr %4, i64 0, i64 0
  %57 = load i32, ptr %56, align 16, !tbaa !5
  %58 = getelementptr inbounds [4 x i32], ptr %3, i64 0, i64 3
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = getelementptr inbounds [4 x i32], ptr %4, i64 0, i64 2
  %61 = load i32, ptr %60, align 8, !tbaa !5
  %62 = call noundef zeroext i1 @_Z3fbsiiii(i32 noundef %55, i32 noundef %57, i32 noundef %59, i32 noundef %61)
  br i1 %62, label %63, label %65

63:                                               ; preds = %53, %33
  %64 = call i32 @puts(ptr noundef @.str.1)
  br label %110

65:                                               ; preds = %53, %43
  %66 = getelementptr inbounds [4 x i32], ptr %3, i64 0, i64 0
  %67 = load i32, ptr %66, align 16, !tbaa !5
  %68 = getelementptr inbounds [4 x i32], ptr %4, i64 0, i64 1
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = getelementptr inbounds [4 x i32], ptr %3, i64 0, i64 2
  %71 = load i32, ptr %70, align 8, !tbaa !5
  %72 = getelementptr inbounds [4 x i32], ptr %4, i64 0, i64 3
  %73 = load i32, ptr %72, align 4, !tbaa !5
  %74 = call noundef zeroext i1 @_Z3sbfiiii(i32 noundef %67, i32 noundef %69, i32 noundef %71, i32 noundef %73)
  br i1 %74, label %85, label %75

75:                                               ; preds = %65
  %76 = getelementptr inbounds [4 x i32], ptr %3, i64 0, i64 0
  %77 = load i32, ptr %76, align 16, !tbaa !5
  %78 = getelementptr inbounds [4 x i32], ptr %4, i64 0, i64 1
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = getelementptr inbounds [4 x i32], ptr %3, i64 0, i64 3
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = getelementptr inbounds [4 x i32], ptr %4, i64 0, i64 2
  %83 = load i32, ptr %82, align 8, !tbaa !5
  %84 = call noundef zeroext i1 @_Z3sbfiiii(i32 noundef %77, i32 noundef %79, i32 noundef %81, i32 noundef %83)
  br i1 %84, label %85, label %107

85:                                               ; preds = %75, %65
  %86 = getelementptr inbounds [4 x i32], ptr %3, i64 0, i64 1
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = getelementptr inbounds [4 x i32], ptr %4, i64 0, i64 0
  %89 = load i32, ptr %88, align 16, !tbaa !5
  %90 = getelementptr inbounds [4 x i32], ptr %3, i64 0, i64 2
  %91 = load i32, ptr %90, align 8, !tbaa !5
  %92 = getelementptr inbounds [4 x i32], ptr %4, i64 0, i64 3
  %93 = load i32, ptr %92, align 4, !tbaa !5
  %94 = call noundef zeroext i1 @_Z3sbfiiii(i32 noundef %87, i32 noundef %89, i32 noundef %91, i32 noundef %93)
  br i1 %94, label %105, label %95

95:                                               ; preds = %85
  %96 = getelementptr inbounds [4 x i32], ptr %3, i64 0, i64 1
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = getelementptr inbounds [4 x i32], ptr %4, i64 0, i64 0
  %99 = load i32, ptr %98, align 16, !tbaa !5
  %100 = getelementptr inbounds [4 x i32], ptr %3, i64 0, i64 3
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = getelementptr inbounds [4 x i32], ptr %4, i64 0, i64 2
  %103 = load i32, ptr %102, align 8, !tbaa !5
  %104 = call noundef zeroext i1 @_Z3sbfiiii(i32 noundef %97, i32 noundef %99, i32 noundef %101, i32 noundef %103)
  br i1 %104, label %105, label %107

105:                                              ; preds = %95, %85
  %106 = call i32 @puts(ptr noundef @.str.2)
  br label %109

107:                                              ; preds = %95, %75
  %108 = call i32 @puts(ptr noundef @.str.3)
  br label %109

109:                                              ; preds = %107, %105
  br label %110

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

; 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, ...) #3

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

declare i32 @puts(ptr noundef) #3

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}


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

@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3fbsiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z3sbfiiii(i32 noundef, i32 noundef, i32 noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = alloca [4 x i32], align 16
  %2 = alloca [4 x i32], align 16
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %1) #4
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #4
  %3 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %4 = getelementptr inbounds i8, ptr %1, i64 4
  %5 = getelementptr inbounds i8, ptr %2, i64 4
  %6 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %4, ptr noundef nonnull %5)
  %7 = getelementptr inbounds i8, ptr %1, i64 8
  %8 = getelementptr inbounds i8, ptr %2, i64 8
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %7, ptr noundef nonnull %8)
  %10 = getelementptr inbounds i8, ptr %1, i64 12
  %11 = getelementptr inbounds i8, ptr %2, i64 12
  %12 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %10, ptr noundef nonnull %11)
  %13 = load i32, ptr %1, align 16, !tbaa !5
  %14 = load i32, ptr %5, align 4, !tbaa !5
  %15 = load i32, ptr %7, align 8, !tbaa !5
  %16 = load i32, ptr %11, align 4, !tbaa !5
  %17 = call noundef zeroext i1 @_Z3fbsiiii(i32 noundef %13, i32 noundef %14, i32 noundef %15, i32 noundef %16)
  br i1 %17, label %18, label %24

18:                                               ; preds = %0
  %19 = load i32, ptr %1, align 16, !tbaa !5
  %20 = load i32, ptr %5, align 4, !tbaa !5
  %21 = load i32, ptr %10, align 4, !tbaa !5
  %22 = load i32, ptr %8, align 8, !tbaa !5
  %23 = call noundef zeroext i1 @_Z3fbsiiii(i32 noundef %19, i32 noundef %20, i32 noundef %21, i32 noundef %22)
  br i1 %23, label %61, label %24

24:                                               ; preds = %18, %0
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = load i32, ptr %2, align 16, !tbaa !5
  %27 = load i32, ptr %7, align 8, !tbaa !5
  %28 = load i32, ptr %11, align 4, !tbaa !5
  %29 = call noundef zeroext i1 @_Z3fbsiiii(i32 noundef %25, i32 noundef %26, i32 noundef %27, i32 noundef %28)
  br i1 %29, label %30, label %36

30:                                               ; preds = %24
  %31 = load i32, ptr %4, align 4, !tbaa !5
  %32 = load i32, ptr %2, align 16, !tbaa !5
  %33 = load i32, ptr %10, align 4, !tbaa !5
  %34 = load i32, ptr %8, align 8, !tbaa !5
  %35 = call noundef zeroext i1 @_Z3fbsiiii(i32 noundef %31, i32 noundef %32, i32 noundef %33, i32 noundef %34)
  br i1 %35, label %61, label %36

36:                                               ; preds = %30, %24
  %37 = load i32, ptr %1, align 16, !tbaa !5
  %38 = load i32, ptr %5, align 4, !tbaa !5
  %39 = load i32, ptr %7, align 8, !tbaa !5
  %40 = load i32, ptr %11, align 4, !tbaa !5
  %41 = call noundef zeroext i1 @_Z3sbfiiii(i32 noundef %37, i32 noundef %38, i32 noundef %39, i32 noundef %40)
  br i1 %41, label %48, label %42

42:                                               ; preds = %36
  %43 = load i32, ptr %1, align 16, !tbaa !5
  %44 = load i32, ptr %5, align 4, !tbaa !5
  %45 = load i32, ptr %10, align 4, !tbaa !5
  %46 = load i32, ptr %8, align 8, !tbaa !5
  %47 = call noundef zeroext i1 @_Z3sbfiiii(i32 noundef %43, i32 noundef %44, i32 noundef %45, i32 noundef %46)
  br i1 %47, label %48, label %60

48:                                               ; preds = %42, %36
  %49 = load i32, ptr %4, align 4, !tbaa !5
  %50 = load i32, ptr %2, align 16, !tbaa !5
  %51 = load i32, ptr %7, align 8, !tbaa !5
  %52 = load i32, ptr %11, align 4, !tbaa !5
  %53 = call noundef zeroext i1 @_Z3sbfiiii(i32 noundef %49, i32 noundef %50, i32 noundef %51, i32 noundef %52)
  br i1 %53, label %61, label %54

54:                                               ; preds = %48
  %55 = load i32, ptr %4, align 4, !tbaa !5
  %56 = load i32, ptr %2, align 16, !tbaa !5
  %57 = load i32, ptr %10, align 4, !tbaa !5
  %58 = load i32, ptr %8, align 8, !tbaa !5
  %59 = call noundef zeroext i1 @_Z3sbfiiii(i32 noundef %55, i32 noundef %56, i32 noundef %57, i32 noundef %58)
  br i1 %59, label %61, label %60

60:                                               ; preds = %54, %42
  br label %61

61:                                               ; preds = %48, %54, %18, %30, %60
  %.str.2.sink = phi ptr [ @.str.3, %60 ], [ @.str.1, %30 ], [ @.str.1, %18 ], [ @.str.2, %54 ], [ @.str.2, %48 ]
  %62 = call i32 @puts(ptr noundef nonnull dereferenceable(1) %.str.2.sink)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %1) #4
  ret i32 0
}

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

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

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

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

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass