// File: /workspace/github_c_makefile_star2_O0/gregtour[P]minimal-compiler/tables.c
// Function: DecompressActionTable
void DecompressActionTable(int* source_data, ACTION* 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;
    ACTION copy_value;
    copy_value.type = 0;
    copy_value.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].type = source_data[read_index];
                read_index++;
                dest_data[index].value = source_data[read_index];
                read_index++;
                index++;
                lengthRep--;
            }
            lengthRep = 0;
            mode = 1;
        } 
        else if (mode == 1) 
        {
            lengthRep = source_data[read_index];
            read_index++;
            copy_value.type = source_data[read_index];
            read_index++;
            copy_value.value = source_data[read_index];
            read_index++;
            while (lengthRep && index < total_size)
            {
                dest_data[index].type = copy_value.type;
                dest_data[index].value = copy_value.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, -0x30(%rbp)
movl $0x0, -0x2c(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x18(%rbp), %eax
jae 0x972a
cmpl $0x0, -0x1c(%rbp)
jne 0x967a
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, -0x31(%rbp)
je 0x960f
movl -0x20(%rbp), %eax
cmpl -0x18(%rbp), %eax
setb %al
movb %al, -0x31(%rbp)
movb -0x31(%rbp), %al
testb $0x1, %al
jne 0x9618
jmp 0x9667
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,8)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movq -0x8(%rbp), %rax
movl -0x24(%rbp), %ecx
movl (%rax,%rcx,4), %edx
movq -0x10(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %edx, 0x4(%rax,%rcx,8)
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x28(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x95f8
movl $0x0, -0x28(%rbp)
movl $0x1, -0x1c(%rbp)
jmp 0x9725
cmpl $0x1, -0x1c(%rbp)
jne 0x9723
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, -0x30(%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, -0x32(%rbp)
je 0x96dd
movl -0x20(%rbp), %eax
cmpl -0x18(%rbp), %eax
setb %al
movb %al, -0x32(%rbp)
movb -0x32(%rbp), %al
testb $0x1, %al
jne 0x96e6
jmp 0x9715
movl -0x30(%rbp), %edx
movq -0x10(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %edx, (%rax,%rcx,8)
movl -0x2c(%rbp), %edx
movq -0x10(%rbp), %rax
movl -0x20(%rbp), %ecx
movl %edx, 0x4(%rax,%rcx,8)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
movl -0x28(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x96c6
movl $0x0, -0x28(%rbp)
movl $0x0, -0x1c(%rbp)
jmp 0x9725
jmp 0x95cc
popq %rbp
retq
nopl (%rax)