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

; 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.41 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [154 x i8], align 1
@.str.44 = external hidden unnamed_addr constant [62 x i8], align 1

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

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

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

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

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

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #4

; Function Attrs: nounwind uwtable
define dso_local void @cp_framebuff(ptr noundef %0, ptr noundef %1) #3 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8, !tbaa !5
  %6 = getelementptr inbounds %struct.Dump, ptr %5, i32 0, i32 2
  %7 = load i8, ptr %6, align 8, !tbaa !9
  %8 = sext i8 %7 to i32
  %9 = icmp ne i32 %8, 114
  br i1 %9, label %10, label %15

10:                                               ; preds = %2
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.Dump, ptr %11, i32 0, i32 0
  %13 = load ptr, ptr %12, align 8, !tbaa !13
  %14 = call i32 (ptr, ...) @printf(ptr noundef @.str.41, ptr noundef %13)
  call void @exit(i32 noundef 1) #5
  unreachable

15:                                               ; preds = %2
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.Dump, ptr %16, i32 0, i32 2
  %18 = load i8, ptr %17, align 8, !tbaa !9
  %19 = sext i8 %18 to i32
  %20 = icmp ne i32 %19, 119
  br i1 %20, label %21, label %26

21:                                               ; preds = %15
  %22 = load ptr, ptr %4, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.Dump, ptr %22, i32 0, i32 0
  %24 = load ptr, ptr %23, align 8, !tbaa !13
  %25 = call i32 (ptr, ...) @printf(ptr noundef @.str.42, ptr noundef %24)
  call void @exit(i32 noundef 1) #5
  unreachable

26:                                               ; preds = %15
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct.Dump, ptr %27, i32 0, i32 8
  %29 = load ptr, ptr %28, align 8, !tbaa !14
  %30 = call i64 @strlen(ptr noundef %29) #6
  %31 = icmp ne i64 %30, 0
  br i1 %31, label %32, label %37

32:                                               ; preds = %26
  %33 = load ptr, ptr %4, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.Dump, ptr %33, i32 0, i32 3
  %35 = load i32, ptr %34, align 4, !tbaa !15
  %36 = call i32 (ptr, ...) @printf(ptr noundef @.str.43, i32 noundef %35)
  br label %37

37:                                               ; preds = %32, %26
  %38 = load ptr, ptr %4, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct.Dump, ptr %38, i32 0, i32 8
  %40 = load ptr, ptr %39, align 8, !tbaa !14
  %41 = load ptr, ptr %3, align 8, !tbaa !5
  %42 = getelementptr inbounds %struct.Dump, ptr %41, i32 0, i32 7
  %43 = load i64, ptr %42, align 8, !tbaa !16
  %44 = add nsw i64 %43, 1
  %45 = mul i64 %44, 1
  %46 = call ptr @realloc(ptr noundef %40, i64 noundef %45) #7
  %47 = load ptr, ptr %4, align 8, !tbaa !5
  %48 = getelementptr inbounds %struct.Dump, ptr %47, i32 0, i32 8
  store ptr %46, ptr %48, align 8, !tbaa !14
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.Dump, ptr %49, i32 0, i32 8
  %51 = load ptr, ptr %50, align 8, !tbaa !14
  %52 = icmp eq ptr %51, null
  br i1 %52, label %53, label %59

53:                                               ; preds = %37
  %54 = load ptr, ptr %3, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.Dump, ptr %54, i32 0, i32 7
  %56 = load i64, ptr %55, align 8, !tbaa !16
  %57 = add nsw i64 %56, 1
  %58 = call i32 (ptr, ...) @printf(ptr noundef @.str.44, i64 noundef %57)
  call void @exit(i32 noundef 1) #5
  unreachable

59:                                               ; preds = %37
  %60 = load ptr, ptr %3, align 8, !tbaa !5
  %61 = getelementptr inbounds %struct.Dump, ptr %60, i32 0, i32 7
  %62 = load i64, ptr %61, align 8, !tbaa !16
  %63 = load ptr, ptr %4, align 8, !tbaa !5
  %64 = getelementptr inbounds %struct.Dump, ptr %63, i32 0, i32 7
  store i64 %62, ptr %64, align 8, !tbaa !16
  %65 = load ptr, ptr %4, align 8, !tbaa !5
  %66 = getelementptr inbounds %struct.Dump, ptr %65, i32 0, i32 8
  %67 = load ptr, ptr %66, align 8, !tbaa !14
  %68 = load ptr, ptr %3, align 8, !tbaa !5
  %69 = getelementptr inbounds %struct.Dump, ptr %68, i32 0, i32 8
  %70 = load ptr, ptr %69, align 8, !tbaa !14
  %71 = load ptr, ptr %4, align 8, !tbaa !5
  %72 = getelementptr inbounds %struct.Dump, ptr %71, i32 0, i32 7
  %73 = load i64, ptr %72, align 8, !tbaa !16
  %74 = add nsw i64 %73, 1
  %75 = call i64 @strlcpy(ptr noundef %67, ptr noundef %70, i64 noundef %74)
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  call void @find_sections(ptr noundef %76)
  ret void
}

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


; 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.41 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.42 = external hidden unnamed_addr constant [49 x i8], align 1
@.str.43 = external hidden unnamed_addr constant [154 x i8], align 1
@.str.44 = external hidden unnamed_addr constant [62 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
define dso_local void @cp_framebuff(ptr nocapture noundef readonly %0, ptr noundef %1) local_unnamed_addr #3 {
  %3 = getelementptr inbounds i8, ptr %0, i64 16
  %4 = load i8, ptr %3, align 8, !tbaa !5
  %.not = icmp eq i8 %4, 114
  br i1 %.not, label %8, label %5

5:                                                ; preds = %2
  %6 = load ptr, ptr %0, align 8, !tbaa !12
  %7 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.41, ptr noundef %6)
  tail call void @exit(i32 noundef 1) #5
  unreachable

8:                                                ; preds = %2
  %9 = getelementptr inbounds i8, ptr %1, i64 16
  %10 = load i8, ptr %9, align 8, !tbaa !5
  %.not17 = icmp eq i8 %10, 119
  br i1 %.not17, label %14, label %11

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

14:                                               ; preds = %8
  %15 = getelementptr inbounds i8, ptr %1, i64 48
  %16 = load ptr, ptr %15, align 8, !tbaa !13
  %char0 = load i8, ptr %16, align 1
  %.not18 = icmp eq i8 %char0, 0
  br i1 %.not18, label %21, label %17

17:                                               ; preds = %14
  %18 = getelementptr inbounds i8, ptr %1, i64 20
  %19 = load i32, ptr %18, align 4, !tbaa !14
  %20 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.43, i32 noundef %19)
  %.pre = load ptr, ptr %15, align 8, !tbaa !13
  br label %21

21:                                               ; preds = %17, %14
  %22 = phi ptr [ %.pre, %17 ], [ %16, %14 ]
  %23 = getelementptr inbounds i8, ptr %0, i64 40
  %24 = load i64, ptr %23, align 8, !tbaa !15
  %25 = add nsw i64 %24, 1
  %26 = tail call ptr @realloc(ptr noundef %22, i64 noundef %25) #6
  store ptr %26, ptr %15, align 8, !tbaa !13
  %27 = icmp eq ptr %26, null
  %28 = load i64, ptr %23, align 8, !tbaa !15
  br i1 %27, label %29, label %32

29:                                               ; preds = %21
  %30 = add nsw i64 %28, 1
  %31 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.44, i64 noundef %30)
  tail call void @exit(i32 noundef 1) #5
  unreachable

32:                                               ; preds = %21
  %33 = getelementptr inbounds i8, ptr %1, i64 40
  store i64 %28, ptr %33, align 8, !tbaa !15
  %34 = getelementptr inbounds i8, ptr %0, i64 48
  %35 = load ptr, ptr %34, align 8, !tbaa !13
  %36 = add nsw i64 %28, 1
  %37 = tail call i64 @strlcpy(ptr noundef nonnull %26, ptr noundef nonnull dereferenceable(1) %35, i64 noundef %36)
  tail call void @find_sections(ptr noundef nonnull %1)
  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, !7, i64 48}
!14 = !{!6, !10, i64 20}
!15 = !{!6, !11, i64 40}


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