; LLVM IR from ponylang/ponyc :: src/libponyc/expr (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 [22 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [76 x i8], align 1
@__func__.expr_seq = external hidden unnamed_addr constant [9 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [36 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @expr_seq(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
  %8 = alloca i8, align 1
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %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
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  %14 = call i32 @ast_id(ptr noundef %13)
  %15 = icmp eq i32 %14, 175
  br i1 %15, label %16, label %17

16:                                               ; preds = %2
  br label %18

17:                                               ; preds = %2
  call void @ponyint_assert_fail(ptr noundef @.str, ptr noundef @.str.1, i64 noundef 18, ptr noundef @__func__.expr_seq)
  br label %18

18:                                               ; preds = %17, %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = call ptr @ast_parent(ptr noundef %19)
  store ptr %20, ptr %6, align 8, !tbaa !5
  %21 = load ptr, ptr %6, align 8, !tbaa !5
  %22 = call i32 @ast_id(ptr noundef %21)
  %23 = icmp eq i32 %22, 179
  br i1 %23, label %24, label %25

24:                                               ; preds = %18
  store i1 true, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %78

25:                                               ; preds = %18
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #3
  store i8 1, ptr %8, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = call ptr @ast_child(ptr noundef %26)
  store ptr %27, ptr %9, align 8, !tbaa !5
  br label %28

28:                                               ; preds = %50, %25
  %29 = load ptr, ptr %9, align 8, !tbaa !5
  %30 = call ptr @ast_sibling(ptr noundef %29)
  %31 = icmp ne ptr %30, null
  br i1 %31, label %33, label %32

32:                                               ; preds = %28
  store i32 2, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  br label %53

33:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %34 = load ptr, ptr %9, align 8, !tbaa !5
  %35 = call ptr @ast_type(ptr noundef %34)
  store ptr %35, ptr %10, align 8, !tbaa !5
  %36 = load ptr, ptr %10, align 8, !tbaa !5
  %37 = call zeroext i1 @is_typecheck_error(ptr noundef %36)
  br i1 %37, label %38, label %39

38:                                               ; preds = %33
  store i8 0, ptr %8, align 1, !tbaa !9
  br label %49

39:                                               ; preds = %33
  %40 = load ptr, ptr %10, align 8, !tbaa !5
  %41 = call zeroext i1 @is_type_literal(ptr noundef %40)
  br i1 %41, label %42, label %48

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

48:                                               ; preds = %42, %39
  br label %49

49:                                               ; preds = %48, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br label %50

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

53:                                               ; preds = %32
  %54 = load i8, ptr %8, align 1, !tbaa !9, !range !19, !noundef !20
  %55 = trunc i8 %54 to i1
  br i1 %55, label %57, label %56

56:                                               ; preds = %53
  store i1 false, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %77

57:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #3
  %58 = load ptr, ptr %5, align 8, !tbaa !5
  %59 = call ptr @ast_type(ptr noundef %58)
  store ptr %59, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %60 = load ptr, ptr %5, align 8, !tbaa !5
  %61 = call ptr @ast_childlast(ptr noundef %60)
  store ptr %61, ptr %12, align 8, !tbaa !5
  %62 = load ptr, ptr %11, align 8, !tbaa !5
  %63 = icmp ne ptr %62, null
  br i1 %63, label %64, label %69

64:                                               ; preds = %57
  %65 = load ptr, ptr %11, align 8, !tbaa !5
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = call zeroext i1 @coerce_literals(ptr noundef %12, ptr noundef %65, ptr noundef %66)
  br i1 %67, label %69, label %68

68:                                               ; preds = %64
  store i1 false, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %76

69:                                               ; preds = %64, %57
  %70 = load ptr, ptr %4, align 8, !tbaa !5
  %71 = load ptr, ptr %11, align 8, !tbaa !5
  %72 = load ptr, ptr %12, align 8, !tbaa !5
  %73 = call ptr @control_type_add_branch(ptr noundef %70, ptr noundef %71, ptr noundef %72)
  store ptr %73, ptr %11, align 8, !tbaa !5
  %74 = load ptr, ptr %5, align 8, !tbaa !5
  %75 = load ptr, ptr %11, align 8, !tbaa !5
  call void @ast_settype(ptr noundef %74, ptr noundef %75)
  store i1 true, ptr %3, align 1
  store i32 1, ptr %7, align 4
  br label %76

76:                                               ; preds = %69, %68
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #3
  br label %77

77:                                               ; preds = %76, %56
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #3
  br label %78

78:                                               ; preds = %77, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %79 = load i1, ptr %3, align 1
  ret i1 %79
}

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 ptr @ast_parent(ptr noundef) #1

declare ptr @ast_child(ptr noundef) #1

declare ptr @ast_sibling(ptr noundef) #1

declare ptr @ast_type(ptr noundef) #1

declare zeroext i1 @is_typecheck_error(ptr noundef) #1

declare zeroext i1 @is_type_literal(ptr noundef) #1

declare void @ast_error(ptr noundef, 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

declare ptr @ast_childlast(ptr noundef) #1

declare zeroext i1 @coerce_literals(ptr noundef, ptr noundef, ptr noundef) #1

declare ptr @control_type_add_branch(ptr noundef, ptr noundef, ptr noundef) #1

declare void @ast_settype(ptr noundef, 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, !10, i64 0}
!10 = !{!"_Bool", !7, i64 0}
!11 = !{!12, !6, i64 216}
!12 = !{!"pass_opt_t", !13, i64 0, !13, 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, !13, i64 24, !14, 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, !15, i64 176, !6, i64 224, !6, i64 232}
!13 = !{!"int", !7, i64 0}
!14 = !{!"long", !7, i64 0}
!15 = !{!"typecheck_t", !6, i64 0, !16, i64 8, !6, i64 40}
!16 = !{!"typecheck_stats_t", !14, i64 0, !14, i64 8, !14, i64 16, !14, i64 24}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{i8 0, i8 2}
!20 = !{}


; 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 [22 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [76 x i8], align 1
@__func__.expr_seq = external hidden unnamed_addr constant [9 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [36 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef zeroext i1 @expr_seq(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca ptr, align 8
  %4 = tail call i32 @ast_id(ptr noundef %1) #3
  %5 = icmp eq i32 %4, 175
  br i1 %5, label %7, label %6

6:                                                ; preds = %2
  tail call void @ponyint_assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i64 noundef 18, ptr noundef nonnull @__func__.expr_seq) #3
  br label %7

7:                                                ; preds = %2, %6
  %8 = tail call ptr @ast_parent(ptr noundef %1) #3
  %9 = tail call i32 @ast_id(ptr noundef %8) #3
  %10 = icmp eq i32 %9, 179
  br i1 %10, label %33, label %11

11:                                               ; preds = %7
  %12 = tail call ptr @ast_child(ptr noundef %1) #3
  %13 = tail call ptr @ast_sibling(ptr noundef %12) #3
  %.not26 = icmp eq ptr %13, null
  br i1 %.not26, label %.critedge, label %.lr.ph

.lr.ph:                                           ; preds = %11
  %14 = getelementptr inbounds i8, ptr %0, i64 216
  br label %15

._crit_edge:                                      ; preds = %22
  br i1 %.123, label %.critedge, label %33

15:                                               ; preds = %.lr.ph, %22
  %.02128 = phi ptr [ %12, %.lr.ph ], [ %23, %22 ]
  %.02227 = phi i1 [ true, %.lr.ph ], [ %.123, %22 ]
  %16 = tail call ptr @ast_type(ptr noundef %.02128) #3
  %17 = tail call zeroext i1 @is_typecheck_error(ptr noundef %16) #3
  br i1 %17, label %22, label %18

18:                                               ; preds = %15
  %19 = tail call zeroext i1 @is_type_literal(ptr noundef %16) #3
  br i1 %19, label %20, label %22

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

22:                                               ; preds = %15, %18, %20
  %.123 = phi i1 [ false, %20 ], [ %.02227, %18 ], [ false, %15 ]
  %23 = tail call ptr @ast_sibling(ptr noundef %.02128) #3
  %24 = tail call ptr @ast_sibling(ptr noundef %23) #3
  %.not = icmp eq ptr %24, null
  br i1 %.not, label %._crit_edge, label %15, !llvm.loop !15

.critedge:                                        ; preds = %11, %._crit_edge
  %25 = tail call ptr @ast_type(ptr noundef %1) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  %26 = tail call ptr @ast_childlast(ptr noundef %1) #3
  store ptr %26, ptr %3, align 8, !tbaa !17
  %.not25 = icmp eq ptr %25, null
  br i1 %.not25, label %29, label %27

27:                                               ; preds = %.critedge
  %28 = call zeroext i1 @coerce_literals(ptr noundef nonnull %3, ptr noundef nonnull %25, ptr noundef %0) #3
  br i1 %28, label %._crit_edge29, label %32

._crit_edge29:                                    ; preds = %27
  %.pre = load ptr, ptr %3, align 8, !tbaa !17
  br label %29

29:                                               ; preds = %._crit_edge29, %.critedge
  %30 = phi ptr [ %.pre, %._crit_edge29 ], [ %26, %.critedge ]
  %31 = call ptr @control_type_add_branch(ptr noundef %0, ptr noundef %25, ptr noundef %30) #3
  call void @ast_settype(ptr noundef %1, ptr noundef %31) #3
  br label %32

32:                                               ; preds = %27, %29
  %.0 = phi i1 [ true, %29 ], [ false, %27 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  br label %33

33:                                               ; preds = %32, %._crit_edge, %7
  %.2 = phi i1 [ true, %7 ], [ %.0, %32 ], [ false, %._crit_edge ]
  ret i1 %.2
}

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 ptr @ast_parent(ptr noundef) local_unnamed_addr #1

declare ptr @ast_child(ptr noundef) local_unnamed_addr #1

declare ptr @ast_sibling(ptr noundef) local_unnamed_addr #1

declare ptr @ast_type(ptr noundef) local_unnamed_addr #1

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

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

declare void @ast_error(ptr noundef, ptr 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 ptr @ast_childlast(ptr noundef) local_unnamed_addr #1

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

declare ptr @control_type_add_branch(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @ast_settype(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 = { 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, !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"}
!17 = !{!12, !12, i64 0}


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