; LLVM IR from jingweizhanghuai/Morn :: test (test_map)

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

@.str.49 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.51 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [5 x i8], align 1
@__const.test4.b = external hidden unnamed_addr constant [4 x i8], align 1

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

declare ptr @mMapCreate(...) #1

declare ptr @m_MapWrite(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef) #1

declare ptr @m_MapRead(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef) #1

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

declare void @mMapRelease(ptr noundef) #1

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #2

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #3

; Function Attrs: nounwind uwtable
define dso_local void @test4() #4 {
  %1 = alloca ptr, align 8
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca [4 x i8], align 1
  %5 = alloca i32, align 4
  %6 = alloca float, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %1) #5
  %7 = call ptr (...) @mMapCreate()
  store ptr %7, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #5
  store ptr @.str.53, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 1, ptr %3, align 4, !tbaa !9
  %8 = load ptr, ptr %1, align 8, !tbaa !5
  %9 = load ptr, ptr %2, align 8, !tbaa !5
  %10 = load ptr, ptr %2, align 8, !tbaa !5
  %11 = call i64 @strlen(ptr noundef %10) #6
  %12 = trunc i64 %11 to i32
  %13 = call ptr @m_MapWrite(ptr noundef %8, ptr noundef %9, i32 noundef %12, ptr noundef %3, i32 noundef 4)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 1 %4, ptr align 1 @__const.test4.b, i64 4, i1 false)
  store i32 2, ptr %3, align 4, !tbaa !9
  %14 = load ptr, ptr %1, align 8, !tbaa !5
  %15 = getelementptr inbounds [4 x i8], ptr %4, i64 0, i64 0
  %16 = call ptr @m_MapWrite(ptr noundef %14, ptr noundef %15, i32 noundef 4, ptr noundef %3, i32 noundef 4)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  store i32 1684234849, ptr %5, align 4, !tbaa !9
  store i32 3, ptr %3, align 4, !tbaa !9
  %17 = load ptr, ptr %1, align 8, !tbaa !5
  %18 = call ptr @m_MapWrite(ptr noundef %17, ptr noundef %5, i32 noundef 4, ptr noundef %3, i32 noundef 4)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  store float 0x448C6C4C20000000, ptr %6, align 4, !tbaa !11
  store i32 4, ptr %3, align 4, !tbaa !9
  %19 = load ptr, ptr %1, align 8, !tbaa !5
  %20 = call ptr @m_MapWrite(ptr noundef %19, ptr noundef %6, i32 noundef 4, ptr noundef %3, i32 noundef 4)
  %21 = load ptr, ptr %1, align 8, !tbaa !5
  %22 = load ptr, ptr %2, align 8, !tbaa !5
  %23 = load ptr, ptr %2, align 8, !tbaa !5
  %24 = call i64 @strlen(ptr noundef %23) #6
  %25 = trunc i64 %24 to i32
  %26 = call ptr @m_MapRead(ptr noundef %21, ptr noundef %22, i32 noundef %25, ptr noundef null, ptr noundef null)
  %27 = load i32, ptr %26, align 4, !tbaa !9
  %28 = call i32 (ptr, ...) @printf(ptr noundef @.str.52, i32 noundef %27)
  %29 = load ptr, ptr %1, align 8, !tbaa !5
  %30 = getelementptr inbounds [4 x i8], ptr %4, i64 0, i64 0
  %31 = call ptr @m_MapRead(ptr noundef %29, ptr noundef %30, i32 noundef 4, ptr noundef null, ptr noundef null)
  %32 = load i32, ptr %31, align 4, !tbaa !9
  %33 = call i32 (ptr, ...) @printf(ptr noundef @.str.51, i32 noundef %32)
  %34 = load ptr, ptr %1, align 8, !tbaa !5
  %35 = call ptr @m_MapRead(ptr noundef %34, ptr noundef %5, i32 noundef 4, ptr noundef null, ptr noundef null)
  %36 = load i32, ptr %35, align 4, !tbaa !9
  %37 = call i32 (ptr, ...) @printf(ptr noundef @.str.50, i32 noundef %36)
  %38 = load ptr, ptr %1, align 8, !tbaa !5
  %39 = call ptr @m_MapRead(ptr noundef %38, ptr noundef %6, i32 noundef 4, ptr noundef null, ptr noundef null)
  %40 = load i32, ptr %39, align 4, !tbaa !9
  %41 = call i32 (ptr, ...) @printf(ptr noundef @.str.49, i32 noundef %40)
  %42 = load ptr, ptr %1, align 8, !tbaa !5
  call void @mMapRelease(ptr noundef %42)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %1) #5
  ret void
}

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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { nounwind willreturn memory(read) "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 = { nounwind willreturn memory(read) }

!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, !12, i64 0}
!12 = !{!"float", !7, 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"

@.str.49 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.50 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.51 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.52 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.53 = external hidden unnamed_addr constant [5 x i8], align 1
@__const.test4.b = external hidden unnamed_addr constant [4 x i8], align 1

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

declare ptr @mMapCreate(...) local_unnamed_addr #1

declare ptr @m_MapWrite(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef) local_unnamed_addr #1

declare ptr @m_MapRead(ptr noundef, ptr noundef, i32 noundef, ptr noundef, ptr noundef) local_unnamed_addr #1

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

declare void @mMapRelease(ptr noundef) local_unnamed_addr #1

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

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #3

; Function Attrs: nounwind uwtable
define dso_local void @test4() local_unnamed_addr #4 {
  %1 = alloca i32, align 4
  %2 = alloca [4 x i8], align 4
  %3 = alloca i32, align 4
  %4 = alloca float, align 4
  %5 = tail call ptr (...) @mMapCreate() #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  store i32 1, ptr %1, align 4, !tbaa !5
  %6 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) @.str.53) #6
  %7 = trunc i64 %6 to i32
  %8 = call ptr @m_MapWrite(ptr noundef %5, ptr noundef nonnull @.str.53, i32 noundef %7, ptr noundef nonnull %1, i32 noundef 4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %9 = load i32, ptr @__const.test4.b, align 1
  store i32 %9, ptr %2, align 4
  store i32 2, ptr %1, align 4, !tbaa !5
  %10 = call ptr @m_MapWrite(ptr noundef %5, ptr noundef nonnull %2, i32 noundef 4, ptr noundef nonnull %1, i32 noundef 4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  store i32 1684234849, ptr %3, align 4, !tbaa !5
  store i32 3, ptr %1, align 4, !tbaa !5
  %11 = call ptr @m_MapWrite(ptr noundef %5, ptr noundef nonnull %3, i32 noundef 4, ptr noundef nonnull %1, i32 noundef 4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  store float 0x448C6C4C20000000, ptr %4, align 4, !tbaa !9
  store i32 4, ptr %1, align 4, !tbaa !5
  %12 = call ptr @m_MapWrite(ptr noundef %5, ptr noundef nonnull %4, i32 noundef 4, ptr noundef nonnull %1, i32 noundef 4) #5
  %13 = call ptr @m_MapRead(ptr noundef %5, ptr noundef nonnull @.str.53, i32 noundef %7, ptr noundef null, ptr noundef null) #5
  %14 = load i32, ptr %13, align 4, !tbaa !5
  %15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.52, i32 noundef %14)
  %16 = call ptr @m_MapRead(ptr noundef %5, ptr noundef nonnull %2, i32 noundef 4, ptr noundef null, ptr noundef null) #5
  %17 = load i32, ptr %16, align 4, !tbaa !5
  %18 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.51, i32 noundef %17)
  %19 = call ptr @m_MapRead(ptr noundef %5, ptr noundef nonnull %3, i32 noundef 4, ptr noundef null, ptr noundef null) #5
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.50, i32 noundef %20)
  %22 = call ptr @m_MapRead(ptr noundef %5, ptr noundef nonnull %4, i32 noundef 4, ptr noundef null, ptr noundef null) #5
  %23 = load i32, ptr %22, align 4, !tbaa !5
  %24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.49, i32 noundef %23)
  call void @mMapRelease(ptr noundef %5) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret void
}

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 = { 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 = { mustprogress nofree nounwind willreturn memory(argmem: read) "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 = { nounwind willreturn memory(read) }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"float", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,TailCallElimPass