; LLVM IR from goldshtn/shmemq-blog :: shmemq (shmemq_new)

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

%union.pthread_mutexattr_t = type { i32 }
%struct._shmemq = type { i64, i32, i64, ptr, i32, i64, ptr }
%struct.shmemq_info = type { %union.pthread_mutex_t, i64, i64, [1 x i8] }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }

@.str = external hidden unnamed_addr constant [36 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local ptr @shmemq_new(ptr noundef %0, i64 noundef %1, i32 noundef %2) #0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i8, align 1
  %10 = alloca %union.pthread_mutexattr_t, align 4
  %11 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store i64 %1, ptr %6, align 8, !tbaa !9
  store i32 %2, ptr %7, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.start.p0(i64 1, ptr %9) #6
  %12 = call noalias ptr @malloc(i64 noundef 56) #7
  store ptr %12, ptr %8, align 8, !tbaa !5
  %13 = load i64, ptr %6, align 8, !tbaa !9
  %14 = load ptr, ptr %8, align 8, !tbaa !5
  %15 = getelementptr inbounds %struct._shmemq, ptr %14, i32 0, i32 0
  store i64 %13, ptr %15, align 8, !tbaa !13
  %16 = load i32, ptr %7, align 4, !tbaa !11
  %17 = load ptr, ptr %8, align 8, !tbaa !5
  %18 = getelementptr inbounds %struct._shmemq, ptr %17, i32 0, i32 1
  store i32 %16, ptr %18, align 8, !tbaa !15
  %19 = load i64, ptr %6, align 8, !tbaa !9
  %20 = load i32, ptr %7, align 4, !tbaa !11
  %21 = zext i32 %20 to i64
  %22 = mul i64 %19, %21
  %23 = load ptr, ptr %8, align 8, !tbaa !5
  %24 = getelementptr inbounds %struct._shmemq, ptr %23, i32 0, i32 2
  store i64 %22, ptr %24, align 8, !tbaa !16
  %25 = load ptr, ptr %5, align 8, !tbaa !5
  %26 = call noalias ptr @strdup(ptr noundef %25) #6
  %27 = load ptr, ptr %8, align 8, !tbaa !5
  %28 = getelementptr inbounds %struct._shmemq, ptr %27, i32 0, i32 3
  store ptr %26, ptr %28, align 8, !tbaa !17
  %29 = load ptr, ptr %8, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct._shmemq, ptr %29, i32 0, i32 2
  %31 = load i64, ptr %30, align 8, !tbaa !16
  %32 = add i64 %31, 64
  %33 = sub i64 %32, 1
  %34 = load ptr, ptr %8, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct._shmemq, ptr %34, i32 0, i32 5
  store i64 %33, ptr %35, align 8, !tbaa !18
  store i8 0, ptr %9, align 1, !tbaa !19
  %36 = load ptr, ptr %5, align 8, !tbaa !5
  %37 = call i32 @shm_open(ptr noundef %36, i32 noundef 2, i32 noundef 384)
  %38 = load ptr, ptr %8, align 8, !tbaa !5
  %39 = getelementptr inbounds %struct._shmemq, ptr %38, i32 0, i32 4
  store i32 %37, ptr %39, align 8, !tbaa !21
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct._shmemq, ptr %40, i32 0, i32 4
  %42 = load i32, ptr %41, align 8, !tbaa !21
  %43 = icmp eq i32 %42, -1
  br i1 %43, label %44, label %61

44:                                               ; preds = %3
  %45 = call ptr @__errno_location() #8
  %46 = load i32, ptr %45, align 4, !tbaa !11
  %47 = icmp eq i32 %46, 2
  br i1 %47, label %48, label %59

48:                                               ; preds = %44
  %49 = load ptr, ptr %5, align 8, !tbaa !5
  %50 = call i32 @shm_open(ptr noundef %49, i32 noundef 66, i32 noundef 384)
  %51 = load ptr, ptr %8, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct._shmemq, ptr %51, i32 0, i32 4
  store i32 %50, ptr %52, align 8, !tbaa !21
  %53 = load ptr, ptr %8, align 8, !tbaa !5
  %54 = getelementptr inbounds %struct._shmemq, ptr %53, i32 0, i32 4
  %55 = load i32, ptr %54, align 8, !tbaa !21
  %56 = icmp eq i32 %55, -1
  br i1 %56, label %57, label %58

57:                                               ; preds = %48
  br label %116

58:                                               ; preds = %48
  store i8 1, ptr %9, align 1, !tbaa !19
  br label %60

59:                                               ; preds = %44
  br label %116

60:                                               ; preds = %58
  br label %61

61:                                               ; preds = %60, %3
  %62 = load ptr, ptr %5, align 8, !tbaa !5
  %63 = load i8, ptr %9, align 1, !tbaa !19, !range !22, !noundef !23
  %64 = trunc i8 %63 to i1
  %65 = zext i1 %64 to i32
  %66 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef %62, i32 noundef %65)
  %67 = load i8, ptr %9, align 1, !tbaa !19, !range !22, !noundef !23
  %68 = trunc i8 %67 to i1
  br i1 %68, label %69, label %79

69:                                               ; preds = %61
  %70 = load ptr, ptr %8, align 8, !tbaa !5
  %71 = getelementptr inbounds %struct._shmemq, ptr %70, i32 0, i32 4
  %72 = load i32, ptr %71, align 8, !tbaa !21
  %73 = load ptr, ptr %8, align 8, !tbaa !5
  %74 = getelementptr inbounds %struct._shmemq, ptr %73, i32 0, i32 5
  %75 = load i64, ptr %74, align 8, !tbaa !18
  %76 = call i32 @ftruncate(i32 noundef %72, i64 noundef %75) #6
  %77 = icmp eq i32 -1, %76
  br i1 %77, label %78, label %79

78:                                               ; preds = %69
  br label %116

79:                                               ; preds = %69, %61
  %80 = load ptr, ptr %8, align 8, !tbaa !5
  %81 = getelementptr inbounds %struct._shmemq, ptr %80, i32 0, i32 5
  %82 = load i64, ptr %81, align 8, !tbaa !18
  %83 = load ptr, ptr %8, align 8, !tbaa !5
  %84 = getelementptr inbounds %struct._shmemq, ptr %83, i32 0, i32 4
  %85 = load i32, ptr %84, align 8, !tbaa !21
  %86 = call ptr @mmap(ptr noundef null, i64 noundef %82, i32 noundef 3, i32 noundef 1, i32 noundef %85, i64 noundef 0) #6
  %87 = load ptr, ptr %8, align 8, !tbaa !5
  %88 = getelementptr inbounds %struct._shmemq, ptr %87, i32 0, i32 6
  store ptr %86, ptr %88, align 8, !tbaa !24
  %89 = load ptr, ptr %8, align 8, !tbaa !5
  %90 = getelementptr inbounds %struct._shmemq, ptr %89, i32 0, i32 6
  %91 = load ptr, ptr %90, align 8, !tbaa !24
  %92 = icmp eq ptr %91, inttoptr (i64 -1 to ptr)
  br i1 %92, label %93, label %94

93:                                               ; preds = %79
  br label %116

94:                                               ; preds = %79
  %95 = load i8, ptr %9, align 1, !tbaa !19, !range !22, !noundef !23
  %96 = trunc i8 %95 to i1
  br i1 %96, label %97, label %114

97:                                               ; preds = %94
  %98 = load ptr, ptr %8, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct._shmemq, ptr %98, i32 0, i32 6
  %100 = load ptr, ptr %99, align 8, !tbaa !24
  %101 = getelementptr inbounds %struct.shmemq_info, ptr %100, i32 0, i32 2
  store i64 0, ptr %101, align 8, !tbaa !25
  %102 = load ptr, ptr %8, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct._shmemq, ptr %102, i32 0, i32 6
  %104 = load ptr, ptr %103, align 8, !tbaa !24
  %105 = getelementptr inbounds %struct.shmemq_info, ptr %104, i32 0, i32 1
  store i64 0, ptr %105, align 8, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  %106 = call i32 @pthread_mutexattr_init(ptr noundef %10) #6
  %107 = call i32 @pthread_mutexattr_setpshared(ptr noundef %10, i32 noundef 1) #6
  %108 = load ptr, ptr %8, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct._shmemq, ptr %108, i32 0, i32 6
  %110 = load ptr, ptr %109, align 8, !tbaa !24
  %111 = getelementptr inbounds %struct.shmemq_info, ptr %110, i32 0, i32 0
  %112 = call i32 @pthread_mutex_init(ptr noundef %111, ptr noundef %10) #6
  %113 = call i32 @pthread_mutexattr_destroy(ptr noundef %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %114

114:                                              ; preds = %97, %94
  %115 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %115, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %135

116:                                              ; preds = %93, %78, %59, %57
  %117 = load ptr, ptr %8, align 8, !tbaa !5
  %118 = getelementptr inbounds %struct._shmemq, ptr %117, i32 0, i32 4
  %119 = load i32, ptr %118, align 8, !tbaa !21
  %120 = icmp ne i32 %119, -1
  br i1 %120, label %121, label %130

121:                                              ; preds = %116
  %122 = load ptr, ptr %8, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct._shmemq, ptr %122, i32 0, i32 4
  %124 = load i32, ptr %123, align 8, !tbaa !21
  %125 = call i32 @close(i32 noundef %124)
  %126 = load ptr, ptr %8, align 8, !tbaa !5
  %127 = getelementptr inbounds %struct._shmemq, ptr %126, i32 0, i32 3
  %128 = load ptr, ptr %127, align 8, !tbaa !17
  %129 = call i32 @shm_unlink(ptr noundef %128)
  br label %130

130:                                              ; preds = %121, %116
  %131 = load ptr, ptr %8, align 8, !tbaa !5
  %132 = getelementptr inbounds %struct._shmemq, ptr %131, i32 0, i32 3
  %133 = load ptr, ptr %132, align 8, !tbaa !17
  call void @free(ptr noundef %133) #6
  %134 = load ptr, ptr %8, align 8, !tbaa !5
  call void @free(ptr noundef %134) #6
  store ptr null, ptr %4, align 8
  store i32 1, ptr %11, align 4
  br label %135

135:                                              ; preds = %130, %114
  call void @llvm.lifetime.end.p0(i64 1, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  %136 = load ptr, ptr %4, align 8
  ret ptr %136
}

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

; Function Attrs: nounwind allocsize(0)
declare noalias ptr @malloc(i64 noundef) #2

; Function Attrs: nounwind
declare noalias ptr @strdup(ptr noundef) #3

declare i32 @shm_open(ptr noundef, i32 noundef, i32 noundef) #4

; Function Attrs: nounwind willreturn memory(none)
declare ptr @__errno_location() #5

declare i32 @printf(ptr noundef, ...) #4

; Function Attrs: nounwind
declare i32 @ftruncate(i32 noundef, i64 noundef) #3

; Function Attrs: nounwind
declare ptr @mmap(ptr noundef, i64 noundef, i32 noundef, i32 noundef, i32 noundef, i64 noundef) #3

; Function Attrs: nounwind
declare i32 @pthread_mutexattr_init(ptr noundef) #3

; Function Attrs: nounwind
declare i32 @pthread_mutexattr_setpshared(ptr noundef, i32 noundef) #3

; Function Attrs: nounwind
declare i32 @pthread_mutex_init(ptr noundef, ptr noundef) #3

; Function Attrs: nounwind
declare i32 @pthread_mutexattr_destroy(ptr noundef) #3

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

declare i32 @close(i32 noundef) #4

declare i32 @shm_unlink(ptr noundef) #4

; Function Attrs: nounwind
declare void @free(ptr noundef) #3

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 = { nounwind allocsize(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 "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 = { "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 willreturn memory(none) "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 = { nounwind allocsize(0) }
attributes #8 = { nounwind willreturn memory(none) }

!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 = !{!14, !10, i64 0}
!14 = !{!"_shmemq", !10, i64 0, !12, i64 8, !10, i64 16, !6, i64 24, !12, i64 32, !10, i64 40, !6, i64 48}
!15 = !{!14, !12, i64 8}
!16 = !{!14, !10, i64 16}
!17 = !{!14, !6, i64 24}
!18 = !{!14, !10, i64 40}
!19 = !{!20, !20, i64 0}
!20 = !{!"_Bool", !7, i64 0}
!21 = !{!14, !12, i64 32}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = !{!14, !6, i64 48}
!25 = !{!26, !10, i64 48}
!26 = !{!"shmemq_info", !7, i64 0, !10, i64 40, !10, i64 48, !7, i64 56}
!27 = !{!26, !10, i64 40}


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

%union.pthread_mutexattr_t = type { i32 }

@.str = external hidden unnamed_addr constant [36 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noalias noundef ptr @shmemq_new(ptr noundef %0, i64 noundef %1, i32 noundef %2) local_unnamed_addr #0 {
  %4 = alloca %union.pthread_mutexattr_t, align 4
  %5 = tail call noalias dereferenceable_or_null(56) ptr @malloc(i64 noundef 56) #10
  store i64 %1, ptr %5, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %5, i64 8
  store i32 %2, ptr %6, align 8, !tbaa !12
  %7 = zext i32 %2 to i64
  %8 = mul i64 %7, %1
  %9 = getelementptr inbounds i8, ptr %5, i64 16
  store i64 %8, ptr %9, align 8, !tbaa !13
  %10 = tail call noalias ptr @strdup(ptr noundef %0) #11
  %11 = getelementptr inbounds i8, ptr %5, i64 24
  store ptr %10, ptr %11, align 8, !tbaa !14
  %12 = add i64 %8, 63
  %13 = getelementptr inbounds i8, ptr %5, i64 40
  store i64 %12, ptr %13, align 8, !tbaa !15
  %14 = tail call i32 @shm_open(ptr noundef %0, i32 noundef 2, i32 noundef 384) #11
  %15 = getelementptr inbounds i8, ptr %5, i64 32
  store i32 %14, ptr %15, align 8, !tbaa !16
  %16 = icmp eq i32 %14, -1
  br i1 %16, label %17, label %.thread41

17:                                               ; preds = %3
  %18 = tail call ptr @__errno_location() #12
  %19 = load i32, ptr %18, align 4, !tbaa !17
  %20 = icmp eq i32 %19, 2
  br i1 %20, label %21, label %.thread

21:                                               ; preds = %17
  %22 = tail call i32 @shm_open(ptr noundef %0, i32 noundef 66, i32 noundef 384) #11
  store i32 %22, ptr %15, align 8, !tbaa !16
  %23 = icmp eq i32 %22, -1
  br i1 %23, label %.thread, label %24

24:                                               ; preds = %21
  %25 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef %0, i32 noundef 1)
  %26 = tail call i32 @ftruncate(i32 noundef %22, i64 noundef %12) #11
  %27 = icmp eq i32 %26, -1
  br i1 %27, label %43, label %28

28:                                               ; preds = %24
  %29 = tail call ptr @mmap(ptr noundef null, i64 noundef %12, i32 noundef 3, i32 noundef 1, i32 noundef %22, i64 noundef 0) #11
  %30 = getelementptr inbounds i8, ptr %5, i64 48
  store ptr %29, ptr %30, align 8, !tbaa !18
  %31 = icmp eq ptr %29, inttoptr (i64 -1 to ptr)
  br i1 %31, label %43, label %36

.thread41:                                        ; preds = %3
  %32 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef %0, i32 noundef 0)
  %33 = tail call ptr @mmap(ptr noundef null, i64 noundef %12, i32 noundef 3, i32 noundef 1, i32 noundef %14, i64 noundef 0) #11
  %34 = getelementptr inbounds i8, ptr %5, i64 48
  store ptr %33, ptr %34, align 8, !tbaa !18
  %35 = icmp eq ptr %33, inttoptr (i64 -1 to ptr)
  br i1 %35, label %43, label %.thread42

36:                                               ; preds = %28
  br i1 %16, label %37, label %.thread42

37:                                               ; preds = %36
  %38 = getelementptr inbounds i8, ptr %29, i64 40
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %38, i8 0, i64 16, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #11
  %39 = call i32 @pthread_mutexattr_init(ptr noundef nonnull %4) #11
  %40 = call i32 @pthread_mutexattr_setpshared(ptr noundef nonnull %4, i32 noundef 1) #11
  %41 = call i32 @pthread_mutex_init(ptr noundef %29, ptr noundef nonnull %4) #11
  %42 = call i32 @pthread_mutexattr_destroy(ptr noundef nonnull %4) #11
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #11
  br label %.thread42

43:                                               ; preds = %28, %.thread41, %24
  %.ph = phi i32 [ %22, %24 ], [ %14, %.thread41 ], [ %22, %28 ]
  %44 = tail call i32 @close(i32 noundef %.ph) #11
  %45 = tail call i32 @shm_unlink(ptr noundef %10) #11
  br label %.thread

.thread:                                          ; preds = %17, %21, %43
  tail call void @free(ptr noundef %10) #11
  tail call void @free(ptr noundef nonnull %5) #11
  br label %.thread42

.thread42:                                        ; preds = %.thread41, %36, %37, %.thread
  %.036 = phi ptr [ null, %.thread ], [ %5, %37 ], [ %5, %36 ], [ %5, %.thread41 ]
  ret ptr %.036
}

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

; Function Attrs: mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite)
declare noalias noundef ptr @malloc(i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite)
declare noalias ptr @strdup(ptr nocapture noundef readonly) local_unnamed_addr #3

declare i32 @shm_open(ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nofree nosync nounwind willreturn memory(none)
declare ptr @__errno_location() local_unnamed_addr #5

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

; Function Attrs: nounwind
declare i32 @ftruncate(i32 noundef, i64 noundef) local_unnamed_addr #7

; Function Attrs: nounwind
declare ptr @mmap(ptr noundef, i64 noundef, i32 noundef, i32 noundef, i32 noundef, i64 noundef) local_unnamed_addr #7

; Function Attrs: nounwind
declare i32 @pthread_mutexattr_init(ptr noundef) local_unnamed_addr #7

; Function Attrs: nounwind
declare i32 @pthread_mutexattr_setpshared(ptr noundef, i32 noundef) local_unnamed_addr #7

; Function Attrs: nounwind
declare i32 @pthread_mutex_init(ptr noundef, ptr noundef) local_unnamed_addr #7

; Function Attrs: nounwind
declare i32 @pthread_mutexattr_destroy(ptr noundef) local_unnamed_addr #7

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

declare i32 @close(i32 noundef) local_unnamed_addr #4

declare i32 @shm_unlink(ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite)
declare void @free(ptr allocptr nocapture noundef) local_unnamed_addr #8

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

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 = { mustprogress nofree nounwind willreturn allockind("alloc,uninitialized") allocsize(0) memory(inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { mustprogress nofree nounwind willreturn memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 = { "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 = { mustprogress nofree nosync nounwind willreturn memory(none) "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 = { 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 #7 = { 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 #8 = { mustprogress nounwind willreturn allockind("free") memory(argmem: readwrite, inaccessiblemem: readwrite) "alloc-family"="malloc" "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 #9 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #10 = { nounwind allocsize(0) }
attributes #11 = { nounwind }
attributes #12 = { nounwind willreturn memory(none) }

!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 = !{!"_shmemq", !7, i64 0, !10, i64 8, !7, i64 16, !11, i64 24, !10, i64 32, !7, i64 40, !11, i64 48}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!"any pointer", !8, i64 0}
!12 = !{!6, !10, i64 8}
!13 = !{!6, !7, i64 16}
!14 = !{!6, !11, i64 24}
!15 = !{!6, !7, i64 40}
!16 = !{!6, !10, i64 32}
!17 = !{!10, !10, i64 0}
!18 = !{!6, !11, i64 48}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass