; LLVM IR from godzilla-foundation/godzilla-community :: core/deps/nanomsg-1.1.5/src/transports/inproc (cinproc)

; 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.nn_ep_ops = type { ptr, ptr }
%struct.nn_cinproc = type { %struct.nn_fsm, i32, %struct.nn_ins_item, %struct.nn_list }
%struct.nn_fsm = type { ptr, ptr, i32, i32, ptr, ptr, ptr, %struct.nn_fsm_event }
%struct.nn_fsm_event = type { ptr, i32, ptr, i32, %struct.nn_queue_item }
%struct.nn_queue_item = type { ptr }
%struct.nn_ins_item = type { %struct.nn_list_item, ptr, i32 }
%struct.nn_list_item = type { ptr, ptr }
%struct.nn_list = type { ptr, ptr }

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [23 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [128 x i8], align 1
@nn_cinproc_ops = external hidden constant %struct.nn_ep_ops, align 8

; Function Attrs: nounwind uwtable
define dso_local i32 @nn_cinproc_create(ptr noundef %0) #0 {
  %2 = alloca ptr, align 8
  %3 = alloca ptr, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  %4 = call ptr @nn_alloc_(i64 noundef 144)
  store ptr %4, ptr %3, align 8, !tbaa !5
  br label %5

5:                                                ; preds = %1
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  %7 = icmp ne ptr %6, null
  %8 = xor i1 %7, true
  %9 = zext i1 %8 to i32
  %10 = sext i32 %9 to i64
  %11 = call i64 @llvm.expect.i64(i64 %10, i64 0)
  %12 = icmp ne i64 %11, 0
  br i1 %12, label %13, label %18

13:                                               ; preds = %5
  call void @nn_backtrace_print()
  %14 = load ptr, ptr @stderr, align 8, !tbaa !5
  %15 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %14, ptr noundef @.str, ptr noundef @.str.1, i32 noundef 65) #6
  %16 = load ptr, ptr @stderr, align 8, !tbaa !5
  %17 = call i32 @fflush(ptr noundef %16)
  call void @nn_err_abort() #7
  unreachable

18:                                               ; preds = %5
  br label %19

19:                                               ; preds = %18
  br label %20

20:                                               ; preds = %19
  %21 = load ptr, ptr %2, align 8, !tbaa !5
  %22 = load ptr, ptr %3, align 8, !tbaa !5
  call void @nn_ep_tran_setup(ptr noundef %21, ptr noundef @nn_cinproc_ops, ptr noundef %22)
  %23 = load ptr, ptr %3, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct.nn_cinproc, ptr %23, i32 0, i32 2
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  call void @nn_ins_item_init(ptr noundef %24, ptr noundef %25)
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.nn_cinproc, ptr %26, i32 0, i32 0
  %28 = load ptr, ptr %2, align 8, !tbaa !5
  %29 = call ptr @nn_ep_getctx(ptr noundef %28)
  call void @nn_fsm_init_root(ptr noundef %27, ptr noundef @nn_cinproc_handler, ptr noundef @nn_cinproc_shutdown, ptr noundef %29)
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.nn_cinproc, ptr %30, i32 0, i32 1
  store i32 1, ptr %31, align 8, !tbaa !9
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  %33 = getelementptr inbounds %struct.nn_cinproc, ptr %32, i32 0, i32 3
  call void @nn_list_init(ptr noundef %33)
  %34 = load ptr, ptr %2, align 8, !tbaa !5
  call void @nn_ep_stat_increment(ptr noundef %34, i32 noundef 202, i32 noundef 1)
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.nn_cinproc, ptr %35, i32 0, i32 0
  call void @nn_fsm_start(ptr noundef %36)
  %37 = load ptr, ptr %3, align 8, !tbaa !5
  %38 = getelementptr inbounds %struct.nn_cinproc, ptr %37, i32 0, i32 2
  call void @nn_ins_connect(ptr noundef %38, ptr noundef @nn_cinproc_connect)
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  ret i32 0
}

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

declare ptr @nn_alloc_(i64 noundef) #2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(none)
declare i64 @llvm.expect.i64(i64, i64) #3

declare void @nn_backtrace_print() #2

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, ptr noundef, ...) #4

declare i32 @fflush(ptr noundef) #2

; Function Attrs: noreturn
declare void @nn_err_abort() #5

declare void @nn_ep_tran_setup(ptr noundef, ptr noundef, ptr noundef) #2

declare void @nn_ins_item_init(ptr noundef, ptr noundef) #2

declare void @nn_fsm_init_root(ptr noundef, ptr noundef, ptr noundef, ptr noundef) #2

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

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

declare ptr @nn_ep_getctx(ptr noundef) #2

declare void @nn_list_init(ptr noundef) #2

declare void @nn_ep_stat_increment(ptr noundef, i32 noundef, i32 noundef) #2

declare void @nn_fsm_start(ptr noundef) #2

declare void @nn_ins_connect(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
declare hidden void @nn_cinproc_connect(ptr noundef, ptr noundef) #0

; 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 nosync nounwind willreturn memory(none) }
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 = { noreturn "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 = { nounwind }
attributes #7 = { noreturn }

!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, !12, i64 88}
!10 = !{!"nn_cinproc", !11, i64 0, !12, i64 88, !15, i64 96, !17, i64 128}
!11 = !{!"nn_fsm", !6, i64 0, !6, i64 8, !12, i64 16, !12, i64 20, !6, i64 24, !6, i64 32, !6, i64 40, !13, i64 48}
!12 = !{!"int", !7, i64 0}
!13 = !{!"nn_fsm_event", !6, i64 0, !12, i64 8, !6, i64 16, !12, i64 24, !14, i64 32}
!14 = !{!"nn_queue_item", !6, i64 0}
!15 = !{!"nn_ins_item", !16, i64 0, !6, i64 16, !12, i64 24}
!16 = !{!"nn_list_item", !6, i64 0, !6, i64 8}
!17 = !{!"nn_list", !6, i64 0, !6, i64 8}


; 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.nn_ep_ops = type { ptr, ptr }

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [23 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [128 x i8], align 1
@nn_cinproc_ops = external hidden constant %struct.nn_ep_ops, align 8

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @nn_cinproc_create(ptr noundef %0) local_unnamed_addr #0 {
  %2 = tail call ptr @nn_alloc_(i64 noundef 144) #4
  %.not = icmp eq ptr %2, null
  br i1 %.not, label %3, label %8, !prof !5

3:                                                ; preds = %1
  tail call void @nn_backtrace_print() #4
  %4 = load ptr, ptr @stderr, align 8, !tbaa !6
  %5 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %4, ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 65) #5
  %6 = load ptr, ptr @stderr, align 8, !tbaa !6
  %7 = tail call i32 @fflush(ptr noundef %6)
  tail call void @nn_err_abort() #6
  unreachable

8:                                                ; preds = %1
  tail call void @nn_ep_tran_setup(ptr noundef %0, ptr noundef nonnull @nn_cinproc_ops, ptr noundef nonnull %2) #4
  %9 = getelementptr inbounds i8, ptr %2, i64 96
  tail call void @nn_ins_item_init(ptr noundef nonnull %9, ptr noundef %0) #4
  %10 = tail call ptr @nn_ep_getctx(ptr noundef %0) #4
  tail call void @nn_fsm_init_root(ptr noundef nonnull %2, ptr noundef nonnull @nn_cinproc_handler, ptr noundef nonnull @nn_cinproc_shutdown, ptr noundef %10) #4
  %11 = getelementptr inbounds i8, ptr %2, i64 88
  store i32 1, ptr %11, align 8, !tbaa !10
  %12 = getelementptr inbounds i8, ptr %2, i64 128
  tail call void @nn_list_init(ptr noundef nonnull %12) #4
  tail call void @nn_ep_stat_increment(ptr noundef %0, i32 noundef 202, i32 noundef 1) #4
  tail call void @nn_fsm_start(ptr noundef nonnull %2) #4
  tail call void @nn_ins_connect(ptr noundef nonnull %9, ptr noundef nonnull @nn_cinproc_connect) #4
  ret i32 0
}

declare ptr @nn_alloc_(i64 noundef) local_unnamed_addr #1

declare void @nn_backtrace_print() local_unnamed_addr #1

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

; Function Attrs: nofree nounwind
declare noundef i32 @fflush(ptr nocapture noundef) local_unnamed_addr #2

; Function Attrs: noreturn
declare void @nn_err_abort() local_unnamed_addr #3

declare void @nn_ep_tran_setup(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @nn_ins_item_init(ptr noundef, ptr noundef) local_unnamed_addr #1

declare void @nn_fsm_init_root(ptr noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

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

declare ptr @nn_ep_getctx(ptr noundef) local_unnamed_addr #1

declare void @nn_list_init(ptr noundef) local_unnamed_addr #1

declare void @nn_ep_stat_increment(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1

declare void @nn_fsm_start(ptr noundef) local_unnamed_addr #1

declare void @nn_ins_connect(ptr noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: nounwind uwtable
declare hidden void @nn_cinproc_connect(ptr noundef, ptr noundef) #0

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 = { "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 = { 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 #3 = { noreturn "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 }
attributes #5 = { cold nounwind }
attributes #6 = { noreturn 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 = !{!"branch_weights", !"expected", i32 1, i32 2000}
!6 = !{!7, !7, i64 0}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!11, !13, i64 88}
!11 = !{!"nn_cinproc", !12, i64 0, !13, i64 88, !16, i64 96, !18, i64 128}
!12 = !{!"nn_fsm", !7, i64 0, !7, i64 8, !13, i64 16, !13, i64 20, !7, i64 24, !7, i64 32, !7, i64 40, !14, i64 48}
!13 = !{!"int", !8, i64 0}
!14 = !{!"nn_fsm_event", !7, i64 0, !13, i64 8, !7, i64 16, !13, i64 24, !15, i64 32}
!15 = !{!"nn_queue_item", !7, i64 0}
!16 = !{!"nn_ins_item", !17, i64 0, !7, i64 16, !13, i64 24}
!17 = !{!"nn_list_item", !7, i64 0, !7, i64 8}
!18 = !{!"nn_list", !7, i64 0, !7, i64 8}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,LowerExpectIntrinsicPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass