; LLVM IR from pmwkaa/monotone :: monotone/main/api (monotone)

; 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.Runtime = type { %struct.ExceptionMgr, %struct.Error, ptr }
%struct.ExceptionMgr = type { ptr }
%struct.Error = type { [256 x i8], i32, ptr, ptr, i32, ptr, ptr }
%struct.Exception = type { ptr, i8, ptr, [1 x %struct.__jmp_buf_tag] }
%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }
%struct.monotone = type { i32, %struct.Main }
%struct.Main = type { %struct.Rwlock, %struct.File, %struct.Engine, %struct.Wal, %struct.Service, %struct.WorkerMgr, %struct.CloudMgr, %struct.MemoryMgr, %struct.CompressionMgr, %struct.EncryptionMgr, %struct.Random, %struct.Comparator, %struct.Logger, %struct.Context, %struct.Control, %struct.Config, %struct.Global }
%struct.Rwlock = type { %union.pthread_rwlock_t }
%union.pthread_rwlock_t = type { %struct.__pthread_rwlock_arch_t }
%struct.__pthread_rwlock_arch_t = type { i32, i32, i32, i32, i32, i32, i32, i32, i8, [7 x i8], i64, i32 }
%struct.File = type { i32, i64, %struct.Str, %struct.List }
%struct.Str = type { ptr, ptr, i8 }
%struct.List = type { ptr, ptr }
%struct.Engine = type { %struct.Mutex, %struct.CondVar, %struct.Mapping, %struct.Pipeline, %struct.StorageMgr, ptr, ptr, ptr }
%struct.Mutex = type { %union.pthread_mutex_t }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%struct.CondVar = type { %union.pthread_cond_t }
%union.pthread_cond_t = type { %struct.__pthread_cond_s }
%struct.__pthread_cond_s = type { %union.__atomic_wide_counter, %union.__atomic_wide_counter, [2 x i32], [2 x i32], i32, i32, [2 x i32] }
%union.__atomic_wide_counter = type { i64 }
%struct.Mapping = type { %struct.Rbtree, i32 }
%struct.Rbtree = type { ptr }
%struct.Pipeline = type { %struct.List, i32, ptr }
%struct.StorageMgr = type { %struct.List, i32, ptr }
%struct.Wal = type { %struct.Mutex, %struct.WalId, ptr }
%struct.WalId = type { %struct.Spinlock, i32, %struct.Buf }
%struct.Spinlock = type { i32 }
%struct.Buf = type { ptr, ptr, ptr }
%struct.Service = type { %struct.Mutex, %struct.CondVar, %struct.List, i32, i32, i8 }
%struct.WorkerMgr = type { i32, ptr }
%struct.CloudMgr = type { %struct.List, i32 }
%struct.MemoryMgr = type { %struct.Mutex, %struct.CondVar, i32, ptr, i32, i32, i64, i8, i8, i64, i64 }
%struct.CompressionMgr = type { %struct.Cache, %struct.Cache }
%struct.Cache = type { %struct.Spinlock, %struct.List, i32 }
%struct.EncryptionMgr = type { %struct.Cache }
%struct.Random = type { %struct.Spinlock, [2 x i64] }
%struct.Comparator = type { i32 }
%struct.Logger = type { i8, i8, i32 }
%struct.Context = type { ptr, ptr, ptr }
%struct.Control = type { ptr, ptr, ptr, ptr }
%struct.Config = type { %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.Var, %struct.List, %struct.List, i32, i32, i32, i32 }
%struct.Var = type { i32, i32, %struct.Str, %struct.List, %struct.List, %union.anon }
%union.anon = type { %struct.Str }
%struct.Global = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr }
%struct.monotone_cursor = type { i32, %struct.EngineCursor, ptr }
%struct.EngineCursor = type { ptr, %struct.PartCursor, ptr }
%struct.PartCursor = type { ptr, %struct.PartIterator, %struct.MemtableIterator, %struct.MemtableIterator, %struct.MergeIterator }
%struct.PartIterator = type { %struct.Iterator, %struct.RegionIterator, %struct.IndexIterator, ptr, ptr, %struct.Reader }
%struct.Iterator = type { ptr, ptr, ptr, ptr }
%struct.RegionIterator = type { %struct.Iterator, ptr, i32, ptr, ptr }
%struct.IndexIterator = type { ptr, ptr, ptr, i32 }
%struct.Reader = type { ptr, ptr, ptr, %struct.Buf, %struct.Buf, %struct.Buf }
%struct.MemtableIterator = type { %struct.Iterator, ptr, ptr, i32, ptr, %struct.List }
%struct.MergeIterator = type { %struct.Iterator, ptr, %struct.Buf, i32, ptr }

@mn_runtime = external thread_local global %struct.Runtime, align 8
@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [38 x i8], align 1
@__func__.monotone_free = external hidden unnamed_addr constant [14 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [33 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: inlinehint nounwind uwtable
declare hidden void @monotone_enter(ptr noundef) #1

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

; Function Attrs: nounwind returns_twice
declare i32 @_setjmp(ptr noundef) #3

; Function Attrs: alwaysinline nounwind uwtable
declare hidden zeroext i1 @exception_mgr_leave(ptr noundef, ptr noundef) #4

declare void @main_free(ptr noundef) #5

; Function Attrs: nounwind
declare void @free(ptr noundef) #6

; 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
define dso_local void @monotone_free(ptr noundef %0) #7 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca %struct.Exception, align 8
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %struct.Exception, align 8
  %9 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = load i32, ptr %10, align 4, !tbaa !9
  switch i32 %11, label %81 [
    i32 1068587329, label %12
    i32 339455746, label %43
    i32 57005, label %75
  ]

12:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #10
  %13 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %13, ptr %3, align 8, !tbaa !5
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  call void @monotone_enter(ptr noundef %14)
  call void @llvm.lifetime.start.p0(i64 224, ptr %4) #10
  %15 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %16 = getelementptr inbounds %struct.Runtime, ptr %15, i32 0, i32 0
  %17 = getelementptr inbounds %struct.ExceptionMgr, ptr %16, i32 0, i32 0
  %18 = load ptr, ptr %17, align 8, !tbaa !11
  %19 = getelementptr inbounds %struct.Exception, ptr %4, i32 0, i32 0
  store ptr %18, ptr %19, align 8, !tbaa !15
  %20 = getelementptr inbounds %struct.Exception, ptr %4, i32 0, i32 1
  store i8 0, ptr %20, align 8, !tbaa !18
  %21 = getelementptr inbounds %struct.Exception, ptr %4, i32 0, i32 2
  store ptr null, ptr %21, align 8, !tbaa !19
  %22 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %23 = getelementptr inbounds %struct.Runtime, ptr %22, i32 0, i32 0
  %24 = getelementptr inbounds %struct.ExceptionMgr, ptr %23, i32 0, i32 0
  store ptr %4, ptr %24, align 8, !tbaa !11
  %25 = getelementptr inbounds %struct.Exception, ptr %4, i32 0, i32 3
  %26 = getelementptr inbounds [1 x %struct.__jmp_buf_tag], ptr %25, i64 0, i64 0
  %27 = call i32 @_setjmp(ptr noundef %26) #11
  %28 = icmp eq i32 %27, 0
  %29 = zext i1 %28 to i32
  store i32 %29, ptr %5, align 4, !tbaa !9
  %30 = load i32, ptr %5, align 4, !tbaa !9
  %31 = icmp ne i32 %30, 0
  br i1 %31, label %32, label %37

32:                                               ; preds = %12
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.monotone, ptr %33, i32 0, i32 1
  call void @main_stop(ptr noundef %34)
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.monotone, ptr %35, i32 0, i32 1
  call void @main_free(ptr noundef %36)
  br label %37

37:                                               ; preds = %32, %12
  %38 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %39 = getelementptr inbounds %struct.Runtime, ptr %38, i32 0, i32 0
  %40 = call zeroext i1 @exception_mgr_leave(ptr noundef %39, ptr noundef %4)
  br i1 %40, label %41, label %42

41:                                               ; preds = %37
  br label %42

42:                                               ; preds = %41, %37
  call void @llvm.lifetime.end.p0(i64 224, ptr %4) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #10
  br label %87

43:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #10
  %44 = load ptr, ptr %2, align 8, !tbaa !5
  store ptr %44, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #10
  %45 = load ptr, ptr %6, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.monotone_cursor, ptr %45, i32 0, i32 2
  %47 = load ptr, ptr %46, align 8, !tbaa !20
  store ptr %47, ptr %7, align 8, !tbaa !5
  %48 = load ptr, ptr %7, align 8, !tbaa !5
  call void @monotone_enter(ptr noundef %48)
  call void @llvm.lifetime.start.p0(i64 224, ptr %8) #10
  %49 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %50 = getelementptr inbounds %struct.Runtime, ptr %49, i32 0, i32 0
  %51 = getelementptr inbounds %struct.ExceptionMgr, ptr %50, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8, !tbaa !11
  %53 = getelementptr inbounds %struct.Exception, ptr %8, i32 0, i32 0
  store ptr %52, ptr %53, align 8, !tbaa !15
  %54 = getelementptr inbounds %struct.Exception, ptr %8, i32 0, i32 1
  store i8 0, ptr %54, align 8, !tbaa !18
  %55 = getelementptr inbounds %struct.Exception, ptr %8, i32 0, i32 2
  store ptr null, ptr %55, align 8, !tbaa !19
  %56 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %57 = getelementptr inbounds %struct.Runtime, ptr %56, i32 0, i32 0
  %58 = getelementptr inbounds %struct.ExceptionMgr, ptr %57, i32 0, i32 0
  store ptr %8, ptr %58, align 8, !tbaa !11
  %59 = getelementptr inbounds %struct.Exception, ptr %8, i32 0, i32 3
  %60 = getelementptr inbounds [1 x %struct.__jmp_buf_tag], ptr %59, i64 0, i64 0
  %61 = call i32 @_setjmp(ptr noundef %60) #11
  %62 = icmp eq i32 %61, 0
  %63 = zext i1 %62 to i32
  store i32 %63, ptr %9, align 4, !tbaa !9
  %64 = load i32, ptr %9, align 4, !tbaa !9
  %65 = icmp ne i32 %64, 0
  br i1 %65, label %66, label %69

66:                                               ; preds = %43
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.monotone_cursor, ptr %67, i32 0, i32 1
  call void @engine_cursor_close(ptr noundef %68) #12
  br label %69

69:                                               ; preds = %66, %43
  %70 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %71 = getelementptr inbounds %struct.Runtime, ptr %70, i32 0, i32 0
  %72 = call zeroext i1 @exception_mgr_leave(ptr noundef %71, ptr noundef %8)
  br i1 %72, label %73, label %74

73:                                               ; preds = %69
  br label %74

74:                                               ; preds = %73, %69
  call void @llvm.lifetime.end.p0(i64 224, ptr %8) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #10
  br label %87

75:                                               ; preds = %1
  %76 = load ptr, ptr @stderr, align 8, !tbaa !5
  %77 = load ptr, ptr %2, align 8, !tbaa !5
  %78 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %76, ptr noundef @.str, ptr noundef @__func__.monotone_free, ptr noundef %77) #10
  %79 = load ptr, ptr @stderr, align 8, !tbaa !5
  %80 = call i32 @fflush(ptr noundef %79)
  call void @abort() #13
  unreachable

81:                                               ; preds = %1
  %82 = load ptr, ptr @stderr, align 8, !tbaa !5
  %83 = load ptr, ptr %2, align 8, !tbaa !5
  %84 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %82, ptr noundef @.str.1, ptr noundef @__func__.monotone_free, ptr noundef %83) #10
  %85 = load ptr, ptr @stderr, align 8, !tbaa !5
  %86 = call i32 @fflush(ptr noundef %85)
  call void @abort() #13
  unreachable

87:                                               ; preds = %74, %42
  %88 = load ptr, ptr %2, align 8, !tbaa !5
  store i32 57005, ptr %88, align 4, !tbaa !9
  %89 = load ptr, ptr %2, align 8, !tbaa !5
  call void @free(ptr noundef %89) #10
  ret void
}

declare void @main_stop(ptr noundef) #5

; Function Attrs: hot inlinehint nounwind uwtable
declare hidden void @engine_cursor_close(ptr noundef) #8

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #6

declare i32 @fflush(ptr noundef) #5

; Function Attrs: noreturn nounwind
declare void @abort() #9

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 #4 = { alwaysinline 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 = { "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 "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 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 #8 = { hot inlinehint 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 #9 = { noreturn 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 #10 = { nounwind }
attributes #11 = { nounwind returns_twice }
attributes #12 = { hot }
attributes #13 = { noreturn 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 0}
!12 = !{!"Runtime", !13, i64 0, !14, i64 8, !6, i64 312}
!13 = !{!"ExceptionMgr", !6, i64 0}
!14 = !{!"Error", !7, i64 0, !10, i64 256, !6, i64 264, !6, i64 272, !10, i64 280, !6, i64 288, !6, i64 296}
!15 = !{!16, !6, i64 0}
!16 = !{!"Exception", !6, i64 0, !17, i64 8, !6, i64 16, !7, i64 24}
!17 = !{!"_Bool", !7, i64 0}
!18 = !{!16, !17, i64 8}
!19 = !{!16, !6, i64 16}
!20 = !{!21, !6, i64 512}
!21 = !{!"monotone_cursor", !10, i64 0, !22, i64 8, !6, i64 512}
!22 = !{!"EngineCursor", !6, i64 0, !23, i64 8, !6, i64 496}
!23 = !{!"PartCursor", !6, i64 0, !24, i64 8, !30, i64 248, !30, i64 328, !32, i64 408}
!24 = !{!"PartIterator", !25, i64 0, !26, i64 32, !27, i64 96, !6, i64 128, !6, i64 136, !28, i64 144}
!25 = !{!"Iterator", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!26 = !{!"RegionIterator", !25, i64 0, !6, i64 32, !10, i64 40, !6, i64 48, !6, i64 56}
!27 = !{!"IndexIterator", !6, i64 0, !6, i64 8, !6, i64 16, !10, i64 24}
!28 = !{!"Reader", !6, i64 0, !6, i64 8, !6, i64 16, !29, i64 24, !29, i64 48, !29, i64 72}
!29 = !{!"Buf", !6, i64 0, !6, i64 8, !6, i64 16}
!30 = !{!"MemtableIterator", !25, i64 0, !6, i64 32, !6, i64 40, !10, i64 48, !6, i64 56, !31, i64 64}
!31 = !{!"List", !6, i64 0, !6, i64 8}
!32 = !{!"MergeIterator", !25, i64 0, !6, i64 32, !29, i64 40, !10, i64 64, !6, i64 72}


; 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.Runtime = type { %struct.ExceptionMgr, %struct.Error, ptr }
%struct.ExceptionMgr = type { ptr }
%struct.Error = type { [256 x i8], i32, ptr, ptr, i32, ptr, ptr }
%struct.Exception = type { ptr, i8, ptr, [1 x %struct.__jmp_buf_tag] }
%struct.__jmp_buf_tag = type { [8 x i64], i32, %struct.__sigset_t }
%struct.__sigset_t = type { [16 x i64] }

@mn_runtime = external thread_local global %struct.Runtime, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [38 x i8], align 1
@__func__.monotone_free = external hidden unnamed_addr constant [14 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [33 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: inlinehint nounwind uwtable
declare hidden void @monotone_enter(ptr noundef) local_unnamed_addr #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 returns_twice
declare i32 @_setjmp(ptr noundef) local_unnamed_addr #3

; Function Attrs: alwaysinline nounwind uwtable
declare hidden zeroext i1 @exception_mgr_leave(ptr noundef, ptr noundef) local_unnamed_addr #4

declare void @main_free(ptr noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #6

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

; Function Attrs: nounwind uwtable
define dso_local void @monotone_free(ptr noundef %0) local_unnamed_addr #7 {
  %2 = alloca %struct.Exception, align 8
  %3 = alloca %struct.Exception, align 8
  %4 = load i32, ptr %0, align 4, !tbaa !5
  switch i32 %4, label %36 [
    i32 1068587329, label %5
    i32 339455746, label %17
    i32 57005, label %31
  ]

5:                                                ; preds = %1
  call void @monotone_enter(ptr noundef nonnull %0)
  call void @llvm.lifetime.start.p0(i64 224, ptr nonnull %2) #11
  %6 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %7 = load ptr, ptr %6, align 8, !tbaa !9
  store ptr %7, ptr %2, align 8, !tbaa !14
  %8 = getelementptr inbounds i8, ptr %2, i64 8
  store i8 0, ptr %8, align 8, !tbaa !17
  %9 = getelementptr inbounds i8, ptr %2, i64 16
  store ptr null, ptr %9, align 8, !tbaa !18
  store ptr %2, ptr %6, align 8, !tbaa !9
  %10 = getelementptr inbounds i8, ptr %2, i64 24
  %11 = call i32 @_setjmp(ptr noundef nonnull %10) #12
  %12 = icmp eq i32 %11, 0
  br i1 %12, label %13, label %15

13:                                               ; preds = %5
  %14 = getelementptr inbounds i8, ptr %0, i64 8
  call void @main_stop(ptr noundef nonnull %14) #11
  call void @main_free(ptr noundef nonnull %14) #11
  br label %15

15:                                               ; preds = %13, %5
  %16 = call zeroext i1 @exception_mgr_leave(ptr noundef nonnull %6, ptr noundef nonnull %2)
  call void @llvm.lifetime.end.p0(i64 224, ptr nonnull %2) #11
  br label %41

17:                                               ; preds = %1
  %18 = getelementptr inbounds i8, ptr %0, i64 512
  %19 = load ptr, ptr %18, align 8, !tbaa !19
  call void @monotone_enter(ptr noundef %19)
  call void @llvm.lifetime.start.p0(i64 224, ptr nonnull %3) #11
  %20 = call align 8 ptr @llvm.threadlocal.address.p0(ptr align 8 @mn_runtime)
  %21 = load ptr, ptr %20, align 8, !tbaa !9
  store ptr %21, ptr %3, align 8, !tbaa !14
  %22 = getelementptr inbounds i8, ptr %3, i64 8
  store i8 0, ptr %22, align 8, !tbaa !17
  %23 = getelementptr inbounds i8, ptr %3, i64 16
  store ptr null, ptr %23, align 8, !tbaa !18
  store ptr %3, ptr %20, align 8, !tbaa !9
  %24 = getelementptr inbounds i8, ptr %3, i64 24
  %25 = call i32 @_setjmp(ptr noundef nonnull %24) #12
  %26 = icmp eq i32 %25, 0
  br i1 %26, label %27, label %29

27:                                               ; preds = %17
  %28 = getelementptr inbounds i8, ptr %0, i64 8
  call void @engine_cursor_close(ptr noundef nonnull %28) #13
  br label %29

29:                                               ; preds = %27, %17
  %30 = call zeroext i1 @exception_mgr_leave(ptr noundef nonnull %20, ptr noundef nonnull %3)
  call void @llvm.lifetime.end.p0(i64 224, ptr nonnull %3) #11
  br label %41

31:                                               ; preds = %1
  %32 = load ptr, ptr @stderr, align 8, !tbaa !32
  %33 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %32, ptr noundef nonnull @.str, ptr noundef nonnull @__func__.monotone_free, ptr noundef nonnull %0) #14
  %34 = load ptr, ptr @stderr, align 8, !tbaa !32
  %35 = call i32 @fflush(ptr noundef %34)
  call void @abort() #15
  unreachable

36:                                               ; preds = %1
  %37 = load ptr, ptr @stderr, align 8, !tbaa !32
  %38 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %37, ptr noundef nonnull @.str.1, ptr noundef nonnull @__func__.monotone_free, ptr noundef nonnull %0) #14
  %39 = load ptr, ptr @stderr, align 8, !tbaa !32
  %40 = call i32 @fflush(ptr noundef %39)
  call void @abort() #15
  unreachable

41:                                               ; preds = %29, %15
  call void @free(ptr noundef nonnull %0) #11
  ret void
}

declare void @main_stop(ptr noundef) local_unnamed_addr #5

; Function Attrs: hot inlinehint nounwind uwtable
declare hidden void @engine_cursor_close(ptr noundef) local_unnamed_addr #8

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) local_unnamed_addr #9

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #9

; Function Attrs: noreturn nounwind
declare void @abort() local_unnamed_addr #10

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint 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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #3 = { 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 #4 = { alwaysinline 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 = { "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 nounwind willreturn allockind("free") memory(argmem: readwrite, 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 = { 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 #8 = { hot inlinehint 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 #9 = { nofree 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 #10 = { noreturn 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 #11 = { nounwind }
attributes #12 = { nounwind returns_twice }
attributes #13 = { hot }
attributes #14 = { cold nounwind }
attributes #15 = { noreturn 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !12, i64 0}
!10 = !{!"Runtime", !11, i64 0, !13, i64 8, !12, i64 312}
!11 = !{!"ExceptionMgr", !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!"Error", !7, i64 0, !6, i64 256, !12, i64 264, !12, i64 272, !6, i64 280, !12, i64 288, !12, i64 296}
!14 = !{!15, !12, i64 0}
!15 = !{!"Exception", !12, i64 0, !16, i64 8, !12, i64 16, !7, i64 24}
!16 = !{!"_Bool", !7, i64 0}
!17 = !{!15, !16, i64 8}
!18 = !{!15, !12, i64 16}
!19 = !{!20, !12, i64 512}
!20 = !{!"monotone_cursor", !6, i64 0, !21, i64 8, !12, i64 512}
!21 = !{!"EngineCursor", !12, i64 0, !22, i64 8, !12, i64 496}
!22 = !{!"PartCursor", !12, i64 0, !23, i64 8, !29, i64 248, !29, i64 328, !31, i64 408}
!23 = !{!"PartIterator", !24, i64 0, !25, i64 32, !26, i64 96, !12, i64 128, !12, i64 136, !27, i64 144}
!24 = !{!"Iterator", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24}
!25 = !{!"RegionIterator", !24, i64 0, !12, i64 32, !6, i64 40, !12, i64 48, !12, i64 56}
!26 = !{!"IndexIterator", !12, i64 0, !12, i64 8, !12, i64 16, !6, i64 24}
!27 = !{!"Reader", !12, i64 0, !12, i64 8, !12, i64 16, !28, i64 24, !28, i64 48, !28, i64 72}
!28 = !{!"Buf", !12, i64 0, !12, i64 8, !12, i64 16}
!29 = !{!"MemtableIterator", !24, i64 0, !12, i64 32, !12, i64 40, !6, i64 48, !12, i64 56, !30, i64 64}
!30 = !{!"List", !12, i64 0, !12, i64 8}
!31 = !{!"MergeIterator", !24, i64 0, !12, i64 32, !28, i64 40, !6, i64 64, !12, i64 72}
!32 = !{!12, !12, i64 0}


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