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

; 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_____Namespace__ = type { %struct.string__, ptr, i32, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32 }
%struct.tag_____CallExpression__ = type { %struct.Node__, ptr, ptr, ptr, ptr, 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 }
%struct.tag_____Token__ = type { i32, %struct.string__, %struct.tag_____IntRange__, %struct.tag_____IntRange__, i32 }
%struct.tag_____List__Node____ = type { ptr, i32, i32 }

@mu_____string209 = external dso_local global %struct.string__, align 8
@mu_____string207 = external dso_local global %struct.string__, align 8
@mu_____string206 = external dso_local global %struct.string__, align 8
@top_____abandonFn__ = external dso_local thread_local global ptr, 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 speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #1

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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

; 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) #4

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

; 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) #4

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

; Function Attrs: nounwind uwtable
declare dso_local void @TypeChecker__badConversion__(ptr noundef, i32, ptr, ptr, ptr, ptr noundef byval(%struct.tag_____Tag__) align 8) #4

; Function Attrs: nounwind uwtable
declare dso_local void @TypeChecker__redundantCast__(ptr noundef, i32, ptr) #4

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @Set__contains__Tag____(ptr noundef, ptr, ptr) #4

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

33:                                               ; preds = %2
  %34 = getelementptr inbounds %struct.tag_____Tag__, ptr %6, i32 0, i32 0
  %35 = load ptr, ptr %34, align 8, !tbaa !9
  %36 = getelementptr inbounds %struct.tag_____Namespace__, ptr %35, i32 0, i32 3
  %37 = load i32, ptr %36, align 4, !tbaa !12
  %38 = and i32 %37, 1
  %39 = icmp ne i32 %38, 0
  %40 = zext i1 %39 to i32
  %41 = trunc i32 %40 to i8
  store i8 %41, ptr %7, align 1, !tbaa !11
  br label %42

42:                                               ; preds = %33, %2
  %43 = load i8, ptr %7, align 1, !tbaa !11
  %44 = icmp ne i8 %43, 0
  br i1 %44, label %45, label %137

45:                                               ; preds = %42
  %46 = load ptr, ptr %4, align 8, !tbaa !5
  %47 = load ptr, ptr %5, align 8, !tbaa !5
  %48 = load ptr, ptr @mu_____string207, align 8
  %49 = load i32, ptr getelementptr inbounds ({ ptr, i32 }, ptr @mu_____string207, i32 0, i32 1), align 8
  %50 = call { ptr, ptr } @TypeChecker__getTypeArgWithTypeFlags__(ptr noundef %46, ptr noundef %47, i32 noundef 1, i32 noundef 1, ptr %48, i32 %49)
  %51 = getelementptr inbounds { ptr, ptr }, ptr %3, i32 0, i32 0
  %52 = extractvalue { ptr, ptr } %50, 0
  store ptr %52, ptr %51, align 8
  %53 = getelementptr inbounds { ptr, ptr }, ptr %3, i32 0, i32 1
  %54 = extractvalue { ptr, ptr } %50, 1
  store ptr %54, ptr %53, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %8) #5
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = call zeroext i8 @TypeChecker__checkRemainingArgs__(ptr noundef %55, ptr noundef %56, i32 noundef 2, i8 noundef zeroext 0)
  %58 = icmp ne i8 %57, 0
  %59 = xor i1 %58, true
  %60 = zext i1 %59 to i32
  %61 = trunc i32 %60 to i8
  store i8 %61, ptr %8, align 1, !tbaa !11
  %62 = load i8, ptr %8, align 1, !tbaa !11
  %63 = icmp ne i8 %62, 0
  br i1 %63, label %70, label %64

64:                                               ; preds = %45
  %65 = getelementptr inbounds %struct.tag_____Tag__, ptr %6, i32 0, i32 0
  %66 = load ptr, ptr %65, align 8, !tbaa !9
  %67 = icmp eq ptr %66, null
  %68 = zext i1 %67 to i32
  %69 = trunc i32 %68 to i8
  store i8 %69, ptr %8, align 1, !tbaa !11
  br label %70

70:                                               ; preds = %64, %45
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #5
  %71 = load i8, ptr %8, align 1, !tbaa !11
  store i8 %71, ptr %9, align 1, !tbaa !11
  %72 = load i8, ptr %9, align 1, !tbaa !11
  %73 = icmp ne i8 %72, 0
  br i1 %73, label %80, label %74

74:                                               ; preds = %70
  %75 = getelementptr inbounds %struct.tag_____Tag__, ptr %3, i32 0, i32 0
  %76 = load ptr, ptr %75, align 8, !tbaa !9
  %77 = icmp eq ptr %76, null
  %78 = zext i1 %77 to i32
  %79 = trunc i32 %78 to i8
  store i8 %79, ptr %9, align 1, !tbaa !11
  br label %80

80:                                               ; preds = %74, %70
  %81 = load i8, ptr %9, align 1, !tbaa !11
  %82 = icmp ne i8 %81, 0
  br i1 %82, label %83, label %84

83:                                               ; preds = %80
  store i32 1, ptr %10, align 4
  br label %136

84:                                               ; preds = %80
  %85 = getelementptr inbounds %struct.tag_____Tag__, ptr %6, i32 0, i32 0
  %86 = load ptr, ptr %85, align 8, !tbaa !9
  %87 = getelementptr inbounds %struct.tag_____Tag__, ptr %3, i32 0, i32 0
  %88 = load ptr, ptr %87, align 8, !tbaa !9
  %89 = icmp eq ptr %86, %88
  br i1 %89, label %90, label %106

90:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #5
  %91 = load ptr, ptr %5, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.tag_____CallExpression__, ptr %91, i32 0, i32 1
  %93 = load ptr, ptr %92, align 8, !tbaa !16
  %94 = getelementptr inbounds %struct.Node__, ptr %11, i32 0, i32 1
  store ptr %93, ptr %94, align 8, !tbaa !19
  %95 = getelementptr inbounds %struct.Node__, ptr %11, i32 0, i32 1
  %96 = load ptr, ptr %95, align 8, !tbaa !19
  %97 = icmp ne ptr %96, null
  %98 = zext i1 %97 to i64
  %99 = select i1 %97, i32 21, i32 0
  %100 = getelementptr inbounds %struct.Node__, ptr %11, i32 0, i32 0
  store i32 %99, ptr %100, align 8, !tbaa !20
  %101 = load ptr, ptr %4, align 8, !tbaa !5
  %102 = getelementptr inbounds { i32, ptr }, ptr %11, i32 0, i32 0
  %103 = load i32, ptr %102, align 8
  %104 = getelementptr inbounds { i32, ptr }, ptr %11, i32 0, i32 1
  %105 = load ptr, ptr %104, align 8
  call void @TypeChecker__redundantCast__(ptr noundef %101, i32 %103, ptr %105)
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #5
  br label %135

106:                                              ; preds = %84
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #5
  %107 = getelementptr inbounds %struct.Node__, ptr %12, i32 0, i32 1
  store ptr null, ptr %107, align 8, !tbaa !19
  %108 = getelementptr inbounds %struct.Node__, ptr %12, i32 0, i32 0
  store i32 0, ptr %108, align 8, !tbaa !20
  %109 = load ptr, ptr %4, align 8, !tbaa !5
  %110 = getelementptr inbounds { ptr, ptr }, ptr %6, i32 0, i32 0
  %111 = load ptr, ptr %110, align 8
  %112 = getelementptr inbounds { ptr, ptr }, ptr %6, i32 0, i32 1
  %113 = load ptr, ptr %112, align 8
  %114 = getelementptr inbounds { i32, ptr }, ptr %12, i32 0, i32 0
  %115 = load i32, ptr %114, align 8
  %116 = getelementptr inbounds { i32, ptr }, ptr %12, i32 0, i32 1
  %117 = load ptr, ptr %116, align 8
  %118 = call zeroext i8 @TypeChecker__canCoerce__(ptr noundef %109, ptr %111, ptr %113, i32 %115, ptr %117, ptr noundef byval(%struct.tag_____Tag__) align 8 %3)
  %119 = icmp ne i8 %118, 0
  br i1 %119, label %120, label %134

120:                                              ; preds = %106
  %121 = load ptr, ptr %4, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.tag_____TypeCheckerContext__, ptr %121, i32 0, i32 2
  %123 = load ptr, ptr %122, align 8, !tbaa !21
  %124 = load ptr, ptr %4, align 8, !tbaa !5
  %125 = getelementptr inbounds %struct.tag_____TypeCheckerContext__, ptr %124, i32 0, i32 5
  %126 = load ptr, ptr %125, align 8, !tbaa !23
  %127 = load ptr, ptr %5, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.tag_____CallExpression__, ptr %127, i32 0, i32 1
  %129 = load ptr, ptr %128, align 8, !tbaa !16
  %130 = getelementptr inbounds %struct.tag_____Token__, ptr %129, i32 0, i32 2
  %131 = load i64, ptr %130, align 8
  %132 = load ptr, ptr @mu_____string209, align 8
  %133 = load i32, ptr getelementptr inbounds ({ ptr, i32 }, ptr @mu_____string209, i32 0, i32 1), align 8
  call void @Error__at__(ptr dead_on_unwind writable sret(%struct.tag_____Error__) align 8 %13, ptr noundef %126, i64 %131, ptr %132, i32 %133)
  call void @List__add__Error____(ptr noundef %123, ptr noundef byval(%struct.tag_____Error__) align 8 %13)
  br label %134

134:                                              ; preds = %120, %106
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #5
  br label %135

135:                                              ; preds = %134, %90
  store i32 1, ptr %10, align 4
  br label %136

136:                                              ; preds = %135, %83
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %8) #5
  br label %215

137:                                              ; preds = %42
  call void @llvm.lifetime.start.p0(i64 16, ptr %14) #5
  %138 = load ptr, ptr %4, align 8, !tbaa !5
  %139 = load ptr, ptr %5, align 8, !tbaa !5
  %140 = call { ptr, ptr } @TypeChecker__getTypeArg__(ptr noundef %138, ptr noundef %139, i32 noundef 1)
  %141 = getelementptr inbounds { ptr, ptr }, ptr %14, i32 0, i32 0
  %142 = extractvalue { ptr, ptr } %140, 0
  store ptr %142, ptr %141, align 8
  %143 = getelementptr inbounds { ptr, ptr }, ptr %14, i32 0, i32 1
  %144 = extractvalue { ptr, ptr } %140, 1
  store ptr %144, ptr %143, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr %15) #5
  %145 = load ptr, ptr %4, align 8, !tbaa !5
  %146 = load ptr, ptr %5, align 8, !tbaa !5
  %147 = call zeroext i8 @TypeChecker__checkRemainingArgs__(ptr noundef %145, ptr noundef %146, i32 noundef 2, i8 noundef zeroext 0)
  %148 = icmp ne i8 %147, 0
  %149 = xor i1 %148, true
  %150 = zext i1 %149 to i32
  %151 = trunc i32 %150 to i8
  store i8 %151, ptr %15, align 1, !tbaa !11
  %152 = load i8, ptr %15, align 1, !tbaa !11
  %153 = icmp ne i8 %152, 0
  br i1 %153, label %160, label %154

154:                                              ; preds = %137
  %155 = getelementptr inbounds %struct.tag_____Tag__, ptr %6, i32 0, i32 0
  %156 = load ptr, ptr %155, align 8, !tbaa !9
  %157 = icmp eq ptr %156, null
  %158 = zext i1 %157 to i32
  %159 = trunc i32 %158 to i8
  store i8 %159, ptr %15, align 1, !tbaa !11
  br label %160

160:                                              ; preds = %154, %137
  call void @llvm.lifetime.start.p0(i64 1, ptr %16) #5
  %161 = load i8, ptr %15, align 1, !tbaa !11
  store i8 %161, ptr %16, align 1, !tbaa !11
  %162 = load i8, ptr %16, align 1, !tbaa !11
  %163 = icmp ne i8 %162, 0
  br i1 %163, label %170, label %164

164:                                              ; preds = %160
  %165 = getelementptr inbounds %struct.tag_____Tag__, ptr %14, i32 0, i32 0
  %166 = load ptr, ptr %165, align 8, !tbaa !9
  %167 = icmp eq ptr %166, null
  %168 = zext i1 %167 to i32
  %169 = trunc i32 %168 to i8
  store i8 %169, ptr %16, align 1, !tbaa !11
  br label %170

170:                                              ; preds = %164, %160
  %171 = load i8, ptr %16, align 1, !tbaa !11
  %172 = icmp ne i8 %171, 0
  br i1 %172, label %173, label %174

173:                                              ; preds = %170
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %3, ptr align 8 %14, i64 16, i1 false), !tbaa.struct !24
  store i32 1, ptr %10, align 4
  br label %214

174:                                              ; preds = %170
  %175 = getelementptr inbounds %struct.tag_____Tag__, ptr %6, i32 0, i32 0
  %176 = load ptr, ptr %175, align 8, !tbaa !9
  %177 = getelementptr inbounds %struct.tag_____Namespace__, ptr %176, i32 0, i32 8
  %178 = load ptr, ptr %177, align 8, !tbaa !25
  %179 = getelementptr inbounds { ptr, ptr }, ptr %14, i32 0, i32 0
  %180 = load ptr, ptr %179, align 8
  %181 = getelementptr inbounds { ptr, ptr }, ptr %14, i32 0, i32 1
  %182 = load ptr, ptr %181, align 8
  %183 = call zeroext i8 @Set__contains__Tag____(ptr noundef %178, ptr %180, ptr %182)
  %184 = icmp ne i8 %183, 0
  br i1 %184, label %213, label %185

185:                                              ; preds = %174
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #5
  %186 = load ptr, ptr %5, align 8, !tbaa !5
  %187 = getelementptr inbounds %struct.tag_____CallExpression__, ptr %186, i32 0, i32 2
  %188 = load ptr, ptr %187, align 8, !tbaa !26
  store ptr %188, ptr %17, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #5
  store i32 0, ptr %18, align 4, !tbaa !27
  %189 = load i32, ptr %18, align 4, !tbaa !27
  %190 = load ptr, ptr %17, align 8, !tbaa !5
  %191 = getelementptr inbounds %struct.tag_____List__Node____, ptr %190, i32 0, i32 1
  %192 = load i32, ptr %191, align 8, !tbaa !28
  %193 = icmp ult i32 %189, %192
  br i1 %193, label %197, label %194

194:                                              ; preds = %185
  %195 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____abandonFn__)
  %196 = load ptr, ptr %195, align 8, !tbaa !5
  call void %196(i32 noundef -3)
  br label %197

197:                                              ; preds = %194, %185
  %198 = load ptr, ptr %4, align 8, !tbaa !5
  %199 = load ptr, ptr %17, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct.tag_____List__Node____, ptr %199, i32 0, i32 0
  %201 = load ptr, ptr %200, align 8, !tbaa !30
  %202 = load i32, ptr %18, align 4, !tbaa !27
  %203 = zext i32 %202 to i64
  %204 = getelementptr inbounds %struct.Node__, ptr %201, i64 %203
  %205 = getelementptr inbounds { i32, ptr }, ptr %204, i32 0, i32 0
  %206 = load i32, ptr %205, align 8
  %207 = getelementptr inbounds { i32, ptr }, ptr %204, i32 0, i32 1
  %208 = load ptr, ptr %207, align 8
  %209 = getelementptr inbounds { ptr, ptr }, ptr %6, i32 0, i32 0
  %210 = load ptr, ptr %209, align 8
  %211 = getelementptr inbounds { ptr, ptr }, ptr %6, i32 0, i32 1
  %212 = load ptr, ptr %211, align 8
  call void @TypeChecker__badConversion__(ptr noundef %198, i32 %206, ptr %208, ptr %210, ptr %212, ptr noundef byval(%struct.tag_____Tag__) align 8 %14)
  call void @llvm.memset.p0.i64(ptr align 8 %3, i8 0, i64 16, i1 false)
  store i32 1, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #5
  br label %214

213:                                              ; preds = %174
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %3, ptr align 8 %14, i64 16, i1 false), !tbaa.struct !24
  store i32 1, ptr %10, align 4
  br label %214

214:                                              ; preds = %213, %197, %173
  call void @llvm.lifetime.end.p0(i64 1, ptr %16) #5
  call void @llvm.lifetime.end.p0(i64 1, ptr %15) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %14) #5
  br label %215

215:                                              ; preds = %214, %136
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #5
  %216 = load { ptr, ptr }, ptr %3, align 8
  ret { ptr, ptr } %216
}

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @TypeChecker__canCoerce__(ptr noundef, ptr, ptr, i32, ptr, ptr noundef byval(%struct.tag_____Tag__) align 8) #4

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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 0}
!10 = !{!"tag_____Tag__", !6, i64 0, !6, i64 8}
!11 = !{!7, !7, i64 0}
!12 = !{!13, !15, i64 28}
!13 = !{!"tag_____Namespace__", !14, i64 0, !6, i64 16, !15, i64 24, !15, i64 28, !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, !15, i64 104}
!14 = !{!"", !6, i64 0, !15, i64 8}
!15 = !{!"int", !7, i64 0}
!16 = !{!17, !6, i64 16}
!17 = !{!"tag_____CallExpression__", !18, i64 0, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!18 = !{!"", !15, i64 0, !6, i64 8}
!19 = !{!18, !6, i64 8}
!20 = !{!18, !15, i64 0}
!21 = !{!22, !6, i64 16}
!22 = !{!"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, !15, i64 120, !15, i64 124, !6, i64 128, !15, i64 136, !7, i64 140}
!23 = !{!22, !6, i64 40}
!24 = !{i64 0, i64 8, !5, i64 8, i64 8, !5}
!25 = !{!13, !6, i64 64}
!26 = !{!17, !6, i64 24}
!27 = !{!15, !15, i64 0}
!28 = !{!29, !15, i64 8}
!29 = !{!"tag_____List__Node____", !6, i64 0, !15, i64 8, !15, i64 12}
!30 = !{!29, !6, 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"

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

@mu_____string209 = external dso_local local_unnamed_addr global %struct.string__, align 8
@mu_____string207 = external dso_local local_unnamed_addr global %struct.string__, align 8
@mu_____string206 = external dso_local global %struct.string__, align 8
@top_____abandonFn__ = external dso_local thread_local local_unnamed_addr global ptr, align 8

; 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 speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #1

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #2

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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

; 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 #4

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

; 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 #4

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

; Function Attrs: nounwind uwtable
declare dso_local void @TypeChecker__badConversion__(ptr noundef, i32, ptr, ptr, ptr, ptr noundef byval(%struct.tag_____Tag__) align 8) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare dso_local void @TypeChecker__redundantCast__(ptr noundef, i32, ptr) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @Set__contains__Tag____(ptr noundef, ptr, ptr) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
define dso_local { ptr, ptr } @TypeChecker__checkCheckedCast__(ptr noundef %0, ptr noundef %1) local_unnamed_addr #4 {
  %3 = alloca %struct.tag_____Tag__, align 8
  %4 = alloca %struct.tag_____Error__, align 8
  %5 = alloca %struct.tag_____Tag__, align 8
  %6 = tail call { ptr, ptr } @TypeChecker__getArgWithTypeFlags__(ptr noundef %0, ptr noundef %1, i32 noundef 0, i32 noundef 8193, i8 noundef zeroext 0, ptr noundef nonnull byval(%struct.string__) align 8 @mu_____string206)
  %7 = extractvalue { ptr, ptr } %6, 0
  %8 = extractvalue { ptr, ptr } %6, 1
  %9 = icmp ne ptr %7, null
  br i1 %9, label %10, label %.critedge

10:                                               ; preds = %2
  %11 = getelementptr inbounds i8, ptr %7, i64 28
  %12 = load i32, ptr %11, align 4, !tbaa !5
  %13 = and i32 %12, 1
  %14 = icmp eq i32 %13, 0
  br i1 %14, label %42, label %.critedge

.critedge:                                        ; preds = %2, %10
  %15 = load ptr, ptr @mu_____string207, align 8
  %16 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string207, i64 8), align 8
  %17 = tail call { ptr, ptr } @TypeChecker__getTypeArgWithTypeFlags__(ptr noundef %0, ptr noundef %1, i32 noundef 1, i32 noundef 1, ptr %15, i32 %16)
  %18 = extractvalue { ptr, ptr } %17, 0
  store ptr %18, ptr %3, align 8
  %19 = getelementptr inbounds i8, ptr %3, i64 8
  %20 = extractvalue { ptr, ptr } %17, 1
  store ptr %20, ptr %19, align 8
  %21 = tail call zeroext i8 @TypeChecker__checkRemainingArgs__(ptr noundef %0, ptr noundef %1, i32 noundef 2, i8 noundef zeroext 0)
  %.not57 = icmp ne i8 %21, 0
  %spec.select = and i1 %9, %.not57
  %22 = icmp ne ptr %18, null
  %or.cond = select i1 %spec.select, i1 %22, i1 false
  br i1 %or.cond, label %23, label %.critedge63

23:                                               ; preds = %.critedge
  %24 = icmp eq ptr %7, %18
  br i1 %24, label %25, label %29

25:                                               ; preds = %23
  %26 = getelementptr inbounds i8, ptr %1, i64 16
  %27 = load ptr, ptr %26, align 8, !tbaa !12
  %.not61 = icmp eq ptr %27, null
  %28 = select i1 %.not61, i32 0, i32 21
  tail call void @TypeChecker__redundantCast__(ptr noundef %0, i32 %28, ptr %27)
  br label %.critedge63

29:                                               ; preds = %23
  %30 = tail call zeroext i8 @TypeChecker__canCoerce__(ptr noundef %0, ptr nonnull %7, ptr %8, i32 0, ptr null, ptr noundef nonnull byval(%struct.tag_____Tag__) align 8 %3)
  %.not60 = icmp eq i8 %30, 0
  br i1 %.not60, label %.critedge63, label %31

31:                                               ; preds = %29
  %32 = getelementptr inbounds i8, ptr %0, i64 16
  %33 = load ptr, ptr %32, align 8, !tbaa !15
  %34 = getelementptr inbounds i8, ptr %0, i64 40
  %35 = load ptr, ptr %34, align 8, !tbaa !17
  %36 = getelementptr inbounds i8, ptr %1, i64 16
  %37 = load ptr, ptr %36, align 8, !tbaa !12
  %38 = getelementptr inbounds i8, ptr %37, i64 24
  %39 = load i64, ptr %38, align 8
  %40 = load ptr, ptr @mu_____string209, align 8
  %41 = load i32, ptr getelementptr inbounds (i8, ptr @mu_____string209, i64 8), align 8
  call void @Error__at__(ptr dead_on_unwind nonnull writable sret(%struct.tag_____Error__) align 8 %4, ptr noundef %35, i64 %39, ptr %40, i32 %41)
  call void @List__add__Error____(ptr noundef %33, ptr noundef nonnull byval(%struct.tag_____Error__) align 8 %4)
  br label %.critedge63

42:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #5
  %43 = tail call { ptr, ptr } @TypeChecker__getTypeArg__(ptr noundef %0, ptr noundef %1, i32 noundef 1)
  %44 = extractvalue { ptr, ptr } %43, 0
  store ptr %44, ptr %5, align 8
  %45 = getelementptr inbounds i8, ptr %5, i64 8
  %46 = extractvalue { ptr, ptr } %43, 1
  store ptr %46, ptr %45, align 8
  %47 = tail call zeroext i8 @TypeChecker__checkRemainingArgs__(ptr noundef %0, ptr noundef %1, i32 noundef 2, i8 noundef zeroext 0)
  %.not = icmp ne i8 %47, 0
  %48 = icmp ne ptr %44, null
  %or.cond69 = select i1 %.not, i1 %48, i1 false
  br i1 %or.cond69, label %49, label %.critedge66

.critedge66:                                      ; preds = %42
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %5, i64 16, i1 false), !tbaa.struct !18
  br label %67

49:                                               ; preds = %42
  %50 = getelementptr inbounds i8, ptr %7, i64 64
  %51 = load ptr, ptr %50, align 8, !tbaa !20
  %52 = tail call zeroext i8 @Set__contains__Tag____(ptr noundef %51, ptr nonnull %44, ptr %46)
  %.not55 = icmp eq i8 %52, 0
  br i1 %.not55, label %53, label %66

53:                                               ; preds = %49
  %54 = getelementptr inbounds i8, ptr %1, i64 24
  %55 = load ptr, ptr %54, align 8, !tbaa !21
  %56 = getelementptr inbounds i8, ptr %55, i64 8
  %57 = load i32, ptr %56, align 8, !tbaa !22
  %.not56 = icmp eq i32 %57, 0
  br i1 %.not56, label %58, label %61

58:                                               ; preds = %53
  %59 = tail call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @top_____abandonFn__)
  %60 = load ptr, ptr %59, align 8, !tbaa !19
  tail call void %60(i32 noundef -3) #5
  br label %61

61:                                               ; preds = %58, %53
  %62 = load ptr, ptr %55, align 8, !tbaa !24
  %63 = load i32, ptr %62, align 8
  %64 = getelementptr inbounds i8, ptr %62, i64 8
  %65 = load ptr, ptr %64, align 8
  tail call void @TypeChecker__badConversion__(ptr noundef %0, i32 %63, ptr %65, ptr nonnull %7, ptr %8, ptr noundef nonnull byval(%struct.tag_____Tag__) align 8 %5)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %3, i8 0, i64 16, i1 false)
  br label %67

66:                                               ; preds = %49
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %5, i64 16, i1 false), !tbaa.struct !18
  br label %67

67:                                               ; preds = %66, %61, %.critedge66
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #5
  br label %.critedge63

.critedge63:                                      ; preds = %.critedge, %29, %31, %25, %67
  %.fca.0.load = load ptr, ptr %3, align 8
  %.fca.0.insert = insertvalue { ptr, ptr } poison, ptr %.fca.0.load, 0
  %.fca.1.gep = getelementptr inbounds i8, ptr %3, i64 8
  %.fca.1.load = load ptr, ptr %.fca.1.gep, align 8
  %.fca.1.insert = insertvalue { ptr, ptr } %.fca.0.insert, ptr %.fca.1.load, 1
  ret { ptr, ptr } %.fca.1.insert
}

; Function Attrs: nounwind uwtable
declare dso_local zeroext i8 @TypeChecker__canCoerce__(ptr noundef, ptr, ptr, i32, ptr, ptr noundef byval(%struct.tag_____Tag__) align 8) local_unnamed_addr #4

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #2 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #3 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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, !11, i64 28}
!6 = !{!"tag_____Namespace__", !7, i64 0, !8, i64 16, !11, i64 24, !11, i64 28, !8, i64 32, !8, i64 40, !8, i64 48, !8, i64 56, !8, i64 64, !8, i64 72, !8, i64 80, !8, i64 88, !8, i64 96, !11, i64 104}
!7 = !{!"", !8, i64 0, !11, i64 8}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!13, !8, i64 16}
!13 = !{!"tag_____CallExpression__", !14, i64 0, !8, i64 16, !8, i64 24, !8, i64 32, !8, i64 40, !8, i64 48}
!14 = !{!"", !11, i64 0, !8, i64 8}
!15 = !{!16, !8, i64 16}
!16 = !{!"tag_____TypeCheckerContext__", !8, i64 0, !8, i64 8, !8, i64 16, !8, i64 24, !8, i64 32, !8, i64 40, !8, i64 48, !8, i64 56, !8, i64 64, !8, i64 72, !8, i64 80, !8, i64 88, !8, i64 96, !8, i64 104, !8, i64 112, !11, i64 120, !11, i64 124, !8, i64 128, !11, i64 136, !9, i64 140}
!17 = !{!16, !8, i64 40}
!18 = !{i64 0, i64 8, !19, i64 8, i64 8, !19}
!19 = !{!8, !8, i64 0}
!20 = !{!6, !8, i64 64}
!21 = !{!13, !8, i64 24}
!22 = !{!23, !11, i64 8}
!23 = !{!"tag_____List__Node____", !8, i64 0, !11, i64 8, !11, i64 12}
!24 = !{!23, !8, i64 0}


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