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

; 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_pipebase_vfptr = type { ptr, ptr }
%struct.nn_sinproc = type { %struct.nn_fsm, i32, i32, ptr, %struct.nn_pipebase, %struct.nn_msgqueue, %struct.nn_msg, %struct.nn_fsm_event, %struct.nn_fsm_event, %struct.nn_fsm_event, %struct.nn_fsm_event, %struct.nn_list_item }
%struct.nn_fsm = type { ptr, ptr, i32, i32, ptr, ptr, ptr, %struct.nn_fsm_event }
%struct.nn_pipebase = type { %struct.nn_fsm, ptr, i8, i8, i8, ptr, ptr, %struct.nn_fsm_event, %struct.nn_fsm_event, %struct.nn_ep_options }
%struct.nn_ep_options = type { i32, i32, i32 }
%struct.nn_msgqueue = type { %struct.anon, %struct.anon.0, i64, i64, i64, ptr }
%struct.anon = type { ptr, i32 }
%struct.anon.0 = type { ptr, i32 }
%struct.nn_msg = type { %struct.nn_chunkref, %struct.nn_chunkref, %struct.nn_chunkref }
%struct.nn_chunkref = type { %union.anon }
%union.anon = type { ptr, [24 x i8] }
%struct.nn_fsm_event = type { ptr, i32, ptr, i32, %struct.nn_queue_item }
%struct.nn_queue_item = type { ptr }
%struct.nn_list_item = type { ptr, ptr }

@nn_sinproc_pipebase_vfptr = external dso_local constant %struct.nn_pipebase_vfptr, align 8
@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [30 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [128 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @nn_sinproc_init(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3) #0 {
  %5 = alloca ptr, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca i64, align 8
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i32 %1, ptr %6, align 4, !tbaa !9
  store ptr %2, ptr %7, align 8, !tbaa !5
  store ptr %3, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %11 = load ptr, ptr %5, align 8, !tbaa !5
  %12 = getelementptr inbounds %struct.nn_sinproc, ptr %11, i32 0, i32 0
  %13 = load i32, ptr %6, align 4, !tbaa !9
  %14 = load ptr, ptr %5, align 8, !tbaa !5
  %15 = load ptr, ptr %8, align 8, !tbaa !5
  call void @nn_fsm_init(ptr noundef %12, ptr noundef @nn_sinproc_handler, ptr noundef @nn_sinproc_shutdown, i32 noundef %13, ptr noundef %14, ptr noundef %15)
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = getelementptr inbounds %struct.nn_sinproc, ptr %16, i32 0, i32 1
  store i32 1, ptr %17, align 8, !tbaa !11
  %18 = load ptr, ptr %5, align 8, !tbaa !5
  %19 = getelementptr inbounds %struct.nn_sinproc, ptr %18, i32 0, i32 2
  store i32 0, ptr %19, align 4, !tbaa !24
  %20 = load ptr, ptr %5, align 8, !tbaa !5
  %21 = getelementptr inbounds %struct.nn_sinproc, ptr %20, i32 0, i32 3
  store ptr null, ptr %21, align 8, !tbaa !25
  %22 = load ptr, ptr %5, align 8, !tbaa !5
  %23 = getelementptr inbounds %struct.nn_sinproc, ptr %22, i32 0, i32 4
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  call void @nn_pipebase_init(ptr noundef %23, ptr noundef @nn_sinproc_pipebase_vfptr, ptr noundef %24)
  store i64 4, ptr %10, align 8, !tbaa !26
  %25 = load ptr, ptr %7, align 8, !tbaa !5
  call void @nn_ep_getopt(ptr noundef %25, i32 noundef 0, i32 noundef 3, ptr noundef %9, ptr noundef %10)
  br label %26

26:                                               ; preds = %4
  %27 = load i64, ptr %10, align 8, !tbaa !26
  %28 = icmp eq i64 %27, 4
  %29 = xor i1 %28, true
  %30 = zext i1 %29 to i32
  %31 = sext i32 %30 to i64
  %32 = call i64 @llvm.expect.i64(i64 %31, i64 0)
  %33 = icmp ne i64 %32, 0
  br i1 %33, label %34, label %39

34:                                               ; preds = %26
  call void @nn_backtrace_print()
  %35 = load ptr, ptr @stderr, align 8, !tbaa !5
  %36 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %35, ptr noundef @.str, ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 79) #6
  %37 = load ptr, ptr @stderr, align 8, !tbaa !5
  %38 = call i32 @fflush(ptr noundef %37)
  call void @nn_err_abort() #7
  unreachable

39:                                               ; preds = %26
  br label %40

40:                                               ; preds = %39
  br label %41

41:                                               ; preds = %40
  %42 = load ptr, ptr %5, align 8, !tbaa !5
  %43 = getelementptr inbounds %struct.nn_sinproc, ptr %42, i32 0, i32 5
  %44 = load i32, ptr %9, align 4, !tbaa !9
  %45 = sext i32 %44 to i64
  call void @nn_msgqueue_init(ptr noundef %43, i64 noundef %45)
  %46 = load ptr, ptr %5, align 8, !tbaa !5
  %47 = getelementptr inbounds %struct.nn_sinproc, ptr %46, i32 0, i32 6
  call void @nn_msg_init(ptr noundef %47, i64 noundef 0)
  %48 = load ptr, ptr %5, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.nn_sinproc, ptr %48, i32 0, i32 7
  call void @nn_fsm_event_init(ptr noundef %49)
  %50 = load ptr, ptr %5, align 8, !tbaa !5
  %51 = getelementptr inbounds %struct.nn_sinproc, ptr %50, i32 0, i32 8
  call void @nn_fsm_event_init(ptr noundef %51)
  %52 = load ptr, ptr %5, align 8, !tbaa !5
  %53 = getelementptr inbounds %struct.nn_sinproc, ptr %52, i32 0, i32 9
  call void @nn_fsm_event_init(ptr noundef %53)
  %54 = load ptr, ptr %5, align 8, !tbaa !5
  %55 = getelementptr inbounds %struct.nn_sinproc, ptr %54, i32 0, i32 10
  call void @nn_fsm_event_init(ptr noundef %55)
  %56 = load ptr, ptr %5, align 8, !tbaa !5
  %57 = getelementptr inbounds %struct.nn_sinproc, ptr %56, i32 0, i32 11
  call void @nn_list_item_init(ptr noundef %57)
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  ret void
}

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

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

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

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

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

declare void @nn_ep_getopt(ptr noundef, i32 noundef, i32 noundef, ptr noundef, ptr 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_msgqueue_init(ptr noundef, i64 noundef) #2

declare void @nn_msg_init(ptr noundef, i64 noundef) #2

declare void @nn_fsm_event_init(ptr noundef) #2

declare void @nn_list_item_init(ptr noundef) #2

; 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, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 88}
!12 = !{!"nn_sinproc", !13, i64 0, !10, i64 88, !10, i64 92, !6, i64 96, !16, i64 104, !18, i64 320, !21, i64 384, !14, i64 480, !14, i64 520, !14, i64 560, !14, i64 600, !23, i64 640}
!13 = !{!"nn_fsm", !6, i64 0, !6, i64 8, !10, i64 16, !10, i64 20, !6, i64 24, !6, i64 32, !6, i64 40, !14, i64 48}
!14 = !{!"nn_fsm_event", !6, i64 0, !10, i64 8, !6, i64 16, !10, i64 24, !15, i64 32}
!15 = !{!"nn_queue_item", !6, i64 0}
!16 = !{!"nn_pipebase", !13, i64 0, !6, i64 88, !7, i64 96, !7, i64 97, !7, i64 98, !6, i64 104, !6, i64 112, !14, i64 120, !14, i64 160, !17, i64 200}
!17 = !{!"nn_ep_options", !10, i64 0, !10, i64 4, !10, i64 8}
!18 = !{!"nn_msgqueue", !19, i64 0, !19, i64 16, !20, i64 32, !20, i64 40, !20, i64 48, !6, i64 56}
!19 = !{!"", !6, i64 0, !10, i64 8}
!20 = !{!"long", !7, i64 0}
!21 = !{!"nn_msg", !22, i64 0, !22, i64 32, !22, i64 64}
!22 = !{!"nn_chunkref", !7, i64 0}
!23 = !{!"nn_list_item", !6, i64 0, !6, i64 8}
!24 = !{!12, !10, i64 92}
!25 = !{!12, !6, i64 96}
!26 = !{!20, !20, 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"

%struct.nn_pipebase_vfptr = type { ptr, ptr }

@nn_sinproc_pipebase_vfptr = external dso_local constant %struct.nn_pipebase_vfptr, align 8
@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [30 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [128 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local void @nn_sinproc_init(ptr noundef %0, i32 noundef %1, ptr noundef %2, ptr noundef %3) local_unnamed_addr #0 {
  %5 = alloca i32, align 4
  %6 = alloca i64, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #5
  tail call void @nn_fsm_init(ptr noundef %0, ptr noundef nonnull @nn_sinproc_handler, ptr noundef nonnull @nn_sinproc_shutdown, i32 noundef %1, ptr noundef %0, ptr noundef %3) #5
  %7 = getelementptr inbounds i8, ptr %0, i64 88
  store i32 1, ptr %7, align 8, !tbaa !5
  %8 = getelementptr inbounds i8, ptr %0, i64 92
  store i32 0, ptr %8, align 4, !tbaa !22
  %9 = getelementptr inbounds i8, ptr %0, i64 96
  store ptr null, ptr %9, align 8, !tbaa !23
  %10 = getelementptr inbounds i8, ptr %0, i64 104
  tail call void @nn_pipebase_init(ptr noundef nonnull %10, ptr noundef nonnull @nn_sinproc_pipebase_vfptr, ptr noundef %2) #5
  store i64 4, ptr %6, align 8, !tbaa !24
  call void @nn_ep_getopt(ptr noundef %2, i32 noundef 0, i32 noundef 3, ptr noundef nonnull %5, ptr noundef nonnull %6) #5
  %11 = load i64, ptr %6, align 8, !tbaa !24
  %.not = icmp eq i64 %11, 4
  br i1 %.not, label %17, label %12, !prof !25

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

17:                                               ; preds = %4
  %18 = getelementptr inbounds i8, ptr %0, i64 320
  %19 = load i32, ptr %5, align 4, !tbaa !27
  %20 = sext i32 %19 to i64
  call void @nn_msgqueue_init(ptr noundef nonnull %18, i64 noundef %20) #5
  %21 = getelementptr inbounds i8, ptr %0, i64 384
  call void @nn_msg_init(ptr noundef nonnull %21, i64 noundef 0) #5
  %22 = getelementptr inbounds i8, ptr %0, i64 480
  call void @nn_fsm_event_init(ptr noundef nonnull %22) #5
  %23 = getelementptr inbounds i8, ptr %0, i64 520
  call void @nn_fsm_event_init(ptr noundef nonnull %23) #5
  %24 = getelementptr inbounds i8, ptr %0, i64 560
  call void @nn_fsm_event_init(ptr noundef nonnull %24) #5
  %25 = getelementptr inbounds i8, ptr %0, i64 600
  call void @nn_fsm_event_init(ptr noundef nonnull %25) #5
  %26 = getelementptr inbounds i8, ptr %0, i64 640
  call void @nn_list_item_init(ptr noundef nonnull %26) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  ret void
}

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

declare void @nn_fsm_init(ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

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

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

declare void @nn_pipebase_init(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @nn_ep_getopt(ptr noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @nn_backtrace_print() local_unnamed_addr #2

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

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

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

declare void @nn_msgqueue_init(ptr noundef, i64 noundef) local_unnamed_addr #2

declare void @nn_msg_init(ptr noundef, i64 noundef) local_unnamed_addr #2

declare void @nn_fsm_event_init(ptr noundef) local_unnamed_addr #2

declare void @nn_list_item_init(ptr 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 = { 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 #4 = { 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 #5 = { nounwind }
attributes #6 = { cold nounwind }
attributes #7 = { 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 = !{!6, !11, i64 88}
!6 = !{!"nn_sinproc", !7, i64 0, !11, i64 88, !11, i64 92, !8, i64 96, !14, i64 104, !16, i64 320, !19, i64 384, !12, i64 480, !12, i64 520, !12, i64 560, !12, i64 600, !21, i64 640}
!7 = !{!"nn_fsm", !8, i64 0, !8, i64 8, !11, i64 16, !11, i64 20, !8, i64 24, !8, i64 32, !8, i64 40, !12, i64 48}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C/C++ TBAA"}
!11 = !{!"int", !9, i64 0}
!12 = !{!"nn_fsm_event", !8, i64 0, !11, i64 8, !8, i64 16, !11, i64 24, !13, i64 32}
!13 = !{!"nn_queue_item", !8, i64 0}
!14 = !{!"nn_pipebase", !7, i64 0, !8, i64 88, !9, i64 96, !9, i64 97, !9, i64 98, !8, i64 104, !8, i64 112, !12, i64 120, !12, i64 160, !15, i64 200}
!15 = !{!"nn_ep_options", !11, i64 0, !11, i64 4, !11, i64 8}
!16 = !{!"nn_msgqueue", !17, i64 0, !17, i64 16, !18, i64 32, !18, i64 40, !18, i64 48, !8, i64 56}
!17 = !{!"", !8, i64 0, !11, i64 8}
!18 = !{!"long", !9, i64 0}
!19 = !{!"nn_msg", !20, i64 0, !20, i64 32, !20, i64 64}
!20 = !{!"nn_chunkref", !9, i64 0}
!21 = !{!"nn_list_item", !8, i64 0, !8, i64 8}
!22 = !{!6, !11, i64 92}
!23 = !{!6, !8, i64 96}
!24 = !{!18, !18, i64 0}
!25 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!26 = !{!8, !8, i64 0}
!27 = !{!11, !11, i64 0}


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