{"type": "func", "start": 307288, "end": 307542, "name": "sub_4B058", "pseudocode": "// \n// sub_4B058 from 0x4b058 to 0x4b156 (254 bytes)\n// \n// 2 xrefs:\n// > sub_4A934 @ 0x4a976\n// > FMOD::Channel::getLoopPoints @ 0xad918\n// \n// This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!\n// \n// Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n// Generated at Fri, 27 Nov 2026 11:40:40 +0000\n// \n\nint __fastcall sub_4B058(int a1, _DWORD *a2, unsigned int a3, int *a4, unsigned int a5)\n{\n  int v5; // r4\n  int result; // r0\n  int v9; // r6\n  int v10; // r0\n\n  v5 = *(_DWORD *)(a1 + 332);\n  if ( !v5 )\n    return 30;\n  result = 19;\n  if ( a3 <= 4 && ((1 << a3) & 0x16) != 0 )\n  {\n    result = 19;\n    if ( a5 <= 4 && ((1 << a5) & 0x16) != 0 )\n    {\n      v9 = *(_DWORD *)(v5 + 20);\n      if ( v9 )\n      {\n        if ( a2 )\n        {\n          switch ( a3 )\n          {\n            case 1u:\n              *a2 = (unsigned int)(float)((float)((float)((float)*(unsigned int *)(v5 + 56) * 1000.0)\n                                                / *(float *)(v9 + 80))\n                                        + 0.5);\n              break;\n            case 4u:\n              sub_4C6EA(*(_DWORD *)(v5 + 56), a2, *(_DWORD *)(v9 + 76), *(_DWORD *)(v9 + 24));\n              break;\n            case 2u:\n              *a2 = *(_DWORD *)(v5 + 56);\n              break;\n          }\n        }\n        if ( a4 )\n        {\n          v10 = *(_DWORD *)(*(_DWORD *)(a1 + 332) + 56) + *(_DWORD *)(*(_DWORD *)(a1 + 332) + 60) - 1;\n          switch ( a5 )\n          {\n            case 1u:\n              *a4 = (unsigned int)(float)((float)((float)((float)(unsigned int)v10 * 1000.0) / *(float *)(v9 + 80)) + 0.5);\n              break;\n            case 4u:\n              sub_4C6EA(v10, a4, *(_DWORD *)(v9 + 76), *(_DWORD *)(v9 + 24));\n              break;\n            case 2u:\n              *a4 = v10;\n              break;\n          }\n        }\n        return 0;\n      }\n      else\n      {\n        return 31;\n      }\n    }\n  }\n  return result;\n}", "assembly": "; \n; sub_4B058 from 0x4b058 to 0x4b156 (254 bytes)\n; \n; 2 xrefs:\n; > sub_4A934 @ 0x4a976\n; > FMOD::Channel::getLoopPoints @ 0xad918\n; \n; This function is hookable on this platform (idp: arm, 32 bit: True, 64 bit: False!\n; \n; Using BromaIDA 8.3.0 @ https://github.com/Stazzical/BromaIDA\n; Using bindings at commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings\n; Generated at Fri, 27 Nov 2026 11:40:40 +0000\n; \nPUSH            {R4-R7,LR}                                             ; +0x0, 0x4b058\nADD             R7, SP, #0xC                                           ; +0x2, 0x4b05a\nPUSH.W          {R6-R9,R11}                                            ; +0x4, 0x4b05c\nLDR.W           R4, [R0,#0x14C]                                        ; +0x8, 0x4b060\nCBZ             R4, loc_4B0AA                                          ; +0xc, 0x4b064\nMOV             R5, R0                                                 ; +0xe, 0x4b066\nMOVS            R0, #0x13                                              ; +0x10, 0x4b068\nCMP             R2, #4                                                 ; +0x12, 0x4b06a\nBHI             loc_4B150                                              ; +0x14, 0x4b06c\nMOV             R9, R3                                                 ; +0x16, 0x4b06e\nMOVS            R3, #1                                                 ; +0x18, 0x4b070\nLSLS            R3, R2                                                 ; +0x1a, 0x4b072\nTST.W           R3, #0x16                                              ; +0x1c, 0x4b074\nBEQ             loc_4B150                                              ; +0x20, 0x4b078\nLDR.W           R8, [R7,#-0x18+arg_0]                                  ; +0x22, 0x4b07a\nMOVS            R0, #0x13                                              ; +0x26, 0x4b07e\nCMP.W           R8, #4                                                 ; +0x28, 0x4b080\nBHI             loc_4B150                                              ; +0x2c, 0x4b084\nMOVS            R3, #1                                                 ; +0x2e, 0x4b086\nLSL.W           R3, R3, R8                                             ; +0x30, 0x4b088\nTST.W           R3, #0x16                                              ; +0x34, 0x4b08c\nBEQ             loc_4B150                                              ; +0x38, 0x4b090\nLDR             R6, [R4,#0x14]                                         ; +0x3a, 0x4b092\nCBZ             R6, loc_4B0AE                                          ; +0x3c, 0x4b094\nCBZ             R1, loc_4B0EA                                          ; +0x3e, 0x4b096\nCMP             R2, #1                                                 ; +0x40, 0x4b098\nBEQ             loc_4B0B2                                              ; +0x42, 0x4b09a\nCMP             R2, #4                                                 ; +0x44, 0x4b09c\nBEQ             loc_4B0DC                                              ; +0x46, 0x4b09e\nCMP             R2, #2                                                 ; +0x48, 0x4b0a0\nITT EQ                                                                 ; +0x4a, 0x4b0a2\nLDREQ           R0, [R4,#0x38]                                         ; +0x4c, 0x4b0a4\nSTREQ           R0, [R1]                                               ; +0x4e, 0x4b0a6\nB               loc_4B0EA                                              ; +0x50, 0x4b0a8\nMOVS            R0, #0x1E                                              ; +0x52, 0x4b0aa\nB               loc_4B150                                              ; +0x54, 0x4b0ac\nMOVS            R0, #0x1F                                              ; +0x56, 0x4b0ae\nB               loc_4B150                                              ; +0x58, 0x4b0b0\nVLDR            S0, [R4,#0x38]                                         ; +0x5a, 0x4b0b2\nVLDR            S2, =1000.0                                            ; +0x5e, 0x4b0b6\nVCVT.F32.U32    S0, S0                                                 ; +0x62, 0x4b0ba\nVMUL.F32        S0, S0, S2                                             ; +0x66, 0x4b0be\nVLDR            S2, [R6,#0x50]                                         ; +0x6a, 0x4b0c2\nVDIV.F32        S0, S0, S2                                             ; +0x6e, 0x4b0c6\nVMOV.F32        S2, #0.5                                               ; +0x72, 0x4b0ca\nVADD.F32        S0, S0, S2                                             ; +0x76, 0x4b0ce\nVCVT.U32.F32    S0, S0                                                 ; +0x7a, 0x4b0d2\nVSTR            S0, [R1]                                               ; +0x7e, 0x4b0d6\nB               loc_4B0EA                                              ; +0x82, 0x4b0da\nLDR             R0, [R4,#0x38]                                         ; +0x84, 0x4b0dc\nMOVS            R4, #1                                                 ; +0x86, 0x4b0de\nLDR             R3, [R6,#0x18]                                         ; +0x88, 0x4b0e0\nLDR             R2, [R6,#0x4C]                                         ; +0x8a, 0x4b0e2\nSTR             R4, [SP,#8+var_8]                                      ; +0x8c, 0x4b0e4\nBL              sub_4C6EA                                              ; +0x8e, 0x4b0e6\nCMP.W           R9, #0                                                 ; +0x92, 0x4b0ea\nBEQ             loc_4B14E                                              ; +0x96, 0x4b0ee\nLDR.W           R0, [R5,#0x14C]                                        ; +0x98, 0x4b0f0\nCMP.W           R8, #1                                                 ; +0x9c, 0x4b0f4\nLDRD.W          R0, R1, [R0,#0x38]                                     ; +0xa0, 0x4b0f8\nADD             R0, R1                                                 ; +0xa4, 0x4b0fc\nSUB.W           R0, R0, #1                                             ; +0xa6, 0x4b0fe\nBEQ             loc_4B116                                              ; +0xaa, 0x4b102\nCMP.W           R8, #4                                                 ; +0xac, 0x4b104\nBEQ             loc_4B140                                              ; +0xb0, 0x4b108\nCMP.W           R8, #2                                                 ; +0xb2, 0x4b10a\nIT EQ                                                                  ; +0xb6, 0x4b10e\nSTREQ.W         R0, [R9]                                               ; +0xb8, 0x4b110\nB               loc_4B14E                                              ; +0xbc, 0x4b114\nVMOV            S0, R0                                                 ; +0xbe, 0x4b116\nVLDR            S2, =1000.0                                            ; +0xc2, 0x4b11a\nVCVT.F32.U32    S0, S0                                                 ; +0xc6, 0x4b11e\nVMUL.F32        S0, S0, S2                                             ; +0xca, 0x4b122\nVLDR            S2, [R6,#0x50]                                         ; +0xce, 0x4b126\nVDIV.F32        S0, S0, S2                                             ; +0xd2, 0x4b12a\nVMOV.F32        S2, #0.5                                               ; +0xd6, 0x4b12e\nVADD.F32        S0, S0, S2                                             ; +0xda, 0x4b132\nVCVT.U32.F32    S0, S0                                                 ; +0xde, 0x4b136\nVSTR            S0, [R9]                                               ; +0xe2, 0x4b13a\nB               loc_4B14E                                              ; +0xe6, 0x4b13e\nLDR             R3, [R6,#0x18]                                         ; +0xe8, 0x4b140\nMOVS            R1, #1                                                 ; +0xea, 0x4b142\nLDR             R2, [R6,#0x4C]                                         ; +0xec, 0x4b144\nSTR             R1, [SP,#8+var_8]                                      ; +0xee, 0x4b146\nMOV             R1, R9                                                 ; +0xf0, 0x4b148\nBL              sub_4C6EA                                              ; +0xf2, 0x4b14a\nMOVS            R0, #0                                                 ; +0xf6, 0x4b14e\nPOP.W           {R2,R3,R8,R9,R11}                                      ; +0xf8, 0x4b150\nPOP             {R4-R7,PC}                                             ; +0xfc, 0x4b154", "xrefs": ["sub_4A934 @ 0x4a976", "FMOD::Channel::getLoopPoints @ 0xad918"], "is_objc": false, "is_32_bit": true, "is_64_bit": false, "idp_name": "arm", "bida_info": "8.3.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit 1c6ec395 at Thu Nov 26 21:29:22 2026 from https://github.com/geode-sdk/bindings"}