; LLVM IR from unitreerobotics/kinect_teleoperate :: src/mujoco-3.1.5/sample (basic)

; 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.mjvCamera_ = type { i32, i32, i32, [3 x double], double, double, double }
%struct.mjvOption_ = type { i32, i32, [6 x i8], [6 x i8], [6 x i8], [6 x i8], [6 x i8], [6 x i8], [6 x i8], [32 x i8], i32, i32 }
%struct.mjvScene_ = type { i32, i32, ptr, ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i8, i8, i8, i32, ptr, ptr, ptr, ptr, ptr, i32, [100 x %struct.mjvLight_], [2 x %struct.mjvGLCamera_], i8, [3 x float], [4 x float], float, i32, [10 x i8], i32, [3 x float] }
%struct.mjvLight_ = type { [3 x float], [3 x float], [3 x float], float, float, [3 x float], [3 x float], [3 x float], i8, i8, i8, float }
%struct.mjvGLCamera_ = type { [3 x float], [3 x float], [3 x float], float, float, float, float, float, float }
%struct.mjrContext_ = type { float, float, float, float, float, [4 x float], i32, i32, i32, i32, i32, [10 x i32], [10 x i32], [10 x i32], i32, i32, i32, i32, i32, i32, i32, i32, [10 x i32], [10 x i32], [10 x i32], [10 x i32], i32, [100 x i32], [100 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, [127 x i32], [127 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.mjrRect_ = type { i32, i32, i32, i32 }
%struct.mjData_ = type { i64, i64, i32, i64, i64, i64, i64, [128 x i64], i64, i32, i32, [8 x %struct.mjWarningStat_], [15 x %struct.mjTimerStat_], [4000 x %struct.mjSolverStat_], i32, [20 x i32], [20 x i32], [2 x double], i32, i32, i32, i32, i32, i32, i32, double, [2 x double], ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i64 }
%struct.mjWarningStat_ = type { i32, i32 }
%struct.mjTimerStat_ = type { double, i32 }
%struct.mjSolverStat_ = type { double, double, double, i32, i32, i32, i32 }

@m = external dso_local global ptr, align 8
@d = external dso_local global ptr, align 8
@cam = external dso_local global %struct.mjvCamera_, align 8
@opt = external dso_local global %struct.mjvOption_, align 4
@scn = external dso_local global %struct.mjvScene_, align 8
@con = external dso_local global %struct.mjrContext_, align 8
@.str = external hidden unnamed_addr constant [26 x i8], align 1
@__const.main.error = external hidden unnamed_addr constant [1000 x i8], align 16
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8keyboardP10GLFWwindowiiii(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z12mouse_buttonP10GLFWwindowiii(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z10mouse_moveP10GLFWwindowdd(ptr noundef, double noundef, double noundef) #0

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6scrollP10GLFWwindowdd(ptr noundef, double noundef, double noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main(i32 noundef %0, ptr noundef %1) #2 {
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca [1000 x i8], align 16
  %7 = alloca ptr, align 8
  %8 = alloca double, align 8
  %9 = alloca %struct.mjrRect_, align 4
  %10 = alloca %struct.mjrRect_, 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
  %11 = load i32, ptr %4, align 4, !tbaa !5
  %12 = icmp ne i32 %11, 2
  br i1 %12, label %13, label %15

13:                                               ; preds = %2
  %14 = call i32 (ptr, ...) @printf(ptr noundef @.str)
  store i32 0, ptr %3, align 4
  br label %101

15:                                               ; preds = %2
  call void @llvm.lifetime.start.p0(i64 1000, ptr %6) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %6, ptr align 16 @__const.main.error, i64 1000, i1 false)
  %16 = load ptr, ptr %5, align 8, !tbaa !9
  %17 = getelementptr inbounds ptr, ptr %16, i64 1
  %18 = load ptr, ptr %17, align 8, !tbaa !9
  %19 = call i64 @strlen(ptr noundef %18) #8
  %20 = icmp ugt i64 %19, 4
  br i1 %20, label %21, label %38

21:                                               ; preds = %15
  %22 = load ptr, ptr %5, align 8, !tbaa !9
  %23 = getelementptr inbounds ptr, ptr %22, i64 1
  %24 = load ptr, ptr %23, align 8, !tbaa !9
  %25 = load ptr, ptr %5, align 8, !tbaa !9
  %26 = getelementptr inbounds ptr, ptr %25, i64 1
  %27 = load ptr, ptr %26, align 8, !tbaa !9
  %28 = call i64 @strlen(ptr noundef %27) #8
  %29 = getelementptr inbounds i8, ptr %24, i64 %28
  %30 = getelementptr inbounds i8, ptr %29, i64 -4
  %31 = call i32 @strcmp(ptr noundef %30, ptr noundef @.str.1) #8
  %32 = icmp ne i32 %31, 0
  br i1 %32, label %38, label %33

33:                                               ; preds = %21
  %34 = load ptr, ptr %5, align 8, !tbaa !9
  %35 = getelementptr inbounds ptr, ptr %34, i64 1
  %36 = load ptr, ptr %35, align 8, !tbaa !9
  %37 = call ptr @mj_loadModel(ptr noundef %36, ptr noundef null)
  store ptr %37, ptr @m, align 8, !tbaa !9
  br label %44

38:                                               ; preds = %21, %15
  %39 = load ptr, ptr %5, align 8, !tbaa !9
  %40 = getelementptr inbounds ptr, ptr %39, i64 1
  %41 = load ptr, ptr %40, align 8, !tbaa !9
  %42 = getelementptr inbounds [1000 x i8], ptr %6, i64 0, i64 0
  %43 = call ptr @mj_loadXML(ptr noundef %41, ptr noundef null, ptr noundef %42, i32 noundef 1000)
  store ptr %43, ptr @m, align 8, !tbaa !9
  br label %44

44:                                               ; preds = %38, %33
  %45 = load ptr, ptr @m, align 8, !tbaa !9
  %46 = icmp ne ptr %45, null
  br i1 %46, label %49, label %47

47:                                               ; preds = %44
  %48 = getelementptr inbounds [1000 x i8], ptr %6, i64 0, i64 0
  call void (ptr, ...) @mju_error(ptr noundef @.str.2, ptr noundef %48)
  br label %49

49:                                               ; preds = %47, %44
  %50 = load ptr, ptr @m, align 8, !tbaa !9
  %51 = call ptr @mj_makeData(ptr noundef %50)
  store ptr %51, ptr @d, align 8, !tbaa !9
  %52 = call i32 @glfwInit()
  %53 = icmp ne i32 %52, 0
  br i1 %53, label %55, label %54

54:                                               ; preds = %49
  call void (ptr, ...) @mju_error(ptr noundef @.str.3)
  br label %55

55:                                               ; preds = %54, %49
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %56 = call ptr @glfwCreateWindow(i32 noundef 1200, i32 noundef 900, ptr noundef @.str.4, ptr noundef null, ptr noundef null)
  store ptr %56, ptr %7, align 8, !tbaa !9
  %57 = load ptr, ptr %7, align 8, !tbaa !9
  call void @glfwMakeContextCurrent(ptr noundef %57)
  call void @glfwSwapInterval(i32 noundef 1)
  call void @mjv_defaultCamera(ptr noundef @cam)
  call void @mjv_defaultOption(ptr noundef @opt)
  call void @mjv_defaultScene(ptr noundef @scn)
  call void @mjr_defaultContext(ptr noundef @con)
  %58 = load ptr, ptr @m, align 8, !tbaa !9
  call void @mjv_makeScene(ptr noundef %58, ptr noundef @scn, i32 noundef 2000)
  %59 = load ptr, ptr @m, align 8, !tbaa !9
  call void @mjr_makeContext(ptr noundef %59, ptr noundef @con, i32 noundef 150)
  %60 = load ptr, ptr %7, align 8, !tbaa !9
  %61 = call ptr @glfwSetKeyCallback(ptr noundef %60, ptr noundef @_Z8keyboardP10GLFWwindowiiii)
  %62 = load ptr, ptr %7, align 8, !tbaa !9
  %63 = call ptr @glfwSetCursorPosCallback(ptr noundef %62, ptr noundef @_Z10mouse_moveP10GLFWwindowdd)
  %64 = load ptr, ptr %7, align 8, !tbaa !9
  %65 = call ptr @glfwSetMouseButtonCallback(ptr noundef %64, ptr noundef @_Z12mouse_buttonP10GLFWwindowiii)
  %66 = load ptr, ptr %7, align 8, !tbaa !9
  %67 = call ptr @glfwSetScrollCallback(ptr noundef %66, ptr noundef @_Z6scrollP10GLFWwindowdd)
  br label %68

68:                                               ; preds = %87, %55
  %69 = load ptr, ptr %7, align 8, !tbaa !9
  %70 = call i32 @glfwWindowShouldClose(ptr noundef %69)
  %71 = icmp ne i32 %70, 0
  %72 = xor i1 %71, true
  br i1 %72, label %73, label %98

73:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %74 = load ptr, ptr @d, align 8, !tbaa !9
  %75 = getelementptr inbounds %struct.mjData_, ptr %74, i32 0, i32 25
  %76 = load double, ptr %75, align 8, !tbaa !11
  store double %76, ptr %8, align 8, !tbaa !15
  br label %77

77:                                               ; preds = %84, %73
  %78 = load ptr, ptr @d, align 8, !tbaa !9
  %79 = getelementptr inbounds %struct.mjData_, ptr %78, i32 0, i32 25
  %80 = load double, ptr %79, align 8, !tbaa !11
  %81 = load double, ptr %8, align 8, !tbaa !15
  %82 = fsub double %80, %81
  %83 = fcmp olt double %82, 0x3F91111111111111
  br i1 %83, label %84, label %87

84:                                               ; preds = %77
  %85 = load ptr, ptr @m, align 8, !tbaa !9
  %86 = load ptr, ptr @d, align 8, !tbaa !9
  call void @mj_step(ptr noundef %85, ptr noundef %86)
  br label %77, !llvm.loop !16

87:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 16, ptr %9) #7
  call void @llvm.memset.p0.i64(ptr align 4 %9, i8 0, i64 16, i1 false)
  %88 = load ptr, ptr %7, align 8, !tbaa !9
  %89 = getelementptr inbounds %struct.mjrRect_, ptr %9, i32 0, i32 2
  %90 = getelementptr inbounds %struct.mjrRect_, ptr %9, i32 0, i32 3
  call void @glfwGetFramebufferSize(ptr noundef %88, ptr noundef %89, ptr noundef %90)
  %91 = load ptr, ptr @m, align 8, !tbaa !9
  %92 = load ptr, ptr @d, align 8, !tbaa !9
  call void @mjv_updateScene(ptr noundef %91, ptr noundef %92, ptr noundef @opt, ptr noundef null, ptr noundef @cam, i32 noundef 7, ptr noundef @scn)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %10, ptr align 4 %9, i64 16, i1 false), !tbaa.struct !18
  %93 = getelementptr inbounds { i64, i64 }, ptr %10, i32 0, i32 0
  %94 = load i64, ptr %93, align 4
  %95 = getelementptr inbounds { i64, i64 }, ptr %10, i32 0, i32 1
  %96 = load i64, ptr %95, align 4
  call void @mjr_render(i64 %94, i64 %96, ptr noundef @scn, ptr noundef @con)
  %97 = load ptr, ptr %7, align 8, !tbaa !9
  call void @glfwSwapBuffers(ptr noundef %97)
  call void @glfwPollEvents()
  call void @llvm.lifetime.end.p0(i64 16, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %68, !llvm.loop !19

98:                                               ; preds = %68
  call void @mjv_freeScene(ptr noundef @scn)
  call void @mjr_freeContext(ptr noundef @con)
  %99 = load ptr, ptr @d, align 8, !tbaa !9
  call void @mj_deleteData(ptr noundef %99)
  %100 = load ptr, ptr @m, align 8, !tbaa !9
  call void @mj_deleteModel(ptr noundef %100)
  store i32 1, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 1000, ptr %6) #7
  br label %101

101:                                              ; preds = %98, %13
  %102 = load i32, ptr %3, align 4
  ret i32 %102
}

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

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

; Function Attrs: nounwind willreturn memory(read)
declare i64 @strlen(ptr noundef) #5

; Function Attrs: nounwind willreturn memory(read)
declare i32 @strcmp(ptr noundef, ptr noundef) #5

declare ptr @mj_loadModel(ptr noundef, ptr noundef) #3

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

declare void @mju_error(ptr noundef, ...) #3

declare ptr @mj_makeData(ptr noundef) #3

declare i32 @glfwInit() #3

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

declare void @glfwMakeContextCurrent(ptr noundef) #3

declare void @glfwSwapInterval(i32 noundef) #3

declare void @mjv_defaultCamera(ptr noundef) #3

declare void @mjv_defaultOption(ptr noundef) #3

declare void @mjv_defaultScene(ptr noundef) #3

declare void @mjr_defaultContext(ptr noundef) #3

declare void @mjv_makeScene(ptr noundef, ptr noundef, i32 noundef) #3

declare void @mjr_makeContext(ptr noundef, ptr noundef, i32 noundef) #3

declare ptr @glfwSetKeyCallback(ptr noundef, ptr noundef) #3

declare ptr @glfwSetCursorPosCallback(ptr noundef, ptr noundef) #3

declare ptr @glfwSetMouseButtonCallback(ptr noundef, ptr noundef) #3

declare ptr @glfwSetScrollCallback(ptr noundef, ptr noundef) #3

declare i32 @glfwWindowShouldClose(ptr noundef) #3

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #6

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

declare void @mjv_updateScene(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

declare void @mjr_render(i64, i64, ptr noundef, ptr noundef) #3

declare void @glfwSwapBuffers(ptr noundef) #3

declare void @glfwPollEvents() #3

declare void @mjv_freeScene(ptr noundef) #3

declare void @mjr_freeContext(ptr noundef) #3

declare void @mj_deleteData(ptr noundef) #3

declare void @mj_deleteModel(ptr noundef) #3

attributes #0 = { mustprogress 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 = { mustprogress norecurse 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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind willreturn memory(read) "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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #7 = { nounwind }
attributes #8 = { nounwind willreturn memory(read) }

!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++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"any pointer", !7, i64 0}
!11 = !{!12, !14, i64 161616}
!12 = !{!"_ZTS7mjData_", !13, i64 0, !13, i64 8, !6, i64 16, !13, i64 24, !13, i64 32, !13, i64 40, !13, i64 48, !7, i64 56, !13, i64 1080, !6, i64 1088, !6, i64 1092, !7, i64 1096, !7, i64 1160, !7, i64 1400, !6, i64 161400, !7, i64 161404, !7, i64 161484, !7, i64 161568, !6, i64 161584, !6, i64 161588, !6, i64 161592, !6, i64 161596, !6, i64 161600, !6, i64 161604, !6, i64 161608, !14, i64 161616, !7, i64 161624, !10, i64 161640, !10, i64 161648, !10, i64 161656, !10, i64 161664, !10, i64 161672, !10, i64 161680, !10, i64 161688, !10, i64 161696, !10, i64 161704, !10, i64 161712, !10, i64 161720, !10, i64 161728, !10, i64 161736, !10, i64 161744, !10, i64 161752, !10, i64 161760, !10, i64 161768, !10, i64 161776, !10, i64 161784, !10, i64 161792, !10, i64 161800, !10, i64 161808, !10, i64 161816, !10, i64 161824, !10, i64 161832, !10, i64 161840, !10, i64 161848, !10, i64 161856, !10, i64 161864, !10, i64 161872, !10, i64 161880, !10, i64 161888, !10, i64 161896, !10, i64 161904, !10, i64 161912, !10, i64 161920, !10, i64 161928, !10, i64 161936, !10, i64 161944, !10, i64 161952, !10, i64 161960, !10, i64 161968, !10, i64 161976, !10, i64 161984, !10, i64 161992, !10, i64 162000, !10, i64 162008, !10, i64 162016, !10, i64 162024, !10, i64 162032, !10, i64 162040, !10, i64 162048, !10, i64 162056, !10, i64 162064, !10, i64 162072, !10, i64 162080, !10, i64 162088, !10, i64 162096, !10, i64 162104, !10, i64 162112, !10, i64 162120, !10, i64 162128, !10, i64 162136, !10, i64 162144, !10, i64 162152, !10, i64 162160, !10, i64 162168, !10, i64 162176, !10, i64 162184, !10, i64 162192, !10, i64 162200, !10, i64 162208, !10, i64 162216, !10, i64 162224, !10, i64 162232, !10, i64 162240, !10, i64 162248, !10, i64 162256, !10, i64 162264, !10, i64 162272, !10, i64 162280, !10, i64 162288, !10, i64 162296, !10, i64 162304, !10, i64 162312, !10, i64 162320, !10, i64 162328, !10, i64 162336, !10, i64 162344, !10, i64 162352, !10, i64 162360, !10, i64 162368, !10, i64 162376, !10, i64 162384, !10, i64 162392, !10, i64 162400, !10, i64 162408, !10, i64 162416, !10, i64 162424, !10, i64 162432, !10, i64 162440, !10, i64 162448, !10, i64 162456, !10, i64 162464, !10, i64 162472, !10, i64 162480, !10, i64 162488, !10, i64 162496, !10, i64 162504, !10, i64 162512, !10, i64 162520, !10, i64 162528, !10, i64 162536, !10, i64 162544, !10, i64 162552, !10, i64 162560, !10, i64 162568, !10, i64 162576, !10, i64 162584, !10, i64 162592, !10, i64 162600, !10, i64 162608, !10, i64 162616, !10, i64 162624, !10, i64 162632, !10, i64 162640, !10, i64 162648, !10, i64 162656, !10, i64 162664, !10, i64 162672, !10, i64 162680, !10, i64 162688, !10, i64 162696, !13, i64 162704}
!13 = !{!"long", !7, i64 0}
!14 = !{!"double", !7, i64 0}
!15 = !{!14, !14, i64 0}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}
!18 = !{i64 0, i64 4, !5, i64 4, i64 4, !5, i64 8, i64 4, !5, i64 12, i64 4, !5}
!19 = distinct !{!19, !17}


; 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.mjvCamera_ = type { i32, i32, i32, [3 x double], double, double, double }
%struct.mjvOption_ = type { i32, i32, [6 x i8], [6 x i8], [6 x i8], [6 x i8], [6 x i8], [6 x i8], [6 x i8], [32 x i8], i32, i32 }
%struct.mjvScene_ = type { i32, i32, ptr, ptr, i32, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, i8, i8, i8, i8, i32, ptr, ptr, ptr, ptr, ptr, i32, [100 x %struct.mjvLight_], [2 x %struct.mjvGLCamera_], i8, [3 x float], [4 x float], float, i32, [10 x i8], i32, [3 x float] }
%struct.mjvLight_ = type { [3 x float], [3 x float], [3 x float], float, float, [3 x float], [3 x float], [3 x float], i8, i8, i8, float }
%struct.mjvGLCamera_ = type { [3 x float], [3 x float], [3 x float], float, float, float, float, float, float }
%struct.mjrContext_ = type { float, float, float, float, float, [4 x float], i32, i32, i32, i32, i32, [10 x i32], [10 x i32], [10 x i32], i32, i32, i32, i32, i32, i32, i32, i32, [10 x i32], [10 x i32], [10 x i32], [10 x i32], i32, [100 x i32], [100 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, ptr, ptr, ptr, ptr, [127 x i32], [127 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.mjrRect_ = type { i32, i32, i32, i32 }

@m = external dso_local local_unnamed_addr global ptr, align 8
@d = external dso_local local_unnamed_addr global ptr, align 8
@cam = external dso_local global %struct.mjvCamera_, align 8
@opt = external dso_local global %struct.mjvOption_, align 4
@scn = external dso_local global %struct.mjvScene_, align 8
@con = external dso_local global %struct.mjrContext_, align 8
@.str = external hidden unnamed_addr constant [26 x i8], align 1
@__const.main.error = external hidden unnamed_addr constant [1000 x i8], align 16
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [21 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [26 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [5 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8keyboardP10GLFWwindowiiii(ptr noundef, i32 noundef, i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z12mouse_buttonP10GLFWwindowiii(ptr noundef, i32 noundef, i32 noundef, i32 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z10mouse_moveP10GLFWwindowdd(ptr noundef, double noundef, double noundef) #0

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

; 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 uwtable
declare dso_local void @_Z6scrollP10GLFWwindowdd(ptr noundef, double noundef, double noundef) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef range(i32 0, 2) i32 @main(i32 noundef %0, ptr nocapture noundef readonly %1) local_unnamed_addr #2 {
  %3 = alloca [1000 x i8], align 16
  %4 = alloca %struct.mjrRect_, align 8
  %.not = icmp eq i32 %0, 2
  br i1 %.not, label %7, label %5

5:                                                ; preds = %2
  %6 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str)
  br label %56

7:                                                ; preds = %2
  call void @llvm.lifetime.start.p0(i64 1000, ptr nonnull %3) #8
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 16 dereferenceable(1000) %3, ptr noundef nonnull align 16 dereferenceable(1000) @__const.main.error, i64 1000, i1 false)
  %8 = getelementptr inbounds i8, ptr %1, i64 8
  %9 = load ptr, ptr %8, align 8, !tbaa !5
  %10 = tail call i64 @strlen(ptr noundef nonnull dereferenceable(1) %9) #9
  %11 = icmp ugt i64 %10, 4
  br i1 %11, label %12, label %18

12:                                               ; preds = %7
  %13 = getelementptr inbounds i8, ptr %9, i64 %10
  %14 = getelementptr inbounds i8, ptr %13, i64 -4
  %15 = tail call i32 @strcmp(ptr noundef nonnull dereferenceable(1) %14, ptr noundef nonnull dereferenceable(1) @.str.1) #9
  %.not16 = icmp eq i32 %15, 0
  br i1 %.not16, label %16, label %18

16:                                               ; preds = %12
  %17 = tail call ptr @mj_loadModel(ptr noundef %9, ptr noundef null)
  br label %20

18:                                               ; preds = %12, %7
  %19 = call ptr @mj_loadXML(ptr noundef %9, ptr noundef null, ptr noundef nonnull %3, i32 noundef 1000)
  br label %20

20:                                               ; preds = %18, %16
  %storemerge = phi ptr [ %17, %16 ], [ %19, %18 ]
  store ptr %storemerge, ptr @m, align 8, !tbaa !5
  %.not17 = icmp eq ptr %storemerge, null
  br i1 %.not17, label %21, label %22

21:                                               ; preds = %20
  call void (ptr, ...) @mju_error(ptr noundef nonnull @.str.2, ptr noundef nonnull %3)
  %.pre = load ptr, ptr @m, align 8, !tbaa !5
  br label %22

22:                                               ; preds = %21, %20
  %23 = phi ptr [ %.pre, %21 ], [ %storemerge, %20 ]
  %24 = call ptr @mj_makeData(ptr noundef %23)
  store ptr %24, ptr @d, align 8, !tbaa !5
  %25 = call i32 @glfwInit()
  %.not18 = icmp eq i32 %25, 0
  br i1 %.not18, label %26, label %27

26:                                               ; preds = %22
  call void (ptr, ...) @mju_error(ptr noundef nonnull @.str.3)
  br label %27

27:                                               ; preds = %26, %22
  %28 = call ptr @glfwCreateWindow(i32 noundef 1200, i32 noundef 900, ptr noundef nonnull @.str.4, ptr noundef null, ptr noundef null)
  call void @glfwMakeContextCurrent(ptr noundef %28)
  call void @glfwSwapInterval(i32 noundef 1)
  call void @mjv_defaultCamera(ptr noundef nonnull @cam)
  call void @mjv_defaultOption(ptr noundef nonnull @opt)
  call void @mjv_defaultScene(ptr noundef nonnull @scn)
  call void @mjr_defaultContext(ptr noundef nonnull @con)
  %29 = load ptr, ptr @m, align 8, !tbaa !5
  call void @mjv_makeScene(ptr noundef %29, ptr noundef nonnull @scn, i32 noundef 2000)
  %30 = load ptr, ptr @m, align 8, !tbaa !5
  call void @mjr_makeContext(ptr noundef %30, ptr noundef nonnull @con, i32 noundef 150)
  %31 = call ptr @glfwSetKeyCallback(ptr noundef %28, ptr noundef nonnull @_Z8keyboardP10GLFWwindowiiii)
  %32 = call ptr @glfwSetCursorPosCallback(ptr noundef %28, ptr noundef nonnull @_Z10mouse_moveP10GLFWwindowdd)
  %33 = call ptr @glfwSetMouseButtonCallback(ptr noundef %28, ptr noundef nonnull @_Z12mouse_buttonP10GLFWwindowiii)
  %34 = call ptr @glfwSetScrollCallback(ptr noundef %28, ptr noundef nonnull @_Z6scrollP10GLFWwindowdd)
  %35 = call i32 @glfwWindowShouldClose(ptr noundef %28)
  %.not1920 = icmp eq i32 %35, 0
  br i1 %.not1920, label %.lr.ph22, label %._crit_edge23

.lr.ph22:                                         ; preds = %27
  %36 = getelementptr inbounds i8, ptr %4, i64 8
  %37 = getelementptr inbounds i8, ptr %4, i64 12
  br label %38

38:                                               ; preds = %.lr.ph22, %._crit_edge
  %39 = load ptr, ptr @d, align 8, !tbaa !5
  %40 = getelementptr inbounds i8, ptr %39, i64 161616
  %41 = load double, ptr %40, align 8, !tbaa !9
  %42 = fsub double %41, %41
  %43 = fcmp olt double %42, 0x3F91111111111111
  br i1 %43, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %38, %.lr.ph
  %44 = phi ptr [ %46, %.lr.ph ], [ %39, %38 ]
  %45 = load ptr, ptr @m, align 8, !tbaa !5
  call void @mj_step(ptr noundef %45, ptr noundef nonnull %44)
  %46 = load ptr, ptr @d, align 8, !tbaa !5
  %47 = getelementptr inbounds i8, ptr %46, i64 161616
  %48 = load double, ptr %47, align 8, !tbaa !9
  %49 = fsub double %48, %41
  %50 = fcmp olt double %49, 0x3F91111111111111
  br i1 %50, label %.lr.ph, label %._crit_edge, !llvm.loop !14

._crit_edge:                                      ; preds = %.lr.ph, %38
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #8
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %4, i8 0, i64 16, i1 false)
  call void @glfwGetFramebufferSize(ptr noundef %28, ptr noundef nonnull %36, ptr noundef nonnull %37)
  %51 = load ptr, ptr @m, align 8, !tbaa !5
  %52 = load ptr, ptr @d, align 8, !tbaa !5
  call void @mjv_updateScene(ptr noundef %51, ptr noundef %52, ptr noundef nonnull @opt, ptr noundef null, ptr noundef nonnull @cam, i32 noundef 7, ptr noundef nonnull @scn)
  %.sroa.0.0.copyload = load i64, ptr %4, align 8
  %.sroa.2.0.copyload = load i64, ptr %36, align 8
  call void @mjr_render(i64 %.sroa.0.0.copyload, i64 %.sroa.2.0.copyload, ptr noundef nonnull @scn, ptr noundef nonnull @con)
  call void @glfwSwapBuffers(ptr noundef %28)
  call void @glfwPollEvents()
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #8
  %53 = call i32 @glfwWindowShouldClose(ptr noundef %28)
  %.not19 = icmp eq i32 %53, 0
  br i1 %.not19, label %38, label %._crit_edge23, !llvm.loop !16

._crit_edge23:                                    ; preds = %._crit_edge, %27
  call void @mjv_freeScene(ptr noundef nonnull @scn)
  call void @mjr_freeContext(ptr noundef nonnull @con)
  %54 = load ptr, ptr @d, align 8, !tbaa !5
  call void @mj_deleteData(ptr noundef %54)
  %55 = load ptr, ptr @m, align 8, !tbaa !5
  call void @mj_deleteModel(ptr noundef %55)
  call void @llvm.lifetime.end.p0(i64 1000, ptr nonnull %3) #8
  br label %56

56:                                               ; preds = %._crit_edge23, %5
  %.0 = phi i32 [ 0, %5 ], [ 1, %._crit_edge23 ]
  ret i32 %.0
}

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

; 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 nofree nounwind willreturn memory(argmem: read)
declare i64 @strlen(ptr nocapture noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nofree nounwind willreturn memory(argmem: read)
declare i32 @strcmp(ptr nocapture noundef, ptr nocapture noundef) local_unnamed_addr #5

declare ptr @mj_loadModel(ptr noundef, ptr noundef) local_unnamed_addr #6

declare ptr @mj_loadXML(ptr noundef, ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #6

declare void @mju_error(ptr noundef, ...) local_unnamed_addr #6

declare ptr @mj_makeData(ptr noundef) local_unnamed_addr #6

declare i32 @glfwInit() local_unnamed_addr #6

declare ptr @glfwCreateWindow(i32 noundef, i32 noundef, ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #6

declare void @glfwMakeContextCurrent(ptr noundef) local_unnamed_addr #6

declare void @glfwSwapInterval(i32 noundef) local_unnamed_addr #6

declare void @mjv_defaultCamera(ptr noundef) local_unnamed_addr #6

declare void @mjv_defaultOption(ptr noundef) local_unnamed_addr #6

declare void @mjv_defaultScene(ptr noundef) local_unnamed_addr #6

declare void @mjr_defaultContext(ptr noundef) local_unnamed_addr #6

declare void @mjv_makeScene(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #6

declare void @mjr_makeContext(ptr noundef, ptr noundef, i32 noundef) local_unnamed_addr #6

declare ptr @glfwSetKeyCallback(ptr noundef, ptr noundef) local_unnamed_addr #6

declare ptr @glfwSetCursorPosCallback(ptr noundef, ptr noundef) local_unnamed_addr #6

declare ptr @glfwSetMouseButtonCallback(ptr noundef, ptr noundef) local_unnamed_addr #6

declare ptr @glfwSetScrollCallback(ptr noundef, ptr noundef) local_unnamed_addr #6

declare i32 @glfwWindowShouldClose(ptr noundef) local_unnamed_addr #6

declare void @mj_step(ptr noundef, ptr noundef) local_unnamed_addr #6

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #7

declare void @glfwGetFramebufferSize(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #6

declare void @mjv_updateScene(ptr noundef, ptr noundef, ptr noundef, ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #6

declare void @mjr_render(i64, i64, ptr noundef, ptr noundef) local_unnamed_addr #6

declare void @glfwSwapBuffers(ptr noundef) local_unnamed_addr #6

declare void @glfwPollEvents() local_unnamed_addr #6

declare void @mjv_freeScene(ptr noundef) local_unnamed_addr #6

declare void @mjr_freeContext(ptr noundef) local_unnamed_addr #6

declare void @mj_deleteData(ptr noundef) local_unnamed_addr #6

declare void @mj_deleteModel(ptr noundef) local_unnamed_addr #6

attributes #0 = { mustprogress 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 = { mustprogress norecurse 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 = { 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 memory(argmem: read) "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 = { "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 #7 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #8 = { nounwind }
attributes #9 = { nounwind willreturn memory(read) }

!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++ TBAA"}
!9 = !{!10, !13, i64 161616}
!10 = !{!"_ZTS7mjData_", !11, i64 0, !11, i64 8, !12, i64 16, !11, i64 24, !11, i64 32, !11, i64 40, !11, i64 48, !7, i64 56, !11, i64 1080, !12, i64 1088, !12, i64 1092, !7, i64 1096, !7, i64 1160, !7, i64 1400, !12, i64 161400, !7, i64 161404, !7, i64 161484, !7, i64 161568, !12, i64 161584, !12, i64 161588, !12, i64 161592, !12, i64 161596, !12, i64 161600, !12, i64 161604, !12, i64 161608, !13, i64 161616, !7, i64 161624, !6, i64 161640, !6, i64 161648, !6, i64 161656, !6, i64 161664, !6, i64 161672, !6, i64 161680, !6, i64 161688, !6, i64 161696, !6, i64 161704, !6, i64 161712, !6, i64 161720, !6, i64 161728, !6, i64 161736, !6, i64 161744, !6, i64 161752, !6, i64 161760, !6, i64 161768, !6, i64 161776, !6, i64 161784, !6, i64 161792, !6, i64 161800, !6, i64 161808, !6, i64 161816, !6, i64 161824, !6, i64 161832, !6, i64 161840, !6, i64 161848, !6, i64 161856, !6, i64 161864, !6, i64 161872, !6, i64 161880, !6, i64 161888, !6, i64 161896, !6, i64 161904, !6, i64 161912, !6, i64 161920, !6, i64 161928, !6, i64 161936, !6, i64 161944, !6, i64 161952, !6, i64 161960, !6, i64 161968, !6, i64 161976, !6, i64 161984, !6, i64 161992, !6, i64 162000, !6, i64 162008, !6, i64 162016, !6, i64 162024, !6, i64 162032, !6, i64 162040, !6, i64 162048, !6, i64 162056, !6, i64 162064, !6, i64 162072, !6, i64 162080, !6, i64 162088, !6, i64 162096, !6, i64 162104, !6, i64 162112, !6, i64 162120, !6, i64 162128, !6, i64 162136, !6, i64 162144, !6, i64 162152, !6, i64 162160, !6, i64 162168, !6, i64 162176, !6, i64 162184, !6, i64 162192, !6, i64 162200, !6, i64 162208, !6, i64 162216, !6, i64 162224, !6, i64 162232, !6, i64 162240, !6, i64 162248, !6, i64 162256, !6, i64 162264, !6, i64 162272, !6, i64 162280, !6, i64 162288, !6, i64 162296, !6, i64 162304, !6, i64 162312, !6, i64 162320, !6, i64 162328, !6, i64 162336, !6, i64 162344, !6, i64 162352, !6, i64 162360, !6, i64 162368, !6, i64 162376, !6, i64 162384, !6, i64 162392, !6, i64 162400, !6, i64 162408, !6, i64 162416, !6, i64 162424, !6, i64 162432, !6, i64 162440, !6, i64 162448, !6, i64 162456, !6, i64 162464, !6, i64 162472, !6, i64 162480, !6, i64 162488, !6, i64 162496, !6, i64 162504, !6, i64 162512, !6, i64 162520, !6, i64 162528, !6, i64 162536, !6, i64 162544, !6, i64 162552, !6, i64 162560, !6, i64 162568, !6, i64 162576, !6, i64 162584, !6, i64 162592, !6, i64 162600, !6, i64 162608, !6, i64 162616, !6, i64 162624, !6, i64 162632, !6, i64 162640, !6, i64 162648, !6, i64 162656, !6, i64 162664, !6, i64 162672, !6, i64 162680, !6, i64 162688, !6, i64 162696, !11, i64 162704}
!11 = !{!"long", !7, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!"double", !7, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = distinct !{!16, !15}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass