// File: /workspace/github_c_makefile_star2_O0/jogolden[P]ps4flashtool/southbridge.c
// Function: mersenne_twister
unsigned int mersenne_twister(int *seed) {
    int var1; // r12
    int *var2; // r1
    unsigned int var3; // r4
    int var4; // r2
    int var5; // r5
    int var6; // r0
    unsigned int var7; // r4
    int *var8; // r5

    var1 = *seed;
    var2 = &seed[*seed + 1];
    var3 = *var2;
    var4 = *seed + 1;
    if(*seed >= 623) {
        var5 = seed[1];
        var4 = 0;
    } else {
        var5 = var2[1];
    }
    *seed = var4;
    var6 = var3 ^ (var3 >> 11);
    var7 = (var3 & 0x80000000 | var5 & 0x7FFFFFFF) >> 1;
    if(var5 & 1 ) {
        var7 ^= 0x9908B0DF;
    }
    var8 = var2 - 227;
    if( var1 < 227 ) {
        var8 = var2 + 397;
    }
    *var2 = var7 ^ *var8;
    
    return var6 ^ (var6 << 7) & 0x9D2C5680 ^ ((var6 ^ (var6 << 7) & 0x9D2C5680) << 15) & 0xEFC60000 ^ ((var6 ^ (var6 << 7) & 0x9D2C5680 ^ ((var6 ^ (var6 << 7) & 0x9D2C5680) << 15) & 0xEFC60000) >> 18);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq -0x8(%rbp), %rcx
movl (%rcx), %ecx
addl $0x1, %ecx
movslq %ecx, %rcx
shlq $0x2, %rcx
addq %rcx, %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x1c(%rbp)
movq -0x8(%rbp), %rax
movl (%rax), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movq -0x8(%rbp), %rax
cmpl $0x26f, (%rax)          # imm = 0x26F
jl 0xab00
movq -0x8(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x24(%rbp)
movl $0x0, -0x20(%rbp)
jmp 0xab0a
movq -0x18(%rbp), %rax
movl 0x4(%rax), %eax
movl %eax, -0x24(%rbp)
movl -0x20(%rbp), %ecx
movq -0x8(%rbp), %rax
movl %ecx, (%rax)
movl -0x1c(%rbp), %eax
movl -0x1c(%rbp), %ecx
shrl $0xb, %ecx
xorl %ecx, %eax
movl %eax, -0x28(%rbp)
movl -0x1c(%rbp), %eax
andl $0x80000000, %eax       # imm = 0x80000000
movl -0x24(%rbp), %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
orl %ecx, %eax
shrl %eax
movl %eax, -0x2c(%rbp)
movl -0x24(%rbp), %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0xab4f
movl -0x2c(%rbp), %eax
xorl $0x9908b0df, %eax       # imm = 0x9908B0DF
movl %eax, -0x2c(%rbp)
movq -0x18(%rbp), %rax
addq $-0x38c, %rax           # imm = 0xFC74
movq %rax, -0x38(%rbp)
cmpl $0xe3, -0xc(%rbp)
jge 0xab74
movq -0x18(%rbp), %rax
addq $0x634, %rax            # imm = 0x634
movq %rax, -0x38(%rbp)
movl -0x2c(%rbp), %ecx
movq -0x38(%rbp), %rax
xorl (%rax), %ecx
movq -0x18(%rbp), %rax
movl %ecx, (%rax)
movl -0x28(%rbp), %eax
movl -0x28(%rbp), %ecx
shll $0x7, %ecx
andl $0x9d2c5680, %ecx       # imm = 0x9D2C5680
xorl %ecx, %eax
movl -0x28(%rbp), %ecx
movl -0x28(%rbp), %edx
shll $0x7, %edx
andl $0x9d2c5680, %edx       # imm = 0x9D2C5680
xorl %edx, %ecx
shll $0xf, %ecx
andl $0xefc60000, %ecx       # imm = 0xEFC60000
xorl %ecx, %eax
movl -0x28(%rbp), %ecx
movl -0x28(%rbp), %edx
shll $0x7, %edx
andl $0x9d2c5680, %edx       # imm = 0x9D2C5680
xorl %edx, %ecx
movl -0x28(%rbp), %edx
movl -0x28(%rbp), %esi
shll $0x7, %esi
andl $0x9d2c5680, %esi       # imm = 0x9D2C5680
xorl %esi, %edx
shll $0xf, %edx
andl $0xefc60000, %edx       # imm = 0xEFC60000
xorl %edx, %ecx
shrl $0x12, %ecx
xorl %ecx, %eax
popq %rbp
retq
nopw %cs:(%rax,%rax)