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

; 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.pass_opt_t = type { i32, i32, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i32, i64, i8, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, %struct.typecheck_t, ptr, ptr }
%struct.typecheck_t = type { ptr, %struct.typecheck_stats_t, ptr }
%struct.typecheck_stats_t = type { i64, i64, i64, i64 }

@.str = external hidden unnamed_addr constant [36 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [42 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @verify_fields_are_defined_in_constructor(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i8, align 1
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  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
  store i8 1, ptr %6, align 1, !tbaa !9
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = call i32 @ast_id(ptr noundef %13)
  %15 = icmp ne i32 %14, 88
  br i1 %15, label %16, label %19

16:                                               ; preds = %2
  %17 = load i8, ptr %6, align 1, !tbaa !9, !range !11, !noundef !12
  %18 = trunc i8 %17 to i1
  store i1 %18, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %66

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

24:                                               ; preds = %51, %19
  %25 = load ptr, ptr %9, align 8, !tbaa !5
  %26 = icmp ne ptr %25, null
  br i1 %26, label %27, label %54

27:                                               ; preds = %24
  %28 = load ptr, ptr %9, align 8, !tbaa !5
  %29 = call i32 @ast_id(ptr noundef %28)
  switch i32 %29, label %50 [
    i32 140, label %30
    i32 141, label %30
    i32 86, label %30
  ]

30:                                               ; preds = %27, %27, %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %31 = load ptr, ptr %9, align 8, !tbaa !5
  %32 = call ptr @ast_child(ptr noundef %31)
  store ptr %32, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %33 = load ptr, ptr %5, align 8, !tbaa !5
  %34 = load ptr, ptr %11, align 8, !tbaa !5
  %35 = call ptr @ast_name(ptr noundef %34)
  %36 = call ptr @ast_get(ptr noundef %33, ptr noundef %35, ptr noundef %10)
  store ptr %36, ptr %12, align 8, !tbaa !5
  %37 = load ptr, ptr %12, align 8, !tbaa !5
  %38 = load ptr, ptr %9, align 8, !tbaa !5
  %39 = icmp ne ptr %37, %38
  br i1 %39, label %43, label %40

40:                                               ; preds = %30
  %41 = load i32, ptr %10, align 4, !tbaa !13
  %42 = icmp ne i32 %41, 2
  br i1 %42, label %43, label %49

43:                                               ; preds = %40, %30
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.pass_opt_t, ptr %44, i32 0, i32 36
  %46 = getelementptr inbounds %struct.typecheck_t, ptr %45, i32 0, i32 2
  %47 = load ptr, ptr %46, align 8, !tbaa !15
  %48 = load ptr, ptr %12, align 8, !tbaa !5
  call void (ptr, ptr, ptr, ...) @ast_error(ptr noundef %47, ptr noundef %48, ptr noundef @.str)
  store i8 0, ptr %6, align 1, !tbaa !9
  br label %49

49:                                               ; preds = %43, %40
  store i32 4, ptr %7, 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 4, ptr %10) #3
  br label %51

50:                                               ; preds = %27
  br label %51

51:                                               ; preds = %50, %49
  %52 = load ptr, ptr %9, align 8, !tbaa !5
  %53 = call ptr @ast_sibling(ptr noundef %52)
  store ptr %53, ptr %9, align 8, !tbaa !5
  br label %24, !llvm.loop !20

54:                                               ; preds = %24
  %55 = load i8, ptr %6, align 1, !tbaa !9, !range !11, !noundef !12
  %56 = trunc i8 %55 to i1
  br i1 %56, label %63, label %57

57:                                               ; preds = %54
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.pass_opt_t, ptr %58, i32 0, i32 36
  %60 = getelementptr inbounds %struct.typecheck_t, ptr %59, i32 0, i32 2
  %61 = load ptr, ptr %60, align 8, !tbaa !15
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  call void (ptr, ptr, ptr, ...) @ast_error(ptr noundef %61, ptr noundef %62, ptr noundef @.str.1)
  br label %63

63:                                               ; preds = %57, %54
  %64 = load i8, ptr %6, align 1, !tbaa !9, !range !11, !noundef !12
  %65 = trunc i8 %64 to i1
  store i1 %65, ptr %3, align 1
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %66

66:                                               ; preds = %63, %16
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #3
  %67 = load i1, ptr %3, align 1
  ret i1 %67
}

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

declare i32 @ast_id(ptr noundef) #2

declare ptr @ast_parent(ptr noundef) #2

declare ptr @ast_child(ptr noundef) #2

declare ptr @ast_get(ptr noundef, ptr noundef, ptr noundef) #2

declare ptr @ast_name(ptr noundef) #2

declare void @ast_error(ptr noundef, ptr noundef, ptr noundef, ...) #2

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

declare ptr @ast_sibling(ptr noundef) #2

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" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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, !10, i64 0}
!10 = !{!"_Bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !6, i64 216}
!16 = !{!"pass_opt_t", !14, i64 0, !14, i64 4, !10, i64 8, !10, i64 9, !10, i64 10, !10, i64 11, !10, i64 12, !10, i64 13, !10, i64 14, !10, i64 15, !10, i64 16, !10, i64 17, !10, i64 18, !10, i64 19, !10, i64 20, !10, i64 21, !14, i64 24, !17, i64 32, !10, i64 40, !10, i64 41, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !18, i64 176, !6, i64 224, !6, i64 232}
!17 = !{!"long", !7, i64 0}
!18 = !{!"typecheck_t", !6, i64 0, !19, i64 8, !6, i64 40}
!19 = !{!"typecheck_stats_t", !17, i64 0, !17, i64 8, !17, i64 16, !17, i64 24}
!20 = distinct !{!20, !21}
!21 = !{!"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"

@.str = external hidden unnamed_addr constant [36 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [42 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @verify_fields_are_defined_in_constructor(ptr nocapture noundef readonly %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca i32, align 4
  %4 = tail call i32 @ast_id(ptr noundef %1) #3
  %.not = icmp eq i32 %4, 88
  br i1 %.not, label %5, label %.critedge

5:                                                ; preds = %2
  %6 = tail call ptr @ast_parent(ptr noundef %1) #3
  %7 = tail call ptr @ast_child(ptr noundef %6) #3
  %.not2122 = icmp eq ptr %7, null
  br i1 %.not2122, label %.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %5
  %8 = getelementptr inbounds i8, ptr %0, i64 216
  br label %9

9:                                                ; preds = %.lr.ph, %21
  %.01924 = phi i1 [ true, %.lr.ph ], [ %.2, %21 ]
  %.02023 = phi ptr [ %7, %.lr.ph ], [ %22, %21 ]
  %10 = call i32 @ast_id(ptr noundef nonnull %.02023) #3
  switch i32 %10, label %21 [
    i32 140, label %11
    i32 141, label %11
    i32 86, label %11
  ]

11:                                               ; preds = %9, %9, %9
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #3
  %12 = call ptr @ast_child(ptr noundef nonnull %.02023) #3
  %13 = call ptr @ast_name(ptr noundef %12) #3
  %14 = call ptr @ast_get(ptr noundef %1, ptr noundef %13, ptr noundef nonnull %3) #3
  %15 = icmp ne ptr %14, %.02023
  %16 = load i32, ptr %3, align 4
  %17 = icmp ne i32 %16, 2
  %or.cond = select i1 %15, i1 true, i1 %17
  br i1 %or.cond, label %18, label %20

18:                                               ; preds = %11
  %19 = load ptr, ptr %8, align 8, !tbaa !5
  call void (ptr, ptr, ptr, ...) @ast_error(ptr noundef %19, ptr noundef %14, ptr noundef nonnull @.str) #3
  br label %20

20:                                               ; preds = %11, %18
  %.1 = phi i1 [ false, %18 ], [ %.01924, %11 ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #3
  br label %21

21:                                               ; preds = %9, %20
  %.2 = phi i1 [ %.01924, %9 ], [ %.1, %20 ]
  %22 = call ptr @ast_sibling(ptr noundef nonnull %.02023) #3
  %.not21 = icmp eq ptr %22, null
  br i1 %.not21, label %._crit_edge, label %9, !llvm.loop !15

._crit_edge:                                      ; preds = %21
  br i1 %.2, label %.critedge, label %23

23:                                               ; preds = %._crit_edge
  %24 = load ptr, ptr %8, align 8, !tbaa !5
  call void (ptr, ptr, ptr, ...) @ast_error(ptr noundef %24, ptr noundef %1, ptr noundef nonnull @.str.1) #3
  br label %.critedge

.critedge:                                        ; preds = %5, %._crit_edge, %23, %2
  %.0 = phi i1 [ true, %2 ], [ false, %23 ], [ true, %._crit_edge ], [ true, %5 ]
  ret i1 %.0
}

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

declare i32 @ast_id(ptr noundef) local_unnamed_addr #2

declare ptr @ast_parent(ptr noundef) local_unnamed_addr #2

declare ptr @ast_child(ptr noundef) local_unnamed_addr #2

declare ptr @ast_get(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare ptr @ast_name(ptr noundef) local_unnamed_addr #2

declare void @ast_error(ptr noundef, ptr noundef, ptr noundef, ...) local_unnamed_addr #2

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

declare ptr @ast_sibling(ptr noundef) local_unnamed_addr #2

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" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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, !12, i64 216}
!6 = !{!"pass_opt_t", !7, i64 0, !7, i64 4, !10, i64 8, !10, i64 9, !10, i64 10, !10, i64 11, !10, i64 12, !10, i64 13, !10, i64 14, !10, i64 15, !10, i64 16, !10, i64 17, !10, i64 18, !10, i64 19, !10, i64 20, !10, i64 21, !7, i64 24, !11, i64 32, !10, i64 40, !10, i64 41, !12, i64 48, !12, i64 56, !12, i64 64, !12, i64 72, !12, i64 80, !12, i64 88, !12, i64 96, !12, i64 104, !12, i64 112, !12, i64 120, !12, i64 128, !12, i64 136, !12, i64 144, !12, i64 152, !12, i64 160, !12, i64 168, !13, i64 176, !12, i64 224, !12, i64 232}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"_Bool", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!"typecheck_t", !12, i64 0, !14, i64 8, !12, i64 40}
!14 = !{!"typecheck_stats_t", !11, i64 0, !11, i64 8, !11, i64 16, !11, i64 24}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: AggressiveInstCombinePass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LICMPass,LoopRotatePass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass