; 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 void @config_print(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.Config, ptr %6, i32 0, i32 39
  %8 = getelementptr inbounds %struct.List, ptr %7, i32 0, i32 0
  %9 = load ptr, ptr %8, align 8, !tbaa !9
  store ptr %9, ptr %3, align 8, !tbaa !5
  br label %10

10:                                               ; preds = %30, %1
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = load ptr, ptr %2, align 8, !tbaa !5
  %13 = getelementptr inbounds %struct.Config, ptr %12, i32 0, i32 39
  %14 = icmp ne ptr %11, %13
  br i1 %14, label %16, label %15

15:                                               ; preds = %10
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  br label %34

16:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds i8, ptr %17, i64 -32
  store ptr %18, ptr %5, align 8, !tbaa !5
  %19 = load ptr, ptr %5, align 8, !tbaa !5
  %20 = call zeroext i1 @var_is(ptr noundef %19, i32 noundef 4)
  br i1 %20, label %24, label %21

21:                                               ; preds = %16
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = call zeroext i1 @var_is(ptr noundef %22, i32 noundef 8)
  br i1 %23, label %24, label %25

24:                                               ; preds = %21, %16
  store i32 4, ptr %4, align 4
  br label %27

25:                                               ; preds = %21
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  call void @var_print(ptr noundef %26)
  store i32 0, ptr %4, align 4
  br label %27

27:                                               ; preds = %25, %24
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  %28 = load i32, ptr %4, align 4
  switch i32 %28, label %35 [
    i32 0, label %29
    i32 4, label %30
  ]

29:                                               ; preds = %27
  br label %30

30:                                               ; preds = %29, %27
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.List, ptr %31, i32 0, i32 0
  %33 = load ptr, ptr %32, align 8, !tbaa !16
  store ptr %33, ptr %3, align 8, !tbaa !5
  br label %10, !llvm.loop !17

34:                                               ; preds = %15
  ret void

35:                                               ; preds = %27
  unreachable
}

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @var_print(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 void @config_print(ptr noundef readonly %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 3432
  %.08 = load ptr, ptr %2, align 8, !tbaa !5
  %.not9 = icmp eq ptr %.08, %2
  br i1 %.not9, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %8, %1
  ret void

.lr.ph:                                           ; preds = %1, %8
  %.010 = phi ptr [ %.0, %8 ], [ %.08, %1 ]
  %3 = getelementptr inbounds i8, ptr %.010, i64 -32
  %4 = tail call zeroext i1 @var_is(ptr noundef nonnull %3, i32 noundef 4)
  br i1 %4, label %8, label %5

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

7:                                                ; preds = %5
  tail call void @var_print(ptr noundef nonnull %3)
  br label %8

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

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

; Function Attrs: inlinehint nounwind uwtable
declare hidden void @var_print(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: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass