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

; 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 [60 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [78 x i8], align 1
@__func__.verify_try = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [41 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @verify_try(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca [4 x ptr], align 16
  %10 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = call i32 @ast_id(ptr noundef %11)
  %13 = icmp eq i32 %12, 124
  br i1 %13, label %18, label %14

14:                                               ; preds = %2
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = call i32 @ast_id(ptr noundef %15)
  %17 = icmp eq i32 %16, 125
  br i1 %17, label %18, label %19

18:                                               ; preds = %14, %2
  br label %20

19:                                               ; preds = %14
  call void @ponyint_assert_fail(ptr noundef @.str, ptr noundef @.str.1, i64 noundef 6, ptr noundef @__func__.verify_try)
  br label %20

20:                                               ; preds = %19, %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 32, ptr %9) #3
  store ptr %6, ptr %9, align 8, !tbaa !5
  %21 = getelementptr inbounds ptr, ptr %9, i64 1
  store ptr %7, ptr %21, align 8, !tbaa !5
  %22 = getelementptr inbounds ptr, ptr %9, i64 2
  store ptr %8, ptr %22, align 8, !tbaa !5
  %23 = getelementptr inbounds ptr, ptr %9, i64 3
  store ptr null, ptr %23, align 8, !tbaa !5
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = getelementptr inbounds [4 x ptr], ptr %9, i64 0, i64 0
  call void @ast_get_children(ptr noundef %24, i64 noundef 3, ptr noundef %25)
  call void @llvm.lifetime.end.p0(i64 32, ptr %9) #3
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = call i32 @ast_id(ptr noundef %26)
  %28 = icmp ne i32 %27, 125
  br i1 %28, label %29, label %38

29:                                               ; preds = %20
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = call zeroext i1 @ast_canerror(ptr noundef %30)
  br i1 %31, label %38, label %32

32:                                               ; preds = %29
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.pass_opt_t, ptr %33, i32 0, i32 36
  %35 = getelementptr inbounds %struct.typecheck_t, ptr %34, i32 0, i32 2
  %36 = load ptr, ptr %35, align 8, !tbaa !9
  %37 = load ptr, ptr %6, align 8, !tbaa !5
  call void (ptr, ptr, ptr, ...) @ast_error(ptr noundef %36, ptr noundef %37, ptr noundef @.str.2)
  store i1 false, ptr %3, align 1
  store i32 1, ptr %10, align 4
  br label %69

38:                                               ; preds = %29, %20
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = call zeroext i1 @ast_canerror(ptr noundef %39)
  br i1 %40, label %44, label %41

41:                                               ; preds = %38
  %42 = load ptr, ptr %8, align 8, !tbaa !5
  %43 = call zeroext i1 @ast_canerror(ptr noundef %42)
  br i1 %43, label %44, label %46

44:                                               ; preds = %41, %38
  %45 = load ptr, ptr %5, align 8, !tbaa !5
  call void @ast_seterror(ptr noundef %45)
  br label %46

46:                                               ; preds = %44, %41
  %47 = load ptr, ptr %6, align 8, !tbaa !5
  %48 = call zeroext i1 @ast_cansend(ptr noundef %47)
  br i1 %48, label %55, label %49

49:                                               ; preds = %46
  %50 = load ptr, ptr %7, align 8, !tbaa !5
  %51 = call zeroext i1 @ast_cansend(ptr noundef %50)
  br i1 %51, label %55, label %52

52:                                               ; preds = %49
  %53 = load ptr, ptr %8, align 8, !tbaa !5
  %54 = call zeroext i1 @ast_cansend(ptr noundef %53)
  br i1 %54, label %55, label %57

55:                                               ; preds = %52, %49, %46
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  call void @ast_setsend(ptr noundef %56)
  br label %57

57:                                               ; preds = %55, %52
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  %59 = call zeroext i1 @ast_mightsend(ptr noundef %58)
  br i1 %59, label %66, label %60

60:                                               ; preds = %57
  %61 = load ptr, ptr %7, align 8, !tbaa !5
  %62 = call zeroext i1 @ast_mightsend(ptr noundef %61)
  br i1 %62, label %66, label %63

63:                                               ; preds = %60
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = call zeroext i1 @ast_mightsend(ptr noundef %64)
  br i1 %65, label %66, label %68

66:                                               ; preds = %63, %60, %57
  %67 = load ptr, ptr %5, align 8, !tbaa !5
  call void @ast_setmightsend(ptr noundef %67)
  br label %68

68:                                               ; preds = %66, %63
  store i1 true, ptr %3, align 1
  store i32 1, ptr %10, align 4
  br label %69

69:                                               ; preds = %68, %32
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %70 = load i1, ptr %3, align 1
  ret i1 %70
}

declare i32 @ast_id(ptr noundef) #1

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

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

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

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

declare zeroext i1 @ast_canerror(ptr noundef) #1

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

declare void @ast_seterror(ptr noundef) #1

declare zeroext i1 @ast_cansend(ptr noundef) #1

declare void @ast_setsend(ptr noundef) #1

declare zeroext i1 @ast_mightsend(ptr noundef) #1

declare void @ast_setmightsend(ptr noundef) #1

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 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 216}
!10 = !{!"pass_opt_t", !11, i64 0, !11, i64 4, !12, i64 8, !12, i64 9, !12, i64 10, !12, i64 11, !12, i64 12, !12, i64 13, !12, i64 14, !12, i64 15, !12, i64 16, !12, i64 17, !12, i64 18, !12, i64 19, !12, i64 20, !12, i64 21, !11, i64 24, !13, i64 32, !12, i64 40, !12, 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, !14, i64 176, !6, i64 224, !6, i64 232}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!"typecheck_t", !6, i64 0, !15, i64 8, !6, i64 40}
!15 = !{!"typecheck_stats_t", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24}


; 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 [60 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [78 x i8], align 1
@__func__.verify_try = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [41 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @verify_try(ptr nocapture noundef readonly %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca [4 x ptr], align 16
  %7 = tail call i32 @ast_id(ptr noundef %1) #3
  %8 = icmp eq i32 %7, 124
  br i1 %8, label %13, label %9

9:                                                ; preds = %2
  %10 = tail call i32 @ast_id(ptr noundef %1) #3
  %11 = icmp eq i32 %10, 125
  br i1 %11, label %13, label %12

12:                                               ; preds = %9
  tail call void @ponyint_assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i64 noundef 6, ptr noundef nonnull @__func__.verify_try) #3
  br label %13

13:                                               ; preds = %2, %9, %12
  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 32, ptr nonnull %6) #3
  store ptr %3, ptr %6, align 16, !tbaa !5
  %14 = getelementptr inbounds i8, ptr %6, i64 8
  store ptr %4, ptr %14, align 8, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %6, i64 16
  store ptr %5, ptr %15, align 16, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %6, i64 24
  store ptr null, ptr %16, align 8, !tbaa !5
  call void @ast_get_children(ptr noundef %1, i64 noundef 3, ptr noundef nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #3
  %17 = call i32 @ast_id(ptr noundef %1) #3
  %.not = icmp eq i32 %17, 125
  br i1 %.not, label %25, label %18

18:                                               ; preds = %13
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = call zeroext i1 @ast_canerror(ptr noundef %19) #3
  br i1 %20, label %25, label %21

21:                                               ; preds = %18
  %22 = getelementptr inbounds i8, ptr %0, i64 216
  %23 = load ptr, ptr %22, align 8, !tbaa !9
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  call void (ptr, ptr, ptr, ...) @ast_error(ptr noundef %23, ptr noundef %24, ptr noundef nonnull @.str.2) #3
  br label %52

25:                                               ; preds = %18, %13
  %26 = load ptr, ptr %4, align 8, !tbaa !5
  %27 = call zeroext i1 @ast_canerror(ptr noundef %26) #3
  br i1 %27, label %31, label %28

28:                                               ; preds = %25
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = call zeroext i1 @ast_canerror(ptr noundef %29) #3
  br i1 %30, label %31, label %32

31:                                               ; preds = %28, %25
  call void @ast_seterror(ptr noundef %1) #3
  br label %32

32:                                               ; preds = %31, %28
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = call zeroext i1 @ast_cansend(ptr noundef %33) #3
  br i1 %34, label %41, label %35

35:                                               ; preds = %32
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = call zeroext i1 @ast_cansend(ptr noundef %36) #3
  br i1 %37, label %41, label %38

38:                                               ; preds = %35
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = call zeroext i1 @ast_cansend(ptr noundef %39) #3
  br i1 %40, label %41, label %42

41:                                               ; preds = %38, %35, %32
  call void @ast_setsend(ptr noundef %1) #3
  br label %42

42:                                               ; preds = %41, %38
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = call zeroext i1 @ast_mightsend(ptr noundef %43) #3
  br i1 %44, label %51, label %45

45:                                               ; preds = %42
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = call zeroext i1 @ast_mightsend(ptr noundef %46) #3
  br i1 %47, label %51, label %48

48:                                               ; preds = %45
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = call zeroext i1 @ast_mightsend(ptr noundef %49) #3
  br i1 %50, label %51, label %52

51:                                               ; preds = %48, %45, %42
  call void @ast_setmightsend(ptr noundef %1) #3
  br label %52

52:                                               ; preds = %48, %51, %21
  %.0 = phi i1 [ false, %21 ], [ true, %51 ], [ true, %48 ]
  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
  ret i1 %.0
}

declare i32 @ast_id(ptr noundef) local_unnamed_addr #1

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

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

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

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

declare zeroext i1 @ast_canerror(ptr noundef) local_unnamed_addr #1

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

declare void @ast_seterror(ptr noundef) local_unnamed_addr #1

declare zeroext i1 @ast_cansend(ptr noundef) local_unnamed_addr #1

declare void @ast_setsend(ptr noundef) local_unnamed_addr #1

declare zeroext i1 @ast_mightsend(ptr noundef) local_unnamed_addr #1

declare void @ast_setmightsend(ptr noundef) local_unnamed_addr #1

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 = { "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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 216}
!10 = !{!"pass_opt_t", !11, i64 0, !11, i64 4, !12, i64 8, !12, i64 9, !12, i64 10, !12, i64 11, !12, i64 12, !12, i64 13, !12, i64 14, !12, i64 15, !12, i64 16, !12, i64 17, !12, i64 18, !12, i64 19, !12, i64 20, !12, i64 21, !11, i64 24, !13, i64 32, !12, i64 40, !12, 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, !14, i64 176, !6, i64 224, !6, i64 232}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!"typecheck_t", !6, i64 0, !15, i64 8, !6, i64 40}
!15 = !{!"typecheck_stats_t", !13, i64 0, !13, i64 8, !13, i64 16, !13, i64 24}


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