; LLVM IR from marcobambini/gravity :: src/compiler (gravity_semacheck1)

; 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.gvisitor = type { i32, ptr, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @gravity_semacheck1(ptr noundef %0, ptr noundef %1) #0 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %struct.gvisitor, 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) #3
  %7 = call ptr @symboltable_create(i32 noundef 0)
  store ptr %7, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 208, ptr %6) #3
  %8 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 0
  store i32 0, ptr %8, align 8, !tbaa !9
  %9 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 1
  %10 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %10, ptr %9, align 8, !tbaa !13
  %11 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 2
  store i8 0, ptr %11, align 8, !tbaa !14
  %12 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 3
  %13 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %13, ptr %12, align 8, !tbaa !15
  %14 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 4
  store ptr null, ptr %14, align 8, !tbaa !16
  %15 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 5
  store ptr null, ptr %15, align 8, !tbaa !17
  %16 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 6
  store ptr @visit_list_stmt, ptr %16, align 8, !tbaa !18
  %17 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 7
  store ptr null, ptr %17, align 8, !tbaa !19
  %18 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 8
  store ptr null, ptr %18, align 8, !tbaa !20
  %19 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 9
  store ptr null, ptr %19, align 8, !tbaa !21
  %20 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 10
  store ptr null, ptr %20, align 8, !tbaa !22
  %21 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 11
  store ptr null, ptr %21, align 8, !tbaa !23
  %22 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 12
  store ptr null, ptr %22, align 8, !tbaa !24
  %23 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 13
  store ptr @visit_function_decl, ptr %23, align 8, !tbaa !25
  %24 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 14
  store ptr @visit_variable_decl, ptr %24, align 8, !tbaa !26
  %25 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 15
  store ptr @visit_enum_decl, ptr %25, align 8, !tbaa !27
  %26 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 16
  store ptr @visit_class_decl, ptr %26, align 8, !tbaa !28
  %27 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 17
  store ptr @visit_module_decl, ptr %27, align 8, !tbaa !29
  %28 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 18
  store ptr null, ptr %28, align 8, !tbaa !30
  %29 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 19
  store ptr null, ptr %29, align 8, !tbaa !31
  %30 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 20
  store ptr null, ptr %30, align 8, !tbaa !32
  %31 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 21
  store ptr null, ptr %31, align 8, !tbaa !33
  %32 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 22
  store ptr null, ptr %32, align 8, !tbaa !34
  %33 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 23
  store ptr null, ptr %33, align 8, !tbaa !35
  %34 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 24
  store ptr null, ptr %34, align 8, !tbaa !36
  %35 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 25
  store ptr null, ptr %35, align 8, !tbaa !37
  %36 = load ptr, ptr %3, align 8, !tbaa !5
  call void @gvisit(ptr noundef %6, ptr noundef %36)
  %37 = getelementptr inbounds %struct.gvisitor, ptr %6, i32 0, i32 0
  %38 = load i32, ptr %37, align 8, !tbaa !9
  %39 = icmp eq i32 %38, 0
  call void @llvm.lifetime.end.p0(i64 208, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret i1 %39
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

declare ptr @symboltable_create(i32 noundef) #2

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

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

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

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

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

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

declare void @gvisit(ptr noundef, ptr noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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, !11, i64 0}
!10 = !{!"gvisitor", !11, i64 0, !6, i64 8, !12, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !6, i64 80, !6, i64 88, !6, i64 96, !6, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !6, i64 160, !6, i64 168, !6, i64 176, !6, i64 184, !6, i64 192, !6, i64 200}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{!10, !6, i64 8}
!14 = !{!10, !12, i64 16}
!15 = !{!10, !6, i64 24}
!16 = !{!10, !6, i64 32}
!17 = !{!10, !6, i64 40}
!18 = !{!10, !6, i64 48}
!19 = !{!10, !6, i64 56}
!20 = !{!10, !6, i64 64}
!21 = !{!10, !6, i64 72}
!22 = !{!10, !6, i64 80}
!23 = !{!10, !6, i64 88}
!24 = !{!10, !6, i64 96}
!25 = !{!10, !6, i64 104}
!26 = !{!10, !6, i64 112}
!27 = !{!10, !6, i64 120}
!28 = !{!10, !6, i64 128}
!29 = !{!10, !6, i64 136}
!30 = !{!10, !6, i64 144}
!31 = !{!10, !6, i64 152}
!32 = !{!10, !6, i64 160}
!33 = !{!10, !6, i64 168}
!34 = !{!10, !6, i64 176}
!35 = !{!10, !6, i64 184}
!36 = !{!10, !6, i64 192}
!37 = !{!10, !6, i64 200}


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

%struct.gvisitor = type { i32, ptr, i8, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }

; Function Attrs: nounwind uwtable
define dso_local zeroext i1 @gravity_semacheck1(ptr noundef %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca %struct.gvisitor, align 8
  %4 = tail call ptr @symboltable_create(i32 noundef 0) #4
  call void @llvm.lifetime.start.p0(i64 208, ptr nonnull %3) #4
  store i32 0, ptr %3, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %3, i64 8
  store ptr %4, ptr %5, align 8, !tbaa !12
  %6 = getelementptr inbounds i8, ptr %3, i64 16
  store i8 0, ptr %6, align 8, !tbaa !13
  %7 = getelementptr inbounds i8, ptr %3, i64 24
  store ptr %1, ptr %7, align 8, !tbaa !14
  %8 = getelementptr inbounds i8, ptr %3, i64 32
  %9 = getelementptr inbounds i8, ptr %3, i64 48
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %8, i8 0, i64 16, i1 false)
  store ptr @visit_list_stmt, ptr %9, align 8, !tbaa !15
  %10 = getelementptr inbounds i8, ptr %3, i64 56
  %11 = getelementptr inbounds i8, ptr %3, i64 104
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(48) %10, i8 0, i64 48, i1 false)
  store ptr @visit_function_decl, ptr %11, align 8, !tbaa !16
  %12 = getelementptr inbounds i8, ptr %3, i64 112
  store ptr @visit_variable_decl, ptr %12, align 8, !tbaa !17
  %13 = getelementptr inbounds i8, ptr %3, i64 120
  store ptr @visit_enum_decl, ptr %13, align 8, !tbaa !18
  %14 = getelementptr inbounds i8, ptr %3, i64 128
  store ptr @visit_class_decl, ptr %14, align 8, !tbaa !19
  %15 = getelementptr inbounds i8, ptr %3, i64 136
  store ptr @visit_module_decl, ptr %15, align 8, !tbaa !20
  %16 = getelementptr inbounds i8, ptr %3, i64 144
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(64) %16, i8 0, i64 64, i1 false)
  call void @gvisit(ptr noundef nonnull %3, ptr noundef %0) #4
  %17 = load i32, ptr %3, align 8, !tbaa !5
  %18 = icmp eq i32 %17, 0
  call void @llvm.lifetime.end.p0(i64 208, ptr nonnull %3) #4
  ret i1 %18
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

declare ptr @symboltable_create(i32 noundef) local_unnamed_addr #2

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

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

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

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

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

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

declare void @gvisit(ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

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

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #4 = { 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, !7, i64 0}
!6 = !{!"gvisitor", !7, i64 0, !10, i64 8, !11, i64 16, !10, i64 24, !10, i64 32, !10, i64 40, !10, i64 48, !10, i64 56, !10, i64 64, !10, i64 72, !10, i64 80, !10, i64 88, !10, i64 96, !10, i64 104, !10, i64 112, !10, i64 120, !10, i64 128, !10, i64 136, !10, i64 144, !10, i64 152, !10, i64 160, !10, i64 168, !10, i64 176, !10, i64 184, !10, i64 192, !10, i64 200}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"_Bool", !8, i64 0}
!12 = !{!6, !10, i64 8}
!13 = !{!6, !11, i64 16}
!14 = !{!6, !10, i64 24}
!15 = !{!6, !10, i64 48}
!16 = !{!6, !10, i64 104}
!17 = !{!6, !10, i64 112}
!18 = !{!6, !10, i64 120}
!19 = !{!6, !10, i64 128}
!20 = !{!6, !10, i64 136}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,SROAPass,TailCallElimPass