// File: /workspace/github_c_makefile_star2_O0/ajpaulson[P]srogue11/state.c
// Function: rs_read_traps
int rs_read_traps(int inf, struct trap *trap, int count)
{
    int id = 0, value = 0, n = 0;

    if (rs_read_int(inf,&id) != 0)
    {
        if (id != RSID_TRAP)
        {
            printf("Invalid id. %x != %x(RSID_TRAP)\n",
                id,RSID_TRAP);
            printf("Sorry, invalid save game format");
            format_error = TRUE;
        }
        else if (rs_read_int(inf,&value) != 0)
        {
            if (value > count)
            {
                printf("Incorrect number of traps in block. %d > %d.",
                    value,count);
                printf("Sorry, invalid save game format\n");
                format_error = TRUE;
            }
            else
            {
                for(n=0;n<value;n++)
                {   
                    rs_read_coord(inf,&trap[n].tr_pos);
                    rs_read_coord(inf,&trap[n].tr_goto);
                    rs_read_int(inf,&trap[n].tr_flags);
                    rs_read_char(inf,&trap[n].tr_type);
                }
            }
        }
        else
            format_error = TRUE;
    }
    
    return(READSTAT);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movl -0x4(%rbp), %edi
leaq -0x18(%rbp), %rsi
callq 0x1c810
cmpl $0x0, %eax
je 0x1f41a
cmpl $0xabcd000c, -0x18(%rbp) # imm = 0xABCD000C
je 0x1f338
movl -0x18(%rbp), %esi
leaq 0xe4fb(%rip), %rdi      # 0x2d80a
movl $0xabcd000c, %edx       # imm = 0xABCD000C
movb $0x0, %al
callq 0x61b0
leaq 0xe156(%rip), %rdi      # 0x2d478
movb $0x0, %al
callq 0x61b0
movl $0x1, 0x1d5c5(%rip)     # 0x3c8f8
jmp 0x1f418
movl -0x4(%rbp), %edi
leaq -0x1c(%rbp), %rsi
callq 0x1c810
cmpl $0x0, %eax
je 0x1f40c
movl -0x1c(%rbp), %eax
cmpl -0x14(%rbp), %eax
jle 0x1f386
movl -0x1c(%rbp), %esi
movl -0x14(%rbp), %edx
leaq 0xe4c9(%rip), %rdi      # 0x2d82b
movb $0x0, %al
callq 0x61b0
leaq 0xe091(%rip), %rdi      # 0x2d401
movb $0x0, %al
callq 0x61b0
movl $0x1, 0x1d577(%rip)     # 0x3c8f8
jmp 0x1f40a
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x1c(%rbp), %eax
jge 0x1f408
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rsi
movslq -0x20(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rsi
callq 0x1d3a0
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rsi
movslq -0x20(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rsi
addq $0x8, %rsi
callq 0x1d3a0
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rsi
movslq -0x20(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rsi
addq $0x10, %rsi
callq 0x1c810
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rsi
movslq -0x20(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rsi
addq $0x14, %rsi
callq 0x1c760
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x1f38d
jmp 0x1f40a
jmp 0x1f416
movl $0x1, 0x1d4e2(%rip)     # 0x3c8f8
jmp 0x1f418
jmp 0x1f41a
xorl %eax, %eax
cmpl $0x0, 0x1d4d5(%rip)     # 0x3c8f8
movb %al, -0x21(%rbp)
jne 0x1f435
cmpl $0x0, 0x1d4c1(%rip)     # 0x3c8f0
sete %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
andb $0x1, %al
movzbl %al, %eax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)