; LLVM IR from simbody/simbody :: SimTKmath/Integrators/src/CPodes/sundials/src/cpodes (cpodes_io)

; 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.71 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.72 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.73 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.74 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.75 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.76 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.77 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.78 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.79 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.80 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.81 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.82 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.83 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.84 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.85 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.86 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.87 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.88 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.89 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.90 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.91 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.92 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.93 = external hidden unnamed_addr constant [5 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 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 @CPodeGetReturnFlagName(i32 noundef %0) #1 {
  %2 = alloca i32, align 4
  %3 = alloca ptr, align 8
  store i32 %0, ptr %2, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %4 = call noalias ptr @malloc(i64 noundef 24) #5
  store ptr %4, ptr %3, align 8, !tbaa !9
  %5 = load i32, ptr %2, align 4, !tbaa !5
  switch i32 %5, label %72 [
    i32 0, label %6
    i32 1, label %9
    i32 2, label %12
    i32 -1, label %15
    i32 -2, label %18
    i32 -3, label %21
    i32 -4, label %24
    i32 -5, label %27
    i32 -6, label %30
    i32 -7, label %33
    i32 -8, label %36
    i32 -9, label %39
    i32 -10, label %42
    i32 -11, label %45
    i32 -12, label %48
    i32 -20, label %51
    i32 -21, label %54
    i32 -22, label %57
    i32 -23, label %60
    i32 -24, label %63
    i32 -25, label %66
    i32 -26, label %69
  ]

6:                                                ; preds = %1
  %7 = load ptr, ptr %3, align 8, !tbaa !9
  %8 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %7, ptr noundef @.str.71) #4
  br label %75

9:                                                ; preds = %1
  %10 = load ptr, ptr %3, align 8, !tbaa !9
  %11 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %10, ptr noundef @.str.72) #4
  br label %75

12:                                               ; preds = %1
  %13 = load ptr, ptr %3, align 8, !tbaa !9
  %14 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %13, ptr noundef @.str.73) #4
  br label %75

15:                                               ; preds = %1
  %16 = load ptr, ptr %3, align 8, !tbaa !9
  %17 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %16, ptr noundef @.str.74) #4
  br label %75

18:                                               ; preds = %1
  %19 = load ptr, ptr %3, align 8, !tbaa !9
  %20 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %19, ptr noundef @.str.75) #4
  br label %75

21:                                               ; preds = %1
  %22 = load ptr, ptr %3, align 8, !tbaa !9
  %23 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %22, ptr noundef @.str.76) #4
  br label %75

24:                                               ; preds = %1
  %25 = load ptr, ptr %3, align 8, !tbaa !9
  %26 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %25, ptr noundef @.str.77) #4
  br label %75

27:                                               ; preds = %1
  %28 = load ptr, ptr %3, align 8, !tbaa !9
  %29 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %28, ptr noundef @.str.78) #4
  br label %75

30:                                               ; preds = %1
  %31 = load ptr, ptr %3, align 8, !tbaa !9
  %32 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %31, ptr noundef @.str.79) #4
  br label %75

33:                                               ; preds = %1
  %34 = load ptr, ptr %3, align 8, !tbaa !9
  %35 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %34, ptr noundef @.str.80) #4
  br label %75

36:                                               ; preds = %1
  %37 = load ptr, ptr %3, align 8, !tbaa !9
  %38 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %37, ptr noundef @.str.81) #4
  br label %75

39:                                               ; preds = %1
  %40 = load ptr, ptr %3, align 8, !tbaa !9
  %41 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %40, ptr noundef @.str.82) #4
  br label %75

42:                                               ; preds = %1
  %43 = load ptr, ptr %3, align 8, !tbaa !9
  %44 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %43, ptr noundef @.str.83) #4
  br label %75

45:                                               ; preds = %1
  %46 = load ptr, ptr %3, align 8, !tbaa !9
  %47 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %46, ptr noundef @.str.84) #4
  br label %75

48:                                               ; preds = %1
  %49 = load ptr, ptr %3, align 8, !tbaa !9
  %50 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %49, ptr noundef @.str.85) #4
  br label %75

51:                                               ; preds = %1
  %52 = load ptr, ptr %3, align 8, !tbaa !9
  %53 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %52, ptr noundef @.str.86) #4
  br label %75

54:                                               ; preds = %1
  %55 = load ptr, ptr %3, align 8, !tbaa !9
  %56 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %55, ptr noundef @.str.87) #4
  br label %75

57:                                               ; preds = %1
  %58 = load ptr, ptr %3, align 8, !tbaa !9
  %59 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %58, ptr noundef @.str.88) #4
  br label %75

60:                                               ; preds = %1
  %61 = load ptr, ptr %3, align 8, !tbaa !9
  %62 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %61, ptr noundef @.str.89) #4
  br label %75

63:                                               ; preds = %1
  %64 = load ptr, ptr %3, align 8, !tbaa !9
  %65 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %64, ptr noundef @.str.90) #4
  br label %75

66:                                               ; preds = %1
  %67 = load ptr, ptr %3, align 8, !tbaa !9
  %68 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %67, ptr noundef @.str.91) #4
  br label %75

69:                                               ; preds = %1
  %70 = load ptr, ptr %3, align 8, !tbaa !9
  %71 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %70, ptr noundef @.str.92) #4
  br label %75

72:                                               ; preds = %1
  %73 = load ptr, ptr %3, align 8, !tbaa !9
  %74 = call i32 (ptr, ptr, ...) @sprintf(ptr noundef %73, ptr noundef @.str.93) #4
  br label %75

75:                                               ; preds = %72, %69, %66, %63, %60, %57, %54, %51, %48, %45, %42, %39, %36, %33, %30, %27, %24, %21, %18, %15, %12, %9, %6
  %76 = load ptr, ptr %3, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  ret ptr %76
}

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

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

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

!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}


; 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.71 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.72 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.73 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.74 = external hidden unnamed_addr constant [17 x i8], align 1
@.str.75 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.76 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.77 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.78 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.79 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.80 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.81 = external hidden unnamed_addr constant [16 x i8], align 1
@.str.82 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.83 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.84 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.85 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.86 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.87 = external hidden unnamed_addr constant [12 x i8], align 1
@.str.88 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.89 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.90 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.91 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.92 = external hidden unnamed_addr constant [11 x i8], align 1
@.str.93 = external hidden unnamed_addr constant [5 x i8], align 1
@switch.table.CPodeGetReturnFlagName = private unnamed_addr constant [29 x ptr] [ptr @.str.92, ptr @.str.91, ptr @.str.90, ptr @.str.89, ptr @.str.88, ptr @.str.87, ptr @.str.86, ptr @.str.93, ptr @.str.93, ptr @.str.93, ptr @.str.93, ptr @.str.93, ptr @.str.93, ptr @.str.93, ptr @.str.85, ptr @.str.84, ptr @.str.83, ptr @.str.82, ptr @.str.81, ptr @.str.80, ptr @.str.79, ptr @.str.78, ptr @.str.77, ptr @.str.76, ptr @.str.75, ptr @.str.74, ptr @.str.71, ptr @.str.72, ptr @.str.73], align 8

; Function Attrs: nofree nounwind uwtable
define dso_local noalias noundef ptr @CPodeGetReturnFlagName(i32 noundef %0) local_unnamed_addr #0 {
  %2 = tail call noalias dereferenceable_or_null(24) ptr @malloc(i64 noundef 24) #3
  %switch.tableidx = add i32 %0, 26
  %3 = icmp ult i32 %switch.tableidx, 29
  br i1 %3, label %switch.lookup, label %5

switch.lookup:                                    ; preds = %1
  %4 = zext nneg i32 %switch.tableidx to i64
  %switch.gep = getelementptr inbounds [29 x ptr], ptr @switch.table.CPodeGetReturnFlagName, i64 0, i64 %4
  %switch.load = load ptr, ptr %switch.gep, align 8
  br label %5

5:                                                ; preds = %1, %switch.lookup
  %.str.93.sink = phi ptr [ %switch.load, %switch.lookup ], [ @.str.93, %1 ]
  %6 = tail call i32 (ptr, ptr, ...) @sprintf(ptr noundef nonnull dereferenceable(1) %2, ptr noundef nonnull dereferenceable(1) %.str.93.sink) #4
  ret ptr %2
}

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

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

attributes #0 = { nofree 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 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 #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 allocsize(0) }
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)"}


; Effective O3 passes: GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass