// File: /workspace/github_c_makefile_star2_O0/gregtour[P]minimal-compiler/tables.c
// Function: DecompressGotoTable
void DecompressGotoTable(int* source_data, int* dest_data, unsigned int compressed_size, unsigned int total_size)
{
    unsigned int mode = 0;
    unsigned int index = 0;
    unsigned int read_index = 0;
    int lengthRep = 0;
    int copy_value = 0;

    while (/*read_index < compressed_size && */index < total_size)
    {
        if (mode == 0)
        {
            lengthRep = source_data[read_index];
            read_index++;
            while (lengthRep && /*read_index < compressed_size &&*/
                    index < total_size)
            {
                dest_data[index] = source_data[read_index];
                index++; read_index++;
                lengthRep--;
            }
            lengthRep = 0;
            mode = 1;
        } 
        else if (mode == 1) 
        {
            lengthRep = source_data[read_index];
            read_index++;
            copy_value = source_data[read_index];
            read_index++;
            while (lengthRep && index < total_size)
            {
                dest_data[index] = copy_value;
                index++;
                lengthRep--;
            }
            lengthRep = 0;
            mode = 0;
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x18(%rbp), %eax
jae 0x9589
cmpl $0x0, -0x1c(%rbp)
jne 0x9501
movq -0x8(%rbp), %rax
movl -0x24(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x28(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x28(%rbp)
movb %al, -0x2d(%rbp)
je 0x94b4
movl -0x20(%rbp), %eax
cmpl -0x18(%rbp), %eax
setb %al
movb %al, -0x2d(%rbp)
movb -0x2d(%rbp), %al
testb $0x1, %al
jne 0x94bd
jmp 0x94ee
movq -0x8(%rbp), %rax
movl -0x24(%rbp), %ecx
movl (%rax,%rcx,4), %edx
movq -0x10(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %edx, (%rax,%rcx,4)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movl -0x28(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x949d
movl $0x0, -0x28(%rbp)
movl $0x1, -0x1c(%rbp)
jmp 0x9584
cmpl $0x1, -0x1c(%rbp)
jne 0x9582
movq -0x8(%rbp), %rax
movl -0x24(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x28(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rax
movl -0x24(%rbp), %ecx
movl (%rax,%rcx,4), %eax
movl %eax, -0x2c(%rbp)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
xorl %eax, %eax
cmpl $0x0, -0x28(%rbp)
movb %al, -0x2e(%rbp)
je 0x954a
movl -0x20(%rbp), %eax
cmpl -0x18(%rbp), %eax
setb %al
movb %al, -0x2e(%rbp)
movb -0x2e(%rbp), %al
testb $0x1, %al
jne 0x9553
jmp 0x9574
movl -0x2c(%rbp), %edx
movq -0x10(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %edx, (%rax,%rcx,4)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x28(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x9533
movl $0x0, -0x28(%rbp)
movl $0x0, -0x1c(%rbp)
jmp 0x9584
jmp 0x9475
popq %rbp
retq
nopl (%rax,%rax)