; LLVM IR from PyCee/NUS_library :: src/model (NUS_model)

; 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.NUS_absolute_path = type { [100 x i8] }
%struct.NUS_binary_model = type { i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, %struct.NUS_skeleton, ptr }
%struct.NUS_skeleton = type { i32, ptr }
%struct.NUS_animation = type { ptr, [64 x i8], float, i32, ptr, ptr }
%struct.NUS_binding = type { ptr, ptr, ptr, i32 }
%struct.NUS_model = type { %struct.NUS_memory_map, %struct.NUS_memory_map, %struct.NUS_texture, %struct.NUS_skeleton, ptr, i32, i32, i32, %struct.NUS_binding }
%struct.NUS_memory_map = type { ptr, ptr, i64, %struct.NUS_binding }
%struct.NUS_texture = type { ptr, ptr, i32, i32, i32, i32, i32, %struct.NUS_binding }

@.str = external hidden unnamed_addr constant [48 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [51 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local i32 @nus_model_build(ptr noundef byval(%struct.NUS_absolute_path) align 8 %0, ptr noundef %1) #0 {
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca %struct.NUS_binary_model, align 8
  %7 = alloca i32, align 4
  %8 = alloca %struct.NUS_skeleton, align 8
  %9 = alloca %struct.NUS_animation, align 8
  %10 = alloca %struct.NUS_binding, align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 72, ptr %6) #5
  %11 = getelementptr inbounds %struct.NUS_absolute_path, ptr %0, i32 0, i32 0
  %12 = getelementptr inbounds [100 x i8], ptr %11, i64 0, i64 0
  %13 = call i32 @nusm_read(ptr noundef %12, ptr noundef %6)
  %14 = icmp ne i32 %13, 1
  br i1 %14, label %15, label %19

15:                                               ; preds = %2
  %16 = getelementptr inbounds %struct.NUS_absolute_path, ptr %0, i32 0, i32 0
  %17 = getelementptr inbounds [100 x i8], ptr %16, i64 0, i64 0
  %18 = call i32 (ptr, ...) @printf(ptr noundef @.str, ptr noundef %17)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %161

19:                                               ; preds = %2
  %20 = getelementptr inbounds %struct.NUS_binary_model, ptr %6, i32 0, i32 0
  %21 = load i32, ptr %20, align 8, !tbaa !9
  %22 = zext i32 %21 to i64
  %23 = mul i64 %22, 64
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %struct.NUS_model, ptr %24, i32 0, i32 0
  %26 = call i32 @nus_memory_map_build(i64 noundef %23, i32 noundef 128, i32 noundef 2, ptr noundef %25)
  %27 = icmp ne i32 %26, 1
  br i1 %27, label %28, label %30

28:                                               ; preds = %19
  %29 = call i32 (ptr, ...) @printf(ptr noundef @.str.1)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %161

30:                                               ; preds = %19
  %31 = load ptr, ptr %4, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.NUS_model, ptr %31, i32 0, i32 0
  %33 = getelementptr inbounds %struct.NUS_binary_model, ptr %6, i32 0, i32 6
  %34 = load ptr, ptr %33, align 8, !tbaa !13
  %35 = getelementptr inbounds %struct.NUS_binary_model, ptr %6, i32 0, i32 0
  %36 = load i32, ptr %35, align 8, !tbaa !9
  %37 = zext i32 %36 to i64
  %38 = mul i64 %37, 64
  %39 = call i32 @nus_memory_map_flush(ptr noundef byval(%struct.NUS_memory_map) align 8 %32, ptr noundef %34, i64 noundef %38)
  %40 = icmp ne i32 %39, 1
  br i1 %40, label %41, label %43

41:                                               ; preds = %30
  %42 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %161

43:                                               ; preds = %30
  %44 = getelementptr inbounds %struct.NUS_binary_model, ptr %6, i32 0, i32 1
  %45 = load i32, ptr %44, align 4, !tbaa !14
  %46 = zext i32 %45 to i64
  %47 = mul i64 %46, 4
  %48 = load ptr, ptr %4, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.NUS_model, ptr %48, i32 0, i32 1
  %50 = call i32 @nus_memory_map_build(i64 noundef %47, i32 noundef 64, i32 noundef 2, ptr noundef %49)
  %51 = icmp ne i32 %50, 1
  br i1 %51, label %52, label %54

52:                                               ; preds = %43
  %53 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %161

54:                                               ; preds = %43
  %55 = load ptr, ptr %4, align 8, !tbaa !5
  %56 = getelementptr inbounds %struct.NUS_model, ptr %55, i32 0, i32 1
  %57 = getelementptr inbounds %struct.NUS_binary_model, ptr %6, i32 0, i32 7
  %58 = load ptr, ptr %57, align 8, !tbaa !15
  %59 = getelementptr inbounds %struct.NUS_binary_model, ptr %6, i32 0, i32 1
  %60 = load i32, ptr %59, align 4, !tbaa !14
  %61 = zext i32 %60 to i64
  %62 = mul i64 %61, 4
  %63 = call i32 @nus_memory_map_flush(ptr noundef byval(%struct.NUS_memory_map) align 8 %56, ptr noundef %58, i64 noundef %62)
  %64 = icmp ne i32 %63, 1
  br i1 %64, label %65, label %67

65:                                               ; preds = %54
  %66 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %161

67:                                               ; preds = %54
  %68 = getelementptr inbounds %struct.NUS_binary_model, ptr %6, i32 0, i32 4
  %69 = load i32, ptr %68, align 8, !tbaa !16
  %70 = icmp ne i32 %69, 0
  br i1 %70, label %71, label %97

71:                                               ; preds = %67
  %72 = getelementptr inbounds %struct.NUS_binary_model, ptr %6, i32 0, i32 2
  %73 = load i32, ptr %72, align 8, !tbaa !17
  %74 = getelementptr inbounds %struct.NUS_binary_model, ptr %6, i32 0, i32 3
  %75 = load i32, ptr %74, align 4, !tbaa !18
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.NUS_model, ptr %76, i32 0, i32 2
  %78 = call i32 @nus_texture_build(i32 noundef %73, i32 noundef %75, i32 noundef 37, i32 noundef 134, i32 noundef 2, i32 noundef 1, ptr noundef %77)
  %79 = icmp ne i32 %78, 1
  br i1 %79, label %80, label %82

80:                                               ; preds = %71
  %81 = call i32 (ptr, ...) @printf(ptr noundef @.str.5)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %161

82:                                               ; preds = %71
  %83 = getelementptr inbounds %struct.NUS_binary_model, ptr %6, i32 0, i32 8
  %84 = load ptr, ptr %83, align 8, !tbaa !19
  %85 = getelementptr inbounds %struct.NUS_binary_model, ptr %6, i32 0, i32 4
  %86 = load i32, ptr %85, align 8, !tbaa !16
  %87 = zext i32 %86 to i64
  %88 = load ptr, ptr %4, align 8, !tbaa !5
  %89 = getelementptr inbounds %struct.NUS_model, ptr %88, i32 0, i32 2
  %90 = call i32 @nus_texture_buffer_image(ptr noundef %84, i64 noundef %87, ptr noundef %89)
  %91 = icmp ne i32 %90, 1
  br i1 %91, label %92, label %94

92:                                               ; preds = %82
  %93 = call i32 (ptr, ...) @printf(ptr noundef @.str.6)
  store i32 0, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %161

94:                                               ; preds = %82
  %95 = load ptr, ptr %4, align 8, !tbaa !5
  %96 = getelementptr inbounds %struct.NUS_model, ptr %95, i32 0, i32 5
  store i32 1, ptr %96, align 8, !tbaa !20
  br label %100

97:                                               ; preds = %67
  %98 = load ptr, ptr %4, align 8, !tbaa !5
  %99 = getelementptr inbounds %struct.NUS_model, ptr %98, i32 0, i32 5
  store i32 0, ptr %99, align 8, !tbaa !20
  br label %100

100:                                              ; preds = %97, %94
  %101 = getelementptr inbounds %struct.NUS_binary_model, ptr %6, i32 0, i32 9
  %102 = getelementptr inbounds %struct.NUS_skeleton, ptr %101, i32 0, i32 0
  %103 = load i32, ptr %102, align 8, !tbaa !26
  %104 = icmp ne i32 %103, 0
  br i1 %104, label %105, label %155

105:                                              ; preds = %100
  %106 = load ptr, ptr %4, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.NUS_model, ptr %106, i32 0, i32 3
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #5
  %108 = getelementptr inbounds %struct.NUS_binary_model, ptr %6, i32 0, i32 9
  %109 = call { i32, ptr } @nus_skeleton_build(ptr noundef %108)
  %110 = getelementptr inbounds { i32, ptr }, ptr %8, i32 0, i32 0
  %111 = extractvalue { i32, ptr } %109, 0
  store i32 %111, ptr %110, align 8
  %112 = getelementptr inbounds { i32, ptr }, ptr %8, i32 0, i32 1
  %113 = extractvalue { i32, ptr } %109, 1
  store ptr %113, ptr %112, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %107, ptr align 8 %8, i64 16, i1 false), !tbaa.struct !27
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #5
  %114 = getelementptr inbounds %struct.NUS_binary_model, ptr %6, i32 0, i32 5
  %115 = load i32, ptr %114, align 4, !tbaa !29
  %116 = icmp ne i32 %115, 0
  br i1 %116, label %117, label %152

117:                                              ; preds = %105
  %118 = getelementptr inbounds %struct.NUS_binary_model, ptr %6, i32 0, i32 5
  %119 = load i32, ptr %118, align 4, !tbaa !29
  %120 = load ptr, ptr %4, align 8, !tbaa !5
  %121 = getelementptr inbounds %struct.NUS_model, ptr %120, i32 0, i32 7
  store i32 %119, ptr %121, align 8, !tbaa !30
  %122 = getelementptr inbounds %struct.NUS_binary_model, ptr %6, i32 0, i32 5
  %123 = load i32, ptr %122, align 4, !tbaa !29
  %124 = zext i32 %123 to i64
  %125 = mul i64 96, %124
  %126 = call noalias ptr @malloc(i64 noundef %125) #6
  %127 = load ptr, ptr %4, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.NUS_model, ptr %127, i32 0, i32 4
  store ptr %126, ptr %128, align 8, !tbaa !31
  store i32 0, ptr %5, align 4, !tbaa !28
  br label %129

129:                                              ; preds = %148, %117
  %130 = load i32, ptr %5, align 4, !tbaa !28
  %131 = getelementptr inbounds %struct.NUS_binary_model, ptr %6, i32 0, i32 5
  %132 = load i32, ptr %131, align 4, !tbaa !29
  %133 = icmp ult i32 %130, %132
  br i1 %133, label %134, label %151

134:                                              ; preds = %129
  %135 = load ptr, ptr %4, align 8, !tbaa !5
  %136 = getelementptr inbounds %struct.NUS_model, ptr %135, i32 0, i32 4
  %137 = load ptr, ptr %136, align 8, !tbaa !31
  %138 = load i32, ptr %5, align 4, !tbaa !28
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds %struct.NUS_animation, ptr %137, i64 %139
  call void @llvm.lifetime.start.p0(i64 96, ptr %9) #5
  %141 = load ptr, ptr %4, align 8, !tbaa !5
  %142 = getelementptr inbounds %struct.NUS_model, ptr %141, i32 0, i32 3
  %143 = getelementptr inbounds %struct.NUS_binary_model, ptr %6, i32 0, i32 10
  %144 = load ptr, ptr %143, align 8, !tbaa !32
  %145 = load i32, ptr %5, align 4, !tbaa !28
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds %struct.NUS_animation, ptr %144, i64 %146
  call void @nus_animation_build(ptr dead_on_unwind writable sret(%struct.NUS_animation) align 8 %9, ptr noundef %142, ptr noundef %147)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %140, ptr align 8 %9, i64 96, i1 false), !tbaa.struct !33
  call void @llvm.lifetime.end.p0(i64 96, ptr %9) #5
  br label %148

148:                                              ; preds = %134
  %149 = load i32, ptr %5, align 4, !tbaa !28
  %150 = add nsw i32 %149, 1
  store i32 %150, ptr %5, align 4, !tbaa !28
  br label %129, !llvm.loop !37

151:                                              ; preds = %129
  br label %152

152:                                              ; preds = %151, %105
  %153 = load ptr, ptr %4, align 8, !tbaa !5
  %154 = getelementptr inbounds %struct.NUS_model, ptr %153, i32 0, i32 6
  store i32 1, ptr %154, align 4, !tbaa !39
  br label %158

155:                                              ; preds = %100
  %156 = load ptr, ptr %4, align 8, !tbaa !5
  %157 = getelementptr inbounds %struct.NUS_model, ptr %156, i32 0, i32 6
  store i32 0, ptr %157, align 4, !tbaa !39
  br label %158

158:                                              ; preds = %155, %152
  call void @nus_binary_model_free(ptr noundef %6)
  %159 = load ptr, ptr %4, align 8, !tbaa !5
  %160 = getelementptr inbounds %struct.NUS_model, ptr %159, i32 0, i32 8
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #5
  call void @nus_get_binding(ptr dead_on_unwind writable sret(%struct.NUS_binding) align 8 %10)
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %160, ptr align 8 %10, i64 32, i1 false), !tbaa.struct !40
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #5
  store i32 1, ptr %3, align 4
  store i32 1, ptr %7, align 4
  br label %161

161:                                              ; preds = %158, %92, %80, %65, %52, %41, %28, %15
  call void @llvm.lifetime.end.p0(i64 72, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  %162 = load i32, ptr %3, align 4
  ret i32 %162
}

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

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

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

declare i32 @nus_memory_map_build(i64 noundef, i32 noundef, i32 noundef, ptr noundef) #2

declare i32 @nus_memory_map_flush(ptr noundef byval(%struct.NUS_memory_map) align 8, ptr noundef, i64 noundef) #2

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

declare i32 @nus_texture_buffer_image(ptr noundef, i64 noundef, ptr noundef) #2

declare { i32, ptr } @nus_skeleton_build(ptr 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

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

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

declare void @nus_animation_build(ptr dead_on_unwind writable sret(%struct.NUS_animation) align 8, ptr noundef, ptr noundef) #2

declare void @nus_binary_model_free(ptr noundef) #2

declare void @nus_get_binding(ptr dead_on_unwind writable sret(%struct.NUS_binding) align 8) #2

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 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 #5 = { nounwind }
attributes #6 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C/C++ TBAA"}
!9 = !{!10, !11, i64 0}
!10 = !{!"NUS_binary_model", !11, i64 0, !11, i64 4, !11, i64 8, !11, i64 12, !11, i64 16, !11, i64 20, !6, i64 24, !6, i64 32, !6, i64 40, !12, i64 48, !6, i64 64}
!11 = !{!"int", !7, i64 0}
!12 = !{!"NUS_skeleton", !11, i64 0, !6, i64 8}
!13 = !{!10, !6, i64 24}
!14 = !{!10, !11, i64 4}
!15 = !{!10, !6, i64 32}
!16 = !{!10, !11, i64 16}
!17 = !{!10, !11, i64 8}
!18 = !{!10, !11, i64 12}
!19 = !{!10, !6, i64 40}
!20 = !{!21, !11, i64 208}
!21 = !{!"NUS_model", !22, i64 0, !22, i64 56, !25, i64 112, !12, i64 184, !6, i64 200, !11, i64 208, !11, i64 212, !11, i64 216, !24, i64 224}
!22 = !{!"NUS_memory_map", !6, i64 0, !6, i64 8, !23, i64 16, !24, i64 24}
!23 = !{!"long", !7, i64 0}
!24 = !{!"NUS_binding", !6, i64 0, !6, i64 8, !6, i64 16, !11, i64 24}
!25 = !{!"NUS_texture", !6, i64 0, !6, i64 8, !11, i64 16, !11, i64 20, !11, i64 24, !11, i64 28, !11, i64 32, !24, i64 40}
!26 = !{!10, !11, i64 48}
!27 = !{i64 0, i64 4, !28, i64 8, i64 8, !5}
!28 = !{!11, !11, i64 0}
!29 = !{!10, !11, i64 20}
!30 = !{!21, !11, i64 216}
!31 = !{!21, !6, i64 200}
!32 = !{!10, !6, i64 64}
!33 = !{i64 0, i64 8, !5, i64 8, i64 64, !34, i64 72, i64 4, !35, i64 76, i64 4, !28, i64 80, i64 8, !5, i64 88, i64 8, !5}
!34 = !{!7, !7, i64 0}
!35 = !{!36, !36, i64 0}
!36 = !{!"float", !7, i64 0}
!37 = distinct !{!37, !38}
!38 = !{!"llvm.loop.mustprogress"}
!39 = !{!21, !11, i64 212}
!40 = !{i64 0, i64 8, !5, i64 8, i64 8, !5, i64 16, i64 8, !5, i64 24, i64 4, !28}


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

%struct.NUS_absolute_path = type { [100 x i8] }
%struct.NUS_binary_model = type { i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, %struct.NUS_skeleton, ptr }
%struct.NUS_skeleton = type { i32, ptr }
%struct.NUS_animation = type { ptr, [64 x i8], float, i32, ptr, ptr }
%struct.NUS_binding = type { ptr, ptr, ptr, i32 }
%struct.NUS_memory_map = type { ptr, ptr, i64, %struct.NUS_binding }

@.str = external hidden unnamed_addr constant [48 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [48 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [37 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [47 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [51 x i8], align 1

; Function Attrs: nounwind uwtable
define dso_local range(i32 0, 2) i32 @nus_model_build(ptr noundef byval(%struct.NUS_absolute_path) align 8 %0, ptr noundef %1) local_unnamed_addr #0 {
  %3 = alloca %struct.NUS_binary_model, align 8
  %4 = alloca %struct.NUS_animation, align 8
  %5 = alloca %struct.NUS_binding, align 8
  call void @llvm.lifetime.start.p0(i64 72, ptr nonnull %3) #6
  %6 = call i32 @nusm_read(ptr noundef nonnull %0, ptr noundef nonnull %3) #6
  %.not = icmp eq i32 %6, 1
  br i1 %.not, label %9, label %7

7:                                                ; preds = %2
  %8 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str, ptr noundef nonnull %0)
  br label %90

9:                                                ; preds = %2
  %10 = load i32, ptr %3, align 8, !tbaa !5
  %11 = zext i32 %10 to i64
  %12 = shl nuw nsw i64 %11, 6
  %13 = call i32 @nus_memory_map_build(i64 noundef %12, i32 noundef 128, i32 noundef 2, ptr noundef %1) #6
  %.not23 = icmp eq i32 %13, 1
  br i1 %.not23, label %16, label %14

14:                                               ; preds = %9
  %15 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.1)
  br label %90

16:                                               ; preds = %9
  %17 = getelementptr inbounds i8, ptr %3, i64 24
  %18 = load ptr, ptr %17, align 8, !tbaa !12
  %19 = load i32, ptr %3, align 8, !tbaa !5
  %20 = zext i32 %19 to i64
  %21 = shl nuw nsw i64 %20, 6
  %22 = call i32 @nus_memory_map_flush(ptr noundef byval(%struct.NUS_memory_map) align 8 %1, ptr noundef %18, i64 noundef %21) #6
  %.not24 = icmp eq i32 %22, 1
  br i1 %.not24, label %25, label %23

23:                                               ; preds = %16
  %24 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %90

25:                                               ; preds = %16
  %26 = getelementptr inbounds i8, ptr %3, i64 4
  %27 = load i32, ptr %26, align 4, !tbaa !13
  %28 = zext i32 %27 to i64
  %29 = shl nuw nsw i64 %28, 2
  %30 = getelementptr inbounds i8, ptr %1, i64 56
  %31 = call i32 @nus_memory_map_build(i64 noundef %29, i32 noundef 64, i32 noundef 2, ptr noundef nonnull %30) #6
  %.not25 = icmp eq i32 %31, 1
  br i1 %.not25, label %34, label %32

32:                                               ; preds = %25
  %33 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %90

34:                                               ; preds = %25
  %35 = getelementptr inbounds i8, ptr %3, i64 32
  %36 = load ptr, ptr %35, align 8, !tbaa !14
  %37 = load i32, ptr %26, align 4, !tbaa !13
  %38 = zext i32 %37 to i64
  %39 = shl nuw nsw i64 %38, 2
  %40 = call i32 @nus_memory_map_flush(ptr noundef nonnull byval(%struct.NUS_memory_map) align 8 %30, ptr noundef %36, i64 noundef %39) #6
  %.not26 = icmp eq i32 %40, 1
  br i1 %.not26, label %43, label %41

41:                                               ; preds = %34
  %42 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  br label %90

43:                                               ; preds = %34
  %44 = getelementptr inbounds i8, ptr %3, i64 16
  %45 = load i32, ptr %44, align 8, !tbaa !15
  %.not27 = icmp eq i32 %45, 0
  br i1 %.not27, label %63, label %46

46:                                               ; preds = %43
  %47 = getelementptr inbounds i8, ptr %3, i64 8
  %48 = load i32, ptr %47, align 8, !tbaa !16
  %49 = getelementptr inbounds i8, ptr %3, i64 12
  %50 = load i32, ptr %49, align 4, !tbaa !17
  %51 = getelementptr inbounds i8, ptr %1, i64 112
  %52 = call i32 @nus_texture_build(i32 noundef %48, i32 noundef %50, i32 noundef 37, i32 noundef 134, i32 noundef 2, i32 noundef 1, ptr noundef nonnull %51) #6
  %.not28 = icmp eq i32 %52, 1
  br i1 %.not28, label %55, label %53

53:                                               ; preds = %46
  %54 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.5)
  br label %90

55:                                               ; preds = %46
  %56 = getelementptr inbounds i8, ptr %3, i64 40
  %57 = load ptr, ptr %56, align 8, !tbaa !18
  %58 = load i32, ptr %44, align 8, !tbaa !15
  %59 = zext i32 %58 to i64
  %60 = call i32 @nus_texture_buffer_image(ptr noundef %57, i64 noundef %59, ptr noundef nonnull %51) #6
  %.not29 = icmp eq i32 %60, 1
  br i1 %.not29, label %63, label %61

61:                                               ; preds = %55
  %62 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.6)
  br label %90

63:                                               ; preds = %43, %55
  %.sink = phi i32 [ 1, %55 ], [ 0, %43 ]
  %64 = getelementptr inbounds i8, ptr %1, i64 208
  store i32 %.sink, ptr %64, align 8, !tbaa !19
  %65 = getelementptr inbounds i8, ptr %3, i64 48
  %66 = load i32, ptr %65, align 8, !tbaa !25
  %.not30 = icmp eq i32 %66, 0
  br i1 %.not30, label %.loopexit, label %67

67:                                               ; preds = %63
  %68 = getelementptr inbounds i8, ptr %1, i64 184
  %69 = call { i32, ptr } @nus_skeleton_build(ptr noundef nonnull %65) #6
  %70 = extractvalue { i32, ptr } %69, 0
  %71 = extractvalue { i32, ptr } %69, 1
  store i32 %70, ptr %68, align 8, !tbaa !26
  %.sroa.41.0..sroa_idx = getelementptr inbounds i8, ptr %1, i64 192
  store ptr %71, ptr %.sroa.41.0..sroa_idx, align 8, !tbaa !27
  %72 = getelementptr inbounds i8, ptr %3, i64 20
  %73 = load i32, ptr %72, align 4, !tbaa !28
  %.not31 = icmp eq i32 %73, 0
  br i1 %.not31, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %67
  %74 = getelementptr inbounds i8, ptr %1, i64 216
  store i32 %73, ptr %74, align 8, !tbaa !29
  %75 = zext i32 %73 to i64
  %76 = mul nuw nsw i64 %75, 96
  %77 = call noalias ptr @malloc(i64 noundef %76) #7
  %78 = getelementptr inbounds i8, ptr %1, i64 200
  store ptr %77, ptr %78, align 8, !tbaa !30
  %79 = getelementptr inbounds i8, ptr %3, i64 64
  br label %80

80:                                               ; preds = %.lr.ph, %80
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %80 ]
  %81 = load ptr, ptr %78, align 8, !tbaa !30
  %82 = getelementptr inbounds %struct.NUS_animation, ptr %81, i64 %indvars.iv
  call void @llvm.lifetime.start.p0(i64 96, ptr nonnull %4) #6
  %83 = load ptr, ptr %79, align 8, !tbaa !31
  %84 = getelementptr inbounds %struct.NUS_animation, ptr %83, i64 %indvars.iv
  call void @nus_animation_build(ptr dead_on_unwind nonnull writable sret(%struct.NUS_animation) align 8 %4, ptr noundef nonnull %68, ptr noundef %84) #6
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(96) %82, ptr noundef nonnull align 8 dereferenceable(96) %4, i64 96, i1 false), !tbaa.struct !32
  call void @llvm.lifetime.end.p0(i64 96, ptr nonnull %4) #6
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %85 = load i32, ptr %72, align 4, !tbaa !28
  %86 = zext i32 %85 to i64
  %87 = icmp ult i64 %indvars.iv.next, %86
  br i1 %87, label %80, label %.loopexit, !llvm.loop !36

.loopexit:                                        ; preds = %80, %63, %67
  %.sink36 = phi i32 [ 1, %67 ], [ 0, %63 ], [ 1, %80 ]
  %88 = getelementptr inbounds i8, ptr %1, i64 212
  store i32 %.sink36, ptr %88, align 4, !tbaa !38
  call void @nus_binary_model_free(ptr noundef nonnull %3) #6
  %89 = getelementptr inbounds i8, ptr %1, i64 224
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #6
  call void @nus_get_binding(ptr dead_on_unwind nonnull writable sret(%struct.NUS_binding) align 8 %5) #6
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(32) %89, ptr noundef nonnull align 8 dereferenceable(32) %5, i64 32, i1 false), !tbaa.struct !39
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #6
  br label %90

90:                                               ; preds = %.loopexit, %61, %53, %41, %32, %23, %14, %7
  %.0 = phi i32 [ 0, %7 ], [ 0, %14 ], [ 0, %23 ], [ 0, %32 ], [ 0, %41 ], [ 0, %53 ], [ 0, %61 ], [ 1, %.loopexit ]
  call void @llvm.lifetime.end.p0(i64 72, ptr nonnull %3) #6
  ret i32 %.0
}

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

declare i32 @nusm_read(ptr noundef, ptr noundef) local_unnamed_addr #2

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

declare i32 @nus_memory_map_build(i64 noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

declare i32 @nus_memory_map_flush(ptr noundef byval(%struct.NUS_memory_map) align 8, ptr noundef, i64 noundef) local_unnamed_addr #2

declare i32 @nus_texture_build(i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef, ptr noundef) local_unnamed_addr #2

declare i32 @nus_texture_buffer_image(ptr noundef, i64 noundef, ptr noundef) local_unnamed_addr #2

declare { i32, ptr } @nus_skeleton_build(ptr noundef) local_unnamed_addr #2

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

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

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

declare void @nus_animation_build(ptr dead_on_unwind writable sret(%struct.NUS_animation) align 8, ptr noundef, ptr noundef) local_unnamed_addr #2

declare void @nus_binary_model_free(ptr noundef) local_unnamed_addr #2

declare void @nus_get_binding(ptr dead_on_unwind writable sret(%struct.NUS_binding) align 8) local_unnamed_addr #2

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 = { mustprogress 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 = { 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { 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 #6 = { nounwind }
attributes #7 = { 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, !7, i64 0}
!6 = !{!"NUS_binary_model", !7, i64 0, !7, i64 4, !7, i64 8, !7, i64 12, !7, i64 16, !7, i64 20, !10, i64 24, !10, i64 32, !10, i64 40, !11, i64 48, !10, i64 64}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C/C++ TBAA"}
!10 = !{!"any pointer", !8, i64 0}
!11 = !{!"NUS_skeleton", !7, i64 0, !10, i64 8}
!12 = !{!6, !10, i64 24}
!13 = !{!6, !7, i64 4}
!14 = !{!6, !10, i64 32}
!15 = !{!6, !7, i64 16}
!16 = !{!6, !7, i64 8}
!17 = !{!6, !7, i64 12}
!18 = !{!6, !10, i64 40}
!19 = !{!20, !7, i64 208}
!20 = !{!"NUS_model", !21, i64 0, !21, i64 56, !24, i64 112, !11, i64 184, !10, i64 200, !7, i64 208, !7, i64 212, !7, i64 216, !23, i64 224}
!21 = !{!"NUS_memory_map", !10, i64 0, !10, i64 8, !22, i64 16, !23, i64 24}
!22 = !{!"long", !8, i64 0}
!23 = !{!"NUS_binding", !10, i64 0, !10, i64 8, !10, i64 16, !7, i64 24}
!24 = !{!"NUS_texture", !10, i64 0, !10, i64 8, !7, i64 16, !7, i64 20, !7, i64 24, !7, i64 28, !7, i64 32, !23, i64 40}
!25 = !{!6, !7, i64 48}
!26 = !{!7, !7, i64 0}
!27 = !{!10, !10, i64 0}
!28 = !{!6, !7, i64 20}
!29 = !{!20, !7, i64 216}
!30 = !{!20, !10, i64 200}
!31 = !{!6, !10, i64 64}
!32 = !{i64 0, i64 8, !27, i64 8, i64 64, !33, i64 72, i64 4, !34, i64 76, i64 4, !26, i64 80, i64 8, !27, i64 88, i64 8, !27}
!33 = !{!8, !8, i64 0}
!34 = !{!35, !35, i64 0}
!35 = !{!"float", !8, i64 0}
!36 = distinct !{!36, !37}
!37 = !{!"llvm.loop.mustprogress"}
!38 = !{!20, !7, i64 212}
!39 = !{i64 0, i64 8, !27, i64 8, i64 8, !27, i64 16, i64 8, !27, i64 24, i64 4, !26}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SCCPPass,SROAPass,SimplifyCFGPass