; LLVM IR from snowballstem/snowball :: compiler (analyser)

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

; 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 ptr @create_analyser(ptr noundef %0) #1 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  %5 = call ptr @check_malloc(i64 noundef 144)
  store ptr %5, ptr %3, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8, !tbaa !5
  %8 = getelementptr inbounds %struct.analyser, ptr %7, i32 0, i32 0
  store ptr %6, ptr %8, align 8, !tbaa !9
  %9 = load ptr, ptr %3, align 8, !tbaa !5
  %10 = getelementptr inbounds %struct.analyser, ptr %9, i32 0, i32 1
  store ptr null, ptr %10, align 8, !tbaa !12
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.analyser, ptr %11, i32 0, i32 2
  store ptr null, ptr %12, align 8, !tbaa !13
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.analyser, ptr %13, i32 0, i32 3
  store ptr null, ptr %14, align 8, !tbaa !14
  %15 = load ptr, ptr %3, align 8, !tbaa !5
  %16 = getelementptr inbounds %struct.analyser, ptr %15, i32 0, i32 6
  store ptr null, ptr %16, align 8, !tbaa !15
  %17 = load ptr, ptr %3, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct.analyser, ptr %17, i32 0, i32 9
  store ptr null, ptr %18, align 8, !tbaa !16
  %19 = load ptr, ptr %3, align 8, !tbaa !5
  %20 = getelementptr inbounds %struct.analyser, ptr %19, i32 0, i32 11
  store i32 0, ptr %20, align 8, !tbaa !17
  %21 = load ptr, ptr %3, align 8, !tbaa !5
  %22 = getelementptr inbounds %struct.analyser, ptr %21, i32 0, i32 13
  store i32 0, ptr %22, align 8, !tbaa !18
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.analyser, ptr %23, i32 0, i32 14
  store ptr null, ptr %24, align 8, !tbaa !19
  %25 = load ptr, ptr %3, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.analyser, ptr %25, i32 0, i32 4
  store i8 0, ptr %26, align 8, !tbaa !20
  %27 = load ptr, ptr %3, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.analyser, ptr %27, i32 0, i32 5
  store i8 1, ptr %28, align 1, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #3
  store i32 0, ptr %4, align 4, !tbaa !22
  br label %29

29:                                               ; preds = %38, %1
  %30 = load i32, ptr %4, align 4, !tbaa !22
  %31 = icmp slt i32 %30, 6
  br i1 %31, label %32, label %41

32:                                               ; preds = %29
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.analyser, ptr %33, i32 0, i32 8
  %35 = load i32, ptr %4, align 4, !tbaa !22
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [6 x i32], ptr %34, i64 0, i64 %36
  store i32 0, ptr %37, align 4, !tbaa !22
  br label %38

38:                                               ; preds = %32
  %39 = load i32, ptr %4, align 4, !tbaa !22
  %40 = add nsw i32 %39, 1
  store i32 %40, ptr %4, align 4, !tbaa !22
  br label %29, !llvm.loop !23

41:                                               ; preds = %29
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #3
  %42 = load ptr, ptr %3, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.analyser, ptr %42, i32 0, i32 16
  store ptr null, ptr %43, align 8, !tbaa !25
  %44 = load ptr, ptr %3, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.analyser, ptr %44, i32 0, i32 18
  store i8 0, ptr %45, align 4, !tbaa !26
  %46 = load ptr, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  ret ptr %46
}

declare ptr @check_malloc(i64 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 = { "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 0}
!10 = !{!"analyser", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !7, i64 32, !7, i64 33, !6, i64 40, !6, i64 48, !7, i64 56, !6, i64 80, !6, i64 88, !11, i64 96, !11, i64 100, !11, i64 104, !6, i64 112, !6, i64 120, !6, i64 128, !11, i64 136, !7, i64 140}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 8}
!13 = !{!10, !6, i64 16}
!14 = !{!10, !6, i64 24}
!15 = !{!10, !6, i64 40}
!16 = !{!10, !6, i64 80}
!17 = !{!10, !11, i64 96}
!18 = !{!10, !11, i64 104}
!19 = !{!10, !6, i64 112}
!20 = !{!10, !7, i64 32}
!21 = !{!10, !7, i64 33}
!22 = !{!11, !11, i64 0}
!23 = distinct !{!23, !24}
!24 = !{!"llvm.loop.mustprogress"}
!25 = !{!10, !6, i64 128}
!26 = !{!10, !7, i64 140}


; 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 noundef ptr @create_analyser(ptr noundef %0) local_unnamed_addr #0 {
  %2 = tail call ptr @check_malloc(i64 noundef 144) #3
  store ptr %0, ptr %2, align 8, !tbaa !5
  %3 = getelementptr inbounds i8, ptr %2, i64 8
  %4 = getelementptr inbounds i8, ptr %2, i64 40
  store ptr null, ptr %4, align 8, !tbaa !11
  %5 = getelementptr inbounds i8, ptr %2, i64 80
  store ptr null, ptr %5, align 8, !tbaa !12
  %6 = getelementptr inbounds i8, ptr %2, i64 96
  store i32 0, ptr %6, align 8, !tbaa !13
  %7 = getelementptr inbounds i8, ptr %2, i64 104
  store i32 0, ptr %7, align 8, !tbaa !14
  %8 = getelementptr inbounds i8, ptr %2, i64 112
  store ptr null, ptr %8, align 8, !tbaa !15
  %9 = getelementptr inbounds i8, ptr %2, i64 33
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(25) %3, i8 0, i64 25, i1 false)
  store i8 1, ptr %9, align 1, !tbaa !16
  %10 = getelementptr inbounds i8, ptr %2, i64 56
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 4 dereferenceable(24) %10, i8 0, i64 24, i1 false), !tbaa !17
  %11 = getelementptr inbounds i8, ptr %2, i64 128
  store ptr null, ptr %11, align 8, !tbaa !18
  %12 = getelementptr inbounds i8, ptr %2, i64 140
  store i8 0, ptr %12, align 4, !tbaa !19
  ret ptr %2
}

declare ptr @check_malloc(i64 noundef) local_unnamed_addr #1

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

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 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !7, i64 0}
!6 = !{!"analyser", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !8, i64 32, !8, i64 33, !7, i64 40, !7, i64 48, !8, i64 56, !7, i64 80, !7, i64 88, !10, i64 96, !10, i64 100, !10, i64 104, !7, i64 112, !7, i64 120, !7, i64 128, !10, i64 136, !8, i64 140}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 40}
!12 = !{!6, !7, i64 80}
!13 = !{!6, !10, i64 96}
!14 = !{!6, !10, i64 104}
!15 = !{!6, !7, i64 112}
!16 = !{!6, !8, i64 33}
!17 = !{!10, !10, i64 0}
!18 = !{!6, !7, i64 128}
!19 = !{!6, !8, i64 140}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LICMPass,LoopIdiomRecognizePass,LoopRotatePass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass