; LLVM IR from sysprog21/shecc :: src (ssa)

; 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.func = type { %struct.var, [8 x %struct.var], i32, i32, i32, ptr, ptr, %struct.symbol_list_t, i32, i32, ptr }
%struct.var = type { [32 x i8], [32 x i8], i32, i8, i8, i32, i32, i32, i32, i32, ptr, i32, [64 x ptr], i32, %struct.rename_t, %struct.ref_block_list, ptr, ptr, ptr, i32, i8, i8, i8 }
%struct.rename_t = type { i32, [64 x i32], i32 }
%struct.ref_block_list = type { ptr, ptr }
%struct.symbol_list_t = type { ptr, ptr }
%struct.basic_block = type { %struct.insn_list_t, %struct.ph2_ir_list_t, [128 x %struct.bb_connection_t], ptr, ptr, ptr, ptr, ptr, ptr, ptr, [800 x ptr], i32, [800 x ptr], i32, [800 x ptr], i32, [800 x ptr], i32, i32, i32, [64 x ptr], [64 x ptr], i32, i32, i32, i8, [64 x ptr], ptr, [256 x ptr], ptr, ptr, ptr, %struct.symbol_list_t, i32 }
%struct.insn_list_t = type { ptr, ptr }
%struct.ph2_ir_list_t = type { ptr, ptr }
%struct.bb_connection_t = type { ptr, i32 }

; 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 dso_local zeroext i1 @dom_connect(ptr noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @bb_build_dom(ptr noundef %0, ptr noundef %1) #1 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #2
  %6 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %6, ptr %5, align 8, !tbaa !5
  br label %7

7:                                                ; preds = %20, %2
  %8 = load ptr, ptr %5, align 8, !tbaa !5
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.func, ptr %9, i32 0, i32 5
  %11 = load ptr, ptr %10, align 8, !tbaa !9
  %12 = icmp ne ptr %8, %11
  br i1 %12, label %13, label %24

13:                                               ; preds = %7
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.basic_block, ptr %14, i32 0, i32 6
  %16 = load ptr, ptr %15, align 8, !tbaa !17
  %17 = load ptr, ptr %5, align 8, !tbaa !5
  %18 = call zeroext i1 @dom_connect(ptr noundef %16, ptr noundef %17)
  br i1 %18, label %20, label %19

19:                                               ; preds = %13
  br label %24

20:                                               ; preds = %13
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.basic_block, ptr %21, i32 0, i32 6
  %23 = load ptr, ptr %22, align 8, !tbaa !17
  store ptr %23, ptr %5, align 8, !tbaa !5
  br label %7, !llvm.loop !19

24:                                               ; preds = %19, %7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #2
  ret void
}

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 8512}
!10 = !{!"func", !11, i64 0, !7, i64 944, !12, i64 8496, !12, i64 8500, !12, i64 8504, !6, i64 8512, !6, i64 8520, !16, i64 8528, !12, i64 8544, !12, i64 8548, !6, i64 8552}
!11 = !{!"var", !7, i64 0, !7, i64 32, !12, i64 64, !13, i64 68, !13, i64 69, !12, i64 72, !12, i64 76, !12, i64 80, !12, i64 84, !12, i64 88, !6, i64 96, !12, i64 104, !7, i64 112, !12, i64 624, !14, i64 628, !15, i64 896, !6, i64 912, !6, i64 920, !6, i64 928, !12, i64 936, !13, i64 940, !13, i64 941, !13, i64 942}
!12 = !{!"int", !7, i64 0}
!13 = !{!"_Bool", !7, i64 0}
!14 = !{!"", !12, i64 0, !7, i64 4, !12, i64 260}
!15 = !{!"ref_block_list", !6, i64 0, !6, i64 8}
!16 = !{!"", !6, i64 0, !6, i64 8}
!17 = !{!18, !6, i64 2104}
!18 = !{!"basic_block", !16, i64 0, !16, i64 16, !7, i64 32, !6, i64 2080, !6, i64 2088, !6, i64 2096, !6, i64 2104, !6, i64 2112, !6, i64 2120, !6, i64 2128, !7, i64 2136, !12, i64 8536, !7, i64 8544, !12, i64 14944, !7, i64 14952, !12, i64 21352, !7, i64 21360, !12, i64 27760, !12, i64 27764, !12, i64 27768, !7, i64 27776, !7, i64 28288, !12, i64 28800, !12, i64 28804, !12, i64 28808, !13, i64 28812, !7, i64 28816, !6, i64 29328, !7, i64 29336, !6, i64 31384, !6, i64 31392, !6, i64 31400, !16, i64 31408, !12, i64 31424}
!19 = distinct !{!19, !20}
!20 = !{!"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
declare dso_local zeroext i1 @dom_connect(ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @bb_build_dom(ptr nocapture noundef readonly %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = getelementptr inbounds i8, ptr %0, i64 8512
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %.not6 = icmp eq ptr %4, %1
  br i1 %.not6, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %2, %8
  %.07 = phi ptr [ %9, %8 ], [ %1, %2 ]
  %5 = getelementptr inbounds i8, ptr %.07, i64 2104
  %6 = load ptr, ptr %5, align 8, !tbaa !16
  %7 = tail call zeroext i1 @dom_connect(ptr noundef %6, ptr noundef %.07)
  br i1 %7, label %8, label %._crit_edge

8:                                                ; preds = %.lr.ph
  %9 = load ptr, ptr %5, align 8, !tbaa !16
  %10 = load ptr, ptr %3, align 8, !tbaa !5
  %.not = icmp eq ptr %9, %10
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !18

._crit_edge:                                      ; preds = %8, %.lr.ph, %2
  ret void
}

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

!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, !12, i64 8512}
!6 = !{!"func", !7, i64 0, !8, i64 944, !10, i64 8496, !10, i64 8500, !10, i64 8504, !12, i64 8512, !12, i64 8520, !15, i64 8528, !10, i64 8544, !10, i64 8548, !12, i64 8552}
!7 = !{!"var", !8, i64 0, !8, i64 32, !10, i64 64, !11, i64 68, !11, i64 69, !10, i64 72, !10, i64 76, !10, i64 80, !10, i64 84, !10, i64 88, !12, i64 96, !10, i64 104, !8, i64 112, !10, i64 624, !13, i64 628, !14, i64 896, !12, i64 912, !12, i64 920, !12, i64 928, !10, i64 936, !11, i64 940, !11, i64 941, !11, i64 942}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"_Bool", !8, i64 0}
!12 = !{!"any pointer", !8, i64 0}
!13 = !{!"", !10, i64 0, !8, i64 4, !10, i64 260}
!14 = !{!"ref_block_list", !12, i64 0, !12, i64 8}
!15 = !{!"", !12, i64 0, !12, i64 8}
!16 = !{!17, !12, i64 2104}
!17 = !{!"basic_block", !15, i64 0, !15, i64 16, !8, i64 32, !12, i64 2080, !12, i64 2088, !12, i64 2096, !12, i64 2104, !12, i64 2112, !12, i64 2120, !12, i64 2128, !8, i64 2136, !10, i64 8536, !8, i64 8544, !10, i64 14944, !8, i64 14952, !10, i64 21352, !8, i64 21360, !10, i64 27760, !10, i64 27764, !10, i64 27768, !8, i64 27776, !8, i64 28288, !10, i64 28800, !10, i64 28804, !10, i64 28808, !11, i64 28812, !8, i64 28816, !12, i64 29328, !8, i64 29336, !12, i64 31384, !12, i64 31392, !12, i64 31400, !15, i64 31408, !10, i64 31424}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}


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