; LLVM IR from DionysiosB/CodeForces :: 0001-0099/19A-WorldFootballCup.ll (Z11perfCompare4perfS_)

; 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.perf = type { %"class.std::__cxx11::basic_string", i64, i64, i64 }
%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z11perfCompare4perfS_(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %6 = getelementptr inbounds %struct.perf, ptr %0, i32 0, i32 1
  %7 = load i64, ptr %6, align 8, !tbaa !9
  %8 = getelementptr inbounds %struct.perf, ptr %1, i32 0, i32 1
  %9 = load i64, ptr %8, align 8, !tbaa !9
  %10 = icmp sgt i64 %7, %9
  br i1 %10, label %11, label %12

11:                                               ; preds = %2
  store i1 true, ptr %3, align 1
  br label %47

12:                                               ; preds = %2
  %13 = getelementptr inbounds %struct.perf, ptr %0, i32 0, i32 1
  %14 = load i64, ptr %13, align 8, !tbaa !9
  %15 = getelementptr inbounds %struct.perf, ptr %1, i32 0, i32 1
  %16 = load i64, ptr %15, align 8, !tbaa !9
  %17 = icmp eq i64 %14, %16
  br i1 %17, label %18, label %25

18:                                               ; preds = %12
  %19 = getelementptr inbounds %struct.perf, ptr %0, i32 0, i32 2
  %20 = load i64, ptr %19, align 8, !tbaa !14
  %21 = getelementptr inbounds %struct.perf, ptr %1, i32 0, i32 2
  %22 = load i64, ptr %21, align 8, !tbaa !14
  %23 = icmp sgt i64 %20, %22
  br i1 %23, label %24, label %25

24:                                               ; preds = %18
  store i1 true, ptr %3, align 1
  br label %47

25:                                               ; preds = %18, %12
  %26 = getelementptr inbounds %struct.perf, ptr %0, i32 0, i32 1
  %27 = load i64, ptr %26, align 8, !tbaa !9
  %28 = getelementptr inbounds %struct.perf, ptr %1, i32 0, i32 1
  %29 = load i64, ptr %28, align 8, !tbaa !9
  %30 = icmp eq i64 %27, %29
  br i1 %30, label %31, label %44

31:                                               ; preds = %25
  %32 = getelementptr inbounds %struct.perf, ptr %0, i32 0, i32 2
  %33 = load i64, ptr %32, align 8, !tbaa !14
  %34 = getelementptr inbounds %struct.perf, ptr %1, i32 0, i32 2
  %35 = load i64, ptr %34, align 8, !tbaa !14
  %36 = icmp eq i64 %33, %35
  br i1 %36, label %37, label %44

37:                                               ; preds = %31
  %38 = getelementptr inbounds %struct.perf, ptr %0, i32 0, i32 3
  %39 = load i64, ptr %38, align 8, !tbaa !15
  %40 = getelementptr inbounds %struct.perf, ptr %1, i32 0, i32 3
  %41 = load i64, ptr %40, align 8, !tbaa !15
  %42 = icmp sgt i64 %39, %41
  br i1 %42, label %43, label %44

43:                                               ; preds = %37
  store i1 true, ptr %3, align 1
  br label %47

44:                                               ; preds = %37, %31, %25
  br label %45

45:                                               ; preds = %44
  br label %46

46:                                               ; preds = %45
  store i1 false, ptr %3, align 1
  br label %47

47:                                               ; preds = %46, %43, %24, %11
  %48 = load i1, ptr %3, align 1
  ret i1 %48
}

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

!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, !13, i64 32}
!10 = !{!"_ZTS4perf", !11, i64 0, !13, i64 32, !13, i64 40, !13, i64 48}
!11 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !12, i64 0, !13, i64 8, !7, i64 16}
!12 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !6, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!10, !13, i64 40}
!15 = !{!10, !13, i64 48}


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

; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) uwtable
define dso_local noundef zeroext i1 @_Z11perfCompare4perfS_(ptr nocapture noundef readonly %0, ptr nocapture noundef readonly %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 32
  %4 = load i64, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %1, i64 32
  %6 = load i64, ptr %5, align 8, !tbaa !5
  %7 = icmp sgt i64 %4, %6
  br i1 %7, label %25, label %8

8:                                                ; preds = %2
  %9 = icmp eq i64 %4, %6
  br i1 %9, label %10, label %24

10:                                               ; preds = %8
  %11 = getelementptr inbounds i8, ptr %0, i64 40
  %12 = load i64, ptr %11, align 8, !tbaa !13
  %13 = getelementptr inbounds i8, ptr %1, i64 40
  %14 = load i64, ptr %13, align 8, !tbaa !13
  %15 = icmp sgt i64 %12, %14
  br i1 %15, label %25, label %16

16:                                               ; preds = %10
  %17 = icmp eq i64 %12, %14
  br i1 %17, label %18, label %24

18:                                               ; preds = %16
  %19 = getelementptr inbounds i8, ptr %0, i64 48
  %20 = load i64, ptr %19, align 8, !tbaa !14
  %21 = getelementptr inbounds i8, ptr %1, i64 48
  %22 = load i64, ptr %21, align 8, !tbaa !14
  %23 = icmp sgt i64 %20, %22
  br i1 %23, label %25, label %24

24:                                               ; preds = %8, %18, %16
  br label %25

25:                                               ; preds = %18, %10, %2, %24
  %.0 = phi i1 [ false, %24 ], [ true, %2 ], [ true, %10 ], [ true, %18 ]
  ret i1 %.0
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: read) 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, !12, i64 32}
!6 = !{!"_ZTS4perf", !7, i64 0, !12, i64 32, !12, i64 40, !12, i64 48}
!7 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE", !8, i64 0, !12, i64 8, !10, i64 16}
!8 = !{!"_ZTSNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE12_Alloc_hiderE", !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !11, i64 0}
!11 = !{!"Simple C++ TBAA"}
!12 = !{!"long", !10, i64 0}
!13 = !{!6, !12, i64 40}
!14 = !{!6, !12, i64 48}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass