; LLVM IR from buzz-lang/Buzz :: src/testing (testbuzzdict)

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

@stdout = external global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [15 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

; Function Attrs: nounwind
declare i32 @fprintf(ptr noundef, 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: nounwind uwtable
declare dso_local void @di_print(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @di_hash(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @di_cmp(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca ptr, align 8
  %3 = alloca i16, align 2
  %4 = alloca float, align 4
  %5 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #4
  %6 = call ptr @buzzdict_new(i32 noundef 4, i32 noundef 2, i32 noundef 4, ptr noundef @di_hash, ptr noundef @di_cmp, ptr noundef null)
  store ptr %6, ptr %2, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 2, ptr %3) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  %7 = load ptr, ptr %2, align 8, !tbaa !5
  call void @di_print(ptr noundef %7)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  store i32 0, ptr %5, align 4, !tbaa !9
  br label %8

8:                                                ; preds = %26, %0
  %9 = load i32, ptr %5, align 4, !tbaa !9
  %10 = icmp slt i32 %9, 10
  br i1 %10, label %11, label %29

11:                                               ; preds = %8
  %12 = load i32, ptr %5, align 4, !tbaa !9
  %13 = trunc i32 %12 to i16
  store i16 %13, ptr %3, align 2, !tbaa !11
  %14 = load i16, ptr %3, align 2, !tbaa !11
  %15 = sext i16 %14 to i32
  %16 = sitofp i32 %15 to float
  %17 = fadd float 1.000000e+02, %16
  store float %17, ptr %4, align 4, !tbaa !13
  %18 = load ptr, ptr @stdout, align 8, !tbaa !5
  %19 = load i16, ptr %3, align 2, !tbaa !11
  %20 = sext i16 %19 to i32
  %21 = load float, ptr %4, align 4, !tbaa !13
  %22 = fpext float %21 to double
  %23 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %18, ptr noundef @.str.3, i32 noundef %20, double noundef %22) #4
  %24 = load ptr, ptr %2, align 8, !tbaa !5
  call void @buzzdict_set(ptr noundef %24, ptr noundef %3, ptr noundef %4)
  %25 = load ptr, ptr %2, align 8, !tbaa !5
  call void @di_print(ptr noundef %25)
  br label %26

26:                                               ; preds = %11
  %27 = load i32, ptr %5, align 4, !tbaa !9
  %28 = add nsw i32 %27, 1
  store i32 %28, ptr %5, align 4, !tbaa !9
  br label %8, !llvm.loop !15

29:                                               ; preds = %8
  store i16 5, ptr %3, align 2, !tbaa !11
  %30 = load i16, ptr %3, align 2, !tbaa !11
  %31 = sext i16 %30 to i32
  %32 = sitofp i32 %31 to float
  %33 = fadd float 2.000000e+02, %32
  store float %33, ptr %4, align 4, !tbaa !13
  %34 = load ptr, ptr @stdout, align 8, !tbaa !5
  %35 = load i16, ptr %3, align 2, !tbaa !11
  %36 = sext i16 %35 to i32
  %37 = load float, ptr %4, align 4, !tbaa !13
  %38 = fpext float %37 to double
  %39 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef @.str.4, i32 noundef %36, double noundef %38) #4
  %40 = load ptr, ptr %2, align 8, !tbaa !5
  call void @buzzdict_set(ptr noundef %40, ptr noundef %3, ptr noundef %4)
  %41 = load ptr, ptr %2, align 8, !tbaa !5
  call void @di_print(ptr noundef %41)
  store i16 10, ptr %3, align 2, !tbaa !11
  %42 = load i16, ptr %3, align 2, !tbaa !11
  %43 = sext i16 %42 to i32
  %44 = sitofp i32 %43 to float
  %45 = fadd float 2.000000e+02, %44
  store float %45, ptr %4, align 4, !tbaa !13
  %46 = load ptr, ptr @stdout, align 8, !tbaa !5
  %47 = load i16, ptr %3, align 2, !tbaa !11
  %48 = sext i16 %47 to i32
  %49 = load float, ptr %4, align 4, !tbaa !13
  %50 = fpext float %49 to double
  %51 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %46, ptr noundef @.str.4, i32 noundef %48, double noundef %50) #4
  %52 = load ptr, ptr %2, align 8, !tbaa !5
  call void @buzzdict_set(ptr noundef %52, ptr noundef %3, ptr noundef %4)
  %53 = load ptr, ptr %2, align 8, !tbaa !5
  call void @di_print(ptr noundef %53)
  store i16 4, ptr %3, align 2, !tbaa !11
  %54 = load ptr, ptr @stdout, align 8, !tbaa !5
  %55 = load i16, ptr %3, align 2, !tbaa !11
  %56 = sext i16 %55 to i32
  %57 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %54, ptr noundef @.str.5, i32 noundef %56) #4
  %58 = load ptr, ptr %2, align 8, !tbaa !5
  %59 = call i32 @buzzdict_remove(ptr noundef %58, ptr noundef %3)
  %60 = load ptr, ptr %2, align 8, !tbaa !5
  call void @di_print(ptr noundef %60)
  store i16 10, ptr %3, align 2, !tbaa !11
  %61 = load ptr, ptr @stdout, align 8, !tbaa !5
  %62 = load i16, ptr %3, align 2, !tbaa !11
  %63 = sext i16 %62 to i32
  %64 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %61, ptr noundef @.str.5, i32 noundef %63) #4
  %65 = load ptr, ptr %2, align 8, !tbaa !5
  %66 = call i32 @buzzdict_remove(ptr noundef %65, ptr noundef %3)
  %67 = load ptr, ptr %2, align 8, !tbaa !5
  call void @di_print(ptr noundef %67)
  call void @buzzdict_destroy(ptr noundef %2)
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr %3) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #4
  ret i32 0
}

declare ptr @buzzdict_new(i32 noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) #3

declare void @buzzdict_set(ptr noundef, ptr noundef, ptr noundef) #3

declare i32 @buzzdict_remove(ptr noundef, ptr noundef) #3

declare void @buzzdict_destroy(ptr noundef) #3

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

!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 = !{!"short", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"float", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}


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

@stdout = external local_unnamed_addr global ptr, align 8
@.str.3 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [15 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

; Function Attrs: nofree nounwind
declare noundef i32 @fprintf(ptr nocapture noundef, ptr nocapture noundef readonly, ...) 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: nounwind uwtable
declare dso_local void @di_print(ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @di_hash(ptr noundef) #2

; Function Attrs: nounwind uwtable
declare dso_local i32 @di_cmp(ptr noundef, ptr noundef) #2

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca ptr, align 8
  %2 = alloca i16, align 2
  %3 = alloca float, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #4
  %4 = tail call ptr @buzzdict_new(i32 noundef 4, i32 noundef 2, i32 noundef 4, ptr noundef nonnull @di_hash, ptr noundef nonnull @di_cmp, ptr noundef null) #4
  store ptr %4, ptr %1, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 2, ptr nonnull %2) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  tail call void @di_print(ptr noundef %4)
  store i16 0, ptr %2, align 2, !tbaa !9
  store float 1.000000e+02, ptr %3, align 4, !tbaa !11
  %5 = load ptr, ptr @stdout, align 8, !tbaa !5
  %6 = tail call i32 (ptr, ptr, ...) @fprintf(ptr noundef %5, ptr noundef nonnull @.str.3, i32 noundef 0, double noundef 1.000000e+02) #4
  call void @buzzdict_set(ptr noundef %4, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  call void @di_print(ptr noundef %4)
  store i16 1, ptr %2, align 2, !tbaa !9
  store float 1.010000e+02, ptr %3, align 4, !tbaa !11
  %7 = load ptr, ptr @stdout, align 8, !tbaa !5
  %8 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %7, ptr noundef nonnull @.str.3, i32 noundef 1, double noundef 1.010000e+02) #4
  call void @buzzdict_set(ptr noundef %4, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  call void @di_print(ptr noundef %4)
  store i16 2, ptr %2, align 2, !tbaa !9
  store float 1.020000e+02, ptr %3, align 4, !tbaa !11
  %9 = load ptr, ptr @stdout, align 8, !tbaa !5
  %10 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %9, ptr noundef nonnull @.str.3, i32 noundef 2, double noundef 1.020000e+02) #4
  call void @buzzdict_set(ptr noundef %4, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  call void @di_print(ptr noundef %4)
  store i16 3, ptr %2, align 2, !tbaa !9
  store float 1.030000e+02, ptr %3, align 4, !tbaa !11
  %11 = load ptr, ptr @stdout, align 8, !tbaa !5
  %12 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %11, ptr noundef nonnull @.str.3, i32 noundef 3, double noundef 1.030000e+02) #4
  call void @buzzdict_set(ptr noundef %4, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  call void @di_print(ptr noundef %4)
  store i16 4, ptr %2, align 2, !tbaa !9
  store float 1.040000e+02, ptr %3, align 4, !tbaa !11
  %13 = load ptr, ptr @stdout, align 8, !tbaa !5
  %14 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %13, ptr noundef nonnull @.str.3, i32 noundef 4, double noundef 1.040000e+02) #4
  call void @buzzdict_set(ptr noundef %4, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  call void @di_print(ptr noundef %4)
  store i16 5, ptr %2, align 2, !tbaa !9
  store float 1.050000e+02, ptr %3, align 4, !tbaa !11
  %15 = load ptr, ptr @stdout, align 8, !tbaa !5
  %16 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %15, ptr noundef nonnull @.str.3, i32 noundef 5, double noundef 1.050000e+02) #4
  call void @buzzdict_set(ptr noundef %4, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  call void @di_print(ptr noundef %4)
  store i16 6, ptr %2, align 2, !tbaa !9
  store float 1.060000e+02, ptr %3, align 4, !tbaa !11
  %17 = load ptr, ptr @stdout, align 8, !tbaa !5
  %18 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %17, ptr noundef nonnull @.str.3, i32 noundef 6, double noundef 1.060000e+02) #4
  call void @buzzdict_set(ptr noundef %4, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  call void @di_print(ptr noundef %4)
  store i16 7, ptr %2, align 2, !tbaa !9
  store float 1.070000e+02, ptr %3, align 4, !tbaa !11
  %19 = load ptr, ptr @stdout, align 8, !tbaa !5
  %20 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef nonnull @.str.3, i32 noundef 7, double noundef 1.070000e+02) #4
  call void @buzzdict_set(ptr noundef %4, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  call void @di_print(ptr noundef %4)
  store i16 8, ptr %2, align 2, !tbaa !9
  store float 1.080000e+02, ptr %3, align 4, !tbaa !11
  %21 = load ptr, ptr @stdout, align 8, !tbaa !5
  %22 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %21, ptr noundef nonnull @.str.3, i32 noundef 8, double noundef 1.080000e+02) #4
  call void @buzzdict_set(ptr noundef %4, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  call void @di_print(ptr noundef %4)
  store i16 9, ptr %2, align 2, !tbaa !9
  store float 1.090000e+02, ptr %3, align 4, !tbaa !11
  %23 = load ptr, ptr @stdout, align 8, !tbaa !5
  %24 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %23, ptr noundef nonnull @.str.3, i32 noundef 9, double noundef 1.090000e+02) #4
  call void @buzzdict_set(ptr noundef %4, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  call void @di_print(ptr noundef %4)
  store i16 5, ptr %2, align 2, !tbaa !9
  store float 2.050000e+02, ptr %3, align 4, !tbaa !11
  %25 = load ptr, ptr @stdout, align 8, !tbaa !5
  %26 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %25, ptr noundef nonnull @.str.4, i32 noundef 5, double noundef 2.050000e+02) #4
  call void @buzzdict_set(ptr noundef %4, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  call void @di_print(ptr noundef %4)
  store i16 10, ptr %2, align 2, !tbaa !9
  store float 2.100000e+02, ptr %3, align 4, !tbaa !11
  %27 = load ptr, ptr @stdout, align 8, !tbaa !5
  %28 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %27, ptr noundef nonnull @.str.4, i32 noundef 10, double noundef 2.100000e+02) #4
  call void @buzzdict_set(ptr noundef %4, ptr noundef nonnull %2, ptr noundef nonnull %3) #4
  call void @di_print(ptr noundef %4)
  store i16 4, ptr %2, align 2, !tbaa !9
  %29 = load ptr, ptr @stdout, align 8, !tbaa !5
  %30 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %29, ptr noundef nonnull @.str.5, i32 noundef 4) #4
  %31 = call i32 @buzzdict_remove(ptr noundef %4, ptr noundef nonnull %2) #4
  call void @di_print(ptr noundef %4)
  store i16 10, ptr %2, align 2, !tbaa !9
  %32 = load ptr, ptr @stdout, align 8, !tbaa !5
  %33 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %32, ptr noundef nonnull @.str.5, i32 noundef 10) #4
  %34 = call i32 @buzzdict_remove(ptr noundef %4, ptr noundef nonnull %2) #4
  call void @di_print(ptr noundef %4)
  call void @buzzdict_destroy(ptr noundef nonnull %1) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  call void @llvm.lifetime.end.p0(i64 2, ptr nonnull %2) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #4
  ret i32 0
}

declare ptr @buzzdict_new(i32 noundef, i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @buzzdict_set(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #3

declare i32 @buzzdict_remove(ptr noundef, ptr noundef) local_unnamed_addr #3

declare void @buzzdict_destroy(ptr noundef) local_unnamed_addr #3

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

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass