Skip to content

Instantly share code, notes, and snippets.

@zbanks
Last active May 4, 2022 14:01
Show Gist options
  • Save zbanks/acc81c51084691405fc4eadccc4229cb to your computer and use it in GitHub Desktop.
Save zbanks/acc81c51084691405fc4eadccc4229cb to your computer and use it in GitHub Desktop.
struct _m2c_stack_func_80125980 {
/* 0x00 */ char pad_0[0x18];
/* 0x18 */ s32 sp18; /* inferred */
/* 0x1C */ s32 sp1C; /* inferred */
/* 0x20 */ s32 sp20; /* inferred */
/* 0x24 */ s32 sp24; /* inferred */
/* 0x28 */ s32 sp28; /* inferred */
/* 0x2C */ s32 sp2C; /* inferred */
/* 0x30 */ char pad_30[4];
/* 0x34 */ void *sp34; /* inferred */
/* 0x38 */ char pad_38[8]; /* maybe part of sp34[3]? */
/* 0x40 */ s32 sp40; /* inferred */
/* 0x44 */ u32 sp44; /* inferred */
/* 0x48 */ char pad_48[0x18]; /* maybe part of sp44[7]? */
/* 0x60 */ s32 sp60; /* inferred */
/* 0x64 */ s32 sp64; /* inferred */
/* 0x68 */ char pad_68[8]; /* maybe part of sp64[3]? */
/* 0x70 */ s32 sp70; /* inferred */
/* 0x74 */ s32 sp74; /* inferred */
/* 0x78 */ char pad_78[8]; /* maybe part of sp74[3]? */
/* 0x80 */ s32 sp80; /* inferred */
/* 0x84 */ s32 sp84; /* inferred */
/* 0x88 */ char pad_88[0x10]; /* maybe part of sp84[5]? */
/* 0x98 */ s32 sp98; /* inferred */
/* 0x9C */ s32 sp9C; /* inferred */
/* 0xA0 */ s32 spA0; /* inferred */
/* 0xA4 */ s32 spA4; /* inferred */
/* 0xA8 */ s32 spA8; /* inferred */
/* 0xAC */ s32 spAC; /* inferred */
/* 0xB0 */ s32 spB0; /* inferred */
/* 0xB4 */ s32 spB4; /* inferred */
/* 0xB8 */ s32 spB8; /* inferred */
/* 0xBC */ s32 spBC; /* inferred */
/* 0xC0 */ s32 spC0; /* inferred */
/* 0xC4 */ s32 spC4; /* inferred */
}; /* size = 0xC8 */
s32 func_8012635C(s32, s64, s32, s64); /* extern */
extern ? D_80152350;
void func_80125980(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s16 arg4, s16 arg5, s16 arg6, s32 arg7, s32 arg8, s32 arg9) {
s32 spC4;
s32 spC0;
s32 spBC;
s32 spB8;
s32 spB4;
s32 spB0;
s32 spAC;
s32 spA8;
s32 spA4;
s32 spA0;
s32 sp9C;
s32 sp98;
s32 sp84;
s32 sp80;
s32 sp74;
s32 sp70;
s32 sp64;
s32 sp60;
u32 sp44;
s32 sp40;
void *sp34;
s32 sp2C;
s32 sp28;
s32 sp24;
s32 sp20;
s32 sp1C;
s32 sp18;
s32 temp_v0;
s32 temp_v0_2;
s32 temp_v0_3;
s32 temp_v0_4;
s64 temp_v1;
void *temp_t0;
void *temp_t0_2;
void *temp_t0_3;
temp_t0 = (arg4 * 2) + &D_80152350;
sp34 = temp_t0;
spC0 = M2C_ERROR(Read from unset register $v0);
spC4 = (s32) ((s64) temp_t0->unk_2D0 << 8);
temp_t0_2 = (arg5 * 2) + &D_80152350;
spB8 = M2C_ERROR(Read from unset register $v0);
spBC = (s32) ((s64) temp_t0->unk_384 << 8);
sp34 = temp_t0_2;
spB0 = M2C_ERROR(Read from unset register $v0);
spB4 = (s32) ((s64) temp_t0_2->unk_2D0 << 8);
temp_t0_3 = (arg6 * 2) + &D_80152350;
spA8 = M2C_ERROR(Read from unset register $v0);
spAC = (s32) ((s64) temp_t0_2->unk_384 << 8);
sp34 = temp_t0_3;
spA0 = M2C_ERROR(Read from unset register $v0);
spA4 = (s32) ((s64) temp_t0_3->unk_2D0 << 8);
temp_v1 = (s64) temp_t0_3->unk_384 << 8;
sp98 = M2C_ERROR(Read from unset register $v0);
sp9C = (s32) temp_v1;
sp40 = M2C_ERROR(Read from unset register $v0);
sp44 = (u32) (((s64) spBC * temp_v1) / 65536);
sp28 = arg7 >> 0x1F;
sp2C = arg7;
sp70 = M2C_ERROR(Read from unset register $v0);
sp74 = (s32) (((s64) arg7 * (sp44 - (((s64) spC4 * (((s64) spB4 * (s64) spA4) / 65536)) / 65536))) / 65536);
sp20 = arg8 >> 0x1F;
sp24 = arg8;
temp_v0 = func_8012635C(sp74, ((s64) arg8 * -(((s64) spC4 * (s64) spAC) / 65536)) / 65536, arg0, 0x10000);
sp60 = temp_v0;
sp64 = (s32) (((s64) spBC * (s64) spA4) / 65536);
sp18 = arg9 >> 0x1F;
sp1C = arg9;
temp_v0_2 = func_8012635C((s32) (((s64) arg9 * (-sp64 - (((s64) spC4 * (((s64) spB4 * (s64) sp9C) / 65536)) / 65536))) / 65536), 0, arg0 + 4, 0x10000);
sp40 = temp_v0_2;
sp44 = (u32) (((s64) spC4 * (s64) sp9C) / 65536);
sp70 = temp_v0_2;
sp74 = (s32) (((s64) arg7 * ((((s64) spBC * (((s64) spB4 * (s64) spA4) / 65536)) / 65536) + sp44)) / 65536);
temp_v0_3 = func_8012635C(sp74, ((s64) arg8 * (((s64) spBC * (s64) spAC) / 65536)) / 65536, arg0 + 8, 0x10000);
sp60 = temp_v0_3;
sp64 = (s32) (((s64) spC4 * (s64) spA4) / 65536);
temp_v0_4 = func_8012635C((s32) (((s64) arg9 * ((((s64) spBC * (((s64) spB4 * (s64) sp9C) / 65536)) / 65536) - sp64)) / 65536), 0, arg0 + 0xC, 0x10000);
sp80 = temp_v0_4;
sp84 = (s32) (((s64) arg7 * (((s64) spAC * (s64) spA4) / 65536)) / 65536);
func_8012635C(sp84, ((s64) arg8 * (s64) -spB4) / 65536, arg0 + 0x10, 0x10000);
func_8012635C((s32) (((s64) arg9 * (((s64) spAC * (s64) sp9C) / 65536)) / 65536), 0, arg0 + 0x14, 0x10000);
func_8012635C(arg1, (s64) arg2, arg0 + 0x18);
func_8012635C(arg3, 0x10000, arg0 + 0x1C);
}
struct _m2c_stack_func_80125FE0 {
/* 0x00 */ char pad_0[0x18];
/* 0x18 */ s32 sp18; /* inferred */
/* 0x1C */ s32 sp1C; /* inferred */
/* 0x20 */ char pad_20[4];
/* 0x24 */ void *sp24; /* inferred */
/* 0x28 */ char pad_28[0x18]; /* maybe part of sp24[7]? */
/* 0x40 */ s32 sp40; /* inferred */
/* 0x44 */ s32 sp44; /* inferred */
/* 0x48 */ char pad_48[8]; /* maybe part of sp44[3]? */
/* 0x50 */ s32 sp50; /* inferred */
/* 0x54 */ s32 sp54; /* inferred */
/* 0x58 */ char pad_58[0x10]; /* maybe part of sp54[5]? */
/* 0x68 */ s32 sp68; /* inferred */
/* 0x6C */ s32 sp6C; /* inferred */
/* 0x70 */ s32 sp70; /* inferred */
/* 0x74 */ s32 sp74; /* inferred */
/* 0x78 */ s32 sp78; /* inferred */
/* 0x7C */ s32 sp7C; /* inferred */
/* 0x80 */ s32 sp80; /* inferred */
/* 0x84 */ s32 sp84; /* inferred */
}; /* size = 0x88 */
s32 func_8012635C(s32, s64, s32, s64); /* extern */
extern ? D_80152350;
void func_80125FE0(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s16 arg4, s16 arg5, s32 arg6, s32 arg7, s32 arg8) {
s32 sp84;
s32 sp80;
s32 sp7C;
s32 sp78;
s32 sp74;
s32 sp70;
s32 sp6C;
s32 sp68;
s32 sp54;
s32 sp50;
s32 sp44;
s32 sp40;
void *sp24;
s32 sp1C;
s32 sp18;
s32 temp_a1;
s32 temp_v0;
s32 temp_v0_2;
s64 temp_v1;
void *temp_t0;
void *temp_t0_2;
temp_t0 = (arg4 * 2) + &D_80152350;
sp24 = temp_t0;
sp80 = M2C_ERROR(Read from unset register $v0);
sp84 = (s32) ((s64) temp_t0->unk_2D0 << 8);
temp_t0_2 = (arg5 * 2) + &D_80152350;
sp78 = M2C_ERROR(Read from unset register $v0);
sp7C = (s32) ((s64) temp_t0->unk_384 << 8);
sp24 = temp_t0_2;
sp70 = M2C_ERROR(Read from unset register $v0);
sp74 = (s32) ((s64) temp_t0_2->unk_2D0 << 8);
temp_v1 = (s64) temp_t0_2->unk_384 << 8;
sp68 = M2C_ERROR(Read from unset register $v0);
sp6C = (s32) temp_v1;
sp50 = M2C_ERROR(Read from unset register $v0);
sp54 = (s32) (((s64) arg6 * temp_v1) / 65536);
func_8012635C(sp54, ((s64) -arg6 * (s64) sp74) / 65536, arg0, 0x10000);
temp_v0 = func_8012635C(0, 0, arg0 + 4);
sp18 = arg7 >> 0x1F;
sp1C = arg7;
sp40 = temp_v0;
sp44 = (s32) (((s64) arg7 * (((s64) sp74 * (s64) sp7C) / 65536)) / 65536);
func_8012635C(sp44, ((s64) arg7 * (((s64) sp6C * (s64) sp7C) / 65536)) / 65536, arg0 + 8, 0x10000);
temp_v0_2 = func_8012635C((s32) (((s64) arg7 * (s64) sp84) / 65536), 0, arg0 + 0xC, 0x10000);
temp_a1 = -arg8;
sp18 = temp_a1 >> 0x1F;
sp1C = temp_a1;
sp40 = temp_v0_2;
sp44 = (s32) (((s64) temp_a1 * (((s64) sp74 * (s64) sp84) / 65536)) / 65536);
func_8012635C(sp44, ((s64) temp_a1 * (((s64) sp6C * (s64) sp84) / 65536)) / 65536, arg0 + 0x10, 0x10000);
func_8012635C((s32) (((s64) arg8 * (s64) sp7C) / 65536), 0, arg0 + 0x14, 0x10000);
func_8012635C(arg1, (s64) arg2, arg0 + 0x18);
func_8012635C(arg3, 0x10000, arg0 + 0x1C);
}
struct _m2c_stack_func_80126388 {
/* 0x00 */ char pad_0[0x18];
/* 0x18 */ s32 sp18; /* inferred */
/* 0x1C */ s32 sp1C; /* inferred */
/* 0x20 */ s32 sp20; /* inferred */
/* 0x24 */ s32 sp24; /* inferred */
/* 0x28 */ s32 sp28; /* inferred */
/* 0x2C */ s32 sp2C; /* inferred */
/* 0x30 */ s32 sp30; /* inferred */
/* 0x34 */ char pad_34[4];
/* 0x38 */ s32 sp38; /* inferred */
/* 0x3C */ s32 sp3C; /* inferred */
/* 0x40 */ char pad_40[0xC]; /* maybe part of sp3C[4]? */
/* 0x4C */ s32 sp4C; /* inferred */
/* 0x50 */ s32 sp50; /* inferred */
/* 0x54 */ s32 sp54; /* inferred */
/* 0x58 */ char pad_58[4];
/* 0x5C */ s32 sp5C; /* inferred */
/* 0x60 */ s32 sp60; /* inferred */
/* 0x64 */ s32 sp64; /* inferred */
/* 0x68 */ s32 sp68; /* inferred */
/* 0x6C */ s32 sp6C; /* inferred */
}; /* size = 0x70 */
f32 sqrtf(f32, f32, s32, s32, s32, s32); /* extern */
extern ? D_80152C78;
extern ? D_80203FE0;
? func_80126388(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s16 arg5, s16 arg6, u8 arg7, u8 arg8, void *arg9) {
s32 sp6C;
s32 sp68;
s32 sp64;
s32 sp60;
s32 sp5C;
s32 sp54;
s32 sp50;
s32 sp4C;
s32 sp3C;
s32 sp38;
s32 sp30;
s32 sp2C;
s32 sp28;
s32 sp24;
s32 sp20;
s32 sp1C;
s32 sp18;
f32 temp_f0;
f32 temp_f14;
f32 temp_f14_2;
f32 temp_f14_3;
f32 temp_f16;
f32 temp_f16_2;
f32 temp_f2;
f32 temp_f2_2;
f32 temp_f2_3;
s16 temp_t0;
s16 temp_t1;
s16 temp_t2;
s16 temp_t3;
s16 temp_t4;
s16 temp_t5;
s16 temp_v0_4;
s32 temp_a0;
s32 temp_a0_2;
s32 temp_a2;
s32 temp_f8;
s32 temp_lo;
s32 temp_lo_2;
s32 temp_lo_3;
s32 temp_lo_4;
s32 temp_lo_5;
s32 temp_t4_2;
s32 temp_t6;
s32 temp_t7;
s32 temp_t7_2;
s32 temp_t7_3;
s32 temp_t7_4;
s32 temp_t8;
s32 temp_t8_2;
s32 temp_t8_3;
s32 temp_t8_4;
s32 temp_t8_5;
s32 temp_t8_6;
s32 temp_t9;
s32 temp_v0_2;
s32 temp_v0_3;
void *temp_v0;
void *temp_v1;
s32 phi_t3;
s32 phi_t2;
s32 phi_a3;
s32 phi_t0;
s32 phi_t1;
s32 phi_t2_2;
s32 phi_t3_2;
s32 phi_a0;
s32 phi_a1;
s32 phi_a2;
s32 phi_t2_3;
s32 phi_t3_3;
s32 phi_a2_2;
s32 phi_a3_2;
s32 phi_t0_2;
s32 phi_t1_2;
s32 phi_t2_4;
s32 phi_a3_3;
s32 phi_t3_4;
s32 phi_t0_3;
s32 phi_a2_3;
s32 phi_t1_3;
temp_t8 = arg0 & 0xFFFF;
temp_t9 = arg1 & 0xFFFF;
temp_v1 = &D_80203FE0 + (temp_t8 * 8);
temp_v0 = &D_80203FE0 + (temp_t9 * 8);
temp_t0 = temp_v0->unk_0;
temp_t1 = temp_v1->unk_0;
temp_t2 = temp_v0->unk_2;
temp_t3 = temp_v1->unk_2;
temp_t4 = temp_v0->unk_4;
temp_t5 = temp_v1->unk_4;
temp_t7 = (s32) (((s32) (temp_t0 + temp_t1) >> 1) << 0x10) / 8;
sp30 = temp_t7;
temp_t8_2 = (s32) (((s32) (temp_t2 + temp_t3) >> 1) << 0x10) / 8;
sp2C = temp_t8_2;
temp_t6 = (s32) (((s32) (temp_t4 + temp_t5) >> 1) << 0x10) / 8;
sp18 = temp_t8_2;
sp28 = temp_t6;
sp1C = temp_t6;
sp30 = ((s32) (arg5 * temp_t7) >> 4) + temp_t7;
sp2C = ((s32) (arg5 * temp_t8_2) >> 4) + temp_t8_2;
temp_t8_3 = temp_t0 - temp_t1;
temp_t7_2 = temp_t2 - temp_t3;
sp28 = ((s32) (arg5 * temp_t6) >> 3) + temp_t6;
sp6C = temp_t8_3;
sp68 = temp_t7_2;
sp64 = temp_t4 - temp_t5;
phi_a0 = temp_t8;
phi_a1 = temp_t9;
phi_a2 = arg2;
if ((temp_t8_3 == 0) && (temp_t7_2 == 0)) {
phi_t2_2 = 0x400;
phi_t3_2 = 0;
if (arg8 == 1) {
phi_a3 = 0x400;
phi_t0 = 0;
phi_t1 = 0;
phi_t2_2 = 0;
phi_t3_2 = 0x400;
} else {
phi_a3 = 0;
phi_t0 = -0x400;
phi_t1 = 0;
}
} else {
temp_v0_2 = -sp6C;
phi_t3 = temp_v0_2;
phi_t2 = sp68;
if (arg8 == 1) {
if (temp_v0_2 < 0) {
phi_t2 = -sp68;
goto block_10;
}
} else if (sp68 < 0) {
phi_t2 = -sp68;
block_10:
phi_t3 = -temp_v0_2;
}
temp_lo = phi_t3 * sp64;
temp_v0_3 = -(temp_lo / 256);
temp_lo_2 = sp64 * phi_t2;
temp_a0 = temp_lo_2 / 256;
temp_a2 = (sp6C * phi_t3) - (sp68 * phi_t2);
temp_t4_2 = temp_a2 / 256;
phi_a3 = temp_v0_3;
phi_t0 = temp_a0;
phi_t1 = temp_t4_2;
phi_t2_2 = phi_t2;
phi_t3_2 = phi_t3;
phi_a0 = temp_a0;
phi_a1 = temp_lo_2;
phi_a2 = temp_a2;
phi_a3 = temp_v0_3;
phi_t0 = temp_a0;
if ((temp_v0_3 == 0) && (temp_a0 == 0) && (temp_t4_2 == 0)) {
if (temp_v0_3 == 0) {
if (temp_lo < 0) {
phi_a3 = 1;
} else if (temp_lo > 0) {
phi_a3 = -1;
}
}
if (temp_a0 == 0) {
if (temp_lo_2 < 0) {
phi_t0 = -1;
} else if (temp_lo_2 > 0) {
phi_t0 = 1;
}
}
if (temp_t4_2 == 0) {
if (temp_a2 < 0) {
phi_t1 = -1;
} else if (temp_a2 > 0) {
phi_t1 = 1;
}
}
}
}
temp_f0 = (f32) sp6C;
sp54 = phi_a3;
sp50 = phi_t0;
sp4C = phi_t1;
sp60 = phi_t2_2;
temp_f2 = (f32) sp68;
sp5C = phi_t3_2;
temp_f14 = (f32) sp64;
temp_f2_2 = (f32) phi_t2_2;
temp_a0_2 = (s32) sqrtf((temp_f0 * temp_f0) + (temp_f2 * temp_f2) + (temp_f14 * temp_f14), temp_f14, phi_a0, phi_a1, phi_a2, phi_a3);
temp_f14_2 = (f32) phi_t3_2;
sp3C = (s32) (s16) temp_a0_2;
temp_f16 = (f32) 0;
temp_f2_3 = (f32) phi_a3;
temp_f14_3 = (f32) phi_t0;
sp38 = (s32) (s16) (s32) sqrtf((temp_f2_2 * temp_f2_2) + (temp_f14_2 * temp_f14_2) + (temp_f16 * temp_f16), temp_f14_2, temp_a0_2);
temp_f16_2 = (f32) phi_t1;
if (sp3C == 0) {
return 0;
}
if (sp38 == 0) {
return 0;
}
temp_f8 = (s32) sqrtf((temp_f2_3 * temp_f2_3) + (temp_f14_3 * temp_f14_3) + (temp_f16_2 * temp_f16_2), temp_f14_3);
temp_v0_4 = (s16) temp_f8;
if ((s16) temp_f8 == 0) {
return 0;
}
sp6C = (s32) (sp6C * arg2) / sp3C;
sp68 = (s32) (sp68 * arg3) / sp3C;
sp64 = (s32) (sp64 * arg4) / sp3C;
temp_lo_3 = (s32) (phi_t2_2 * arg2) / sp38;
temp_lo_4 = (s32) (phi_t3_2 * arg3) / sp38;
temp_lo_5 = 0 / sp38;
temp_t8_4 = ((s32) ((arg2 >> 3) * phi_a3) / temp_v0_4) * 8;
temp_t8_5 = ((s32) ((arg3 >> 3) * phi_t0) / temp_v0_4) * 8;
temp_t7_3 = ((s32) ((arg4 >> 3) * phi_t1) / temp_v0_4) * 8;
phi_t2_4 = temp_lo_3;
phi_a3_3 = temp_t8_4;
phi_t3_4 = temp_lo_4;
phi_t0_3 = temp_t8_5;
phi_a2_3 = temp_lo_5;
phi_t1_3 = temp_t7_3;
phi_t2_4 = temp_lo_3;
phi_t3_4 = temp_lo_4;
phi_a2_3 = temp_lo_5;
switch (arg7) { /* irregular */
case 1:
phi_t2_4 = -temp_lo_3;
phi_t3_4 = -temp_lo_4;
phi_a2_3 = -temp_lo_5;
break;
case 2:
phi_a3_3 = -temp_t8_4;
phi_t0_3 = -temp_t8_5;
block_43:
phi_t1_3 = -temp_t7_3;
break;
case 3:
phi_t2_4 = -temp_lo_3;
phi_a3_3 = -temp_t8_4;
phi_t3_4 = -temp_lo_4;
phi_t0_3 = -temp_t8_5;
phi_a2_3 = -temp_lo_5;
goto block_43;
}
case 0:
phi_t2_3 = phi_t2_4;
phi_t3_3 = phi_t3_4;
phi_a2_2 = phi_a2_3;
phi_a3_2 = phi_a3_3;
phi_t0_2 = phi_t0_3;
phi_t1_2 = phi_t1_3;
if (arg6 != 0) {
temp_t7_4 = (s16) *(&D_80152C78 + ((arg6 & 0xFF) * 2)) >> 7;
temp_t8_6 = (s16) *(&D_80152C78 + (((arg6 + 0x40) & 0xFF) * 2)) >> 7;
phi_t2_3 = (s32) ((temp_t7_4 * phi_a3_3) + (phi_t2_4 * temp_t8_6)) >> 8;
phi_t3_3 = (s32) ((temp_t7_4 * phi_t0_3) + (phi_t3_4 * temp_t8_6)) >> 8;
phi_a2_2 = (s32) ((temp_t7_4 * phi_t1_3) + (phi_a2_3 * temp_t8_6)) >> 8;
phi_a3_2 = (s32) ((phi_a3_3 * temp_t8_6) - (temp_t7_4 * phi_t2_4)) >> 8;
phi_t0_2 = (s32) ((phi_t0_3 * temp_t8_6) - (temp_t7_4 * phi_t3_4)) >> 8;
phi_t1_2 = (s32) ((phi_t1_3 * temp_t8_6) - (temp_t7_4 * phi_a2_3)) >> 8;
}
sp24 = sp6C;
sp20 = sp68;
arg9->unk_0 = (s32) (((u16) sp24 << 0x10) | (u16) sp20);
arg9->unk_20 = (s32) ((unksp26 << 0x10) | unksp22);
sp24 = sp64;
arg9->unk_4 = (s32) ((u16) sp24 << 0x10);
arg9->unk_24 = (s32) (unksp26 << 0x10);
sp24 = phi_t2_3;
sp20 = phi_t3_3;
arg9->unk_8 = (s32) (((u16) sp24 << 0x10) | (u16) sp20);
arg9->unk_28 = (s32) ((unksp26 << 0x10) | unksp22);
sp24 = phi_a2_2;
arg9->unk_C = (s32) ((u16) sp24 << 0x10);
arg9->unk_2C = (s32) (unksp26 << 0x10);
sp24 = phi_a3_2;
sp20 = phi_t0_2;
arg9->unk_10 = (s32) (((u16) sp24 << 0x10) | (u16) sp20);
arg9->unk_30 = (s32) ((unksp26 << 0x10) | unksp22);
sp24 = phi_t1_2;
arg9->unk_14 = (s32) ((u16) sp24 << 0x10);
arg9->unk_34 = (s32) (unksp26 << 0x10);
sp24 = sp30;
sp20 = sp2C;
arg9->unk_18 = (s32) (((u16) sp24 << 0x10) | (u16) sp20);
arg9->unk_38 = (s32) ((unksp26 << 0x10) | unksp22);
sp24 = sp28;
arg9->unk_1C = (s32) (((u16) sp24 << 0x10) | 1);
arg9->unk_3C = (s32) (unksp26 << 0x10);
return 1;
}
struct _m2c_stack_func_80126CC4 {
/* 0x00 */ s32 sp0; /* inferred */
/* 0x04 */ s32 sp4; /* inferred */
/* 0x08 */ s16 sp8; /* inferred */
/* 0x0A */ s16 spA; /* inferred */
/* 0x0C */ s16 spC; /* inferred */
/* 0x0E */ s16 spE; /* inferred */
}; /* size = 0x10 */
extern ? D_80152350;
void func_80126CC4(s16 arg0, void *arg1) {
s16 spE;
s16 spC;
s16 spA;
s16 sp8;
s32 sp4;
s32 sp0;
s16 temp_a2;
s16 temp_v0;
void *temp_v1;
spC = (s16) ((s32) arg1->unk_0 >> 0x10);
temp_v1 = (arg0 * 2) + &D_80152350;
spE = (s16) ((s32) arg1->unk_20 >> 0x10);
temp_a2 = temp_v1->unk_384;
temp_v0 = temp_v1->unk_2D0;
sp8 = (s16) arg1->unk_0;
spA = (s16) arg1->unk_20;
sp4 = (s32) ((temp_a2 * (s32) spC) + (temp_v0 * (s32) sp8)) / 256;
sp0 = (s32) ((temp_a2 * (s32) sp8) - (temp_v0 * (s32) spC)) / 256;
arg1->unk_0 = (s32) (((u16) sp4 << 0x10) | (u16) sp0);
arg1->unk_20 = (s32) ((unksp6 << 0x10) | unksp2);
spC = (s16) ((s32) arg1->unk_8 >> 0x10);
spE = (s16) ((s32) arg1->unk_28 >> 0x10);
sp8 = (s16) arg1->unk_8;
spA = (s16) arg1->unk_28;
sp4 = (s32) ((temp_a2 * (s32) spC) + (temp_v0 * (s32) sp8)) / 256;
sp0 = (s32) ((temp_a2 * (s32) sp8) - (temp_v0 * (s32) spC)) / 256;
arg1->unk_8 = (s32) (((u16) sp4 << 0x10) | (u16) sp0);
arg1->unk_28 = (s32) ((unksp6 << 0x10) | unksp2);
spC = (s16) ((s32) arg1->unk_10 >> 0x10);
spE = (s16) ((s32) arg1->unk_30 >> 0x10);
sp8 = (s16) arg1->unk_10;
spA = (s16) arg1->unk_30;
sp4 = (s32) ((temp_a2 * (s32) spC) + (temp_v0 * (s32) sp8)) / 256;
sp0 = (s32) ((temp_a2 * (s32) sp8) - (temp_v0 * (s32) spC)) / 256;
arg1->unk_10 = (s32) (((u16) sp4 << 0x10) | (u16) sp0);
arg1->unk_30 = (s32) ((unksp6 << 0x10) | unksp2);
spC = (s16) ((s32) arg1->unk_18 >> 0x10);
spE = (s16) ((s32) arg1->unk_38 >> 0x10);
sp8 = (s16) arg1->unk_18;
spA = (s16) arg1->unk_38;
sp4 = (s32) ((temp_a2 * (s32) spC) + (temp_v0 * (s32) sp8)) / 256;
sp0 = (s32) ((temp_a2 * (s32) sp8) - (temp_v0 * (s32) spC)) / 256;
arg1->unk_18 = (s32) (((u16) sp4 << 0x10) | (u16) sp0);
arg1->unk_38 = (s32) ((unksp6 << 0x10) | unksp2);
}
struct _m2c_stack_func_80126FD4 {
/* 0x00 */ char pad_0[0x1C];
/* 0x1C */ s32 sp1C; /* inferred */
/* 0x20 */ s32 sp20; /* inferred */
/* 0x24 */ s32 sp24; /* inferred */
/* 0x28 */ s32 sp28; /* inferred */
/* 0x2C */ s32 sp2C; /* inferred */
/* 0x30 */ s32 sp30; /* inferred */
/* 0x34 */ s32 sp34; /* inferred */
/* 0x38 */ s32 sp38; /* inferred */
/* 0x3C */ char pad_3C[4];
/* 0x40 */ s32 sp40; /* inferred */
/* 0x44 */ s32 sp44; /* inferred */
/* 0x48 */ char pad_48[0xC]; /* maybe part of sp44[4]? */
/* 0x54 */ s32 sp54; /* inferred */
/* 0x58 */ s32 sp58; /* inferred */
/* 0x5C */ s32 sp5C; /* inferred */
/* 0x60 */ s32 sp60; /* inferred */
/* 0x64 */ s32 sp64; /* inferred */
/* 0x68 */ s32 sp68; /* inferred */
/* 0x6C */ s32 sp6C; /* inferred */
/* 0x70 */ char pad_70[8];
}; /* size = 0x78 */
f32 sqrtf(f32, f32, s32, s32, s32, s32); /* extern */
? func_80126FD4(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, s32 arg6, s32 arg7, void *arg8) {
s32 sp6C;
s32 sp68;
s32 sp64;
s32 sp60;
s32 sp5C;
s32 sp58;
s32 sp54;
s32 sp44;
s32 sp40;
s32 sp38;
s32 sp34;
s32 sp30;
s32 sp2C;
s32 sp28;
s32 sp24;
s32 sp20;
s32 sp1C;
f32 temp_f0;
f32 temp_f14;
f32 temp_f14_2;
f32 temp_f14_3;
f32 temp_f16;
f32 temp_f16_2;
f32 temp_f2;
f32 temp_f2_2;
f32 temp_f2_3;
s32 temp_a1;
s32 temp_a2;
s32 temp_f4;
s32 temp_lo;
s32 temp_lo_2;
s32 temp_ra;
s32 temp_t2;
s32 temp_t2_2;
s32 temp_t5;
s32 temp_t6;
s32 temp_t6_2;
s32 temp_t6_3;
s32 temp_t8;
s32 temp_t9;
s32 temp_t9_2;
s32 temp_t9_3;
s32 temp_v0;
s32 temp_v0_2;
s32 temp_v0_3;
s32 phi_t4;
s32 phi_t3;
s32 phi_a3;
s32 phi_t0;
s32 phi_t1;
s32 phi_t2;
s32 phi_t3_2;
s32 phi_t4_2;
s32 phi_a0;
s32 phi_a1;
sp38 = (s32) (arg0 + arg3) >> 1;
sp34 = (s32) (arg1 + arg4) >> 1;
sp30 = (s32) (arg2 + arg5) >> 1;
temp_t9 = arg0 >> 8;
temp_t6 = arg1 >> 8;
temp_t9_2 = arg2 >> 8;
temp_t9_3 = arg4 >> 8;
temp_t8 = (arg3 >> 8) - temp_t9;
temp_t6_2 = arg5 >> 8;
arg4 = temp_t9_3;
arg5 = temp_t6_2;
sp24 = temp_t8;
phi_a0 = temp_t9;
phi_a1 = temp_t6;
if ((temp_t8 == 0) && (temp_t2 = temp_t9_3 - temp_t6, phi_t2 = temp_t2, phi_t3_2 = 0x400, (temp_t2 == 0))) {
sp1C = temp_t6_2 - temp_t9_2;
phi_a3 = 0;
phi_t0 = -0x400;
phi_t1 = 0;
phi_t4_2 = 0;
} else {
temp_t2_2 = arg4 - temp_t6;
temp_v0 = -sp24;
phi_t4 = temp_v0;
phi_t3 = temp_t2_2;
phi_t2 = temp_t2_2;
if (temp_t2_2 < 0) {
phi_t4 = -temp_v0;
phi_t3 = -temp_t2_2;
}
temp_t6_3 = arg5 - temp_t9_2;
temp_lo = phi_t4 * temp_t6_3;
sp1C = temp_t6_3;
temp_v0_2 = -(temp_lo / 512);
temp_lo_2 = temp_t6_3 * phi_t3;
temp_t5 = temp_lo_2 / 512;
temp_a1 = (sp24 * phi_t4) - (temp_t2_2 * phi_t3);
temp_ra = temp_a1 / 512;
phi_t1 = temp_ra;
phi_t3_2 = phi_t3;
phi_t4_2 = phi_t4;
phi_a0 = temp_lo_2;
phi_a1 = temp_a1;
phi_a3 = temp_v0_2;
phi_t0 = temp_t5;
if (temp_v0_2 == 0) {
if (temp_lo < 0) {
phi_a3 = 1;
} else if (temp_lo > 0) {
phi_a3 = -1;
}
}
if (temp_t5 == 0) {
if (temp_lo_2 < 0) {
phi_t0 = -1;
} else if (temp_lo_2 > 0) {
phi_t0 = 1;
}
}
if (temp_ra == 0) {
if (temp_a1 < 0) {
phi_t1 = -1;
} else if (temp_a1 > 0) {
phi_t1 = 1;
}
}
}
temp_f2 = (f32) phi_t2;
sp5C = phi_a3;
sp58 = phi_t0;
sp54 = phi_t1;
temp_f0 = (f32) sp24;
sp20 = phi_t2;
sp68 = phi_t3_2;
sp64 = phi_t4_2;
temp_f14 = (f32) sp1C;
temp_f2_2 = (f32) phi_t3_2;
temp_a2 = (s32) sqrtf((temp_f0 * temp_f0) + (temp_f2 * temp_f2) + (temp_f14 * temp_f14), temp_f14, phi_a0, phi_a1, temp_t9_2, phi_a3);
sp44 = temp_a2;
temp_f14_2 = (f32) phi_t4_2;
temp_f16 = (f32) 0;
temp_f4 = (s32) sqrtf((temp_f2_2 * temp_f2_2) + (temp_f14_2 * temp_f14_2) + (temp_f16 * temp_f16), temp_f14_2, temp_a2);
temp_f2_3 = (f32) phi_a3;
sp40 = temp_f4;
temp_f14_3 = (f32) phi_t0;
temp_f16_2 = (f32) phi_t1;
if (temp_a2 == 0) {
return 0;
}
if (temp_f4 == 0) {
return 0;
}
temp_v0_3 = (s32) sqrtf((temp_f2_3 * temp_f2_3) + (temp_f14_3 * temp_f14_3) + (temp_f16_2 * temp_f16_2), temp_f14_3);
if (temp_v0_3 == 0) {
return 0;
}
sp2C = (s32) (sp24 * arg6) / temp_a2;
sp28 = (s32) (phi_t2 * arg6) / temp_a2;
sp6C = (s32) (sp1C * arg6) / temp_a2;
sp60 = 0 / temp_f4;
arg8->unk_0 = (s32) (((u16) sp2C << 0x10) | (u16) sp28);
arg8->unk_20 = (s32) ((unksp2E << 0x10) | unksp2A);
sp2C = sp6C;
arg8->unk_4 = (s32) ((u16) sp2C << 0x10);
arg8->unk_24 = (s32) (unksp2E << 0x10);
sp2C = (s32) (phi_t3_2 * arg7) / temp_f4;
sp28 = (s32) (phi_t4_2 * arg7) / temp_f4;
arg8->unk_8 = (s32) (((u16) sp2C << 0x10) | (u16) sp28);
arg8->unk_28 = (s32) ((unksp2E << 0x10) | unksp2A);
sp2C = sp60;
arg8->unk_C = (s32) ((u16) sp2C << 0x10);
arg8->unk_2C = (s32) (unksp2E << 0x10);
sp2C = (s32) (phi_a3 * arg7) / temp_v0_3;
sp28 = (s32) (phi_t0 * arg7) / temp_v0_3;
arg8->unk_10 = (s32) (((u16) sp2C << 0x10) | (u16) sp28);
arg8->unk_30 = (s32) ((unksp2E << 0x10) | unksp2A);
sp2C = (s32) (phi_t1 * arg7) / temp_v0_3;
arg8->unk_14 = (s32) ((u16) sp2C << 0x10);
arg8->unk_34 = (s32) (unksp2E << 0x10);
sp2C = sp38;
sp28 = sp34;
arg8->unk_18 = (s32) (((u16) sp2C << 0x10) | (u16) sp28);
arg8->unk_38 = (s32) ((unksp2E << 0x10) | unksp2A);
sp2C = sp30;
arg8->unk_1C = (s32) (((u16) sp2C << 0x10) | 1);
arg8->unk_3C = (s32) (unksp2E << 0x10);
return 1;
}
struct _m2c_stack_func_80127640 {
/* 0x00 */ char pad_0[0x20];
/* 0x20 */ s32 sp20; /* inferred */
/* 0x24 */ s32 sp24; /* inferred */
/* 0x28 */ char pad_28[4];
/* 0x2C */ s32 sp2C; /* inferred */
/* 0x30 */ char pad_30[8]; /* maybe part of sp2C[3]? */
/* 0x38 */ s32 sp38; /* inferred */
/* 0x3C */ s32 sp3C; /* inferred */
/* 0x40 */ s32 sp40; /* inferred */
/* 0x44 */ s32 sp44; /* inferred */
/* 0x48 */ s32 sp48; /* inferred */
/* 0x4C */ s32 sp4C; /* inferred */
/* 0x50 */ s32 sp50; /* inferred */
/* 0x54 */ s32 sp54; /* inferred */
/* 0x58 */ s32 sp58; /* inferred */
/* 0x5C */ s32 sp5C; /* inferred */
}; /* size = 0x60 */
extern ? D_80152C78;
void func_80127640(void *arg0, s32 arg1, s32 arg2, s32 arg3, s16 arg4, s32 arg5, s32 arg6, s32 arg7, s16 arg8, s32 arg9) {
s32 sp5C;
s32 sp58;
s32 sp54;
s32 sp50;
s32 sp4C;
s32 sp48;
s32 sp44;
s32 sp40;
s32 sp3C;
s32 sp38;
s32 sp2C;
s32 sp24;
s32 sp20;
s16 temp_t1;
sp58 = M2C_ERROR(Read from unset register $v0);
sp5C = (s32) ((s64) ((s16) *(&D_80152C78 + ((arg4 & 0xFF) * 2)) >> 7) << 8);
sp50 = M2C_ERROR(Read from unset register $v0);
temp_t1 = (arg4 + arg8) & 0xFF;
sp54 = (s32) ((s64) ((s16) *(&D_80152C78 + (((arg4 + 0x40) & 0xFF) * 2)) >> 7) << 8);
sp2C = (s32) temp_t1;
sp48 = M2C_ERROR(Read from unset register $v0);
sp4C = (s32) ((s64) ((s16) *(&D_80152C78 + ((temp_t1 & 0xFF) * 2)) >> 7) << 8);
sp40 = M2C_ERROR(Read from unset register $v0);
sp44 = (s32) ((s64) ((s16) *(&D_80152C78 + (((temp_t1 + 0x40) & 0xFF) * 2)) >> 7) << 8);
sp20 = arg5 >> 0x1F;
sp24 = arg5;
sp3C = (s32) ((s64) ((s64) sp54 * (s64) arg5) >> 0x10);
sp38 = (s32) ((s64) ((s64) sp5C * (s64) arg5) >> 0x10);
arg0->unk_0 = (s32) (((u16) sp3C << 0x10) | (u16) sp38);
arg0->unk_4 = 0;
arg0->unk_20 = (s32) ((unksp3E << 0x10) | unksp3A);
arg0->unk_24 = 0;
sp20 = arg6 >> 0x1F;
sp24 = arg6;
sp3C = (s32) ((s64) ((s64) -sp5C * (s64) arg6) >> 0x10);
sp38 = (s32) ((s64) ((s64) sp54 * (s64) arg6) >> 0x10);
arg0->unk_8 = (s32) (((u16) sp3C << 0x10) | (u16) sp38);
arg0->unk_C = 0;
arg0->unk_28 = (s32) ((unksp3E << 0x10) | unksp3A);
arg0->unk_2C = 0;
sp20 = arg9 >> 0x1F;
sp24 = arg9;
sp3C = (s32) ((s64) ((s64) sp44 * (s64) arg9) >> 0x10);
sp38 = (s32) ((s64) ((s64) sp4C * (s64) arg9) >> 0x10);
arg0->unk_10 = (s32) (((u16) sp3C << 0x10) | (u16) sp38);
arg0->unk_30 = (s32) ((unksp3E << 0x10) | unksp3A);
sp3C = arg7;
arg0->unk_14 = (s32) ((u16) sp3C << 0x10);
arg0->unk_34 = (s32) (unksp3E << 0x10);
sp3C = arg1;
sp38 = arg2;
arg0->unk_18 = (s32) (((u16) sp3C << 0x10) | (u16) sp38);
arg0->unk_38 = (s32) ((unksp3E << 0x10) | unksp3A);
sp3C = arg3;
arg0->unk_1C = (s32) (((u16) sp3C << 0x10) | 1);
arg0->unk_3C = (s32) (unksp3E << 0x10);
}
struct _m2c_stack_func_80127994 {
/* 0x00 */ char pad_0[0x20];
/* 0x20 */ s32 sp20; /* inferred */
/* 0x24 */ s32 sp24; /* inferred */
/* 0x28 */ s32 sp28; /* inferred */
/* 0x2C */ char pad_2C[0x1C];
}; /* size = 0x48 */
f32 sqrtf(f32, f32, s32, s32, void *); /* extern */
? func_80127994(s32 arg0, s32 arg1, s32 arg2, void *arg3) {
s32 sp28;
s32 sp24;
s32 sp20;
f32 temp_f0;
f32 temp_f0_2;
f32 temp_f14;
f32 temp_f14_2;
f32 temp_f2;
s32 temp_f6;
s32 temp_lo;
s32 temp_lo_2;
s32 temp_t1;
s32 temp_v0;
s32 temp_v1;
s32 phi_a0;
s32 phi_a2;
s32 phi_s0;
temp_f0 = (f32) arg0;
temp_f2 = (f32) arg1;
temp_f14 = (f32) arg2;
temp_f6 = (s32) sqrtf((temp_f0 * temp_f0) + (temp_f2 * temp_f2) + (temp_f14 * temp_f14), temp_f14);
if (temp_f6 == 0) {
phi_a0 = 0;
phi_a2 = 0x400;
phi_s0 = 0;
} else {
phi_a0 = (s32) (arg0 << 0xA) / temp_f6;
phi_a2 = (s32) (arg2 << 0xA) / temp_f6;
phi_s0 = (s32) (arg1 << 0xA) / temp_f6;
}
temp_t1 = -phi_a0;
temp_f14_2 = (f32) phi_a2;
sp20 = temp_t1;
arg0 = phi_a0;
arg2 = phi_a2;
temp_f0_2 = (f32) temp_t1;
temp_v0 = (s32) sqrtf((temp_f14_2 * temp_f14_2) + (temp_f0_2 * temp_f0_2), temp_f14_2, phi_a0, phi_a2, arg3);
temp_v1 = (s32) (arg2 << 0xA) / temp_v0;
sp28 = temp_v1 << 6;
temp_lo = 0 / temp_v0;
temp_lo_2 = (s32) (phi_a0 * -0x400) / temp_v0;
sp24 = temp_lo << 6;
arg3->unk_0 = (s32) (((u16) sp28 << 0x10) | (u16) sp24);
arg3->unk_20 = (s32) ((unksp2A << 0x10) | unksp26);
sp28 = temp_lo_2 << 6;
arg3->unk_4 = (s32) ((u16) sp28 << 0x10);
arg3->unk_24 = (s32) (unksp2A << 0x10);
sp28 = ((s32) -((temp_lo * arg2) - (temp_lo_2 * phi_s0)) >> 0xA) << 6;
sp24 = ((s32) -((temp_lo_2 * arg0) - (temp_v1 * arg2)) >> 0xA) << 6;
arg3->unk_8 = (s32) (((u16) sp28 << 0x10) | (u16) sp24);
arg3->unk_28 = (s32) ((unksp2A << 0x10) | unksp26);
sp28 = ((s32) -((temp_v1 * phi_s0) - (temp_lo * arg0)) >> 0xA) << 6;
arg3->unk_C = (s32) ((u16) sp28 << 0x10);
arg3->unk_2C = (s32) (unksp2A << 0x10);
sp28 = arg0 << 6;
sp24 = phi_s0 << 6;
arg3->unk_10 = (s32) (((u16) sp28 << 0x10) | (u16) sp24);
arg3->unk_30 = (s32) ((unksp2A << 0x10) | unksp26);
sp28 = arg2 << 6;
arg3->unk_14 = (s32) ((u16) sp28 << 0x10);
arg3->unk_18 = 0;
arg3->unk_38 = 0;
arg3->unk_34 = (s32) (unksp2A << 0x10);
sp28 = 0;
sp24 = 0x10000;
arg3->unk_1C = (s32) (((u16) sp28 << 0x10) | (u16) sp24);
arg3->unk_3C = (s32) ((unksp2A << 0x10) | unksp26);
return 1;
}
struct _m2c_stack_func_80127D30 {
/* 0x0 */ s32 sp0; /* inferred */
/* 0x4 */ s32 sp4; /* inferred */
}; /* size = 0x8 */
void func_80127D30(void *arg0, s32 arg1) {
s32 sp4;
s32 sp0;
sp4 = 0x10000;
sp0 = 0;
arg0->unk_0 = (s32) (((u16) sp4 << 0x10) | (u16) sp0);
arg0->unk_20 = (s32) ((unksp6 << 0x10) | unksp2);
sp4 = 0;
sp0 = 0;
arg0->unk_4 = (s32) (((u16) sp4 << 0x10) | (u16) sp0);
arg0->unk_24 = (s32) ((unksp6 << 0x10) | unksp2);
sp4 = 0;
sp0 = 0x10000;
arg0->unk_8 = (s32) (((u16) sp4 << 0x10) | (u16) sp0);
arg0->unk_28 = (s32) ((unksp6 << 0x10) | unksp2);
sp4 = 0;
sp0 = 0;
arg0->unk_C = (s32) (((u16) sp4 << 0x10) | (u16) sp0);
arg0->unk_2C = (s32) ((unksp6 << 0x10) | unksp2);
sp4 = 0;
sp0 = 0;
arg0->unk_10 = (s32) (((u16) sp4 << 0x10) | (u16) sp0);
arg0->unk_30 = (s32) ((unksp6 << 0x10) | unksp2);
sp4 = 0xFFFF0000;
sp0 = 0;
arg0->unk_14 = (s32) (((u16) sp4 << 0x10) | (u16) sp0);
arg0->unk_34 = (s32) ((unksp6 << 0x10) | unksp2);
sp4 = 0;
sp0 = 0;
arg0->unk_18 = (s32) (((u16) sp4 << 0x10) | (u16) sp0);
arg0->unk_38 = (s32) ((unksp6 << 0x10) | unksp2);
sp4 = arg1 << 0x11;
sp0 = 0x10000;
arg0->unk_1C = (s32) (((u16) sp4 << 0x10) | (u16) sp0);
arg0->unk_3C = (s32) ((unksp6 << 0x10) | unksp2);
}
struct _m2c_stack_func_80127ED4 {
/* 0x0 */ s32 sp0; /* inferred */
/* 0x4 */ s32 sp4; /* inferred */
}; /* size = 0x8 */
void func_80127ED4(void *arg0, s32 arg1) {
s32 sp4;
s32 sp0;
sp4 = 0xFFFF0000;
sp0 = 0;
arg0->unk_0 = (s32) (((u16) sp4 << 0x10) | (u16) sp0);
arg0->unk_20 = (s32) ((unksp6 << 0x10) | unksp2);
sp4 = 0;
sp0 = 0;
arg0->unk_4 = (s32) (((u16) sp4 << 0x10) | (u16) sp0);
arg0->unk_24 = (s32) ((unksp6 << 0x10) | unksp2);
sp4 = 0;
sp0 = 0x10000;
arg0->unk_8 = (s32) (((u16) sp4 << 0x10) | (u16) sp0);
arg0->unk_28 = (s32) ((unksp6 << 0x10) | unksp2);
sp4 = 0;
sp0 = 0;
arg0->unk_C = (s32) (((u16) sp4 << 0x10) | (u16) sp0);
arg0->unk_2C = (s32) ((unksp6 << 0x10) | unksp2);
sp4 = 0;
sp0 = 0;
arg0->unk_10 = (s32) (((u16) sp4 << 0x10) | (u16) sp0);
arg0->unk_30 = (s32) ((unksp6 << 0x10) | unksp2);
sp4 = 0x10000;
sp0 = 0;
arg0->unk_14 = (s32) (((u16) sp4 << 0x10) | (u16) sp0);
arg0->unk_34 = (s32) ((unksp6 << 0x10) | unksp2);
sp4 = arg1 << 0x11;
sp0 = 0;
arg0->unk_18 = (s32) (((u16) sp4 << 0x10) | (u16) sp0);
arg0->unk_38 = (s32) ((unksp6 << 0x10) | unksp2);
sp4 = 0;
sp0 = 0x10000;
arg0->unk_1C = (s32) (((u16) sp4 << 0x10) | (u16) sp0);
arg0->unk_3C = (s32) ((unksp6 << 0x10) | unksp2);
}
struct _m2c_stack_func_80128078 {
/* 0x00 */ char pad_0[0x20];
/* 0x20 */ s32 sp20; /* inferred */
/* 0x24 */ s32 sp24; /* inferred */
/* 0x28 */ char pad_28[4];
/* 0x2C */ void *sp2C; /* inferred */
/* 0x30 */ s32 sp30; /* inferred */
/* 0x34 */ s32 sp34; /* inferred */
/* 0x38 */ s32 sp38; /* inferred */
/* 0x3C */ s32 sp3C; /* inferred */
/* 0x40 */ s32 sp40; /* inferred */
/* 0x44 */ s32 sp44; /* inferred */
}; /* size = 0x48 */
extern ? D_80152350;
void func_80128078(void *arg0, s16 arg1, s16 arg2) {
s32 sp44;
s32 sp40;
s32 sp3C;
s32 sp38;
s32 sp34;
s32 sp30;
void *sp2C;
s32 sp24;
s32 sp20;
s64 temp_v1;
void *temp_t0;
temp_t0 = (arg2 * 2) + &D_80152350;
sp2C = temp_t0;
sp40 = M2C_ERROR(Read from unset register $v0);
sp44 = (s32) ((s64) temp_t0->unk_2D0 << 8);
temp_v1 = (s64) temp_t0->unk_384 << 8;
sp34 = 0x10000;
sp38 = M2C_ERROR(Read from unset register $v0);
sp3C = (s32) temp_v1;
arg0->unk_0 = (s32) ((u16) sp34 << 0x10);
arg0->unk_4 = 0;
arg0->unk_24 = 0;
arg0->unk_20 = (s32) (unksp36 << 0x10);
sp30 = (s32) temp_v1;
arg0->unk_8 = (s32) (u16) sp30;
arg0->unk_28 = (s32) unksp32;
sp34 = sp44;
arg0->unk_C = (s32) ((u16) sp34 << 0x10);
arg0->unk_2C = (s32) (unksp36 << 0x10);
sp30 = -sp44;
arg0->unk_10 = (s32) (u16) sp30;
arg0->unk_30 = (s32) unksp32;
sp34 = (s32) temp_v1;
arg0->unk_14 = (s32) ((u16) sp34 << 0x10);
arg0->unk_34 = (s32) (unksp36 << 0x10);
sp20 = arg1 >> 0x1F;
sp24 = (s32) arg1;
sp30 = (s32) ((s64) arg1 * (s64) sp44);
arg0->unk_18 = (s32) (u16) sp30;
arg0->unk_38 = (s32) unksp32;
sp34 = (arg1 << 0x10) - ((s64) arg1 * (s64) sp3C);
arg0->unk_1C = (s32) (((u16) sp34 << 0x10) | 1);
arg0->unk_3C = (s32) (unksp36 << 0x10);
}
See https://github.com/zbanks/mips_to_c/tree/dword-arith
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment