; LLVM IR from ponylang/ponyc :: src/libponyc/type (alias)

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

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [74 x i8], align 1
@__func__.immutable_or_opaque = external hidden unnamed_addr constant [20 x i8], align 1

declare i32 @ast_id(ptr noundef) #0

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

declare ptr @ast_child(ptr noundef) #0

declare ptr @ast_sibling(ptr noundef) #0

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

declare void @ast_get_children(ptr noundef, i64 noundef, ptr noundef) #0

declare void @ponyint_assert_fail(ptr noundef, ptr noundef, i64 noundef, ptr noundef) #0

declare void @ast_free_unattached(ptr noundef) #0

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @immutable_or_opaque(ptr noundef %0) #2 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca [6 x ptr], align 16
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca [4 x ptr], align 16
  store ptr %0, ptr %3, align 8, !tbaa !5
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = call i32 @ast_id(ptr noundef %18)
  switch i32 %19, label %70 [
    i32 149, label %20
    i32 56, label %20
    i32 150, label %20
    i32 17, label %35
    i32 151, label %49
    i32 187, label %60
    i32 153, label %69
    i32 157, label %69
    i32 158, label %69
  ]

20:                                               ; preds = %1, %1, %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = call ptr @ast_child(ptr noundef %21)
  store ptr %22, ptr %4, align 8, !tbaa !5
  br label %23

23:                                               ; preds = %30, %20
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = icmp ne ptr %24, null
  br i1 %25, label %26, label %33

26:                                               ; preds = %23
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = call zeroext i1 @immutable_or_opaque(ptr noundef %27)
  br i1 %28, label %30, label %29

29:                                               ; preds = %26
  store i1 false, ptr %2, align 1
  store i32 1, ptr %5, align 4
  br label %34

30:                                               ; preds = %26
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = call ptr @ast_sibling(ptr noundef %31)
  store ptr %32, ptr %4, align 8, !tbaa !5
  br label %23, !llvm.loop !9

33:                                               ; preds = %23
  store i1 true, ptr %2, align 1
  store i32 1, ptr %5, align 4
  br label %34

34:                                               ; preds = %33, %29
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  br label %72

35:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = call ptr @viewpoint_lower(ptr noundef %36)
  store ptr %37, ptr %6, align 8, !tbaa !5
  %38 = load ptr, ptr %6, align 8, !tbaa !5
  %39 = icmp eq ptr %38, null
  br i1 %39, label %40, label %41

40:                                               ; preds = %35
  store i1 false, ptr %2, align 1
  store i32 1, ptr %5, align 4
  br label %48

41:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #3
  %42 = load ptr, ptr %6, align 8, !tbaa !5
  %43 = call zeroext i1 @immutable_or_opaque(ptr noundef %42)
  %44 = zext i1 %43 to i8
  store i8 %44, ptr %7, align 1, !tbaa !11
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  call void @ast_free_unattached(ptr noundef %45)
  %46 = load i8, ptr %7, align 1, !tbaa !11, !range !13, !noundef !14
  %47 = trunc i8 %46 to i1
  store i1 %47, ptr %2, align 1
  store i32 1, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #3
  br label %48

48:                                               ; preds = %41, %40
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  br label %72

49:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.start.p0(i64 48, ptr %13) #3
  store ptr %8, ptr %13, align 8, !tbaa !5
  %50 = getelementptr inbounds ptr, ptr %13, i64 1
  store ptr %9, ptr %50, align 8, !tbaa !5
  %51 = getelementptr inbounds ptr, ptr %13, i64 2
  store ptr %10, ptr %51, align 8, !tbaa !5
  %52 = getelementptr inbounds ptr, ptr %13, i64 3
  store ptr %11, ptr %52, align 8, !tbaa !5
  %53 = getelementptr inbounds ptr, ptr %13, i64 4
  store ptr %12, ptr %53, align 8, !tbaa !5
  %54 = getelementptr inbounds ptr, ptr %13, i64 5
  store ptr null, ptr %54, align 8, !tbaa !5
  %55 = load ptr, ptr %3, align 8, !tbaa !5
  %56 = getelementptr inbounds [6 x ptr], ptr %13, i64 0, i64 0
  call void @ast_get_children(ptr noundef %55, i64 noundef 5, ptr noundef %56)
  call void @llvm.lifetime.end.p0(i64 48, ptr %13) #3
  %57 = load ptr, ptr %11, align 8, !tbaa !5
  %58 = call i32 @ast_id(ptr noundef %57)
  %59 = call zeroext i1 @cap_immutable_or_opaque(i32 noundef %58)
  store i1 %59, ptr %2, align 1
  store i32 1, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %72

60:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr %17) #3
  store ptr %14, ptr %17, align 8, !tbaa !5
  %61 = getelementptr inbounds ptr, ptr %17, i64 1
  store ptr %15, ptr %61, align 8, !tbaa !5
  %62 = getelementptr inbounds ptr, ptr %17, i64 2
  store ptr %16, ptr %62, align 8, !tbaa !5
  %63 = getelementptr inbounds ptr, ptr %17, i64 3
  store ptr null, ptr %63, align 8, !tbaa !5
  %64 = load ptr, ptr %3, align 8, !tbaa !5
  %65 = getelementptr inbounds [4 x ptr], ptr %17, i64 0, i64 0
  call void @ast_get_children(ptr noundef %64, i64 noundef 3, ptr noundef %65)
  call void @llvm.lifetime.end.p0(i64 32, ptr %17) #3
  %66 = load ptr, ptr %15, align 8, !tbaa !5
  %67 = call i32 @ast_id(ptr noundef %66)
  %68 = call zeroext i1 @cap_immutable_or_opaque(i32 noundef %67)
  store i1 %68, ptr %2, align 1
  store i32 1, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #3
  br label %72

69:                                               ; preds = %1, %1, %1
  store i1 false, ptr %2, align 1
  br label %72

70:                                               ; preds = %1
  br label %71

71:                                               ; preds = %70
  call void @ponyint_assert_fail(ptr noundef @.str, ptr noundef @.str.1, i64 noundef 729, ptr noundef @__func__.immutable_or_opaque)
  store i1 false, ptr %2, align 1
  br label %72

72:                                               ; preds = %71, %69, %60, %49, %48, %34
  %73 = load i1, ptr %2, align 1
  ret i1 %73
}

declare ptr @viewpoint_lower(ptr noundef) #0

declare zeroext i1 @cap_immutable_or_opaque(i32 noundef) #0

attributes #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{i8 0, i8 2}
!14 = !{}


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

@.str = external hidden unnamed_addr constant [2 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [74 x i8], align 1
@__func__.immutable_or_opaque = external hidden unnamed_addr constant [20 x i8], align 1

declare i32 @ast_id(ptr noundef) local_unnamed_addr #0

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

declare ptr @ast_child(ptr noundef) local_unnamed_addr #0

declare ptr @ast_sibling(ptr noundef) local_unnamed_addr #0

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

declare void @ast_get_children(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #0

declare void @ponyint_assert_fail(ptr noundef, ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #0

declare void @ast_free_unattached(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @immutable_or_opaque(ptr noundef %0) local_unnamed_addr #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca [6 x ptr], align 16
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca [4 x ptr], align 16
  %12 = tail call i32 @ast_id(ptr noundef %0) #3
  switch i32 %12, label %39 [
    i32 149, label %13
    i32 56, label %13
    i32 150, label %13
    i32 17, label %18
    i32 151, label %23
    i32 187, label %32
    i32 153, label %common.ret18
    i32 157, label %common.ret18
    i32 158, label %common.ret18
  ]

13:                                               ; preds = %1, %1, %1
  %14 = tail call ptr @ast_child(ptr noundef %0) #3
  %.not14 = icmp eq ptr %14, null
  br i1 %.not14, label %common.ret18, label %.lr.ph

.lr.ph:                                           ; preds = %13, %16
  %.01215 = phi ptr [ %17, %16 ], [ %14, %13 ]
  %15 = tail call zeroext i1 @immutable_or_opaque(ptr noundef nonnull %.01215)
  br i1 %15, label %16, label %common.ret18

16:                                               ; preds = %.lr.ph
  %17 = tail call ptr @ast_sibling(ptr noundef nonnull %.01215) #3
  %.not = icmp eq ptr %17, null
  br i1 %.not, label %common.ret18, label %.lr.ph, !llvm.loop !5

18:                                               ; preds = %1
  %19 = tail call ptr @viewpoint_lower(ptr noundef %0) #3
  %20 = icmp eq ptr %19, null
  br i1 %20, label %common.ret18, label %21

common.ret18:                                     ; preds = %1, %1, %1, %18, %39, %32, %23, %13, %16, %.lr.ph, %21
  %common.ret18.op = phi i1 [ %22, %21 ], [ false, %39 ], [ %38, %32 ], [ %31, %23 ], [ false, %18 ], [ false, %1 ], [ false, %1 ], [ false, %1 ], [ true, %13 ], [ %15, %16 ], [ %15, %.lr.ph ]
  ret i1 %common.ret18.op

21:                                               ; preds = %18
  %22 = tail call zeroext i1 @immutable_or_opaque(ptr noundef nonnull %19)
  tail call void @ast_free_unattached(ptr noundef nonnull %19) #3
  br label %common.ret18

23:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %7) #3
  store ptr %2, ptr %7, align 16, !tbaa !7
  %24 = getelementptr inbounds i8, ptr %7, i64 8
  store ptr %3, ptr %24, align 8, !tbaa !7
  %25 = getelementptr inbounds i8, ptr %7, i64 16
  store ptr %4, ptr %25, align 16, !tbaa !7
  %26 = getelementptr inbounds i8, ptr %7, i64 24
  store ptr %5, ptr %26, align 8, !tbaa !7
  %27 = getelementptr inbounds i8, ptr %7, i64 32
  store ptr %6, ptr %27, align 16, !tbaa !7
  %28 = getelementptr inbounds i8, ptr %7, i64 40
  store ptr null, ptr %28, align 8, !tbaa !7
  call void @ast_get_children(ptr noundef %0, i64 noundef 5, ptr noundef nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %7) #3
  %29 = load ptr, ptr %5, align 8, !tbaa !7
  %30 = call i32 @ast_id(ptr noundef %29) #3
  %31 = call zeroext i1 @cap_immutable_or_opaque(i32 noundef %30) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #3
  br label %common.ret18

32:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %11) #3
  store ptr %8, ptr %11, align 16, !tbaa !7
  %33 = getelementptr inbounds i8, ptr %11, i64 8
  store ptr %9, ptr %33, align 8, !tbaa !7
  %34 = getelementptr inbounds i8, ptr %11, i64 16
  store ptr %10, ptr %34, align 16, !tbaa !7
  %35 = getelementptr inbounds i8, ptr %11, i64 24
  store ptr null, ptr %35, align 8, !tbaa !7
  call void @ast_get_children(ptr noundef %0, i64 noundef 3, ptr noundef nonnull %11) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %11) #3
  %36 = load ptr, ptr %9, align 8, !tbaa !7
  %37 = call i32 @ast_id(ptr noundef %36) #3
  %38 = call zeroext i1 @cap_immutable_or_opaque(i32 noundef %37) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #3
  br label %common.ret18

39:                                               ; preds = %1
  tail call void @ponyint_assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i64 noundef 729, ptr noundef nonnull @__func__.immutable_or_opaque) #3
  br label %common.ret18
}

declare ptr @viewpoint_lower(ptr noundef) local_unnamed_addr #0

declare zeroext i1 @cap_immutable_or_opaque(i32 noundef) local_unnamed_addr #0

attributes #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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = !{!8, !8, i64 0}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass