// File: akshayrajput[P]ARMV8_Simulator/./instructions.cpp
// Function: ASR(int, int, int, int, int)
void ASR(int sf, int sw, int op1, int op2, int  op3 )
{
    if(sf)
    {
        if(sw == 0) //immediate
        {
	   printf("[log] - ASR 64 bit immediate\n");
            uint64_t op2_data = R[op2].getData();
            uint64_t dat;
            dat = op2_data >> op3;
            R[op1].setData(dat);
            
        }
        
        else //register
        {
            uint64_t op2_data = R[op2].getData();
            uint64_t op3_data = R[op3].getData();
            uint64_t dat;
            dat = op2_data >> op3_data;
            R[op1].setData(dat);
            
        }
    }
    
    else    //32 bit registers
    {
        if(sw == 0) //immediate
        {
	    printf("[log] - ASR instruction - 32 bit \n");
            int op2_data = R[op2].getLowerData();
            int dat;
            dat = op2_data >> op3;
            R[op1].setLowerData(dat);
        }
        
        else    //register
        {
            int op2_data = R[op2].getLowerData();
            int op3_data = R[op3].getLowerData();
            int dat;
            dat = op2_data >> op3_data;
            R[op1].setLowerData(dat);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl %edi, -0x4(%rbp)
movl %esi, -0x8(%rbp)
movl %edx, -0xc(%rbp)
movl %ecx, -0x10(%rbp)
movl %r8d, -0x14(%rbp)
cmpl $0x0, -0x4(%rbp)
je 0x1d61
cmpl $0x0, -0x8(%rbp)
jne 0x1cfc
leaq 0x95dd(%rip), %rdi      # 0xb28c
movb $0x0, %al
callq 0x1030
movslq -0x10(%rbp), %rax
leaq 0xc41f(%rip), %rdi      # 0xe0e0
shlq $0x3, %rax
addq %rax, %rdi
callq 0xa6c0
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movl -0x14(%rbp), %ecx
shrq %cl, %rax
movq %rax, -0x28(%rbp)
movslq -0xc(%rbp), %rax
leaq 0xc3f6(%rip), %rdi      # 0xe0e0
shlq $0x3, %rax
addq %rax, %rdi
movq -0x28(%rbp), %rsi
callq 0xa710
jmp 0x1d5c
movslq -0x10(%rbp), %rax
leaq 0xc3d9(%rip), %rdi      # 0xe0e0
shlq $0x3, %rax
addq %rax, %rdi
callq 0xa6c0
movq %rax, -0x30(%rbp)
movslq -0x14(%rbp), %rax
leaq 0xc3be(%rip), %rdi      # 0xe0e0
shlq $0x3, %rax
addq %rax, %rdi
callq 0xa6c0
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq -0x38(%rbp), %rcx
shrq %cl, %rax
movq %rax, -0x40(%rbp)
movslq -0xc(%rbp), %rax
leaq 0xc394(%rip), %rdi      # 0xe0e0
shlq $0x3, %rax
addq %rax, %rdi
movq -0x40(%rbp), %rsi
callq 0xa710
jmp 0x1e11
cmpl $0x0, -0x8(%rbp)
jne 0x1db6
leaq 0x953c(%rip), %rdi      # 0xb2aa
movb $0x0, %al
callq 0x1030
movslq -0x10(%rbp), %rax
leaq 0xc360(%rip), %rdi      # 0xe0e0
shlq $0x3, %rax
addq %rax, %rdi
callq 0xa6e0
movl %eax, -0x44(%rbp)
movl -0x44(%rbp), %eax
movl -0x14(%rbp), %ecx
sarl %cl, %eax
movl %eax, -0x48(%rbp)
movslq -0xc(%rbp), %rax
leaq 0xc33b(%rip), %rdi      # 0xe0e0
shlq $0x3, %rax
addq %rax, %rdi
movl -0x48(%rbp), %esi
callq 0xa730
jmp 0x1e0f
movslq -0x10(%rbp), %rax
leaq 0xc31f(%rip), %rdi      # 0xe0e0
shlq $0x3, %rax
addq %rax, %rdi
callq 0xa6e0
movl %eax, -0x4c(%rbp)
movslq -0x14(%rbp), %rax
leaq 0xc305(%rip), %rdi      # 0xe0e0
shlq $0x3, %rax
addq %rax, %rdi
callq 0xa6e0
movl %eax, -0x50(%rbp)
movl -0x4c(%rbp), %eax
movl -0x50(%rbp), %ecx
sarl %cl, %eax
movl %eax, -0x54(%rbp)
movslq -0xc(%rbp), %rax
leaq 0xc2e0(%rip), %rdi      # 0xe0e0
shlq $0x3, %rax
addq %rax, %rdi
movl -0x54(%rbp), %esi
callq 0xa730
jmp 0x1e11
addq $0x60, %rsp
popq %rbp
retq
nopw (%rax,%rax)