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

; 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 [19 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [72 x i8], align 1
@__func__.void_star_param = external hidden unnamed_addr constant [16 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @void_star_param(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 i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = icmp ne ptr %8, null
  br i1 %9, label %10, label %11

10:                                               ; preds = %2
  br label %12

11:                                               ; preds = %2
  call void @ponyint_assert_fail(ptr noundef @.str, ptr noundef @.str.1, i64 noundef 12, ptr noundef @__func__.void_star_param)
  br label %12

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

15:                                               ; preds = %12
  br label %17

16:                                               ; preds = %12
  call void @ponyint_assert_fail(ptr noundef @.str.2, ptr noundef @.str.1, i64 noundef 13, ptr noundef @__func__.void_star_param)
  br label %17

17:                                               ; preds = %16, %15
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = call zeroext i1 @is_pointer(ptr noundef %18)
  br i1 %19, label %21, label %20

20:                                               ; preds = %17
  store i1 false, ptr %3, align 1
  br label %52

21:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = call ptr @ast_childidx(ptr noundef %22, i64 noundef 2)
  store ptr %23, ptr %6, align 8, !tbaa !5
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = call i64 @ast_childcount(ptr noundef %24)
  %26 = icmp ne i64 %25, 1
  br i1 %26, label %31, label %27

27:                                               ; preds = %21
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = call ptr @ast_child(ptr noundef %28)
  %30 = call zeroext i1 @is_none(ptr noundef %29)
  br i1 %30, label %32, label %31

31:                                               ; preds = %27, %21
  store i1 false, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %51

32:                                               ; preds = %27
  br label %33

33:                                               ; preds = %37, %32
  %34 = load ptr, ptr %5, align 8, !tbaa !5
  %35 = call i32 @ast_id(ptr noundef %34)
  %36 = icmp eq i32 %35, 17
  br i1 %36, label %37, label %40

37:                                               ; preds = %33
  %38 = load ptr, ptr %5, align 8, !tbaa !5
  %39 = call ptr @ast_childidx(ptr noundef %38, i64 noundef 1)
  store ptr %39, ptr %5, align 8, !tbaa !5
  br label %33, !llvm.loop !9

40:                                               ; preds = %33
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = call zeroext i1 @is_pointer(ptr noundef %41)
  br i1 %42, label %49, label %43

43:                                               ; preds = %40
  %44 = load ptr, ptr %5, align 8, !tbaa !5
  %45 = call zeroext i1 @is_nullable_pointer(ptr noundef %44)
  br i1 %45, label %49, label %46

46:                                               ; preds = %43
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = call zeroext i1 @is_literal(ptr noundef %47, ptr noundef @.str.3)
  br i1 %48, label %49, label %50

49:                                               ; preds = %46, %43, %40
  store i1 true, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %51

50:                                               ; preds = %46
  store i1 false, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %51

51:                                               ; preds = %50, %49, %31
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  br label %52

52:                                               ; preds = %51, %20
  %53 = load i1, ptr %3, align 1
  ret i1 %53
}

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

declare zeroext i1 @is_pointer(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 ptr @ast_childidx(ptr noundef, i64 noundef) #1

declare i64 @ast_childcount(ptr noundef) #1

declare zeroext i1 @is_none(ptr noundef) #1

declare ptr @ast_child(ptr noundef) #1

declare i32 @ast_id(ptr noundef) #1

declare zeroext i1 @is_nullable_pointer(ptr noundef) #1

declare zeroext i1 @is_literal(ptr 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

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 = distinct !{!9, !10}
!10 = !{!"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 [19 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [72 x i8], align 1
@__func__.void_star_param = external hidden unnamed_addr constant [16 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [6 x i8], align 1

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

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

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

5:                                                ; preds = %4
  tail call void @ponyint_assert_fail(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.1, i64 noundef 13, ptr noundef nonnull @__func__.void_star_param) #2
  br label %6

6:                                                ; preds = %4, %5
  %7 = tail call zeroext i1 @is_pointer(ptr noundef %0) #2
  br i1 %7, label %8, label %24

8:                                                ; preds = %6
  %9 = tail call ptr @ast_childidx(ptr noundef %0, i64 noundef 2) #2
  %10 = tail call i64 @ast_childcount(ptr noundef %9) #2
  %.not14 = icmp eq i64 %10, 1
  br i1 %.not14, label %11, label %24

11:                                               ; preds = %8
  %12 = tail call ptr @ast_child(ptr noundef %9) #2
  %13 = tail call zeroext i1 @is_none(ptr noundef %12) #2
  br i1 %13, label %.preheader, label %24

.preheader:                                       ; preds = %11
  %14 = tail call i32 @ast_id(ptr noundef %1) #2
  %15 = icmp eq i32 %14, 17
  br i1 %15, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader, %.lr.ph
  %.01215 = phi ptr [ %16, %.lr.ph ], [ %1, %.preheader ]
  %16 = tail call ptr @ast_childidx(ptr noundef %.01215, i64 noundef 1) #2
  %17 = tail call i32 @ast_id(ptr noundef %16) #2
  %18 = icmp eq i32 %17, 17
  br i1 %18, label %.lr.ph, label %._crit_edge, !llvm.loop !5

._crit_edge:                                      ; preds = %.lr.ph, %.preheader
  %.012.lcssa = phi ptr [ %1, %.preheader ], [ %16, %.lr.ph ]
  %19 = tail call zeroext i1 @is_pointer(ptr noundef %.012.lcssa) #2
  br i1 %19, label %24, label %20

20:                                               ; preds = %._crit_edge
  %21 = tail call zeroext i1 @is_nullable_pointer(ptr noundef %.012.lcssa) #2
  br i1 %21, label %24, label %22

22:                                               ; preds = %20
  %23 = tail call zeroext i1 @is_literal(ptr noundef %.012.lcssa, ptr noundef nonnull @.str.3) #2
  br label %24

24:                                               ; preds = %22, %11, %8, %20, %._crit_edge, %6
  %.1 = phi i1 [ false, %6 ], [ false, %11 ], [ false, %8 ], [ true, %20 ], [ true, %._crit_edge ], [ %23, %22 ]
  ret i1 %.1
}

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

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

declare ptr @ast_childidx(ptr noundef, i64 noundef) local_unnamed_addr #1

declare i64 @ast_childcount(ptr noundef) local_unnamed_addr #1

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

declare ptr @ast_child(ptr noundef) local_unnamed_addr #1

declare i32 @ast_id(ptr noundef) local_unnamed_addr #1

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

declare zeroext i1 @is_literal(ptr 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


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