; LLVM IR from jingweizhanghuai/Morn :: src/ptc (morn_coroutine)

; 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.MHandle = type { i32, i32, ptr, ptr }
%struct.HandleCoroutine = type { ptr, ptr, ptr }
%struct.CoroutineInfo = type { ptr, ptr, %struct.ucontext_t, i32, ptr, ptr, ptr }
%struct.ucontext_t = type { i64, ptr, %struct.stack_t, %struct.mcontext_t, %struct.__sigset_t, %struct._libc_fpstate, [4 x i64] }
%struct.stack_t = type { ptr, i32, i64 }
%struct.mcontext_t = type { [23 x i64], ptr, [8 x i64] }
%struct.__sigset_t = type { [16 x i64] }
%struct._libc_fpstate = type { i16, i16, i16, i16, i64, i64, i32, i32, [8 x %struct._libc_fpxreg], [16 x %struct._libc_xmmreg], [24 x i32] }
%struct._libc_fpxreg = type { [4 x i16], i16, [3 x i16] }
%struct._libc_xmmreg = type { [4 x i32] }

@morn_coroutine_handle = external dso_local thread_local global ptr, align 8
@.str = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @endCoroutine(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @endCoroutineFunc() #0

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #2

; Function Attrs: nounwind
declare i32 @swapcontext(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local ptr @m_CoroutineInfo(ptr noundef %0, ptr noundef %1, ptr noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca [2 x ptr], align 16
  %10 = alloca ptr, align 8
  %11 = alloca ptr, align 8
  %12 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %13 = load ptr, ptr %6, align 8, !tbaa !5
  %14 = ptrtoint ptr %13 to i64
  %15 = icmp eq i64 %14, -1
  br i1 %15, label %16, label %17

16:                                               ; preds = %3
  store ptr null, ptr %6, align 8, !tbaa !5
  br label %17

17:                                               ; preds = %16, %3
  %18 = load ptr, ptr %4, align 8, !tbaa !5
  %19 = ptrtoint ptr %18 to i64
  %20 = icmp eq i64 %19, -1
  br i1 %20, label %21, label %22

21:                                               ; preds = %17
  store ptr null, ptr %4, align 8, !tbaa !5
  br label %22

22:                                               ; preds = %21, %17
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %23 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @morn_coroutine_handle)
  %24 = load ptr, ptr %23, align 8, !tbaa !5
  store ptr %24, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  store ptr null, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #7
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = icmp eq ptr %25, null
  br i1 %26, label %27, label %134

27:                                               ; preds = %22
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = icmp ne ptr %28, null
  br i1 %29, label %30, label %32

30:                                               ; preds = %27
  %31 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 0, ptr %31, align 4, !tbaa !9
  br label %32

32:                                               ; preds = %30, %27
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  %33 = call ptr @mMornObject(ptr noundef @.str, i32 noundef -1)
  %34 = call ptr @GetHandle(ptr noundef %33, i32 noundef 24, i32 noundef -1868988789, ptr noundef @endCoroutine)
  store ptr %34, ptr %10, align 8, !tbaa !5
  %35 = load ptr, ptr %10, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.MHandle, ptr %35, i32 0, i32 3
  %37 = load ptr, ptr %36, align 8, !tbaa !11
  store ptr %37, ptr %7, align 8, !tbaa !5
  %38 = load ptr, ptr %10, align 8, !tbaa !5
  %39 = call i32 @mHandleValid(ptr noundef %38)
  %40 = icmp ne i32 %39, 0
  br i1 %40, label %133, label %41

41:                                               ; preds = %32
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.HandleCoroutine, ptr %42, i32 0, i32 0
  %44 = load ptr, ptr %43, align 8, !tbaa !13
  %45 = icmp eq ptr %44, null
  br i1 %45, label %46, label %50

46:                                               ; preds = %41
  %47 = call ptr (...) @mChainCreate()
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.HandleCoroutine, ptr %48, i32 0, i32 0
  store ptr %47, ptr %49, align 8, !tbaa !13
  br label %50

50:                                               ; preds = %46, %41
  %51 = getelementptr inbounds [2 x ptr], ptr %9, i64 0, i64 0
  store ptr @endCoroutineFunc, ptr %51, align 16, !tbaa !5
  %52 = getelementptr inbounds [2 x ptr], ptr %9, i64 0, i64 1
  store ptr null, ptr %52, align 8, !tbaa !5
  %53 = load ptr, ptr %7, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.HandleCoroutine, ptr %53, i32 0, i32 0
  %55 = load ptr, ptr %54, align 8, !tbaa !13
  %56 = getelementptr inbounds [2 x ptr], ptr %9, i64 0, i64 0
  %57 = call ptr @mornMapWrite(ptr noundef %55, ptr noundef %56, i32 noundef 16, ptr noundef null, i32 noundef 1016)
  store ptr %57, ptr %8, align 8, !tbaa !5
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  %59 = getelementptr inbounds %struct.CoroutineInfo, ptr %58, i32 0, i32 2
  %60 = call i32 @getcontext(ptr noundef %59) #8
  %61 = load ptr, ptr %8, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.CoroutineInfo, ptr %61, i32 0, i32 3
  store i32 0, ptr %62, align 8, !tbaa !15
  %63 = load ptr, ptr %8, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.CoroutineInfo, ptr %63, i32 0, i32 3
  %65 = load ptr, ptr %8, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.CoroutineInfo, ptr %65, i32 0, i32 4
  store ptr %64, ptr %66, align 8, !tbaa !24
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.CoroutineInfo, ptr %67, i32 0, i32 0
  store ptr @endCoroutineFunc, ptr %68, align 8, !tbaa !25
  %69 = load ptr, ptr %8, align 8, !tbaa !5
  %70 = getelementptr inbounds %struct.CoroutineInfo, ptr %69, i32 0, i32 1
  store ptr null, ptr %70, align 8, !tbaa !26
  %71 = call noalias ptr @malloc(i64 noundef 1024) #9
  %72 = load ptr, ptr %8, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.CoroutineInfo, ptr %72, i32 0, i32 2
  %74 = getelementptr inbounds %struct.ucontext_t, ptr %73, i32 0, i32 2
  %75 = getelementptr inbounds %struct.stack_t, ptr %74, i32 0, i32 0
  store ptr %71, ptr %75, align 8, !tbaa !27
  %76 = load ptr, ptr %8, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.CoroutineInfo, ptr %76, i32 0, i32 2
  %78 = getelementptr inbounds %struct.ucontext_t, ptr %77, i32 0, i32 2
  %79 = getelementptr inbounds %struct.stack_t, ptr %78, i32 0, i32 2
  store i64 1024, ptr %79, align 8, !tbaa !28
  %80 = load ptr, ptr %8, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.CoroutineInfo, ptr %80, i32 0, i32 2
  %82 = getelementptr inbounds %struct.ucontext_t, ptr %81, i32 0, i32 1
  store ptr null, ptr %82, align 8, !tbaa !29
  %83 = load ptr, ptr %8, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct.CoroutineInfo, ptr %83, i32 0, i32 2
  call void (ptr, ptr, i32, ...) @makecontext(ptr noundef %84, ptr noundef @endCoroutineFunc, i32 noundef 0) #7
  %85 = load ptr, ptr %8, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.CoroutineInfo, ptr %85, i32 0, i32 2
  %87 = load ptr, ptr %7, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.HandleCoroutine, ptr %87, i32 0, i32 1
  store ptr %86, ptr %88, align 8, !tbaa !30
  %89 = getelementptr inbounds [2 x ptr], ptr %9, i64 0, i64 0
  store ptr null, ptr %89, align 16, !tbaa !5
  %90 = getelementptr inbounds [2 x ptr], ptr %9, i64 0, i64 1
  store ptr null, ptr %90, align 8, !tbaa !5
  %91 = load ptr, ptr %7, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.HandleCoroutine, ptr %91, i32 0, i32 0
  %93 = load ptr, ptr %92, align 8, !tbaa !13
  %94 = getelementptr inbounds [2 x ptr], ptr %9, i64 0, i64 0
  %95 = call ptr @mornMapWrite(ptr noundef %93, ptr noundef %94, i32 noundef 16, ptr noundef null, i32 noundef 1016)
  store ptr %95, ptr %8, align 8, !tbaa !5
  %96 = load ptr, ptr %8, align 8, !tbaa !5
  %97 = getelementptr inbounds %struct.CoroutineInfo, ptr %96, i32 0, i32 2
  %98 = call i32 @getcontext(ptr noundef %97) #8
  %99 = load ptr, ptr %8, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.CoroutineInfo, ptr %99, i32 0, i32 3
  store i32 -1, ptr %100, align 8, !tbaa !15
  %101 = load ptr, ptr %8, align 8, !tbaa !5
  %102 = getelementptr inbounds %struct.CoroutineInfo, ptr %101, i32 0, i32 3
  %103 = load ptr, ptr %8, align 8, !tbaa !5
  %104 = getelementptr inbounds %struct.CoroutineInfo, ptr %103, i32 0, i32 4
  store ptr %102, ptr %104, align 8, !tbaa !24
  %105 = load ptr, ptr %8, align 8, !tbaa !5
  %106 = getelementptr inbounds %struct.CoroutineInfo, ptr %105, i32 0, i32 0
  store ptr null, ptr %106, align 8, !tbaa !25
  %107 = load ptr, ptr %8, align 8, !tbaa !5
  %108 = getelementptr inbounds %struct.CoroutineInfo, ptr %107, i32 0, i32 1
  store ptr null, ptr %108, align 8, !tbaa !26
  %109 = load ptr, ptr %8, align 8, !tbaa !5
  %110 = getelementptr inbounds %struct.CoroutineInfo, ptr %109, i32 0, i32 2
  %111 = getelementptr inbounds %struct.ucontext_t, ptr %110, i32 0, i32 2
  %112 = getelementptr inbounds %struct.stack_t, ptr %111, i32 0, i32 0
  store ptr null, ptr %112, align 8, !tbaa !27
  %113 = load ptr, ptr %8, align 8, !tbaa !5
  %114 = getelementptr inbounds %struct.CoroutineInfo, ptr %113, i32 0, i32 2
  %115 = getelementptr inbounds %struct.ucontext_t, ptr %114, i32 0, i32 1
  store ptr null, ptr %115, align 8, !tbaa !29
  %116 = load ptr, ptr %8, align 8, !tbaa !5
  %117 = getelementptr inbounds %struct.CoroutineInfo, ptr %116, i32 0, i32 5
  store ptr null, ptr %117, align 8, !tbaa !31
  %118 = load ptr, ptr %8, align 8, !tbaa !5
  %119 = getelementptr inbounds %struct.CoroutineInfo, ptr %118, i32 0, i32 6
  store ptr null, ptr %119, align 8, !tbaa !32
  %120 = load ptr, ptr %8, align 8, !tbaa !5
  %121 = load ptr, ptr %7, align 8, !tbaa !5
  %122 = getelementptr inbounds %struct.HandleCoroutine, ptr %121, i32 0, i32 2
  store ptr %120, ptr %122, align 8, !tbaa !33
  %123 = load ptr, ptr %7, align 8, !tbaa !5
  %124 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @morn_coroutine_handle)
  store ptr %123, ptr %124, align 8, !tbaa !5
  %125 = load ptr, ptr %8, align 8, !tbaa !5
  %126 = getelementptr inbounds %struct.CoroutineInfo, ptr %125, i32 0, i32 2
  %127 = load ptr, ptr %7, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.HandleCoroutine, ptr %127, i32 0, i32 1
  %129 = load ptr, ptr %128, align 8, !tbaa !30
  %130 = call i32 @swapcontext(ptr noundef %126, ptr noundef %129) #7
  %131 = load ptr, ptr %10, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct.MHandle, ptr %131, i32 0, i32 1
  store volatile i32 1, ptr %132, align 4, !tbaa !34
  br label %133

133:                                              ; preds = %50, %32
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %134

134:                                              ; preds = %133, %22
  %135 = load ptr, ptr %7, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.HandleCoroutine, ptr %135, i32 0, i32 2
  %137 = load ptr, ptr %136, align 8, !tbaa !33
  store ptr %137, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %138 = load ptr, ptr %8, align 8, !tbaa !5
  %139 = getelementptr inbounds %struct.CoroutineInfo, ptr %138, i32 0, i32 6
  %140 = load ptr, ptr %139, align 8, !tbaa !32
  store ptr %140, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %141 = load ptr, ptr %11, align 8, !tbaa !5
  %142 = icmp ne ptr %141, null
  %143 = zext i1 %142 to i32
  store i32 %143, ptr %12, align 4, !tbaa !9
  %144 = load i32, ptr %12, align 4, !tbaa !9
  %145 = icmp ne i32 %144, 0
  br i1 %145, label %146, label %161

146:                                              ; preds = %134
  %147 = load ptr, ptr %11, align 8, !tbaa !5
  %148 = getelementptr inbounds %struct.CoroutineInfo, ptr %147, i32 0, i32 0
  %149 = load ptr, ptr %148, align 8, !tbaa !25
  %150 = load ptr, ptr %4, align 8, !tbaa !5
  %151 = icmp eq ptr %149, %150
  br i1 %151, label %152, label %158

152:                                              ; preds = %146
  %153 = load ptr, ptr %11, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.CoroutineInfo, ptr %153, i32 0, i32 1
  %155 = load ptr, ptr %154, align 8, !tbaa !26
  %156 = load ptr, ptr %5, align 8, !tbaa !5
  %157 = icmp eq ptr %155, %156
  br label %158

158:                                              ; preds = %152, %146
  %159 = phi i1 [ false, %146 ], [ %157, %152 ]
  %160 = zext i1 %159 to i32
  store i32 %160, ptr %12, align 4, !tbaa !9
  br label %161

161:                                              ; preds = %158, %134
  %162 = load i32, ptr %12, align 4, !tbaa !9
  %163 = icmp ne i32 %162, 0
  br i1 %163, label %174, label %164

164:                                              ; preds = %161
  %165 = load ptr, ptr %4, align 8, !tbaa !5
  %166 = getelementptr inbounds [2 x ptr], ptr %9, i64 0, i64 0
  store ptr %165, ptr %166, align 16, !tbaa !5
  %167 = load ptr, ptr %5, align 8, !tbaa !5
  %168 = getelementptr inbounds [2 x ptr], ptr %9, i64 0, i64 1
  store ptr %167, ptr %168, align 8, !tbaa !5
  %169 = load ptr, ptr %7, align 8, !tbaa !5
  %170 = getelementptr inbounds %struct.HandleCoroutine, ptr %169, i32 0, i32 0
  %171 = load ptr, ptr %170, align 8, !tbaa !13
  %172 = getelementptr inbounds [2 x ptr], ptr %9, i64 0, i64 0
  %173 = call ptr @mornMapRead(ptr noundef %171, ptr noundef %172, i32 noundef 16, ptr noundef null, ptr noundef null)
  store ptr %173, ptr %11, align 8, !tbaa !5
  br label %174

174:                                              ; preds = %164, %161
  %175 = load ptr, ptr %11, align 8, !tbaa !5
  %176 = icmp eq ptr %175, null
  br i1 %176, label %177, label %238

177:                                              ; preds = %174
  %178 = load ptr, ptr %6, align 8, !tbaa !5
  %179 = icmp ne ptr %178, null
  br i1 %179, label %180, label %182

180:                                              ; preds = %177
  %181 = load ptr, ptr %6, align 8, !tbaa !5
  store i32 0, ptr %181, align 4, !tbaa !9
  br label %182

182:                                              ; preds = %180, %177
  %183 = load ptr, ptr %4, align 8, !tbaa !5
  %184 = getelementptr inbounds [2 x ptr], ptr %9, i64 0, i64 0
  store ptr %183, ptr %184, align 16, !tbaa !5
  %185 = load ptr, ptr %5, align 8, !tbaa !5
  %186 = getelementptr inbounds [2 x ptr], ptr %9, i64 0, i64 1
  store ptr %185, ptr %186, align 8, !tbaa !5
  %187 = load ptr, ptr %7, align 8, !tbaa !5
  %188 = getelementptr inbounds %struct.HandleCoroutine, ptr %187, i32 0, i32 0
  %189 = load ptr, ptr %188, align 8, !tbaa !13
  %190 = getelementptr inbounds [2 x ptr], ptr %9, i64 0, i64 0
  %191 = call ptr @mornMapWrite(ptr noundef %189, ptr noundef %190, i32 noundef 16, ptr noundef null, i32 noundef 1016)
  store ptr %191, ptr %11, align 8, !tbaa !5
  %192 = load ptr, ptr %11, align 8, !tbaa !5
  %193 = getelementptr inbounds %struct.CoroutineInfo, ptr %192, i32 0, i32 2
  %194 = call i32 @getcontext(ptr noundef %193) #8
  %195 = load ptr, ptr %11, align 8, !tbaa !5
  %196 = getelementptr inbounds %struct.CoroutineInfo, ptr %195, i32 0, i32 3
  store i32 0, ptr %196, align 8, !tbaa !15
  %197 = load ptr, ptr %6, align 8, !tbaa !5
  %198 = icmp ne ptr %197, null
  br i1 %198, label %199, label %201

199:                                              ; preds = %182
  %200 = load ptr, ptr %6, align 8, !tbaa !5
  br label %204

201:                                              ; preds = %182
  %202 = load ptr, ptr %11, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.CoroutineInfo, ptr %202, i32 0, i32 3
  br label %204

204:                                              ; preds = %201, %199
  %205 = phi ptr [ %200, %199 ], [ %203, %201 ]
  %206 = load ptr, ptr %11, align 8, !tbaa !5
  %207 = getelementptr inbounds %struct.CoroutineInfo, ptr %206, i32 0, i32 4
  store ptr %205, ptr %207, align 8, !tbaa !24
  %208 = load ptr, ptr %4, align 8, !tbaa !5
  %209 = load ptr, ptr %11, align 8, !tbaa !5
  %210 = getelementptr inbounds %struct.CoroutineInfo, ptr %209, i32 0, i32 0
  store ptr %208, ptr %210, align 8, !tbaa !25
  %211 = load ptr, ptr %5, align 8, !tbaa !5
  %212 = load ptr, ptr %11, align 8, !tbaa !5
  %213 = getelementptr inbounds %struct.CoroutineInfo, ptr %212, i32 0, i32 1
  store ptr %211, ptr %213, align 8, !tbaa !26
  %214 = call noalias ptr @malloc(i64 noundef 262144) #9
  %215 = load ptr, ptr %11, align 8, !tbaa !5
  %216 = getelementptr inbounds %struct.CoroutineInfo, ptr %215, i32 0, i32 2
  %217 = getelementptr inbounds %struct.ucontext_t, ptr %216, i32 0, i32 2
  %218 = getelementptr inbounds %struct.stack_t, ptr %217, i32 0, i32 0
  store ptr %214, ptr %218, align 8, !tbaa !27
  %219 = load ptr, ptr %11, align 8, !tbaa !5
  %220 = getelementptr inbounds %struct.CoroutineInfo, ptr %219, i32 0, i32 2
  %221 = getelementptr inbounds %struct.ucontext_t, ptr %220, i32 0, i32 2
  %222 = getelementptr inbounds %struct.stack_t, ptr %221, i32 0, i32 2
  store i64 262144, ptr %222, align 8, !tbaa !28
  %223 = load ptr, ptr %7, align 8, !tbaa !5
  %224 = getelementptr inbounds %struct.HandleCoroutine, ptr %223, i32 0, i32 1
  %225 = load ptr, ptr %224, align 8, !tbaa !30
  %226 = load ptr, ptr %11, align 8, !tbaa !5
  %227 = getelementptr inbounds %struct.CoroutineInfo, ptr %226, i32 0, i32 2
  %228 = getelementptr inbounds %struct.ucontext_t, ptr %227, i32 0, i32 1
  store ptr %225, ptr %228, align 8, !tbaa !29
  %229 = load ptr, ptr %11, align 8, !tbaa !5
  %230 = getelementptr inbounds %struct.CoroutineInfo, ptr %229, i32 0, i32 6
  store ptr null, ptr %230, align 8, !tbaa !32
  %231 = load ptr, ptr %8, align 8, !tbaa !5
  %232 = load ptr, ptr %11, align 8, !tbaa !5
  %233 = getelementptr inbounds %struct.CoroutineInfo, ptr %232, i32 0, i32 5
  store ptr %231, ptr %233, align 8, !tbaa !31
  %234 = load ptr, ptr %11, align 8, !tbaa !5
  %235 = getelementptr inbounds %struct.CoroutineInfo, ptr %234, i32 0, i32 2
  %236 = load ptr, ptr %4, align 8, !tbaa !5
  %237 = load ptr, ptr %5, align 8, !tbaa !5
  call void (ptr, ptr, i32, ...) @makecontext(ptr noundef %235, ptr noundef %236, i32 noundef 1, ptr noundef %237) #7
  br label %238

238:                                              ; preds = %204, %174
  %239 = load ptr, ptr %11, align 8, !tbaa !5
  %240 = load ptr, ptr %8, align 8, !tbaa !5
  %241 = getelementptr inbounds %struct.CoroutineInfo, ptr %240, i32 0, i32 6
  store ptr %239, ptr %241, align 8, !tbaa !32
  %242 = load ptr, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  ret ptr %242
}

declare ptr @GetHandle(ptr noundef, i32 noundef, i32 noundef, ptr noundef) #4

declare ptr @mMornObject(ptr noundef, i32 noundef) #4

declare i32 @mHandleValid(ptr noundef) #4

declare ptr @mChainCreate(...) #4

declare ptr @mornMapWrite(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef) #4

; Function Attrs: nounwind returns_twice
declare i32 @getcontext(ptr noundef) #5

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #6

; Function Attrs: nounwind
declare void @makecontext(ptr noundef, ptr noundef, i32 noundef, ...) #3

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

declare ptr @mornMapRead(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef) #4

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { nounwind "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 #4 = { "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 returns_twice "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 #6 = { nounwind allocsize(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 #7 = { nounwind }
attributes #8 = { nounwind returns_twice }
attributes #9 = { nounwind allocsize(0) }

!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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 16}
!12 = !{!"MHandle", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16}
!13 = !{!14, !6, i64 0}
!14 = !{!"HandleCoroutine", !6, i64 0, !6, i64 8, !6, i64 16}
!15 = !{!16, !10, i64 984}
!16 = !{!"CoroutineInfo", !6, i64 0, !6, i64 8, !17, i64 16, !10, i64 984, !6, i64 992, !6, i64 1000, !6, i64 1008}
!17 = !{!"ucontext_t", !18, i64 0, !6, i64 8, !19, i64 16, !20, i64 40, !21, i64 296, !22, i64 424, !7, i64 936}
!18 = !{!"long", !7, i64 0}
!19 = !{!"", !6, i64 0, !10, i64 8, !18, i64 16}
!20 = !{!"", !7, i64 0, !6, i64 184, !7, i64 192}
!21 = !{!"", !7, i64 0}
!22 = !{!"_libc_fpstate", !23, i64 0, !23, i64 2, !23, i64 4, !23, i64 6, !18, i64 8, !18, i64 16, !10, i64 24, !10, i64 28, !7, i64 32, !7, i64 160, !7, i64 416}
!23 = !{!"short", !7, i64 0}
!24 = !{!16, !6, i64 992}
!25 = !{!16, !6, i64 0}
!26 = !{!16, !6, i64 8}
!27 = !{!16, !6, i64 32}
!28 = !{!16, !18, i64 48}
!29 = !{!16, !6, i64 24}
!30 = !{!14, !6, i64 8}
!31 = !{!16, !6, i64 1000}
!32 = !{!16, !6, i64 1008}
!33 = !{!14, !6, i64 16}
!34 = !{!12, !10, i64 4}


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

@morn_coroutine_handle = external dso_local thread_local local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: nounwind uwtable
declare dso_local void @endCoroutine(ptr noundef) #0

; Function Attrs: nounwind uwtable
declare dso_local void @endCoroutineFunc() #0

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare nonnull ptr @llvm.threadlocal.address.p0(ptr nonnull) #2

; Function Attrs: nounwind
declare i32 @swapcontext(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local ptr @m_CoroutineInfo(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #0 {
  %4 = alloca [2 x ptr], align 16
  %5 = icmp eq ptr %2, inttoptr (i64 -1 to ptr)
  %spec.store.select = select i1 %5, ptr null, ptr %2
  %6 = icmp eq ptr %0, inttoptr (i64 -1 to ptr)
  %spec.store.select1 = select i1 %6, ptr null, ptr %0
  %7 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @morn_coroutine_handle)
  %8 = load ptr, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #8
  %9 = icmp eq ptr %8, null
  br i1 %9, label %10, label %49

10:                                               ; preds = %3
  %.not = icmp eq ptr %spec.store.select, null
  br i1 %.not, label %12, label %11

11:                                               ; preds = %10
  store i32 0, ptr %spec.store.select, align 4, !tbaa !9
  br label %12

12:                                               ; preds = %11, %10
  %13 = call ptr @mMornObject(ptr noundef nonnull @.str, i32 noundef -1) #8
  %14 = call ptr @GetHandle(ptr noundef %13, i32 noundef 24, i32 noundef -1868988789, ptr noundef nonnull @endCoroutine) #8
  %15 = getelementptr inbounds i8, ptr %14, i64 16
  %16 = load ptr, ptr %15, align 8, !tbaa !11
  %17 = call i32 @mHandleValid(ptr noundef %14) #8
  %.not84 = icmp eq i32 %17, 0
  br i1 %.not84, label %18, label %49

18:                                               ; preds = %12
  %19 = load ptr, ptr %16, align 8, !tbaa !13
  %20 = icmp eq ptr %19, null
  br i1 %20, label %21, label %23

21:                                               ; preds = %18
  %22 = call ptr (...) @mChainCreate() #8
  store ptr %22, ptr %16, align 8, !tbaa !13
  br label %23

23:                                               ; preds = %21, %18
  store ptr @endCoroutineFunc, ptr %4, align 16, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %4, i64 8
  store ptr null, ptr %24, align 8, !tbaa !5
  %25 = load ptr, ptr %16, align 8, !tbaa !13
  %26 = call ptr @mornMapWrite(ptr noundef %25, ptr noundef nonnull %4, i32 noundef 16, ptr noundef null, i32 noundef 1016) #8
  %27 = getelementptr inbounds i8, ptr %26, i64 16
  %28 = call i32 @getcontext(ptr noundef nonnull %27) #9
  %29 = getelementptr inbounds i8, ptr %26, i64 984
  store i32 0, ptr %29, align 8, !tbaa !15
  %30 = getelementptr inbounds i8, ptr %26, i64 992
  store ptr %29, ptr %30, align 8, !tbaa !24
  store ptr @endCoroutineFunc, ptr %26, align 8, !tbaa !25
  %31 = getelementptr inbounds i8, ptr %26, i64 8
  store ptr null, ptr %31, align 8, !tbaa !26
  %32 = call noalias dereferenceable_or_null(1024) ptr @malloc(i64 noundef 1024) #10
  %33 = getelementptr inbounds i8, ptr %26, i64 32
  store ptr %32, ptr %33, align 8, !tbaa !27
  %34 = getelementptr inbounds i8, ptr %26, i64 48
  store i64 1024, ptr %34, align 8, !tbaa !28
  %35 = getelementptr inbounds i8, ptr %26, i64 24
  store ptr null, ptr %35, align 8, !tbaa !29
  call void (ptr, ptr, i32, ...) @makecontext(ptr noundef nonnull %27, ptr noundef nonnull @endCoroutineFunc, i32 noundef 0) #8
  %36 = getelementptr inbounds i8, ptr %16, i64 8
  store ptr %27, ptr %36, align 8, !tbaa !30
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(16) %4, i8 0, i64 16, i1 false)
  %37 = load ptr, ptr %16, align 8, !tbaa !13
  %38 = call ptr @mornMapWrite(ptr noundef %37, ptr noundef nonnull %4, i32 noundef 16, ptr noundef null, i32 noundef 1016) #8
  %39 = getelementptr inbounds i8, ptr %38, i64 16
  %40 = call i32 @getcontext(ptr noundef nonnull %39) #9
  %41 = getelementptr inbounds i8, ptr %38, i64 984
  store i32 -1, ptr %41, align 8, !tbaa !15
  %42 = getelementptr inbounds i8, ptr %38, i64 992
  store ptr %41, ptr %42, align 8, !tbaa !24
  %43 = getelementptr inbounds i8, ptr %38, i64 24
  %44 = getelementptr inbounds i8, ptr %38, i64 1000
  %45 = getelementptr inbounds i8, ptr %16, i64 16
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %38, i8 0, i64 16, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %43, i8 0, i64 16, i1 false)
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %44, i8 0, i64 16, i1 false)
  store ptr %38, ptr %45, align 8, !tbaa !31
  store ptr %16, ptr %7, align 8, !tbaa !5
  %46 = load ptr, ptr %36, align 8, !tbaa !30
  %47 = call i32 @swapcontext(ptr noundef nonnull %39, ptr noundef %46) #8
  %48 = getelementptr inbounds i8, ptr %14, i64 4
  store volatile i32 1, ptr %48, align 4, !tbaa !32
  br label %49

49:                                               ; preds = %12, %23, %3
  %.081 = phi ptr [ %8, %3 ], [ %16, %23 ], [ %16, %12 ]
  %50 = getelementptr inbounds i8, ptr %.081, i64 16
  %51 = load ptr, ptr %50, align 8, !tbaa !31
  %52 = getelementptr inbounds i8, ptr %51, i64 1008
  %53 = load ptr, ptr %52, align 8, !tbaa !33
  %.not91 = icmp eq ptr %53, null
  br i1 %.not91, label %.thread, label %54

54:                                               ; preds = %49
  %55 = load ptr, ptr %53, align 8, !tbaa !25
  %56 = icmp eq ptr %55, %spec.store.select1
  br i1 %56, label %57, label %.thread

57:                                               ; preds = %54
  %58 = getelementptr inbounds i8, ptr %53, i64 8
  %59 = load ptr, ptr %58, align 8, !tbaa !26
  %.not92 = icmp eq ptr %59, %1
  br i1 %.not92, label %.thread89, label %.thread

.thread:                                          ; preds = %54, %49, %57
  store ptr %spec.store.select1, ptr %4, align 16, !tbaa !5
  %60 = getelementptr inbounds i8, ptr %4, i64 8
  store ptr %1, ptr %60, align 8, !tbaa !5
  %61 = load ptr, ptr %.081, align 8, !tbaa !13
  %62 = call ptr @mornMapRead(ptr noundef %61, ptr noundef nonnull %4, i32 noundef 16, ptr noundef null, ptr noundef null) #8
  %63 = icmp eq ptr %62, null
  br i1 %63, label %64, label %.thread89

64:                                               ; preds = %.thread
  %.not86 = icmp eq ptr %spec.store.select, null
  br i1 %.not86, label %66, label %65

65:                                               ; preds = %64
  store i32 0, ptr %spec.store.select, align 4, !tbaa !9
  br label %66

66:                                               ; preds = %65, %64
  store ptr %spec.store.select1, ptr %4, align 16, !tbaa !5
  store ptr %1, ptr %60, align 8, !tbaa !5
  %67 = load ptr, ptr %.081, align 8, !tbaa !13
  %68 = call ptr @mornMapWrite(ptr noundef %67, ptr noundef nonnull %4, i32 noundef 16, ptr noundef null, i32 noundef 1016) #8
  %69 = getelementptr inbounds i8, ptr %68, i64 16
  %70 = call i32 @getcontext(ptr noundef nonnull %69) #9
  %71 = getelementptr inbounds i8, ptr %68, i64 984
  store i32 0, ptr %71, align 8, !tbaa !15
  %72 = select i1 %.not86, ptr %71, ptr %spec.store.select
  %73 = getelementptr inbounds i8, ptr %68, i64 992
  store ptr %72, ptr %73, align 8, !tbaa !24
  store ptr %spec.store.select1, ptr %68, align 8, !tbaa !25
  %74 = getelementptr inbounds i8, ptr %68, i64 8
  store ptr %1, ptr %74, align 8, !tbaa !26
  %75 = call noalias dereferenceable_or_null(262144) ptr @malloc(i64 noundef 262144) #10
  %76 = getelementptr inbounds i8, ptr %68, i64 32
  store ptr %75, ptr %76, align 8, !tbaa !27
  %77 = getelementptr inbounds i8, ptr %68, i64 48
  store i64 262144, ptr %77, align 8, !tbaa !28
  %78 = getelementptr inbounds i8, ptr %.081, i64 8
  %79 = load ptr, ptr %78, align 8, !tbaa !30
  %80 = getelementptr inbounds i8, ptr %68, i64 24
  store ptr %79, ptr %80, align 8, !tbaa !29
  %81 = getelementptr inbounds i8, ptr %68, i64 1008
  store ptr null, ptr %81, align 8, !tbaa !33
  %82 = getelementptr inbounds i8, ptr %68, i64 1000
  store ptr %51, ptr %82, align 8, !tbaa !34
  call void (ptr, ptr, i32, ...) @makecontext(ptr noundef nonnull %69, ptr noundef %spec.store.select1, i32 noundef 1, ptr noundef %1) #8
  br label %.thread89

.thread89:                                        ; preds = %57, %66, %.thread
  %.1 = phi ptr [ %68, %66 ], [ %62, %.thread ], [ %53, %57 ]
  store ptr %.1, ptr %52, align 8, !tbaa !33
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #8
  ret ptr %.1
}

declare ptr @GetHandle(ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

declare ptr @mMornObject(ptr noundef, i32 noundef) local_unnamed_addr #4

declare i32 @mHandleValid(ptr noundef) local_unnamed_addr #4

declare ptr @mChainCreate(...) local_unnamed_addr #4

declare ptr @mornMapWrite(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: nounwind returns_twice
declare i32 @getcontext(ptr noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #6

; Function Attrs: nounwind
declare void @makecontext(ptr noundef, ptr noundef, i32 noundef, ...) local_unnamed_addr #3

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

declare ptr @mornMapRead(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

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

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { nounwind "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 #4 = { "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 returns_twice "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 #6 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #7 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { nounwind }
attributes #9 = { nounwind returns_twice }
attributes #10 = { nounwind allocsize(0) }

!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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 16}
!12 = !{!"MHandle", !10, i64 0, !10, i64 4, !6, i64 8, !6, i64 16}
!13 = !{!14, !6, i64 0}
!14 = !{!"HandleCoroutine", !6, i64 0, !6, i64 8, !6, i64 16}
!15 = !{!16, !10, i64 984}
!16 = !{!"CoroutineInfo", !6, i64 0, !6, i64 8, !17, i64 16, !10, i64 984, !6, i64 992, !6, i64 1000, !6, i64 1008}
!17 = !{!"ucontext_t", !18, i64 0, !6, i64 8, !19, i64 16, !20, i64 40, !21, i64 296, !22, i64 424, !7, i64 936}
!18 = !{!"long", !7, i64 0}
!19 = !{!"", !6, i64 0, !10, i64 8, !18, i64 16}
!20 = !{!"", !7, i64 0, !6, i64 184, !7, i64 192}
!21 = !{!"", !7, i64 0}
!22 = !{!"_libc_fpstate", !23, i64 0, !23, i64 2, !23, i64 4, !23, i64 6, !18, i64 8, !18, i64 16, !10, i64 24, !10, i64 28, !7, i64 32, !7, i64 160, !7, i64 416}
!23 = !{!"short", !7, i64 0}
!24 = !{!16, !6, i64 992}
!25 = !{!16, !6, i64 0}
!26 = !{!16, !6, i64 8}
!27 = !{!16, !6, i64 32}
!28 = !{!16, !18, i64 48}
!29 = !{!16, !6, i64 24}
!30 = !{!14, !6, i64 8}
!31 = !{!14, !6, i64 16}
!32 = !{!12, !10, i64 4}
!33 = !{!16, !6, i64 1008}
!34 = !{!16, !6, i64 1000}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,MemCpyOptPass,SROAPass,SimplifyCFGPass