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

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

@mu_____string467 = external dso_local global %struct.string__, align 8
@mu_____string303 = external dso_local global %struct.string__, align 8
@mu_____string466 = 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: nounwind uwtable
declare dso_local void @StringBuilder__write__(ptr noundef, ptr, i32) #2

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

; Function Attrs: nounwind uwtable
define dso_local void @CGenerator__genAbandon__(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %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 i8, align 1
  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
  %10 = load ptr, ptr %6, align 8, !tbaa !5
  %11 = load ptr, ptr @mu_____string466, align 8
  %12 = load i32, ptr getelementptr inbounds ({ ptr, i32 }, ptr @mu_____string466, i32 0, i32 1), align 8
  call void @StringBuilder__write__(ptr noundef %10, ptr %11, i32 %12)
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.tag_____CallExpression__, ptr %13, i32 0, i32 2
  %15 = load ptr, ptr %14, align 8, !tbaa !9
  %16 = getelementptr inbounds %struct.tag_____List__Node____, ptr %15, i32 0, i32 1
  %17 = load i32, ptr %16, align 8, !tbaa !13
  %18 = icmp sgt i32 %17, 0
  br i1 %18, label %19, label %52

19:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.tag_____CallExpression__, ptr %20, i32 0, i32 2
  %22 = load ptr, ptr %21, align 8, !tbaa !9
  store ptr %22, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 0, ptr %8, align 4, !tbaa !15
  %23 = load i32, ptr %8, align 4, !tbaa !15
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.tag_____List__Node____, ptr %24, i32 0, i32 1
  %26 = load i32, ptr %25, align 8, !tbaa !13
  %27 = icmp ult i32 %23, %26
  br i1 %27, label %31, label %28

28:                                               ; preds = %19
  %29 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____abandonFn__)
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  call void %30(i32 noundef -3)
  br label %31

31:                                               ; preds = %28, %19
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.tag_____List__Node____, ptr %33, i32 0, i32 0
  %35 = load ptr, ptr %34, align 8, !tbaa !16
  %36 = load i32, ptr %8, align 4, !tbaa !15
  %37 = zext i32 %36 to i64
  %38 = getelementptr inbounds %struct.Node__, ptr %35, i64 %37
  %39 = load ptr, ptr %6, align 8, !tbaa !5
  %40 = load ptr, ptr %4, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %40, i32 0, i32 4
  %42 = load ptr, ptr %41, align 8, !tbaa !17
  %43 = getelementptr inbounds %struct.tag_____CommonTags__, ptr %42, i32 0, i32 5
  %44 = getelementptr inbounds { i32, ptr }, ptr %38, i32 0, i32 0
  %45 = load i32, ptr %44, align 8
  %46 = getelementptr inbounds { i32, ptr }, ptr %38, i32 0, i32 1
  %47 = load ptr, ptr %46, align 8
  %48 = getelementptr inbounds { ptr, ptr }, ptr %43, i32 0, i32 0
  %49 = load ptr, ptr %48, align 8
  %50 = getelementptr inbounds { ptr, ptr }, ptr %43, i32 0, i32 1
  %51 = load ptr, ptr %50, align 8
  call void @CGenerator__genConverted__(ptr noundef %32, i32 %45, ptr %47, ptr noundef %39, ptr %49, ptr %51)
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  br label %56

52:                                               ; preds = %3
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = load ptr, ptr @mu_____string467, align 8
  %55 = load i32, ptr getelementptr inbounds ({ ptr, i32 }, ptr @mu_____string467, i32 0, i32 1), align 8
  call void @StringBuilder__write__(ptr noundef %53, ptr %54, i32 %55)
  br label %56

56:                                               ; preds = %52, %31
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = load ptr, ptr @mu_____string303, align 8
  %59 = load i32, ptr getelementptr inbounds ({ ptr, i32 }, ptr @mu_____string303, i32 0, i32 1), align 8
  call void @StringBuilder__write__(ptr noundef %57, ptr %58, i32 %59)
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #3
  %60 = load ptr, ptr %4, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %60, i32 0, i32 16
  %62 = load ptr, ptr %61, align 8, !tbaa !20
  %63 = icmp ne ptr %62, null
  %64 = zext i1 %63 to i32
  %65 = trunc i32 %64 to i8
  store i8 %65, ptr %9, align 1, !tbaa !21
  %66 = load i8, ptr %9, align 1, !tbaa !21
  %67 = icmp ne i8 %66, 0
  br i1 %67, label %68, label %79

68:                                               ; preds = %56
  %69 = load ptr, ptr %4, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %69, i32 0, i32 16
  %71 = load ptr, ptr %70, align 8, !tbaa !20
  %72 = getelementptr inbounds %struct.tag_____ExpressionStatement__, ptr %71, i32 0, i32 0
  %73 = getelementptr inbounds %struct.Node__, ptr %72, i32 0, i32 1
  %74 = load ptr, ptr %73, align 8, !tbaa !22
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  %76 = icmp eq ptr %74, %75
  %77 = zext i1 %76 to i32
  %78 = trunc i32 %77 to i8
  store i8 %78, ptr %9, align 1, !tbaa !21
  br label %79

79:                                               ; preds = %68, %56
  %80 = load i8, ptr %9, align 1, !tbaa !21
  %81 = icmp ne i8 %80, 0
  br i1 %81, label %82, label %85

82:                                               ; preds = %79
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.tag_____GenerateContext__, ptr %83, i32 0, i32 17
  store i8 1, ptr %84, align 8, !tbaa !24
  br label %85

85:                                               ; preds = %82, %79
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #3
  ret void
}

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 = !{!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 = !{!14, !12, i64 8}
!14 = !{!"tag_____List__Node____", !6, i64 0, !12, i64 8, !12, i64 12}
!15 = !{!12, !12, i64 0}
!16 = !{!14, !6, i64 0}
!17 = !{!18, !6, i64 32}
!18 = !{!"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, !19, i64 80, !12, i64 96, !19, i64 104, !12, i64 120, !6, i64 128, !6, i64 136, !7, i64 144}
!19 = !{!"", !6, i64 0, !12, i64 8}
!20 = !{!18, !6, i64 136}
!21 = !{!7, !7, i64 0}
!22 = !{!23, !6, i64 8}
!23 = !{!"tag_____ExpressionStatement__", !11, i64 0}
!24 = !{!18, !7, i64 144}


; 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_____string467 = external dso_local local_unnamed_addr global %struct.string__, align 8
@mu_____string303 = external dso_local local_unnamed_addr global %struct.string__, align 8
@mu_____string466 = external dso_local local_unnamed_addr global %struct.string__, align 8

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

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

; Function Attrs: nounwind uwtable
define dso_local void @CGenerator__genAbandon__(ptr noundef %0, ptr noundef readonly %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = load ptr, ptr @mu_____string466, align 8
  %5 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string466, i64 8), align 8
  tail call void @StringBuilder__write__(ptr noundef %2, ptr %4, i32 %5)
  %6 = getelementptr inbounds i8, ptr %1, i64 24
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %7, i64 8
  %9 = load i32, ptr %8, align 8, !tbaa !12
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %11, label %22

11:                                               ; preds = %3
  %12 = load ptr, ptr %7, align 8, !tbaa !14
  %13 = getelementptr inbounds i8, ptr %0, i64 32
  %14 = load ptr, ptr %13, align 8, !tbaa !15
  %15 = getelementptr inbounds i8, ptr %14, i64 80
  %16 = load i32, ptr %12, align 8
  %17 = getelementptr inbounds i8, ptr %12, i64 8
  %18 = load ptr, ptr %17, align 8
  %19 = load ptr, ptr %15, align 8
  %20 = getelementptr inbounds i8, ptr %14, i64 88
  %21 = load ptr, ptr %20, align 8
  tail call void @CGenerator__genConverted__(ptr noundef %0, i32 %16, ptr %18, ptr noundef %2, ptr %19, ptr %21)
  br label %25

22:                                               ; preds = %3
  %23 = load ptr, ptr @mu_____string467, align 8
  %24 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string467, i64 8), align 8
  tail call void @StringBuilder__write__(ptr noundef %2, ptr %23, i32 %24)
  br label %25

25:                                               ; preds = %22, %11
  %26 = load ptr, ptr @mu_____string303, align 8
  %27 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string303, i64 8), align 8
  tail call void @StringBuilder__write__(ptr noundef %2, ptr %26, i32 %27)
  %28 = getelementptr inbounds i8, ptr %0, i64 136
  %29 = load ptr, ptr %28, align 8, !tbaa !18
  %.not = icmp eq ptr %29, null
  br i1 %.not, label %.critedge, label %30

30:                                               ; preds = %25
  %31 = getelementptr inbounds i8, ptr %29, i64 8
  %32 = load ptr, ptr %31, align 8, !tbaa !19
  %.not19 = icmp eq ptr %32, %1
  br i1 %.not19, label %33, label %.critedge

33:                                               ; preds = %30
  %34 = getelementptr inbounds i8, ptr %0, i64 144
  store i8 1, ptr %34, align 8, !tbaa !21
  br label %.critedge

.critedge:                                        ; preds = %25, %33, %30
  ret void
}

attributes #0 = { 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, !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 = !{!13, !11, i64 0}
!15 = !{!16, !11, i64 32}
!16 = !{!"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, !17, i64 80, !8, i64 96, !17, i64 104, !8, i64 120, !11, i64 128, !11, i64 136, !9, i64 144}
!17 = !{!"", !11, i64 0, !8, i64 8}
!18 = !{!16, !11, i64 136}
!19 = !{!20, !11, i64 8}
!20 = !{!"tag_____ExpressionStatement__", !7, i64 0}
!21 = !{!16, !9, i64 144}


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