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

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

@.str.1 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [15 x i8], align 1
@__func__.ast_list_append = external hidden unnamed_addr constant [16 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [33 x i8], align 1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @ast_list_append(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  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
  %7 = load ptr, ptr %4, align 8, !tbaa !5
  %8 = icmp ne ptr %7, null
  br i1 %8, label %9, label %10

9:                                                ; preds = %3
  br label %11

10:                                               ; preds = %3
  call void @ponyint_assert_fail(ptr noundef @.str.24, ptr noundef @.str.1, i64 noundef 1509, ptr noundef @__func__.ast_list_append)
  br label %11

11:                                               ; preds = %10, %9
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = icmp ne ptr %12, null
  br i1 %13, label %14, label %15

14:                                               ; preds = %11
  br label %16

15:                                               ; preds = %11
  call void @ponyint_assert_fail(ptr noundef @.str.37, ptr noundef @.str.1, i64 noundef 1510, ptr noundef @__func__.ast_list_append)
  br label %16

16:                                               ; preds = %15, %14
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %19, label %20

19:                                               ; preds = %16
  br label %21

20:                                               ; preds = %16
  call void @ponyint_assert_fail(ptr noundef @.str.38, ptr noundef @.str.1, i64 noundef 1511, ptr noundef @__func__.ast_list_append)
  br label %21

21:                                               ; preds = %20, %19
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = load ptr, ptr %22, align 8, !tbaa !5
  %24 = icmp eq ptr %23, null
  br i1 %24, label %25, label %37

25:                                               ; preds = %21
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.ast_t, ptr %26, i32 0, i32 4
  %28 = load ptr, ptr %27, align 8, !tbaa !9
  %29 = icmp eq ptr %28, null
  br i1 %29, label %30, label %31

30:                                               ; preds = %25
  br label %32

31:                                               ; preds = %25
  call void @ponyint_assert_fail(ptr noundef @.str.39, ptr noundef @.str.1, i64 noundef 1516, ptr noundef @__func__.ast_list_append)
  br label %32

32:                                               ; preds = %31, %30
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = load ptr, ptr %6, align 8, !tbaa !5
  %35 = call ptr @ast_add(ptr noundef %33, ptr noundef %34)
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %35, ptr %36, align 8, !tbaa !5
  br label %58

37:                                               ; preds = %21
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.ast_t, ptr %38, i32 0, i32 4
  %40 = load ptr, ptr %39, align 8, !tbaa !9
  %41 = icmp ne ptr %40, null
  br i1 %41, label %42, label %43

42:                                               ; preds = %37
  br label %44

43:                                               ; preds = %37
  call void @ponyint_assert_fail(ptr noundef @.str.40, ptr noundef @.str.1, i64 noundef 1522, ptr noundef @__func__.ast_list_append)
  br label %44

44:                                               ; preds = %43, %42
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  %46 = load ptr, ptr %45, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.ast_t, ptr %46, i32 0, i32 5
  %48 = load ptr, ptr %47, align 8, !tbaa !13
  %49 = icmp eq ptr %48, null
  br i1 %49, label %50, label %51

50:                                               ; preds = %44
  br label %52

51:                                               ; preds = %44
  call void @ponyint_assert_fail(ptr noundef @.str.41, ptr noundef @.str.1, i64 noundef 1523, ptr noundef @__func__.ast_list_append)
  br label %52

52:                                               ; preds = %51, %50
  %53 = load ptr, ptr %5, align 8, !tbaa !5
  %54 = load ptr, ptr %53, align 8, !tbaa !5
  %55 = load ptr, ptr %6, align 8, !tbaa !5
  %56 = call ptr @ast_add_sibling(ptr noundef %54, ptr noundef %55)
  %57 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %56, ptr %57, align 8, !tbaa !5
  br label %58

58:                                               ; preds = %52, %32
  %59 = load ptr, ptr %5, align 8, !tbaa !5
  %60 = load ptr, ptr %59, align 8, !tbaa !5
  ret ptr %60
}

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 = { 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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 32}
!10 = !{!"ast_t", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !11, i64 56, !12, i64 60}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{!10, !6, i64 40}


; 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.1 = external hidden unnamed_addr constant [71 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [15 x i8], align 1
@__func__.ast_list_append = external hidden unnamed_addr constant [16 x i8], align 1
@.str.37 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.38 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.41 = external hidden unnamed_addr constant [33 x i8], align 1

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

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

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

; Function Attrs: nounwind uwtable
define dso_local ptr @ast_list_append(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #1 {
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %4, label %5

4:                                                ; preds = %3
  tail call void @ponyint_assert_fail(ptr noundef nonnull @.str.24, ptr noundef nonnull @.str.1, i64 noundef 1509, ptr noundef nonnull @__func__.ast_list_append) #2
  br label %5

5:                                                ; preds = %3, %4
  %.not14 = icmp eq ptr %1, null
  br i1 %.not14, label %6, label %7

6:                                                ; preds = %5
  tail call void @ponyint_assert_fail(ptr noundef nonnull @.str.37, ptr noundef nonnull @.str.1, i64 noundef 1510, ptr noundef nonnull @__func__.ast_list_append) #2
  br label %7

7:                                                ; preds = %5, %6
  %.not15 = icmp eq ptr %2, null
  br i1 %.not15, label %8, label %9

8:                                                ; preds = %7
  tail call void @ponyint_assert_fail(ptr noundef nonnull @.str.38, ptr noundef nonnull @.str.1, i64 noundef 1511, ptr noundef nonnull @__func__.ast_list_append) #2
  br label %9

9:                                                ; preds = %7, %8
  %10 = load ptr, ptr %1, align 8, !tbaa !5
  %11 = icmp eq ptr %10, null
  %12 = getelementptr inbounds i8, ptr %0, i64 32
  %13 = load ptr, ptr %12, align 8, !tbaa !9
  %14 = icmp eq ptr %13, null
  br i1 %11, label %15, label %19

15:                                               ; preds = %9
  br i1 %14, label %17, label %16

16:                                               ; preds = %15
  tail call void @ponyint_assert_fail(ptr noundef nonnull @.str.39, ptr noundef nonnull @.str.1, i64 noundef 1516, ptr noundef nonnull @__func__.ast_list_append) #2
  br label %17

17:                                               ; preds = %15, %16
  %18 = tail call ptr @ast_add(ptr noundef nonnull %0, ptr noundef %2)
  br label %30

19:                                               ; preds = %9
  br i1 %14, label %20, label %21

20:                                               ; preds = %19
  tail call void @ponyint_assert_fail(ptr noundef nonnull @.str.40, ptr noundef nonnull @.str.1, i64 noundef 1522, ptr noundef nonnull @__func__.ast_list_append) #2
  %.pre = load ptr, ptr %1, align 8, !tbaa !5
  br label %21

21:                                               ; preds = %19, %20
  %22 = phi ptr [ %10, %19 ], [ %.pre, %20 ]
  %23 = getelementptr inbounds i8, ptr %22, i64 40
  %24 = load ptr, ptr %23, align 8, !tbaa !13
  %25 = icmp eq ptr %24, null
  br i1 %25, label %27, label %26

26:                                               ; preds = %21
  tail call void @ponyint_assert_fail(ptr noundef nonnull @.str.41, ptr noundef nonnull @.str.1, i64 noundef 1523, ptr noundef nonnull @__func__.ast_list_append) #2
  %.pre17 = load ptr, ptr %1, align 8, !tbaa !5
  br label %27

27:                                               ; preds = %21, %26
  %28 = phi ptr [ %22, %21 ], [ %.pre17, %26 ]
  %29 = tail call ptr @ast_add_sibling(ptr noundef %28, ptr noundef %2)
  br label %30

30:                                               ; preds = %27, %17
  %storemerge = phi ptr [ %29, %27 ], [ %18, %17 ]
  store ptr %storemerge, ptr %1, align 8, !tbaa !5
  ret ptr %storemerge
}

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 = { 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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 32}
!10 = !{!"ast_t", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !11, i64 56, !12, i64 60}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{!10, !6, i64 40}


; Effective O3 passes: CorrelatedValuePropagationPass,GVNPass,GlobalOptPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass