; 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_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 }

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [30 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [128 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [12 x i8], align 1

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

declare void @nn_backtrace_print() #1

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

declare i32 @fflush(ptr noundef) #1

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

declare void @nn_fsm_start(ptr noundef) #1

declare void @nn_fsm_raiseto(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) #1

; Function Attrs: nounwind uwtable
define dso_local void @nn_sinproc_accept(ptr noundef %0, ptr noundef %1) #4 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  br label %5

5:                                                ; preds = %2
  %6 = load ptr, ptr %3, align 8, !tbaa !5
  %7 = getelementptr inbounds %struct.nn_sinproc, ptr %6, i32 0, i32 3
  %8 = load ptr, ptr %7, align 8, !tbaa !9
  %9 = icmp ne ptr %8, null
  %10 = xor i1 %9, true
  %11 = xor i1 %10, true
  %12 = zext i1 %11 to i32
  %13 = sext i32 %12 to i64
  %14 = call i64 @llvm.expect.i64(i64 %13, i64 0)
  %15 = icmp ne i64 %14, 0
  br i1 %15, label %16, label %21

16:                                               ; preds = %5
  call void @nn_backtrace_print()
  %17 = load ptr, ptr @stderr, align 8, !tbaa !5
  %18 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %17, ptr noundef @.str, ptr noundef @.str.3, ptr noundef @.str.2, i32 noundef 118) #5
  %19 = load ptr, ptr @stderr, align 8, !tbaa !5
  %20 = call i32 @fflush(ptr noundef %19)
  call void @nn_err_abort() #6
  unreachable

21:                                               ; preds = %5
  br label %22

22:                                               ; preds = %21
  %23 = load ptr, ptr %4, align 8, !tbaa !5
  %24 = load ptr, ptr %3, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.nn_sinproc, ptr %24, i32 0, i32 3
  store ptr %23, ptr %25, align 8, !tbaa !9
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.nn_sinproc, ptr %26, i32 0, i32 0
  %28 = load ptr, ptr %4, align 8, !tbaa !5
  %29 = getelementptr inbounds %struct.nn_sinproc, ptr %28, i32 0, i32 0
  %30 = load ptr, ptr %3, align 8, !tbaa !5
  %31 = getelementptr inbounds %struct.nn_sinproc, ptr %30, i32 0, i32 7
  %32 = load ptr, ptr %3, align 8, !tbaa !5
  call void @nn_fsm_raiseto(ptr noundef %27, ptr noundef %29, ptr noundef %31, i32 noundef 27713, i32 noundef 2, ptr noundef %32)
  %33 = load ptr, ptr %3, align 8, !tbaa !5
  %34 = getelementptr inbounds %struct.nn_sinproc, ptr %33, i32 0, i32 0
  call void @nn_fsm_start(ptr noundef %34)
  %35 = load ptr, ptr %3, align 8, !tbaa !5
  %36 = getelementptr inbounds %struct.nn_sinproc, ptr %35, i32 0, i32 0
  call void @nn_fsm_action(ptr noundef %36, i32 noundef 1)
  ret void
}

declare void @nn_fsm_action(ptr noundef, i32 noundef) #1

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(none) }
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 "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 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 = { nounwind }
attributes #6 = { 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, !6, i64 96}
!10 = !{!"nn_sinproc", !11, i64 0, !12, i64 88, !12, i64 92, !6, i64 96, !15, i64 104, !17, i64 320, !20, i64 384, !13, i64 480, !13, i64 520, !13, i64 560, !13, i64 600, !22, i64 640}
!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_pipebase", !11, i64 0, !6, i64 88, !7, i64 96, !7, i64 97, !7, i64 98, !6, i64 104, !6, i64 112, !13, i64 120, !13, i64 160, !16, i64 200}
!16 = !{!"nn_ep_options", !12, i64 0, !12, i64 4, !12, i64 8}
!17 = !{!"nn_msgqueue", !18, i64 0, !18, i64 16, !19, i64 32, !19, i64 40, !19, i64 48, !6, i64 56}
!18 = !{!"", !6, i64 0, !12, i64 8}
!19 = !{!"long", !7, i64 0}
!20 = !{!"nn_msg", !21, i64 0, !21, i64 32, !21, i64 64}
!21 = !{!"nn_chunkref", !7, i64 0}
!22 = !{!"nn_list_item", !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"

@stderr = external local_unnamed_addr global ptr, align 8
@.str = external hidden unnamed_addr constant [30 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [128 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [12 x i8], align 1

declare void @nn_backtrace_print() local_unnamed_addr #0

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

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

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

declare void @nn_fsm_start(ptr noundef) local_unnamed_addr #0

declare void @nn_fsm_raiseto(ptr noundef, ptr noundef, ptr noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

; Function Attrs: nounwind uwtable
define dso_local void @nn_sinproc_accept(ptr noundef %0, ptr noundef %1) local_unnamed_addr #3 {
  %3 = getelementptr inbounds i8, ptr %0, i64 96
  %4 = load ptr, ptr %3, align 8, !tbaa !5
  %.not = icmp eq ptr %4, null
  br i1 %.not, label %10, label %5, !prof !22

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

10:                                               ; preds = %2
  store ptr %1, ptr %3, align 8, !tbaa !5
  %11 = getelementptr inbounds i8, ptr %0, i64 480
  tail call void @nn_fsm_raiseto(ptr noundef nonnull %0, ptr noundef %1, ptr noundef nonnull %11, i32 noundef 27713, i32 noundef 2, ptr noundef nonnull %0) #4
  tail call void @nn_fsm_start(ptr noundef nonnull %0) #4
  tail call void @nn_fsm_action(ptr noundef nonnull %0, i32 noundef 1) #4
  ret void
}

declare void @nn_fsm_action(ptr noundef, i32 noundef) local_unnamed_addr #0

attributes #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 = { 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 "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 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 #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 = !{!6, !8, i64 96}
!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 = !{!"branch_weights", !"expected", i32 2000, i32 1}
!23 = !{!8, !8, i64 0}


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