; LLVM IR from lzyrapx/Competitive-Programming :: HDUOJ/2115.ll (Z3cmp4nodeS_)

; 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 { [10 x i8], i32, i32 }

; Function Attrs: mustprogress nounwind uwtable
define dso_local noundef zeroext i1 @_Z3cmp4nodeS_(ptr noundef byval(%struct.node) align 8 %0, ptr noundef byval(%struct.node) align 8 %1) #0 {
  %3 = alloca i1, align 1
  %4 = getelementptr inbounds %struct.node, ptr %0, i32 0, i32 1
  %5 = load i32, ptr %4, align 4, !tbaa !5
  %6 = getelementptr inbounds %struct.node, ptr %1, i32 0, i32 1
  %7 = load i32, ptr %6, align 4, !tbaa !5
  %8 = icmp eq i32 %5, %7
  br i1 %8, label %9, label %22

9:                                                ; preds = %2
  %10 = getelementptr inbounds %struct.node, ptr %0, i32 0, i32 2
  %11 = load i32, ptr %10, align 8, !tbaa !10
  %12 = getelementptr inbounds %struct.node, ptr %1, i32 0, i32 2
  %13 = load i32, ptr %12, align 8, !tbaa !10
  %14 = icmp eq i32 %11, %13
  br i1 %14, label %15, label %22

15:                                               ; preds = %9
  %16 = getelementptr inbounds %struct.node, ptr %0, i32 0, i32 0
  %17 = getelementptr inbounds [10 x i8], ptr %16, i64 0, i64 0
  %18 = getelementptr inbounds %struct.node, ptr %1, i32 0, i32 0
  %19 = getelementptr inbounds [10 x i8], ptr %18, i64 0, i64 0
  %20 = call i32 @strcmp(ptr noundef %17, ptr noundef %19) #2
  %21 = icmp slt i32 %20, 0
  store i1 %21, ptr %3, align 1
  br label %41

22:                                               ; preds = %9, %2
  %23 = getelementptr inbounds %struct.node, ptr %0, i32 0, i32 1
  %24 = load i32, ptr %23, align 4, !tbaa !5
  %25 = getelementptr inbounds %struct.node, ptr %1, i32 0, i32 1
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = icmp eq i32 %24, %26
  br i1 %27, label %28, label %34

28:                                               ; preds = %22
  %29 = getelementptr inbounds %struct.node, ptr %0, i32 0, i32 2
  %30 = load i32, ptr %29, align 8, !tbaa !10
  %31 = getelementptr inbounds %struct.node, ptr %1, i32 0, i32 2
  %32 = load i32, ptr %31, align 8, !tbaa !10
  %33 = icmp slt i32 %30, %32
  store i1 %33, ptr %3, align 1
  br label %41

34:                                               ; preds = %22
  br label %35

35:                                               ; preds = %34
  %36 = getelementptr inbounds %struct.node, ptr %0, i32 0, i32 1
  %37 = load i32, ptr %36, align 4, !tbaa !5
  %38 = getelementptr inbounds %struct.node, ptr %1, i32 0, i32 1
  %39 = load i32, ptr %38, align 4, !tbaa !5
  %40 = icmp slt i32 %37, %39
  store i1 %40, ptr %3, align 1
  br label %41

41:                                               ; preds = %35, %28, %15
  %42 = load i1, ptr %3, align 1
  ret i1 %42
}

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #1

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 = { nounwind willreturn memory(read) "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 = { nounwind willreturn memory(read) }

!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, !9, i64 12}
!6 = !{!"_ZTS4node", !7, i64 0, !9, i64 12, !9, i64 16}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!6, !9, i64 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 { [10 x i8], i32, i32 }

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read) uwtable
define dso_local noundef zeroext i1 @_Z3cmp4nodeS_(ptr nocapture noundef readonly byval(%struct.node) align 8 %0, ptr nocapture noundef readonly byval(%struct.node) align 8 %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 12
  %4 = load i32, ptr %3, align 4, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %1, i64 12
  %6 = load i32, ptr %5, align 4, !tbaa !5
  %7 = icmp eq i32 %4, %6
  br i1 %7, label %8, label %19

8:                                                ; preds = %2
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  %10 = load i32, ptr %9, align 8, !tbaa !10
  %11 = getelementptr inbounds i8, ptr %1, i64 16
  %12 = load i32, ptr %11, align 8, !tbaa !10
  %13 = icmp eq i32 %10, %12
  br i1 %13, label %14, label %17

14:                                               ; preds = %8
  %15 = call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %0, ptr noundef nonnull dereferenceable(1) %1) #2
  %16 = icmp slt i32 %15, 0
  br label %21

17:                                               ; preds = %8
  %18 = icmp slt i32 %10, %12
  br label %21

19:                                               ; preds = %2
  %20 = icmp slt i32 %4, %6
  br label %21

21:                                               ; preds = %19, %17, %14
  %.0 = phi i1 [ %16, %14 ], [ %18, %17 ], [ %20, %19 ]
  ret i1 %.0
}

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #1

attributes #0 = { mustprogress nofree 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" }
attributes #1 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 = { nounwind willreturn memory(read) }

!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, !9, i64 12}
!6 = !{!"_ZTS4node", !7, i64 0, !9, i64 12, !9, i64 16}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!"int", !7, i64 0}
!10 = !{!6, !9, i64 16}


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