; LLVM IR from nickmqb/muon :: bootstrap/mu.ll_CGenerator (genComputeHash__)

; 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.string__ = type { ptr, i32 }
%struct.tag_____Tag__ = type { ptr, ptr }
%struct.tag_____CallExpression__ = type { %struct.Node__, ptr, ptr, ptr, ptr, ptr }
%struct.Node__ = type { i32, ptr }
%struct.tag_____List__Node____ = type { ptr, i32, i32 }
%struct.tag_____Namespace__ = type { %struct.string__, ptr, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32 }
%struct.tag_____GenerateContext__ = type { ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, ptr, ptr, %struct.string__, i32, %struct.string__, i32, ptr, ptr, i8 }
%struct.tag_____CommonTags__ = type { %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, %struct.tag_____Tag__, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

@mu_____string303 = external dso_local global %struct.string__, align 8
@mu_____string511 = external dso_local global %struct.string__, align 8
@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: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nounwind uwtable
declare dso_local void @StringBuilder__write__(ptr noundef, ptr, i32) #3

; Function Attrs: nounwind uwtable
declare dso_local { ptr, ptr } @CGenerator__nodeTag__(ptr noundef, i32, ptr) #3

; Function Attrs: nounwind uwtable
declare dso_local void @CGenerator__genExpression__(ptr noundef, i32, ptr, ptr noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local void @CGenerator__writeNs__(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local void @CGenerator__genComputeHash__(ptr noundef %0, ptr noundef %1, ptr noundef %2) #3 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca %struct.tag_____Tag__, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.tag_____CallExpression__, ptr %12, i32 0, i32 2
  %14 = load ptr, ptr %13, align 8, !tbaa !9
  store ptr %14, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !13
  %15 = load i32, ptr %8, align 4, !tbaa !13
  %16 = load ptr, ptr %7, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.tag_____List__Node____, ptr %16, i32 0, i32 1
  %18 = load i32, ptr %17, align 8, !tbaa !14
  %19 = icmp ult i32 %15, %18
  br i1 %19, label %23, label %20

20:                                               ; preds = %3
  %21 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____abandonFn__)
  %22 = load ptr, ptr %21, align 8, !tbaa !5
  call void %22(i32 noundef -3)
  br label %23

23:                                               ; preds = %20, %3
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #4
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.tag_____List__Node____, ptr %25, i32 0, i32 0
  %27 = load ptr, ptr %26, align 8, !tbaa !16
  %28 = load i32, ptr %8, align 4, !tbaa !13
  %29 = zext i32 %28 to i64
  %30 = getelementptr inbounds %struct.Node__, ptr %27, i64 %29
  %31 = getelementptr inbounds { i32, ptr }, ptr %30, i32 0, i32 0
  %32 = load i32, ptr %31, align 8
  %33 = getelementptr inbounds { i32, ptr }, ptr %30, i32 0, i32 1
  %34 = load ptr, ptr %33, align 8
  %35 = call { ptr, ptr } @CGenerator__nodeTag__(ptr noundef %24, i32 %32, ptr %34)
  %36 = getelementptr inbounds { ptr, ptr }, ptr %9, i32 0, i32 0
  %37 = extractvalue { ptr, ptr } %35, 0
  store ptr %37, ptr %36, align 8
  %38 = getelementptr inbounds { ptr, ptr }, ptr %9, i32 0, i32 1
  %39 = extractvalue { ptr, ptr } %35, 1
  store ptr %39, ptr %38, align 8
  %40 = getelementptr inbounds %struct.tag_____Tag__, ptr %9, i32 0, i32 0
  %41 = load ptr, ptr %40, align 8, !tbaa !17
  %42 = getelementptr inbounds %struct.tag_____Namespace__, ptr %41, i32 0, i32 3
  %43 = load i32, ptr %42, align 4, !tbaa !19
  %44 = and i32 %43, 196736
  %45 = icmp ne i32 %44, 0
  br i1 %45, label %46, label %51

46:                                               ; preds = %23
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %47, i32 0, i32 4
  %49 = load ptr, ptr %48, align 8, !tbaa !22
  %50 = getelementptr inbounds %struct.tag_____CommonTags__, ptr %49, i32 0, i32 18
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 %50, i64 16, i1 false), !tbaa.struct !24
  br label %64

51:                                               ; preds = %23
  %52 = getelementptr inbounds %struct.tag_____Tag__, ptr %9, i32 0, i32 0
  %53 = load ptr, ptr %52, align 8, !tbaa !17
  %54 = getelementptr inbounds %struct.tag_____Namespace__, ptr %53, i32 0, i32 3
  %55 = load i32, ptr %54, align 4, !tbaa !19
  %56 = and i32 %55, 2048
  %57 = icmp ne i32 %56, 0
  br i1 %57, label %58, label %63

58:                                               ; preds = %51
  %59 = load ptr, ptr %4, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %59, i32 0, i32 4
  %61 = load ptr, ptr %60, align 8, !tbaa !22
  %62 = getelementptr inbounds %struct.tag_____CommonTags__, ptr %61, i32 0, i32 6
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %9, ptr align 8 %62, i64 16, i1 false), !tbaa.struct !24
  br label %63

63:                                               ; preds = %58, %51
  br label %64

64:                                               ; preds = %63, %46
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.tag_____Tag__, ptr %9, i32 0, i32 0
  %67 = load ptr, ptr %66, align 8, !tbaa !17
  call void @CGenerator__writeNs__(ptr noundef %65, ptr noundef %67)
  %68 = load ptr, ptr %6, align 8, !tbaa !5
  %69 = load ptr, ptr @mu_____string511, align 8
  %70 = load i32, ptr getelementptr inbounds ({ ptr, i32 }, ptr @mu_____string511, i32 0, i32 1), align 8
  call void @StringBuilder__write__(ptr noundef %68, ptr %69, i32 %70)
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %71 = load ptr, ptr %5, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.tag_____CallExpression__, ptr %71, i32 0, i32 2
  %73 = load ptr, ptr %72, align 8, !tbaa !9
  store ptr %73, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 0, ptr %11, align 4, !tbaa !13
  %74 = load i32, ptr %11, align 4, !tbaa !13
  %75 = load ptr, ptr %10, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.tag_____List__Node____, ptr %75, i32 0, i32 1
  %77 = load i32, ptr %76, align 8, !tbaa !14
  %78 = icmp ult i32 %74, %77
  br i1 %78, label %82, label %79

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

82:                                               ; preds = %79, %64
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = load ptr, ptr %10, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.tag_____List__Node____, ptr %84, i32 0, i32 0
  %86 = load ptr, ptr %85, align 8, !tbaa !16
  %87 = load i32, ptr %11, align 4, !tbaa !13
  %88 = zext i32 %87 to i64
  %89 = getelementptr inbounds %struct.Node__, ptr %86, i64 %88
  %90 = load ptr, ptr %6, align 8, !tbaa !5
  %91 = getelementptr inbounds { i32, ptr }, ptr %89, i32 0, i32 0
  %92 = load i32, ptr %91, align 8
  %93 = getelementptr inbounds { i32, ptr }, ptr %89, i32 0, i32 1
  %94 = load ptr, ptr %93, align 8
  call void @CGenerator__genExpression__(ptr noundef %83, i32 %92, ptr %94, ptr noundef %90)
  %95 = load ptr, ptr %6, align 8, !tbaa !5
  %96 = load ptr, ptr @mu_____string303, align 8
  %97 = load i32, ptr getelementptr inbounds ({ ptr, i32 }, ptr @mu_____string303, i32 0, i32 1), align 8
  call void @StringBuilder__write__(ptr noundef %95, ptr %96, i32 %97)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 24}
!10 = !{!"tag_____CallExpression__", !11, i64 0, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!11 = !{!"", !12, i64 0, !6, i64 8}
!12 = !{!"int", !7, i64 0}
!13 = !{!12, !12, i64 0}
!14 = !{!15, !12, i64 8}
!15 = !{!"tag_____List__Node____", !6, i64 0, !12, i64 8, !12, i64 12}
!16 = !{!15, !6, i64 0}
!17 = !{!18, !6, i64 0}
!18 = !{!"tag_____Tag__", !6, i64 0, !6, i64 8}
!19 = !{!20, !12, i64 28}
!20 = !{!"tag_____Namespace__", !21, i64 0, !6, i64 16, !12, i64 24, !12, i64 28, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !12, i64 104}
!21 = !{!"", !6, i64 0, !12, i64 8}
!22 = !{!23, !6, i64 32}
!23 = !{!"tag_____GenerateContext__", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !12, i64 48, !12, i64 52, !6, i64 56, !6, i64 64, !6, i64 72, !21, i64 80, !12, i64 96, !21, i64 104, !12, i64 120, !6, i64 128, !6, i64 136, !7, i64 144}
!24 = !{i64 0, i64 8, !5, i64 8, i64 8, !5}


; 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.string__ = type { ptr, i32 }

@mu_____string303 = external dso_local local_unnamed_addr global %struct.string__, align 8
@mu_____string511 = external dso_local local_unnamed_addr global %struct.string__, align 8
@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
declare dso_local void @StringBuilder__write__(ptr noundef, ptr, i32) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local { ptr, ptr } @CGenerator__nodeTag__(ptr noundef, i32, ptr) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @CGenerator__genExpression__(ptr noundef, i32, ptr, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local void @CGenerator__writeNs__(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local void @CGenerator__genComputeHash__(ptr noundef %0, ptr nocapture noundef readonly %1, ptr noundef %2) local_unnamed_addr #1 {
  %4 = getelementptr inbounds i8, ptr %1, i64 24
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %5, i64 8
  %7 = load i32, ptr %6, align 8, !tbaa !12
  %.not = icmp eq i32 %7, 0
  br i1 %.not, label %8, label %11

8:                                                ; preds = %3
  %9 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____abandonFn__)
  %10 = load ptr, ptr %9, align 8, !tbaa !14
  tail call void %10(i32 noundef -3) #2
  br label %11

11:                                               ; preds = %8, %3
  %12 = load ptr, ptr %5, align 8, !tbaa !15
  %13 = load i32, ptr %12, align 8
  %14 = getelementptr inbounds i8, ptr %12, i64 8
  %15 = load ptr, ptr %14, align 8
  %16 = tail call { ptr, ptr } @CGenerator__nodeTag__(ptr noundef %0, i32 %13, ptr %15)
  %17 = extractvalue { ptr, ptr } %16, 0
  %18 = getelementptr inbounds i8, ptr %17, i64 28
  %19 = load i32, ptr %18, align 4, !tbaa !16
  %20 = and i32 %19, 196736
  %.not22 = icmp eq i32 %20, 0
  br i1 %.not22, label %21, label %.sink.split

21:                                               ; preds = %11
  %22 = and i32 %19, 2048
  %.not23 = icmp eq i32 %22, 0
  br i1 %.not23, label %26, label %.sink.split

.sink.split:                                      ; preds = %21, %11
  %.sink26 = phi i64 [ 288, %11 ], [ 96, %21 ]
  %23 = getelementptr inbounds i8, ptr %0, i64 32
  %24 = load ptr, ptr %23, align 8, !tbaa !19
  %25 = getelementptr inbounds i8, ptr %24, i64 %.sink26
  %.sroa.0.0.copyload5 = load ptr, ptr %25, align 8, !tbaa !14
  br label %26

26:                                               ; preds = %.sink.split, %21
  %.sroa.0.0 = phi ptr [ %17, %21 ], [ %.sroa.0.0.copyload5, %.sink.split ]
  tail call void @CGenerator__writeNs__(ptr noundef %2, ptr noundef %.sroa.0.0)
  %27 = load ptr, ptr @mu_____string511, align 8
  %28 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string511, i64 8), align 8
  tail call void @StringBuilder__write__(ptr noundef %2, ptr %27, i32 %28)
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %29, i64 8
  %31 = load i32, ptr %30, align 8, !tbaa !12
  %.not24 = icmp eq i32 %31, 0
  br i1 %.not24, label %32, label %35

32:                                               ; preds = %26
  %33 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____abandonFn__)
  %34 = load ptr, ptr %33, align 8, !tbaa !14
  tail call void %34(i32 noundef -3) #2
  br label %35

35:                                               ; preds = %32, %26
  %36 = load ptr, ptr %29, align 8, !tbaa !15
  %37 = load i32, ptr %36, align 8
  %38 = getelementptr inbounds i8, ptr %36, i64 8
  %39 = load ptr, ptr %38, align 8
  tail call void @CGenerator__genExpression__(ptr noundef %0, i32 %37, ptr %39, ptr noundef %2)
  %40 = load ptr, ptr @mu_____string303, align 8
  %41 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string303, i64 8), align 8
  tail call void @StringBuilder__write__(ptr noundef %2, ptr %40, i32 %41)
  ret void
}

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, !11, i64 24}
!6 = !{!"tag_____CallExpression__", !7, i64 0, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48}
!7 = !{!"", !8, i64 0, !11, i64 8}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"any pointer", !9, i64 0}
!12 = !{!13, !8, i64 8}
!13 = !{!"tag_____List__Node____", !11, i64 0, !8, i64 8, !8, i64 12}
!14 = !{!11, !11, i64 0}
!15 = !{!13, !11, i64 0}
!16 = !{!17, !8, i64 28}
!17 = !{!"tag_____Namespace__", !18, i64 0, !11, i64 16, !8, i64 24, !8, i64 28, !11, i64 32, !11, i64 40, !11, i64 48, !11, i64 56, !11, i64 64, !11, i64 72, !11, i64 80, !11, i64 88, !11, i64 96, !8, i64 104}
!18 = !{!"", !11, i64 0, !8, i64 8}
!19 = !{!20, !11, i64 32}
!20 = !{!"tag_____GenerateContext__", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !8, i64 48, !8, i64 52, !11, i64 56, !11, i64 64, !11, i64 72, !18, i64 80, !8, i64 96, !18, i64 104, !8, i64 120, !11, i64 128, !11, i64 136, !9, i64 144}


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