; LLVM IR from recp/cglm :: test/src (tests)

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

@stderr = external global ptr, align 8
@.str = external hidden unnamed_addr constant [94 x i8], align 1
@.str.467 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.468 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.469 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.470 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.527 = external hidden unnamed_addr constant [65 x i8], align 1
@__const.test_glm_ivec3_div.v1 = external hidden unnamed_addr constant [3 x i32], align 4
@__const.test_glm_ivec3_div.v2 = external hidden unnamed_addr constant [3 x i32], align 4
@.str.543 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.544 = external hidden unnamed_addr constant [11 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: 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) #1

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

; 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
define dso_local { ptr, i32 } @test_glm_ivec3_div() #3 {
  %1 = alloca %struct.test_status_t, align 8
  %2 = alloca [3 x i32], align 4
  %3 = alloca [3 x i32], align 4
  %4 = alloca [3 x i32], align 4
  %5 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 12, ptr %2) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %2, ptr align 4 @__const.test_glm_ivec3_div.v1, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 12, ptr %3) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %3, ptr align 4 @__const.test_glm_ivec3_div.v2, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 12, ptr %4) #5
  %6 = getelementptr inbounds [3 x i32], ptr %2, i64 0, i64 0
  %7 = getelementptr inbounds [3 x i32], ptr %3, i64 0, i64 0
  %8 = getelementptr inbounds [3 x i32], ptr %4, i64 0, i64 0
  call void @glm_ivec3_div(ptr noundef %6, ptr noundef %7, ptr noundef %8)
  br label %9

9:                                                ; preds = %0
  %10 = getelementptr inbounds [3 x i32], ptr %2, i64 0, i64 0
  %11 = load i32, ptr %10, align 4, !tbaa !5
  %12 = getelementptr inbounds [3 x i32], ptr %3, i64 0, i64 0
  %13 = load i32, ptr %12, align 4, !tbaa !5
  %14 = sdiv i32 %11, %13
  %15 = getelementptr inbounds [3 x i32], ptr %4, i64 0, i64 0
  %16 = load i32, ptr %15, align 4, !tbaa !5
  %17 = icmp eq i32 %14, %16
  br i1 %17, label %23, label %18

18:                                               ; preds = %9
  %19 = load ptr, ptr @stderr, align 8, !tbaa !9
  %20 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %19, ptr noundef @.str, ptr noundef @.str.527, i32 noundef 181, ptr noundef @.str.467) #5
  %21 = getelementptr inbounds %struct.test_status_t, ptr %1, i32 0, i32 0
  store ptr null, ptr %21, align 8, !tbaa !11
  %22 = getelementptr inbounds %struct.test_status_t, ptr %1, i32 0, i32 1
  store i32 0, ptr %22, align 8, !tbaa !13
  store i32 1, ptr %5, align 4
  br label %98

23:                                               ; preds = %9
  br label %24

24:                                               ; preds = %23
  br label %25

25:                                               ; preds = %24
  br label %26

26:                                               ; preds = %25
  %27 = getelementptr inbounds [3 x i32], ptr %2, i64 0, i64 1
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = getelementptr inbounds [3 x i32], ptr %3, i64 0, i64 1
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = sdiv i32 %28, %30
  %32 = getelementptr inbounds [3 x i32], ptr %4, i64 0, i64 1
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %34 = icmp eq i32 %31, %33
  br i1 %34, label %40, label %35

35:                                               ; preds = %26
  %36 = load ptr, ptr @stderr, align 8, !tbaa !9
  %37 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %36, ptr noundef @.str, ptr noundef @.str.527, i32 noundef 182, ptr noundef @.str.468) #5
  %38 = getelementptr inbounds %struct.test_status_t, ptr %1, i32 0, i32 0
  store ptr null, ptr %38, align 8, !tbaa !11
  %39 = getelementptr inbounds %struct.test_status_t, ptr %1, i32 0, i32 1
  store i32 0, ptr %39, align 8, !tbaa !13
  store i32 1, ptr %5, align 4
  br label %98

40:                                               ; preds = %26
  br label %41

41:                                               ; preds = %40
  br label %42

42:                                               ; preds = %41
  br label %43

43:                                               ; preds = %42
  %44 = getelementptr inbounds [3 x i32], ptr %2, i64 0, i64 2
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = getelementptr inbounds [3 x i32], ptr %3, i64 0, i64 2
  %47 = load i32, ptr %46, align 4, !tbaa !5
  %48 = sdiv i32 %45, %47
  %49 = getelementptr inbounds [3 x i32], ptr %4, i64 0, i64 2
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = icmp eq i32 %48, %50
  br i1 %51, label %57, label %52

52:                                               ; preds = %43
  %53 = load ptr, ptr @stderr, align 8, !tbaa !9
  %54 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %53, ptr noundef @.str, ptr noundef @.str.527, i32 noundef 183, ptr noundef @.str.543) #5
  %55 = getelementptr inbounds %struct.test_status_t, ptr %1, i32 0, i32 0
  store ptr null, ptr %55, align 8, !tbaa !11
  %56 = getelementptr inbounds %struct.test_status_t, ptr %1, i32 0, i32 1
  store i32 0, ptr %56, align 8, !tbaa !13
  store i32 1, ptr %5, align 4
  br label %98

57:                                               ; preds = %43
  br label %58

58:                                               ; preds = %57
  br label %59

59:                                               ; preds = %58
  br label %60

60:                                               ; preds = %59
  %61 = getelementptr inbounds [3 x i32], ptr %4, i64 0, i64 0
  %62 = load i32, ptr %61, align 4, !tbaa !5
  %63 = icmp eq i32 %62, -3
  br i1 %63, label %69, label %64

64:                                               ; preds = %60
  %65 = load ptr, ptr @stderr, align 8, !tbaa !9
  %66 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %65, ptr noundef @.str, ptr noundef @.str.527, i32 noundef 184, ptr noundef @.str.469) #5
  %67 = getelementptr inbounds %struct.test_status_t, ptr %1, i32 0, i32 0
  store ptr null, ptr %67, align 8, !tbaa !11
  %68 = getelementptr inbounds %struct.test_status_t, ptr %1, i32 0, i32 1
  store i32 0, ptr %68, align 8, !tbaa !13
  store i32 1, ptr %5, align 4
  br label %98

69:                                               ; preds = %60
  br label %70

70:                                               ; preds = %69
  br label %71

71:                                               ; preds = %70
  br label %72

72:                                               ; preds = %71
  %73 = getelementptr inbounds [3 x i32], ptr %4, i64 0, i64 1
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = icmp eq i32 %74, 1
  br i1 %75, label %81, label %76

76:                                               ; preds = %72
  %77 = load ptr, ptr @stderr, align 8, !tbaa !9
  %78 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %77, ptr noundef @.str, ptr noundef @.str.527, i32 noundef 185, ptr noundef @.str.470) #5
  %79 = getelementptr inbounds %struct.test_status_t, ptr %1, i32 0, i32 0
  store ptr null, ptr %79, align 8, !tbaa !11
  %80 = getelementptr inbounds %struct.test_status_t, ptr %1, i32 0, i32 1
  store i32 0, ptr %80, align 8, !tbaa !13
  store i32 1, ptr %5, align 4
  br label %98

81:                                               ; preds = %72
  br label %82

82:                                               ; preds = %81
  br label %83

83:                                               ; preds = %82
  br label %84

84:                                               ; preds = %83
  %85 = getelementptr inbounds [3 x i32], ptr %4, i64 0, i64 2
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = icmp eq i32 %86, 4
  br i1 %87, label %93, label %88

88:                                               ; preds = %84
  %89 = load ptr, ptr @stderr, align 8, !tbaa !9
  %90 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %89, ptr noundef @.str, ptr noundef @.str.527, i32 noundef 186, ptr noundef @.str.544) #5
  %91 = getelementptr inbounds %struct.test_status_t, ptr %1, i32 0, i32 0
  store ptr null, ptr %91, align 8, !tbaa !11
  %92 = getelementptr inbounds %struct.test_status_t, ptr %1, i32 0, i32 1
  store i32 0, ptr %92, align 8, !tbaa !13
  store i32 1, ptr %5, align 4
  br label %98

93:                                               ; preds = %84
  br label %94

94:                                               ; preds = %93
  br label %95

95:                                               ; preds = %94
  %96 = getelementptr inbounds %struct.test_status_t, ptr %1, i32 0, i32 0
  store ptr null, ptr %96, align 8, !tbaa !11
  %97 = getelementptr inbounds %struct.test_status_t, ptr %1, i32 0, i32 1
  store i32 1, ptr %97, align 8, !tbaa !13
  store i32 1, ptr %5, align 4
  br label %98

98:                                               ; preds = %95, %88, %76, %64, %52, %35, %18
  call void @llvm.lifetime.end.p0(i64 12, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr %2) #5
  %99 = load { ptr, i32 }, ptr %1, align 8
  ret { ptr, i32 } %99
}

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @glm_ivec3_div(ptr noundef, ptr noundef, ptr noundef) #4

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

!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 = !{!12, !10, i64 0}
!12 = !{!"test_status_t", !10, i64 0, !6, i64 8}
!13 = !{!12, !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 [94 x i8], align 1
@.str.467 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.468 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.469 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.470 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.527 = external hidden unnamed_addr constant [65 x i8], align 1
@__const.test_glm_ivec3_div.v1 = external hidden unnamed_addr constant [3 x i32], align 4
@__const.test_glm_ivec3_div.v2 = external hidden unnamed_addr constant [3 x i32], align 4
@.str.543 = external hidden unnamed_addr constant [23 x i8], align 1
@.str.544 = external hidden unnamed_addr constant [11 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: mustprogress 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) #1

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

; 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
define dso_local { ptr, i32 } @test_glm_ivec3_div() local_unnamed_addr #3 {
  %1 = alloca [3 x i32], align 4
  %2 = alloca [3 x i32], align 4
  %3 = alloca [3 x i32], align 4
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %1) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %1, ptr noundef nonnull align 4 dereferenceable(12) @__const.test_glm_ivec3_div.v1, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %2) #5
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 4 dereferenceable(12) %2, ptr noundef nonnull align 4 dereferenceable(12) @__const.test_glm_ivec3_div.v2, i64 12, i1 false)
  call void @llvm.lifetime.start.p0(i64 12, ptr nonnull %3) #5
  call void @glm_ivec3_div(ptr noundef nonnull %1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %4 = load i32, ptr %1, align 4, !tbaa !5
  %5 = load i32, ptr %2, align 4, !tbaa !5
  %6 = sdiv i32 %4, %5
  %7 = load i32, ptr %3, align 4, !tbaa !5
  %8 = icmp eq i32 %6, %7
  br i1 %8, label %12, label %9

9:                                                ; preds = %0
  %10 = load ptr, ptr @stderr, align 8, !tbaa !9
  %11 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %10, ptr noundef nonnull @.str, ptr noundef nonnull @.str.527, i32 noundef 181, ptr noundef nonnull @.str.467) #6
  br label %51

12:                                               ; preds = %0
  %13 = getelementptr inbounds i8, ptr %1, i64 4
  %14 = load i32, ptr %13, align 4, !tbaa !5
  %15 = getelementptr inbounds i8, ptr %2, i64 4
  %16 = load i32, ptr %15, align 4, !tbaa !5
  %17 = sdiv i32 %14, %16
  %18 = getelementptr inbounds i8, ptr %3, i64 4
  %19 = load i32, ptr %18, align 4, !tbaa !5
  %20 = icmp eq i32 %17, %19
  br i1 %20, label %24, label %21

21:                                               ; preds = %12
  %22 = load ptr, ptr @stderr, align 8, !tbaa !9
  %23 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %22, ptr noundef nonnull @.str, ptr noundef nonnull @.str.527, i32 noundef 182, ptr noundef nonnull @.str.468) #6
  br label %51

24:                                               ; preds = %12
  %25 = getelementptr inbounds i8, ptr %1, i64 8
  %26 = load i32, ptr %25, align 4, !tbaa !5
  %27 = getelementptr inbounds i8, ptr %2, i64 8
  %28 = load i32, ptr %27, align 4, !tbaa !5
  %29 = sdiv i32 %26, %28
  %30 = getelementptr inbounds i8, ptr %3, i64 8
  %31 = load i32, ptr %30, align 4, !tbaa !5
  %32 = icmp eq i32 %29, %31
  br i1 %32, label %36, label %33

33:                                               ; preds = %24
  %34 = load ptr, ptr @stderr, align 8, !tbaa !9
  %35 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %34, ptr noundef nonnull @.str, ptr noundef nonnull @.str.527, i32 noundef 183, ptr noundef nonnull @.str.543) #6
  br label %51

36:                                               ; preds = %24
  %37 = icmp eq i32 %6, -3
  br i1 %37, label %41, label %38

38:                                               ; preds = %36
  %39 = load ptr, ptr @stderr, align 8, !tbaa !9
  %40 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %39, ptr noundef nonnull @.str, ptr noundef nonnull @.str.527, i32 noundef 184, ptr noundef nonnull @.str.469) #6
  br label %51

41:                                               ; preds = %36
  %42 = icmp eq i32 %17, 1
  br i1 %42, label %46, label %43

43:                                               ; preds = %41
  %44 = load ptr, ptr @stderr, align 8, !tbaa !9
  %45 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %44, ptr noundef nonnull @.str, ptr noundef nonnull @.str.527, i32 noundef 185, ptr noundef nonnull @.str.470) #6
  br label %51

46:                                               ; preds = %41
  %47 = icmp eq i32 %29, 4
  br i1 %47, label %51, label %48

48:                                               ; preds = %46
  %49 = load ptr, ptr @stderr, align 8, !tbaa !9
  %50 = call i32 (ptr, ptr, ...) @fprintf(ptr noundef %49, ptr noundef nonnull @.str, ptr noundef nonnull @.str.527, i32 noundef 186, ptr noundef nonnull @.str.544) #6
  br label %51

51:                                               ; preds = %46, %48, %43, %38, %33, %21, %9
  %.sroa.8.0 = phi i32 [ 0, %48 ], [ 0, %43 ], [ 0, %38 ], [ 0, %33 ], [ 0, %21 ], [ 0, %9 ], [ 1, %46 ]
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 12, ptr nonnull %1) #5
  %.fca.1.insert = insertvalue { ptr, i32 } { ptr null, i32 poison }, i32 %.sroa.8.0, 1
  ret { ptr, i32 } %.fca.1.insert
}

; Function Attrs: alwaysinline nounwind uwtable
declare hidden void @glm_ivec3_div(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

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


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,SROAPass,SimplifyCFGPass