; LLVM IR from lionsoul2014/friso :: src (tst-array)

; 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.friso_array_entry = type { ptr, i32, i32 }

@__const.main.keys = external hidden unnamed_addr constant [19 x ptr], align 16
@.str.19 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @main(i32 noundef %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca [19 x ptr], align 16
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  store i32 0, ptr %3, align 4
  store i32 %0, ptr %4, align 4, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %11 = call ptr @new_array_list_with_opacity(i32 noundef 8)
  store ptr %11, ptr %6, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 152, ptr %7) #4
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %7, ptr align 16 @__const.main.keys, i64 152, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 2, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 19, ptr %10, align 4, !tbaa !5
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %12

12:                                               ; preds = %22, %2
  %13 = load i32, ptr %8, align 4, !tbaa !5
  %14 = load i32, ptr %10, align 4, !tbaa !5
  %15 = icmp slt i32 %13, %14
  br i1 %15, label %16, label %25

16:                                               ; preds = %12
  %17 = load ptr, ptr %6, align 8, !tbaa !9
  %18 = load i32, ptr %8, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [19 x ptr], ptr %7, i64 0, i64 %19
  %21 = load ptr, ptr %20, align 8, !tbaa !9
  call void @array_list_add(ptr noundef %17, ptr noundef %21)
  br label %22

22:                                               ; preds = %16
  %23 = load i32, ptr %8, align 4, !tbaa !5
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr %8, align 4, !tbaa !5
  br label %12, !llvm.loop !11

25:                                               ; preds = %12
  %26 = load ptr, ptr %6, align 8, !tbaa !9
  %27 = getelementptr inbounds %struct.friso_array_entry, ptr %26, i32 0, i32 2
  %28 = load i32, ptr %27, align 4, !tbaa !13
  %29 = load ptr, ptr %6, align 8, !tbaa !9
  %30 = getelementptr inbounds %struct.friso_array_entry, ptr %29, i32 0, i32 1
  %31 = load i32, ptr %30, align 8, !tbaa !15
  %32 = call i32 (ptr, ...) @printf(ptr noundef @.str.19, i32 noundef %28, i32 noundef %31)
  %33 = load ptr, ptr %6, align 8, !tbaa !9
  %34 = call ptr @array_list_trim(ptr noundef %33)
  %35 = load ptr, ptr %6, align 8, !tbaa !9
  %36 = getelementptr inbounds %struct.friso_array_entry, ptr %35, i32 0, i32 2
  %37 = load i32, ptr %36, align 4, !tbaa !13
  %38 = load ptr, ptr %6, align 8, !tbaa !9
  %39 = getelementptr inbounds %struct.friso_array_entry, ptr %38, i32 0, i32 1
  %40 = load i32, ptr %39, align 8, !tbaa !15
  %41 = call i32 (ptr, ...) @printf(ptr noundef @.str.20, i32 noundef %37, i32 noundef %40)
  %42 = load i32, ptr %9, align 4, !tbaa !5
  %43 = load ptr, ptr %6, align 8, !tbaa !9
  %44 = load i32, ptr %9, align 4, !tbaa !5
  %45 = call ptr @array_list_get(ptr noundef %43, i32 noundef %44)
  %46 = call i32 (ptr, ...) @printf(ptr noundef @.str.21, i32 noundef %42, ptr noundef %45)
  %47 = load i32, ptr %9, align 4, !tbaa !5
  %48 = call i32 (ptr, ...) @printf(ptr noundef @.str.22, i32 noundef %47)
  %49 = load ptr, ptr %6, align 8, !tbaa !9
  %50 = load i32, ptr %9, align 4, !tbaa !5
  %51 = call ptr @array_list_set(ptr noundef %49, i32 noundef %50, ptr noundef @.str.23)
  %52 = load i32, ptr %9, align 4, !tbaa !5
  %53 = load ptr, ptr %6, align 8, !tbaa !9
  %54 = load i32, ptr %9, align 4, !tbaa !5
  %55 = call ptr @array_list_get(ptr noundef %53, i32 noundef %54)
  %56 = call i32 (ptr, ...) @printf(ptr noundef @.str.21, i32 noundef %52, ptr noundef %55)
  %57 = load i32, ptr %9, align 4, !tbaa !5
  %58 = call i32 (ptr, ...) @printf(ptr noundef @.str.24, i32 noundef %57)
  %59 = load ptr, ptr %6, align 8, !tbaa !9
  %60 = load i32, ptr %9, align 4, !tbaa !5
  %61 = call ptr @array_list_remove(ptr noundef %59, i32 noundef %60)
  %62 = load ptr, ptr %6, align 8, !tbaa !9
  %63 = getelementptr inbounds %struct.friso_array_entry, ptr %62, i32 0, i32 2
  %64 = load i32, ptr %63, align 4, !tbaa !13
  %65 = load ptr, ptr %6, align 8, !tbaa !9
  %66 = getelementptr inbounds %struct.friso_array_entry, ptr %65, i32 0, i32 1
  %67 = load i32, ptr %66, align 8, !tbaa !15
  %68 = call i32 (ptr, ...) @printf(ptr noundef @.str.19, i32 noundef %64, i32 noundef %67)
  %69 = load i32, ptr %9, align 4, !tbaa !5
  %70 = load ptr, ptr %6, align 8, !tbaa !9
  %71 = load i32, ptr %9, align 4, !tbaa !5
  %72 = call ptr @array_list_get(ptr noundef %70, i32 noundef %71)
  %73 = call i32 (ptr, ...) @printf(ptr noundef @.str.21, i32 noundef %69, ptr noundef %72)
  %74 = load i32, ptr %9, align 4, !tbaa !5
  %75 = call i32 (ptr, ...) @printf(ptr noundef @.str.25, i32 noundef %74)
  %76 = load ptr, ptr %6, align 8, !tbaa !9
  %77 = load i32, ptr %9, align 4, !tbaa !5
  call void @array_list_insert(ptr noundef %76, i32 noundef %77, ptr noundef @.str.26)
  %78 = load i32, ptr %9, align 4, !tbaa !5
  %79 = load ptr, ptr %6, align 8, !tbaa !9
  %80 = load i32, ptr %9, align 4, !tbaa !5
  %81 = call ptr @array_list_get(ptr noundef %79, i32 noundef %80)
  %82 = call i32 (ptr, ...) @printf(ptr noundef @.str.21, i32 noundef %78, ptr noundef %81)
  %83 = load ptr, ptr %6, align 8, !tbaa !9
  call void @free_array_list(ptr noundef %83)
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 152, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  ret i32 0
}

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

declare ptr @new_array_list_with_opacity(i32 noundef) #2

; 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) #3

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

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

declare ptr @array_list_trim(ptr noundef) #2

declare ptr @array_list_get(ptr noundef, i32 noundef) #2

declare ptr @array_list_set(ptr noundef, i32 noundef, ptr noundef) #2

declare ptr @array_list_remove(ptr noundef, i32 noundef) #2

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

declare void @free_array_list(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 nounwind willreturn memory(argmem: readwrite) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !6, i64 12}
!14 = !{!"", !10, i64 0, !6, i64 8, !6, i64 12}
!15 = !{!14, !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"

@__const.main.keys = external hidden unnamed_addr constant [19 x ptr], align 16
@.str.19 = external hidden unnamed_addr constant [27 x i8], align 1
@.str.20 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.21 = external hidden unnamed_addr constant [18 x i8], align 1
@.str.22 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.23 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.24 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.25 = external hidden unnamed_addr constant [24 x i8], align 1
@.str.26 = external hidden unnamed_addr constant [10 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr nocapture noundef readnone %1) local_unnamed_addr #0 {
  %3 = tail call ptr @new_array_list_with_opacity(i32 noundef 8) #3
  %4 = load ptr, ptr @__const.main.keys, align 16, !tbaa !5
  tail call void @array_list_add(ptr noundef %3, ptr noundef %4) #3
  %5 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 8), align 8, !tbaa !5
  tail call void @array_list_add(ptr noundef %3, ptr noundef %5) #3
  %6 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 16), align 16, !tbaa !5
  tail call void @array_list_add(ptr noundef %3, ptr noundef %6) #3
  %7 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 24), align 8, !tbaa !5
  tail call void @array_list_add(ptr noundef %3, ptr noundef %7) #3
  %8 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 32), align 16, !tbaa !5
  tail call void @array_list_add(ptr noundef %3, ptr noundef %8) #3
  %9 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 40), align 8, !tbaa !5
  tail call void @array_list_add(ptr noundef %3, ptr noundef %9) #3
  %10 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 48), align 16, !tbaa !5
  tail call void @array_list_add(ptr noundef %3, ptr noundef %10) #3
  %11 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 56), align 8, !tbaa !5
  tail call void @array_list_add(ptr noundef %3, ptr noundef %11) #3
  %12 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 64), align 16, !tbaa !5
  tail call void @array_list_add(ptr noundef %3, ptr noundef %12) #3
  %13 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 72), align 8, !tbaa !5
  tail call void @array_list_add(ptr noundef %3, ptr noundef %13) #3
  %14 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 80), align 16, !tbaa !5
  tail call void @array_list_add(ptr noundef %3, ptr noundef %14) #3
  %15 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 88), align 8, !tbaa !5
  tail call void @array_list_add(ptr noundef %3, ptr noundef %15) #3
  %16 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 96), align 16, !tbaa !5
  tail call void @array_list_add(ptr noundef %3, ptr noundef %16) #3
  %17 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 104), align 8, !tbaa !5
  tail call void @array_list_add(ptr noundef %3, ptr noundef %17) #3
  %18 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 112), align 16, !tbaa !5
  tail call void @array_list_add(ptr noundef %3, ptr noundef %18) #3
  %19 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 120), align 8, !tbaa !5
  tail call void @array_list_add(ptr noundef %3, ptr noundef %19) #3
  %20 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 128), align 16, !tbaa !5
  tail call void @array_list_add(ptr noundef %3, ptr noundef %20) #3
  %21 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 136), align 8, !tbaa !5
  tail call void @array_list_add(ptr noundef %3, ptr noundef %21) #3
  %22 = load ptr, ptr getelementptr inbounds (i8, ptr @__const.main.keys, i64 144), align 16, !tbaa !5
  tail call void @array_list_add(ptr noundef %3, ptr noundef %22) #3
  %23 = getelementptr inbounds i8, ptr %3, i64 12
  %24 = load i32, ptr %23, align 4, !tbaa !9
  %25 = getelementptr inbounds i8, ptr %3, i64 8
  %26 = load i32, ptr %25, align 8, !tbaa !12
  %27 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.19, i32 noundef %24, i32 noundef %26)
  %28 = tail call ptr @array_list_trim(ptr noundef %3) #3
  %29 = load i32, ptr %23, align 4, !tbaa !9
  %30 = load i32, ptr %25, align 8, !tbaa !12
  %31 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.20, i32 noundef %29, i32 noundef %30)
  %32 = tail call ptr @array_list_get(ptr noundef %3, i32 noundef 2) #3
  %33 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.21, i32 noundef 2, ptr noundef %32)
  %34 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.22, i32 noundef 2)
  %35 = tail call ptr @array_list_set(ptr noundef %3, i32 noundef 2, ptr noundef nonnull @.str.23) #3
  %36 = tail call ptr @array_list_get(ptr noundef %3, i32 noundef 2) #3
  %37 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.21, i32 noundef 2, ptr noundef %36)
  %38 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.24, i32 noundef 2)
  %39 = tail call ptr @array_list_remove(ptr noundef %3, i32 noundef 2) #3
  %40 = load i32, ptr %23, align 4, !tbaa !9
  %41 = load i32, ptr %25, align 8, !tbaa !12
  %42 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.19, i32 noundef %40, i32 noundef %41)
  %43 = tail call ptr @array_list_get(ptr noundef %3, i32 noundef 2) #3
  %44 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.21, i32 noundef 2, ptr noundef %43)
  %45 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.25, i32 noundef 2)
  tail call void @array_list_insert(ptr noundef %3, i32 noundef 2, ptr noundef nonnull @.str.26) #3
  %46 = tail call ptr @array_list_get(ptr noundef %3, i32 noundef 2) #3
  %47 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.21, i32 noundef 2, ptr noundef %46)
  tail call void @free_array_list(ptr noundef %3) #3
  ret i32 0
}

declare ptr @new_array_list_with_opacity(i32 noundef) local_unnamed_addr #1

declare void @array_list_add(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 ptr @array_list_trim(ptr noundef) local_unnamed_addr #1

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

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

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

declare void @array_list_insert(ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

declare void @free_array_list(ptr noundef) local_unnamed_addr #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 = { "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 = { 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, !11, i64 12}
!10 = !{!"", !6, i64 0, !11, i64 8, !11, i64 12}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !11, i64 8}


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