; 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.insn = type { ptr, ptr, i32, i32, ptr, ptr, ptr, i32, i8, ptr, ptr, [64 x i8] }
%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 }

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @mark_const(ptr noundef %0) #0 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds %struct.insn, ptr %4, i32 0, i32 3
  %6 = load i32, ptr %5, align 4, !tbaa !9
  %7 = icmp eq i32 %6, 10
  br i1 %7, label %8, label %13

8:                                                ; preds = %1
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.insn, ptr %9, i32 0, i32 4
  %11 = load ptr, ptr %10, align 8, !tbaa !13
  %12 = getelementptr inbounds %struct.var, ptr %11, i32 0, i32 22
  store i8 1, ptr %12, align 2, !tbaa !14
  store i1 false, ptr %2, align 1
  br label %78

13:                                               ; preds = %1
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.insn, ptr %14, i32 0, i32 3
  %16 = load i32, ptr %15, align 4, !tbaa !9
  %17 = icmp ne i32 %16, 9
  br i1 %17, label %18, label %19

18:                                               ; preds = %13
  store i1 false, ptr %2, align 1
  br label %78

19:                                               ; preds = %13
  %20 = load ptr, ptr %3, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.insn, ptr %20, i32 0, i32 4
  %22 = load ptr, ptr %21, align 8, !tbaa !13
  %23 = getelementptr inbounds %struct.var, ptr %22, i32 0, i32 4
  %24 = load i8, ptr %23, align 1, !tbaa !18, !range !19, !noundef !20
  %25 = trunc i8 %24 to i1
  br i1 %25, label %26, label %27

26:                                               ; preds = %19
  store i1 false, ptr %2, align 1
  br label %78

27:                                               ; preds = %19
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.insn, ptr %28, i32 0, i32 5
  %30 = load ptr, ptr %29, align 8, !tbaa !21
  %31 = getelementptr inbounds %struct.var, ptr %30, i32 0, i32 22
  %32 = load i8, ptr %31, align 2, !tbaa !14, !range !19, !noundef !20
  %33 = trunc i8 %32 to i1
  br i1 %33, label %60, label %34

34:                                               ; preds = %27
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.insn, ptr %35, i32 0, i32 1
  %37 = load ptr, ptr %36, align 8, !tbaa !22
  %38 = icmp ne ptr %37, null
  br i1 %38, label %40, label %39

39:                                               ; preds = %34
  store i1 false, ptr %2, align 1
  br label %78

40:                                               ; preds = %34
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.insn, ptr %41, i32 0, i32 1
  %43 = load ptr, ptr %42, align 8, !tbaa !22
  %44 = getelementptr inbounds %struct.insn, ptr %43, i32 0, i32 3
  %45 = load i32, ptr %44, align 4, !tbaa !9
  %46 = icmp ne i32 %45, 10
  br i1 %46, label %47, label %48

47:                                               ; preds = %40
  store i1 false, ptr %2, align 1
  br label %78

48:                                               ; preds = %40
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.insn, ptr %49, i32 0, i32 5
  %51 = load ptr, ptr %50, align 8, !tbaa !21
  %52 = load ptr, ptr %3, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.insn, ptr %52, i32 0, i32 1
  %54 = load ptr, ptr %53, align 8, !tbaa !22
  %55 = getelementptr inbounds %struct.insn, ptr %54, i32 0, i32 4
  %56 = load ptr, ptr %55, align 8, !tbaa !13
  %57 = icmp ne ptr %51, %56
  br i1 %57, label %58, label %59

58:                                               ; preds = %48
  store i1 false, ptr %2, align 1
  br label %78

59:                                               ; preds = %48
  br label %60

60:                                               ; preds = %59, %27
  %61 = load ptr, ptr %3, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.insn, ptr %61, i32 0, i32 3
  store i32 10, ptr %62, align 4, !tbaa !9
  %63 = load ptr, ptr %3, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.insn, ptr %63, i32 0, i32 4
  %65 = load ptr, ptr %64, align 8, !tbaa !13
  %66 = getelementptr inbounds %struct.var, ptr %65, i32 0, i32 22
  store i8 1, ptr %66, align 2, !tbaa !14
  %67 = load ptr, ptr %3, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.insn, ptr %67, i32 0, i32 5
  %69 = load ptr, ptr %68, align 8, !tbaa !21
  %70 = getelementptr inbounds %struct.var, ptr %69, i32 0, i32 7
  %71 = load i32, ptr %70, align 8, !tbaa !23
  %72 = load ptr, ptr %3, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.insn, ptr %72, i32 0, i32 4
  %74 = load ptr, ptr %73, align 8, !tbaa !13
  %75 = getelementptr inbounds %struct.var, ptr %74, i32 0, i32 7
  store i32 %71, ptr %75, align 8, !tbaa !23
  %76 = load ptr, ptr %3, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.insn, ptr %76, i32 0, i32 5
  store ptr null, ptr %77, align 8, !tbaa !21
  store i1 true, ptr %2, align 1
  br label %78

78:                                               ; preds = %60, %58, %47, %39, %26, %18, %8
  %79 = load i1, ptr %2, align 1
  ret i1 %79
}

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, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 20}
!10 = !{!"insn", !6, i64 0, !6, i64 8, !11, i64 16, !11, i64 20, !6, i64 24, !6, i64 32, !6, i64 40, !11, i64 48, !12, i64 52, !6, i64 56, !6, i64 64, !7, i64 72}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{!10, !6, i64 24}
!14 = !{!15, !12, i64 942}
!15 = !{!"var", !7, i64 0, !7, i64 32, !11, i64 64, !12, i64 68, !12, i64 69, !11, i64 72, !11, i64 76, !11, i64 80, !11, i64 84, !11, i64 88, !6, i64 96, !11, i64 104, !7, i64 112, !11, i64 624, !16, i64 628, !17, i64 896, !6, i64 912, !6, i64 920, !6, i64 928, !11, i64 936, !12, i64 940, !12, i64 941, !12, i64 942}
!16 = !{!"", !11, i64 0, !7, i64 4, !11, i64 260}
!17 = !{!"ref_block_list", !6, i64 0, !6, i64 8}
!18 = !{!15, !12, i64 69}
!19 = !{i8 0, i8 2}
!20 = !{}
!21 = !{!10, !6, i64 32}
!22 = !{!10, !6, i64 8}
!23 = !{!15, !11, i64 80}


; 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 nofree norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) uwtable
define dso_local noundef zeroext i1 @mark_const(ptr nocapture noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 20
  %3 = load i32, ptr %2, align 4, !tbaa !5
  switch i32 %3, label %34 [
    i32 10, label %4
    i32 9, label %8
  ]

4:                                                ; preds = %1
  %5 = getelementptr inbounds i8, ptr %0, i64 24
  %6 = load ptr, ptr %5, align 8, !tbaa !12
  %7 = getelementptr inbounds i8, ptr %6, i64 942
  store i8 1, ptr %7, align 2, !tbaa !13
  br label %34

8:                                                ; preds = %1
  %9 = getelementptr inbounds i8, ptr %0, i64 24
  %10 = load ptr, ptr %9, align 8, !tbaa !12
  %11 = getelementptr inbounds i8, ptr %10, i64 69
  %12 = load i8, ptr %11, align 1, !tbaa !17, !range !18, !noundef !19
  %13 = trunc nuw i8 %12 to i1
  br i1 %13, label %34, label %14

14:                                               ; preds = %8
  %15 = getelementptr inbounds i8, ptr %0, i64 32
  %16 = load ptr, ptr %15, align 8, !tbaa !20
  %17 = getelementptr inbounds i8, ptr %16, i64 942
  %18 = load i8, ptr %17, align 2, !tbaa !13, !range !18, !noundef !19
  %19 = trunc nuw i8 %18 to i1
  br i1 %19, label %29, label %20

20:                                               ; preds = %14
  %21 = getelementptr inbounds i8, ptr %0, i64 8
  %22 = load ptr, ptr %21, align 8, !tbaa !21
  %.not17 = icmp eq ptr %22, null
  br i1 %.not17, label %34, label %23

23:                                               ; preds = %20
  %24 = getelementptr inbounds i8, ptr %22, i64 20
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %.not18 = icmp eq i32 %25, 10
  br i1 %.not18, label %26, label %34

26:                                               ; preds = %23
  %27 = getelementptr inbounds i8, ptr %22, i64 24
  %28 = load ptr, ptr %27, align 8, !tbaa !12
  %.not19 = icmp eq ptr %16, %28
  br i1 %.not19, label %29, label %34

29:                                               ; preds = %26, %14
  store i32 10, ptr %2, align 4, !tbaa !5
  %30 = getelementptr inbounds i8, ptr %10, i64 942
  store i8 1, ptr %30, align 2, !tbaa !13
  %31 = getelementptr inbounds i8, ptr %16, i64 80
  %32 = load i32, ptr %31, align 8, !tbaa !22
  %33 = getelementptr inbounds i8, ptr %10, i64 80
  store i32 %32, ptr %33, align 8, !tbaa !22
  store ptr null, ptr %15, align 8, !tbaa !20
  br label %34

34:                                               ; preds = %26, %23, %20, %8, %1, %29, %4
  %.0 = phi i1 [ false, %4 ], [ true, %29 ], [ false, %1 ], [ false, %8 ], [ false, %20 ], [ false, %23 ], [ false, %26 ]
  ret i1 %.0
}

attributes #0 = { mustprogress nofree norecurse nosync nounwind willreturn memory(readwrite, inaccessiblemem: none) 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, !10, i64 20}
!6 = !{!"insn", !7, i64 0, !7, i64 8, !10, i64 16, !10, i64 20, !7, i64 24, !7, i64 32, !7, i64 40, !10, i64 48, !11, i64 52, !7, i64 56, !7, i64 64, !8, i64 72}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"_Bool", !8, i64 0}
!12 = !{!6, !7, i64 24}
!13 = !{!14, !11, i64 942}
!14 = !{!"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, !7, i64 96, !10, i64 104, !8, i64 112, !10, i64 624, !15, i64 628, !16, i64 896, !7, i64 912, !7, i64 920, !7, i64 928, !10, i64 936, !11, i64 940, !11, i64 941, !11, i64 942}
!15 = !{!"", !10, i64 0, !8, i64 4, !10, i64 260}
!16 = !{!"ref_block_list", !7, i64 0, !7, i64 8}
!17 = !{!14, !11, i64 69}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = !{!6, !7, i64 32}
!21 = !{!6, !7, i64 8}
!22 = !{!14, !10, i64 80}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass