; LLVM IR from Water-Melon/Melon :: src (mln_http)

; 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.mln_hash_attr = type { ptr, ptr, ptr, ptr, i64, i8, ptr, ptr, ptr }
%struct.mln_tcp_conn_t = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32 }
%struct.mln_http_s = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i32, i32, i32, i32, i8 }

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

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

declare void @mln_alloc_free(ptr noundef) #1

declare ptr @mln_alloc_m(ptr noundef, i64 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local ptr @mln_http_init(ptr noundef %0, ptr noundef %1, ptr noundef %2) #2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca %struct.mln_hash_attr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store ptr %2, ptr %7, align 8, !tbaa !5
  %12 = load ptr, ptr %5, align 8, !tbaa !5
  %13 = icmp eq ptr %12, null
  br i1 %13, label %14, label %15

14:                                               ; preds = %3
  store ptr null, ptr %4, align 8
  br label %98

15:                                               ; preds = %3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.start.p0(i64 72, ptr %9) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.mln_tcp_conn_t, ptr %16, i32 0, i32 0
  %18 = load ptr, ptr %17, align 8, !tbaa !9
  store ptr %18, ptr %10, align 8, !tbaa !5
  %19 = load ptr, ptr %10, align 8, !tbaa !5
  %20 = icmp eq ptr %19, null
  br i1 %20, label %21, label %22

21:                                               ; preds = %15
  store ptr null, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %97

22:                                               ; preds = %15
  %23 = load ptr, ptr %10, align 8, !tbaa !5
  %24 = call ptr @mln_alloc_m(ptr noundef %23, i64 noundef 104)
  store ptr %24, ptr %8, align 8, !tbaa !5
  %25 = load ptr, ptr %8, align 8, !tbaa !5
  %26 = icmp eq ptr %25, null
  br i1 %26, label %27, label %28

27:                                               ; preds = %22
  store ptr null, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %97

28:                                               ; preds = %22
  %29 = load ptr, ptr %5, align 8, !tbaa !5
  %30 = load ptr, ptr %8, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.mln_http_s, ptr %30, i32 0, i32 0
  store ptr %29, ptr %31, align 8, !tbaa !12
  %32 = load ptr, ptr %10, align 8, !tbaa !5
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.mln_http_s, ptr %33, i32 0, i32 1
  store ptr %32, ptr %34, align 8, !tbaa !14
  %35 = load ptr, ptr %10, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.mln_hash_attr, ptr %9, i32 0, i32 6
  store ptr %35, ptr %36, align 8, !tbaa !15
  %37 = getelementptr inbounds %struct.mln_hash_attr, ptr %9, i32 0, i32 7
  store ptr @mln_alloc_m, ptr %37, align 8, !tbaa !18
  %38 = getelementptr inbounds %struct.mln_hash_attr, ptr %9, i32 0, i32 8
  store ptr @mln_alloc_free, ptr %38, align 8, !tbaa !19
  %39 = getelementptr inbounds %struct.mln_hash_attr, ptr %9, i32 0, i32 0
  store ptr @mln_http_hash_calc, ptr %39, align 8, !tbaa !20
  %40 = getelementptr inbounds %struct.mln_hash_attr, ptr %9, i32 0, i32 1
  store ptr @mln_http_hash_cmp, ptr %40, align 8, !tbaa !21
  %41 = getelementptr inbounds %struct.mln_hash_attr, ptr %9, i32 0, i32 2
  store ptr @mln_http_hash_free, ptr %41, align 8, !tbaa !22
  %42 = getelementptr inbounds %struct.mln_hash_attr, ptr %9, i32 0, i32 3
  store ptr @mln_http_hash_free, ptr %42, align 8, !tbaa !23
  %43 = getelementptr inbounds %struct.mln_hash_attr, ptr %9, i32 0, i32 4
  store i64 31, ptr %43, align 8, !tbaa !24
  %44 = getelementptr inbounds %struct.mln_hash_attr, ptr %9, i32 0, i32 5
  %45 = load i8, ptr %44, align 8
  %46 = and i8 %45, -2
  %47 = or i8 %46, 0
  store i8 %47, ptr %44, align 8
  %48 = getelementptr inbounds %struct.mln_hash_attr, ptr %9, i32 0, i32 5
  %49 = load i8, ptr %48, align 8
  %50 = and i8 %49, -3
  %51 = or i8 %50, 0
  store i8 %51, ptr %48, align 8
  %52 = call ptr @mln_hash_new(ptr noundef %9)
  %53 = load ptr, ptr %8, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct.mln_http_s, ptr %53, i32 0, i32 2
  store ptr %52, ptr %54, align 8, !tbaa !25
  %55 = load ptr, ptr %8, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.mln_http_s, ptr %55, i32 0, i32 2
  %57 = load ptr, ptr %56, align 8, !tbaa !25
  %58 = icmp eq ptr %57, null
  br i1 %58, label %59, label %61

59:                                               ; preds = %28
  %60 = load ptr, ptr %8, align 8, !tbaa !5
  call void @mln_alloc_free(ptr noundef %60)
  store ptr null, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %97

61:                                               ; preds = %28
  %62 = load ptr, ptr %8, align 8, !tbaa !5
  %63 = getelementptr inbounds %struct.mln_http_s, ptr %62, i32 0, i32 4
  store ptr null, ptr %63, align 8, !tbaa !26
  %64 = load ptr, ptr %8, align 8, !tbaa !5
  %65 = getelementptr inbounds %struct.mln_http_s, ptr %64, i32 0, i32 3
  store ptr null, ptr %65, align 8, !tbaa !27
  %66 = load ptr, ptr %7, align 8, !tbaa !5
  %67 = load ptr, ptr %8, align 8, !tbaa !5
  %68 = getelementptr inbounds %struct.mln_http_s, ptr %67, i32 0, i32 5
  store ptr %66, ptr %68, align 8, !tbaa !28
  %69 = load ptr, ptr %6, align 8, !tbaa !5
  %70 = load ptr, ptr %8, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct.mln_http_s, ptr %70, i32 0, i32 6
  store ptr %69, ptr %71, align 8, !tbaa !29
  %72 = load ptr, ptr %8, align 8, !tbaa !5
  %73 = getelementptr inbounds %struct.mln_http_s, ptr %72, i32 0, i32 7
  store ptr null, ptr %73, align 8, !tbaa !30
  %74 = load ptr, ptr %8, align 8, !tbaa !5
  %75 = getelementptr inbounds %struct.mln_http_s, ptr %74, i32 0, i32 8
  store ptr null, ptr %75, align 8, !tbaa !31
  %76 = load ptr, ptr %8, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.mln_http_s, ptr %76, i32 0, i32 9
  store ptr null, ptr %77, align 8, !tbaa !32
  %78 = load ptr, ptr %8, align 8, !tbaa !5
  %79 = getelementptr inbounds %struct.mln_http_s, ptr %78, i32 0, i32 10
  store i32 200, ptr %79, align 8, !tbaa !33
  %80 = load ptr, ptr %8, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct.mln_http_s, ptr %80, i32 0, i32 11
  store i32 200, ptr %81, align 4, !tbaa !34
  %82 = load ptr, ptr %8, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.mln_http_s, ptr %82, i32 0, i32 12
  store i32 0, ptr %83, align 8, !tbaa !35
  %84 = load ptr, ptr %8, align 8, !tbaa !5
  %85 = getelementptr inbounds %struct.mln_http_s, ptr %84, i32 0, i32 13
  store i32 0, ptr %85, align 4, !tbaa !36
  %86 = load ptr, ptr %8, align 8, !tbaa !5
  %87 = getelementptr inbounds %struct.mln_http_s, ptr %86, i32 0, i32 14
  %88 = load i8, ptr %87, align 8
  %89 = and i8 %88, -4
  %90 = or i8 %89, 0
  store i8 %90, ptr %87, align 8
  %91 = load ptr, ptr %8, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.mln_http_s, ptr %91, i32 0, i32 14
  %93 = load i8, ptr %92, align 8
  %94 = and i8 %93, -5
  %95 = or i8 %94, 0
  store i8 %95, ptr %92, align 8
  %96 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %96, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %97

97:                                               ; preds = %61, %59, %27, %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  call void @llvm.lifetime.end.p0(i64 72, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %98

98:                                               ; preds = %97, %14
  %99 = load ptr, ptr %4, align 8
  ret ptr %99
}

; Function Attrs: nounwind uwtable
declare hidden i64 @mln_http_hash_calc(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden i32 @mln_http_hash_cmp(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @mln_http_hash_free(ptr noundef) #2

declare ptr @mln_hash_new(ptr noundef) #1

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 0}
!10 = !{!"", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !11, i64 56}
!11 = !{!"int", !7, i64 0}
!12 = !{!13, !6, i64 0}
!13 = !{!"mln_http_s", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !6, i64 40, !6, i64 48, !6, i64 56, !6, i64 64, !6, i64 72, !11, i64 80, !11, i64 84, !11, i64 88, !11, i64 92, !11, i64 96, !11, i64 96}
!14 = !{!13, !6, i64 8}
!15 = !{!16, !6, i64 48}
!16 = !{!"mln_hash_attr", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !17, i64 32, !11, i64 40, !11, i64 40, !6, i64 48, !6, i64 56, !6, i64 64}
!17 = !{!"long", !7, i64 0}
!18 = !{!16, !6, i64 56}
!19 = !{!16, !6, i64 64}
!20 = !{!16, !6, i64 0}
!21 = !{!16, !6, i64 8}
!22 = !{!16, !6, i64 16}
!23 = !{!16, !6, i64 24}
!24 = !{!16, !17, i64 32}
!25 = !{!13, !6, i64 16}
!26 = !{!13, !6, i64 32}
!27 = !{!13, !6, i64 24}
!28 = !{!13, !6, i64 40}
!29 = !{!13, !6, i64 48}
!30 = !{!13, !6, i64 56}
!31 = !{!13, !6, i64 64}
!32 = !{!13, !6, i64 72}
!33 = !{!13, !11, i64 80}
!34 = !{!13, !11, i64 84}
!35 = !{!13, !11, i64 88}
!36 = !{!13, !11, i64 92}


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

%struct.mln_hash_attr = type { ptr, ptr, ptr, ptr, i64, i8, ptr, ptr, ptr }

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

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

declare void @mln_alloc_free(ptr noundef) #1

declare ptr @mln_alloc_m(ptr noundef, i64 noundef) #1

; Function Attrs: nounwind uwtable
define dso_local ptr @mln_http_init(ptr noundef %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #2 {
  %4 = alloca %struct.mln_hash_attr, align 8
  %5 = icmp eq ptr %0, null
  br i1 %5, label %36, label %6

6:                                                ; preds = %3
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %4) #4
  %7 = load ptr, ptr %0, align 8, !tbaa !5
  %8 = icmp eq ptr %7, null
  br i1 %8, label %35, label %9

9:                                                ; preds = %6
  %10 = tail call ptr @mln_alloc_m(ptr noundef nonnull %7, i64 noundef 104) #4
  %11 = icmp eq ptr %10, null
  br i1 %11, label %35, label %12

12:                                               ; preds = %9
  store ptr %0, ptr %10, align 8, !tbaa !11
  %13 = getelementptr inbounds i8, ptr %10, i64 8
  store ptr %7, ptr %13, align 8, !tbaa !13
  %14 = getelementptr inbounds i8, ptr %4, i64 48
  store ptr %7, ptr %14, align 8, !tbaa !14
  %15 = getelementptr inbounds i8, ptr %4, i64 56
  store ptr @mln_alloc_m, ptr %15, align 8, !tbaa !17
  %16 = getelementptr inbounds i8, ptr %4, i64 64
  store ptr @mln_alloc_free, ptr %16, align 8, !tbaa !18
  store ptr @mln_http_hash_calc, ptr %4, align 8, !tbaa !19
  %17 = getelementptr inbounds i8, ptr %4, i64 8
  store ptr @mln_http_hash_cmp, ptr %17, align 8, !tbaa !20
  %18 = getelementptr inbounds i8, ptr %4, i64 16
  store ptr @mln_http_hash_free, ptr %18, align 8, !tbaa !21
  %19 = getelementptr inbounds i8, ptr %4, i64 24
  store ptr @mln_http_hash_free, ptr %19, align 8, !tbaa !22
  %20 = getelementptr inbounds i8, ptr %4, i64 32
  store i64 31, ptr %20, align 8, !tbaa !23
  %21 = getelementptr inbounds i8, ptr %4, i64 40
  store i8 0, ptr %21, align 8
  %22 = call ptr @mln_hash_new(ptr noundef nonnull %4) #4
  %23 = getelementptr inbounds i8, ptr %10, i64 16
  store ptr %22, ptr %23, align 8, !tbaa !24
  %24 = icmp eq ptr %22, null
  br i1 %24, label %25, label %26

25:                                               ; preds = %12
  call void @mln_alloc_free(ptr noundef nonnull %10) #4
  br label %35

26:                                               ; preds = %12
  %27 = getelementptr inbounds i8, ptr %10, i64 24
  %28 = getelementptr inbounds i8, ptr %10, i64 40
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %27, i8 0, i64 16, i1 false)
  store ptr %2, ptr %28, align 8, !tbaa !25
  %29 = getelementptr inbounds i8, ptr %10, i64 48
  store ptr %1, ptr %29, align 8, !tbaa !26
  %30 = getelementptr inbounds i8, ptr %10, i64 56
  %31 = getelementptr inbounds i8, ptr %10, i64 80
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(24) %30, i8 0, i64 24, i1 false)
  store <4 x i32> <i32 200, i32 200, i32 0, i32 0>, ptr %31, align 8, !tbaa !27
  %32 = getelementptr inbounds i8, ptr %10, i64 96
  %33 = load i8, ptr %32, align 8
  %34 = and i8 %33, -8
  store i8 %34, ptr %32, align 8
  br label %35

35:                                               ; preds = %9, %6, %26, %25
  %.0 = phi ptr [ null, %25 ], [ %10, %26 ], [ null, %6 ], [ null, %9 ]
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %4) #4
  br label %36

36:                                               ; preds = %3, %35
  %.1 = phi ptr [ %.0, %35 ], [ null, %3 ]
  ret ptr %.1
}

; Function Attrs: nounwind uwtable
declare hidden i64 @mln_http_hash_calc(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden i32 @mln_http_hash_cmp(ptr noundef, ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @mln_http_hash_free(ptr noundef) #2

declare ptr @mln_hash_new(ptr noundef) local_unnamed_addr #1

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3

attributes #0 = { mustprogress 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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, !7, i64 0}
!6 = !{!"", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !10, i64 56}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!12, !7, i64 0}
!12 = !{!"mln_http_s", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !7, i64 32, !7, i64 40, !7, i64 48, !7, i64 56, !7, i64 64, !7, i64 72, !10, i64 80, !10, i64 84, !10, i64 88, !10, i64 92, !10, i64 96, !10, i64 96}
!13 = !{!12, !7, i64 8}
!14 = !{!15, !7, i64 48}
!15 = !{!"mln_hash_attr", !7, i64 0, !7, i64 8, !7, i64 16, !7, i64 24, !16, i64 32, !10, i64 40, !10, i64 40, !7, i64 48, !7, i64 56, !7, i64 64}
!16 = !{!"long", !8, i64 0}
!17 = !{!15, !7, i64 56}
!18 = !{!15, !7, i64 64}
!19 = !{!15, !7, i64 0}
!20 = !{!15, !7, i64 8}
!21 = !{!15, !7, i64 16}
!22 = !{!15, !7, i64 24}
!23 = !{!15, !16, i64 32}
!24 = !{!12, !7, i64 16}
!25 = !{!12, !7, i64 40}
!26 = !{!12, !7, i64 48}
!27 = !{!10, !10, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,MemCpyOptPass,SLPVectorizerPass,SROAPass,SimplifyCFGPass,TailCallElimPass