; 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: 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 zeroext i1 @eval_const_arithmetic(ptr noundef %0) #1 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %8 = load ptr, ptr %3, align 8, !tbaa !5
  %9 = getelementptr inbounds %struct.insn, ptr %8, i32 0, i32 5
  %10 = load ptr, ptr %9, align 8, !tbaa !9
  %11 = icmp ne ptr %10, null
  br i1 %11, label %13, label %12

12:                                               ; preds = %1
  store i1 false, ptr %2, align 1
  br label %87

13:                                               ; preds = %1
  %14 = load ptr, ptr %3, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.insn, ptr %14, i32 0, i32 5
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = getelementptr inbounds %struct.var, ptr %16, i32 0, i32 22
  %18 = load i8, ptr %17, align 2, !tbaa !13, !range !17, !noundef !18
  %19 = trunc i8 %18 to i1
  br i1 %19, label %21, label %20

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

21:                                               ; preds = %13
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.insn, ptr %22, i32 0, i32 6
  %24 = load ptr, ptr %23, align 8, !tbaa !19
  %25 = icmp ne ptr %24, null
  br i1 %25, label %27, label %26

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

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

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

35:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #2
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #2
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.insn, ptr %36, i32 0, i32 5
  %38 = load ptr, ptr %37, align 8, !tbaa !9
  %39 = getelementptr inbounds %struct.var, ptr %38, i32 0, i32 7
  %40 = load i32, ptr %39, align 8, !tbaa !20
  store i32 %40, ptr %5, align 4, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #2
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.insn, ptr %41, i32 0, i32 6
  %43 = load ptr, ptr %42, align 8, !tbaa !19
  %44 = getelementptr inbounds %struct.var, ptr %43, i32 0, i32 7
  %45 = load i32, ptr %44, align 8, !tbaa !20
  store i32 %45, ptr %6, align 4, !tbaa !21
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.insn, ptr %46, i32 0, i32 3
  %48 = load i32, ptr %47, align 4, !tbaa !22
  switch i32 %48, label %69 [
    i32 29, label %49
    i32 30, label %53
    i32 31, label %57
    i32 32, label %61
    i32 33, label %65
  ]

49:                                               ; preds = %35
  %50 = load i32, ptr %5, align 4, !tbaa !21
  %51 = load i32, ptr %6, align 4, !tbaa !21
  %52 = add nsw i32 %50, %51
  store i32 %52, ptr %4, align 4, !tbaa !21
  br label %70

53:                                               ; preds = %35
  %54 = load i32, ptr %5, align 4, !tbaa !21
  %55 = load i32, ptr %6, align 4, !tbaa !21
  %56 = sub nsw i32 %54, %55
  store i32 %56, ptr %4, align 4, !tbaa !21
  br label %70

57:                                               ; preds = %35
  %58 = load i32, ptr %5, align 4, !tbaa !21
  %59 = load i32, ptr %6, align 4, !tbaa !21
  %60 = mul nsw i32 %58, %59
  store i32 %60, ptr %4, align 4, !tbaa !21
  br label %70

61:                                               ; preds = %35
  %62 = load i32, ptr %5, align 4, !tbaa !21
  %63 = load i32, ptr %6, align 4, !tbaa !21
  %64 = sdiv i32 %62, %63
  store i32 %64, ptr %4, align 4, !tbaa !21
  br label %70

65:                                               ; preds = %35
  %66 = load i32, ptr %5, align 4, !tbaa !21
  %67 = load i32, ptr %6, align 4, !tbaa !21
  %68 = srem i32 %66, %67
  store i32 %68, ptr %4, align 4, !tbaa !21
  br label %70

69:                                               ; preds = %35
  store i1 false, ptr %2, align 1
  store i32 1, ptr %7, align 4
  br label %86

70:                                               ; preds = %65, %61, %57, %53, %49
  %71 = load ptr, ptr %3, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.insn, ptr %71, i32 0, i32 5
  store ptr null, ptr %72, align 8, !tbaa !9
  %73 = load ptr, ptr %3, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct.insn, ptr %73, i32 0, i32 6
  store ptr null, ptr %74, align 8, !tbaa !19
  %75 = load ptr, ptr %3, align 8, !tbaa !5
  %76 = getelementptr inbounds %struct.insn, ptr %75, i32 0, i32 4
  %77 = load ptr, ptr %76, align 8, !tbaa !23
  %78 = getelementptr inbounds %struct.var, ptr %77, i32 0, i32 22
  store i8 1, ptr %78, align 2, !tbaa !13
  %79 = load i32, ptr %4, align 4, !tbaa !21
  %80 = load ptr, ptr %3, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.insn, ptr %80, i32 0, i32 4
  %82 = load ptr, ptr %81, align 8, !tbaa !23
  %83 = getelementptr inbounds %struct.var, ptr %82, i32 0, i32 7
  store i32 %79, ptr %83, align 8, !tbaa !20
  %84 = load ptr, ptr %3, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.insn, ptr %84, i32 0, i32 3
  store i32 10, ptr %85, align 4, !tbaa !22
  store i1 true, ptr %2, align 1
  store i32 1, ptr %7, align 4
  br label %86

86:                                               ; preds = %70, %69
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #2
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #2
  br label %87

87:                                               ; preds = %86, %34, %26, %20, %12
  %88 = load i1, ptr %2, align 1
  ret i1 %88
}

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 32}
!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 = !{!14, !12, i64 942}
!14 = !{!"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, !15, i64 628, !16, i64 896, !6, i64 912, !6, i64 920, !6, i64 928, !11, i64 936, !12, i64 940, !12, i64 941, !12, i64 942}
!15 = !{!"", !11, i64 0, !7, i64 4, !11, i64 260}
!16 = !{!"ref_block_list", !6, i64 0, !6, i64 8}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!10, !6, i64 40}
!20 = !{!14, !11, i64 80}
!21 = !{!11, !11, i64 0}
!22 = !{!10, !11, i64 20}
!23 = !{!10, !6, i64 24}


; 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 @eval_const_arithmetic(ptr nocapture noundef %0) local_unnamed_addr #0 {
  %2 = getelementptr inbounds i8, ptr %0, i64 32
  %3 = load ptr, ptr %2, align 8, !tbaa !5
  %.not = icmp eq ptr %3, null
  br i1 %.not, label %37, label %4

4:                                                ; preds = %1
  %5 = getelementptr inbounds i8, ptr %3, i64 942
  %6 = load i8, ptr %5, align 2, !tbaa !12, !range !16, !noundef !17
  %7 = trunc nuw i8 %6 to i1
  br i1 %7, label %8, label %37

8:                                                ; preds = %4
  %9 = getelementptr inbounds i8, ptr %0, i64 40
  %10 = load ptr, ptr %9, align 8, !tbaa !18
  %.not26 = icmp eq ptr %10, null
  br i1 %.not26, label %37, label %11

11:                                               ; preds = %8
  %12 = getelementptr inbounds i8, ptr %10, i64 942
  %13 = load i8, ptr %12, align 2, !tbaa !12, !range !16, !noundef !17
  %14 = trunc nuw i8 %13 to i1
  br i1 %14, label %15, label %37

15:                                               ; preds = %11
  %16 = getelementptr inbounds i8, ptr %3, i64 80
  %17 = load i32, ptr %16, align 8, !tbaa !19
  %18 = getelementptr inbounds i8, ptr %10, i64 80
  %19 = load i32, ptr %18, align 8, !tbaa !19
  %20 = getelementptr inbounds i8, ptr %0, i64 20
  %21 = load i32, ptr %20, align 4, !tbaa !20
  switch i32 %21, label %37 [
    i32 29, label %22
    i32 30, label %24
    i32 31, label %26
    i32 32, label %28
    i32 33, label %30
  ]

22:                                               ; preds = %15
  %23 = add nsw i32 %19, %17
  br label %32

24:                                               ; preds = %15
  %25 = sub nsw i32 %17, %19
  br label %32

26:                                               ; preds = %15
  %27 = mul nsw i32 %19, %17
  br label %32

28:                                               ; preds = %15
  %29 = sdiv i32 %17, %19
  br label %32

30:                                               ; preds = %15
  %31 = srem i32 %17, %19
  br label %32

32:                                               ; preds = %30, %28, %26, %24, %22
  %.023 = phi i32 [ %31, %30 ], [ %29, %28 ], [ %27, %26 ], [ %25, %24 ], [ %23, %22 ]
  %33 = getelementptr inbounds i8, ptr %0, i64 24
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %2, i8 0, i64 16, i1 false)
  %34 = load ptr, ptr %33, align 8, !tbaa !21
  %35 = getelementptr inbounds i8, ptr %34, i64 942
  store i8 1, ptr %35, align 2, !tbaa !12
  %36 = getelementptr inbounds i8, ptr %34, i64 80
  store i32 %.023, ptr %36, align 8, !tbaa !19
  store i32 10, ptr %20, align 4, !tbaa !20
  br label %37

37:                                               ; preds = %32, %15, %11, %8, %4, %1
  %.1 = phi i1 [ false, %1 ], [ false, %4 ], [ false, %8 ], [ false, %11 ], [ true, %32 ], [ false, %15 ]
  ret i1 %.1
}

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #1

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" }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: write) }

!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 32}
!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 = !{!13, !11, i64 942}
!13 = !{!"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, !14, i64 628, !15, i64 896, !7, i64 912, !7, i64 920, !7, i64 928, !10, i64 936, !11, i64 940, !11, i64 941, !11, i64 942}
!14 = !{!"", !10, i64 0, !8, i64 4, !10, i64 260}
!15 = !{!"ref_block_list", !7, i64 0, !7, i64 8}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = !{!6, !7, i64 40}
!19 = !{!13, !10, i64 80}
!20 = !{!6, !10, i64 20}
!21 = !{!6, !7, i64 24}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,PostOrderFunctionAttrsPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass