; LLVM IR from seppo0010/rlite :: src (dump)

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

; Function Attrs: nounwind uwtable
define dso_local i32 @rl_dump(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef %3, ptr noundef %4) #0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i64, align 8
  %13 = alloca i8, align 1
  %14 = alloca ptr, align 8
  %15 = alloca i64, align 8
  store ptr %0, ptr %6, align 8, !tbaa !5
  store ptr %1, ptr %7, align 8, !tbaa !5
  store i64 %2, ptr %8, align 8, !tbaa !9
  store ptr %3, ptr %9, align 8, !tbaa !5
  store ptr %4, ptr %10, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.start.p0(i64 1, ptr %13) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  store ptr null, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %16 = load ptr, ptr %6, align 8, !tbaa !5
  %17 = load ptr, ptr %7, align 8, !tbaa !5
  %18 = load i64, ptr %8, align 8, !tbaa !9
  %19 = call i32 @rl_key_get(ptr noundef %16, ptr noundef %17, i64 noundef %18, ptr noundef %13, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef null)
  store i32 %19, ptr %11, align 4, !tbaa !11
  %20 = load i32, ptr %11, align 4, !tbaa !11
  %21 = icmp ne i32 2, %20
  br i1 %21, label %22, label %23

22:                                               ; preds = %5
  br label %114

23:                                               ; preds = %5
  %24 = load i8, ptr %13, align 1, !tbaa !13
  %25 = zext i8 %24 to i32
  %26 = icmp eq i32 %25, 84
  br i1 %26, label %27, label %36

27:                                               ; preds = %23
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = load ptr, ptr %7, align 8, !tbaa !5
  %30 = load i64, ptr %8, align 8, !tbaa !9
  %31 = call i32 @rl_dump_string(ptr noundef %28, ptr noundef %29, i64 noundef %30, ptr noundef %14, ptr noundef %15)
  store i32 %31, ptr %11, align 4, !tbaa !11
  %32 = load i32, ptr %11, align 4, !tbaa !11
  %33 = icmp ne i32 0, %32
  br i1 %33, label %34, label %35

34:                                               ; preds = %27
  br label %114

35:                                               ; preds = %27
  br label %93

36:                                               ; preds = %23
  %37 = load i8, ptr %13, align 1, !tbaa !13
  %38 = zext i8 %37 to i32
  %39 = icmp eq i32 %38, 76
  br i1 %39, label %40, label %49

40:                                               ; preds = %36
  %41 = load ptr, ptr %6, align 8, !tbaa !5
  %42 = load ptr, ptr %7, align 8, !tbaa !5
  %43 = load i64, ptr %8, align 8, !tbaa !9
  %44 = call i32 @rl_dump_list(ptr noundef %41, ptr noundef %42, i64 noundef %43, ptr noundef %14, ptr noundef %15)
  store i32 %44, ptr %11, align 4, !tbaa !11
  %45 = load i32, ptr %11, align 4, !tbaa !11
  %46 = icmp ne i32 0, %45
  br i1 %46, label %47, label %48

47:                                               ; preds = %40
  br label %114

48:                                               ; preds = %40
  br label %92

49:                                               ; preds = %36
  %50 = load i8, ptr %13, align 1, !tbaa !13
  %51 = zext i8 %50 to i32
  %52 = icmp eq i32 %51, 83
  br i1 %52, label %53, label %62

53:                                               ; preds = %49
  %54 = load ptr, ptr %6, align 8, !tbaa !5
  %55 = load ptr, ptr %7, align 8, !tbaa !5
  %56 = load i64, ptr %8, align 8, !tbaa !9
  %57 = call i32 @rl_dump_set(ptr noundef %54, ptr noundef %55, i64 noundef %56, ptr noundef %14, ptr noundef %15)
  store i32 %57, ptr %11, align 4, !tbaa !11
  %58 = load i32, ptr %11, align 4, !tbaa !11
  %59 = icmp ne i32 0, %58
  br i1 %59, label %60, label %61

60:                                               ; preds = %53
  br label %114

61:                                               ; preds = %53
  br label %91

62:                                               ; preds = %49
  %63 = load i8, ptr %13, align 1, !tbaa !13
  %64 = zext i8 %63 to i32
  %65 = icmp eq i32 %64, 90
  br i1 %65, label %66, label %75

66:                                               ; preds = %62
  %67 = load ptr, ptr %6, align 8, !tbaa !5
  %68 = load ptr, ptr %7, align 8, !tbaa !5
  %69 = load i64, ptr %8, align 8, !tbaa !9
  %70 = call i32 @rl_dump_zset(ptr noundef %67, ptr noundef %68, i64 noundef %69, ptr noundef %14, ptr noundef %15)
  store i32 %70, ptr %11, align 4, !tbaa !11
  %71 = load i32, ptr %11, align 4, !tbaa !11
  %72 = icmp ne i32 0, %71
  br i1 %72, label %73, label %74

73:                                               ; preds = %66
  br label %114

74:                                               ; preds = %66
  br label %90

75:                                               ; preds = %62
  %76 = load i8, ptr %13, align 1, !tbaa !13
  %77 = zext i8 %76 to i32
  %78 = icmp eq i32 %77, 72
  br i1 %78, label %79, label %88

79:                                               ; preds = %75
  %80 = load ptr, ptr %6, align 8, !tbaa !5
  %81 = load ptr, ptr %7, align 8, !tbaa !5
  %82 = load i64, ptr %8, align 8, !tbaa !9
  %83 = call i32 @rl_dump_hash(ptr noundef %80, ptr noundef %81, i64 noundef %82, ptr noundef %14, ptr noundef %15)
  store i32 %83, ptr %11, align 4, !tbaa !11
  %84 = load i32, ptr %11, align 4, !tbaa !11
  %85 = icmp ne i32 0, %84
  br i1 %85, label %86, label %87

86:                                               ; preds = %79
  br label %114

87:                                               ; preds = %79
  br label %89

88:                                               ; preds = %75
  store i32 6, ptr %11, align 4, !tbaa !11
  br label %114

89:                                               ; preds = %87
  br label %90

90:                                               ; preds = %89, %74
  br label %91

91:                                               ; preds = %90, %61
  br label %92

92:                                               ; preds = %91, %48
  br label %93

93:                                               ; preds = %92, %35
  %94 = load ptr, ptr %14, align 8, !tbaa !5
  %95 = load i64, ptr %15, align 8, !tbaa !9
  %96 = add nsw i64 %95, 1
  store i64 %96, ptr %15, align 8, !tbaa !9
  %97 = getelementptr inbounds i8, ptr %94, i64 %95
  store i8 6, ptr %97, align 1, !tbaa !13
  %98 = load ptr, ptr %14, align 8, !tbaa !5
  %99 = load i64, ptr %15, align 8, !tbaa !9
  %100 = add nsw i64 %99, 1
  store i64 %100, ptr %15, align 8, !tbaa !9
  %101 = getelementptr inbounds i8, ptr %98, i64 %99
  store i8 0, ptr %101, align 1, !tbaa !13
  %102 = load ptr, ptr %14, align 8, !tbaa !5
  %103 = load i64, ptr %15, align 8, !tbaa !9
  %104 = call i64 @rl_crc64(i64 noundef 0, ptr noundef %102, i64 noundef %103)
  store i64 %104, ptr %12, align 8, !tbaa !9
  %105 = load ptr, ptr %14, align 8, !tbaa !5
  %106 = load i64, ptr %15, align 8, !tbaa !9
  %107 = getelementptr inbounds i8, ptr %105, i64 %106
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %107, ptr align 8 %12, i64 8, i1 false)
  %108 = load i64, ptr %15, align 8, !tbaa !9
  %109 = add nsw i64 %108, 8
  store i64 %109, ptr %15, align 8, !tbaa !9
  %110 = load ptr, ptr %14, align 8, !tbaa !5
  %111 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %110, ptr %111, align 8, !tbaa !5
  %112 = load i64, ptr %15, align 8, !tbaa !9
  %113 = load ptr, ptr %10, align 8, !tbaa !5
  store i64 %112, ptr %113, align 8, !tbaa !9
  store i32 0, ptr %11, align 4, !tbaa !11
  br label %114

114:                                              ; preds = %93, %88, %86, %73, %60, %47, %34, %22
  %115 = load i32, ptr %11, align 4, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  ret i32 %115
}

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

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

; Function Attrs: nounwind uwtable
declare hidden i32 @rl_dump_string(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @rl_dump_list(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @rl_dump_set(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @rl_dump_zset(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) #0

; Function Attrs: nounwind uwtable
declare hidden i32 @rl_dump_hash(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) #0

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!7, !7, i64 0}


; 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 i32 @rl_dump(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr nocapture noundef writeonly %3, ptr nocapture noundef writeonly %4) local_unnamed_addr #0 {
  %6 = alloca i8, align 1
  %7 = alloca ptr, align 8
  %8 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %6) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #3
  store ptr null, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #3
  %9 = call i32 @rl_key_get(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef nonnull %6, ptr noundef null, ptr noundef null, ptr noundef null, ptr noundef null) #3
  %.not = icmp eq i32 %9, 2
  br i1 %.not, label %10, label %40

10:                                               ; preds = %5
  %11 = load i8, ptr %6, align 1, !tbaa !9
  switch i8 %11, label %40 [
    i8 84, label %12
    i8 76, label %14
    i8 83, label %16
    i8 90, label %18
    i8 72, label %20
  ]

12:                                               ; preds = %10
  %13 = call i32 @rl_dump_string(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef nonnull %7, ptr noundef nonnull %8)
  %.not37 = icmp eq i32 %13, 0
  br i1 %.not37, label %22, label %40

14:                                               ; preds = %10
  %15 = call i32 @rl_dump_list(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef nonnull %7, ptr noundef nonnull %8)
  %.not36 = icmp eq i32 %15, 0
  br i1 %.not36, label %22, label %40

16:                                               ; preds = %10
  %17 = call i32 @rl_dump_set(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef nonnull %7, ptr noundef nonnull %8)
  %.not35 = icmp eq i32 %17, 0
  br i1 %.not35, label %22, label %40

18:                                               ; preds = %10
  %19 = call i32 @rl_dump_zset(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef nonnull %7, ptr noundef nonnull %8)
  %.not34 = icmp eq i32 %19, 0
  br i1 %.not34, label %22, label %40

20:                                               ; preds = %10
  %21 = call i32 @rl_dump_hash(ptr noundef %0, ptr noundef %1, i64 noundef %2, ptr noundef nonnull %7, ptr noundef nonnull %8)
  %.not33 = icmp eq i32 %21, 0
  br i1 %.not33, label %22, label %40

22:                                               ; preds = %14, %18, %20, %16, %12
  %23 = load ptr, ptr %7, align 8, !tbaa !5
  %24 = load i64, ptr %8, align 8, !tbaa !10
  %25 = add nsw i64 %24, 1
  store i64 %25, ptr %8, align 8, !tbaa !10
  %26 = getelementptr inbounds i8, ptr %23, i64 %24
  store i8 6, ptr %26, align 1, !tbaa !9
  %27 = load ptr, ptr %7, align 8, !tbaa !5
  %28 = load i64, ptr %8, align 8, !tbaa !10
  %29 = add nsw i64 %28, 1
  store i64 %29, ptr %8, align 8, !tbaa !10
  %30 = getelementptr inbounds i8, ptr %27, i64 %28
  store i8 0, ptr %30, align 1, !tbaa !9
  %31 = load ptr, ptr %7, align 8, !tbaa !5
  %32 = load i64, ptr %8, align 8, !tbaa !10
  %33 = call i64 @rl_crc64(i64 noundef 0, ptr noundef %31, i64 noundef %32) #3
  %34 = load ptr, ptr %7, align 8, !tbaa !5
  %35 = load i64, ptr %8, align 8, !tbaa !10
  %36 = getelementptr inbounds i8, ptr %34, i64 %35
  store i64 %33, ptr %36, align 1
  %37 = load i64, ptr %8, align 8, !tbaa !10
  %38 = add nsw i64 %37, 8
  %39 = load ptr, ptr %7, align 8, !tbaa !5
  store ptr %39, ptr %3, align 8, !tbaa !5
  store i64 %38, ptr %4, align 8, !tbaa !10
  br label %40

40:                                               ; preds = %10, %20, %18, %16, %14, %12, %5, %22
  %.0 = phi i32 [ %9, %5 ], [ %13, %12 ], [ 0, %22 ], [ %15, %14 ], [ %17, %16 ], [ %19, %18 ], [ %21, %20 ], [ 6, %10 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #3
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %6) #3
  ret i32 %.0
}

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

declare i32 @rl_key_get(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare hidden i32 @rl_dump_string(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @rl_dump_list(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @rl_dump_set(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @rl_dump_zset(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
declare hidden i32 @rl_dump_hash(ptr noundef, ptr noundef, i64 noundef, ptr noundef, ptr noundef) local_unnamed_addr #0

declare i64 @rl_crc64(i64 noundef, ptr noundef, i64 noundef) local_unnamed_addr #2

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

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!7, !7, i64 0}
!10 = !{!11, !11, i64 0}
!11 = !{!"long", !7, i64 0}


; Effective O3 passes: DSEPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass