; LLVM IR from PaulBatchelor/sndkit :: lil (lil)

; 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._lil_t = type { ptr, ptr, i64, i64, i32, ptr, i64, i64, %struct._hashmap_t, ptr, i32, ptr, ptr, ptr, ptr, ptr, i32, i64, ptr, [8 x ptr], i64, ptr, ptr, i64 }
%struct._hashmap_t = type { [256 x %struct.hashcell_t] }
%struct.hashcell_t = type { ptr, i64 }
%struct._lil_var_t = type { ptr, ptr, ptr, ptr }

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

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

; Function Attrs: nounwind uwtable
declare hidden ptr @lil_find_var(ptr noundef, ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local ptr @lil_get_var_or(ptr noundef %0, ptr noundef %1, ptr noundef %2) #1 {
  %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 ptr, align 8
  %10 = alloca ptr, align 8
  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
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #2
  %11 = load ptr, ptr %4, align 8, !tbaa !5
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct._lil_t, ptr %12, i32 0, i32 12
  %14 = load ptr, ptr %13, align 8, !tbaa !9
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = call ptr @lil_find_var(ptr noundef %11, ptr noundef %14, ptr noundef %15)
  store ptr %16, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #2
  %17 = load ptr, ptr %7, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %19, label %23

19:                                               ; preds = %3
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct._lil_var_t, ptr %20, i32 0, i32 3
  %22 = load ptr, ptr %21, align 8, !tbaa !14
  br label %25

23:                                               ; preds = %3
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  br label %25

25:                                               ; preds = %23, %19
  %26 = phi ptr [ %22, %19 ], [ %24, %23 ]
  store ptr %26, ptr %8, align 8, !tbaa !5
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct._lil_t, ptr %27, i32 0, i32 19
  %29 = getelementptr inbounds [8 x ptr], ptr %28, i64 0, i64 7
  %30 = load ptr, ptr %29, align 8, !tbaa !5
  %31 = icmp ne ptr %30, null
  br i1 %31, label %32, label %57

32:                                               ; preds = %25
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = icmp ne ptr %33, null
  br i1 %34, label %35, label %43

35:                                               ; preds = %32
  %36 = load ptr, ptr %7, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct._lil_var_t, ptr %36, i32 0, i32 2
  %38 = load ptr, ptr %37, align 8, !tbaa !16
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct._lil_t, ptr %39, i32 0, i32 13
  %41 = load ptr, ptr %40, align 8, !tbaa !17
  %42 = icmp eq ptr %38, %41
  br i1 %42, label %43, label %57

43:                                               ; preds = %35, %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #2
  %44 = load ptr, ptr %4, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct._lil_t, ptr %44, i32 0, i32 19
  %46 = getelementptr inbounds [8 x ptr], ptr %45, i64 0, i64 7
  %47 = load ptr, ptr %46, align 8, !tbaa !5
  store ptr %47, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #2
  %48 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %48, ptr %10, align 8, !tbaa !5
  %49 = load ptr, ptr %9, align 8, !tbaa !5
  %50 = load ptr, ptr %4, align 8, !tbaa !5
  %51 = load ptr, ptr %5, align 8, !tbaa !5
  %52 = call i32 %49(ptr noundef %50, ptr noundef %51, ptr noundef %10)
  %53 = icmp ne i32 %52, 0
  br i1 %53, label %54, label %56

54:                                               ; preds = %43
  %55 = load ptr, ptr %10, align 8, !tbaa !5
  store ptr %55, ptr %8, align 8, !tbaa !5
  br label %56

56:                                               ; preds = %54, %43
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #2
  br label %57

57:                                               ; preds = %56, %35, %25
  %58 = load ptr, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #2
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #2
  ret ptr %58
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !6, i64 4184}
!10 = !{!"_lil_t", !6, i64 0, !6, i64 8, !11, i64 16, !11, i64 24, !12, i64 32, !6, i64 40, !11, i64 48, !11, i64 56, !13, i64 64, !6, i64 4160, !12, i64 4168, !6, i64 4176, !6, i64 4184, !6, i64 4192, !6, i64 4200, !6, i64 4208, !12, i64 4216, !11, i64 4224, !6, i64 4232, !7, i64 4240, !11, i64 4304, !6, i64 4312, !6, i64 4320, !11, i64 4328}
!11 = !{!"long", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_hashmap_t", !7, i64 0}
!14 = !{!15, !6, i64 24}
!15 = !{!"_lil_var_t", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24}
!16 = !{!15, !6, i64 16}
!17 = !{!10, !6, i64 4192}


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

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

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

; Function Attrs: nounwind uwtable
declare hidden ptr @lil_find_var(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
define dso_local ptr @lil_get_var_or(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #1 {
  %4 = alloca ptr, align 8
  %5 = getelementptr inbounds i8, ptr %0, i64 4184
  %6 = load ptr, ptr %5, align 8, !tbaa !5
  %7 = tail call ptr @lil_find_var(ptr noundef %0, ptr noundef %6, ptr noundef %1)
  %.not = icmp eq ptr %7, null
  br i1 %.not, label %8, label %.thread

8:                                                ; preds = %3
  %9 = getelementptr inbounds i8, ptr %0, i64 4296
  %10 = load ptr, ptr %9, align 8, !tbaa !13
  %.not18 = icmp eq ptr %10, null
  br i1 %.not18, label %26, label %21

.thread:                                          ; preds = %3
  %11 = getelementptr inbounds i8, ptr %7, i64 24
  %12 = load ptr, ptr %11, align 8, !tbaa !14
  %13 = getelementptr inbounds i8, ptr %0, i64 4296
  %14 = load ptr, ptr %13, align 8, !tbaa !13
  %.not1820 = icmp eq ptr %14, null
  br i1 %.not1820, label %26, label %15

15:                                               ; preds = %.thread
  %16 = getelementptr inbounds i8, ptr %7, i64 16
  %17 = load ptr, ptr %16, align 8, !tbaa !16
  %18 = getelementptr inbounds i8, ptr %0, i64 4192
  %19 = load ptr, ptr %18, align 8, !tbaa !17
  %20 = icmp eq ptr %17, %19
  br i1 %20, label %21, label %26

21:                                               ; preds = %8, %15
  %22 = phi ptr [ %12, %15 ], [ %2, %8 ]
  %23 = phi ptr [ %14, %15 ], [ %10, %8 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #2
  store ptr %22, ptr %4, align 8, !tbaa !13
  %24 = call i32 %23(ptr noundef nonnull %0, ptr noundef %1, ptr noundef nonnull %4) #2
  %.not19 = icmp eq i32 %24, 0
  %25 = load ptr, ptr %4, align 8
  %spec.select = select i1 %.not19, ptr %22, ptr %25
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #2
  br label %26

26:                                               ; preds = %.thread, %21, %15, %8
  %.1 = phi ptr [ %spec.select, %21 ], [ %12, %15 ], [ %2, %8 ], [ %12, %.thread ]
  ret ptr %.1
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !7, i64 4184}
!6 = !{!"_lil_t", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 24, !11, i64 32, !7, i64 40, !10, i64 48, !10, i64 56, !12, i64 64, !7, i64 4160, !11, i64 4168, !7, i64 4176, !7, i64 4184, !7, i64 4192, !7, i64 4200, !7, i64 4208, !11, i64 4216, !10, i64 4224, !7, i64 4232, !8, i64 4240, !10, i64 4304, !7, i64 4312, !7, i64 4320, !10, i64 4328}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"long", !8, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!"_hashmap_t", !8, i64 0}
!13 = !{!7, !7, i64 0}
!14 = !{!15, !7, i64 24}
!15 = !{!"_lil_var_t", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24}
!16 = !{!15, !7, i64 16}
!17 = !{!6, !7, i64 4192}


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