; LLVM IR from nickmqb/muon :: bootstrap/mu.ll_Tag (argsEquals__)

; 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.tag_____Array__Tag____ = type { ptr, i32 }
%struct.tag_____Tag__ = type { ptr, ptr }

@top_____abandonFn__ = external dso_local thread_local global ptr, align 8

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #1

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

; Function Attrs: nounwind uwtable
define dso_local zeroext i8 @Tag__argsEquals__(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca i8, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca i32, align 4
  %8 = alloca i8, align 1
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #3
  %14 = load ptr, ptr %4, align 8, !tbaa !5
  %15 = icmp eq ptr %14, null
  %16 = zext i1 %15 to i32
  %17 = trunc i32 %16 to i8
  store i8 %17, ptr %6, align 1, !tbaa !9
  %18 = load i8, ptr %6, align 1, !tbaa !9
  %19 = icmp ne i8 %18, 0
  br i1 %19, label %20, label %25

20:                                               ; preds = %2
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = icmp eq ptr %21, null
  %23 = zext i1 %22 to i32
  %24 = trunc i32 %23 to i8
  store i8 %24, ptr %6, align 1, !tbaa !9
  br label %25

25:                                               ; preds = %20, %2
  %26 = load i8, ptr %6, align 1, !tbaa !9
  %27 = icmp ne i8 %26, 0
  br i1 %27, label %28, label %29

28:                                               ; preds = %25
  store i8 1, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %118

29:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #3
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = icmp eq ptr %30, null
  %32 = zext i1 %31 to i32
  %33 = trunc i32 %32 to i8
  store i8 %33, ptr %8, align 1, !tbaa !9
  %34 = load i8, ptr %8, align 1, !tbaa !9
  %35 = icmp ne i8 %34, 0
  br i1 %35, label %41, label %36

36:                                               ; preds = %29
  %37 = load ptr, ptr %5, align 8, !tbaa !5
  %38 = icmp eq ptr %37, null
  %39 = zext i1 %38 to i32
  %40 = trunc i32 %39 to i8
  store i8 %40, ptr %8, align 1, !tbaa !9
  br label %41

41:                                               ; preds = %36, %29
  %42 = load i8, ptr %8, align 1, !tbaa !9
  %43 = icmp ne i8 %42, 0
  br i1 %43, label %44, label %45

44:                                               ; preds = %41
  store i8 0, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %117

45:                                               ; preds = %41
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.tag_____Array__Tag____, ptr %46, i32 0, i32 1
  %48 = load i32, ptr %47, align 8, !tbaa !10
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.tag_____Array__Tag____, ptr %49, i32 0, i32 1
  %51 = load i32, ptr %50, align 8, !tbaa !10
  %52 = icmp ne i32 %48, %51
  br i1 %52, label %53, label %54

53:                                               ; preds = %45
  store i8 0, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %117

54:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #3
  store i32 0, ptr %9, align 4, !tbaa !13
  br label %55

55:                                               ; preds = %112, %54
  %56 = load i32, ptr %9, align 4, !tbaa !13
  %57 = load ptr, ptr %4, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.tag_____Array__Tag____, ptr %57, i32 0, i32 1
  %59 = load i32, ptr %58, align 8, !tbaa !10
  %60 = icmp slt i32 %56, %59
  br i1 %60, label %61, label %113

61:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %62 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %62, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %63 = load i32, ptr %9, align 4, !tbaa !13
  store i32 %63, ptr %11, align 4, !tbaa !13
  %64 = load i32, ptr %11, align 4, !tbaa !13
  %65 = load ptr, ptr %10, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.tag_____Array__Tag____, ptr %65, i32 0, i32 1
  %67 = load i32, ptr %66, align 8, !tbaa !10
  %68 = icmp ult i32 %64, %67
  br i1 %68, label %72, label %69

69:                                               ; preds = %61
  %70 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____abandonFn__)
  %71 = load ptr, ptr %70, align 8, !tbaa !5
  call void %71(i32 noundef -3)
  br label %72

72:                                               ; preds = %69, %61
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %73 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %73, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #3
  %74 = load i32, ptr %9, align 4, !tbaa !13
  store i32 %74, ptr %13, align 4, !tbaa !13
  %75 = load i32, ptr %13, align 4, !tbaa !13
  %76 = load ptr, ptr %12, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.tag_____Array__Tag____, ptr %76, i32 0, i32 1
  %78 = load i32, ptr %77, align 8, !tbaa !10
  %79 = icmp ult i32 %75, %78
  br i1 %79, label %83, label %80

80:                                               ; preds = %72
  %81 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____abandonFn__)
  %82 = load ptr, ptr %81, align 8, !tbaa !5
  call void %82(i32 noundef -3)
  br label %83

83:                                               ; preds = %80, %72
  %84 = load ptr, ptr %10, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.tag_____Array__Tag____, ptr %84, i32 0, i32 0
  %86 = load ptr, ptr %85, align 8, !tbaa !14
  %87 = load i32, ptr %11, align 4, !tbaa !13
  %88 = zext i32 %87 to i64
  %89 = getelementptr inbounds %struct.tag_____Tag__, ptr %86, i64 %88
  %90 = load ptr, ptr %12, align 8, !tbaa !5
  %91 = getelementptr inbounds %struct.tag_____Array__Tag____, ptr %90, i32 0, i32 0
  %92 = load ptr, ptr %91, align 8, !tbaa !14
  %93 = load i32, ptr %13, align 4, !tbaa !13
  %94 = zext i32 %93 to i64
  %95 = getelementptr inbounds %struct.tag_____Tag__, ptr %92, i64 %94
  %96 = getelementptr inbounds { ptr, ptr }, ptr %89, i32 0, i32 0
  %97 = load ptr, ptr %96, align 8
  %98 = getelementptr inbounds { ptr, ptr }, ptr %89, i32 0, i32 1
  %99 = load ptr, ptr %98, align 8
  %100 = getelementptr inbounds { ptr, ptr }, ptr %95, i32 0, i32 0
  %101 = load ptr, ptr %100, align 8
  %102 = getelementptr inbounds { ptr, ptr }, ptr %95, i32 0, i32 1
  %103 = load ptr, ptr %102, align 8
  %104 = call zeroext i8 @Tag__equals__(ptr %97, ptr %99, ptr %101, ptr %103)
  %105 = icmp ne i8 %104, 0
  br i1 %105, label %107, label %106

106:                                              ; preds = %83
  store i8 0, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %110

107:                                              ; preds = %83
  %108 = load i32, ptr %9, align 4, !tbaa !13
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr %9, align 4, !tbaa !13
  store i32 0, ptr %7, align 4
  br label %110

110:                                              ; preds = %107, %106
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  %111 = load i32, ptr %7, align 4
  switch i32 %111, label %114 [
    i32 0, label %112
  ]

112:                                              ; preds = %110
  br label %55, !llvm.loop !15

113:                                              ; preds = %55
  store i32 0, ptr %7, align 4
  br label %114

114:                                              ; preds = %113, %110
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #3
  %115 = load i32, ptr %7, align 4
  switch i32 %115, label %117 [
    i32 0, label %116
  ]

116:                                              ; preds = %114
  store i8 1, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %117

117:                                              ; preds = %116, %114, %53, %44
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #3
  br label %118

118:                                              ; preds = %117, %28
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #3
  %119 = load i8, ptr %3, align 1
  ret i8 %119
}

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @Tag__equals__(ptr, ptr, ptr, ptr) #2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { 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 #3 = { 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/C++ TBAA"}
!9 = !{!7, !7, i64 0}
!10 = !{!11, !12, i64 8}
!11 = !{!"tag_____Array__Tag____", !6, i64 0, !12, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!12, !12, i64 0}
!14 = !{!11, !6, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"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"

%struct.tag_____Tag__ = type { ptr, ptr }

@top_____abandonFn__ = external dso_local thread_local local_unnamed_addr global ptr, align 8

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #0

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i8 @Tag__argsEquals__(ptr noundef readonly %0, ptr noundef readonly %1) local_unnamed_addr #1 {
  %3 = icmp ne ptr %0, null
  %4 = icmp ne ptr %1, null
  %spec.select = or i1 %3, %4
  br i1 %spec.select, label %5, label %34

5:                                                ; preds = %2
  %spec.select39 = and i1 %3, %4
  br i1 %spec.select39, label %6, label %34

6:                                                ; preds = %5
  %7 = getelementptr inbounds i8, ptr %0, i64 8
  %8 = load i32, ptr %7, align 8, !tbaa !5
  %9 = getelementptr inbounds i8, ptr %1, i64 8
  %10 = load i32, ptr %9, align 8, !tbaa !5
  %.not = icmp eq i32 %8, %10
  br i1 %.not, label %.preheader, label %34

.preheader:                                       ; preds = %6
  %11 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____abandonFn__)
  br label %12

12:                                               ; preds = %.preheader, %21
  %indvars.iv = phi i64 [ 0, %.preheader ], [ %indvars.iv.next, %21 ]
  %13 = load i32, ptr %7, align 8, !tbaa !5
  %14 = sext i32 %13 to i64
  %.not38.not = icmp sge i64 %indvars.iv, %14
  br i1 %.not38.not, label %33, label %15

15:                                               ; preds = %12
  %16 = load i32, ptr %9, align 8, !tbaa !5
  %17 = zext i32 %16 to i64
  %18 = icmp ult i64 %indvars.iv, %17
  br i1 %18, label %21, label %19

19:                                               ; preds = %15
  %20 = load ptr, ptr %11, align 8, !tbaa !11
  tail call void %20(i32 noundef -3) #2
  br label %21

21:                                               ; preds = %19, %15
  %22 = load ptr, ptr %0, align 8, !tbaa !12
  %23 = getelementptr inbounds %struct.tag_____Tag__, ptr %22, i64 %indvars.iv
  %24 = load ptr, ptr %1, align 8, !tbaa !12
  %25 = getelementptr inbounds %struct.tag_____Tag__, ptr %24, i64 %indvars.iv
  %26 = load ptr, ptr %23, align 8
  %27 = getelementptr inbounds i8, ptr %23, i64 8
  %28 = load ptr, ptr %27, align 8
  %29 = load ptr, ptr %25, align 8
  %30 = getelementptr inbounds i8, ptr %25, i64 8
  %31 = load ptr, ptr %30, align 8
  %32 = tail call zeroext i8 @Tag__equals__(ptr %26, ptr %28, ptr %29, ptr %31)
  %.not37.not = icmp eq i8 %32, 0
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  br i1 %.not37.not, label %33, label %12, !llvm.loop !13

33:                                               ; preds = %12, %21
  %spec.select40 = zext i1 %.not38.not to i8
  br label %34

34:                                               ; preds = %33, %5, %6, %2
  %.4 = phi i8 [ 1, %2 ], [ 0, %5 ], [ 0, %6 ], [ %spec.select40, %33 ]
  ret i8 %.4
}

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @Tag__equals__(ptr, ptr, ptr, ptr) local_unnamed_addr #1

attributes #0 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { 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 = { 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, !10, i64 8}
!6 = !{!"tag_____Array__Tag____", !7, i64 0, !10, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!7, !7, i64 0}
!12 = !{!6, !7, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: ConstraintEliminationPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass