; LLVM IR from Syrocco/Graphical-EDMD :: parser (add_section)

; 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.Dump = type { ptr, ptr, i8, i32, ptr, i32, i32, i64, ptr, i32, [10 x [256 x i8]], [11 x ptr] }

@.str.58 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.59 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.60 = external hidden unnamed_addr constant [61 x i8], align 1

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

declare i32 @printf(ptr noundef, ...) #1

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) #2

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

; Function Attrs: nounwind allocsize(1)
declare ptr @realloc(ptr noundef, i64 noundef) #3

; Function Attrs: nounwind uwtable
declare dso_local void @find_sections(ptr noundef) #4

; Function Attrs: nounwind uwtable
declare dso_local i64 @strlcpy(ptr noundef, ptr noundef, i64 noundef) #4

; Function Attrs: nounwind uwtable
declare dso_local void @cp_framebuff(ptr noundef, ptr noundef) #4

; Function Attrs: nounwind uwtable
define dso_local void @add_section(ptr noundef %0, i32 noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5) #4 {
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  store ptr %0, ptr %7, align 8, !tbaa !5
  store i32 %1, ptr %8, align 4, !tbaa !9
  store ptr %2, ptr %9, align 8, !tbaa !5
  store i32 %3, ptr %10, align 4, !tbaa !9
  store ptr %4, ptr %11, align 8, !tbaa !5
  store ptr %5, ptr %12, align 8, !tbaa !5
  %14 = load ptr, ptr %11, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct.Dump, ptr %14, i32 0, i32 2
  %16 = load i8, ptr %15, align 8, !tbaa !11
  %17 = sext i8 %16 to i32
  %18 = icmp ne i32 %17, 119
  br i1 %18, label %19, label %24

19:                                               ; preds = %6
  %20 = load ptr, ptr %11, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.Dump, ptr %20, i32 0, i32 0
  %22 = load ptr, ptr %21, align 8, !tbaa !14
  %23 = call i32 (ptr, ...) @printf(ptr noundef @.str.58, ptr noundef %22)
  call void @exit(i32 noundef 1) #5
  unreachable

24:                                               ; preds = %6
  %25 = load ptr, ptr %12, align 8, !tbaa !5
  %26 = getelementptr inbounds %struct.Dump, ptr %25, i32 0, i32 2
  %27 = load i8, ptr %26, align 8, !tbaa !11
  %28 = sext i8 %27 to i32
  %29 = icmp ne i32 %28, 114
  br i1 %29, label %30, label %35

30:                                               ; preds = %24
  %31 = load ptr, ptr %12, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.Dump, ptr %31, i32 0, i32 0
  %33 = load ptr, ptr %32, align 8, !tbaa !14
  %34 = call i32 (ptr, ...) @printf(ptr noundef @.str.59, ptr noundef %33)
  call void @exit(i32 noundef 1) #5
  unreachable

35:                                               ; preds = %24
  %36 = load ptr, ptr %11, align 8, !tbaa !5
  %37 = getelementptr inbounds %struct.Dump, ptr %36, i32 0, i32 7
  %38 = load i64, ptr %37, align 8, !tbaa !15
  %39 = icmp eq i64 %38, 0
  br i1 %39, label %40, label %43

40:                                               ; preds = %35
  %41 = load ptr, ptr %12, align 8, !tbaa !5
  %42 = load ptr, ptr %11, align 8, !tbaa !5
  call void @cp_framebuff(ptr noundef %41, ptr noundef %42)
  br label %43

43:                                               ; preds = %40, %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %44 = load ptr, ptr %11, align 8, !tbaa !5
  %45 = getelementptr inbounds %struct.Dump, ptr %44, i32 0, i32 7
  %46 = load i64, ptr %45, align 8, !tbaa !15
  %47 = trunc i64 %46 to i32
  store i32 %47, ptr %13, align 4, !tbaa !9
  %48 = load i32, ptr %8, align 4, !tbaa !9
  %49 = load i32, ptr %10, align 4, !tbaa !9
  %50 = add nsw i32 %48, %49
  %51 = sext i32 %50 to i64
  %52 = load ptr, ptr %11, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.Dump, ptr %52, i32 0, i32 7
  %54 = load i64, ptr %53, align 8, !tbaa !15
  %55 = add nsw i64 %54, %51
  store i64 %55, ptr %53, align 8, !tbaa !15
  %56 = load ptr, ptr %11, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.Dump, ptr %56, i32 0, i32 8
  %58 = load ptr, ptr %57, align 8, !tbaa !16
  %59 = load ptr, ptr %11, align 8, !tbaa !5
  %60 = getelementptr inbounds %struct.Dump, ptr %59, i32 0, i32 7
  %61 = load i64, ptr %60, align 8, !tbaa !15
  %62 = add nsw i64 %61, 1
  %63 = call ptr @realloc(ptr noundef %58, i64 noundef %62) #7
  %64 = load ptr, ptr %11, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.Dump, ptr %64, i32 0, i32 8
  store ptr %63, ptr %65, align 8, !tbaa !16
  %66 = load ptr, ptr %11, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.Dump, ptr %66, i32 0, i32 8
  %68 = load ptr, ptr %67, align 8, !tbaa !16
  %69 = icmp eq ptr %68, null
  br i1 %69, label %70, label %75

70:                                               ; preds = %43
  %71 = load ptr, ptr %11, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.Dump, ptr %71, i32 0, i32 7
  %73 = load i64, ptr %72, align 8, !tbaa !15
  %74 = call i32 (ptr, ...) @printf(ptr noundef @.str.60, i64 noundef %73)
  call void @exit(i32 noundef 1) #5
  unreachable

75:                                               ; preds = %43
  %76 = load ptr, ptr %11, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.Dump, ptr %76, i32 0, i32 8
  %78 = load ptr, ptr %77, align 8, !tbaa !16
  %79 = load i32, ptr %13, align 4, !tbaa !9
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds i8, ptr %78, i64 %80
  %82 = load ptr, ptr %7, align 8, !tbaa !5
  %83 = load i32, ptr %8, align 4, !tbaa !9
  %84 = add nsw i32 %83, 1
  %85 = sext i32 %84 to i64
  %86 = call i64 @strlcpy(ptr noundef %81, ptr noundef %82, i64 noundef %85)
  %87 = load ptr, ptr %11, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct.Dump, ptr %87, i32 0, i32 8
  %89 = load ptr, ptr %88, align 8, !tbaa !16
  %90 = load i32, ptr %13, align 4, !tbaa !9
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds i8, ptr %89, i64 %91
  %93 = load i32, ptr %8, align 4, !tbaa !9
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds i8, ptr %92, i64 %94
  %96 = load ptr, ptr %9, align 8, !tbaa !5
  %97 = load i32, ptr %10, align 4, !tbaa !9
  %98 = add nsw i32 %97, 1
  %99 = sext i32 %98 to i64
  %100 = call i64 @strlcpy(ptr noundef %95, ptr noundef %96, i64 noundef %99)
  %101 = load ptr, ptr %11, align 8, !tbaa !5
  call void @find_sections(ptr noundef %101)
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  ret void
}

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 = { noreturn nounwind "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 allocsize(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 #4 = { 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 #5 = { noreturn nounwind }
attributes #6 = { nounwind }
attributes #7 = { nounwind allocsize(1) }

!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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !7, i64 16}
!12 = !{!"Dump", !6, i64 0, !6, i64 8, !7, i64 16, !10, i64 20, !6, i64 24, !10, i64 32, !10, i64 36, !13, i64 40, !6, i64 48, !10, i64 56, !7, i64 60, !7, i64 2624}
!13 = !{!"long", !7, i64 0}
!14 = !{!12, !6, i64 0}
!15 = !{!12, !13, i64 40}
!16 = !{!12, !6, i64 48}


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

@.str.58 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.59 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.60 = external hidden unnamed_addr constant [61 x i8], align 1

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #0

; Function Attrs: noreturn nounwind
declare void @exit(i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias noundef ptr @realloc(ptr allocptr nocapture noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local void @find_sections(ptr noundef) local_unnamed_addr #3

; Function Attrs: nofree nounwind uwtable
declare dso_local i64 @strlcpy(ptr noundef, ptr noundef, i64 noundef) local_unnamed_addr #4

; Function Attrs: nounwind uwtable
declare dso_local void @cp_framebuff(ptr noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local void @add_section(ptr noundef %0, i32 noundef %1, ptr noundef %2, i32 noundef %3, ptr noundef %4, ptr noundef %5) local_unnamed_addr #3 {
  %7 = getelementptr inbounds i8, ptr %4, i64 16
  %8 = load i8, ptr %7, align 8, !tbaa !5
  %.not = icmp eq i8 %8, 119
  br i1 %.not, label %12, label %9

9:                                                ; preds = %6
  %10 = load ptr, ptr %4, align 8, !tbaa !12
  %11 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.58, ptr noundef %10)
  tail call void @exit(i32 noundef 1) #5
  unreachable

12:                                               ; preds = %6
  %13 = getelementptr inbounds i8, ptr %5, i64 16
  %14 = load i8, ptr %13, align 8, !tbaa !5
  %.not25 = icmp eq i8 %14, 114
  br i1 %.not25, label %18, label %15

15:                                               ; preds = %12
  %16 = load ptr, ptr %5, align 8, !tbaa !12
  %17 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.59, ptr noundef %16)
  tail call void @exit(i32 noundef 1) #5
  unreachable

18:                                               ; preds = %12
  %19 = getelementptr inbounds i8, ptr %4, i64 40
  %20 = load i64, ptr %19, align 8, !tbaa !13
  %21 = icmp eq i64 %20, 0
  br i1 %21, label %22, label %23

22:                                               ; preds = %18
  tail call void @cp_framebuff(ptr noundef nonnull %5, ptr noundef nonnull %4)
  %.pre = load i64, ptr %19, align 8, !tbaa !13
  br label %23

23:                                               ; preds = %22, %18
  %24 = phi i64 [ %.pre, %22 ], [ %20, %18 ]
  %25 = add nsw i32 %3, %1
  %26 = sext i32 %25 to i64
  %27 = add nsw i64 %24, %26
  store i64 %27, ptr %19, align 8, !tbaa !13
  %28 = getelementptr inbounds i8, ptr %4, i64 48
  %29 = load ptr, ptr %28, align 8, !tbaa !14
  %30 = add nsw i64 %27, 1
  %31 = tail call ptr @realloc(ptr noundef %29, i64 noundef %30) #6
  store ptr %31, ptr %28, align 8, !tbaa !14
  %32 = icmp eq ptr %31, null
  br i1 %32, label %33, label %36

33:                                               ; preds = %23
  %34 = load i64, ptr %19, align 8, !tbaa !13
  %35 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.60, i64 noundef %34)
  tail call void @exit(i32 noundef 1) #5
  unreachable

36:                                               ; preds = %23
  %sext = shl i64 %24, 32
  %37 = ashr exact i64 %sext, 32
  %38 = getelementptr inbounds i8, ptr %31, i64 %37
  %39 = add nsw i32 %1, 1
  %40 = sext i32 %39 to i64
  %41 = tail call i64 @strlcpy(ptr noundef nonnull %38, ptr noundef nonnull dereferenceable(1) %0, i64 noundef %40)
  %42 = load ptr, ptr %28, align 8, !tbaa !14
  %43 = getelementptr inbounds i8, ptr %42, i64 %37
  %44 = sext i32 %1 to i64
  %45 = getelementptr inbounds i8, ptr %43, i64 %44
  %46 = add nsw i32 %3, 1
  %47 = sext i32 %46 to i64
  %48 = tail call i64 @strlcpy(ptr noundef %45, ptr noundef nonnull dereferenceable(1) %2, i64 noundef %47)
  tail call void @find_sections(ptr noundef nonnull %4)
  ret void
}

attributes #0 = { nofree nounwind "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 = { noreturn nounwind "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 = { mustprogress nounwind willreturn allockind("realloc") allocsize(1) memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 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 #4 = { nofree 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 #5 = { noreturn nounwind }
attributes #6 = { nounwind allocsize(1) }

!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, !8, i64 16}
!6 = !{!"Dump", !7, i64 0, !7, i64 8, !8, i64 16, !10, i64 20, !7, i64 24, !10, i64 32, !10, i64 36, !11, i64 40, !7, i64 48, !10, i64 56, !8, i64 60, !8, i64 2624}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"long", !8, i64 0}
!12 = !{!6, !7, i64 0}
!13 = !{!6, !11, i64 40}
!14 = !{!6, !7, i64 48}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,TailCallElimPass