; LLVM IR from nickmqb/muon :: bootstrap/mu.ll_TypeChecker (checkTransmute__)

; 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.string__ = type { ptr, i32 }
%struct.tag_____Error__ = type { ptr, %struct.tag_____IntRange__, %struct.string__ }
%struct.tag_____IntRange__ = type { i32, i32 }
%struct.tag_____Tag__ = type { ptr, ptr }
%struct.Node__ = type { i32, ptr }
%struct.tag_____TypeCheckerContext__ = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, ptr, i32, i8 }

@mu_____string222 = external dso_local global %struct.string__, align 8
@mu_____string221 = external dso_local global %struct.string__, align 8
@mu_____string220 = external dso_local global %struct.string__, align 8

; 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
declare dso_local void @List__add__Error____(ptr noundef, ptr noundef byval(%struct.tag_____Error__) align 8) #1

; Function Attrs: nounwind uwtable
declare dso_local void @Error__at__(ptr dead_on_unwind noalias writable sret(%struct.tag_____Error__) align 8, ptr noundef, i64, ptr, i32) #1

; Function Attrs: nounwind uwtable
declare dso_local i64 @RangeFinder__find__(i32, ptr) #1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @Tag__equals__(ptr, ptr, ptr, ptr) #1

; Function Attrs: nounwind uwtable
declare dso_local { ptr, ptr } @TypeChecker__getTypeArgWithTypeFlags__(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr, i32) #1

; Function Attrs: nounwind uwtable
define dso_local { ptr, ptr } @TypeChecker__checkTransmute__(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca %struct.tag_____Tag__, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %struct.tag_____Tag__, align 8
  %7 = alloca i8, align 1
  %8 = alloca i8, align 1
  %9 = alloca i32, align 4
  %10 = alloca %struct.Node__, align 8
  %11 = alloca %struct.tag_____Error__, align 8
  %12 = alloca %struct.tag_____IntRange__, 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 16, ptr %6) #2
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = call { ptr, ptr } @TypeChecker__getArgWithTypeFlags__(ptr noundef %13, ptr noundef %14, i32 noundef 0, i32 noundef 199133, i8 noundef zeroext 1, ptr noundef byval(%struct.string__) align 8 @mu_____string220)
  %16 = getelementptr inbounds { ptr, ptr }, ptr %6, i32 0, i32 0
  %17 = extractvalue { ptr, ptr } %15, 0
  store ptr %17, ptr %16, align 8
  %18 = getelementptr inbounds { ptr, ptr }, ptr %6, i32 0, i32 1
  %19 = extractvalue { ptr, ptr } %15, 1
  store ptr %19, ptr %18, align 8
  %20 = load ptr, ptr %4, align 8, !tbaa !5
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = load ptr, ptr @mu_____string221, align 8
  %23 = load i32, ptr getelementptr inbounds ({ ptr, i32 }, ptr @mu_____string221, i32 0, i32 1), align 8
  %24 = call { ptr, ptr } @TypeChecker__getTypeArgWithTypeFlags__(ptr noundef %20, ptr noundef %21, i32 noundef 1, i32 noundef 199133, ptr %22, i32 %23)
  %25 = getelementptr inbounds { ptr, ptr }, ptr %3, i32 0, i32 0
  %26 = extractvalue { ptr, ptr } %24, 0
  store ptr %26, ptr %25, align 8
  %27 = getelementptr inbounds { ptr, ptr }, ptr %3, i32 0, i32 1
  %28 = extractvalue { ptr, ptr } %24, 1
  store ptr %28, ptr %27, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #2
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = load ptr, ptr %5, align 8, !tbaa !5
  %31 = call zeroext i8 @TypeChecker__checkRemainingArgs__(ptr noundef %29, ptr noundef %30, i32 noundef 2, i8 noundef zeroext 0)
  %32 = icmp ne i8 %31, 0
  %33 = xor i1 %32, true
  %34 = zext i1 %33 to i32
  %35 = trunc i32 %34 to i8
  store i8 %35, ptr %7, align 1, !tbaa !9
  %36 = load i8, ptr %7, align 1, !tbaa !9
  %37 = icmp ne i8 %36, 0
  br i1 %37, label %44, label %38

38:                                               ; preds = %2
  %39 = getelementptr inbounds %struct.tag_____Tag__, ptr %6, i32 0, i32 0
  %40 = load ptr, ptr %39, align 8, !tbaa !10
  %41 = icmp eq ptr %40, null
  %42 = zext i1 %41 to i32
  %43 = trunc i32 %42 to i8
  store i8 %43, ptr %7, align 1, !tbaa !9
  br label %44

44:                                               ; preds = %38, %2
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #2
  %45 = load i8, ptr %7, align 1, !tbaa !9
  store i8 %45, ptr %8, align 1, !tbaa !9
  %46 = load i8, ptr %8, align 1, !tbaa !9
  %47 = icmp ne i8 %46, 0
  br i1 %47, label %54, label %48

48:                                               ; preds = %44
  %49 = getelementptr inbounds %struct.tag_____Tag__, ptr %3, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8, !tbaa !10
  %51 = icmp eq ptr %50, null
  %52 = zext i1 %51 to i32
  %53 = trunc i32 %52 to i8
  store i8 %53, ptr %8, align 1, !tbaa !9
  br label %54

54:                                               ; preds = %48, %44
  %55 = load i8, ptr %8, align 1, !tbaa !9
  %56 = icmp ne i8 %55, 0
  br i1 %56, label %57, label %58

57:                                               ; preds = %54
  store i32 1, ptr %9, align 4
  br label %93

58:                                               ; preds = %54
  %59 = getelementptr inbounds { ptr, ptr }, ptr %6, i32 0, i32 0
  %60 = load ptr, ptr %59, align 8
  %61 = getelementptr inbounds { ptr, ptr }, ptr %6, i32 0, i32 1
  %62 = load ptr, ptr %61, align 8
  %63 = getelementptr inbounds { ptr, ptr }, ptr %3, i32 0, i32 0
  %64 = load ptr, ptr %63, align 8
  %65 = getelementptr inbounds { ptr, ptr }, ptr %3, i32 0, i32 1
  %66 = load ptr, ptr %65, align 8
  %67 = call zeroext i8 @Tag__equals__(ptr %60, ptr %62, ptr %64, ptr %66)
  %68 = icmp ne i8 %67, 0
  br i1 %68, label %69, label %92

69:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #2
  %70 = load ptr, ptr %5, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.Node__, ptr %10, i32 0, i32 1
  store ptr %70, ptr %71, align 8, !tbaa !12
  %72 = getelementptr inbounds %struct.Node__, ptr %10, i32 0, i32 1
  %73 = load ptr, ptr %72, align 8, !tbaa !12
  %74 = icmp ne ptr %73, null
  %75 = zext i1 %74 to i64
  %76 = select i1 %74, i32 14, i32 0
  %77 = getelementptr inbounds %struct.Node__, ptr %10, i32 0, i32 0
  store i32 %76, ptr %77, align 8, !tbaa !15
  %78 = load ptr, ptr %4, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.tag_____TypeCheckerContext__, ptr %78, i32 0, i32 2
  %80 = load ptr, ptr %79, align 8, !tbaa !16
  %81 = load ptr, ptr %4, align 8, !tbaa !5
  %82 = getelementptr inbounds %struct.tag_____TypeCheckerContext__, ptr %81, i32 0, i32 5
  %83 = load ptr, ptr %82, align 8, !tbaa !18
  %84 = getelementptr inbounds { i32, ptr }, ptr %10, i32 0, i32 0
  %85 = load i32, ptr %84, align 8
  %86 = getelementptr inbounds { i32, ptr }, ptr %10, i32 0, i32 1
  %87 = load ptr, ptr %86, align 8
  %88 = call i64 @RangeFinder__find__(i32 %85, ptr %87)
  store i64 %88, ptr %12, align 4
  %89 = load i64, ptr %12, align 4
  %90 = load ptr, ptr @mu_____string222, align 8
  %91 = load i32, ptr getelementptr inbounds ({ ptr, i32 }, ptr @mu_____string222, i32 0, i32 1), align 8
  call void @Error__at__(ptr dead_on_unwind writable sret(%struct.tag_____Error__) align 8 %11, ptr noundef %83, i64 %89, ptr %90, i32 %91)
  call void @List__add__Error____(ptr noundef %80, ptr noundef byval(%struct.tag_____Error__) align 8 %11)
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #2
  br label %92

92:                                               ; preds = %69, %58
  store i32 1, ptr %9, align 4
  br label %93

93:                                               ; preds = %92, %57
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #2
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #2
  %94 = load { ptr, ptr }, ptr %3, align 8
  ret { ptr, ptr } %94
}

; Function Attrs: nounwind uwtable
declare dso_local { ptr, ptr } @TypeChecker__getArgWithTypeFlags__(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i8 noundef zeroext, ptr noundef byval(%struct.string__) align 8) #1

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @TypeChecker__checkRemainingArgs__(ptr noundef, ptr noundef, i32 noundef, i8 noundef zeroext) #1

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 = { 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 = !{!7, !7, i64 0}
!10 = !{!11, !6, i64 0}
!11 = !{!"tag_____Tag__", !6, i64 0, !6, i64 8}
!12 = !{!13, !6, i64 8}
!13 = !{!"", !14, i64 0, !6, i64 8}
!14 = !{!"int", !7, i64 0}
!15 = !{!13, !14, i64 0}
!16 = !{!17, !6, i64 16}
!17 = !{!"tag_____TypeCheckerContext__", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !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, !14, i64 120, !14, i64 124, !6, i64 128, !14, i64 136, !7, i64 140}
!18 = !{!17, !6, i64 40}


; 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"

%struct.string__ = type { ptr, i32 }
%struct.tag_____Error__ = type { ptr, %struct.tag_____IntRange__, %struct.string__ }
%struct.tag_____IntRange__ = type { i32, i32 }

@mu_____string222 = external dso_local local_unnamed_addr global %struct.string__, align 8
@mu_____string221 = external dso_local local_unnamed_addr global %struct.string__, align 8
@mu_____string220 = external dso_local global %struct.string__, align 8

; Function Attrs: nounwind uwtable
declare dso_local void @List__add__Error____(ptr noundef, ptr noundef byval(%struct.tag_____Error__) align 8) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local void @Error__at__(ptr dead_on_unwind noalias writable sret(%struct.tag_____Error__) align 8, ptr noundef, i64, ptr, i32) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local i64 @RangeFinder__find__(i32, ptr) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @Tag__equals__(ptr, ptr, ptr, ptr) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local { ptr, ptr } @TypeChecker__getTypeArgWithTypeFlags__(ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr, i32) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local { ptr, ptr } @TypeChecker__checkTransmute__(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca %struct.tag_____Error__, align 8
  %4 = tail call { ptr, ptr } @TypeChecker__getArgWithTypeFlags__(ptr noundef %0, ptr noundef %1, i32 noundef 0, i32 noundef 199133, i8 noundef zeroext 1, ptr noundef nonnull byval(%struct.string__) align 8 @mu_____string220)
  %5 = extractvalue { ptr, ptr } %4, 0
  %6 = load ptr, ptr @mu_____string221, align 8
  %7 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string221, i64 8), align 8
  %8 = tail call { ptr, ptr } @TypeChecker__getTypeArgWithTypeFlags__(ptr noundef %0, ptr noundef %1, i32 noundef 1, i32 noundef 199133, ptr %6, i32 %7)
  %9 = extractvalue { ptr, ptr } %8, 0
  %10 = tail call zeroext i8 @TypeChecker__checkRemainingArgs__(ptr noundef %0, ptr noundef %1, i32 noundef 2, i8 noundef zeroext 0)
  %.not = icmp ne i8 %10, 0
  %11 = icmp ne ptr %5, null
  %spec.select = select i1 %.not, i1 %11, i1 false
  %12 = icmp ne ptr %9, null
  %or.cond = select i1 %spec.select, i1 %12, i1 false
  br i1 %or.cond, label %13, label %.critedge

13:                                               ; preds = %2
  %14 = extractvalue { ptr, ptr } %8, 1
  %15 = extractvalue { ptr, ptr } %4, 1
  %16 = tail call zeroext i8 @Tag__equals__(ptr nonnull %5, ptr %15, ptr nonnull %9, ptr %14)
  %.not24 = icmp eq i8 %16, 0
  br i1 %.not24, label %.critedge, label %17

17:                                               ; preds = %13
  %.not25 = icmp eq ptr %1, null
  %18 = select i1 %.not25, i32 0, i32 14
  %19 = getelementptr inbounds i8, ptr %0, i64 16
  %20 = load ptr, ptr %19, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %0, i64 40
  %22 = load ptr, ptr %21, align 8, !tbaa !11
  %23 = tail call i64 @RangeFinder__find__(i32 %18, ptr %1)
  %24 = load ptr, ptr @mu_____string222, align 8
  %25 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string222, i64 8), align 8
  call void @Error__at__(ptr dead_on_unwind nonnull writable sret(%struct.tag_____Error__) align 8 %3, ptr noundef %22, i64 %23, ptr %24, i32 %25)
  call void @List__add__Error____(ptr noundef %20, ptr noundef nonnull byval(%struct.tag_____Error__) align 8 %3)
  br label %.critedge

.critedge:                                        ; preds = %2, %13, %17
  ret { ptr, ptr } %8
}

; Function Attrs: nounwind uwtable
declare dso_local { ptr, ptr } @TypeChecker__getArgWithTypeFlags__(ptr noundef, ptr noundef, i32 noundef, i32 noundef, i8 noundef zeroext, ptr noundef byval(%struct.string__) align 8) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @TypeChecker__checkRemainingArgs__(ptr noundef, ptr noundef, i32 noundef, i8 noundef zeroext) local_unnamed_addr #0

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" }

!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, !7, i64 16}
!6 = !{!"tag_____TypeCheckerContext__", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !7, i64 80, !7, i64 88, !7, i64 96, !7, i64 104, !7, i64 112, !10, i64 120, !10, i64 124, !7, i64 128, !10, i64 136, !8, i64 140}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 40}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass,TailCallElimPass