; LLVM IR from OpenFAST/openfast :: modules/map/src (freedata)

; 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.Line_t = type { ptr, %struct.LineOptions, %struct.VarTypePtr_t, %struct.VarTypePtr_t, %struct.VarType_t, ptr, ptr, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, double, %struct.list_t, ptr, ptr, i32, i32, i32, i32, i32 }
%struct.LineOptions = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 }
%struct.VarTypePtr_t = type { ptr, ptr, ptr, i8, i32, i32 }
%struct.VarType_t = type { ptr, ptr, double, i8, i8, i32, i32 }
%struct.list_t = type { ptr, ptr, ptr, i32, ptr, i32, i32, i32, ptr, %struct.list_attributes_s }
%struct.list_attributes_s = type { ptr, ptr, ptr, i32, ptr, ptr, ptr }

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

declare i32 @list_iterator_start(ptr noundef) #1

declare i32 @list_iterator_hasnext(ptr noundef) #1

declare ptr @list_iterator_next(ptr noundef) #1

declare i32 @bdestroy(ptr noundef) #1

declare i32 @list_iterator_stop(ptr noundef) #1

; 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 i32 @free_line(ptr noalias noundef %0) #2 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #3
  store ptr null, ptr %3, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8, !tbaa !5
  %5 = call i32 @list_iterator_start(ptr noundef %4)
  br label %6

6:                                                ; preds = %10, %1
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  %8 = call i32 @list_iterator_hasnext(ptr noundef %7)
  %9 = icmp ne i32 %8, 0
  br i1 %9, label %10, label %53

10:                                               ; preds = %6
  %11 = load ptr, ptr %2, align 8, !tbaa !5
  %12 = call ptr @list_iterator_next(ptr noundef %11)
  store ptr %12, ptr %3, align 8, !tbaa !5
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = getelementptr inbounds %struct.Line_t, ptr %13, i32 0, i32 4
  %15 = getelementptr inbounds %struct.VarType_t, ptr %14, i32 0, i32 1
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = call i32 @bdestroy(ptr noundef %16)
  %18 = load ptr, ptr %3, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.Line_t, ptr %18, i32 0, i32 4
  %20 = getelementptr inbounds %struct.VarType_t, ptr %19, i32 0, i32 0
  %21 = load ptr, ptr %20, align 8, !tbaa !19
  %22 = call i32 @bdestroy(ptr noundef %21)
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.Line_t, ptr %23, i32 0, i32 2
  %25 = getelementptr inbounds %struct.VarTypePtr_t, ptr %24, i32 0, i32 1
  %26 = load ptr, ptr %25, align 8, !tbaa !20
  %27 = call i32 @bdestroy(ptr noundef %26)
  %28 = load ptr, ptr %3, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.Line_t, ptr %28, i32 0, i32 2
  %30 = getelementptr inbounds %struct.VarTypePtr_t, ptr %29, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8, !tbaa !21
  %32 = call i32 @bdestroy(ptr noundef %31)
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.Line_t, ptr %33, i32 0, i32 3
  %35 = getelementptr inbounds %struct.VarTypePtr_t, ptr %34, i32 0, i32 1
  %36 = load ptr, ptr %35, align 8, !tbaa !22
  %37 = call i32 @bdestroy(ptr noundef %36)
  %38 = load ptr, ptr %3, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.Line_t, ptr %38, i32 0, i32 3
  %40 = getelementptr inbounds %struct.VarTypePtr_t, ptr %39, i32 0, i32 0
  %41 = load ptr, ptr %40, align 8, !tbaa !23
  %42 = call i32 @bdestroy(ptr noundef %41)
  %43 = load ptr, ptr %3, align 8, !tbaa !5
  %44 = getelementptr inbounds %struct.Line_t, ptr %43, i32 0, i32 0
  store ptr null, ptr %44, align 8, !tbaa !24
  %45 = load ptr, ptr %3, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.Line_t, ptr %45, i32 0, i32 5
  store ptr null, ptr %46, align 8, !tbaa !25
  %47 = load ptr, ptr %3, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.Line_t, ptr %47, i32 0, i32 6
  store ptr null, ptr %48, align 8, !tbaa !26
  %49 = load ptr, ptr %3, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.Line_t, ptr %49, i32 0, i32 26
  store ptr null, ptr %50, align 8, !tbaa !27
  %51 = load ptr, ptr %3, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.Line_t, ptr %51, i32 0, i32 27
  store ptr null, ptr %52, align 8, !tbaa !28
  br label %6, !llvm.loop !29

53:                                               ; preds = %6
  %54 = load ptr, ptr %2, align 8, !tbaa !5
  %55 = call i32 @list_iterator_stop(ptr noundef %54)
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #3
  ret i32 0
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 #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 128}
!10 = !{!"Line_t", !6, i64 0, !11, i64 8, !13, i64 40, !13, i64 80, !15, i64 120, !6, i64 160, !6, i64 168, !16, i64 176, !16, i64 184, !16, i64 192, !16, i64 200, !16, i64 208, !16, i64 216, !16, i64 224, !16, i64 232, !16, i64 240, !16, i64 248, !16, i64 256, !16, i64 264, !16, i64 272, !16, i64 280, !16, i64 288, !16, i64 296, !16, i64 304, !16, i64 312, !17, i64 320, !6, i64 440, !6, i64 448, !14, i64 456, !14, i64 460, !14, i64 464, !14, i64 468, !14, i64 472}
!11 = !{!"", !12, i64 0, !12, i64 1, !12, i64 2, !12, i64 3, !12, i64 4, !12, i64 5, !12, i64 6, !12, i64 7, !12, i64 8, !12, i64 9, !12, i64 10, !12, i64 11, !12, i64 12, !12, i64 13, !12, i64 14, !12, i64 15, !12, i64 16, !12, i64 17, !12, i64 18, !12, i64 19, !12, i64 20, !12, i64 21, !12, i64 22, !12, i64 23, !12, i64 24, !12, i64 25}
!12 = !{!"_Bool", !7, i64 0}
!13 = !{!"VarTypePtr_t", !6, i64 0, !6, i64 8, !6, i64 16, !12, i64 24, !14, i64 28, !14, i64 32}
!14 = !{!"int", !7, i64 0}
!15 = !{!"VarType_t", !6, i64 0, !6, i64 8, !16, i64 16, !12, i64 24, !12, i64 25, !14, i64 28, !14, i64 32}
!16 = !{!"double", !7, i64 0}
!17 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !14, i64 24, !6, i64 32, !14, i64 40, !14, i64 44, !14, i64 48, !6, i64 56, !18, i64 64}
!18 = !{!"list_attributes_s", !6, i64 0, !6, i64 8, !6, i64 16, !14, i64 24, !6, i64 32, !6, i64 40, !6, i64 48}
!19 = !{!10, !6, i64 120}
!20 = !{!10, !6, i64 48}
!21 = !{!10, !6, i64 40}
!22 = !{!10, !6, i64 88}
!23 = !{!10, !6, i64 80}
!24 = !{!10, !6, i64 0}
!25 = !{!10, !6, i64 160}
!26 = !{!10, !6, i64 168}
!27 = !{!10, !6, i64 440}
!28 = !{!10, !6, i64 448}
!29 = distinct !{!29, !30}
!30 = !{!"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"

declare i32 @list_iterator_start(ptr noundef) local_unnamed_addr #0

declare i32 @list_iterator_hasnext(ptr noundef) local_unnamed_addr #0

declare ptr @list_iterator_next(ptr noundef) local_unnamed_addr #0

declare i32 @bdestroy(ptr noundef) local_unnamed_addr #0

declare i32 @list_iterator_stop(ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @free_line(ptr noalias noundef %0) local_unnamed_addr #1 {
  %2 = tail call i32 @list_iterator_start(ptr noundef %0) #3
  %3 = tail call i32 @list_iterator_hasnext(ptr noundef %0) #3
  %.not15 = icmp eq i32 %3, 0
  br i1 %.not15, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %1, %.lr.ph
  %4 = tail call ptr @list_iterator_next(ptr noundef %0) #3
  %5 = getelementptr inbounds i8, ptr %4, i64 120
  %6 = getelementptr inbounds i8, ptr %4, i64 128
  %7 = load ptr, ptr %6, align 8, !tbaa !5
  %8 = tail call i32 @bdestroy(ptr noundef %7) #3
  %9 = load ptr, ptr %5, align 8, !tbaa !18
  %10 = tail call i32 @bdestroy(ptr noundef %9) #3
  %11 = getelementptr inbounds i8, ptr %4, i64 40
  %12 = getelementptr inbounds i8, ptr %4, i64 48
  %13 = load ptr, ptr %12, align 8, !tbaa !19
  %14 = tail call i32 @bdestroy(ptr noundef %13) #3
  %15 = load ptr, ptr %11, align 8, !tbaa !20
  %16 = tail call i32 @bdestroy(ptr noundef %15) #3
  %17 = getelementptr inbounds i8, ptr %4, i64 80
  %18 = getelementptr inbounds i8, ptr %4, i64 88
  %19 = load ptr, ptr %18, align 8, !tbaa !21
  %20 = tail call i32 @bdestroy(ptr noundef %19) #3
  %21 = load ptr, ptr %17, align 8, !tbaa !22
  %22 = tail call i32 @bdestroy(ptr noundef %21) #3
  store ptr null, ptr %4, align 8, !tbaa !23
  %23 = getelementptr inbounds i8, ptr %4, i64 160
  %24 = getelementptr inbounds i8, ptr %4, i64 440
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %23, i8 0, i64 16, i1 false)
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %24, i8 0, i64 16, i1 false)
  %25 = tail call i32 @list_iterator_hasnext(ptr noundef %0) #3
  %.not = icmp eq i32 %25, 0
  br i1 %.not, label %._crit_edge, label %.lr.ph, !llvm.loop !24

._crit_edge:                                      ; preds = %.lr.ph, %1
  %26 = tail call i32 @list_iterator_stop(ptr noundef %0) #3
  ret i32 0
}

; 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 = { "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 = { 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 = { 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 128}
!6 = !{!"Line_t", !7, i64 0, !10, i64 8, !12, i64 40, !12, i64 80, !14, i64 120, !7, i64 160, !7, i64 168, !15, i64 176, !15, i64 184, !15, i64 192, !15, i64 200, !15, i64 208, !15, i64 216, !15, i64 224, !15, i64 232, !15, i64 240, !15, i64 248, !15, i64 256, !15, i64 264, !15, i64 272, !15, i64 280, !15, i64 288, !15, i64 296, !15, i64 304, !15, i64 312, !16, i64 320, !7, i64 440, !7, i64 448, !13, i64 456, !13, i64 460, !13, i64 464, !13, i64 468, !13, i64 472}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"", !11, i64 0, !11, i64 1, !11, i64 2, !11, i64 3, !11, i64 4, !11, i64 5, !11, i64 6, !11, i64 7, !11, i64 8, !11, i64 9, !11, i64 10, !11, i64 11, !11, i64 12, !11, i64 13, !11, i64 14, !11, i64 15, !11, i64 16, !11, i64 17, !11, i64 18, !11, i64 19, !11, i64 20, !11, i64 21, !11, i64 22, !11, i64 23, !11, i64 24, !11, i64 25}
!11 = !{!"_Bool", !8, i64 0}
!12 = !{!"VarTypePtr_t", !7, i64 0, !7, i64 8, !7, i64 16, !11, i64 24, !13, i64 28, !13, i64 32}
!13 = !{!"int", !8, i64 0}
!14 = !{!"VarType_t", !7, i64 0, !7, i64 8, !15, i64 16, !11, i64 24, !11, i64 25, !13, i64 28, !13, i64 32}
!15 = !{!"double", !8, i64 0}
!16 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16, !13, i64 24, !7, i64 32, !13, i64 40, !13, i64 44, !13, i64 48, !7, i64 56, !17, i64 64}
!17 = !{!"list_attributes_s", !7, i64 0, !7, i64 8, !7, i64 16, !13, i64 24, !7, i64 32, !7, i64 40, !7, i64 48}
!18 = !{!6, !7, i64 120}
!19 = !{!6, !7, i64 48}
!20 = !{!6, !7, i64 40}
!21 = !{!6, !7, i64 88}
!22 = !{!6, !7, i64 80}
!23 = !{!6, !7, i64 0}
!24 = distinct !{!24, !25}
!25 = !{!"llvm.loop.mustprogress"}


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