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

; 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 [44 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [75 x i8], align 1
@__func__.pass_verify = external hidden unnamed_addr constant [12 x i8], align 1

; 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 willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: nounwind uwtable
define dso_local i32 @pass_verify(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  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 8, ptr %6) #3
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %10, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #3
  store i8 1, ptr %7, align 1, !tbaa !9
  %11 = load ptr, ptr %6, align 8, !tbaa !5
  %12 = call i32 @ast_id(ptr noundef %11)
  switch i32 %12, label %64 [
    i32 75, label %13
    i32 24, label %18
    i32 72, label %23
    i32 89, label %28
    i32 88, label %28
    i32 90, label %28
    i32 191, label %33
    i32 204, label %33
    i32 188, label %33
    i32 190, label %38
    i32 203, label %38
    i32 189, label %38
    i32 143, label %43
    i32 124, label %48
    i32 125, label %48
    i32 206, label %53
    i32 127, label %57
    i32 82, label %59
    i32 83, label %59
  ]

13:                                               ; preds = %2
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = call zeroext i1 @verify_struct(ptr noundef %14, ptr noundef %15)
  %17 = zext i1 %16 to i8
  store i8 %17, ptr %7, align 1, !tbaa !9
  br label %66

18:                                               ; preds = %2
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = call zeroext i1 @verify_assign(ptr noundef %19, ptr noundef %20)
  %22 = zext i1 %21 to i8
  store i8 %22, ptr %7, align 1, !tbaa !9
  br label %66

23:                                               ; preds = %2
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = load ptr, ptr %6, align 8, !tbaa !5
  %26 = call zeroext i1 @verify_interface(ptr noundef %24, ptr noundef %25)
  %27 = zext i1 %26 to i8
  store i8 %27, ptr %7, align 1, !tbaa !9
  br label %66

28:                                               ; preds = %2, %2, %2
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = load ptr, ptr %6, align 8, !tbaa !5
  %31 = call zeroext i1 @verify_fun(ptr noundef %29, ptr noundef %30)
  %32 = zext i1 %31 to i8
  store i8 %32, ptr %7, align 1, !tbaa !9
  br label %66

33:                                               ; preds = %2, %2, %2
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = load ptr, ptr %6, align 8, !tbaa !5
  %36 = call zeroext i1 @verify_function_call(ptr noundef %34, ptr noundef %35)
  %37 = zext i1 %36 to i8
  store i8 %37, ptr %7, align 1, !tbaa !9
  br label %66

38:                                               ; preds = %2, %2, %2
  %39 = load ptr, ptr %5, align 8, !tbaa !5
  %40 = load ptr, ptr %6, align 8, !tbaa !5
  %41 = call zeroext i1 @verify_behaviour_call(ptr noundef %39, ptr noundef %40)
  %42 = zext i1 %41 to i8
  store i8 %42, ptr %7, align 1, !tbaa !9
  br label %66

43:                                               ; preds = %2
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = call zeroext i1 @verify_ffi_call(ptr noundef %44, ptr noundef %45)
  %47 = zext i1 %46 to i8
  store i8 %47, ptr %7, align 1, !tbaa !9
  br label %66

48:                                               ; preds = %2, %2
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = load ptr, ptr %6, align 8, !tbaa !5
  %51 = call zeroext i1 @verify_try(ptr noundef %49, ptr noundef %50)
  %52 = zext i1 %51 to i8
  store i8 %52, ptr %7, align 1, !tbaa !9
  br label %66

53:                                               ; preds = %2
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = call zeroext i1 @verify_disposing_block(ptr noundef %54)
  %56 = zext i1 %55 to i8
  store i8 %56, ptr %7, align 1, !tbaa !9
  br label %66

57:                                               ; preds = %2
  %58 = load ptr, ptr %6, align 8, !tbaa !5
  call void @ast_seterror(ptr noundef %58)
  br label %66

59:                                               ; preds = %2, %2
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = load ptr, ptr %6, align 8, !tbaa !5
  %62 = call zeroext i1 @verify_is(ptr noundef %60, ptr noundef %61)
  %63 = zext i1 %62 to i8
  store i8 %63, ptr %7, align 1, !tbaa !9
  br label %66

64:                                               ; preds = %2
  %65 = load ptr, ptr %6, align 8, !tbaa !5
  call void @ast_inheritflags(ptr noundef %65)
  br label %66

66:                                               ; preds = %64, %59, %57, %53, %48, %43, %38, %33, %28, %23, %18, %13
  %67 = load i8, ptr %7, align 1, !tbaa !9, !range !11, !noundef !12
  %68 = trunc i8 %67 to i1
  br i1 %68, label %79, label %69

69:                                               ; preds = %66
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.pass_opt_t, ptr %70, i32 0, i32 36
  %72 = getelementptr inbounds %struct.typecheck_t, ptr %71, i32 0, i32 2
  %73 = load ptr, ptr %72, align 8, !tbaa !13
  %74 = call i64 @errors_get_count(ptr noundef %73)
  %75 = icmp ugt i64 %74, 0
  br i1 %75, label %76, label %77

76:                                               ; preds = %69
  br label %78

77:                                               ; preds = %69
  call void @ponyint_assert_fail(ptr noundef @.str, ptr noundef @.str.1, i64 noundef 650, ptr noundef @__func__.pass_verify)
  br label %78

78:                                               ; preds = %77, %76
  store i32 2, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %80

79:                                               ; preds = %66
  store i32 0, ptr %3, align 4
  store i32 1, ptr %8, align 4
  br label %80

80:                                               ; preds = %79, %78
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %81 = load i32, ptr %3, align 4
  ret i32 %81
}

declare i32 @ast_id(ptr noundef) #2

declare zeroext i1 @verify_struct(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @verify_assign(ptr noundef, ptr noundef) #1

declare zeroext i1 @verify_interface(ptr noundef, ptr noundef) #2

declare zeroext i1 @verify_fun(ptr noundef, ptr noundef) #2

declare zeroext i1 @verify_function_call(ptr noundef, ptr noundef) #2

declare zeroext i1 @verify_behaviour_call(ptr noundef, ptr noundef) #2

declare zeroext i1 @verify_ffi_call(ptr noundef, ptr noundef) #2

declare zeroext i1 @verify_try(ptr noundef, ptr noundef) #2

declare zeroext i1 @verify_disposing_block(ptr noundef) #2

declare void @ast_seterror(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @verify_is(ptr noundef, ptr noundef) #1

declare void @ast_inheritflags(ptr noundef) #2

declare i64 @errors_get_count(ptr noundef) #2

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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, !6, i64 216}
!14 = !{!"pass_opt_t", !15, i64 0, !15, 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, !15, i64 24, !16, 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, !17, i64 176, !6, i64 224, !6, i64 232}
!15 = !{!"int", !7, i64 0}
!16 = !{!"long", !7, i64 0}
!17 = !{!"typecheck_t", !6, i64 0, !18, i64 8, !6, i64 40}
!18 = !{!"typecheck_stats_t", !16, i64 0, !16, i64 8, !16, i64 16, !16, 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 [44 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [75 x i8], align 1
@__func__.pass_verify = external hidden unnamed_addr constant [12 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 3) i32 @pass_verify(ptr nocapture noundef readonly %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = load ptr, ptr %0, align 8, !tbaa !5
  %4 = tail call i32 @ast_id(ptr noundef %3) #2
  switch i32 %4, label %24 [
    i32 75, label %25
    i32 24, label %5
    i32 72, label %7
    i32 89, label %9
    i32 88, label %9
    i32 90, label %9
    i32 191, label %11
    i32 204, label %11
    i32 188, label %11
    i32 190, label %13
    i32 203, label %13
    i32 189, label %13
    i32 143, label %15
    i32 124, label %17
    i32 125, label %17
    i32 206, label %19
    i32 127, label %21
    i32 82, label %22
    i32 83, label %22
  ]

5:                                                ; preds = %2
  %6 = tail call zeroext i1 @verify_assign(ptr noundef %1, ptr noundef %3)
  br i1 %6, label %.critedge, label %27

7:                                                ; preds = %2
  %8 = tail call zeroext i1 @verify_interface(ptr noundef %1, ptr noundef %3) #2
  br i1 %8, label %.critedge, label %27

9:                                                ; preds = %2, %2, %2
  %10 = tail call zeroext i1 @verify_fun(ptr noundef %1, ptr noundef %3) #2
  br i1 %10, label %.critedge, label %27

11:                                               ; preds = %2, %2, %2
  %12 = tail call zeroext i1 @verify_function_call(ptr noundef %1, ptr noundef %3) #2
  br i1 %12, label %.critedge, label %27

13:                                               ; preds = %2, %2, %2
  %14 = tail call zeroext i1 @verify_behaviour_call(ptr noundef %1, ptr noundef %3) #2
  br i1 %14, label %.critedge, label %27

15:                                               ; preds = %2
  %16 = tail call zeroext i1 @verify_ffi_call(ptr noundef %1, ptr noundef %3) #2
  br i1 %16, label %.critedge, label %27

17:                                               ; preds = %2, %2
  %18 = tail call zeroext i1 @verify_try(ptr noundef %1, ptr noundef %3) #2
  br i1 %18, label %.critedge, label %27

19:                                               ; preds = %2
  %20 = tail call zeroext i1 @verify_disposing_block(ptr noundef %3) #2
  br i1 %20, label %.critedge, label %27

21:                                               ; preds = %2
  tail call void @ast_seterror(ptr noundef %3) #2
  br label %.critedge

22:                                               ; preds = %2, %2
  %23 = tail call zeroext i1 @verify_is(ptr noundef %1, ptr noundef %3)
  br i1 %23, label %.critedge, label %27

24:                                               ; preds = %2
  tail call void @ast_inheritflags(ptr noundef %3) #2
  br label %.critedge

25:                                               ; preds = %2
  %26 = tail call zeroext i1 @verify_struct(ptr noundef %1, ptr noundef %3) #2
  br i1 %26, label %.critedge, label %27

27:                                               ; preds = %5, %7, %9, %11, %13, %15, %17, %19, %22, %25
  %28 = getelementptr inbounds i8, ptr %1, i64 216
  %29 = load ptr, ptr %28, align 8, !tbaa !9
  %30 = tail call i64 @errors_get_count(ptr noundef %29) #2
  %.not = icmp eq i64 %30, 0
  br i1 %.not, label %31, label %.critedge

31:                                               ; preds = %27
  tail call void @ponyint_assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i64 noundef 650, ptr noundef nonnull @__func__.pass_verify) #2
  br label %.critedge

.critedge:                                        ; preds = %5, %7, %9, %11, %13, %15, %17, %19, %22, %25, %21, %24, %31, %27
  %.025 = phi i32 [ 2, %27 ], [ 2, %31 ], [ 0, %24 ], [ 0, %21 ], [ 0, %25 ], [ 0, %22 ], [ 0, %19 ], [ 0, %17 ], [ 0, %15 ], [ 0, %13 ], [ 0, %11 ], [ 0, %9 ], [ 0, %7 ], [ 0, %5 ]
  ret i32 %.025
}

declare i32 @ast_id(ptr noundef) local_unnamed_addr #1

declare zeroext i1 @verify_struct(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @verify_assign(ptr noundef, ptr noundef) local_unnamed_addr #0

declare zeroext i1 @verify_interface(ptr noundef, ptr noundef) local_unnamed_addr #1

declare zeroext i1 @verify_fun(ptr noundef, ptr noundef) local_unnamed_addr #1

declare zeroext i1 @verify_function_call(ptr noundef, ptr noundef) local_unnamed_addr #1

declare zeroext i1 @verify_behaviour_call(ptr noundef, ptr noundef) local_unnamed_addr #1

declare zeroext i1 @verify_ffi_call(ptr noundef, ptr noundef) local_unnamed_addr #1

declare zeroext i1 @verify_try(ptr noundef, ptr noundef) local_unnamed_addr #1

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

declare void @ast_seterror(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden zeroext i1 @verify_is(ptr noundef, ptr noundef) local_unnamed_addr #0

declare void @ast_inheritflags(ptr noundef) local_unnamed_addr #1

declare i64 @errors_get_count(ptr noundef) local_unnamed_addr #1

declare void @ponyint_assert_fail(ptr noundef, ptr noundef, i64 noundef, 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 = { 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: GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass