{"type": "func", "start": 791832, "end": 791990, "name": "sub_C1518", "pseudocode": "// \n// sub_C1518 from 0xc1518 to 0xc15b6 (158 bytes)\n// \n// 0 xrefs:\n// \n// This function is hookable on this platform!\n// \n// Using BromaIDA 8.0.0 @ https://github.com/Stazzical/BromaIDA\n// Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings\n// \n\nint __fastcall sub_C1518(int a1)\n{\n  _DWORD *v1; // r6\n  int State; // r0\n  int v4; // r1\n  int v5; // r2\n  int v6; // r0\n  int v7; // r8\n  unsigned int XRunCount; // r0\n  int BufferCapacityInFrames; // r4\n  int BufferSizeInFrames; // r8\n  int FramesPerBurst; // r0\n  int v12; // r0\n  int v14; // [sp+4h] [bp-14h] BYREF\n\n  v1 = *(_DWORD **)a1;\n  if ( *(_DWORD *)a1 && v1[1] )\n  {\n    sub_BFFC4(&v14);\n    State = so_AAudioStream_getState(v1[1]);\n    v4 = v14;\n    v5 = v1[3];\n    __dmb(0xBu);\n    if ( State == 4 )\n    {\n      v6 = dword_1262C0;\n      v7 = v14 - dword_1262C0;\n      if ( v4 - v5 > 1000 )\n      {\n        (*(void (__fastcall **)(int))(a1 + 24))(a1);\n        v6 = dword_1262C0;\n      }\n      if ( v7 > 1000 && v1[8] != v6 )\n        (*(void (__fastcall **)(int))(a1 + 24))(a1);\n    }\n    XRunCount = so_AAudioStream_getXRunCount(v1[1]);\n    if ( v1[4] < XRunCount )\n    {\n      v1[4] = XRunCount;\n      BufferCapacityInFrames = so_AAudioStream_getBufferCapacityInFrames(v1[1]);\n      BufferSizeInFrames = so_AAudioStream_getBufferSizeInFrames(v1[1]);\n      FramesPerBurst = so_AAudioStream_getFramesPerBurst(v1[1]);\n      if ( BufferSizeInFrames < BufferCapacityInFrames )\n      {\n        v12 = FramesPerBurst + BufferSizeInFrames;\n        if ( v12 < BufferCapacityInFrames )\n          BufferCapacityInFrames = v12;\n        so_AAudioStream_setBufferSizeInFrames(v1[1], BufferCapacityInFrames);\n      }\n    }\n  }\n  return 0;\n}", "assembly": "; \n; sub_C1518 from 0xc1518 to 0xc15b6 (158 bytes)\n; \n; 0 xrefs:\n; \n; This function is hookable on this platform!\n; \n; Using BromaIDA 8.0.0 @ https:;github.com/Stazzical/BromaIDA\n; Using bindings at commit ba9f177b at Thu Jul 16 22:52:06 2026 from https:;github.com/geode-sdk/bindings\n; \n\nPUSH            {R4-R7,LR}                                             ; +0x0, 0xc1518\nADD             R7, SP, #0xC                                           ; +0x2, 0xc151a\nPUSH.W          {R8}                                                   ; +0x4, 0xc151c\nSUB             SP, SP, #8                                             ; +0x8, 0xc1520\nLDR             R6, [R0]                                               ; +0xa, 0xc1522\nCMP             R6, #0                                                 ; +0xc, 0xc1524\nBEQ             loc_C15AC                                              ; +0xe, 0xc1526\nMOV             R4, R0                                                 ; +0x10, 0xc1528\nLDR             R0, [R6,#4]                                            ; +0x12, 0xc152a\nCBZ             R0, loc_C15AC                                          ; +0x14, 0xc152c\nADD             R0, SP, #8+var_4                                       ; +0x16, 0xc152e\nBL              sub_BFFC4                                              ; +0x18, 0xc1530\nLDR             R5, =(dword_126258 - 0xC153C)                          ; +0x1c, 0xc1534\nLDR             R0, [R6,#4]                                            ; +0x1e, 0xc1536\nADD             R5, PC; dword_126258                                   ; +0x20, 0xc1538\nLDR             R1, [R5,#(so_AAudioStream_getState - 0x126258)]        ; +0x22, 0xc153a\nBLX             R1                                                     ; +0x24, 0xc153c\nLDR             R1, [SP,#8+var_4]                                      ; +0x26, 0xc153e\nCMP             R0, #4                                                 ; +0x28, 0xc1540\nLDR             R2, [R6,#0xC]                                          ; +0x2a, 0xc1542\nDMB.W           ISH                                                    ; +0x2c, 0xc1544\nBNE             loc_C1574                                              ; +0x30, 0xc1548\nLDR             R0, [R5,#(dword_1262C0 - 0x126258)]                    ; +0x32, 0xc154a\nSUBS            R1, R1, R2                                             ; +0x34, 0xc154c\nLDR             R3, [SP,#8+var_4]                                      ; +0x36, 0xc154e\nCMP.W           R1, #0x3E8                                             ; +0x38, 0xc1550\nSUB.W           R8, R3, R0                                             ; +0x3c, 0xc1554\nBLE             loc_C1562                                              ; +0x40, 0xc1558\nLDR             R1, [R4,#0x18]                                         ; +0x42, 0xc155a\nMOV             R0, R4                                                 ; +0x44, 0xc155c\nBLX             R1                                                     ; +0x46, 0xc155e\nLDR             R0, [R5,#(dword_1262C0 - 0x126258)]                    ; +0x48, 0xc1560\nCMP.W           R8, #0x3E8                                             ; +0x4a, 0xc1562\nBLE             loc_C1574                                              ; +0x4e, 0xc1566\nLDR             R1, [R6,#0x20]                                         ; +0x50, 0xc1568\nCMP             R1, R0                                                 ; +0x52, 0xc156a\nITTT NE                                                                ; +0x54, 0xc156c\nLDRNE           R1, [R4,#0x18]                                         ; +0x56, 0xc156e\nMOVNE           R0, R4                                                 ; +0x58, 0xc1570\nBLXNE           R1                                                     ; +0x5a, 0xc1572\nLDR             R0, [R6,#4]                                            ; +0x5c, 0xc1574\nLDR             R1, [R5,#(so_AAudioStream_getXRunCount - 0x126258)]    ; +0x5e, 0xc1576\nBLX             R1                                                     ; +0x60, 0xc1578\nLDR             R1, [R6,#0x10]                                         ; +0x62, 0xc157a\nCMP             R1, R0                                                 ; +0x64, 0xc157c\nBCS             loc_C15AC                                              ; +0x66, 0xc157e\nSTR             R0, [R6,#0x10]                                         ; +0x68, 0xc1580\nLDR             R0, [R6,#4]                                            ; +0x6a, 0xc1582\nLDR             R1, [R5,#(so_AAudioStream_getBufferCapacityInFrames - 0x126258)] ; +0x6c, 0xc1584\nBLX             R1                                                     ; +0x6e, 0xc1586\nMOV             R4, R0                                                 ; +0x70, 0xc1588\nLDR             R1, [R5,#(so_AAudioStream_getBufferSizeInFrames - 0x126258)] ; +0x72, 0xc158a\nLDR             R0, [R6,#4]                                            ; +0x74, 0xc158c\nBLX             R1                                                     ; +0x76, 0xc158e\nMOV             R8, R0                                                 ; +0x78, 0xc1590\nLDR             R1, [R5,#(so_AAudioStream_getFramesPerBurst - 0x126258)] ; +0x7a, 0xc1592\nLDR             R0, [R6,#4]                                            ; +0x7c, 0xc1594\nBLX             R1                                                     ; +0x7e, 0xc1596\nCMP             R8, R4                                                 ; +0x80, 0xc1598\nBGE             loc_C15AC                                              ; +0x82, 0xc159a\nADD             R0, R8                                                 ; +0x84, 0xc159c\nCMP             R0, R4                                                 ; +0x86, 0xc159e\nIT LT                                                                  ; +0x88, 0xc15a0\nMOVLT           R4, R0                                                 ; +0x8a, 0xc15a2\nLDR             R0, [R6,#4]                                            ; +0x8c, 0xc15a4\nMOV             R1, R4                                                 ; +0x8e, 0xc15a6\nLDR             R2, [R5,#(so_AAudioStream_setBufferSizeInFrames - 0x126258)] ; +0x90, 0xc15a8\nBLX             R2                                                     ; +0x92, 0xc15aa\nMOVS            R0, #0                                                 ; +0x94, 0xc15ac\nADD             SP, SP, #8                                             ; +0x96, 0xc15ae\nPOP.W           {R8}                                                   ; +0x98, 0xc15b0\nPOP             {R4-R7,PC}                                             ; +0x9c, 0xc15b4", "xrefs": [], "is_objc": false, "is_arm32": false, "is_arm64": false, "bida_info": "8.0.0 @ https://github.com/Stazzical/BromaIDA", "bindings_info": "commit ba9f177b at Thu Jul 16 22:52:06 2026 from https://github.com/geode-sdk/bindings"}