Last active
May 8, 2024 13:39
-
-
Save nico/0fbc1ba95be62ce7218c02f5c378ce6a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NEVER_INLINE static ErrorOr<void> write_image_data(LittleEndianOutputBitStream& bit_stream, Bitmap const& bitmap, PrefixCodeGroup const& prefix_code_group) | |
{ | |
// Image data. | |
for (ARGB32 pixel : bitmap) { | |
u8 a = pixel >> 24; | |
u8 r = pixel >> 16; | |
u8 g = pixel >> 8; | |
u8 b = pixel; | |
TRY(prefix_code_group[0].write_symbol(bit_stream, g)); | |
TRY(prefix_code_group[1].write_symbol(bit_stream, r)); | |
TRY(prefix_code_group[2].write_symbol(bit_stream, b)); | |
TRY(prefix_code_group[3].write_symbol(bit_stream, a)); | |
} | |
return {}; | |
} | |
=> | |
+0x00 sub sp, sp, #0xb0 | |
+0x04 stp x28, x27, [sp, #0x50] | |
+0x08 stp x26, x25, [sp, #0x60] | |
+0x0c stp x24, x23, [sp, #0x70] | |
+0x10 stp x22, x21, [sp, #0x80] | |
+0x14 stp x20, x19, [sp, #0x90] | |
+0x18 stp x29, x30, [sp, #0xa0] | |
+0x1c add x29, sp, #0xa0 | |
+0x20 adrp x9, 220 ; 0xdc000 | |
+0x24 ldr x9, [x9, #0x750] | |
+0x28 ldr x9, [x9] | |
+0x2c str x9, [sp, #0x48] | |
+0x30 ldur x11, [x1, #0x4] | |
+0x34 lsr x9, x11, #32 | |
+0x38 ldr w10, [x1, #0xc] | |
+0x3c mul w9, w10, w9 | |
+0x40 cmp w9, #0x0 | |
+0x44 b.le "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x304" | |
+0x48 str x8, [sp, #0x8] | |
+0x4c asr x8, x11, #32 | |
+0x50 ldr x9, [x1, #0x18] | |
+0x54 mul x22, x9, x8 | |
+0x58 cbz x22, "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x280" | |
+0x5c mov x20, x2 | |
+0x60 mov x21, x0 | |
+0x64 mov w8, #0x35b8 | |
+0x68 add x23, x2, x8 | |
+0x6c mov w8, #0x1ad8 | |
+0x70 add x24, x2, x8 | |
+0x74 ldr x25, [x1, #0x10] | |
+0x78 add x26, x2, #0xd70 | |
+0x7c mov w8, #0x1ae0 | |
+0x80 add x27, x2, x8 | |
+0x84 mov w8, #0x2850 | |
+0x88 add x28, x2, x8 | |
+0x8c b "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0xc4" | |
+0x90 ldr x10, [x8, #0xd60] | |
+0x94 add x8, x8, #0xb20 | |
+0x98 cmp x10, #0x0 | |
+0x9c csel x8, x8, x10, eq | |
+0xa0 ldrh w2, [x8, x9, lsl #1] | |
+0xa4 add x8, sp, #0x28 | |
+0xa8 mov x0, x21 | |
+0xac bl "AK::ErrorOr<void, AK::Error> AK::LittleEndianOutputBitStream::write_bits<unsigned int>(unsigned int, unsigned long)" | |
+0xb0 ldrb w8, [sp, #0x40] | |
+0xb4 cbnz w8, "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x2c8" | |
+0xb8 add x25, x25, #0x4 | |
+0xbc subs x22, x22, #0x4 | |
+0xc0 b.eq "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x280" | |
+0xc4 ldr w19, [x25] | |
+0xc8 ldrb w8, [x20, #0xd68] | |
+0xcc cmp w8, #0x1 | |
+0xd0 csel x8, x20, xzr, eq | |
+0xd4 b.ne "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x140" | |
+0xd8 ubfx x9, x19, #8, #8 | |
+0xdc ldr x10, [x8, #0x8b8] | |
+0xe0 cmp x10, x9 | |
+0xe4 b.ls "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x100" | |
+0xe8 ldr x10, [x8, #0xb08] | |
+0xec add x11, x8, #0x8c8 | |
+0xf0 cmp x10, #0x0 | |
+0xf4 csel x10, x11, x10, eq | |
+0xf8 ldrh w1, [x10, x9, lsl #1] | |
+0xfc b "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x104" | |
+0x100 mov w1, #0x0 | |
+0x104 ldr x10, [x8, #0xb10] | |
+0x108 cmp x10, x9 | |
+0x10c b.ls "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x128" | |
+0x110 ldr x10, [x8, #0xd60] | |
+0x114 add x8, x8, #0xb20 | |
+0x118 cmp x10, #0x0 | |
+0x11c csel x8, x8, x10, eq | |
+0x120 ldrh w2, [x8, x9, lsl #1] | |
+0x124 b "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x12c" | |
+0x128 mov x2, #0x0 | |
+0x12c add x8, sp, #0x28 | |
+0x130 mov x0, x21 | |
+0x134 bl "AK::ErrorOr<void, AK::Error> AK::LittleEndianOutputBitStream::write_bits<unsigned int>(unsigned int, unsigned long)" | |
+0x138 ldrb w8, [sp, #0x40] | |
+0x13c cbnz w8, "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x2c8" | |
+0x140 ldrb w8, [x24] | |
+0x144 cmp w8, #0x1 | |
+0x148 csel x8, x26, xzr, eq | |
+0x14c b.ne "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x1b8" | |
+0x150 ubfx w9, w19, #16, #8 | |
+0x154 ldr x10, [x8, #0x8b8] | |
+0x158 cmp x10, x9 | |
+0x15c b.ls "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x178" | |
+0x160 ldr x10, [x8, #0xb08] | |
+0x164 add x11, x8, #0x8c8 | |
+0x168 cmp x10, #0x0 | |
+0x16c csel x10, x11, x10, eq | |
+0x170 ldrh w1, [x10, x9, lsl #1] | |
+0x174 b "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x17c" | |
+0x178 mov w1, #0x0 | |
+0x17c ldr x10, [x8, #0xb10] | |
+0x180 cmp x10, x9 | |
+0x184 b.ls "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x1a0" | |
+0x188 ldr x10, [x8, #0xd60] | |
+0x18c add x8, x8, #0xb20 | |
+0x190 cmp x10, #0x0 | |
+0x194 csel x8, x8, x10, eq | |
+0x198 ldrh w2, [x8, x9, lsl #1] | |
+0x19c b "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x1a4" | |
+0x1a0 mov x2, #0x0 | |
+0x1a4 add x8, sp, #0x28 | |
+0x1a8 mov x0, x21 | |
+0x1ac bl "AK::ErrorOr<void, AK::Error> AK::LittleEndianOutputBitStream::write_bits<unsigned int>(unsigned int, unsigned long)" | |
+0x1b0 ldrb w8, [sp, #0x40] | |
+0x1b4 cbnz w8, "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x2c8" | |
+0x1b8 ldrb w8, [x24, #0xd70] | |
+0x1bc cmp w8, #0x1 | |
+0x1c0 csel x8, x27, xzr, eq | |
+0x1c4 b.ne "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x230" | |
+0x1c8 and x9, x19, #0xff | |
+0x1cc ldr x10, [x8, #0x8b8] | |
+0x1d0 cmp x10, x9 | |
+0x1d4 b.ls "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x1f0" | |
+0x1d8 ldr x10, [x8, #0xb08] | |
+0x1dc add x11, x8, #0x8c8 | |
+0x1e0 cmp x10, #0x0 | |
+0x1e4 csel x10, x11, x10, eq | |
+0x1e8 ldrh w1, [x10, x9, lsl #1] | |
+0x1ec b "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x1f4" | |
+0x1f0 mov w1, #0x0 | |
+0x1f4 ldr x10, [x8, #0xb10] | |
+0x1f8 cmp x10, x9 | |
+0x1fc b.ls "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x218" | |
+0x200 ldr x10, [x8, #0xd60] | |
+0x204 add x8, x8, #0xb20 | |
+0x208 cmp x10, #0x0 | |
+0x20c csel x8, x8, x10, eq | |
+0x210 ldrh w2, [x8, x9, lsl #1] | |
+0x214 b "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x21c" | |
+0x218 mov x2, #0x0 | |
+0x21c add x8, sp, #0x28 | |
+0x220 mov x0, x21 | |
+0x224 bl "AK::ErrorOr<void, AK::Error> AK::LittleEndianOutputBitStream::write_bits<unsigned int>(unsigned int, unsigned long)" | |
+0x228 ldrb w8, [sp, #0x40] | |
+0x22c cbnz w8, "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x2c8" | |
+0x230 ldrb w8, [x23] | |
+0x234 cmp w8, #0x1 | |
+0x238 csel x8, x28, xzr, eq | |
+0x23c b.ne "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0xb8" | |
+0x240 lsr x9, x19, #24 | |
+0x244 ldr x10, [x8, #0x8b8] | |
+0x248 cmp x10, x9 | |
+0x24c b.ls "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x268" | |
+0x250 ldr x10, [x8, #0xb08] | |
+0x254 add x11, x8, #0x8c8 | |
+0x258 cmp x10, #0x0 | |
+0x25c csel x10, x11, x10, eq | |
+0x260 ldrh w1, [x10, x9, lsl #1] | |
+0x264 b "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x26c" | |
+0x268 mov w1, #0x0 | |
+0x26c ldr x10, [x8, #0xb10] | |
+0x270 cmp x10, x9 | |
+0x274 b.hi "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x90" | |
+0x278 mov x2, #0x0 | |
+0x27c b "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0xa4" | |
+0x280 ldr x8, [sp, #0x8] | |
+0x284 stp xzr, xzr, [x8] | |
+0x288 strb wzr, [x8, #0x18] | |
+0x28c str xzr, [x8, #0x10] | |
+0x290 ldr x8, [sp, #0x48] | |
+0x294 adrp x9, 220 ; 0xdc000 | |
+0x298 ldr x9, [x9, #0x750] | |
+0x29c ldr x9, [x9] | |
+0x2a0 cmp x9, x8 | |
+0x2a4 b.ne "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x310" | |
+0x2a8 ldp x29, x30, [sp, #0xa0] | |
+0x2ac ldp x20, x19, [sp, #0x90] | |
+0x2b0 ldp x22, x21, [sp, #0x80] | |
+0x2b4 ldp x24, x23, [sp, #0x70] | |
+0x2b8 ldp x26, x25, [sp, #0x60] | |
+0x2bc ldp x28, x27, [sp, #0x50] | |
+0x2c0 add sp, sp, #0xb0 | |
+0x2c4 ret | |
+0x2c8 cmp w8, #0x1 | |
+0x2cc b.ne "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x2f8" | |
+0x2d0 ldur q0, [sp, #0x28] | |
+0x2d4 str q0, [sp, #0x10] | |
+0x2d8 ldr x8, [sp, #0x38] | |
+0x2dc str x8, [sp, #0x20] | |
+0x2e0 ldr x9, [sp, #0x8] | |
+0x2e4 str q0, [x9] | |
+0x2e8 str x8, [x9, #0x10] | |
+0x2ec mov w8, #0x1 | |
+0x2f0 strb w8, [x9, #0x18] | |
+0x2f4 b "Gfx::write_image_data(AK::LittleEndianOutputBitStream&, Gfx::Bitmap const&, Gfx::PrefixCodeGroup const&)+0x290" | |
+0x2f8 adrp x0, 192 ; 0xc0000 | |
+0x2fc add x0, x0, #0x53b | |
+0x300 bl "DYLD-STUB$$ak_verification_failed" | |
+0x304 adrp x0, 193 ; 0xc1000 | |
+0x308 add x0, x0, #0x353 | |
+0x30c bl "DYLD-STUB$$ak_verification_failed" | |
+0x310 bl "DYLD-STUB$$__stack_chk_fail" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment