; 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: inlinehint nounwind uwtable
declare hidden zeroext i1 @var_is(ptr noundef, i32 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @config_show(ptr noundef %0, ptr noundef %1) #2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.Config, ptr %9, i32 0, i32 42
  %11 = load i32, ptr %10, align 4, !tbaa !9
  call void @encode_map(ptr noundef %8, i32 noundef %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %12 = load ptr, ptr %3, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.Config, ptr %12, i32 0, i32 39
  %14 = getelementptr inbounds %struct.List, ptr %13, i32 0, i32 0
  %15 = load ptr, ptr %14, align 8, !tbaa !16
  store ptr %15, ptr %5, align 8, !tbaa !5
  br label %16

16:                                               ; preds = %40, %2
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.Config, ptr %18, i32 0, i32 39
  %20 = icmp ne ptr %17, %19
  br i1 %20, label %22, label %21

21:                                               ; preds = %16
  store i32 2, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  br label %44

22:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #5
  %23 = load ptr, ptr %5, align 8, !tbaa !5
  %24 = getelementptr inbounds i8, ptr %23, i64 -32
  store ptr %24, ptr %7, align 8, !tbaa !5
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  %26 = call zeroext i1 @var_is(ptr noundef %25, i32 noundef 4)
  br i1 %26, label %30, label %27

27:                                               ; preds = %22
  %28 = load ptr, ptr %7, align 8, !tbaa !5
  %29 = call zeroext i1 @var_is(ptr noundef %28, i32 noundef 8)
  br i1 %29, label %30, label %31

30:                                               ; preds = %27, %22
  store i32 4, ptr %6, align 4
  br label %37

31:                                               ; preds = %27
  %32 = load ptr, ptr %4, align 8, !tbaa !5
  %33 = load ptr, ptr %7, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.Var, ptr %33, i32 0, i32 2
  call void @encode_string(ptr noundef %32, ptr noundef %34) #4
  %35 = load ptr, ptr %7, align 8, !tbaa !5
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  call void @var_encode(ptr noundef %35, ptr noundef %36)
  store i32 0, ptr %6, align 4
  br label %37

37:                                               ; preds = %31, %30
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #5
  %38 = load i32, ptr %6, align 4
  switch i32 %38, label %45 [
    i32 0, label %39
    i32 4, label %40
  ]

39:                                               ; preds = %37
  br label %40

40:                                               ; preds = %39, %37
  %41 = load ptr, ptr %5, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.List, ptr %41, i32 0, i32 0
  %43 = load ptr, ptr %42, align 8, !tbaa !17
  store ptr %43, ptr %5, align 8, !tbaa !5
  br label %16, !llvm.loop !18

44:                                               ; preds = %21
  ret void

45:                                               ; preds = %37
  unreachable
}

; Function Attrs: alwaysinline hot nounwind uwtable
declare hidden void @encode_map(ptr noundef, i32 noundef) #3

; Function Attrs: alwaysinline hot nounwind uwtable
declare hidden void @encode_string(ptr noundef, ptr noundef) #3

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

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 = { 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 = { alwaysinline hot 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 #4 = { hot }
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, !12, i64 3468}
!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 = !{!10, !6, i64 3432}
!17 = !{!15, !6, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"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: inlinehint nounwind uwtable
declare hidden zeroext i1 @var_is(ptr noundef, i32 noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @config_show(ptr noundef readonly %0, ptr noundef %1) local_unnamed_addr #1 {
  %3 = getelementptr inbounds i8, ptr %0, i64 3468
  %4 = load i32, ptr %3, align 4, !tbaa !5
  tail call void @encode_map(ptr noundef %1, i32 noundef %4) #3
  %5 = getelementptr inbounds i8, ptr %0, i64 3432
  %.013 = load ptr, ptr %5, align 8, !tbaa !15
  %.not14 = icmp eq ptr %.013, %5
  br i1 %.not14, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %12, %2
  ret void

.lr.ph:                                           ; preds = %2, %12
  %.015 = phi ptr [ %.0, %12 ], [ %.013, %2 ]
  %6 = getelementptr inbounds i8, ptr %.015, i64 -32
  %7 = tail call zeroext i1 @var_is(ptr noundef nonnull %6, i32 noundef 4)
  br i1 %7, label %12, label %8

8:                                                ; preds = %.lr.ph
  %9 = tail call zeroext i1 @var_is(ptr noundef nonnull %6, i32 noundef 8)
  br i1 %9, label %12, label %10

10:                                               ; preds = %8
  %11 = getelementptr inbounds i8, ptr %.015, i64 -24
  tail call void @encode_string(ptr noundef %1, ptr noundef nonnull %11) #3
  tail call void @var_encode(ptr noundef nonnull %6, ptr noundef %1)
  br label %12

12:                                               ; preds = %.lr.ph, %8, %10
  %.0 = load ptr, ptr %.015, align 8, !tbaa !15
  %.not = icmp eq ptr %.0, %5
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !16
}

; Function Attrs: alwaysinline hot nounwind uwtable
declare hidden void @encode_map(ptr noundef, i32 noundef) local_unnamed_addr #2

; Function Attrs: alwaysinline hot nounwind uwtable
declare hidden void @encode_string(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @var_encode(ptr noundef, ptr noundef) local_unnamed_addr #0

attributes #0 = { 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 #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 = { alwaysinline hot 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 = { hot }

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


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass