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

; 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.10 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [12 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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #1

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

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

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

declare i64 @fread(ptr noundef, i64 noundef, i64 noundef, ptr noundef) #2

declare i32 @fseek(ptr noundef, i64 noundef, i32 noundef) #2

; Function Attrs: nounwind
declare void @free(ptr noundef) #4

; Function Attrs: nounwind uwtable
define dso_local void @jump_to_frame(i32 noundef %0, ptr noundef %1) #5 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  store i32 %0, ptr %3, align 4, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !9
  %6 = load i32, ptr %3, align 4, !tbaa !5
  %7 = load ptr, ptr %4, align 8, !tbaa !9
  %8 = getelementptr inbounds %struct.Dump, ptr %7, i32 0, i32 3
  %9 = load i32, ptr %8, align 4, !tbaa !11
  %10 = icmp sge i32 %6, %9
  br i1 %10, label %11, label %17

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

17:                                               ; preds = %2
  %18 = load ptr, ptr %4, align 8, !tbaa !9
  %19 = getelementptr inbounds %struct.Dump, ptr %18, i32 0, i32 4
  %20 = load ptr, ptr %19, align 8, !tbaa !14
  %21 = load i32, ptr %3, align 4, !tbaa !5
  %22 = add nsw i32 %21, 1
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds i64, ptr %20, i64 %23
  %25 = load i64, ptr %24, align 8, !tbaa !15
  %26 = load ptr, ptr %4, align 8, !tbaa !9
  %27 = getelementptr inbounds %struct.Dump, ptr %26, i32 0, i32 4
  %28 = load ptr, ptr %27, align 8, !tbaa !14
  %29 = load i32, ptr %3, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = getelementptr inbounds i64, ptr %28, i64 %30
  %32 = load i64, ptr %31, align 8, !tbaa !15
  %33 = sub nsw i64 %25, %32
  %34 = load ptr, ptr %4, align 8, !tbaa !9
  %35 = getelementptr inbounds %struct.Dump, ptr %34, i32 0, i32 7
  store i64 %33, ptr %35, align 8, !tbaa !16
  %36 = load ptr, ptr %4, align 8, !tbaa !9
  %37 = getelementptr inbounds %struct.Dump, ptr %36, i32 0, i32 8
  %38 = load ptr, ptr %37, align 8, !tbaa !17
  call void @free(ptr noundef %38) #7
  %39 = load ptr, ptr %4, align 8, !tbaa !9
  %40 = getelementptr inbounds %struct.Dump, ptr %39, i32 0, i32 7
  %41 = load i64, ptr %40, align 8, !tbaa !16
  %42 = add nsw i64 %41, 1
  %43 = mul i64 %42, 1
  %44 = call noalias ptr @malloc(i64 noundef %43) #8
  %45 = load ptr, ptr %4, align 8, !tbaa !9
  %46 = getelementptr inbounds %struct.Dump, ptr %45, i32 0, i32 8
  store ptr %44, ptr %46, align 8, !tbaa !17
  %47 = load ptr, ptr %4, align 8, !tbaa !9
  %48 = getelementptr inbounds %struct.Dump, ptr %47, i32 0, i32 8
  %49 = load ptr, ptr %48, align 8, !tbaa !17
  %50 = icmp eq ptr %49, null
  br i1 %50, label %51, label %58

51:                                               ; preds = %17
  %52 = load ptr, ptr %4, align 8, !tbaa !9
  %53 = getelementptr inbounds %struct.Dump, ptr %52, i32 0, i32 7
  %54 = load i64, ptr %53, align 8, !tbaa !16
  %55 = add nsw i64 %54, 1
  %56 = mul i64 %55, 1
  %57 = call i32 (ptr, ...) @printf(ptr noundef @.str.11, i64 noundef %56)
  call void @exit(i32 noundef 1) #6
  unreachable

58:                                               ; preds = %17
  %59 = load ptr, ptr %4, align 8, !tbaa !9
  %60 = getelementptr inbounds %struct.Dump, ptr %59, i32 0, i32 1
  %61 = load ptr, ptr %60, align 8, !tbaa !18
  %62 = load ptr, ptr %4, align 8, !tbaa !9
  %63 = getelementptr inbounds %struct.Dump, ptr %62, i32 0, i32 4
  %64 = load ptr, ptr %63, align 8, !tbaa !14
  %65 = load i32, ptr %3, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds i64, ptr %64, i64 %66
  %68 = load i64, ptr %67, align 8, !tbaa !15
  %69 = call i32 @fseek(ptr noundef %61, i64 noundef %68, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %70 = load ptr, ptr %4, align 8, !tbaa !9
  %71 = getelementptr inbounds %struct.Dump, ptr %70, i32 0, i32 8
  %72 = load ptr, ptr %71, align 8, !tbaa !17
  %73 = load ptr, ptr %4, align 8, !tbaa !9
  %74 = getelementptr inbounds %struct.Dump, ptr %73, i32 0, i32 7
  %75 = load i64, ptr %74, align 8, !tbaa !16
  %76 = load ptr, ptr %4, align 8, !tbaa !9
  %77 = getelementptr inbounds %struct.Dump, ptr %76, i32 0, i32 1
  %78 = load ptr, ptr %77, align 8, !tbaa !18
  %79 = call i64 @fread(ptr noundef %72, i64 noundef 1, i64 noundef %75, ptr noundef %78)
  %80 = trunc i64 %79 to i32
  store i32 %80, ptr %5, align 4, !tbaa !5
  %81 = load i32, ptr %5, align 4, !tbaa !5
  %82 = icmp eq i32 %81, 0
  br i1 %82, label %83, label %85

83:                                               ; preds = %58
  %84 = call i32 (ptr, ...) @printf(ptr noundef @.str.12)
  br label %85

85:                                               ; preds = %83, %58
  %86 = load ptr, ptr %4, align 8, !tbaa !9
  %87 = getelementptr inbounds %struct.Dump, ptr %86, i32 0, i32 8
  %88 = load ptr, ptr %87, align 8, !tbaa !17
  %89 = load ptr, ptr %4, align 8, !tbaa !9
  %90 = getelementptr inbounds %struct.Dump, ptr %89, i32 0, i32 7
  %91 = load i64, ptr %90, align 8, !tbaa !16
  %92 = getelementptr inbounds i8, ptr %88, i64 %91
  store i8 0, ptr %92, align 1, !tbaa !19
  %93 = load i32, ptr %3, align 4, !tbaa !5
  %94 = load ptr, ptr %4, align 8, !tbaa !9
  %95 = getelementptr inbounds %struct.Dump, ptr %94, i32 0, i32 6
  store i32 %93, ptr %95, align 4, !tbaa !20
  %96 = load ptr, ptr %4, align 8, !tbaa !9
  call void @find_sections(ptr noundef %96)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #7
  ret void
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nounwind allocsize(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 = { 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 #4 = { 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 #5 = { 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 #6 = { noreturn nounwind }
attributes #7 = { nounwind }
attributes #8 = { nounwind allocsize(0) }

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


; 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.10 = external hidden unnamed_addr constant [56 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [66 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [12 x i8], align 1

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #0

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

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

; Function Attrs: nofree nounwind
declare noundef i64 @fread(ptr nocapture noundef, i64 noundef, i64 noundef, ptr nocapture noundef) local_unnamed_addr #1

; Function Attrs: nofree nounwind
declare noundef i32 @fseek(ptr nocapture noundef, i64 noundef, i32 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local void @jump_to_frame(i32 noundef %0, ptr noundef %1) local_unnamed_addr #4 {
  %3 = getelementptr inbounds i8, ptr %1, i64 20
  %4 = load i32, ptr %3, align 4, !tbaa !5
  %.not = icmp sgt i32 %4, %0
  br i1 %.not, label %7, label %5

5:                                                ; preds = %2
  %6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.10, i32 noundef %0, i32 noundef %4)
  tail call void @exit(i32 noundef 1) #5
  unreachable

7:                                                ; preds = %2
  %8 = getelementptr inbounds i8, ptr %1, i64 24
  %9 = load ptr, ptr %8, align 8, !tbaa !12
  %10 = sext i32 %0 to i64
  %11 = getelementptr i64, ptr %9, i64 %10
  %12 = getelementptr i8, ptr %11, i64 8
  %13 = load i64, ptr %12, align 8, !tbaa !13
  %14 = load i64, ptr %11, align 8, !tbaa !13
  %15 = sub nsw i64 %13, %14
  %16 = getelementptr inbounds i8, ptr %1, i64 40
  store i64 %15, ptr %16, align 8, !tbaa !14
  %17 = getelementptr inbounds i8, ptr %1, i64 48
  %18 = load ptr, ptr %17, align 8, !tbaa !15
  tail call void @free(ptr noundef %18) #6
  %19 = load i64, ptr %16, align 8, !tbaa !14
  %20 = add nsw i64 %19, 1
  %21 = tail call noalias ptr @malloc(i64 noundef %20) #7
  store ptr %21, ptr %17, align 8, !tbaa !15
  %22 = icmp eq ptr %21, null
  br i1 %22, label %23, label %25

23:                                               ; preds = %7
  %24 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.11, i64 noundef %20)
  tail call void @exit(i32 noundef 1) #5
  unreachable

25:                                               ; preds = %7
  %26 = getelementptr inbounds i8, ptr %1, i64 8
  %27 = load ptr, ptr %26, align 8, !tbaa !16
  %28 = load ptr, ptr %8, align 8, !tbaa !12
  %29 = getelementptr inbounds i64, ptr %28, i64 %10
  %30 = load i64, ptr %29, align 8, !tbaa !13
  %31 = tail call i32 @fseek(ptr noundef %27, i64 noundef %30, i32 noundef 0)
  %32 = load ptr, ptr %17, align 8, !tbaa !15
  %33 = load i64, ptr %16, align 8, !tbaa !14
  %34 = load ptr, ptr %26, align 8, !tbaa !16
  %35 = tail call i64 @fread(ptr noundef %32, i64 noundef 1, i64 noundef %33, ptr noundef %34)
  %36 = and i64 %35, 4294967295
  %37 = icmp eq i64 %36, 0
  br i1 %37, label %38, label %40

38:                                               ; preds = %25
  %39 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.12)
  br label %40

40:                                               ; preds = %38, %25
  %41 = load ptr, ptr %17, align 8, !tbaa !15
  %42 = load i64, ptr %16, align 8, !tbaa !14
  %43 = getelementptr inbounds i8, ptr %41, i64 %42
  store i8 0, ptr %43, align 1, !tbaa !17
  %44 = getelementptr inbounds i8, ptr %1, i64 36
  store i32 %0, ptr %44, align 4, !tbaa !18
  tail call void @find_sections(ptr noundef nonnull %1)
  ret void
}

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

attributes #0 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(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 #1 = { 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 #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 = { mustprogress nounwind willreturn allockind("free") 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 #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(0) }

!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, !10, i64 20}
!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 24}
!13 = !{!11, !11, i64 0}
!14 = !{!6, !11, i64 40}
!15 = !{!6, !7, i64 48}
!16 = !{!6, !7, i64 8}
!17 = !{!8, !8, i64 0}
!18 = !{!6, !10, i64 36}


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