; LLVM IR from pmwkaa/monotone :: monotone/runtime/config (config)

; 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.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 }
%struct.Str = type { ptr, ptr, i8 }
%union.anon = type { %struct.Str }
%struct.List = type { 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
define dso_local ptr @config_find(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  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 8, ptr %6) #3
  %9 = load ptr, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.Config, ptr %9, i32 0, i32 39
  %11 = getelementptr inbounds %struct.List, ptr %10, i32 0, i32 0
  %12 = load ptr, ptr %11, align 8, !tbaa !9
  store ptr %12, ptr %6, align 8, !tbaa !5
  br label %13

13:                                               ; preds = %32, %2
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.Config, ptr %15, i32 0, i32 39
  %17 = icmp ne ptr %14, %16
  br i1 %17, label %19, label %18

18:                                               ; preds = %13
  store i32 2, ptr %7, align 4
  br label %36

19:                                               ; preds = %13
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = getelementptr inbounds i8, ptr %20, i64 -32
  store ptr %21, ptr %8, align 8, !tbaa !5
  %22 = load ptr, ptr %8, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.Var, ptr %22, i32 0, i32 2
  %24 = load ptr, ptr %5, align 8, !tbaa !5
  %25 = call zeroext i1 @str_compare(ptr noundef %23, ptr noundef %24)
  br i1 %25, label %26, label %28

26:                                               ; preds = %19
  %27 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %27, ptr %3, align 8
  store i32 1, ptr %7, align 4
  br label %29

28:                                               ; preds = %19
  store i32 0, ptr %7, align 4
  br label %29

29:                                               ; preds = %28, %26
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  %30 = load i32, ptr %7, align 4
  switch i32 %30, label %36 [
    i32 0, label %31
  ]

31:                                               ; preds = %29
  br label %32

32:                                               ; preds = %31
  %33 = load ptr, ptr %6, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.List, ptr %33, i32 0, i32 0
  %35 = load ptr, ptr %34, align 8, !tbaa !16
  store ptr %35, ptr %6, align 8, !tbaa !5
  br label %13, !llvm.loop !17

36:                                               ; preds = %29, %18
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %37 = load i32, ptr %7, align 4
  switch i32 %37, label %41 [
    i32 2, label %38
    i32 1, label %39
  ]

38:                                               ; preds = %36
  store ptr null, ptr %3, align 8
  br label %39

39:                                               ; preds = %38, %36
  %40 = load ptr, ptr %3, align 8
  ret ptr %40

41:                                               ; preds = %36
  unreachable
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @str_compare(ptr noundef, ptr noundef) #2

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 = { 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 #3 = { 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 3432}
!10 = !{!"Config", !11, i64 0, !11, i64 88, !11, i64 176, !11, i64 264, !11, i64 352, !11, i64 440, !11, i64 528, !11, i64 616, !11, i64 704, !11, i64 792, !11, i64 880, !11, i64 968, !11, i64 1056, !11, i64 1144, !11, i64 1232, !11, i64 1320, !11, i64 1408, !11, i64 1496, !11, i64 1584, !11, i64 1672, !11, i64 1760, !11, i64 1848, !11, i64 1936, !11, i64 2024, !11, i64 2112, !11, i64 2200, !11, i64 2288, !11, i64 2376, !11, i64 2464, !11, i64 2552, !11, i64 2640, !11, i64 2728, !11, i64 2816, !11, i64 2904, !11, i64 2992, !11, i64 3080, !11, i64 3168, !11, i64 3256, !11, i64 3344, !15, i64 3432, !15, i64 3448, !12, i64 3464, !12, i64 3468, !12, i64 3472, !12, i64 3476}
!11 = !{!"Var", !12, i64 0, !12, i64 4, !13, i64 8, !15, i64 32, !15, i64 48, !7, i64 64}
!12 = !{!"int", !7, i64 0}
!13 = !{!"Str", !6, i64 0, !6, i64 8, !14, i64 16}
!14 = !{!"_Bool", !7, i64 0}
!15 = !{!"List", !6, i64 0, !6, i64 8}
!16 = !{!15, !6, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}


; 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: nounwind uwtable
define dso_local ptr @config_find(ptr noundef readonly %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 3432
  br label %4

4:                                                ; preds = %5, %2
  %.012.in = phi ptr [ %3, %2 ], [ %.012, %5 ]
  %.012 = load ptr, ptr %.012.in, align 8, !tbaa !5
  %.not = icmp eq ptr %.012, %3
  br i1 %.not, label %.split.loop.exit, label %5

5:                                                ; preds = %4
  %6 = getelementptr inbounds i8, ptr %.012, i64 -24
  %7 = tail call zeroext i1 @str_compare(ptr noundef nonnull %6, ptr noundef %1)
  br i1 %7, label %.split.loop.exit13, label %4, !llvm.loop !10

.split.loop.exit13:                               ; preds = %5
  %8 = getelementptr inbounds i8, ptr %.012, i64 -32
  br label %.split.loop.exit

.split.loop.exit:                                 ; preds = %4, %.split.loop.exit13
  %spec.select = phi ptr [ %8, %.split.loop.exit13 ], [ null, %4 ]
  ret ptr %spec.select
}

; Function Attrs: inlinehint nounwind uwtable
declare hidden zeroext i1 @str_compare(ptr noundef, ptr noundef) local_unnamed_addr #1

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

!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 0}
!6 = !{!"List", !7, i64 0, !7, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass