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

; 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.1 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [12 x i8], align 1
@__func__.literal_is = external hidden unnamed_addr constant [11 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [30 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

declare zeroext i1 @is_typecheck_error(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @is_type_literal(ptr noundef) #2

declare i32 @ast_id(ptr noundef) #1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @coerce_literals(ptr noundef, ptr noundef, ptr noundef) #2

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

declare ptr @ast_type(ptr noundef) #1

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

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

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

14:                                               ; preds = %2
  br label %16

15:                                               ; preds = %2
  call void @ponyint_assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i64 noundef 988, ptr noundef @__func__.literal_is)
  br label %16

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

20:                                               ; preds = %16
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = call i32 @ast_id(ptr noundef %21)
  %23 = icmp eq i32 %22, 83
  br i1 %23, label %24, label %25

24:                                               ; preds = %20, %16
  br label %26

25:                                               ; preds = %20
  call void @ponyint_assert_fail(ptr noundef @.str.13, ptr noundef @.str.1, i64 noundef 989, ptr noundef @__func__.literal_is)
  br label %26

26:                                               ; preds = %25, %24
  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
  %27 = getelementptr inbounds ptr, ptr %8, i64 1
  store ptr %7, ptr %27, align 8, !tbaa !5
  %28 = getelementptr inbounds ptr, ptr %8, i64 2
  store ptr null, ptr %28, align 8, !tbaa !5
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds [3 x ptr], ptr %8, i64 0, i64 0
  call void @ast_get_children(ptr noundef %29, i64 noundef 2, ptr noundef %30)
  call void @llvm.lifetime.end.p0(i64 24, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  %32 = call ptr @ast_type(ptr noundef %31)
  store ptr %32, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = call ptr @ast_type(ptr noundef %33)
  store ptr %34, ptr %10, align 8, !tbaa !5
  %35 = load ptr, ptr %9, align 8, !tbaa !5
  %36 = call zeroext i1 @is_typecheck_error(ptr noundef %35)
  br i1 %36, label %40, label %37

37:                                               ; preds = %26
  %38 = load ptr, ptr %10, align 8, !tbaa !5
  %39 = call zeroext i1 @is_typecheck_error(ptr noundef %38)
  br i1 %39, label %40, label %41

40:                                               ; preds = %37, %26
  store i1 false, ptr %3, align 1
  store i32 1, ptr %11, align 4
  br label %84

41:                                               ; preds = %37
  %42 = load ptr, ptr %9, align 8, !tbaa !5
  %43 = call zeroext i1 @is_type_literal(ptr noundef %42)
  br i1 %43, label %48, label %44

44:                                               ; preds = %41
  %45 = load ptr, ptr %10, align 8, !tbaa !5
  %46 = call zeroext i1 @is_type_literal(ptr noundef %45)
  br i1 %46, label %48, label %47

47:                                               ; preds = %44
  store i1 true, ptr %3, align 1
  store i32 1, ptr %11, align 4
  br label %84

48:                                               ; preds = %44, %41
  %49 = load ptr, ptr %9, align 8, !tbaa !5
  %50 = call zeroext i1 @is_type_literal(ptr noundef %49)
  br i1 %50, label %51, label %58

51:                                               ; preds = %48
  %52 = load ptr, ptr %10, align 8, !tbaa !5
  %53 = call zeroext i1 @is_type_literal(ptr noundef %52)
  br i1 %53, label %58, label %54

54:                                               ; preds = %51
  %55 = load ptr, ptr %10, align 8, !tbaa !5
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = call zeroext i1 @coerce_literals(ptr noundef %6, ptr noundef %55, ptr noundef %56)
  store i1 %57, ptr %3, align 1
  store i32 1, ptr %11, align 4
  br label %84

58:                                               ; preds = %51, %48
  %59 = load ptr, ptr %9, align 8, !tbaa !5
  %60 = call zeroext i1 @is_type_literal(ptr noundef %59)
  br i1 %60, label %68, label %61

61:                                               ; preds = %58
  %62 = load ptr, ptr %10, align 8, !tbaa !5
  %63 = call zeroext i1 @is_type_literal(ptr noundef %62)
  br i1 %63, label %64, label %68

64:                                               ; preds = %61
  %65 = load ptr, ptr %9, align 8, !tbaa !5
  %66 = load ptr, ptr %5, align 8, !tbaa !5
  %67 = call zeroext i1 @coerce_literals(ptr noundef %7, ptr noundef %65, ptr noundef %66)
  store i1 %67, ptr %3, align 1
  store i32 1, ptr %11, align 4
  br label %84

68:                                               ; preds = %61, %58
  %69 = load ptr, ptr %9, align 8, !tbaa !5
  %70 = call zeroext i1 @is_type_literal(ptr noundef %69)
  br i1 %70, label %71, label %72

71:                                               ; preds = %68
  br label %73

72:                                               ; preds = %68
  call void @ponyint_assert_fail(ptr noundef @.str.14, ptr noundef @.str.1, i64 noundef 1016, ptr noundef @__func__.literal_is)
  br label %73

73:                                               ; preds = %72, %71
  %74 = load ptr, ptr %10, align 8, !tbaa !5
  %75 = call zeroext i1 @is_type_literal(ptr noundef %74)
  br i1 %75, label %76, label %77

76:                                               ; preds = %73
  br label %78

77:                                               ; preds = %73
  call void @ponyint_assert_fail(ptr noundef @.str.15, ptr noundef @.str.1, i64 noundef 1017, ptr noundef @__func__.literal_is)
  br label %78

78:                                               ; preds = %77, %76
  %79 = load ptr, ptr %5, align 8, !tbaa !5
  %80 = getelementptr inbounds %struct.pass_opt_t, ptr %79, i32 0, i32 36
  %81 = getelementptr inbounds %struct.typecheck_t, ptr %80, i32 0, i32 2
  %82 = load ptr, ptr %81, align 8, !tbaa !9
  %83 = load ptr, ptr %4, align 8, !tbaa !5
  call void (ptr, ptr, ptr, ...) @ast_error(ptr noundef %82, ptr noundef %83, ptr noundef @.str.16)
  store i1 false, ptr %3, align 1
  store i32 1, ptr %11, align 4
  br label %84

84:                                               ; preds = %78, %64, %54, %47, %40
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %85 = load i1, ptr %3, align 1
  ret i1 %85
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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}


; 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.1 = external hidden unnamed_addr constant [76 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [12 x i8], align 1
@__func__.literal_is = external hidden unnamed_addr constant [11 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.15 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.16 = external hidden unnamed_addr constant [30 x i8], align 1

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

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

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

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @is_type_literal(ptr noundef) local_unnamed_addr #2

declare i32 @ast_id(ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i1 @coerce_literals(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

declare ptr @ast_type(ptr noundef) local_unnamed_addr #1

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

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

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @literal_is(ptr noundef %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
  %.not = icmp eq ptr %0, null
  br i1 %.not, label %6, label %7

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

7:                                                ; preds = %2, %6
  %8 = tail call i32 @ast_id(ptr noundef %0) #3
  %9 = icmp eq i32 %8, 82
  br i1 %9, label %14, label %10

10:                                               ; preds = %7
  %11 = tail call i32 @ast_id(ptr noundef %0) #3
  %12 = icmp eq i32 %11, 83
  br i1 %12, label %14, label %13

13:                                               ; preds = %10
  tail call void @ponyint_assert_fail(ptr noundef nonnull @.str.13, ptr noundef nonnull @.str.1, i64 noundef 989, ptr noundef nonnull @__func__.literal_is) #3
  br label %14

14:                                               ; preds = %7, %10, %13
  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
  %15 = getelementptr inbounds i8, ptr %5, i64 8
  store ptr %4, ptr %15, align 8, !tbaa !5
  %16 = getelementptr inbounds i8, ptr %5, i64 16
  store ptr null, ptr %16, align 16, !tbaa !5
  call void @ast_get_children(ptr noundef %0, i64 noundef 2, ptr noundef nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %5) #3
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = call ptr @ast_type(ptr noundef %17) #3
  %19 = load ptr, ptr %4, align 8, !tbaa !5
  %20 = call ptr @ast_type(ptr noundef %19) #3
  %21 = call zeroext i1 @is_typecheck_error(ptr noundef %18) #3
  br i1 %21, label %49, label %22

22:                                               ; preds = %14
  %23 = call zeroext i1 @is_typecheck_error(ptr noundef %20) #3
  br i1 %23, label %49, label %24

24:                                               ; preds = %22
  %25 = call zeroext i1 @is_type_literal(ptr noundef %18)
  br i1 %25, label %28, label %26

26:                                               ; preds = %24
  %27 = call zeroext i1 @is_type_literal(ptr noundef %20)
  br i1 %27, label %28, label %49

28:                                               ; preds = %26, %24
  %29 = call zeroext i1 @is_type_literal(ptr noundef %18)
  br i1 %29, label %30, label %34

30:                                               ; preds = %28
  %31 = call zeroext i1 @is_type_literal(ptr noundef %20)
  br i1 %31, label %34, label %32

32:                                               ; preds = %30
  %33 = call zeroext i1 @coerce_literals(ptr noundef nonnull %3, ptr noundef %20, ptr noundef %1)
  br label %49

34:                                               ; preds = %30, %28
  %35 = call zeroext i1 @is_type_literal(ptr noundef %18)
  br i1 %35, label %40, label %36

36:                                               ; preds = %34
  %37 = call zeroext i1 @is_type_literal(ptr noundef %20)
  br i1 %37, label %38, label %40

38:                                               ; preds = %36
  %39 = call zeroext i1 @coerce_literals(ptr noundef nonnull %4, ptr noundef %18, ptr noundef %1)
  br label %49

40:                                               ; preds = %36, %34
  %41 = call zeroext i1 @is_type_literal(ptr noundef %18)
  br i1 %41, label %43, label %42

42:                                               ; preds = %40
  call void @ponyint_assert_fail(ptr noundef nonnull @.str.14, ptr noundef nonnull @.str.1, i64 noundef 1016, ptr noundef nonnull @__func__.literal_is) #3
  br label %43

43:                                               ; preds = %40, %42
  %44 = call zeroext i1 @is_type_literal(ptr noundef %20)
  br i1 %44, label %46, label %45

45:                                               ; preds = %43
  call void @ponyint_assert_fail(ptr noundef nonnull @.str.15, ptr noundef nonnull @.str.1, i64 noundef 1017, ptr noundef nonnull @__func__.literal_is) #3
  br label %46

46:                                               ; preds = %43, %45
  %47 = getelementptr inbounds i8, ptr %1, i64 216
  %48 = load ptr, ptr %47, align 8, !tbaa !9
  call void (ptr, ptr, ptr, ...) @ast_error(ptr noundef %48, ptr noundef %0, ptr noundef nonnull @.str.16) #3
  br label %49

49:                                               ; preds = %26, %14, %22, %46, %38, %32
  %.0 = phi i1 [ false, %46 ], [ %39, %38 ], [ %33, %32 ], [ false, %22 ], [ false, %14 ], [ true, %26 ]
  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
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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,SROAPass,SimplifyCFGPass,TailCallElimPass