// File: /workspace/github_c_makefile_star2_O2/jogolden[P]ps4flashtool/southbridge.c
// Function: init_eap_keys
void init_eap_keys() {
    int i;

    mersenne_init(random_seeds,
        eap_keys[7][0] + eap_keys[3][0] + eap_keys[6][0]
        + 2 * (eap_keys[7][1] + eap_keys[3][1] + eap_keys[6][1])
        + 3 * (eap_keys[7][2] + eap_keys[3][2] + eap_keys[6][2])
        + 4 * (eap_keys[7][3] + eap_keys[3][3] + eap_keys[6][3]
    ));

    for(i = 0; i < 4; i++) {
        eap_keys[3][i] ^= mersenne_twister(random_seeds);
        eap_keys[7][i] ^= mersenne_twister(random_seeds);
    }

    mersenne_init(random_seeds,
        eap_keys[4][0] + eap_keys[5][0] + eap_keys[6][0]
        + 2 * (eap_keys[6][1] + eap_keys[5][1] + eap_keys[4][1])
        + 3 * (eap_keys[5][2] + eap_keys[4][2] + eap_keys[6][2])
        + 4 * (eap_keys[4][3] + eap_keys[5][3] + eap_keys[6][3])
    );

    for(i = 0; i < 4; i++) {
        eap_keys[4][i] ^= mersenne_twister(random_seeds);
        eap_keys[5][i] ^= mersenne_twister(random_seeds);
    }

    mersenne_init(random_seeds,
        eap_keys[0][0] + eap_keys[1][0] + eap_keys[2][0]
        + 2 * (eap_keys[1][1] + eap_keys[2][1] + eap_keys[0][1])
        + 3 * (eap_keys[1][2] + eap_keys[2][2] + eap_keys[0][2])
        + 4 * (eap_keys[2][3] + eap_keys[1][3] + eap_keys[0][3])
    );

    for(i = 0; i < 4; i++) {
        eap_keys[1][i] ^= mersenne_twister(random_seeds);
        eap_keys[2][i] ^= mersenne_twister(random_seeds);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq 0x48eb(%rip), %xmm0     # 0xb3d0
movq 0x48a3(%rip), %xmm1     # 0xb390
paddd %xmm0, %xmm1
movq 0x48c7(%rip), %xmm0     # 0xb3c0
paddd %xmm1, %xmm0
pshufd $0x55, %xmm0, %xmm1     # xmm1 = xmm0[1,1,1,1]
movd %xmm1, %eax
movd %xmm0, %ecx
leal (%rcx,%rax,2), %eax
movl 0x4885(%rip), %ecx      # 0xb398
addl 0x48bf(%rip), %ecx      # 0xb3d8
addl 0x48a9(%rip), %ecx      # 0xb3c8
leal (%rcx,%rcx,2), %ecx
movl 0x4874(%rip), %edx      # 0xb39c
addl 0x48ae(%rip), %edx      # 0xb3dc
addl %eax, %ecx
addl 0x4896(%rip), %edx      # 0xb3cc
leal (%rcx,%rdx,4), %esi
leaq 0x48a0(%rip), %rbx      # 0xb3e0
movq %rbx, %rdi
callq 0x6a8f
xorl %r15d, %r15d
leaq 0x480e(%rip), %r14      # 0xb360
cmpq $0x4, %r15
je 0x6b77
movq %rbx, %rdi
callq 0x69f0
xorl %eax, 0x30(%r14,%r15,4)
movq %rbx, %rdi
callq 0x69f0
xorl %eax, 0x70(%r14,%r15,4)
incq %r15
jmp 0x6b52
movl 0x4833(%rip), %eax      # 0xb3b0
addl 0x481d(%rip), %eax      # 0xb3a0
addl 0x4837(%rip), %eax      # 0xb3c0
movl 0x4825(%rip), %ecx      # 0xb3b4
addl 0x482f(%rip), %ecx      # 0xb3c4
addl 0x4809(%rip), %ecx      # 0xb3a4
leal (%rax,%rcx,2), %eax
movl 0x4804(%rip), %ecx      # 0xb3a8
addl 0x480e(%rip), %ecx      # 0xb3b8
addl 0x4818(%rip), %ecx      # 0xb3c8
leal (%rcx,%rcx,2), %ecx
movl 0x4803(%rip), %edx      # 0xb3bc
addl 0x47ed(%rip), %edx      # 0xb3ac
addl %eax, %ecx
addl 0x4805(%rip), %edx      # 0xb3cc
leal (%rcx,%rdx,4), %esi
leaq 0x480f(%rip), %rbx      # 0xb3e0
movq %rbx, %rdi
callq 0x6a8f
pushq $-0x10
popq %r15
testq %r15, %r15
je 0x6c02
movq %rbx, %rdi
callq 0x69f0
xorl %eax, 0x50(%r15,%r14)
movq %rbx, %rdi
callq 0x69f0
xorl %eax, 0x60(%r15,%r14)
addq $0x4, %r15
jmp 0x6bdd
movl 0x4768(%rip), %eax      # 0xb370
addl 0x4752(%rip), %eax      # 0xb360
addl 0x476c(%rip), %eax      # 0xb380
movl 0x476a(%rip), %ecx      # 0xb384
addl 0x4754(%rip), %ecx      # 0xb374
addl 0x473e(%rip), %ecx      # 0xb364
leal (%rax,%rcx,2), %eax
movl 0x4759(%rip), %ecx      # 0xb388
addl 0x4743(%rip), %ecx      # 0xb378
addl 0x472d(%rip), %ecx      # 0xb368
leal (%rcx,%rcx,2), %ecx
movl 0x4738(%rip), %edx      # 0xb37c
addl 0x4742(%rip), %edx      # 0xb38c
addl %eax, %ecx
addl 0x471a(%rip), %edx      # 0xb36c
leal (%rcx,%rdx,4), %esi
leaq 0x4784(%rip), %rbx      # 0xb3e0
movq %rbx, %rdi
callq 0x6a8f
pushq $-0x10
popq %r15
testq %r15, %r15
je 0x6c8d
movq %rbx, %rdi
callq 0x69f0
xorl %eax, 0x20(%r15,%r14)
movq %rbx, %rdi
callq 0x69f0
xorl %eax, 0x30(%r15,%r14)
addq $0x4, %r15
jmp 0x6c68
popq %rbx
popq %r14
popq %r15
retq