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

; 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.2 = external hidden unnamed_addr constant [77 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [26 x i8], align 1
@__func__.expr_consume = external hidden unnamed_addr constant [13 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [22 x i8], align 1

declare void @ast_settype(ptr noundef, ptr noundef) #0

declare i32 @ast_id(ptr noundef) #0

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

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

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

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

declare ptr @ast_type(ptr noundef) #0

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

declare zeroext i1 @is_typecheck_error(ptr noundef) #0

declare ptr @consume_type(ptr noundef, i32 noundef, i1 noundef zeroext) #0

declare ptr @ast_print_type(ptr noundef) #0

declare void @ast_error_continue(ptr noundef, ptr noundef, ptr noundef, ...) #0

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @expr_consume(ptr noundef %0, ptr noundef %1) #2 {
  %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 [3 x ptr], align 16
  %9 = alloca i32, align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %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, 106
  br i1 %15, label %16, label %17

16:                                               ; preds = %2
  br label %18

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

18:                                               ; preds = %17, %16
  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 24, ptr %8) #3
  store ptr %6, ptr %8, align 8, !tbaa !5
  %19 = getelementptr inbounds ptr, ptr %8, i64 1
  store ptr %7, ptr %19, align 8, !tbaa !5
  %20 = getelementptr inbounds ptr, ptr %8, i64 2
  store ptr null, ptr %20, align 8, !tbaa !5
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds [3 x ptr], ptr %8, i64 0, i64 0
  call void @ast_get_children(ptr noundef %21, i64 noundef 2, ptr noundef %22)
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #3
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = call i32 @ast_id(ptr noundef %23)
  %25 = icmp ne i32 %24, 2
  br i1 %25, label %26, label %56

26:                                               ; preds = %18
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = call i32 @ast_id(ptr noundef %27)
  %29 = icmp ne i32 %28, 192
  br i1 %29, label %30, label %56

30:                                               ; preds = %26
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = call i32 @ast_id(ptr noundef %31)
  %33 = icmp ne i32 %32, 197
  br i1 %33, label %34, label %56

34:                                               ; preds = %30
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = call i32 @ast_id(ptr noundef %35)
  %37 = icmp ne i32 %36, 196
  br i1 %37, label %38, label %56

38:                                               ; preds = %34
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  %40 = call i32 @ast_id(ptr noundef %39)
  %41 = icmp ne i32 %40, 102
  br i1 %41, label %42, label %56

42:                                               ; preds = %38
  %43 = load ptr, ptr %7, align 8, !tbaa !5
  %44 = call i32 @ast_id(ptr noundef %43)
  %45 = icmp ne i32 %44, 19
  br i1 %45, label %46, label %56

46:                                               ; preds = %42
  %47 = load ptr, ptr %7, align 8, !tbaa !5
  %48 = call i32 @ast_id(ptr noundef %47)
  %49 = icmp ne i32 %48, 198
  br i1 %49, label %50, label %56

50:                                               ; preds = %46
  %51 = load ptr, ptr %4, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.pass_opt_t, ptr %51, i32 0, i32 36
  %53 = getelementptr inbounds %struct.typecheck_t, ptr %52, i32 0, i32 2
  %54 = load ptr, ptr %53, align 8, !tbaa !9
  %55 = load ptr, ptr %5, align 8, !tbaa !5
  call void (ptr, ptr, ptr, ...) @ast_error(ptr noundef %54, ptr noundef %55, ptr noundef @.str.30)
  store i1 false, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %88

56:                                               ; preds = %46, %42, %38, %34, %30, %26, %18
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %57 = load ptr, ptr %7, align 8, !tbaa !5
  %58 = call ptr @ast_type(ptr noundef %57)
  store ptr %58, ptr %10, align 8, !tbaa !5
  %59 = load ptr, ptr %10, align 8, !tbaa !5
  %60 = call zeroext i1 @is_typecheck_error(ptr noundef %59)
  br i1 %60, label %61, label %62

61:                                               ; preds = %56
  store i1 false, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %87

62:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #3
  %63 = load ptr, ptr %6, align 8, !tbaa !5
  %64 = call i32 @ast_id(ptr noundef %63)
  store i32 %64, ptr %11, align 4, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %65 = load ptr, ptr %10, align 8, !tbaa !5
  %66 = load i32, ptr %11, align 4, !tbaa !16
  %67 = call ptr @consume_type(ptr noundef %65, i32 noundef %66, i1 noundef zeroext false)
  store ptr %67, ptr %12, align 8, !tbaa !5
  %68 = load ptr, ptr %12, align 8, !tbaa !5
  %69 = icmp eq ptr %68, null
  br i1 %69, label %70, label %83

70:                                               ; preds = %62
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.pass_opt_t, ptr %71, i32 0, i32 36
  %73 = getelementptr inbounds %struct.typecheck_t, ptr %72, i32 0, i32 2
  %74 = load ptr, ptr %73, align 8, !tbaa !9
  %75 = load ptr, ptr %5, align 8, !tbaa !5
  call void (ptr, ptr, ptr, ...) @ast_error(ptr noundef %74, ptr noundef %75, ptr noundef @.str.31)
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.pass_opt_t, ptr %76, i32 0, i32 36
  %78 = getelementptr inbounds %struct.typecheck_t, ptr %77, i32 0, i32 2
  %79 = load ptr, ptr %78, align 8, !tbaa !9
  %80 = load ptr, ptr %7, align 8, !tbaa !5
  %81 = load ptr, ptr %10, align 8, !tbaa !5
  %82 = call ptr @ast_print_type(ptr noundef %81)
  call void (ptr, ptr, ptr, ...) @ast_error_continue(ptr noundef %79, ptr noundef %80, ptr noundef @.str.32, ptr noundef %82)
  store i1 false, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %86

83:                                               ; preds = %62
  %84 = load ptr, ptr %5, align 8, !tbaa !5
  %85 = load ptr, ptr %12, align 8, !tbaa !5
  call void @ast_settype(ptr noundef %84, ptr noundef %85)
  store i1 true, ptr %3, align 1
  store i32 1, ptr %9, align 4
  br label %86

86:                                               ; preds = %83, %70
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #3
  br label %87

87:                                               ; preds = %86, %61
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br label %88

88:                                               ; preds = %87, %50
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %89 = load i1, ptr %3, align 1
  ret i1 %89
}

attributes #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 = { 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 #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}
!16 = !{!11, !11, i64 0}


; 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.2 = external hidden unnamed_addr constant [77 x i8], align 1
@.str.29 = external hidden unnamed_addr constant [26 x i8], align 1
@__func__.expr_consume = external hidden unnamed_addr constant [13 x i8], align 1
@.str.30 = external hidden unnamed_addr constant [34 x i8], align 1
@.str.31 = external hidden unnamed_addr constant [33 x i8], align 1
@.str.32 = external hidden unnamed_addr constant [22 x i8], align 1

declare void @ast_settype(ptr noundef, ptr noundef) local_unnamed_addr #0

declare i32 @ast_id(ptr noundef) local_unnamed_addr #0

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

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

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

; 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_type(ptr noundef) local_unnamed_addr #0

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

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

declare ptr @consume_type(ptr noundef, i32 noundef, i1 noundef zeroext) local_unnamed_addr #0

declare ptr @ast_print_type(ptr noundef) local_unnamed_addr #0

declare void @ast_error_continue(ptr noundef, ptr noundef, ptr noundef, ...) local_unnamed_addr #0

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

8:                                                ; preds = %2
  tail call void @ponyint_assert_fail(ptr noundef nonnull @.str.29, ptr noundef nonnull @.str.2, i64 noundef 679, ptr noundef nonnull @__func__.expr_consume) #3
  br label %9

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

14:                                               ; preds = %9
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = call i32 @ast_id(ptr noundef %15) #3
  %.not15 = icmp eq i32 %16, 192
  br i1 %.not15, label %35, label %17

17:                                               ; preds = %14
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = call i32 @ast_id(ptr noundef %18) #3
  %.not16 = icmp eq i32 %19, 197
  br i1 %.not16, label %35, label %20

20:                                               ; preds = %17
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = call i32 @ast_id(ptr noundef %21) #3
  %.not17 = icmp eq i32 %22, 196
  br i1 %.not17, label %35, label %23

23:                                               ; preds = %20
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = call i32 @ast_id(ptr noundef %24) #3
  %.not18 = icmp eq i32 %25, 102
  br i1 %.not18, label %35, label %26

26:                                               ; preds = %23
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = call i32 @ast_id(ptr noundef %27) #3
  %.not19 = icmp eq i32 %28, 19
  br i1 %.not19, label %35, label %29

29:                                               ; preds = %26
  %30 = load ptr, ptr %4, align 8, !tbaa !5
  %31 = call i32 @ast_id(ptr noundef %30) #3
  %.not20 = icmp eq i32 %31, 198
  br i1 %.not20, label %35, label %32

32:                                               ; preds = %29
  %33 = getelementptr inbounds i8, ptr %0, i64 216
  %34 = load ptr, ptr %33, align 8, !tbaa !9
  call void (ptr, ptr, ptr, ...) @ast_error(ptr noundef %34, ptr noundef %1, ptr noundef nonnull @.str.30) #3
  br label %50

35:                                               ; preds = %29, %26, %23, %20, %17, %14, %9
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = call ptr @ast_type(ptr noundef %36) #3
  %38 = call zeroext i1 @is_typecheck_error(ptr noundef %37) #3
  br i1 %38, label %50, label %39

39:                                               ; preds = %35
  %40 = load ptr, ptr %3, align 8, !tbaa !5
  %41 = call i32 @ast_id(ptr noundef %40) #3
  %42 = call ptr @consume_type(ptr noundef %37, i32 noundef %41, i1 noundef zeroext false) #3
  %.not21 = icmp eq ptr %42, null
  br i1 %.not21, label %43, label %49

43:                                               ; preds = %39
  %44 = getelementptr inbounds i8, ptr %0, i64 216
  %45 = load ptr, ptr %44, align 8, !tbaa !9
  call void (ptr, ptr, ptr, ...) @ast_error(ptr noundef %45, ptr noundef %1, ptr noundef nonnull @.str.31) #3
  %46 = load ptr, ptr %44, align 8, !tbaa !9
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = call ptr @ast_print_type(ptr noundef %37) #3
  call void (ptr, ptr, ptr, ...) @ast_error_continue(ptr noundef %46, ptr noundef %47, ptr noundef nonnull @.str.32, ptr noundef %48) #3
  br label %50

49:                                               ; preds = %39
  call void @ast_settype(ptr noundef %1, ptr noundef nonnull %42) #3
  br label %50

50:                                               ; preds = %35, %49, %43, %32
  %.2 = phi i1 [ false, %32 ], [ false, %35 ], [ true, %49 ], [ false, %43 ]
  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 %.2
}

attributes #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 = { 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 #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